used the following commands: find . -type f -name "*.h" | xargs sed -i 's/\s*$//g' find . -type f -name "*.cpp" | xargs sed -i 's/\s*$//g'
Showing the changes to src/core/chuck_errmsg.cpp (1 of 90 files). Show all
Unified · Split
| @@ -79,10 +79,10 @@ void ck_fprintf_stdout( const char * format, ... ) · 78 unmodified lines | |||
| 79 | va_start( args, format ); | 79 | va_start( args, format ); |
| 80 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); | 80 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); |
| 81 | va_end( args ); | 81 | va_end( args ); |
| 82 | 82 | ||
| 83 | // send the formatted string to the buffer | 83 | // send the formatted string to the buffer |
| 84 | g_stdout_stream << g_buffer2; | 84 | g_stdout_stream << g_buffer2; |
| 85 | 85 | ||
| 86 | // try flushing | 86 | // try flushing |
| 87 | ck_fflush_stdout(); | 87 | ck_fflush_stdout(); |
| 88 | } | 88 | } |
| @@ -95,10 +95,10 @@ void ck_fprintf_stderr( const char * format, ... ) · 6 unmodified lines | |||
| 95 | va_start( args, format ); | 95 | va_start( args, format ); |
| 96 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); | 96 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); |
| 97 | va_end( args ); | 97 | va_end( args ); |
| 98 | 98 | ||
| 99 | // send the formatted string to the buffer | 99 | // send the formatted string to the buffer |
| 100 | g_stderr_stream << g_buffer2; | 100 | g_stderr_stream << g_buffer2; |
| 101 | 101 | ||
| 102 | // try flushing | 102 | // try flushing |
| 103 | ck_fflush_stderr(); | 103 | ck_fflush_stderr(); |
| 104 | } | 104 | } |
| @@ -112,7 +112,7 @@ void ck_fflush_stdout() · 7 unmodified lines | |||
| 112 | // send to stdout | 112 | // send to stdout |
| 113 | fprintf( stdout, "%s", g_stdout_stream.str().c_str() ); | 113 | fprintf( stdout, "%s", g_stdout_stream.str().c_str() ); |
| 114 | fflush( stdout ); | 114 | fflush( stdout ); |
| 115 | 115 | ||
| 116 | // and clear buffer | 116 | // and clear buffer |
| 117 | g_stdout_stream.str( std::string() ); | 117 | g_stdout_stream.str( std::string() ); |
| 118 | } | 118 | } |
| @@ -124,7 +124,7 @@ void ck_fflush_stdout() · 5 unmodified lines | |||
| 124 | { | 124 | { |
| 125 | // if so, emit to callback | 125 | // if so, emit to callback |
| 126 | g_stdout_callback( g_stdout_stream.str().c_str() ); | 126 | g_stdout_callback( g_stdout_stream.str().c_str() ); |
| 127 | 127 | ||
| 128 | // and clear buffer | 128 | // and clear buffer |
| 129 | g_stdout_stream.str( std::string() ); | 129 | g_stdout_stream.str( std::string() ); |
| 130 | } | 130 | } |
| @@ -140,7 +140,7 @@ void ck_fflush_stderr() · 9 unmodified lines | |||
| 140 | // send to stderr | 140 | // send to stderr |
| 141 | fprintf( stderr, "%s", g_stderr_stream.str().c_str() ); | 141 | fprintf( stderr, "%s", g_stderr_stream.str().c_str() ); |
| 142 | fflush( stderr ); | 142 | fflush( stderr ); |
| 143 | 143 | ||
| 144 | // and clear buffer | 144 | // and clear buffer |
| 145 | g_stderr_stream.str( std::string() ); | 145 | g_stderr_stream.str( std::string() ); |
| 146 | } | 146 | } |
| @@ -152,7 +152,7 @@ void ck_fflush_stderr() · 5 unmodified lines | |||
| 152 | { | 152 | { |
| 153 | // if so, emit to callback | 153 | // if so, emit to callback |
| 154 | g_stderr_callback( g_stderr_stream.str().c_str() ); | 154 | g_stderr_callback( g_stderr_stream.str().c_str() ); |
| 155 | 155 | ||
| 156 | // and clear buffer | 156 | // and clear buffer |
| 157 | g_stderr_stream.str( std::string() ); | 157 | g_stderr_stream.str( std::string() ); |
| 158 | } | 158 | } |
| @@ -164,10 +164,10 @@ void ck_vfprintf_stdout( const char * format, va_list args ) · 5 unmodified lines | |||
| 164 | { | 164 | { |
| 165 | // evaluate the format string | 165 | // evaluate the format string |
| 166 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); | 166 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); |
| 167 | 167 | ||
| 168 | // send the formatted string to the buffer | 168 | // send the formatted string to the buffer |
| 169 | g_stdout_stream << g_buffer2; | 169 | g_stdout_stream << g_buffer2; |
| 170 | 170 | ||
| 171 | // try flushing | 171 | // try flushing |
| 172 | ck_fflush_stdout(); | 172 | ck_fflush_stdout(); |
| 173 | } | 173 | } |
| @@ -177,10 +177,10 @@ void ck_vfprintf_stderr( const char * format, va_list args ) · 3 unmodified lines | |||
| 177 | { | 177 | { |
| 178 | // evaluate the format string | 178 | // evaluate the format string |
| 179 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); | 179 | vsnprintf( g_buffer2, g_buffer2_size, format, args ); |
| 180 | 180 | ||
| 181 | // send the formatted string to the buffer | 181 | // send the formatted string to the buffer |
| 182 | g_stderr_stream << g_buffer2; | 182 | g_stderr_stream << g_buffer2; |
| 183 | 183 | ||
| 184 | // try flushing | 184 | // try flushing |
| 185 | ck_fflush_stderr(); | 185 | ck_fflush_stderr(); |
| 186 | } | 186 | } |
| @@ -374,14 +374,14 @@ static IntList linePos=NULL; · 187 unmodified lines | |||
| 374 | static int lastErrorCat(const char * str) | 374 | static int lastErrorCat(const char * str) |
| 375 | { | 375 | { |
| 376 | assert(g_lasterrorIndex <= LASTERROR_SIZE-1); | 376 | assert(g_lasterrorIndex <= LASTERROR_SIZE-1); |
| 377 | 377 | ||
| 378 | size_t len = strlen(str); | 378 | size_t len = strlen(str); |
| 379 | 379 | ||
| 380 | strncat(g_lasterror, str, LASTERROR_SIZE-g_lasterrorIndex-1); | 380 | strncat(g_lasterror, str, LASTERROR_SIZE-g_lasterrorIndex-1); |
| 381 | 381 | ||
| 382 | size_t appendCount = ck_min(LASTERROR_SIZE-g_lasterrorIndex-1, len); | 382 | size_t appendCount = ck_min(LASTERROR_SIZE-g_lasterrorIndex-1, len); |
| 383 | g_lasterrorIndex += appendCount; | 383 | g_lasterrorIndex += appendCount; |
| 384 | 384 | ||
| 385 | return appendCount > 0; | 385 | return appendCount > 0; |
| 386 | } | 386 | } |
| 387 | 387 | ||
| @@ -430,7 +430,7 @@ void EM_reset_msg() · 42 unmodified lines | |||
| 430 | g_lasterrorIndex = 0; | 430 | g_lasterrorIndex = 0; |
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | // [%s]:line(%d).char(%d): | 433 | // [%s]:line(%d).char(%d): |
| 434 | void EM_error( int pos, const char * message, ... ) | 434 | void EM_error( int pos, const char * message, ... ) |
| 435 | { | 435 | { |
| 436 | va_list ap; | 436 | va_list ap; |
| @@ -438,15 +438,15 @@ void EM_error( int pos, const char * message, ... ) · 1 unmodified line | |||
| 438 | int num = lineNum; | 438 | int num = lineNum; |
| 439 | 439 | ||
| 440 | anyErrors = TRUE; | 440 | anyErrors = TRUE; |
| 441 | while( lines && lines->i >= pos ) | 441 | while( lines && lines->i >= pos ) |
| 442 | { | 442 | { |
| 443 | lines = lines->rest; | 443 | lines = lines->rest; |
| 444 | num--; | 444 | num--; |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | // separate errmsgs with newlines | 447 | // separate errmsgs with newlines |
| 448 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); | 448 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); |
| 449 | 449 | ||
| 450 | CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" ); | 450 | CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" ); |
| 451 | sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" ); | 451 | sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" ); |
| 452 | lastErrorCat( g_buffer ); | 452 | lastErrorCat( g_buffer ); |
| @@ -458,7 +458,7 @@ void EM_error( int pos, const char * message, ... ) · 5 unmodified lines | |||
| 458 | } | 458 | } |
| 459 | CK_FPRINTF_STDERR( " " ); | 459 | CK_FPRINTF_STDERR( " " ); |
| 460 | lastErrorCat( " " ); | 460 | lastErrorCat( " " ); |
| 461 | 461 | ||
| 462 | va_start(ap, message); | 462 | va_start(ap, message); |
| 463 | CK_VFPRINTF_STDERR( message, ap); | 463 | CK_VFPRINTF_STDERR( message, ap); |
| 464 | va_end(ap); | 464 | va_end(ap); |
| @@ -466,7 +466,7 @@ void EM_error( int pos, const char * message, ... ) · 1 unmodified line | |||
| 466 | va_start(ap, message); | 466 | va_start(ap, message); |
| 467 | vsprintf( g_buffer, message, ap ); | 467 | vsprintf( g_buffer, message, ap ); |
| 468 | va_end(ap); | 468 | va_end(ap); |
| 469 | 469 | ||
| 470 | CK_FPRINTF_STDERR( "\n"); | 470 | CK_FPRINTF_STDERR( "\n"); |
| 471 | CK_FFLUSH_STDERR(); | 471 | CK_FFLUSH_STDERR(); |
| 472 | lastErrorCat( g_buffer ); | 472 | lastErrorCat( g_buffer ); |
| @@ -482,7 +482,7 @@ void EM_error2( int line, const char * message, ... ) · 9 unmodified lines | |||
| 482 | 482 | ||
| 483 | // separate errmsgs with newlines | 483 | // separate errmsgs with newlines |
| 484 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); | 484 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); |
| 485 | 485 | ||
| 486 | CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" ); | 486 | CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" ); |
| 487 | sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" ); | 487 | sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" ); |
| 488 | lastErrorCat( g_buffer ); | 488 | lastErrorCat( g_buffer ); |
| @@ -513,12 +513,12 @@ void EM_error2( int line, const char * message, ... ) · 24 unmodified lines | |||
| 513 | void EM_error2b( int line, const char * message, ... ) | 513 | void EM_error2b( int line, const char * message, ... ) |
| 514 | { | 514 | { |
| 515 | va_list ap; | 515 | va_list ap; |
| 516 | 516 | ||
| 517 | EM_extLineNum = line; | 517 | EM_extLineNum = line; |
| 518 | 518 | ||
| 519 | // separate errmsgs with newlines | 519 | // separate errmsgs with newlines |
| 520 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); | 520 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); |
| 521 | 521 | ||
| 522 | CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" ); | 522 | CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" ); |
| 523 | sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" ); | 523 | sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" ); |
| 524 | lastErrorCat( g_buffer ); | 524 | lastErrorCat( g_buffer ); |
| @@ -545,14 +545,14 @@ void EM_error2b( int line, const char * message, ... ) · 20 unmodified lines | |||
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | 547 | ||
| 548 | // | 548 | // |
| 549 | void EM_error3( const char * message, ... ) | 549 | void EM_error3( const char * message, ... ) |
| 550 | { | 550 | { |
| 551 | va_list ap; | 551 | va_list ap; |
| 552 | 552 | ||
| 553 | // separate errmsgs with newlines | 553 | // separate errmsgs with newlines |
| 554 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); | 554 | if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" ); |
| 555 | 555 | ||
| 556 | // g_lasterror[0] = '\0'; | 556 | // g_lasterror[0] = '\0'; |
| 557 | g_buffer[0] = '\0'; | 557 | g_buffer[0] = '\0'; |
| 558 | 558 | ||