From 49043182902e83f1a994d9a57c7441049b72129f Mon Sep 17 00:00:00 2001 From: cas Date: Fri, 5 Nov 1999 18:28:10 +0000 Subject: [PATCH] No comments --- src/EDL/EDL.cxx | 4 +++- src/EDL/EDL.lex | 24 +++++++++++++----------- src/EDL/EDL.yacc | 5 ++++- src/EDL/EDL_Interpretor.cxx | 25 +++++++++++-------------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/EDL/EDL.cxx b/src/EDL/EDL.cxx index 765e163..598f266 100755 --- a/src/EDL/EDL.cxx +++ b/src/EDL/EDL.cxx @@ -23,7 +23,7 @@ Standard_EXPORT void EDL_SetErrorMsgHandler(void (*aMsgHandler) (Standard_CStrin void EDL::PrintError(const EDL_Error anError, const Standard_CString anArg) { char *format; - char *errortext; + char *errortext = ""; if (EDLlineno >= 0) { format = "%s : line %d : %s%s\n"; @@ -55,6 +55,8 @@ void EDL::PrintError(const EDL_Error anError, const Standard_CString anArg) break; case EDL_TOOMANYINCLUDELEVEL: errortext = "Too many include levels : "; break; + case EDL_FILENOTFOUND: errortext = "File not found : "; + break; } if(!EDL_ErrorMsgHandler) { diff --git a/src/EDL/EDL.lex b/src/EDL/EDL.lex index 01c23a9..fd6eb61 100755 --- a/src/EDL/EDL.lex +++ b/src/EDL/EDL.lex @@ -2,20 +2,23 @@ %{ #include #include +#ifdef WNT +# include +#else +# include +#endif /* WNT */ #define yylval EDLlval #include #include +#ifndef YY_NO_UNPUT +# define YY_NO_UNPUT +#endif /* YY_NO_UNPUT */ + #define MAX_CHAR 256 /* The limit of a identifier. */ #define MAX_STRING (MAX_CHAR * 10) /* The limit of a string. */ #define MAX_COMMENT (MAX_CHAR * 300) /* The limit of comment line */ -static char identifier[MAX_CHAR +1]; -static char integer [MAX_CHAR +1]; -static char real [MAX_CHAR +1]; -static char literal [MAX_CHAR +1]; -static char string [MAX_STRING +1]; - char FileName[11][256]; FILE *FileDesc[10]; int LineStack[10]; @@ -81,12 +84,12 @@ is { if (VerboseMode && edl_must_execute()) print @unset { if (VerboseMode && edl_must_execute()) printf("%d. @unset ",EDLlineno); return(UNSET); } @ifdefined { if (VerboseMode && edl_must_execute()) printf("%d. @ifdefined ",EDLlineno); return(IFDEFINED); } @ifnotdefined { if (VerboseMode && edl_must_execute()) printf("%d. @ifnotdefined ",EDLlineno); return(IFNOTDEFINED); } -defined { if (VerboseMode && edl_must_execute()) printf(" defined ",EDLlineno); return(INSTRDEFINED); } -notdefined { if (VerboseMode && edl_must_execute()) printf(" notdefined ",EDLlineno); return(INSTRNOTDEFINED); } +defined { if (VerboseMode && edl_must_execute()) printf("%d. defined ",EDLlineno); return(INSTRDEFINED); } +notdefined { if (VerboseMode && edl_must_execute()) printf("%d. notdefined ",EDLlineno); return(INSTRNOTDEFINED); } @iffile { if (VerboseMode && edl_must_execute()) printf("%d. @iffile ",EDLlineno); return(IFFILE); } @ifnotfile { if (VerboseMode && edl_must_execute()) printf("%d. @ifnotfile ",EDLlineno); return(IFNOTFILE); } -file { if (VerboseMode && edl_must_execute()) printf(" file ",EDLlineno); return(INSTRFILE); } -notfile { if (VerboseMode && edl_must_execute()) printf(" notfile ",EDLlineno); return(INSTRNOTFILE); } +file { if (VerboseMode && edl_must_execute()) printf("%d file ",EDLlineno); return(INSTRFILE); } +notfile { if (VerboseMode && edl_must_execute()) printf("%d notfile ",EDLlineno); return(INSTRNOTFILE); } @if { if (VerboseMode && edl_must_execute()) printf("%d. @if ",EDLlineno); return(IF); } then { if (VerboseMode && edl_must_execute()) printf(" then\n"); return(THEN); } @else { if (VerboseMode && edl_must_execute()) printf("@else\n"); return(ELSE); } @@ -138,7 +141,6 @@ void EDL_SetFile() /* we need this for '@uses' clause */ int EDLwrap() { - char c[2]; edlstring _currentFile; if (numFileDesc < 0) { diff --git a/src/EDL/EDL.yacc b/src/EDL/EDL.yacc index 987afd7..a32f710 100755 --- a/src/EDL/EDL.yacc +++ b/src/EDL/EDL.yacc @@ -1,11 +1,14 @@ %{ #include +#include /* all parser must define this variable */ #define yyv EDLv +extern int EDLlex(); +extern void EDLerror (); extern FILE *FileDesc[]; -extern numFileDesc; +extern int numFileDesc; extern FILE *EDLin; /* extern int edl_must_execute(); */ diff --git a/src/EDL/EDL_Interpretor.cxx b/src/EDL/EDL_Interpretor.cxx index d8527c7..5788f7e 100755 --- a/src/EDL/EDL_Interpretor.cxx +++ b/src/EDL/EDL_Interpretor.cxx @@ -24,8 +24,8 @@ extern "C" { #endif -extern "C" {EDLparse();} -extern "C" {EDLlex();} +extern "C" {int EDLparse();} +extern "C" {int EDLlex();} extern "C" {void EDL_SetFile();} #ifndef WNT @@ -33,13 +33,13 @@ extern FILE *EDLin; extern int EDLlineno; extern char *EDLtext; extern char FileName[][256]; -extern numFileDesc; +extern int numFileDesc; #else extern "C" FILE *EDLin; extern "C" int EDLlineno; extern "C" char *EDLtext; extern "C" char FileName[][256]; -extern "C" numFileDesc; +extern "C" int numFileDesc; #endif // WNT extern "C" { @@ -136,8 +136,7 @@ EDL_Error EDL_Interpretor::Parse(const Standard_CString aFile) { GlobalInter = this; Standard_Boolean IsFound = Standard_False; - Standard_Integer DirCount = 1, - LenName = strlen(aFile); + Standard_Integer DirCount = 1; Handle(TColStd_HSequenceOfAsciiString) IncludeDirectory = GlobalInter->GetIncludeDirectory(); @@ -145,7 +144,7 @@ EDL_Error EDL_Interpretor::Parse(const Standard_CString aFile) FILE *fic = 0L; DirCount = 1; - if (fic = fopen(aFile,"r")) { + if ( ( fic = fopen ( aFile, "r" ) ) != NULL ) { IsFound = Standard_True; } @@ -162,7 +161,7 @@ EDL_Error EDL_Interpretor::Parse(const Standard_CString aFile) if ( GetFileAttributes(tmpName) != 0xFFFFFFFF ) #endif { - if (fic = fopen(tmpName,"r")) { + if ( ( fic = fopen ( tmpName, "r" ) ) != NULL ) { IsFound = Standard_True; } } @@ -359,8 +358,7 @@ Standard_Boolean EDL_Interpretor::IsFile(const Standard_CString aFileName) const TCollection_AsciiString fname(aFileName); Standard_Boolean IsFound = Standard_False; - Standard_Integer DirCount = 1, - LenName = fname.Length(); + Standard_Integer DirCount = 1; Handle(TColStd_HSequenceOfAsciiString) IncludeDirectory = GetIncludeDirectory(); @@ -1661,12 +1659,12 @@ void edl_close_file(const edlstring varname) #ifndef WNT extern FILE *FileDesc[]; extern int LineStack[]; - extern numFileDesc; + extern int numFileDesc; extern FILE *EDLin; #else extern "C" FILE *FileDesc[]; extern "C" int LineStack[]; - extern "C" numFileDesc; + extern "C" int numFileDesc; extern "C" FILE *EDLin; #endif // WNT @@ -1691,8 +1689,7 @@ void edl_uses_var(const edlstring var) void edl_uses(const edlstring filename) { Standard_Boolean IsFound = Standard_False; - Standard_Integer DirCount = 1, - LenName = filename.length; + Standard_Integer DirCount = 1; Handle(TColStd_HSequenceOfAsciiString) IncludeDirectory = GlobalInter->GetIncludeDirectory(); -- 2.39.5