Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 BIN_BUILTIN_H_ | 5 #ifndef BIN_BUILTIN_H_ |
| 6 #define BIN_BUILTIN_H_ | 6 #define BIN_BUILTIN_H_ |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| 11 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 #include "platform/globals.h" | 13 #include "platform/globals.h" |
| 14 | 14 |
| 15 #define FUNCTION_NAME(name) Builtin_##name | 15 #define FUNCTION_NAME(name) Builtin_##name |
| 16 #define REGISTER_FUNCTION(name, count) \ | 16 #define REGISTER_FUNCTION(name, count) \ |
| 17 { ""#name, FUNCTION_NAME(name), count }, | 17 { ""#name, FUNCTION_NAME(name), count }, |
| 18 #define DECLARE_FUNCTION(name, count) \ | 18 #define DECLARE_FUNCTION(name, count) \ |
| 19 extern void FUNCTION_NAME(name)(Dart_NativeArguments args); | 19 extern void FUNCTION_NAME(name)(Dart_NativeArguments args); |
| 20 | 20 |
| 21 | 21 |
| 22 class Builtin { | 22 class Builtin { |
| 23 public: | 23 public: |
| 24 static Dart_Handle Source(); | 24 enum BuiltinLibraryId { |
| 25 static void SetupLibrary(Dart_Handle builtin_lib); | 25 kBuiltinLibrary, |
| 26 static void ImportLibrary(Dart_Handle library); | 26 kCoreImplLibrary, |
| 27 static void SetNativeResolver(); | 27 kIOLibrary, |
| 28 kNativeWrappersLibrary | |
|
Ivan Posva
2012/01/21 20:24:55
ditto. Only the builtin and the io library should
Mads Ager (google)
2012/01/23 11:35:38
Done.
| |
| 29 }; | |
| 30 | |
| 31 static Dart_Handle Source(BuiltinLibraryId id); | |
| 32 static void SetupLibrary(Dart_Handle library, BuiltinLibraryId id); | |
| 33 static Dart_Handle LoadLibrary(BuiltinLibraryId id); | |
| 34 static void ImportLibrary(Dart_Handle library, BuiltinLibraryId id); | |
| 35 static void SetNativeResolver(BuiltinLibraryId id); | |
| 28 static void PrintString(FILE* out, Dart_Handle object); | 36 static void PrintString(FILE* out, Dart_Handle object); |
| 29 | 37 |
| 30 private: | 38 private: |
| 31 static Dart_NativeFunction NativeLookup(Dart_Handle name, | 39 static Dart_NativeFunction NativeLookup(Dart_Handle name, |
| 32 int argument_count); | 40 int argument_count); |
| 33 | 41 |
| 34 static const char Builtin_source_[]; | 42 static const char builtin_source_[]; |
| 43 static const char io_source_[]; | |
| 35 | 44 |
| 36 DISALLOW_ALLOCATION(); | 45 DISALLOW_ALLOCATION(); |
| 37 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin); | 46 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin); |
| 38 }; | 47 }; |
| 39 | 48 |
| 40 | 49 |
| 41 #endif // BIN_BUILTIN_H_ | 50 #endif // BIN_BUILTIN_H_ |
| OLD | NEW |