Next: Bitvectors, Previous: Arrays, Up: Lisp objects
A string, both in Common-Lisp and in ECL is nothing but a vector of
characters. Therefore, almost everything mentioned in the section of arrays
remains valid here. The only important difference is that ECL stores
strings as a lisp object with a pointer to a zero terminated C string. Thus, if
a string has n characters, ECL will reserve n+1 bytes for the
string. This allows us to pass the string self pointer to any C
routine.
If x is a lisp object of type string, we can access the following fields:
x->string.dimx->string.fillpx->string.selfx->string.hasfillpx->string.fillp can be smaller than x->string.dim.
Both routines build a lisp string from a C string.
make_string_copyallocates new space and copies the content of the string to it.make_simple_stringsimply uses the memory pointed by s, which should not be deallocated. Both routines usestrlento calculate the length of the string.