From: Clark C . E. <cc...@cl...> - 2001-06-30 02:50:12
|
On Fri, Jun 29, 2001 at 05:35:29PM -0400, Clark C . Evans wrote: | 1. Should strings be used for values as well | as keys? I think the answer to this one is yes. Both the push and pull methods will have a way to ask/get values as a peice of an array and as a whole string. With the fixed "C++" style structure, two default methods can be included as part of the standard library which will change one style into the other; making the burden on implementers/users of the interfaces managable. | 2. Is the string treated as an object, i.e., | does it have a interface based layout | (in C++ style for clarity) ... | Or does it use global functions: I think the answer to this one is to use global functions; this is the most compatible with OLE BSTR and also very consistent with the "char *" pointer method. Thus, a yaml_string will be implemented as a pointer to yaml_char_t, and the size of the string can be obtained by backing up sizeof(long) to read the string length. Access will be done through the following methods... | typedef char * yaml_char_t; /* or unsigned short */ | typedef void * yaml_string_t; | yaml_string_t yaml_clone(yaml_string_t) | void yaml_release(yaml_string_t) | yaml_char_t * yaml_buff(yaml_string_t) | long yaml_length(yaml_string_t) The yaml_length and yaml_buff will then be simple #defines, except on the Windows platform, where yaml_string_t will be defined as a BSTR and yaml_buff and yaml_length will be defined as the corresponding Sys function... Also, some way to create a yaml_string based on multiple array fragments should also be provided... probably an "create" and "append" functions. | 3. Should the string library include | methods for string creation and, possibly, | fast comparison? The default implementaiton | could, for instance, do string interning... With a single yaml_string_t mechanism, it will be possible for the implementation (perhaps with a compile time option) to specify if string interning will be done. Best, Clark |