-USING: alien.accessors alien.c-types alien.libraries alien.strings
-alien.syntax byte-arrays cpu.x86 eval help.markup help.syntax io
-io.backend io.encodings.utf16n io.encodings.utf8 kernel math
-quotations sequences system ;
+USING: alien.accessors alien.c-types alien.libraries
+alien.strings alien.syntax byte-arrays cpu.x86 eval help.markup
+help.syntax io io.backend io.encodings.utf16 io.encodings.utf8
+kernel math quotations sequences system ;
IN: alien
HELP: callee-cleanup?
{ $description "Tests if the alien is a relic from an earlier session. A byte array is never considered to have expired, whereas passing " { $link f } " always yields true." } ;
HELP: <bad-alien>
-{ $values { "alien" c-ptr } }
+{ $values { "alien" c-ptr } }
{ $description "Constructs an invalid alien pointer that has expired." } ;
HELP: <displaced-alien>
HELP: free-callback
{ $values { "alien" alien } }
-{ $description "Releases the callback heap memory allocated for an alien callback. " }
+{ $description "Releases the callback heap memory allocated for an alien callback." }
{ $warning "If the callback is invoked (either from C or Factor) after it has been freed, then Factor may crash." } ;
HELP: with-callback
{ $class-description "Class of objects consisting of aliens, byte arrays and " { $link f } ". These objects all can be used as values of " { $link pointer } " C types." } ;
HELP: alien-invoke
-{ $values { "args..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } { "return..." "the return value of the function, if not " { $link void } } }
+{ $values { "args..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } { "varargs?" boolean } { "return..." "the return value of the function, if not " { $link void } } }
{ $description "Calls a C library function with the given name. Input parameters are taken from the data stack, and the return value is pushed on the data stack after the function returns. A return type of " { $link void } " indicates that no value is to be expected." }
{ $notes "C type names are documented in " { $link "c-types-specs" } "." }
{ $errors "Throws an " { $link callsite-not-compiled } " if the word calling " { $link alien-invoke } " was not compiled with the optimizing compiler." } ;
ARTICLE: "embedding" "Embedding Factor into C applications"
"The Factor " { $snippet "Makefile" } " builds the Factor VM both as an executable and a library. The library can be used by other applications. File names for the library on various operating systems:"
{ $table
- { "OS" "Library name" "Shared?" }
+ { { $strong "OS" } { $strong "Library name" } { $strong "Shared?" } }
{ "Windows XP/Vista" { $snippet "factor.dll" } "Yes" }
{ "Mac OS X" { $snippet "libfactor.dylib" } "Yes" }
{ "Other Unix" { $snippet "libfactor.a" } "No" }