diff options
Diffstat (limited to 'src/v8utils.h')
-rw-r--r-- | src/v8utils.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/v8utils.h b/src/v8utils.h index a907c9f5..87efbcfe 100644 --- a/src/v8utils.h +++ b/src/v8utils.h @@ -29,6 +29,10 @@ #define V8_V8UTILS_H_ #include "utils.h" +#ifdef ANDROID +// Cherry pick from r6346 to build on Android. +#include "platform.h" +#endif namespace v8 { namespace internal { @@ -42,18 +46,26 @@ namespace internal { // so it works on MacOSX. #if defined(__MACH__) && defined(__APPLE__) #define PRINTF_CHECKING +#define FPRINTF_CHECKING #else // MacOsX. #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) +#define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3))) #endif #else #define PRINTF_CHECKING +#define FPRINTF_CHECKING #endif // Our version of printf(). void PRINTF_CHECKING PrintF(const char* format, ...); +void FPRINTF_CHECKING PrintF(FILE* out, const char* format, ...); // Our version of fflush. -void Flush(); +void Flush(FILE* out); + +inline void Flush() { + Flush(stdout); +} // Read a line of characters after printing the prompt to stdout. The resulting @@ -67,6 +79,14 @@ char* ReadLine(const char* prompt); byte* ReadBytes(const char* filename, int* size, bool verbose = true); +// Append size chars from str to the file given by filename. +// The file is overwritten. Returns the number of chars written. +int AppendChars(const char* filename, + const char* str, + int size, + bool verbose = true); + + // Write size chars from str to the file given by filename. // The file is overwritten. Returns the number of chars written. int WriteChars(const char* filename, @@ -217,6 +237,9 @@ class StringBuilder { // Add formatted contents to the builder just like printf(). void AddFormatted(const char* format, ...); + // Add formatted contents like printf based on a va_list. + void AddFormattedList(const char* format, va_list list); + // Add character padding to the builder. If count is non-positive, // nothing is added to the builder. void AddPadding(char c, int count); |