| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // ---------------------------------------------------------------------------- | 36 // ---------------------------------------------------------------------------- |
| 37 // I/O support. | 37 // I/O support. |
| 38 | 38 |
| 39 #if __GNUC__ >= 4 | 39 #if __GNUC__ >= 4 |
| 40 // On gcc we can ask the compiler to check the types of %d-style format | 40 // On gcc we can ask the compiler to check the types of %d-style format |
| 41 // specifiers and their associated arguments. TODO(erikcorry) fix this | 41 // specifiers and their associated arguments. TODO(erikcorry) fix this |
| 42 // so it works on MacOSX. | 42 // so it works on MacOSX. |
| 43 #if defined(__MACH__) && defined(__APPLE__) | 43 #if defined(__MACH__) && defined(__APPLE__) |
| 44 #define PRINTF_CHECKING | 44 #define PRINTF_CHECKING |
| 45 #define FPRINTF_CHECKING |
| 45 #else // MacOsX. | 46 #else // MacOsX. |
| 46 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) | 47 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) |
| 48 #define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3))) |
| 47 #endif | 49 #endif |
| 48 #else | 50 #else |
| 49 #define PRINTF_CHECKING | 51 #define PRINTF_CHECKING |
| 52 #define FPRINTF_CHECKING |
| 50 #endif | 53 #endif |
| 51 | 54 |
| 52 // Our version of printf(). | 55 // Our version of printf(). |
| 53 void PRINTF_CHECKING PrintF(const char* format, ...); | 56 void PRINTF_CHECKING PrintF(const char* format, ...); |
| 57 void FPRINTF_CHECKING PrintF(FILE* out, const char* format, ...); |
| 54 | 58 |
| 55 // Our version of fflush. | 59 // Our version of fflush. |
| 56 void Flush(); | 60 void Flush(FILE* out = stdout); |
| 57 | 61 |
| 58 | 62 |
| 59 // Read a line of characters after printing the prompt to stdout. The resulting | 63 // Read a line of characters after printing the prompt to stdout. The resulting |
| 60 // char* needs to be disposed off with DeleteArray by the caller. | 64 // char* needs to be disposed off with DeleteArray by the caller. |
| 61 char* ReadLine(const char* prompt); | 65 char* ReadLine(const char* prompt); |
| 62 | 66 |
| 63 | 67 |
| 64 // Read and return the raw bytes in a file. the size of the buffer is returned | 68 // Read and return the raw bytes in a file. the size of the buffer is returned |
| 65 // in size. | 69 // in size. |
| 66 // The returned buffer must be freed by the caller. | 70 // The returned buffer must be freed by the caller. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 307 } |
| 304 #endif | 308 #endif |
| 305 while (dest < limit) { | 309 while (dest < limit) { |
| 306 *dest++ = static_cast<sinkchar>(*src++); | 310 *dest++ = static_cast<sinkchar>(*src++); |
| 307 } | 311 } |
| 308 } | 312 } |
| 309 | 313 |
| 310 } } // namespace v8::internal | 314 } } // namespace v8::internal |
| 311 | 315 |
| 312 #endif // V8_V8UTILS_H_ | 316 #endif // V8_V8UTILS_H_ |
| OLD | NEW |