| 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_DARTUTILS_H_ | 5 #ifndef BIN_DARTUTILS_H_ |
| 6 #define BIN_DARTUTILS_H_ | 6 #define BIN_DARTUTILS_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 int count_; | 52 int count_; |
| 53 int max_count_; | 53 int max_count_; |
| 54 const char** arguments_; | 54 const char** arguments_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 | 57 |
| 58 class DartUtils { | 58 class DartUtils { |
| 59 public: | 59 public: |
| 60 // TODO(turnidge): Clean up the implementations of these so that | 60 // TODO(turnidge): Clean up the implementations of these so that |
| 61 // they allow for proper error propagation. | 61 // they allow for proper error propagation. |
| 62 |
| 63 // Assumes that the value object is known to be an integer object |
| 64 // that fits in a signed 64-bit integer. |
| 62 static int64_t GetIntegerValue(Dart_Handle value_obj); | 65 static int64_t GetIntegerValue(Dart_Handle value_obj); |
| 66 // Checks that the value object is an integer object that fits in a |
| 67 // signed 64-bit integer. If it is, the value is returned in the |
| 68 // value out parameter and true is returned. Otherwise, false is |
| 69 // returned. |
| 63 static bool GetInt64Value(Dart_Handle value_obj, int64_t* value); | 70 static bool GetInt64Value(Dart_Handle value_obj, int64_t* value); |
| 64 static const char* GetStringValue(Dart_Handle str_obj); | 71 static const char* GetStringValue(Dart_Handle str_obj); |
| 65 static bool GetBooleanValue(Dart_Handle bool_obj); | 72 static bool GetBooleanValue(Dart_Handle bool_obj); |
| 66 static void SetIntegerField(Dart_Handle handle, | 73 static void SetIntegerField(Dart_Handle handle, |
| 67 const char* name, | 74 const char* name, |
| 68 intptr_t val); | 75 intptr_t val); |
| 69 static intptr_t GetIntegerField(Dart_Handle handle, | 76 static intptr_t GetIntegerField(Dart_Handle handle, |
| 70 const char* name); | 77 const char* name); |
| 71 static void SetStringField(Dart_Handle handle, | 78 static void SetStringField(Dart_Handle handle, |
| 72 const char* name, | 79 const char* name, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 298 |
| 292 class CObjectUint8Array : public CObject { | 299 class CObjectUint8Array : public CObject { |
| 293 public: | 300 public: |
| 294 DECLARE_COBJECT_CONSTRUCTORS(Uint8Array) | 301 DECLARE_COBJECT_CONSTRUCTORS(Uint8Array) |
| 295 | 302 |
| 296 int Length() const { return cobject_->value.as_byte_array.length; } | 303 int Length() const { return cobject_->value.as_byte_array.length; } |
| 297 uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; } | 304 uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; } |
| 298 }; | 305 }; |
| 299 | 306 |
| 300 #endif // BIN_DARTUTILS_H_ | 307 #endif // BIN_DARTUTILS_H_ |
| OLD | NEW |