Status: Finished and somewhat useful.
Description: it does, like, string things, ya know?
Note: true == true value in c, false == false value in c
#t and #f as in scheme.
True if x is a SCM object representing a scheme string
True if x is not a string object.
True if x can be written to.
True if x cannot be modified.
#t if str is a read-only string (i.e. a shared substring).
slots
with space for scheme values. The pointer to the actual start of this
allocated memory is located in the word before the string's chars (so,
SCM_CHARS(str)-1 == pointer to the start of slots).
Anyhow, this creates a scheme list of scheme strings from an array of c strings.
;). Maybe an example
;)
char the_string = "This is a string"; SCM the_scm_string = scm_tak0str(the_string); SCM_CHARS(the_scm_string)[0] = 't'; printf(the_string); -| "this is a string"
scm_makstr, except this one initializes
the first len-1 chars from src. Note that it doesn't
actually check that src is long enough, so you have to be
careful. On the plus side, none of the parameters are named `it'.
mak function (when SCM was originally written, "e's"
were under dispute due to a really stupid patent involving the creators
of Sesame Street), this one just calls scm_makfromstr with the
src string, the length of the src string, and no slots
specfied.
scm_makfrom0str again ... maybe it's
supposed to be optimized? It isn't, though. It kind of looks cooler,
though, with makfrom0str sandwiched between scm_ and _opt.
[car] ---------> [cdr]
type&length |
|
+------+------+
[car] [cdr]
offset pointer to `real' string
The storage is shared between the original and the copy. Currently, you cannot (or at least shouldn't) write to the string contained in a shared substring (I believe that the eventual goal is to support copy-on-write shared substrings).