www.pudn.com > cppcc.rar > cw_misc.cc
/*
* File: cw_misc.cc
* $Id: cw_misc.cc,v 1.3 2002/05/10 07:15:10 alec Exp $
*
* Author: Alec Panoviciu (alecu@email.com)
*
* Comments:
*
* Revision history:
*
* $Log: cw_misc.cc,v $
* Revision 1.3 2002/05/10 07:15:10 alec
* parser parse tree ok
*
* Revision 1.2 2002/04/29 17:55:41 alec
* regexps almost done
*
* Revision 1.1 2002/04/29 09:40:01 alec
* *** empty log message ***
*
*/
/*
Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define CLIST_IMPLEMENT_HERE
#include "cw_misc.h"
#include "debug.h"
#include "parse_util.hh"
#include "catch_clause.hh"
extern int yylineno;
CLINK void deleteCstring (Cstring *s)
{
free(s);
}
CLINK void deleteCwCharClass (CwCharClass *c)
{
free(c);
}
CLINK void deleteCwCatchClause (CwCatchClause *ptr)
{
delete static_cast(ptr);
}
CLINK void yyerror (char *message)
{
die(formatError(Position(yylineno), message));
}
CLINK void yywarn (char *message)
{
die(formatWarning(Position(yylineno), message));
}
CLINK void cw_die (char *message)
{
die(message);
}
vector* CstringList2vector (CstringList l)
{
vector *v = new vector;
CstringList i;
for (i = l; i != NULL; i = i->next)
v->push_back(string(i->data));
return v;
}
vector* CwCharClassList2vector (CwCharClassList l)
{
vector *v = new vector;
CwCharClassList i;
for (i = l; i != NULL; i = i->next)
v->push_back(CharClassDescriptor(i->data->first, i->data->last));
return v;
}