00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 00003 /* ArchC Pre-processor generates tools for the described arquitecture 00004 Copyright (C) 2002-2004 The ArchC Team 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 */ 00016 00017 /********************************************************/ 00018 /* Acpp.c: The ArchC pre-processor. */ 00019 /* Author: Sandro Rigo */ 00020 /* Date: 16-07-2002 */ 00021 /* */ 00022 /* The ArchC Team */ 00023 /* Computer Systems Laboratory (LSC) */ 00024 /* IC-UNICAMP */ 00025 /* http://www.lsc.ic.unicamp.br */ 00026 /********************************************************/ 00028 00035 00036 00037 #include "acpp.h" 00038 /* #include <stdlib.h> */ 00039 #include <stdio.h> 00040 00041 extern int yyparse(); 00042 extern FILE *yyin; 00043 //extern int *yydebug 00044 extern int line_num; 00045 00049 void acppInit() 00050 { 00051 //Initialize to 1 for parser debug 00052 // *yydebug =1; 00053 00054 yyin = NULL; 00055 } 00056 00057 00061 int acppLoad(char *filename) 00062 { 00063 acppUnload(); 00064 return (int) (yyin = fopen(filename, "r" )); 00065 } 00066 00067 00071 void acppUnload() 00072 { 00073 if (yyin != NULL) fclose(yyin); 00074 yyin = NULL; 00075 } 00076 00077 00081 int acppRun() 00082 { 00083 line_num = 1; 00084 return yyparse(); 00085 } 00086 00087