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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 int32_t min = 0xc0000000; // -1073741824 | 804 int32_t min = 0xc0000000; // -1073741824 |
805 int32_t max = 0x3fffffff; // 1073741823 | 805 int32_t max = 0x3fffffff; // 1073741823 |
806 ASSERT(min <= value && value < max); | 806 ASSERT(min <= value && value < max); |
807 Dart_CObject object; | 807 Dart_CObject object; |
808 object.type = Dart_CObject_kInt32; | 808 object.type = Dart_CObject_kInt32; |
809 object.value.as_int32 = value; | 809 object.value.as_int32 = value; |
810 return Dart_PostCObject(port_id, &object); | 810 return Dart_PostCObject(port_id, &object); |
811 } | 811 } |
812 | 812 |
813 | 813 |
| 814 bool DartUtils::PostInt64(Dart_Port port_id, int64_t value) { |
| 815 // Post a message with the integer value. |
| 816 Dart_CObject object; |
| 817 object.type = Dart_CObject_kInt64; |
| 818 object.value.as_int64 = value; |
| 819 return Dart_PostCObject(port_id, &object); |
| 820 } |
| 821 |
| 822 |
814 Dart_Handle DartUtils::GetDartType(const char* library_url, | 823 Dart_Handle DartUtils::GetDartType(const char* library_url, |
815 const char* class_name) { | 824 const char* class_name) { |
816 return Dart_GetType(Dart_LookupLibrary(NewString(library_url)), | 825 return Dart_GetType(Dart_LookupLibrary(NewString(library_url)), |
817 NewString(class_name), 0, NULL); | 826 NewString(class_name), 0, NULL); |
818 } | 827 } |
819 | 828 |
820 | 829 |
821 Dart_Handle DartUtils::NewDartOSError() { | 830 Dart_Handle DartUtils::NewDartOSError() { |
822 // Extract the current OS error. | 831 // Extract the current OS error. |
823 OSError os_error; | 832 OSError os_error; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 new CObjectString(CObject::NewString(os_error->message())); | 1082 new CObjectString(CObject::NewString(os_error->message())); |
1074 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1083 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
1075 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1084 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
1076 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1085 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
1077 result->SetAt(2, error_message); | 1086 result->SetAt(2, error_message); |
1078 return result; | 1087 return result; |
1079 } | 1088 } |
1080 | 1089 |
1081 } // namespace bin | 1090 } // namespace bin |
1082 } // namespace dart | 1091 } // namespace dart |
OLD | NEW |