00001 /* 00002 * File: cw_macro_token_expander.cc 00003 * $Id: cw_macro_token_expander.cc,v 1.2 2002/05/08 10:33:32 alec Exp $ 00004 * 00005 * Author: Alec Panoviciu (alecu@email.com) 00006 * 00007 * Comments: 00008 * 00009 * Revision history: 00010 * 00011 * $Log: cw_macro_token_expander.cc,v $ 00012 * Revision 1.2 2002/05/08 10:33:32 alec 00013 * *** empty log message *** 00014 * 00015 * Revision 1.1 2002/04/29 17:57:35 alec 00016 * *** empty log message *** 00017 * 00018 */ 00019 00020 /* 00021 Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com) 00022 00023 This program is free software; you can redistribute it and/or modify 00024 it under the terms of the GNU General Public License as published by 00025 the Free Software Foundation; either version 2 of the License, or 00026 (at your option) any later version. 00027 00028 This program is distributed in the hope that it will be useful, 00029 but WITHOUT ANY WARRANTY; without even the implied warranty of 00030 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00031 GNU General Public License for more details. 00032 00033 You should have received a copy of the GNU General Public License 00034 along with this program; if not, write to the Free Software 00035 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00036 00037 */ 00038 00039 #include "cw_macro_token_expander.h" 00040 #include "macro_token_expander.hh" 00041 00042 00043 MacroTokenExpander* cw_macroTokenExpander = NULL; 00044 00045 CLINK void MacroTokenExpander_addMacro (char *name_, void *regexp_) 00046 { 00047 ASSERT(((name_ != NULL) && (regexp_ != NULL)), 00048 "Bad argument to MacroTokenExpander_addMacro"); 00049 cw_macroTokenExpander->addMacro(string(name_), static_cast<ReNode*>(regexp_), 00050 Position(yylineno)); 00051 } 00052 00053 CLINK void* MacroTokenExpander_getMacro (char *name_) 00054 { 00055 ASSERT((name_ != NULL), 00056 "Bad argument to MacroTokenExpander_addMacro"); 00057 try { 00058 return cw_macroTokenExpander->getMacro(string(name_)); 00059 } catch (ParseException &ex) 00060 { 00061 die(formatError(Position(yylineno), ex)); 00062 } 00063 }