Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: runtime/include/dart_api.h

Issue 8383029: Implement external strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: pre-review clean-up Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/string.dart » ('j') | runtime/vm/dart_api_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 INCLUDE_DART_API_H_ 5 #ifndef INCLUDE_DART_API_H_
6 #define INCLUDE_DART_API_H_ 6 #define INCLUDE_DART_API_H_
7 7
8 #ifdef __cplusplus 8 #ifdef __cplusplus
9 #define DART_EXTERN_C extern "C" 9 #define DART_EXTERN_C extern "C"
10 #else 10 #else
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // TODO(iposva): Pass a specification of the app file being spawned. 91 // TODO(iposva): Pass a specification of the app file being spawned.
92 typedef void* (*Dart_IsolateInitCallback)(void* data); 92 typedef void* (*Dart_IsolateInitCallback)(void* data);
93 93
94 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); 94 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments);
95 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, 95 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name,
96 int num_of_arguments); 96 int num_of_arguments);
97 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, 97 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag,
98 Dart_Handle library, 98 Dart_Handle library,
99 Dart_Handle url); 99 Dart_Handle url);
100 100
101 typedef void (*Dart_ExternalString8Finalizer)(uint8_t* codepoints);
102 typedef void (*Dart_ExternalString16Finalizer)(uint16_t* codepoints);
103 typedef void (*Dart_ExternalString32Finalizer)(uint32_t* codepoints);
104
101 // TODO(iposva): This is a placeholder for the eventual external Dart API. 105 // TODO(iposva): This is a placeholder for the eventual external Dart API.
102 106
103 // Return value handling after a Dart API call. 107 // Return value handling after a Dart API call.
104 DART_EXPORT bool Dart_IsValidResult(const Dart_Result& result); 108 DART_EXPORT bool Dart_IsValidResult(const Dart_Result& result);
105 109
106 inline intptr_t Dart_GetResultAsCIntptr(const Dart_Result& result) { 110 inline intptr_t Dart_GetResultAsCIntptr(const Dart_Result& result) {
107 assert(result.type_ == kRetCIntptr); // Valid to access result as C int. 111 assert(result.type_ == kRetCIntptr); // Valid to access result as C int.
108 return result.retval_.int_value; 112 return result.retval_.int_value;
109 } 113 }
110 inline Dart_Result Dart_ResultAsCIntptr(intptr_t value) { 114 inline Dart_Result Dart_ResultAsCIntptr(intptr_t value) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DART_EXPORT Dart_Result Dart_StringLength(Dart_Handle str); 290 DART_EXPORT Dart_Result Dart_StringLength(Dart_Handle str);
287 291
288 DART_EXPORT Dart_Handle Dart_NewString(const char* str); 292 DART_EXPORT Dart_Handle Dart_NewString(const char* str);
289 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, 293 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints,
290 intptr_t length); 294 intptr_t length);
291 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints, 295 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints,
292 intptr_t length); 296 intptr_t length);
293 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, 297 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints,
294 intptr_t length); 298 intptr_t length);
295 299
300 DART_EXPORT Dart_Handle Dart_NewExternalString8(
Anton Muhin 2011/10/25 10:19:02 this API might be difficult to use by embedder. F
cshapiro 2011/10/25 20:42:47 Sure, I'll add and additional argument.
301 uint8_t* codepoints,
302 intptr_t length,
303 Dart_ExternalString8Finalizer finalizer);
304 DART_EXPORT Dart_Handle Dart_NewExternalString16(
Anton Muhin 2011/10/25 10:19:02 Another note, just in case: ideally we need a way
cshapiro 2011/10/25 20:42:47 Doesn't the embedding API provide a way to do this
Anton Muhin 2011/10/26 14:11:52 Not quite. I do not want to fetch a codepoints ou
cshapiro 2011/10/26 23:35:08 Okay, I think I understand more about what you wan
Anton Muhin 2011/10/27 14:14:46 Sorry, I didn't mean data is invalid. I meant it
cshapiro 2011/10/27 21:12:51 Thanks for clarifying. I think we can do what you
Anton Muhin 2011/10/31 09:02:04 I'll run GMail in customized build to gather the s
Anton Muhin 2011/11/01 17:40:44 Promised data (I collected all the string which ca
305 uint16_t* codepoints,
306 intptr_t length,
307 Dart_ExternalString16Finalizer finalizer);
308 DART_EXPORT Dart_Handle Dart_NewExternalString32(
309 uint32_t* codepoints,
310 intptr_t length,
311 Dart_ExternalString32Finalizer finalizer);
312
313
296 // The functions below test whether the object is a String and its codepoints 314 // The functions below test whether the object is a String and its codepoints
297 // all fit into 8 or 16 bits respectively. 315 // all fit into 8 or 16 bits respectively.
298 DART_EXPORT bool Dart_IsString8(Dart_Handle object); 316 DART_EXPORT bool Dart_IsString8(Dart_Handle object);
299 DART_EXPORT bool Dart_IsString16(Dart_Handle object); 317 DART_EXPORT bool Dart_IsString16(Dart_Handle object);
300 318
301 DART_EXPORT Dart_Result Dart_StringGet8(Dart_Handle str, 319 DART_EXPORT Dart_Result Dart_StringGet8(Dart_Handle str,
302 uint8_t* codepoints, 320 uint8_t* codepoints,
303 intptr_t length); 321 intptr_t length);
304 DART_EXPORT Dart_Result Dart_StringGet16(Dart_Handle str, 322 DART_EXPORT Dart_Result Dart_StringGet16(Dart_Handle str,
305 uint16_t* codepoints, 323 uint16_t* codepoints,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // External pprof support for gathering and dumping symbolic information 453 // External pprof support for gathering and dumping symbolic information
436 // that can be used for better profile reports for dynamically generated 454 // that can be used for better profile reports for dynamically generated
437 // code. 455 // code.
438 DART_EXPORT void Dart_InitPprofSupport(); 456 DART_EXPORT void Dart_InitPprofSupport();
439 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); 457 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size);
440 458
441 // Check set vm flags. 459 // Check set vm flags.
442 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); 460 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name);
443 461
444 #endif // INCLUDE_DART_API_H_ 462 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/string.dart » ('j') | runtime/vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698