OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OS_H_ | 5 #ifndef VM_OS_H_ |
6 #define VM_OS_H_ | 6 #define VM_OS_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 | 9 |
10 // Forward declarations. | 10 // Forward declarations. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Sleep the currently executing thread for millis ms. | 78 // Sleep the currently executing thread for millis ms. |
79 static void Sleep(int64_t millis); | 79 static void Sleep(int64_t millis); |
80 | 80 |
81 // Debug break. | 81 // Debug break. |
82 static void DebugBreak(); | 82 static void DebugBreak(); |
83 | 83 |
84 // Print formatted output to stdout/stderr for debugging. | 84 // Print formatted output to stdout/stderr for debugging. |
85 static void Print(const char* format, ...); | 85 static void Print(const char* format, ...); |
86 static void PrintErr(const char* format, ...); | 86 static void PrintErr(const char* format, ...); |
| 87 static void FPrint(FILE* stream, const char* format, ...); |
87 static void VFPrint(FILE* stream, const char* format, va_list args); | 88 static void VFPrint(FILE* stream, const char* format, va_list args); |
88 // Print formatted output info a buffer. | 89 // Print formatted output info a buffer. |
89 // Does not write more than size characters (including the trailing '\0'). | 90 // Does not write more than size characters (including the trailing '\0'). |
90 // Returns the number of characters (excluding the trailing '\0') that would | 91 // Returns the number of characters (excluding the trailing '\0') that would |
91 // been written if the buffer had been big enough. | 92 // been written if the buffer had been big enough. |
92 // If the return value is greater or equal than the given size then the output | 93 // If the return value is greater or equal than the given size then the output |
93 // has been truncated. | 94 // has been truncated. |
94 // The buffer will always be terminated by a '\0', unless the buffer is of | 95 // The buffer will always be terminated by a '\0', unless the buffer is of |
95 // size 0. | 96 // size 0. |
96 // The buffer might be NULL if the size is 0. | 97 // The buffer might be NULL if the size is 0. |
97 // This specification conforms to C99 standard which is implemented by | 98 // This specification conforms to C99 standard which is implemented by |
98 // glibc 2.1+. | 99 // glibc 2.1+. |
99 static int SNPrint(char* str, size_t size, const char* format, ...); | 100 static int SNPrint(char* str, size_t size, const char* format, ...); |
100 static int VSNPrint(char* str, size_t size, | 101 static int VSNPrint(char* str, size_t size, |
101 const char* format, | 102 const char* format, |
102 va_list args); | 103 va_list args); |
103 | 104 |
| 105 static FILE* FOpen(const char* path, const char* mode); |
| 106 |
104 // Initialize the OS class. | 107 // Initialize the OS class. |
105 static void InitOnce(); | 108 static void InitOnce(); |
106 | 109 |
107 // Shut down the OS class. | 110 // Shut down the OS class. |
108 static void Shutdown(); | 111 static void Shutdown(); |
109 | 112 |
110 static void Abort(); | 113 static void Abort(); |
111 | 114 |
112 static void Exit(int code); | 115 static void Exit(int code); |
113 }; | 116 }; |
114 | 117 |
115 } // namespace dart | 118 } // namespace dart |
116 | 119 |
117 #endif // VM_OS_H_ | 120 #endif // VM_OS_H_ |
OLD | NEW |