diff --git a/build.sh b/build.sh index 5dbdb0e..2d7bbc3 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -gcc -g -o extractfuncts -DSCREWUP extractfuncs.c l_log.c l_memory.c l_precomp.c l_script.c +clang -o extractfuncs -Wall -DSCREWUP extractfuncs.c l_log.c l_memory.c l_precomp.c l_script.c diff --git a/extractfuncs.c b/extractfuncs.c index d387f05..cd6d226 100644 --- a/extractfuncs.c +++ b/extractfuncs.c @@ -48,14 +48,14 @@ static char *func_decsfile = "g_func_decs.h"; #define TEMP_LIST_NAME "g_func_list.tmp" #define TEMP_DECS_NAME "g_func_decs.tmp" -//=========================================================================== +//=========================================================================== #if 0 -/* -================= -WriteWhiteSpace -================= -*/ +/* +================= +WriteWhiteSpace +================= +*/ void WriteWhiteSpace (FILE *fp, script_t *script) { int c; @@ -71,11 +71,11 @@ void WriteWhiteSpace (FILE *fp, script_t *script) } //end while } //end of the function WriteWhiteSpace -/* -================= -WriteString -================= -*/ +/* +================= +WriteString +================= +*/ void WriteString (FILE *fp, script_t *script) { char *ptr; @@ -88,11 +88,11 @@ void WriteString (FILE *fp, script_t *script) } //end while } //end of the function WriteString -/* -================= -ScrewUpFile -================= -*/ +/* +================= +ScrewUpFile +================= +*/ void ScrewUpFile (char *oldfile, char *newfile) { FILE *fp; @@ -137,11 +137,11 @@ void ScrewUpFile (char *oldfile, char *newfile) } //end of the function ScrewUpFile #endif -/* -================= -Error -================= -*/ +/* +================= +Error +================= +*/ void Error (char *error, ...) { va_list argptr; @@ -153,11 +153,11 @@ void Error (char *error, ...) exit( 1 ); } -/* -================= -DumpReplaceFunctions -================= -*/ +/* +================= +DumpReplaceFunctions +================= +*/ void DumpReplaceFunctions (char *typeName) { replacefunc_t *rf; @@ -196,7 +196,7 @@ void DumpReplaceFunctions (char *typeName) fclose( f ); strcpy( path, func_listfile ); - if ( f = fopen( path, "rb" ) ) + if ((f = fopen( path, "rb" )) != NULL) { fseek( f, 0, SEEK_END ); newlen = ftell( f ); @@ -264,7 +264,7 @@ void DumpReplaceFunctions (char *typeName) fclose( f ); strcpy( path, func_decsfile ); - if ( f = fopen( path, "rb" ) ) + if ((f = fopen( path, "rb" )) != NULL) { fseek( f, 0, SEEK_END ); newlen = ftell( f ); @@ -317,11 +317,11 @@ void DumpReplaceFunctions (char *typeName) #endif } // end of the function DumpReplaceFunctions -/* -================= -FindFunctionName -================= -*/ +/* +================= +FindFunctionName +================= +*/ replacefunc_t *FindFunctionName (char *funcname) { replacefunc_t *f; @@ -336,11 +336,11 @@ replacefunc_t *FindFunctionName (char *funcname) return NULL; } //end of the function FindFunctionName -/* -================= -MayScrewUp -================= -*/ +/* +================= +MayScrewUp +================= +*/ int MayScrewUp (char *funcname) { if ( !strcmp(funcname, "GetBotAPI") ) @@ -358,11 +358,11 @@ int MayScrewUp (char *funcname) return true; } //end of the function MayScrewUp -/* -================= -ConcatDec -================= -*/ +/* +================= +ConcatDec +================= +*/ void ConcatDec (tokenList_t *list, char *str, int inc) { /* if (!((list->token.type == TT_NAME) || (list->token.string[0] == '*'))) { @@ -381,11 +381,11 @@ void ConcatDec (tokenList_t *list, char *str, int inc) strcat(str, " " ); } -/* -================= -AddFunctionName -================= -*/ +/* +================= +AddFunctionName +================= +*/ void AddFunctionName (char *funcname, char *filename, tokenList_t *head) { replacefunc_t *f; @@ -433,11 +433,11 @@ void AddFunctionName (char *funcname, char *filename, tokenList_t *head) } //end of the function AddFunctionName -/* -================= -AddTokenToList -================= -*/ +/* +================= +AddTokenToList +================= +*/ void AddTokenToList (tokenList_t **head, token_t *token) { tokenList_t *newhead; @@ -454,10 +454,10 @@ void AddTokenToList (tokenList_t **head, token_t *token) } #if 0 -/* -================= -KillTokenList -================= +/* +================= +KillTokenList +================= */ void KillTokenList (tokenList_t *head) { @@ -469,11 +469,11 @@ void KillTokenList (tokenList_t *head) } #endif -/* -================= -StripTokenList -================= -*/ +/* +================= +StripTokenList +================= +*/ void StripTokenList (tokenList_t *head) { tokenList_t *trav, *lastTrav; @@ -496,13 +496,13 @@ void StripTokenList (tokenList_t *head) lastTrav->next = NULL; } -/* -================= -GetTypeNamesFromFile - -Knightmare- this gets structs / vars of a given type -================= -*/ +/* +================= +GetTypeNamesFromFile + +Knightmare- this gets structs / vars of a given type +================= +*/ void GetTypeNamesFromFile (char *filename, char *typeName) { source_t *source; @@ -572,11 +572,11 @@ void GetTypeNamesFromFile (char *filename, char *typeName) FreeSource( source ); } -/* -================= -GetFunctionNamesFromFile -================= -*/ +/* +================= +GetFunctionNamesFromFile +================= +*/ void GetFunctionNamesFromFile (char *filename) { source_t *source; @@ -669,11 +669,11 @@ void GetFunctionNamesFromFile (char *filename) FreeSource( source ); } //end of the function GetFunctionNamesFromFile -/* -================= -Usage -================= -*/ +/* +================= +Usage +================= +*/ void Usage (void) { // Error( "USAGE SCREWUP: extractfuncs \n" ); @@ -681,60 +681,60 @@ void Usage (void) "no -o defaults to g_func_list.h g_func_decs.h or g__list.h g__decs.h\n" ); } -/* -================= -main -================= -*/ +/* +================= +main +================= +*/ #ifdef _WIN32 void main (int argc, char *argv[]) { WIN32_FIND_DATA filedata; HWND handle; int i, firstParm, done; - char typeName[128]; - qboolean typeExtract = false; - qboolean firstParmSet = false; + char typeName[128]; + qboolean typeExtract = false; + qboolean firstParmSet = false; // if ( argc < 2 ) // Usage (); - // Knightmare- check for command line switches - for (i=0; i #include #include +#include #include "l_memory.h" #include "l_script.h" #include "l_precomp.h" @@ -78,10 +79,10 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) { dest[destsize - 1] = 0; } -/* -================= -Com_sprintf -================= +/* +================= +Com_sprintf +================= */ void Com_sprintf (char *dest, int size, const char *fmt, ...) { @@ -789,12 +790,12 @@ void PC_AddBuiltinDefines( source_t *source ) { char *string; int builtin; } builtin[] = { - "__LINE__", BUILTIN_LINE, - "__FILE__", BUILTIN_FILE, - "__DATE__", BUILTIN_DATE, - "__TIME__", BUILTIN_TIME, -// "__STDC__", BUILTIN_STDC, - NULL, 0 + { "__LINE__", BUILTIN_LINE }, + { "__FILE__", BUILTIN_FILE }, + { "__DATE__", BUILTIN_DATE }, + { "__TIME__", BUILTIN_TIME }, +// { "__STDC__", BUILTIN_STDC }, + { NULL, 0 } }; for ( i = 0; builtin[i].string; i++ ) @@ -811,7 +812,7 @@ void PC_AddBuiltinDefines( source_t *source ) { #else define->next = source->defines; source->defines = define; -#endif //DEFINEHASHING +#endif /* DEFINEHASHING */ } //end for } //end of the function PC_AddBuiltinDefines //============================================================================ @@ -823,7 +824,7 @@ void PC_AddBuiltinDefines( source_t *source ) { int PC_ExpandBuiltinDefine( source_t *source, define_t *define, token_t **firsttoken, token_t **lasttoken ) { token_t token; - unsigned long t; // time_t t; //to prevent LCC warning + time_t t; char *curtime; memcpy( &token, &source->token, sizeof( token_t ) ); diff --git a/l_script.c b/l_script.c index eaddc6b..2ed0c15 100644 --- a/l_script.c +++ b/l_script.c @@ -721,13 +721,13 @@ int PS_ReadNumber( script_t *script, token_t *token ) { { c = *script->script_p; //check for a LONG number - if ( c == 'l' || c == 'L' && + if ( (c == 'l' || c == 'L') && !( token->subtype & TT_LONG ) ) { script->script_p++; token->subtype |= TT_LONG; } //end if - //check for an UNSIGNED number - else if ( c == 'u' || c == 'U' && + //check for an UNSIGNED number + else if ( (c == 'u' || c == 'U') && !( token->subtype & ( TT_UNSIGNED | TT_FLOAT ) ) ) { script->script_p++; token->subtype |= TT_UNSIGNED; @@ -736,7 +736,7 @@ int PS_ReadNumber( script_t *script, token_t *token ) { token->string[len] = '\0'; #ifdef NUMBERVALUE NumberValue( token->string, token->subtype, &token->intvalue, &token->floatvalue ); -#endif //NUMBERVALUE +#endif /* NUMBERVALUE */ if ( !( token->subtype & TT_FLOAT ) ) { token->subtype |= TT_INTEGER; }