| 114 | // log prints make tasm slow). |
| 115 | |
| 116 | void PrintOnce( |
| 117 | int& printed, // io: zero=print, nonzero=no print |
| 118 | const char* format, ...) // in: args like printf |
| 119 | { |
| 120 | char s[SBIG]; |
| 121 | va_list args; |
| 122 | va_start(args, format); |
| 123 | VSPRINTF(s, format, args); |
| 124 | va_end(args); |
| 125 | if (printed == 0 && print_g) |
| 126 | { |
| 127 | printed = 1; |
| 128 | printf("%s", s); |
| 129 | fflush(stdout); // flush so if there is a crash we can see what happened |
| 130 | } |
| 131 | if (printed < 100 && logfile_g) |
| 132 | { |
| 133 | fputs(s, logfile_g); |
| 134 | fflush(logfile_g); |
| 135 | printed++; |
| 136 | if (printed == 100) |
| 137 | logprintf("no more prints of the above message (printed == 100)\n"); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | } // namespace stasm |
no test coverage detected