Fixed-width strings: Difference between revisions

no edit summary
No edit summary
Line 40: Line 40:
''In SM, buffer allocations are not exact, but on certain boundaries (16 bytes?), leaving spare room at the end, so appends are possible. When appended, a new String instance is created that shares its buffer with the original instance, just longer. This technique would inhibit the use of 0x00 string terminators.''
''In SM, buffer allocations are not exact, but on certain boundaries (16 bytes?), leaving spare room at the end, so appends are possible. When appended, a new String instance is created that shares its buffer with the original instance, just longer. This technique would inhibit the use of 0x00 string terminators.''


''How are strings constants passed in to the engine? I assume that they are part of the .abc image, so it should be assumed that they are UTF-8?''
''The .abc image contains utf-8 strings that are not 0-terminated. A future abc format could deliver 8/16/32 bit fixed with strings, so it is desireable to support a string object that can point to external data.  That ability is also desireable for the substring() and charAt() operations''


Getting a substring also flattens the source string. The substring is an instance that contains a pointer to the source string, and pointer to the start of the source string buffer. The length field contains the string length. This string is already flat, although it contains a reference to another string. It may be desirable to have a separate flattening function for this case.
Getting a substring also flattens the source string. The substring is an instance that contains a pointer to the source string, and pointer to the start of the source string buffer. The length field contains the string length. This string is already flat, although it contains a reference to another string. It may be desirable to have a separate flattening function for this case.
9

edits