Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

cw_misc.cc

Go to the documentation of this file.
00001 /*
00002  *  File:       cw_misc.cc
00003  *              $Id: cw_misc.cc,v 1.3 2002/05/10 07:15:10 alec Exp $
00004  *
00005  *  Author:     Alec Panoviciu (alecu@email.com)
00006  *
00007  *  Comments:
00008  *
00009  *  Revision history:
00010  *
00011  *  $Log: cw_misc.cc,v $
00012  *  Revision 1.3  2002/05/10 07:15:10  alec
00013  *  parser parse tree ok
00014  *
00015  *  Revision 1.2  2002/04/29 17:55:41  alec
00016  *  regexps almost done
00017  *
00018  *  Revision 1.1  2002/04/29 09:40:01  alec
00019  *  *** empty log message ***
00020  *
00021  */
00022 
00023 /* 
00024   Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
00025 
00026   This program is free software; you can redistribute it and/or modify
00027   it under the terms of the GNU General Public License as published by
00028   the Free Software Foundation; either version 2 of the License, or
00029   (at your option) any later version.
00030 
00031   This program is distributed in the hope that it will be useful,
00032   but WITHOUT ANY WARRANTY; without even the implied warranty of
00033   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00034   GNU General Public License for more details.
00035 
00036   You should have received a copy of the GNU General Public License
00037   along with this program; if not, write to the Free Software
00038   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00039 
00040  */
00041 
00042 
00043 #define CLIST_IMPLEMENT_HERE
00044 #include "cw_misc.h"
00045 
00046 #include "debug.h"
00047 #include "parse_util.hh"
00048 #include "catch_clause.hh"
00049 
00050 extern int yylineno;
00051 
00052 CLINK void deleteCstring (Cstring *s)
00053 {
00054   free(s);
00055 }
00056 
00057 CLINK void deleteCwCharClass (CwCharClass *c)
00058 {
00059   free(c);
00060 }
00061 
00062 CLINK void deleteCwCatchClause (CwCatchClause *ptr)
00063 {
00064   delete static_cast<CatchClause*>(ptr);
00065 }
00066 
00067 
00068 CLINK void yyerror (char *message)
00069 {
00070   die(formatError(Position(yylineno), message));
00071 }
00072 
00073 
00074 CLINK void yywarn (char *message)
00075 {
00076   die(formatWarning(Position(yylineno), message));
00077 }
00078 
00079 
00080 CLINK void cw_die (char *message)
00081 {
00082   die(message);
00083 }
00084 
00085 vector<string>* CstringList2vector (CstringList l)
00086 {
00087   vector<string> *v = new vector<string>;
00088   CstringList i;
00089 
00090   for (i = l; i != NULL; i = i->next)
00091     v->push_back(string(i->data));
00092 
00093   return v;
00094 }
00095 
00096 vector<CharClassDescriptor>* CwCharClassList2vector (CwCharClassList l)
00097 {
00098   vector<CharClassDescriptor> *v = new vector<CharClassDescriptor>;
00099   CwCharClassList i;
00100   
00101   for (i = l; i != NULL; i = i->next)
00102     v->push_back(CharClassDescriptor(i->data->first, i->data->last));
00103 
00104   return v;
00105 }

Generated at Tue Jul 9 21:05:43 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001