diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0cc5598df7..a87adc4a01 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,16 @@ +19991121-22:38 GMT+1 Victor Szel + * source/pp/* + source/compiler/harbour.c + include/hbpp.h + ! static variables and functions marked static. + * Cleared up declarations, removed redundant declartions. + * Some formatting. + * source/pp/hbpp.c + ! Some corrections made to better handle where the code launcher + returns to the caller. This is a theoretical case, but it's more + elegant to handle this case, and it would also help to avoid a jmp_buf + trick in the library callable version of the PP. + 19991121-17:50 GMT+1 Bruno Cantero * include/rddapi.h source/rdd/dbcmd.c diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index cb85a3e2b1..2e73170b6a 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -74,36 +74,44 @@ typedef struct _COMMANDS /* HBPP.C exported functions */ -extern int ParseDirective( char * ); -extern int ParseExpression( char *, char * ); +extern int Hp_Parse( FILE *, FILE *, char * ); +extern int ParseDirective( char * ); /* Parsing preprocessor directives ( #... ) */ +extern int ParseExpression( char *, char * ); /* Parsing a line ( without preprocessor directive ) */ extern int pp_RdStr( FILE *, char *, int, int, char *, int *, int * ); extern int pp_WrStr( FILE *, char * ); +extern int pp_strAt( char *, int, char *, int ); +extern void pp_Stuff( char *, char *, int, int, int ); extern int strolen( char * ); extern int strocpy( char *, char * ); extern char * strodup( char * ); -extern DEFINES * AddDefine( char * szDefine, char * szValue ); /* add a new Lex define from the command line */ +extern DEFINES * AddDefine( char *, char * ); /* Add new #define to a linked list */ + +/* HBPPINT.C exported functions */ + +extern void Hbpp_init ( void ); +extern int PreProcess( FILE *, FILE *, char * ); /* HBPP.C exported variables */ extern int lInclude; -extern int * aCondCompile, nCondCompile; +extern int * aCondCompile; +extern int nCondCompile; extern int nline; - extern char * _szPErrors[]; extern char * _szPWarnings[]; +/* TABLE.C exported variables */ + +extern DEFINES * topDefine; +extern COMMANDS * topCommand; +extern COMMANDS * topTranslate; + /* Needed support modules, but not contained in HBPP.C */ extern void * hb_xgrab( ULONG lSize ); /* allocates memory, exists on failure */ extern void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */ extern void hb_xfree( void * pMem ); /* frees memory */ -/* Needed support variables, but not contained in HBPP.C */ - -extern DEFINES * topDefine; -extern COMMANDS * topCommand; -extern COMMANDS * topTranslate; - #include "compiler.h" #endif /* HB_PP_H_ */ diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index b127504a81..85cf7efaee 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -60,9 +60,6 @@ typedef enum extern int harbour_main( char *szName ); extern BOOL Include( char * szFileName, PATHNAMES * pSearchPath ); /* end #include support */ - /* Following line added for preprocessor */ -extern void Hbpp_init ( void ); - /* output related functions */ extern void GenCCode( PHB_FNAME ); /* generates the C language output */ extern void GenJava( PHB_FNAME ); /* generates the Java language output */ diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index c436257e0e..973d971e69 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -37,19 +37,19 @@ * Avoid tracing in preprocessor/compiler. */ #if ! defined(HB_TRACE_UTILS) -#if defined(HB_TRACE_LEVEL) -#undef HB_TRACE_LEVEL -#endif + #if defined(HB_TRACE_LEVEL) + #undef HB_TRACE_LEVEL + #endif #endif #include #if ( defined(_MSC_VER) || defined(__IBMCPP__) || defined(__MINGW32_) ) -#include + #include #elif defined(__GNUC__) -#include -#include + #include + #include #else -#include + #include #endif #include @@ -57,59 +57,47 @@ #include "hbpp.h" #include "hberrors.h" -int Hp_Parse( FILE*, FILE*, char * ); -int ParseDirective( char* ); /* Parsing preprocessor directives ( #... ) */ -int ParseDefine( char* ); /* Process #define directive */ -DEFINES* AddDefine ( char*, char* ); /* Add new #define to a linked list */ -int ParseUndef( char* ); /* Process #undef directive */ -int ParseIfdef( char*, int); /* Process #ifdef directive */ -void ParseCommand( char*, int, int ); /* Process #command or #translate directive */ -void ConvertPatterns ( char*, int, char*, int ); /* Converting result pattern in #command and #translate */ -COMMANDS* AddCommand ( char * ); /* Add new #command to an array */ -COMMANDS* AddTranslate ( char * ); /* Add new #translate to an array */ -int ParseExpression( char*, char* ); /* Parsing a line ( without preprocessor directive ) */ -int WorkDefine ( char**, char*, DEFINES * ); /* Replace fragment of code with a #defined result text */ -int WorkPseudoF ( char**, char*, DEFINES*); /* Replace pseudofunction with a #defined result text */ -int WorkCommand ( char*, char*, COMMANDS* ); -int WorkTranslate ( char*, char*, COMMANDS*, int* ); -int CommandStuff ( char *, char *, char *, int*, int, int ); -int RemoveSlash( char * ); -int WorkMarkers( char**, char**, char*, int*, int ); -int getExpReal ( char *, char **, int, int ); -int isExpres ( char* ); -int TestOptional( char*, char* ); -int CheckOptional( char*, char*, char*, int*, int, int ); -void SkipOptional( char** ); +static int ParseDefine( char * ); /* Process #define directive */ +static int ParseUndef( char * ); /* Process #undef directive */ +static int ParseIfdef( char *, int ); /* Process #ifdef directive */ +static void ParseCommand( char *, int, int ); /* Process #command or #translate directive */ +static void ConvertPatterns( char *, int, char *, int ); /* Converting result pattern in #command and #translate */ +static COMMANDS * AddCommand( char * ); /* Add new #command to an array */ +static COMMANDS * AddTranslate( char * ); /* Add new #translate to an array */ +static int WorkDefine( char **, char *, DEFINES * ); /* Replace fragment of code with a #defined result text */ +static int WorkPseudoF( char **, char *, DEFINES * ); /* Replace pseudofunction with a #defined result text */ +static int WorkCommand( char *, char *, COMMANDS * ); +static int WorkTranslate( char *, char *, COMMANDS *, int * ); +static int CommandStuff( char *, char *, char *, int *, int, int ); +static int RemoveSlash( char * ); +static int WorkMarkers( char **, char **, char *, int *, int ); +static int getExpReal( char *, char **, int, int ); +static int isExpres( char * ); +static int TestOptional( char *, char * ); +static int CheckOptional( char *, char *, char *, int *, int, int ); +static void SkipOptional( char ** ); -DEFINES* DefSearch(char *, int*); -COMMANDS* ComSearch( char *, COMMANDS* ); -COMMANDS* TraSearch( char *, COMMANDS* ); -void SearnRep( char*,char*,int,char*,int*); -int ReplacePattern ( char, char*, int, char*, int ); -void pp_rQuotes( char *, char * ); -int pp_RdStr(FILE*,char *,int,int,char*,int*,int*); -int pp_WrStr(FILE*,char *); -int pp_strAt(char *, int, char*, int); -int md_strAt(char *, int, char*, int, int); -char* PrevSquare( char* , char*, int* ); -int IsInStr ( char, char*); -void pp_Stuff (char*, char*, int, int, int); -int strocpy (char*, char* ); -int stroncpy (char*, char*, int); -int strincpy (char*, char*); -int truncmp (char**, char**, int); -int strincmp (char*, char**, int); -int strolen ( char* ); -void stroupper ( char* ); -int strotrim ( char* ); -char* strodup ( char * ); -int NextWord ( char**, char*, int); -int NextName ( char**, char* ); -int NextParm ( char**, char* ); -int Include( char *, PATHNAMES *, FILE** ); -BOOL OpenInclude( char *, PATHNAMES *, FILE**, BOOL bStandardOnly, char * ); +static DEFINES * DefSearch( char *, int * ); +static COMMANDS * ComSearch( char *, COMMANDS * ); +static COMMANDS * TraSearch( char *, COMMANDS * ); +static void SearnRep( char *, char *, int, char *, int * ); +static int ReplacePattern( char, char *, int, char *, int ); +static void pp_rQuotes( char *, char * ); +static int md_strAt( char *, int, char *, int, int ); +static char * PrevSquare( char * , char *, int * ); +static int IsInStr( char, char * ); +static int stroncpy( char *, char *, int ); +static int strincpy( char *, char * ); +static int truncmp( char **, char **, int ); +static int strincmp( char *, char **, int ); +static void stroupper( char * ); +static int strotrim( char * ); +static int NextWord( char **, char *, int ); +static int NextName( char **, char * ); +static int NextParm( char **, char * ); +static BOOL OpenInclude( char *, PATHNAMES *, FILE**, BOOL bStandardOnly, char * ); -#define ISNAME(c) (isalnum(c) || (c)=='_' || (c) > 0x7e) +#define ISNAME( c ) ( isalnum( c ) || ( c ) == '_' || ( c ) > 0x7E ) #define MAX_NAME 255 #define MAX_EXP 1024 #define PATTERN_SIZE 2048 @@ -130,15 +118,19 @@ BOOL OpenInclude( char *, PATHNAMES *, FILE**, BOOL bStandardOnly, char * ); #define IT_COMMA 3 #define IT_ID_OR_EXPR 4 -int kolAddDefs = 0; -int ParseState = 0; +static int kolAddDefs = 0; +static int ParseState = 0; +static int maxCondCompile = 5; +static int aIsRepeate[ 5 ]; +static int Repeate; +static int lReplacePat = 1; +static int numBrackets; +static char groupchar; + int lInclude = 0; -int *aCondCompile, nCondCompile = 0, maxCondCompile = 5; -int nline=0; -int aIsRepeate[5], Repeate; -int lReplacePat = 1; -int numBrackets; -char groupchar; +int * aCondCompile; +int nCondCompile = 0; +int nline = 0; /* Table with parse errors */ char * _szPErrors[] = @@ -181,34 +173,34 @@ int ParseDirective( char* sLine ) SKIPTABSPACES(sLine); - if ( i == 4 && memcmp ( sDirective, "ELSE", 4 ) == 0 ) + if( i == 4 && memcmp( sDirective, "ELSE", 4 ) == 0 ) { /* --- #else --- */ - if ( nCondCompile == 0 ) + if( nCondCompile == 0 ) hb_compGenError( _szPErrors, 'F', ERR_DIRECTIVE_ELSE, NULL, NULL ); - else if ( nCondCompile == 1 || aCondCompile[nCondCompile-2] ) + else if( nCondCompile == 1 || aCondCompile[nCondCompile-2] ) aCondCompile[nCondCompile-1] = 1 - aCondCompile[nCondCompile-1]; } - else if ( i == 5 && memcmp ( sDirective, "ENDIF", 5 ) == 0 ) + else if( i == 5 && memcmp( sDirective, "ENDIF", 5 ) == 0 ) { /* --- #endif --- */ - if ( nCondCompile == 0 ) + if( nCondCompile == 0 ) hb_compGenError( _szPErrors, 'F', ERR_DIRECTIVE_ENDIF, NULL, NULL ); else nCondCompile--; } - else if ( i == 5 && memcmp ( sDirective, "IFDEF", 5 ) == 0 ) - ParseIfdef ( sLine, TRUE ); /* --- #ifdef --- */ + else if( i == 5 && memcmp( sDirective, "IFDEF", 5 ) == 0 ) + ParseIfdef( sLine, TRUE ); /* --- #ifdef --- */ - else if ( i == 6 && memcmp ( sDirective, "IFNDEF", 6 ) == 0 ) - ParseIfdef ( sLine, FALSE ); /* --- #ifndef --- */ + else if( i == 6 && memcmp( sDirective, "IFNDEF", 6 ) == 0 ) + ParseIfdef( sLine, FALSE ); /* --- #ifndef --- */ - else if ( nCondCompile==0 || aCondCompile[nCondCompile-1]) + else if( nCondCompile==0 || aCondCompile[nCondCompile-1]) { - if ( i == 7 && memcmp ( sDirective, "INCLUDE", 7 ) == 0 ) + if( i == 7 && memcmp( sDirective, "INCLUDE", 7 ) == 0 ) { /* --- #include --- */ char cDelimChar; - if ( *sLine != '\"' && *sLine != '\'' && *sLine != '<' ) + if( *sLine != '\"' && *sLine != '\'' && *sLine != '<' ) hb_compGenError( _szPErrors, 'F', ERR_WRONG_NAME, NULL, NULL ); cDelimChar = *sLine; @@ -218,12 +210,12 @@ int ParseDirective( char* sLine ) cDelimChar = '\''; sLine++; i = 0; - while ( *(sLine+i) != '\0' && *(sLine+i) != cDelimChar ) i++; - if ( *(sLine+i) != cDelimChar ) + while( *(sLine+i) != '\0' && *(sLine+i) != cDelimChar ) i++; + if( *(sLine+i) != cDelimChar ) hb_compGenError( _szPErrors, 'F', ERR_WRONG_NAME, NULL, NULL ); *(sLine+i) = '\0'; - /* if ((handl_i = fopen(sLine, "r")) == NULL) */ + /* if((handl_i = fopen(sLine, "r")) == NULL) */ if( OpenInclude( sLine, hb_comp_pIncludePath, &handl_i, ( cDelimChar == '>' ), szInclude ) ) { lInclude++; @@ -235,30 +227,30 @@ int ParseDirective( char* sLine ) hb_compGenError( _szPErrors, 'F', ERR_CANNOT_OPEN, sLine, NULL ); } - else if ( i == 6 && memcmp ( sDirective, "DEFINE", 6 ) == 0 ) - ParseDefine ( sLine ); /* --- #define --- */ + else if( i == 6 && memcmp( sDirective, "DEFINE", 6 ) == 0 ) + ParseDefine( sLine ); /* --- #define --- */ - else if ( i == 5 && memcmp ( sDirective, "UNDEF", 5 ) == 0 ) - ParseUndef ( sLine ); /* --- #undef --- */ + else if( i == 5 && memcmp( sDirective, "UNDEF", 5 ) == 0 ) + ParseUndef( sLine ); /* --- #undef --- */ - else if ( (i == 7 && memcmp ( sDirective, "COMMAND", 7 ) == 0) || - (i == 8 && memcmp ( sDirective, "XCOMMAND", 8 ) == 0) ) + else if( (i == 7 && memcmp( sDirective, "COMMAND", 7 ) == 0) || + (i == 8 && memcmp( sDirective, "XCOMMAND", 8 ) == 0) ) /* --- #command --- */ - ParseCommand ( sLine, (i==7)? FALSE:TRUE, TRUE ); + ParseCommand( sLine, (i==7)? FALSE:TRUE, TRUE ); - else if ( (i == 9 && memcmp ( sDirective, "TRANSLATE", 9 ) == 0) || - (i == 10 && memcmp ( sDirective, "XTRANSLATE", 10 ) == 0) ) + else if( (i == 9 && memcmp( sDirective, "TRANSLATE", 9 ) == 0) || + (i == 10 && memcmp( sDirective, "XTRANSLATE", 10 ) == 0) ) /* --- #translate --- */ - ParseCommand ( sLine, (i==9)? FALSE:TRUE, FALSE ); + ParseCommand( sLine, (i==9)? FALSE:TRUE, FALSE ); - else if ( i == 6 && memcmp ( sDirective, "STDOUT", 6 ) == 0 ) - printf ( "%s\n", sLine ); /* --- #stdout --- */ + else if( i == 6 && memcmp( sDirective, "STDOUT", 6 ) == 0 ) + printf( "%s\n", sLine ); /* --- #stdout --- */ - else if ( i == 5 && memcmp ( sDirective, "ERROR", 5 ) == 0 ) + else if( i == 5 && memcmp( sDirective, "ERROR", 5 ) == 0 ) /* --- #error --- */ hb_compGenError( _szPErrors, 'F', ERR_EXPLICIT, sLine, NULL ); - else if ( i == 4 && memcmp ( sDirective, "LINE", 4 ) == 0 ) + else if( i == 4 && memcmp( sDirective, "LINE", 4 ) == 0 ) return -1; else hb_compGenError( _szPErrors, 'F', ERR_WRONG_DIRECTIVE, sDirective, NULL ); @@ -266,7 +258,7 @@ int ParseDirective( char* sLine ) return 0; } -int ParseDefine( char* sLine) +static int ParseDefine( char* sLine) { char defname[MAX_NAME], pars[MAX_NAME]; int i, npars = -1; @@ -278,23 +270,23 @@ int ParseDefine( char* sLine) if( isalpha( *sLine ) || *sLine == '_' || *sLine > 0x7e ) { NextName( &sLine, defname ); - if ( *sLine == '(' ) /* If pseudofunction was found */ + if( *sLine == '(' ) /* If pseudofunction was found */ { sLine++; i = 0; npars = 0; - while ( *sLine != '\0' && *sLine != ')') + while( *sLine != '\0' && *sLine != ')') { - if ( *sLine == ',' ) npars++; - if ( *sLine != ' ' && *sLine != '\t' ) *(pars+i++) = *sLine; + if( *sLine == ',' ) npars++; + if( *sLine != ' ' && *sLine != '\t' ) *(pars+i++) = *sLine; sLine++; } - if ( i > 0 ) npars++; + if( i > 0 ) npars++; *(pars+i) = '\0'; sLine++; } SKIPTABSPACES(sLine); - lastdef = AddDefine ( defname, ( *sLine == '\0' )? NULL : sLine ); + lastdef = AddDefine( defname, ( *sLine == '\0' )? NULL : sLine ); lastdef->npars = npars; lastdef->pars = ( npars <= 0 )? NULL : strodup ( pars ); @@ -304,14 +296,14 @@ int ParseDefine( char* sLine) return 0; } -DEFINES* AddDefine ( char* defname, char* value ) +DEFINES * AddDefine( char * defname, char * value ) { int isNew; DEFINES* stdef = DefSearch( defname, &isNew ); HB_TRACE(HB_TR_DEBUG, ("AddDefine(%s, %s)", defname, value)); - if ( stdef != NULL ) + if( stdef != NULL ) { if( isNew ) { @@ -324,14 +316,14 @@ DEFINES* AddDefine ( char* defname, char* value ) stdef = ( DEFINES * ) hb_xgrab( sizeof( DEFINES ) ); stdef->last = topDefine; topDefine = stdef; - stdef->name = strodup ( defname ); + stdef->name = strodup( defname ); kolAddDefs++; } - stdef->value = ( value == NULL )? NULL : strodup ( value ); + stdef->value = ( value == NULL )? NULL : strodup( value ); return stdef; } -int ParseUndef( char* sLine) +static int ParseUndef( char* sLine) { char defname[MAX_NAME]; DEFINES* stdef; @@ -341,7 +333,7 @@ int ParseUndef( char* sLine) NextWord( &sLine, defname, FALSE ); - if ( ( stdef = DefSearch(defname, &isNew ) ) != NULL ) + if( ( stdef = DefSearch(defname, &isNew ) ) != NULL ) { if( isNew ) { @@ -354,36 +346,39 @@ int ParseUndef( char* sLine) return 0; } -int ParseIfdef( char* sLine, int usl) +static int ParseIfdef( char * sLine, int usl ) { - char defname[MAX_NAME]; - DEFINES *stdef; + char defname[ MAX_NAME ]; + DEFINES * stdef; HB_TRACE(HB_TR_DEBUG, ("ParseIfdef(%s, %d)", sLine, usl)); - if ( nCondCompile==0 || aCondCompile[nCondCompile-1]) + if( nCondCompile==0 || aCondCompile[nCondCompile-1]) { NextWord( &sLine, defname, FALSE ); - if ( *defname == '\0' ) + if( *defname == '\0' ) hb_compGenError( _szPErrors, 'F', ERR_DEFINE_ABSENT, NULL, NULL ); } - if ( nCondCompile == maxCondCompile ) + if( nCondCompile == maxCondCompile ) { maxCondCompile += 5; aCondCompile = (int*)hb_xrealloc( aCondCompile, sizeof( int ) * maxCondCompile ); } - if ( nCondCompile==0 || aCondCompile[nCondCompile-1]) + if( nCondCompile==0 || aCondCompile[nCondCompile-1]) { - if ( ( (stdef = DefSearch(defname,NULL)) != NULL && usl ) + if( ( (stdef = DefSearch(defname,NULL)) != NULL && usl ) || ( stdef == NULL && !usl ) ) aCondCompile[nCondCompile] = 1; else aCondCompile[nCondCompile] = 0; } - else aCondCompile[nCondCompile] = 0; + else + aCondCompile[ nCondCompile ] = 0; + nCondCompile++; + return 0; } -DEFINES* DefSearch(char *defname, int *isNew) +static DEFINES* DefSearch(char *defname, int *isNew) { int kol = 0,j; DEFINES * stdef = topDefine; @@ -395,9 +390,9 @@ DEFINES* DefSearch(char *defname, int *isNew) kol++; if( stdef->name != NULL ) { - for ( j=0; *(stdef->name+j) == *(defname+j) && + for( j=0; *(stdef->name+j) == *(defname+j) && *(stdef->name+j) != '\0'; j++ ); - if ( *(stdef->name+j) == *(defname+j) ) + if( *(stdef->name+j) == *(defname+j) ) { if( isNew ) *isNew = ( kolAddDefs >= kol ); return stdef; @@ -408,7 +403,7 @@ DEFINES* DefSearch(char *defname, int *isNew) return NULL; } -COMMANDS* ComSearch(char *cmdname, COMMANDS *stcmdStart) +static COMMANDS* ComSearch(char *cmdname, COMMANDS *stcmdStart) { int j; COMMANDS *stcmd = ( stcmdStart )? stcmdStart:topCommand; @@ -417,10 +412,10 @@ COMMANDS* ComSearch(char *cmdname, COMMANDS *stcmdStart) while( stcmd != NULL ) { - for ( j=0; (*(stcmd->name+j)==toupper(*(cmdname+j))) && + for( j=0; (*(stcmd->name+j)==toupper(*(cmdname+j))) && (*(stcmd->name+j)!='\0') && ((stcmd->com_or_xcom)? 1:(j<4 || ISNAME(*(cmdname+j+1)))); j++ ); - if ( (*(stcmd->name+j)==toupper(*(cmdname+j))) || + if( (*(stcmd->name+j)==toupper(*(cmdname+j))) || ( !stcmd->com_or_xcom && j >= 4 && *(stcmd->name+j)!='\0' && *(cmdname+j) == '\0' ) ) break; @@ -430,7 +425,7 @@ COMMANDS* ComSearch(char *cmdname, COMMANDS *stcmdStart) return stcmd; } -COMMANDS* TraSearch(char *cmdname, COMMANDS *sttraStart) +static COMMANDS* TraSearch(char *cmdname, COMMANDS *sttraStart) { int j; COMMANDS *sttra = ( sttraStart )? sttraStart:topTranslate; @@ -439,10 +434,10 @@ COMMANDS* TraSearch(char *cmdname, COMMANDS *sttraStart) while( sttra != NULL ) { - for ( j=0; *(sttra->name+j)==toupper(*(cmdname+j)) && + for( j=0; *(sttra->name+j)==toupper(*(cmdname+j)) && *(sttra->name+j)!='\0' && ((sttra->com_or_xcom)? 1:(j<4 || ISNAME(*(cmdname+j+1)))); j++ ); - if ( *(sttra->name+j)==toupper(*(cmdname+j)) || + if( *(sttra->name+j)==toupper(*(cmdname+j)) || ( !sttra->com_or_xcom && j >= 4 && *(sttra->name+j)!='\0' && *(cmdname+j) == '\0' ) ) break; @@ -451,7 +446,7 @@ COMMANDS* TraSearch(char *cmdname, COMMANDS *sttraStart) return sttra; } -void ParseCommand( char* sLine, int com_or_xcom, int com_or_tra ) +static void ParseCommand( char* sLine, int com_or_xcom, int com_or_tra ) { static char mpatt[PATTERN_SIZE], rpatt[PATTERN_SIZE]; char cmdname[MAX_NAME]; @@ -465,35 +460,38 @@ void ParseCommand( char* sLine, int com_or_xcom, int com_or_tra ) stroupper( cmdname ); SKIPTABSPACES(sLine); - if ( (ipos = pp_strAt( "=>", 2, sLine, strolen(sLine) )) > 0 ) + if( (ipos = pp_strAt( "=>", 2, sLine, strolen(sLine) )) > 0 ) + { stroncpy( mpatt, sLine, ipos-1 ); + + RemoveSlash( mpatt ); + mlen = strotrim( mpatt ); + + sLine += ipos + 1; + SKIPTABSPACES(sLine); + strocpy( rpatt, sLine ); + rlen = strotrim( rpatt ); + + ConvertPatterns( mpatt, mlen, rpatt, rlen ); + + if( com_or_tra ) + stcmd = AddCommand( cmdname ); + else + stcmd = AddTranslate( cmdname ); + + stcmd->com_or_xcom = com_or_xcom; + stcmd->mpatt = strodup( mpatt ); + stcmd->value = ( rlen > 0 )? strodup( rpatt ) : NULL; + } else hb_compGenError( _szPErrors, 'F', ERR_COMMAND_DEFINITION, NULL, NULL ); - RemoveSlash( mpatt ); - mlen = strotrim( mpatt ); - - sLine += ipos + 1; - SKIPTABSPACES(sLine); - strocpy( rpatt, sLine ); - rlen = strotrim( rpatt ); - - ConvertPatterns ( mpatt, mlen, rpatt, rlen ); - - if ( com_or_tra ) - stcmd = AddCommand ( cmdname ); - else - stcmd = AddTranslate ( cmdname ); - - stcmd->com_or_xcom = com_or_xcom; - stcmd->mpatt = strodup ( mpatt ); - stcmd->value = ( rlen > 0 )? strodup ( rpatt ) : NULL; } /* ConvertPatterns() * Converts result pattern in #command and #translate to inner format */ -void ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen ) +static void ConvertPatterns( char *mpatt, int mlen, char *rpatt, int rlen ) { int i = 0, ipos, ifou; int explen,rmlen; @@ -503,25 +501,25 @@ void ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen ) HB_TRACE(HB_TR_DEBUG, ("ConvertPatterns(%s, $d, %s, $d)", mpatt, mlen, rpatt, rlen)); - while ( *(mpatt+i) != '\0' ) + while( *(mpatt+i) != '\0' ) { - if ( *(mpatt+i) == '<' ) + if( *(mpatt+i) == '<' ) { /* Drag match marker, determine it type */ explen = 0; ipos = i; i++; exptype = '0'; while( *(mpatt+i) == ' ' || *(mpatt+i) == '\t' ) i++; - if ( *(mpatt+i) == '*' ) /* Wild match marker */ + if( *(mpatt+i) == '*' ) /* Wild match marker */ { exptype = '3'; i++; } - else if ( *(mpatt+i) == '(' ) /* Extended expression match marker */ + else if( *(mpatt+i) == '(' ) /* Extended expression match marker */ { exptype = '4'; i++; } - while ( *(mpatt+i) != '>' ) + while( *(mpatt+i) != '>' ) { - if ( *(mpatt+i) == ',' ) /* List match marker */ + if( *(mpatt+i) == ',' ) /* List match marker */ { exptype = '1'; - while ( *(mpatt+i) != '>' ) i++; + while( *(mpatt+i) != '>' ) i++; break; } - else if ( *(mpatt+i) == ':' ) /* Restricted match marker */ + else if( *(mpatt+i) == ':' ) /* Restricted match marker */ { exptype = '2'; *(mpatt+i--) = ' '; @@ -531,56 +529,57 @@ void ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen ) *(exppatt+explen++) = *(mpatt+i); i++; } - if ( exptype == '3' ) + if( exptype == '3' ) { - if ( *(exppatt+explen-1) == '*' ) explen--; + if( *(exppatt+explen-1) == '*' ) explen--; else hb_compGenError( _szPErrors, 'F', ERR_PATTERN_DEFINITION, NULL, NULL ); } - else if ( exptype == '4' ) + else if( exptype == '4' ) { - if ( *(exppatt+explen-1) == ')' ) explen--; + if( *(exppatt+explen-1) == ')' ) explen--; else hb_compGenError( _szPErrors, 'F', ERR_PATTERN_DEFINITION, NULL, NULL ); } + rmlen = i - ipos + 1; /* Convert match marker into inner format */ - lastchar = (lastchar!='Z')? ( (char) ( (unsigned int)lastchar + 1 ) ): + lastchar = (lastchar!='Z') ? ( (char) ( (unsigned int)lastchar + 1 ) ): 'a'; expreal[1] = lastchar; expreal[2] = exptype; - pp_Stuff ( expreal, mpatt+ipos, 4, rmlen, mlen ); + pp_Stuff( expreal, mpatt+ipos, 4, rmlen, mlen ); mlen += 4 - rmlen; i += 4 - rmlen; /* Look for appropriate result markers */ ptr = rpatt; - while ( (ifou = pp_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 ) + while( (ifou = pp_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 ) { /* Convert result marker into inner format */ ptr += ifou; - if ( *(ptr-2) == '<' && *(ptr+explen-1) == '>' && - *(ptr-3) != '\\' && *(ptr+explen-2) != '\\' ) /* <...> */ + if( *(ptr-2) == '<' && *(ptr+explen-1) == '>' && + *(ptr-3) != '\\' && *(ptr+explen-2) != '\\' ) /* <...> */ { - if ( *(ptr-3) == '#' && *(ptr-4) != '\\' ) /* #<...> */ + if( *(ptr-3) == '#' && *(ptr-4) != '\\' ) /* #<...> */ { exptype = '1'; ptr -= 3; rmlen = explen+3; } else { exptype = '0'; ptr -= 2; rmlen = explen+2; } } - else if ( *(ptr-3) == '<' && *(ptr+explen) == '>' && - *(ptr-4) != '\\' && *(ptr+explen-1) != '\\' ) /* < ... > */ + else if( *(ptr-3) == '<' && *(ptr+explen) == '>' && + *(ptr-4) != '\\' && *(ptr+explen-1) != '\\' ) /* < ... > */ { ptr -= 2; - if ( *ptr == '\"' ) exptype = '2'; - else if ( *ptr == '(' ) exptype = '3'; - else if ( *ptr == '{' ) exptype = '4'; - else if ( *ptr == '.' ) exptype = '5'; + if( *ptr == '\"' ) exptype = '2'; + else if( *ptr == '(' ) exptype = '3'; + else if( *ptr == '{' ) exptype = '4'; + else if( *ptr == '.' ) exptype = '5'; ptr--; rmlen = explen+4; } else continue; expreal[2] = exptype; - pp_Stuff ( expreal, ptr, 4, rmlen, rlen ); + pp_Stuff( expreal, ptr, 4, rmlen, rlen ); rlen += 4 - rmlen; } } @@ -588,7 +587,7 @@ void ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen ) } } -COMMANDS* AddCommand ( char *cmdname ) +static COMMANDS* AddCommand( char *cmdname ) { COMMANDS *stcmd; @@ -597,11 +596,11 @@ COMMANDS* AddCommand ( char *cmdname ) stcmd = ( COMMANDS * ) hb_xgrab( sizeof( COMMANDS ) ); stcmd->last = topCommand; topCommand = stcmd; - stcmd->name = strodup ( cmdname ); + stcmd->name = strodup( cmdname ); return stcmd; } -COMMANDS* AddTranslate ( char *traname ) +static COMMANDS* AddTranslate( char *traname ) { COMMANDS *sttra; @@ -610,7 +609,7 @@ COMMANDS* AddTranslate ( char *traname ) sttra = ( COMMANDS * ) hb_xgrab( sizeof( COMMANDS ) ); sttra->last = topTranslate; topTranslate = sttra; - sttra->name = strodup ( traname ); + sttra->name = strodup( traname ); return sttra; } @@ -628,7 +627,7 @@ int ParseExpression( char* sLine, char* sOutLine ) do { - strotrim ( sLine ); + strotrim( sLine ); rezDef = 0; rezTra = 0; rezCom = 0; isdvig = 0; do @@ -636,33 +635,33 @@ int ParseExpression( char* sLine, char* sOutLine ) ptro = sOutLine; ptri = sLine + isdvig; ipos = md_strAt( ";", 1, ptri, TRUE, FALSE ); - if ( ipos > 0 ) *(ptri+ipos-1) = '\0'; + if( ipos > 0 ) *(ptri+ipos-1) = '\0'; SKIPTABSPACES( ptri ); - if ( *ptri == '#' ) + if( *ptri == '#' ) { ParseDirective( ptri+1 ); - if ( ipos > 0 ) *( sLine + isdvig + ipos - 1 ) = ';'; + if( ipos > 0 ) *( sLine + isdvig + ipos - 1 ) = ';'; lens = strolen( sLine+isdvig ); - pp_Stuff ( " ", sLine+isdvig, 0, (ipos)? ipos:lens, lens ); + pp_Stuff( " ", sLine+isdvig, 0, (ipos)? ipos:lens, lens ); if( ipos > 0 ) ipos = 1; } else { /* Look for macros from #define */ - while ( ( lenToken = NextName( &ptri, sToken ) ) > 0 ) - if ( (stdef=DefSearch(sToken,NULL)) != NULL ) + while( ( lenToken = NextName( &ptri, sToken ) ) > 0 ) + if( (stdef=DefSearch(sToken,NULL)) != NULL ) { ptrb = ptri - lenToken; - if ( ( i = WorkDefine ( &ptri, ptro, stdef ) ) >= 0 ) + if( ( i = WorkDefine( &ptri, ptro, stdef ) ) >= 0 ) { rezDef++; lens = strolen( ptrb ); - if ( ipos > 0 ) + if( ipos > 0 ) { *(ptrb+lens) = ';'; lens += strolen( ptrb+lens+1 ); } - pp_Stuff ( ptro, ptrb, i, ptri-ptrb, lens+1 ); - if ( ipos > 0 ) + pp_Stuff( ptro, ptrb, i, ptri-ptrb, lens+1 ); + if( ipos > 0 ) { ipos += i - (ptri-ptrb); *(sLine + isdvig + ipos - 1) = '\0'; @@ -684,13 +683,13 @@ int ParseExpression( char* sLine, char* sOutLine ) if( (i = WorkTranslate( ptri+lenToken, ptro, stcmd, &lens )) >= 0 ) { lens += lenToken; - while ( lens > 0 && + while( lens > 0 && (*(ptri+lens-1)==' ' || *(ptri+lens-1)=='\t') ) lens--; - if ( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';'; + if( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';'; pp_Stuff( ptro, ptri, i, lens, strolen(ptri) ); rezTra = 1; - if ( ipos > 0 ) + if( ipos > 0 ) { ipos += i - lens; *(sLine+isdvig+ipos-1) = '\0'; @@ -704,17 +703,17 @@ int ParseExpression( char* sLine, char* sOutLine ) } /* Look for definitions from #command */ - if ( kolpass < 3 ) + if( kolpass < 3 ) { ptri = sLine + isdvig; SKIPTABSPACES( ptri ); - if ( ISNAME(*ptri) ) + if( ISNAME(*ptri) ) NextName( &ptri, sToken ); else { i = 0; - while ( *ptri != ' ' && *ptri != '\t' && *ptri != '\0' && - *ptri != '\"' && *ptri != '\'' && *ptri != '(' && + while( *ptri != ' ' && *ptri != '\t' && *ptri != '\0' && + *ptri != '\"' && *ptri != '\'' && *ptri != '(' && !ISNAME(*ptri) ) { *(sToken+i) = *ptri++; @@ -724,7 +723,7 @@ int ParseExpression( char* sLine, char* sOutLine ) } SKIPTABSPACES( ptri ); - if ( ( *ptri == '\0' || ( *ptri != '=' && + if( ( *ptri == '\0' || ( *ptri != '=' && (!IsInStr(*ptri,":/*+-") || *(ptri+1) != '=') && ( *ptri != '-' || *(ptri+1) != '>' ) ) ) && ( stcmd = ComSearch(sToken,NULL) ) != NULL ) @@ -732,59 +731,62 @@ int ParseExpression( char* sLine, char* sOutLine ) ptro = sOutLine; i = WorkCommand( ptri, ptro, stcmd ); ptri = sLine + isdvig; - if ( ipos > 0 ) *(ptri+ipos-1) = ';'; - if ( i >= 0 ) + if( ipos > 0 ) *(ptri+ipos-1) = ';'; + if( i >= 0 ) { - if ( isdvig + ipos > 0 ) + if( isdvig + ipos > 0 ) { lens = strolen( sLine+isdvig ); - pp_Stuff ( ptro, sLine+isdvig, i, (ipos)? ipos-1:lens, lens ); + pp_Stuff( ptro, sLine+isdvig, i, (ipos)? ipos-1:lens, lens ); if( ipos > 0 ) ipos = i + 1; } else - memcpy ( sLine, sOutLine, i+1); + memcpy( sLine, sOutLine, i+1); } rezCom = 1; } - else if ( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';'; + else if( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';'; } - else if ( ipos > 0 ) + else if( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';'; } isdvig += ipos; } - while ( ipos != 0 ); + while( ipos != 0 ); kolpass++; if( kolpass > 20 && rezDef ) + { hb_compGenError( _szPErrors, 'F', ERR_RECURSE, NULL, NULL ); + break; + } } - while ( rezDef || rezTra || rezCom ); + while( rezDef || rezTra || rezCom ); return 0; } -int WorkDefine ( char** ptri, char* ptro, DEFINES *stdef ) +static int WorkDefine( char** ptri, char* ptro, DEFINES *stdef ) { int npars, lens; char *ptr; HB_TRACE(HB_TR_DEBUG, ("WorkDefine(%p, %s, %p)", ptri, ptro, stdef)); - if ( stdef->npars < 0 ) + if( stdef->npars < 0 ) lens = strocpy( ptro,stdef->value ); else { SKIPTABSPACES( *ptri ); - if ( **ptri == '(' ) + if( **ptri == '(' ) { npars = 0; ptr = *ptri; do { ptr++; - if ( NextParm( &ptr, NULL ) > 0 ) npars++; + if( NextParm( &ptr, NULL ) > 0 ) npars++; } - while ( *ptr != ')' && *ptr != '\0' ); - if ( *ptr == ')' && stdef->npars == npars ) + while( *ptr != ')' && *ptr != '\0' ); + if( *ptr == ')' && stdef->npars == npars ) lens = WorkPseudoF( ptri, ptro, stdef ); else return -1; } @@ -793,7 +795,7 @@ int WorkDefine ( char** ptri, char* ptro, DEFINES *stdef ) return lens; } -int WorkPseudoF ( char** ptri, char* ptro, DEFINES *stdef ) +static int WorkPseudoF( char** ptri, char* ptro, DEFINES *stdef ) { char parfict[MAX_NAME], *ptrreal; char *ptrb; @@ -804,17 +806,17 @@ int WorkPseudoF ( char** ptri, char* ptro, DEFINES *stdef ) lenres = strocpy( ptro, stdef->value ); /* Copying value of macro to destination string */ - if ( stdef->pars ) + if( stdef->pars ) { ipos = 0; ibeg = 0; do /* Parsing through parameters */ { /* in macro definition */ - if ( *(stdef->pars+ipos) == ',' || *(stdef->pars+ipos) == '\0' ) + if( *(stdef->pars+ipos) == ',' || *(stdef->pars+ipos) == '\0' ) { *(parfict+ipos-ibeg) = '\0'; lenfict = ipos - ibeg; - if ( **ptri != ')' ) + if( **ptri != ')' ) { (*ptri)++; /* Get next real parameter */ SKIPTABSPACES( *ptri ); @@ -822,12 +824,12 @@ int WorkPseudoF ( char** ptri, char* ptro, DEFINES *stdef ) lenreal = NextParm( ptri, NULL); ptrb = ptro; - while ( (ifou = pp_strAt( parfict, lenfict, ptrb, lenres-(ptrb-ptro) )) > 0 ) + while( (ifou = pp_strAt( parfict, lenfict, ptrb, lenres-(ptrb-ptro) )) > 0 ) { ptrb = ptrb+ifou-1; - if ( !ISNAME(*(ptrb-1)) && !ISNAME(*(ptrb+lenfict)) ) + if( !ISNAME(*(ptrb-1)) && !ISNAME(*(ptrb+lenfict)) ) { - pp_Stuff ( ptrreal, ptrb, lenreal, lenfict, lenres ); + pp_Stuff( ptrreal, ptrb, lenreal, lenfict, lenres ); lenres += lenreal - lenfict; ptrb += lenreal; } @@ -837,17 +839,17 @@ int WorkPseudoF ( char** ptri, char* ptro, DEFINES *stdef ) } } else *(parfict+ipos-ibeg) = *(stdef->pars+ipos); - if ( *(stdef->pars+ipos) == '\0' ) break; + if( *(stdef->pars+ipos) == '\0' ) break; ipos++; } - while ( 1 ); + while( 1 ); } - else while ( **ptri != ')' ) (*ptri)++; + else while( **ptri != ')' ) (*ptri)++; (*ptri)++; return lenres; } -int WorkCommand ( char* ptri, char* ptro, COMMANDS *stcmd ) +static int WorkCommand( char* ptri, char* ptro, COMMANDS *stcmd ) { int rez; int lenres; @@ -858,23 +860,23 @@ int WorkCommand ( char* ptri, char* ptro, COMMANDS *stcmd ) do { - lenres = strocpy ( ptro, stcmd->value ); /* Copying result pattern */ + lenres = strocpy( ptro, stcmd->value ); /* Copying result pattern */ ptrmp = stcmd->mpatt; /* Pointer to a match pattern */ Repeate = 0; groupchar = '@'; - rez = CommandStuff ( ptrmp, ptri, ptro, &lenres, TRUE, stcmd->com_or_xcom ); + rez = CommandStuff( ptrmp, ptri, ptro, &lenres, TRUE, stcmd->com_or_xcom ); stcmd = stcmd->last; - if ( rez < 0 && stcmd != NULL ) stcmd = ComSearch(sToken, stcmd); + if( rez < 0 && stcmd != NULL ) stcmd = ComSearch(sToken, stcmd); } - while ( rez < 0 && stcmd != NULL ); + while( rez < 0 && stcmd != NULL ); *(ptro+lenres) = '\0'; - if ( rez >= 0 ) return lenres; + if( rez >= 0 ) return lenres; return -1; } -int WorkTranslate ( char* ptri, char* ptro, COMMANDS *sttra, int *lens ) +static int WorkTranslate( char* ptri, char* ptro, COMMANDS *sttra, int *lens ) { int rez; int lenres; @@ -885,19 +887,19 @@ int WorkTranslate ( char* ptri, char* ptro, COMMANDS *sttra, int *lens ) do { - lenres = strocpy ( ptro, sttra->value ); + lenres = strocpy( ptro, sttra->value ); ptrmp = sttra->mpatt; Repeate = 0; groupchar = '@'; - rez = CommandStuff ( ptrmp, ptri, ptro, &lenres, FALSE, sttra->com_or_xcom ); + rez = CommandStuff( ptrmp, ptri, ptro, &lenres, FALSE, sttra->com_or_xcom ); sttra = sttra->last; - if ( rez < 0 && sttra != NULL ) sttra = TraSearch(sToken, sttra); + if( rez < 0 && sttra != NULL ) sttra = TraSearch(sToken, sttra); } - while ( rez < 0 && sttra != NULL ); + while( rez < 0 && sttra != NULL ); *(ptro+lenres) = '\0'; - if ( rez >= 0 ) + if( rez >= 0 ) { *lens = rez; return lenres; @@ -905,7 +907,7 @@ int WorkTranslate ( char* ptri, char* ptro, COMMANDS *sttra, int *lens ) return -1; } -int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int com_or_tra, int com_or_xcom ) +static int CommandStuff( char *ptrmp, char *inputLine, char * ptro, int *lenres, int com_or_tra, int com_or_xcom ) { int endTranslation = FALSE, ipos; char *lastopti[3], *strtopti = NULL, *strtptri = NULL; @@ -915,9 +917,9 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c numBrackets = 0; SKIPTABSPACES( ptri ); - if ( ptrmp == NULL ) { if ( *ptri != '\0' ) return -1; } + if( ptrmp == NULL ) { if( *ptri != '\0' ) return -1; } else - while ( *ptri != '\0' && !endTranslation ) + while( *ptri != '\0' && !endTranslation ) { SKIPTABSPACES( ptrmp ); if( *ptrmp == '[' && !numBrackets && !strtopti ) @@ -937,7 +939,7 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c ptrmp = ptr; } } - switch ( *ptrmp ) { + switch( *ptrmp ) { case '[': numBrackets++; aIsRepeate[ Repeate ] = 0; @@ -986,10 +988,10 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c break; case ',': if( !numBrackets ) strtopti = NULL; - if ( *ptri == ',' ) { ptrmp++; ptri++; } + if( *ptri == ',' ) { ptrmp++; ptri++; } else { - if ( numBrackets ) + if( numBrackets ) { SkipOptional( &ptrmp ); } @@ -998,9 +1000,9 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c break; case '\1': /* Match marker */ if( !numBrackets ) strtopti = NULL; - if ( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, com_or_xcom ) ) + if( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, com_or_xcom ) ) { - if ( numBrackets ) + if( numBrackets ) { SkipOptional( &ptrmp ); } @@ -1008,17 +1010,17 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c } break; case '\0': - if ( com_or_tra ) + if( com_or_tra ) return -1; else endTranslation = TRUE; break; default: /* Key word */ if( !numBrackets ) strtopti = NULL; ptr = ptri; - if ( *ptri == ',' || truncmp( &ptri, &ptrmp, !com_or_xcom ) ) + if( *ptri == ',' || truncmp( &ptri, &ptrmp, !com_or_xcom ) ) { ptri = ptr; - if ( numBrackets ) + if( numBrackets ) { SkipOptional( &ptrmp ); } @@ -1028,15 +1030,15 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c SKIPTABSPACES( ptri ); }; - if ( *ptrmp != '\0' ) + if( *ptrmp != '\0' ) { - if ( Repeate ) { Repeate = 0; ptrmp = lastopti[0]; } + if( Repeate ) { Repeate = 0; ptrmp = lastopti[0]; } numBrackets = 0; do { SKIPTABSPACES( ptrmp ); - if ( *ptrmp != '\0' ) - switch ( *ptrmp ) { + if( *ptrmp != '\0' ) + switch( *ptrmp ) { case '[': ptrmp++; SkipOptional( &ptrmp ); @@ -1047,16 +1049,16 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c return -1; } } - while ( *ptrmp != '\0' ); + while( *ptrmp != '\0' ); } SearnRep( "\1","",0,ptro,lenres); *(ptro + *lenres) = '\0'; *lenres = RemoveSlash( ptro ); /* Removing '\' from result string */ - if ( com_or_tra ) return 1; else return (ptri-inputLine); + if( com_or_tra ) return 1; else return (ptri-inputLine); } -int RemoveSlash( char *stroka ) +static int RemoveSlash( char *stroka ) { char *ptr = stroka; int State = STATE_INIT, lDirective = FALSE; @@ -1084,7 +1086,7 @@ int RemoveSlash( char *stroka ) *(ptr+1) == '{' || *(ptr+1) == '}' || *(ptr+1) == '<' || *(ptr+1) == '>' || *(ptr+1) == '\'' || *(ptr+1) == '\"' ) ) { - pp_Stuff ( "", ptr, 0, 1, lenres - (ptr - stroka) ); + pp_Stuff( "", ptr, 0, 1, lenres - (ptr - stroka) ); lenres--; ptr++; } @@ -1102,7 +1104,7 @@ int RemoveSlash( char *stroka ) return lenres; } -int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_xcom ) +static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_xcom ) { static char expreal[MAX_EXP]; char exppatt[MAX_NAME]; @@ -1113,33 +1115,33 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_ HB_TRACE(HB_TR_DEBUG, ("WorkMarkers(%p, %p, %s, %p)", ptrmp, ptri, ptro, lenres)); /* Copying a match pattern to 'exppatt' */ - lenpatt = stroncpy ( exppatt, *ptrmp, 4 ); + lenpatt = stroncpy( exppatt, *ptrmp, 4 ); *ptrmp += 4; - SKIPTABSPACES ( *ptrmp ); - if ( **ptri == ',' ) + SKIPTABSPACES( *ptrmp ); + if( **ptri == ',' ) { - if ( numBrackets ) + if( numBrackets ) { return 0; } } ptrtemp = *ptrmp; - if ( *(exppatt+2) != '2' && *ptrtemp == ']' ) + if( *(exppatt+2) != '2' && *ptrtemp == ']' ) { ptrtemp++; - SKIPTABSPACES ( ptrtemp ); + SKIPTABSPACES( ptrtemp ); } - if ( *(exppatt+2) != '2' && *ptrtemp != '\1' && *ptrtemp != ',' && + if( *(exppatt+2) != '2' && *ptrtemp != '\1' && *ptrtemp != ',' && *ptrtemp != '[' && *ptrtemp != ']' && *ptrtemp != '\0' ) { - lenreal = strincpy ( expreal, ptrtemp ); - if ( (ipos = md_strAt( expreal, lenreal, *ptri, TRUE, TRUE )) > 0 ) + lenreal = strincpy( expreal, ptrtemp ); + if( (ipos = md_strAt( expreal, lenreal, *ptri, TRUE, TRUE )) > 0 ) { - if ( ptrtemp > *ptrmp ) + if( ptrtemp > *ptrmp ) { - if ( ipos == 1 ) + if( ipos == 1 ) { - if ( numBrackets ) + if( numBrackets ) { return 0; } @@ -1153,11 +1155,11 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_ else { lenreal = stroncpy( expreal, *ptri, ipos-1 ); - if ( ipos > 1 && isExpres ( expreal ) ) + if( ipos > 1 && isExpres( expreal ) ) *ptri += lenreal; else { - if ( numBrackets ) + if( numBrackets ) { return 0; } @@ -1166,7 +1168,7 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_ } else { - if ( numBrackets ) + if( numBrackets ) { return 0; } @@ -1174,34 +1176,34 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_ } } - if ( *(exppatt+2) == '4' ) /* ---- extended match marker */ + if( *(exppatt+2) == '4' ) /* ---- extended match marker */ { - if ( !lenreal ) lenreal = getExpReal ( expreal, ptri, FALSE, maxlenreal ); + if( !lenreal ) lenreal = getExpReal( expreal, ptri, FALSE, maxlenreal ); SearnRep( exppatt,expreal,lenreal,ptro,lenres); } - else if ( *(exppatt+2) == '3' ) /* ---- wild match marker */ + else if( *(exppatt+2) == '3' ) /* ---- wild match marker */ { - lenreal = strocpy ( expreal, *ptri ); + lenreal = strocpy( expreal, *ptri ); *ptri += lenreal; SearnRep( exppatt,expreal,lenreal,ptro,lenres); } - else if ( *(exppatt+2) == '2' ) /* ---- restricted match marker */ + else if( *(exppatt+2) == '2' ) /* ---- restricted match marker */ { - while ( **ptrmp != '>' ) *(exppatt+lenpatt++) = *((*ptrmp)++); + while( **ptrmp != '>' ) *(exppatt+lenpatt++) = *((*ptrmp)++); *(exppatt+lenpatt) = '\0'; (*ptrmp)++; ptr = exppatt + 4; rezrestr = 0; - while ( *ptr != '\0' ) + while( *ptr != '\0' ) { - if ( *ptr == '&' ) + if( *ptr == '&' ) { - if ( **ptri == '&' ) + if( **ptri == '&' ) { rezrestr = 1; /* (*ptri)++; */ - lenreal = getExpReal ( expreal, ptri, FALSE, maxlenreal ); + lenreal = getExpReal( expreal, ptri, FALSE, maxlenreal ); SearnRep( exppatt,expreal,lenreal,ptro,lenres); break; } @@ -1212,7 +1214,7 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_ SKIPTABSPACES( ptr ); /* Comparing real parameter and restriction value */ ptrtemp = ptr; - if ( !strincmp ( *ptri, &ptr, !com_or_xcom ) ) + if( !strincmp( *ptri, &ptr, !com_or_xcom ) ) { lenreal = stroncpy( expreal, *ptri, (ptr-ptrtemp) ); *ptri += lenreal; @@ -1222,35 +1224,35 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int com_or_ } else { - while ( *ptr != ',' && *ptr != '\0' ) ptr++; - if ( *ptr == ',' ) ptr++; + while( *ptr != ',' && *ptr != '\0' ) ptr++; + if( *ptr == ',' ) ptr++; } } } - if ( rezrestr == 0 ) + if( rezrestr == 0 ) { /* If restricted match marker doesn't correspond to real parameter */ - if ( numBrackets ) + if( numBrackets ) { return 0; } else return 0; } } - else if ( *(exppatt+2) == '1' ) /* ---- list match marker */ + else if( *(exppatt+2) == '1' ) /* ---- list match marker */ { - if ( !lenreal ) lenreal = getExpReal ( expreal, ptri, TRUE, maxlenreal ); + if( !lenreal ) lenreal = getExpReal( expreal, ptri, TRUE, maxlenreal ); SearnRep( exppatt,expreal,lenreal,ptro,lenres); } else /* ---- regular match marker */ { /* Copying a real expression to 'expreal' */ - if ( !lenreal ) lenreal = getExpReal ( expreal, ptri, FALSE, maxlenreal ); + if( !lenreal ) lenreal = getExpReal( expreal, ptri, FALSE, maxlenreal ); SearnRep( exppatt,expreal,lenreal,ptro,lenres); } return 1; } -int getExpReal ( char *expreal, char **ptri, int prlist, int maxrez ) +static int getExpReal( char *expreal, char **ptri, int prlist, int maxrez ) { int lens = 0; char *sZnaki = "+-=><*/$.&:#%!^"; @@ -1260,11 +1262,11 @@ int getExpReal ( char *expreal, char **ptri, int prlist, int maxrez ) HB_TRACE(HB_TR_DEBUG, ("getExpReal(%s, %p, %d, %d)", expreal, ptri, prlist, maxrez)); - SKIPTABSPACES ( *ptri ); + SKIPTABSPACES( *ptri ); State = (**ptri=='\'' || **ptri=='\"')? STATE_EXPRES:STATE_ID; - while ( **ptri != '\0' && !rez && lens < maxrez ) + while( **ptri != '\0' && !rez && lens < maxrez ) { - switch ( State ) { + switch( State ) { case STATE_QUOTE1: if(**ptri=='\'') State = (StBr1==0 && StBr2==0 && StBr3==0)? STATE_ID_END:STATE_BRACKET; @@ -1274,67 +1276,67 @@ int getExpReal ( char *expreal, char **ptri, int prlist, int maxrez ) State = (StBr1==0 && StBr2==0 && StBr3==0)? STATE_ID_END:STATE_BRACKET; break; case STATE_BRACKET: - if ( **ptri == '\'' ) State = STATE_QUOTE1; - else if ( **ptri == '\"' ) State = STATE_QUOTE2; - else if ( **ptri == '(' ) StBr1++; - else if ( **ptri == '[' ) StBr2++; - else if ( **ptri == '{' ) StBr3++; - else if ( **ptri == ')' ) + if( **ptri == '\'' ) State = STATE_QUOTE1; + else if( **ptri == '\"' ) State = STATE_QUOTE2; + else if( **ptri == '(' ) StBr1++; + else if( **ptri == '[' ) StBr2++; + else if( **ptri == '{' ) StBr3++; + else if( **ptri == ')' ) { StBr1--; if (StBr1==0 && StBr2==0 && StBr3==0) State = STATE_ID_END; } - else if ( **ptri == ']' ) + else if( **ptri == ']' ) { StBr2--; if (StBr1==0 && StBr2==0 && StBr3==0) State = STATE_ID_END; } - else if ( **ptri == '}' ) + else if( **ptri == '}' ) { StBr3--; if (StBr1==0 && StBr2==0 && StBr3==0) State = STATE_ID_END; } break; case STATE_ID: case STATE_ID_END: - if ( ( (ISNAME(**ptri) || **ptri=='\\') && State == STATE_ID_END ) || + if( ( (ISNAME(**ptri) || **ptri=='\\') && State == STATE_ID_END ) || **ptri==',' || **ptri=='\'' || **ptri=='\"' || **ptri==')' ) { - if ( **ptri == ',' ) + if( **ptri == ',' ) { - if ( !prlist ) rez = 1; + if( !prlist ) rez = 1; State = STATE_EXPRES; } else rez = 1; } - else if ( IsInStr( **ptri, sZnaki ) ) + else if( IsInStr( **ptri, sZnaki ) ) { State = STATE_EXPRES; } - else if ( **ptri == '(' ) + else if( **ptri == '(' ) { State = STATE_BRACKET; StBr1 = 1; } - else if ( **ptri == '[' ) + else if( **ptri == '[' ) { State = STATE_BRACKET; StBr2 = 1; } - else if ( **ptri == '{' ) + else if( **ptri == '{' ) { State = STATE_BRACKET; StBr3 = 1; } - else if ( **ptri == ' ' ) State = STATE_ID_END; + else if( **ptri == ' ' ) State = STATE_ID_END; break; case STATE_EXPRES: case STATE_EXPRES_ID: - if ( **ptri == '\'' ) State = STATE_QUOTE1; - else if ( **ptri == '\"' ) State = STATE_QUOTE2; - else if ( ISNAME(**ptri) ) State = STATE_EXPRES_ID; - else if ( **ptri == ' ' ) + if( **ptri == '\'' ) State = STATE_QUOTE1; + else if( **ptri == '\"' ) State = STATE_QUOTE2; + else if( ISNAME(**ptri) ) State = STATE_EXPRES_ID; + else if( **ptri == ' ' ) { if( State == STATE_EXPRES_ID ) State = STATE_ID_END; else if( lens > 2 && ( ( *(*ptri-2)=='+' && *(*ptri-1)=='+' ) || ( *(*ptri-2)=='-' && *(*ptri-1)=='-' ) ) ) State = STATE_ID_END; } - else if ( **ptri == '(' ) { StBr1++; State = STATE_BRACKET; } - else if ( **ptri == '[' ) { StBr2++; State = STATE_BRACKET; } - else if ( **ptri == '{' ) { StBr3++; State = STATE_BRACKET; } - else if ( **ptri == ',' ) { if ( !prlist ) rez = 1; State = STATE_EXPRES; } + else if( **ptri == '(' ) { StBr1++; State = STATE_BRACKET; } + else if( **ptri == '[' ) { StBr2++; State = STATE_BRACKET; } + else if( **ptri == '{' ) { StBr3++; State = STATE_BRACKET; } + else if( **ptri == ',' ) { if ( !prlist ) rez = 1; State = STATE_EXPRES; } else if( **ptri == '.' && *(*ptri-2) == '.' && ( *(*ptri-1) == 'T' || *(*ptri-1) == 'F' || *(*ptri-1) == 't' || *(*ptri-1) == 'f' ) ) @@ -1342,32 +1344,32 @@ int getExpReal ( char *expreal, char **ptri, int prlist, int maxrez ) else State = STATE_EXPRES; break; } - if ( !rez ) + if( !rez ) { - if ( expreal != NULL ) *expreal++ = **ptri; + if( expreal != NULL ) *expreal++ = **ptri; (*ptri)++; lens++; } } - if ( expreal != NULL ) + if( expreal != NULL ) { - if ( *(expreal-1) == ' ' ) { expreal--; lens--; }; + if( *(expreal-1) == ' ' ) { expreal--; lens--; }; *expreal = '\0'; } return lens; } -int isExpres ( char* stroka ) +static int isExpres( char* stroka ) { HB_TRACE(HB_TR_DEBUG, ("isExpres(%s)", stroka)); - if ( strolen ( stroka ) > getExpReal ( NULL, &stroka, FALSE, STR_SIZE ) ) + if( strolen( stroka ) > getExpReal( NULL, &stroka, FALSE, STR_SIZE ) ) return 0; else return 1; } -int TestOptional( char *ptr1, char *ptr2 ) +static int TestOptional( char *ptr1, char *ptr2 ) { int nbr = 0, flagname = 0, statevar = 0; @@ -1403,7 +1405,7 @@ int TestOptional( char *ptr1, char *ptr2 ) return !flagname; } -int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_tra, int com_or_xcom ) +static int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_tra, int com_or_xcom ) { int save_numBr = numBrackets, save_Repeate = Repeate; int endTranslation = FALSE, result = TRUE; @@ -1414,10 +1416,10 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ lReplacePat = FALSE; lastInputptr[Repeate] = ptri; - while ( *ptri != '\0' && !endTranslation && result ) + while( *ptri != '\0' && !endTranslation && result ) { SKIPTABSPACES( ptrmp ); - switch ( *ptrmp ) { + switch( *ptrmp ) { case '[': numBrackets++; aIsRepeate[ Repeate ] = 0; @@ -1440,10 +1442,10 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ } break; case ',': - if ( *ptri == ',' ) { ptrmp++; ptri++; } + if( *ptri == ',' ) { ptrmp++; ptri++; } else { - if ( numBrackets - save_numBr > 0 ) + if( numBrackets - save_numBr > 0 ) { SkipOptional( &ptrmp ); ptri = lastInputptr[Repeate]; @@ -1452,9 +1454,9 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ } break; case '\1': /* Match marker */ - if ( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, com_or_xcom ) ) + if( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, com_or_xcom ) ) { - if ( numBrackets - save_numBr > 0 ) + if( numBrackets - save_numBr > 0 ) { SkipOptional( &ptrmp ); ptri = lastInputptr[Repeate]; @@ -1466,10 +1468,10 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ result = FALSE; default: /* Key word */ ptr = ptri; - if ( *ptri == ',' || truncmp( &ptri, &ptrmp, !com_or_xcom ) ) + if( *ptri == ',' || truncmp( &ptri, &ptrmp, !com_or_xcom ) ) { ptri = ptr; - if ( numBrackets - save_numBr > 0 ) + if( numBrackets - save_numBr > 0 ) { SkipOptional( &ptrmp ); ptri = lastInputptr[Repeate]; @@ -1479,7 +1481,7 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ } SKIPTABSPACES( ptri ); }; - if ( *ptri == '\0' ) + if( *ptri == '\0' ) { do { @@ -1497,7 +1499,7 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ break; } } - while ( 1 ); + while( 1 ); } Repeate = save_Repeate; numBrackets = save_numBr; @@ -1505,33 +1507,33 @@ int CheckOptional( char* ptrmp, char* ptri, char* ptro, int* lenres, int com_or_ return result ; } -void SkipOptional( char** ptri ) +static void SkipOptional( char** ptri ) { int nbr = 0; HB_TRACE(HB_TR_DEBUG, ("SkipOptional(%p)", ptri)); - while ( **ptri != ']' || nbr ) + while( **ptri != ']' || nbr ) { - switch ( **ptri ) { + switch( **ptri ) { case '[': nbr++; break; case ']': nbr--; break; case '\1': (*ptri) += 3; - if ( *(*ptri-1) == '2' ) - while ( **ptri != '>' ) (*ptri)++; + if( *(*ptri-1) == '2' ) + while( **ptri != '>' ) (*ptri)++; break; } (*ptri)++; } - if ( **ptri == ']' && numBrackets > 0 ) + if( **ptri == ']' && numBrackets > 0 ) { - if ( Repeate ) Repeate--; + if( Repeate ) Repeate--; numBrackets--; (*ptri)++; } } -void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres) +static void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres) { int ifou, isdvig = 0, rezs; int kolmarkers; @@ -1543,24 +1545,24 @@ void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres) HB_TRACE(HB_TR_DEBUG, ("SearnRep(%s, %s, %d, %s, %p)", exppatt, expreal, lenreal, ptro, lenres)); if( *(exppatt+1) == '\0' ) *( ptro + *lenres ) = '\0'; - while ( (ifou = md_strAt( exppatt, (*(exppatt+1))? 2:1, ptrOut, FALSE, FALSE )) > 0 ) + while( (ifou = md_strAt( exppatt, (*(exppatt+1))? 2:1, ptrOut, FALSE, FALSE )) > 0 ) { rezs = 0; ptr = ptrOut + ifou - 2; kolmarkers = 0; ptr = PrevSquare( ptr, ptrOut, &kolmarkers ); - if ( ptr ) + if( ptr ) { if( Repeate ) aIsRepeate[ Repeate - 1 ]++; if( !lReplacePat ) return; ptr2 = ptrOut + ifou + 3; - while ( *ptr2 != ']' || *(ptr2-1) == '\\' ) + while( *ptr2 != ']' || *(ptr2-1) == '\\' ) { - if ( *ptr2 == '\1' ) kolmarkers++; + if( *ptr2 == '\1' ) kolmarkers++; ptr2++; } - if ( Repeate && lenreal && kolmarkers && lastchar != '0' && + if( Repeate && lenreal && kolmarkers && lastchar != '0' && *(ptrOut + ifou + 2) == '0' ) { isdvig += ifou; @@ -1568,7 +1570,7 @@ void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres) } else { - if ( lenreal == 0 ) + if( lenreal == 0 ) { if( numBrackets >= 2 ) { @@ -1577,7 +1579,7 @@ void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres) } else { - pp_Stuff ( "", ptr, 0, ptr2-ptr+1, *lenres-(ptr-ptro) ); + pp_Stuff( "", ptr, 0, ptr2-ptr+1, *lenres-(ptr-ptro) ); *lenres -= ptr2-ptr+1; isdvig = ptr - ptro; rezs = 1; @@ -1587,42 +1589,42 @@ void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres) { lennew = ptr2-ptr-1; - memcpy ( expnew, ptr+1, lennew ); + memcpy( expnew, ptr+1, lennew ); *(expnew + lennew++) = ' '; *(expnew + lennew) = '\0'; - while ( (i = pp_strAt( exppatt, 2, expnew, lennew )) > 0 ) - lennew += ReplacePattern ( exppatt[2], expreal, lenreal, expnew+i-1, lennew ); - if ( kolmarkers ) + while( (i = pp_strAt( exppatt, 2, expnew, lennew )) > 0 ) + lennew += ReplacePattern( exppatt[2], expreal, lenreal, expnew+i-1, lennew ); + if( kolmarkers ) { groupchar = (char) ( (unsigned int)groupchar + 1 ); - for ( i=0; i 0 ); + while( ifou > 0 ); } else { pp_rQuotes( expreal, sQuotes ); - pp_Stuff ( sQuotes, ptro, 2, 4, lenres ); - pp_Stuff ( expreal, ptro+1, lenreal, 0, lenres ); + pp_Stuff( sQuotes, ptro, 2, 4, lenres ); + pp_Stuff( expreal, ptro+1, lenreal, 0, lenres ); rmlen = lenreal + 2; } break; case '3': /* Smart stringify result marker */ - if ( patttype == '1' ) /* list match marker */ + if( patttype == '1' ) /* list match marker */ { - pp_Stuff ( "", ptro, 0, 4, lenres ); + pp_Stuff( "", ptro, 0, 4, lenres ); lenres -= 4; rmlen = 0; do @@ -1694,20 +1696,20 @@ int ReplacePattern ( char patttype, char *expreal, int lenreal, char *ptro, int lenitem = (ifou)? ifou-1:lenreal; if( *expreal != '\0' ) { - if ( !lenitem || *expreal == '(' || *expreal == '&' || + if( !lenitem || *expreal == '(' || *expreal == '&' || (*expreal=='\"' && *(expreal+lenitem-1)=='\"') || (*expreal == '\'' && *(expreal+lenitem-1)=='\'') ) { if( ifou ) lenitem++; - pp_Stuff ( (*expreal=='&')? expreal+1:expreal, ptro, - (*expreal=='&')? lenitem-1:lenitem, 0, lenres ); + pp_Stuff( (*expreal=='&')? expreal+1:expreal, ptro, + (*expreal=='&')? lenitem-1:lenitem, 0, lenres ); } else { i = (ifou)? 3:2; pp_rQuotes( expreal, sQuotes ); - pp_Stuff ( sQuotes, ptro, i, 0, lenres ); - pp_Stuff ( expreal, ptro+1, lenitem, 0, lenres+i ); + pp_Stuff( sQuotes, ptro, i, 0, lenres ); + pp_Stuff( expreal, ptro+1, lenitem, 0, lenres+i ); ptro += i; rmlen += i; } @@ -1717,27 +1719,27 @@ int ReplacePattern ( char patttype, char *expreal, int lenreal, char *ptro, int expreal += ifou; lenreal -= ifou; } - while ( ifou > 0 ); + while( ifou > 0 ); } - else if ( !lenreal || *expreal == '(' || *expreal == '&' || - (*expreal=='\"' && *(expreal+lenreal-1)=='\"') || - (*expreal == '\'' && *(expreal+lenreal-1)=='\'') ) - pp_Stuff ( (*expreal=='&')? expreal+1:expreal, ptro, - (*expreal=='&')? lenreal-1:lenreal, 4, lenres ); + else if( !lenreal || *expreal == '(' || *expreal == '&' || + (*expreal=='\"' && *(expreal+lenreal-1)=='\"') || + (*expreal == '\'' && *(expreal+lenreal-1)=='\'') ) + pp_Stuff( (*expreal=='&')? expreal+1:expreal, ptro, + (*expreal=='&')? lenreal-1:lenreal, 4, lenres ); else { pp_rQuotes( expreal, sQuotes ); - pp_Stuff ( sQuotes, ptro, 2, 4, lenres ); - pp_Stuff ( expreal, ptro+1, lenreal, 0, lenres ); + pp_Stuff( sQuotes, ptro, 2, 4, lenres ); + pp_Stuff( expreal, ptro+1, lenreal, 0, lenres ); rmlen = lenreal + 2; } break; case '4': /* Blockify result marker */ - if ( !lenreal ) - pp_Stuff ( expreal, ptro, lenreal, 4, lenres ); - else if ( patttype == '1' ) /* list match marker */ + if( !lenreal ) + pp_Stuff( expreal, ptro, lenreal, 4, lenres ); + else if( patttype == '1' ) /* list match marker */ { - pp_Stuff ( "", ptro, 0, 4, lenres ); + pp_Stuff( "", ptro, 0, 4, lenres ); lenres -= 4; rmlen = 0; do @@ -1747,37 +1749,37 @@ int ReplacePattern ( char patttype, char *expreal, int lenreal, char *ptro, int if( *expreal != '\0' ) { i = (ifou)? 5:4; - pp_Stuff ( "{||},", ptro, i, 0, lenres ); - pp_Stuff ( expreal, ptro+3, lenitem, 0, lenres+i ); + pp_Stuff( "{||},", ptro, i, 0, lenres ); + pp_Stuff( expreal, ptro+3, lenitem, 0, lenres+i ); ptro += i + lenitem; rmlen += i + lenitem; } expreal += ifou; lenreal -= ifou; } - while ( ifou > 0 ); + while( ifou > 0 ); } else { - pp_Stuff ( "{||}", ptro, 4, 4, lenres ); - pp_Stuff ( expreal, ptro+3, lenreal, 0, lenres ); + pp_Stuff( "{||}", ptro, 4, 4, lenres ); + pp_Stuff( expreal, ptro+3, lenreal, 0, lenres ); rmlen = lenreal + 4; } break; case '5': /* Logify result marker */ rmlen = 3; - if ( !lenreal ) + if( !lenreal ) { - pp_Stuff ( ".F.", ptro, 3, 4, lenres ); + pp_Stuff( ".F.", ptro, 3, 4, lenres ); } else - pp_Stuff ( ".T.", ptro, 3, 4, lenres ); + pp_Stuff( ".T.", ptro, 3, 4, lenres ); break; } return rmlen - 4; } -void pp_rQuotes( char *expreal, char *sQuotes ) +static void pp_rQuotes( char *expreal, char *sQuotes ) { int lQuote1 = 0, lQuote2 = 0; @@ -1817,23 +1819,23 @@ int pp_RdStr(FILE* handl_i,char *buffer,int maxlen,int lDropSpaces,char* sBuffer HB_TRACE(HB_TR_DEBUG, ("pp_RdStr(%p, %s, %d, %d, %s, %p, %p)", handl_i, buffer, maxlen, lDropSpaces, sBuffer, lenBuffer, iBuffer)); - if ( *lenBuffer == 0 ) return -1; + if( *lenBuffer == 0 ) return -1; while(1) { - if ( *iBuffer == *lenBuffer ) + if( *iBuffer == *lenBuffer ) { - if ( (*lenBuffer = fread(sBuffer,1,BUFF_SIZE,handl_i)) < 1 ) + if( (*lenBuffer = fread(sBuffer,1,BUFF_SIZE,handl_i)) < 1 ) sBuffer[0] = '\n'; *iBuffer = 0; } cha = sBuffer[*iBuffer]; (*iBuffer)++; if( cha == '\n' ) break; - if ( maxlen > 0 ) + if( maxlen > 0 ) { - switch ( ParseState ) { + switch( ParseState ) { case STATE_COMMENT: - if ( cha == '/' && cLast == '*' ) + if( cha == '/' && cLast == '*' ) { ParseState = STATE_NORMAL; cha = ' '; @@ -1843,7 +1845,7 @@ int pp_RdStr(FILE* handl_i,char *buffer,int maxlen,int lDropSpaces,char* sBuffer case STATE_QUOTE1: if(cha=='\'') ParseState = STATE_NORMAL; break; case STATE_QUOTE2: if(cha=='\"') ParseState = STATE_NORMAL; break; default: - switch ( cha ) { + switch( cha ) { case '[': ParseState = STATE_BRACKET; break; case ']': ParseState = STATE_NORMAL; break; case '\"': @@ -1853,22 +1855,22 @@ int pp_RdStr(FILE* handl_i,char *buffer,int maxlen,int lDropSpaces,char* sBuffer if( ParseState != STATE_BRACKET ) ParseState = STATE_QUOTE1; break; case '&': - if ( readed>0 && buffer[readed-1] == '&' ) { maxlen = 0; readed--; } + if( readed>0 && buffer[readed-1] == '&' ) { maxlen = 0; readed--; } break; case '/': - if ( readed>0 && buffer[readed-1] == '/' ) { maxlen = 0; readed--; } + if( readed>0 && buffer[readed-1] == '/' ) { maxlen = 0; readed--; } break; case '*': - if ( readed > 0 && buffer[readed-1] == '/' ) + if( readed > 0 && buffer[readed-1] == '/' ) { ParseState = STATE_COMMENT; readed--; } - else if ( !State ) maxlen = readed = 0; + else if( !State ) maxlen = readed = 0; break; } } - if ( cha != ' ' && cha != '\t' ) State = 1; + if( cha != ' ' && cha != '\t' ) State = 1; if( lDropSpaces && State ) lDropSpaces = 0; if( readed 1) || (kolPrth == 1 && *(szText+lPos) != '(') || (kolPrth == 0 && *(szText+lPos) == ')')) ) @@ -1978,9 +1980,9 @@ int md_strAt(char *szSub, int lSubLen, char *szText, int checkword, int checkPrt { lSubPos++; lPos++; - if ( lSubPos >= lSubLen && checkword && - ( ( ISNAME(*szSub) && lPos>lSubPos && ISNAME(*(szText+lPos-lSubPos-1)) ) || - ( ISNAME(*(szSub+lSubLen-1)) && ISNAME(*(szText+lPos)) ) ) ) + if( lSubPos >= lSubLen && checkword && + ( ( ISNAME(*szSub) && lPos>lSubPos && ISNAME(*(szText+lPos-lSubPos-1)) ) || + ( ISNAME(*(szSub+lSubLen-1)) && ISNAME(*(szText+lPos)) ) ) ) lSubPos = 0; } else if( lSubPos ) lSubPos = 0; @@ -1990,7 +1992,7 @@ int md_strAt(char *szSub, int lSubLen, char *szText, int checkword, int checkPrt return (lSubPos < lSubLen? 0: lPos - lSubLen + 1); } -char* PrevSquare( char* ptr, char* bound, int *kolmark ) +static char * PrevSquare( char* ptr, char* bound, int *kolmark ) { int State = STATE_NORMAL; @@ -2018,45 +2020,45 @@ char* PrevSquare( char* ptr, char* bound, int *kolmark ) return ( *ptr == '[' && State == STATE_NORMAL )? ptr:NULL; } -int IsInStr ( char symb, char* s ) +static int IsInStr( char symb, char* s ) { HB_TRACE(HB_TR_DEBUG, ("IsInStr(%c, %s)", symb, s)); - while ( *s != '\0' ) if ( *s++ == symb ) return 1; + while( *s != '\0' ) if( *s++ == symb ) return 1; return 0; } -void pp_Stuff (char *ptri, char * ptro, int len1, int len2, int lenres ) +void pp_Stuff(char *ptri, char * ptro, int len1, int len2, int lenres ) { char *ptr1, *ptr2; int i; HB_TRACE(HB_TR_DEBUG, ("pp_Stuff(%s, %s, %d, %d, %d)", ptri, ptro, len1, len2, lenres)); - if ( len1 > len2 ) + if( len1 > len2 ) { - ptr1 = ptro+lenres; + ptr1 = ptro + lenres; ptr2 = ptro + lenres + len1 - len2; - for ( ; ptr1 >= ptro; ptr1--,ptr2-- ) *ptr2 = *ptr1; + for( ; ptr1 >= ptro; ptr1--,ptr2-- ) *ptr2 = *ptr1; } else { ptr1 = ptro + len2; ptr2 = ptro + len1; - for ( ; ptr1 <= ptro+lenres; ptr1++,ptr2++ ) *ptr2 = *ptr1; + for( ; ptr1 <= ptro+lenres; ptr1++,ptr2++ ) *ptr2 = *ptr1; } ptr2 = ptro; - for ( i=0; i < len1; i++ ) *ptr2++ = *(ptri+i); + for( i=0; i < len1; i++ ) *ptr2++ = *(ptri+i); } -int strocpy (char* ptro, char* ptri ) +int strocpy(char* ptro, char* ptri ) { int lens = 0; HB_TRACE(HB_TR_DEBUG, ("strocpy(%s, %s)", ptro, ptri)); - if ( ptri != NULL ) - while ( *ptri != '\0' ) + if( ptri != NULL ) + while( *ptri != '\0' ) { *ptro++ = *ptri++; lens++; @@ -2065,60 +2067,61 @@ int strocpy (char* ptro, char* ptri ) return lens; } -int stroncpy (char* ptro, char* ptri, int lens ) +static int stroncpy(char* ptro, char* ptri, int lens ) { int i = 0; HB_TRACE(HB_TR_DEBUG, ("stroncpy(%s, %s, %d)", ptro, ptri, lens)); - for ( ; i < lens; i++ ) *(ptro+i) = *ptri++; + for( ; i < lens; i++ ) *(ptro+i) = *ptri++; i--; - while ( i > 0 && *(ptro+i) == ' ' ) i--; + while( i > 0 && *(ptro+i) == ' ' ) i--; i++; *(ptro+i) = '\0'; return i; } -int truncmp (char** ptro, char** ptri, int lTrunc ) +static int truncmp(char** ptro, char** ptri, int lTrunc ) { char *ptrb = *ptro, co, ci; HB_TRACE(HB_TR_DEBUG, ("truncmp(%p, %p, %d)", ptro, ptri, lTrunc)); - for ( ; **ptri != ' ' && **ptri != '\t' && **ptri != ',' && **ptri != '[' && **ptri != ']' && + for( ; **ptri != ' ' && **ptri != '\t' && **ptri != ',' && **ptri != '[' && **ptri != ']' && **ptri != '\1' && **ptri != '\0' && toupper(**ptri)==toupper(**ptro); (*ptro)++, (*ptri)++ ); co = *(*ptro-1); ci = **ptri; - if ( ( ( ci == ' ' || ci == ',' || ci == '[' || - ci == ']' || ci == '\1' || ci == '\0' ) && - ( ( !ISNAME(**ptro) && ISNAME(co) ) || - ( !ISNAME(co) ) ) ) ) + if( ( ( ci == ' ' || ci == ',' || ci == '[' || + ci == ']' || ci == '\1' || ci == '\0' ) && + ( ( !ISNAME(**ptro) && ISNAME(co) ) || + ( !ISNAME(co) ) ) ) ) return 0; - else if ( lTrunc && *ptro-ptrb >= 4 && ISNAME(ci) && !ISNAME(**ptro) && ISNAME(co) ) + else if( lTrunc && *ptro-ptrb >= 4 && ISNAME(ci) && !ISNAME(**ptro) && ISNAME(co) ) { while( ISNAME(**ptri) ) (*ptri)++; return 0; } return 1; } -int strincmp (char* ptro, char** ptri, int lTrunc ) + +static int strincmp(char* ptro, char** ptri, int lTrunc ) { char *ptrb = ptro, co, ci; HB_TRACE(HB_TR_DEBUG, ("strincmp(%s, %p)", ptro, ptri)); - for ( ; **ptri != ',' && **ptri != '[' && **ptri != ']' && - **ptri != '\1' && **ptri != '\0' && toupper(**ptri)==toupper(*ptro); + for( ; **ptri != ',' && **ptri != '[' && **ptri != ']' && + **ptri != '\1' && **ptri != '\0' && toupper(**ptri)==toupper(*ptro); ptro++, (*ptri)++ ); co = *(ptro-1); ci = **ptri; - if ( ( ( ci == ' ' || ci == ',' || ci == '[' || - ci == ']' || ci == '\1' || ci == '\0' ) && - ( ( !ISNAME(*ptro) && ISNAME(co) ) || - ( !ISNAME(co) ) ) ) ) + if( ( ( ci == ' ' || ci == ',' || ci == '[' || + ci == ']' || ci == '\1' || ci == '\0' ) && + ( ( !ISNAME(*ptro) && ISNAME(co) ) || + ( !ISNAME(co) ) ) ) ) return 0; - else if ( lTrunc && ptro-ptrb >= 4 && ISNAME(ci) && !ISNAME(*ptro) && ISNAME(co) ) + else if( lTrunc && ptro-ptrb >= 4 && ISNAME(ci) && !ISNAME(*ptro) && ISNAME(co) ) { // while( ISNAME(**ptri) ) (*ptri)++; return 0; @@ -2126,71 +2129,71 @@ int strincmp (char* ptro, char** ptri, int lTrunc ) return 1; } -int strincpy (char* ptro, char* ptri ) +static int strincpy(char* ptro, char* ptri ) { int lens = 0; HB_TRACE(HB_TR_DEBUG, ("strincpy(%s, %s)", ptro, ptri)); - for ( ; *ptri != ' ' && *ptri != ',' && *ptri != '[' && *ptri != ']' && - *ptri != '\1' && *ptri != '\0'; ptro++, ptri++, lens++ ) + for( ; *ptri != ' ' && *ptri != ',' && *ptri != '[' && *ptri != ']' && + *ptri != '\1' && *ptri != '\0'; ptro++, ptri++, lens++ ) *ptro = *ptri; return lens; } -char* strodup ( char *stroka ) +char* strodup( char *stroka ) { char *ptr; int lens = 0; HB_TRACE(HB_TR_DEBUG, ("strodup(%s)", stroka)); - while ( *(stroka+lens) != '\0' ) lens++; + while( *(stroka+lens) != '\0' ) lens++; ptr = ( char * ) hb_xgrab( lens + 1 ); memcpy( ptr, stroka, lens+1 ); *(ptr+lens) = '\0'; return ptr; } -int strolen ( char *stroka ) +int strolen( char *stroka ) { int lens = 0; HB_TRACE(HB_TR_DEBUG, ("strolen(%s)", stroka)); - while ( *(stroka+lens) != '\0' ) lens++; + while( *(stroka+lens) != '\0' ) lens++; return lens; } -void stroupper ( char *stroka ) +static void stroupper( char *stroka ) { HB_TRACE(HB_TR_DEBUG, ("stroupper(%s)", stroka)); - while ( *stroka != '\0' ) + while( *stroka != '\0' ) { *stroka = toupper(*stroka); stroka++; } } -int strotrim ( char *stroka ) +static int strotrim( char *stroka ) { char *ptr = stroka, lastc = '0', curc; int lens = 0, State = STATE_NORMAL; HB_TRACE(HB_TR_DEBUG, ("strotrim(%s)", stroka)); - while ( ( curc = *stroka ) != '\0' ) + while( ( curc = *stroka ) != '\0' ) { - if ( State == STATE_QUOTE1 ) { if (curc == '\'') State = STATE_NORMAL; } - else if ( State == STATE_QUOTE2 ) { if (curc=='\"') State = STATE_NORMAL; } + if( State == STATE_QUOTE1 ) { if(curc == '\'') State = STATE_NORMAL; } + else if( State == STATE_QUOTE2 ) { if(curc=='\"') State = STATE_NORMAL; } else { - if ( curc == '\'' ) State = STATE_QUOTE1; - else if ( curc == '\"' ) State = STATE_QUOTE2; - else if ( curc == '\t' ) curc = ' '; + if( curc == '\'' ) State = STATE_QUOTE1; + else if( curc == '\"' ) State = STATE_QUOTE2; + else if( curc == '\t' ) curc = ' '; } - if ( State != STATE_NORMAL || curc != ' ' || + if( State != STATE_NORMAL || curc != ' ' || ( curc==' ' && lastc != ' ' && lastc != ',' && lastc != '(' && *(stroka+1)!=',') ) { *ptr++ = curc; @@ -2203,14 +2206,14 @@ int strotrim ( char *stroka ) return lens; } -int NextWord ( char** sSource, char* sDest, int lLower ) +static int NextWord( char** sSource, char* sDest, int lLower ) { int i = 0; HB_TRACE(HB_TR_DEBUG, ("NextWord(%p, %s, %d)", sSource, sDest, lLower)); SKIPTABSPACES( (*sSource) ); - while ( **sSource != '\0' && **sSource != ' ' && **sSource != '\t' && **sSource != '(') + while( **sSource != '\0' && **sSource != ' ' && **sSource != '\t' && **sSource != '(') { *sDest++ = (lLower)? tolower(**sSource):**sSource; (*sSource)++; @@ -2220,25 +2223,25 @@ int NextWord ( char** sSource, char* sDest, int lLower ) return i; } -int NextName ( char** sSource, char* sDest ) +static int NextName( char** sSource, char* sDest ) { int lenName = 0, State = STATE_NORMAL; HB_TRACE(HB_TR_DEBUG, ("NextName(%p, %s)", sSource, sDest)); - while ( **sSource != '\0' && ( !ISNAME(**sSource) || State != STATE_NORMAL ) ) + while( **sSource != '\0' && ( !ISNAME(**sSource) || State != STATE_NORMAL ) ) { - if ( State == STATE_QUOTE1 ) - { if ( **sSource == '\'' ) State = STATE_NORMAL; } - else if ( State == STATE_QUOTE2 ) - { if ( **sSource == '\"' ) State = STATE_NORMAL; } - else if ( **sSource == '\"' ) State = STATE_QUOTE2; - else if ( **sSource == '\'' ) State = STATE_QUOTE1; + if( State == STATE_QUOTE1 ) + { if( **sSource == '\'' ) State = STATE_NORMAL; } + else if( State == STATE_QUOTE2 ) + { if( **sSource == '\"' ) State = STATE_NORMAL; } + else if( **sSource == '\"' ) State = STATE_QUOTE2; + else if( **sSource == '\'' ) State = STATE_QUOTE1; (*sSource)++; } - while ( **sSource != '\0' && ISNAME(**sSource) ) + while( **sSource != '\0' && ISNAME(**sSource) ) { *sDest++ = *(*sSource)++; lenName++; @@ -2247,48 +2250,48 @@ int NextName ( char** sSource, char* sDest ) return lenName; } -int NextParm ( char** sSource, char* sDest ) +static int NextParm( char** sSource, char* sDest ) { int lenName = 0, State = STATE_NORMAL, StBr = 0; HB_TRACE(HB_TR_DEBUG, ("NextParm(%p, %s)", sSource, sDest)); SKIPTABSPACES( (*sSource) ); - while ( **sSource != '\0' ) + while( **sSource != '\0' ) { - if ( State == STATE_QUOTE1 ) + if( State == STATE_QUOTE1 ) { - if ( **sSource == '\'' ) State = STATE_NORMAL; + if( **sSource == '\'' ) State = STATE_NORMAL; } - else if ( State == STATE_QUOTE2 ) + else if( State == STATE_QUOTE2 ) { - if ( **sSource == '\"' ) State = STATE_NORMAL; + if( **sSource == '\"' ) State = STATE_NORMAL; } - else if ( **sSource == '\"' ) State = STATE_QUOTE2; - else if ( **sSource == '\'' ) State = STATE_QUOTE1; - else if ( **sSource == '(' ) StBr++; - else if ( **sSource == ')' || **sSource == ',' ) + else if( **sSource == '\"' ) State = STATE_QUOTE2; + else if( **sSource == '\'' ) State = STATE_QUOTE1; + else if( **sSource == '(' ) StBr++; + else if( **sSource == ')' || **sSource == ',' ) { if( !StBr ) break; if( **sSource == ')' ) StBr--; } - if ( sDest != NULL ) *sDest++ = **sSource; + if( sDest != NULL ) *sDest++ = **sSource; (*sSource)++; lenName++; } - if ( sDest != NULL ) *sDest = '\0'; + if( sDest != NULL ) *sDest = '\0'; return lenName; } -BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStandardOnly, char * szInclude ) +static BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStandardOnly, char * szInclude ) { PHB_FNAME pFileName; HB_TRACE(HB_TR_DEBUG, ("OpenInclude(%s, %p, %p, %d)", szFileName, pSearch, fptr, (int) bStandardOnly)); - if ( bStandardOnly ) + if( bStandardOnly ) { *fptr = 0; szInclude[ 0 ] = '\0'; @@ -2302,12 +2305,12 @@ BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStan hb_xfree( pFileName ); } - if ( !*fptr && pSearch ) + if( !*fptr && pSearch ) { pFileName = hb_fsFNameSplit( szFileName ); pFileName->szName = szFileName; pFileName->szExtension = NULL; - while ( pSearch && !*fptr ) + while( pSearch && !*fptr ) { pFileName->szPath = pSearch->szPath; hb_fsFNameMerge( szInclude, pFileName ); diff --git a/harbour/source/pp/hbppint.c b/harbour/source/pp/hbppint.c index dc678c3f9e..8e1cd1ec39 100644 --- a/harbour/source/pp/hbppint.c +++ b/harbour/source/pp/hbppint.c @@ -37,29 +37,25 @@ * Avoid tracing in preprocessor/compiler. */ #if ! defined(HB_TRACE_UTILS) -#if defined(HB_TRACE_LEVEL) -#undef HB_TRACE_LEVEL -#endif + #if defined(HB_TRACE_LEVEL) + #undef HB_TRACE_LEVEL + #endif #endif #if ( defined(_MSC_VER) || defined(__IBMCPP__) || defined(__MINW32__) ) -#include -#include + #include + #include #elif ( defined(__GNUC__) || defined(__WATCOMC__) ) -#include -#include + #include + #include #else -#include -#include + #include + #include #endif #include #include "hbpp.h" #include "hberrors.h" -void Hbpp_init ( void ); -int PreProcess( FILE *, FILE *, char * ); -int Hp_Parse( FILE *, FILE *, char * ); - int iBuffer, lenBuffer; BOOL _bPPO = 0; char sLine[ STR_SIZE ], sOutLine[ STR_SIZE ]; diff --git a/harbour/source/pp/hbpplib.c b/harbour/source/pp/hbpplib.c index 8988e43221..5b81607565 100644 --- a/harbour/source/pp/hbpplib.c +++ b/harbour/source/pp/hbpplib.c @@ -37,9 +37,9 @@ * Avoid tracing in preprocessor/compiler. */ #if ! defined(HB_TRACE_UTILS) -#if defined(HB_TRACE_LEVEL) -#undef HB_TRACE_LEVEL -#endif + #if defined(HB_TRACE_LEVEL) + #undef HB_TRACE_LEVEL + #endif #endif #include diff --git a/harbour/source/pp/stdalone/hbpp.c b/harbour/source/pp/stdalone/hbpp.c index 8a580a93e0..67e93acb50 100644 --- a/harbour/source/pp/stdalone/hbpp.c +++ b/harbour/source/pp/stdalone/hbpp.c @@ -37,20 +37,20 @@ * Avoid tracing in preprocessor/compiler. */ #if ! defined(HB_TRACE_UTILS) -#if defined(HB_TRACE_LEVEL) -#undef HB_TRACE_LEVEL -#endif + #if defined(HB_TRACE_LEVEL) + #undef HB_TRACE_LEVEL + #endif #endif #include #if ( defined(_MSC_VER) || defined(__IBMCPP__) || defined(__MINGW32__) ) -#include + #include #elif defined(__GNUC__) -#include + #include #elif ! defined(__MPW__) -#include + #include #else -#include + #include #endif #include #include @@ -59,12 +59,9 @@ #include "hberrors.h" #include "hbver.h" -extern int pp_strAt( char *, int, char *, int ); -extern void pp_Stuff( char *, char *, int, int, int ); - -int Hp_Parse( FILE *, FILE *, char * ); -void OutTable( DEFINES *, COMMANDS * ); -void AddSearchPath( char *, PATHNAMES * * ); /* add pathname to a search list */ +static int Hp_Parse( FILE * handl_i, FILE * handl_o, char * szSource ); +static void AddSearchPath( char * szPath, PATHNAMES * * pSearchList ); +static void OutTable( DEFINES * endDefine, COMMANDS * endCommand ); char sLine[ STR_SIZE ], sOutLine[ STR_SIZE ]; @@ -280,7 +277,7 @@ int Hp_Parse( FILE * handl_i, FILE * handl_o, char * szSource ) return 0; } -void OutTable( DEFINES * endDefine, COMMANDS * endCommand ) +static void OutTable( DEFINES * endDefine, COMMANDS * endCommand ) { FILE *handl_o; int ipos, len_mpatt, len_value; @@ -332,7 +329,7 @@ void OutTable( DEFINES * endDefine, COMMANDS * endCommand ) stdef2 = stdef2->last; num++; } - fprintf( handl_o, "\n DEFINES *topDefine = " ); + fprintf( handl_o, "\n DEFINES * topDefine = " ); if( num == 1 ) fprintf( handl_o, "NULL;" ); else @@ -375,7 +372,7 @@ void OutTable( DEFINES * endDefine, COMMANDS * endCommand ) stcmd2 = stcmd2->last; num++; } - fprintf( handl_o, "\n COMMANDS *topCommand = " ); + fprintf( handl_o, "\n COMMANDS * topCommand = " ); if( num == 1 ) fprintf( handl_o, "NULL;" ); else @@ -427,7 +424,7 @@ void OutTable( DEFINES * endDefine, COMMANDS * endCommand ) stcmd2 = stcmd2->last; num++; } - fprintf( handl_o, "\n COMMANDS *topTranslate = " ); + fprintf( handl_o, "\n COMMANDS * topTranslate = " ); if( num == 1 ) fprintf( handl_o, "NULL;" ); else @@ -439,7 +436,7 @@ void OutTable( DEFINES * endDefine, COMMANDS * endCommand ) /* * Function that adds specified path to the list of pathnames to search */ -void AddSearchPath( char * szPath, PATHNAMES * * pSearchList ) +static void AddSearchPath( char * szPath, PATHNAMES * * pSearchList ) { PATHNAMES * pPath = *pSearchList; diff --git a/harbour/source/pp/table.c b/harbour/source/pp/table.c index 3f21848485..4de0aa63e2 100644 --- a/harbour/source/pp/table.c +++ b/harbour/source/pp/table.c @@ -37,9 +37,9 @@ * Avoid tracing in preprocessor/compiler. */ #if ! defined(HB_TRACE_UTILS) -#if defined(HB_TRACE_LEVEL) -#undef HB_TRACE_LEVEL -#endif + #if defined(HB_TRACE_LEVEL) + #undef HB_TRACE_LEVEL + #endif #endif #include @@ -97,7 +97,7 @@ static DEFINES sD___50 = {"_SET_AUTORDER",NULL,-1,"46", &sD___49 }; static DEFINES sD___51 = {"_SET_AUTOSHARE",NULL,-1,"47", &sD___50 }; - DEFINES *topDefine = &sD___51; + DEFINES * topDefine = &sD___51; static COMMANDS sC___1 = {0,"NOTE","\1A30",NULL,NULL }; static COMMANDS sC___2 = {0,"DO","WHILE \1A00","while \1A00",&sC___1 }; @@ -389,5 +389,6 @@ static COMMANDS sC___238 = {0,"SET","ORDER TO TAG \1A40 [IN \1B40]","ordSetFocus( \1A30 [, \1B30] )",&sC___237 }; static COMMANDS sC___239 = {0,"SET","ORDER TO","ordSetFocus(0)",&sC___238 }; static COMMANDS sC___240 = {0,"ANNOUNCE","\1A10","procedure \1A00 ; return",&sC___239 }; - COMMANDS *topCommand = &sC___240; - COMMANDS *topTranslate = NULL; + + COMMANDS * topCommand = &sC___240; + COMMANDS * topTranslate = NULL;