]> gitweb.factorcode.org Git - factor.git/blob - core/alien/strings/strings-docs.factor
335ab73328e69898d6a1b3c4ffd225bfdfecc2b3
[factor.git] / core / alien / strings / strings-docs.factor
1 USING: help.markup help.syntax strings byte-arrays alien libc
2 debugger io.encodings.string sequences ;
3 IN: alien.strings
4
5 HELP: string>alien
6 { $values { "string" string } { "encoding" "an encoding descriptor" } { "byte-array" byte-array } }
7 { $description "Encodes a string together with a trailing null code point using the given encoding, and stores the resulting bytes in a freshly-allocated byte array." }
8 { $errors "Throws an error if the string contains null characters, or characters not representable in the given encoding." } ;
9
10 HELP: alien>string
11 { $values { "c-ptr" c-ptr } { "encoding" "an encoding descriptor" } { "string/f" "a string or " { $link f } } }
12 { $description "Reads a null-terminated C string from the specified address with the given encoding." } ;
13
14 HELP: string>symbol
15 { $values { "str/seq" { $or string sequence } } { "alien" alien } }
16 { $description "Converts the string to a format which is a valid symbol name for the Factor VM's compiled code linker. By performing this conversion ahead of time, the image loader can run without allocating memory."
17 $nl
18 "On Windows CE, symbols are represented as UCS2 strings, and on all other platforms they are ASCII strings." } ;
19
20 ABOUT: "c-strings"