OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 30 matching lines...) Expand all Loading... |
41 #include <sys/stat.h> | 41 #include <sys/stat.h> |
42 | 42 |
43 #include <arpa/inet.h> | 43 #include <arpa/inet.h> |
44 #include <netinet/in.h> | 44 #include <netinet/in.h> |
45 #include <netdb.h> | 45 #include <netdb.h> |
46 | 46 |
47 #undef MAP_TYPE | 47 #undef MAP_TYPE |
48 | 48 |
49 #if defined(ANDROID) | 49 #if defined(ANDROID) |
50 #define LOG_TAG "v8" | 50 #define LOG_TAG "v8" |
51 #include <utils/Log.h> // LOG_PRI_VA | 51 #include <android/log.h> |
52 #endif | 52 #endif |
53 | 53 |
54 #include "v8.h" | 54 #include "v8.h" |
55 | 55 |
56 #include "platform.h" | 56 #include "platform.h" |
57 | 57 |
58 namespace v8 { | 58 namespace v8 { |
59 namespace internal { | 59 namespace internal { |
60 | 60 |
61 | 61 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void OS::Print(const char* format, ...) { | 175 void OS::Print(const char* format, ...) { |
176 va_list args; | 176 va_list args; |
177 va_start(args, format); | 177 va_start(args, format); |
178 VPrint(format, args); | 178 VPrint(format, args); |
179 va_end(args); | 179 va_end(args); |
180 } | 180 } |
181 | 181 |
182 | 182 |
183 void OS::VPrint(const char* format, va_list args) { | 183 void OS::VPrint(const char* format, va_list args) { |
184 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) | 184 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) |
185 LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, format, args); | 185 __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, args); |
186 #else | 186 #else |
187 vprintf(format, args); | 187 vprintf(format, args); |
188 #endif | 188 #endif |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 void OS::FPrint(FILE* out, const char* format, ...) { | 192 void OS::FPrint(FILE* out, const char* format, ...) { |
193 va_list args; | 193 va_list args; |
194 va_start(args, format); | 194 va_start(args, format); |
195 VFPrint(out, format, args); | 195 VFPrint(out, format, args); |
196 va_end(args); | 196 va_end(args); |
197 } | 197 } |
198 | 198 |
199 | 199 |
200 void OS::VFPrint(FILE* out, const char* format, va_list args) { | 200 void OS::VFPrint(FILE* out, const char* format, va_list args) { |
201 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) | 201 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) |
202 LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, format, args); | 202 __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, args); |
203 #else | 203 #else |
204 vfprintf(out, format, args); | 204 vfprintf(out, format, args); |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 void OS::PrintError(const char* format, ...) { | 209 void OS::PrintError(const char* format, ...) { |
210 va_list args; | 210 va_list args; |
211 va_start(args, format); | 211 va_start(args, format); |
212 VPrintError(format, args); | 212 VPrintError(format, args); |
213 va_end(args); | 213 va_end(args); |
214 } | 214 } |
215 | 215 |
216 | 216 |
217 void OS::VPrintError(const char* format, va_list args) { | 217 void OS::VPrintError(const char* format, va_list args) { |
218 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) | 218 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) |
219 LOG_PRI_VA(ANDROID_LOG_ERROR, LOG_TAG, format, args); | 219 __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, args); |
220 #else | 220 #else |
221 vfprintf(stderr, format, args); | 221 vfprintf(stderr, format, args); |
222 #endif | 222 #endif |
223 } | 223 } |
224 | 224 |
225 | 225 |
226 int OS::SNPrintF(Vector<char> str, const char* format, ...) { | 226 int OS::SNPrintF(Vector<char> str, const char* format, ...) { |
227 va_list args; | 227 va_list args; |
228 va_start(args, format); | 228 va_start(args, format); |
229 int result = VSNPrintF(str, format, args); | 229 int result = VSNPrintF(str, format, args); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 return ntohl(value); | 457 return ntohl(value); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 Socket* OS::CreateSocket() { | 461 Socket* OS::CreateSocket() { |
462 return new POSIXSocket(); | 462 return new POSIXSocket(); |
463 } | 463 } |
464 | 464 |
465 | 465 |
466 } } // namespace v8::internal | 466 } } // namespace v8::internal |
OLD | NEW |