From f9e5f560ac174744673a467962ee0f112349e9da Mon Sep 17 00:00:00 2001 From: stefanjones Date: Thu, 26 Jun 2003 13:11:23 +0000 Subject: [PATCH] Modified Files: Makefile mod_lex.l mod_yacc.y pp_lst.c pp_mod.c read_ifs.c Fixed up -lst so it works like Spice Opus and finally fix char *yytext not char yytext[]; Call yyrestart(NULL) at the end of each yyparse to reset state. --- src/xspice/cmpp/mod_lex.l | 1 - src/xspice/cmpp/mod_yacc.y | 9 +-------- src/xspice/cmpp/pp_lst.c | 8 ++++---- src/xspice/cmpp/pp_mod.c | 3 ++- src/xspice/cmpp/read_ifs.c | 4 +++- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/xspice/cmpp/mod_lex.l b/src/xspice/cmpp/mod_lex.l index f6d8c450b..bccbb33aa 100755 --- a/src/xspice/cmpp/mod_lex.l +++ b/src/xspice/cmpp/mod_lex.l @@ -1,6 +1,5 @@ %option yylineno %option noyywrap -%array %{ /* $Id$ */ /*============================================================================ diff --git a/src/xspice/cmpp/mod_yacc.y b/src/xspice/cmpp/mod_yacc.y index b16e6df35..2a6e88f6c 100755 --- a/src/xspice/cmpp/mod_yacc.y +++ b/src/xspice/cmpp/mod_yacc.y @@ -52,17 +52,11 @@ NON-STANDARD FEATURES Ifs_Table_t *mod_ifs_table; -extern char mod_yytext[]; +extern char *mod_yytext; extern FILE* mod_yyout; -/* saj - use standard includes */ #include #include -/* -extern char *strdup(char*); -extern int strlen(char*); -extern char *strcat(char*, char*); -*/ int mod_num_errors; @@ -251,7 +245,6 @@ static int check_id (Sub_Id_t sub_id, Id_Kind_t kind, Boolean_t do_subscript) sub_id.id); yyerror (error_str); mod_num_errors++; - abort(); return -1; } diff --git a/src/xspice/cmpp/pp_lst.c b/src/xspice/cmpp/pp_lst.c index 99f9495d5..69a9b091c 100755 --- a/src/xspice/cmpp/pp_lst.c +++ b/src/xspice/cmpp/pp_lst.c @@ -784,7 +784,7 @@ static Status_t write_CMextrn( /* Open the file to be written */ - fp = fopen("CMextrn.h", "w"); + fp = fopen("cmextrn.h", "w"); if(fp == NULL) { print_error("ERROR - Problems opening CMextrn.h for write"); return(ERROR); @@ -824,7 +824,7 @@ static Status_t write_CMinfo( /* Open the file to be written */ - fp = fopen("CMinfo.h", "w"); + fp = fopen("cminfo.h", "w"); if(fp == NULL) { print_error("ERROR - Problems opening CMinfo.h for write"); return(ERROR); @@ -868,7 +868,7 @@ static Status_t write_UDNextrn( /* Open the file to be written */ - fp = fopen("UDNextrn.h", "w"); + fp = fopen("udnextrn.h", "w"); if(fp == NULL) { print_error("ERROR - Problems opening UDNextrn.h for write"); return(ERROR); @@ -910,7 +910,7 @@ static Status_t write_UDNinfo( /* Open the file to be written */ - fp = fopen("UDNinfo.h", "w"); + fp = fopen("udninfo.h", "w"); if(fp == NULL) { print_error("ERROR - Problems opening UDNinfo.h for write"); return(ERROR); diff --git a/src/xspice/cmpp/pp_mod.c b/src/xspice/cmpp/pp_mod.c index 845a88322..722529b7f 100755 --- a/src/xspice/cmpp/pp_mod.c +++ b/src/xspice/cmpp/pp_mod.c @@ -163,6 +163,7 @@ void preprocess_mod_file ( exit (1); } fclose (mod_yyout); + mod_yyrestart(NULL); } /*---------------------------------------------------------------------------*/ @@ -170,7 +171,7 @@ int mod_yyerror (str) char *str; { extern int mod_yylineno; - extern char mod_yytext[]; + extern char *mod_yytext; extern char *current_filename; extern char *prog_name; diff --git a/src/xspice/cmpp/read_ifs.c b/src/xspice/cmpp/read_ifs.c index 40071f5ce..abcb6c5b6 100755 --- a/src/xspice/cmpp/read_ifs.c +++ b/src/xspice/cmpp/read_ifs.c @@ -155,8 +155,10 @@ static Status_t read_ifs_table( if (ifs_yyparse()) { print_error ("Error parsing interface specification file"); + ifs_yyrestart(NULL); return ERROR; } + ifs_yyrestart(NULL); return OK; } @@ -165,7 +167,7 @@ int ifs_yyerror (str) char *str; { extern int ifs_yylineno; - extern char ifs_yytext[]; + extern char *ifs_yytext; fprintf (stderr, "%s: Error: \"%s\": line %d (near \'%s\'):\n\t%s.\n", prog_name, current_filename, ifs_yylineno, ifs_yytext, str);