| 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| 11 | 11 |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 | 13 |
| 14 #include "bin/builtin.h" | 14 #include "bin/builtin.h" |
| 15 #include "bin/dartutils.h" | 15 #include "bin/dartutils.h" |
| 16 #include "bin/io_natives.h" | 16 #include "bin/io_natives.h" |
| 17 #include "bin/platform.h" | 17 #include "bin/platform.h" |
| 18 | 18 |
| 19 namespace dart { | 19 namespace dart { |
| 20 namespace bin { | 20 namespace bin { |
| 21 | 21 |
| 22 // Lists the native functions implementing basic functionality in | 22 // Lists the native functions implementing basic functionality in |
| 23 // standalone dart, such as printing, file I/O, and platform information. | 23 // standalone dart, such as printing, file I/O, and platform information. |
| 24 // Advanced I/O classes like sockets and process management are implemented | 24 // Advanced I/O classes like sockets and process management are implemented |
| 25 // using functions listed in io_natives.cc. | 25 // using functions listed in io_natives.cc. |
| 26 #define BUILTIN_NATIVE_LIST(V) \ | 26 #define BUILTIN_NATIVE_LIST(V) \ |
| 27 V(Crypto_GetRandomBytes, 1) \ | |
| 28 V(Directory_Exists, 1) \ | |
| 29 V(Directory_Create, 1) \ | |
| 30 V(Directory_Current, 0) \ | |
| 31 V(Directory_SetCurrent, 1) \ | |
| 32 V(Directory_SystemTemp, 0) \ | |
| 33 V(Directory_CreateTemp, 1) \ | |
| 34 V(Directory_Delete, 2) \ | |
| 35 V(Directory_Rename, 2) \ | |
| 36 V(Directory_List, 3) \ | |
| 37 V(File_Open, 2) \ | |
| 38 V(File_Exists, 1) \ | |
| 39 V(File_GetFD, 1) \ | |
| 40 V(File_Close, 1) \ | |
| 41 V(File_ReadByte, 1) \ | |
| 42 V(File_WriteByte, 2) \ | |
| 43 V(File_Read, 2) \ | |
| 44 V(File_ReadInto, 4) \ | |
| 45 V(File_WriteFrom, 4) \ | |
| 46 V(File_Position, 1) \ | |
| 47 V(File_SetPosition, 2) \ | |
| 48 V(File_Truncate, 2) \ | |
| 49 V(File_Length, 1) \ | |
| 50 V(File_LengthFromPath, 1) \ | |
| 51 V(File_Stat, 1) \ | |
| 52 V(File_LastModified, 1) \ | |
| 53 V(File_Flush, 1) \ | |
| 54 V(File_Lock, 4) \ | |
| 55 V(File_Create, 1) \ | |
| 56 V(File_CreateLink, 2) \ | |
| 57 V(File_LinkTarget, 1) \ | |
| 58 V(File_Delete, 1) \ | |
| 59 V(File_DeleteLink, 1) \ | |
| 60 V(File_Rename, 2) \ | |
| 61 V(File_Copy, 2) \ | |
| 62 V(File_RenameLink, 2) \ | |
| 63 V(File_ResolveSymbolicLinks, 1) \ | |
| 64 V(File_OpenStdio, 1) \ | |
| 65 V(File_GetStdioHandleType, 1) \ | |
| 66 V(File_GetType, 2) \ | |
| 67 V(File_AreIdentical, 2) \ | |
| 68 V(Builtin_PrintString, 1) \ | 27 V(Builtin_PrintString, 1) \ |
| 69 V(Builtin_LoadSource, 4) \ | 28 V(Builtin_LoadSource, 4) \ |
| 70 V(Builtin_AsyncLoadError, 3) \ | 29 V(Builtin_AsyncLoadError, 3) \ |
| 71 V(Builtin_DoneLoading, 0) \ | 30 V(Builtin_DoneLoading, 0) \ |
| 72 V(Builtin_NativeLibraryExtension, 0) \ | 31 V(Builtin_NativeLibraryExtension, 0) \ |
| 73 V(Builtin_GetCurrentDirectory, 0) \ | 32 V(Builtin_GetCurrentDirectory, 0) \ |
| 74 | 33 |
| 75 | 34 |
| 76 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); | 35 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); |
| 77 | 36 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // For now we report print output on the Stdout stream. | 99 // For now we report print output on the Stdout stream. |
| 141 uint8_t newline[] = { '\n' }; | 100 uint8_t newline[] = { '\n' }; |
| 142 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", chars, length); | 101 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", chars, length); |
| 143 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", | 102 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", |
| 144 newline, sizeof(newline)); | 103 newline, sizeof(newline)); |
| 145 } | 104 } |
| 146 } | 105 } |
| 147 | 106 |
| 148 } // namespace bin | 107 } // namespace bin |
| 149 } // namespace dart | 108 } // namespace dart |
| OLD | NEW |