]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/classes/struct/struct-docs.factor
alien: fix docs for FUNCTION: not using a ; anymore
[factor.git] / basis / classes / struct / struct-docs.factor
index 331aebe22a1e77a4b399d36161e842214fcf3740..f582ad05da019592949f3e6e01d50293231b39d6 100644 (file)
@@ -1,4 +1,5 @@
-! (c)Joe Groff bsd license
+! Copyright (C) Joe Groff.
+! See http://factorcode.org/license.txt for BSD license.
 USING: alien classes classes.struct.private help.markup help.syntax
 kernel libc math sequences ;
 IN: classes.struct
@@ -170,6 +171,7 @@ ARTICLE: "classes.struct.c" "Passing structs to C functions"
 $nl
 "If a parameter is declared with a struct type, the parameter is passed by value. To pass a struct by reference, declare a parameter with a pointer to struct type."
 $nl
+{ $heading "C functions returning structs" }
 "If a C function is declared as returning a struct type, the struct is returned by value, and wrapped in an instance of the correct struct class automatically. If a C function is declared as returning a pointer to a struct, it will return an " { $link alien } " instance. This is because there is no way to distinguish between a pointer to a single struct and a pointer to an array of zero or more structs. It is up to the caller to wrap it in a struct using " { $link memory>struct } ", or a specialized array of structs using " { $snippet "<direct-T-array>" } ", respectively."
 $nl
 "An example of a struct declaration:"
@@ -184,11 +186,11 @@ $nl
 "A C function which returns a struct by value:"
 { $code
     "USING: alien.syntax ;"
-    "FUNCTION: Point give_me_a_point ( c-string description ) ;"
+    "FUNCTION: Point give_me_a_point ( c-string description )"
 }
 "A C function which takes a struct parameter by reference:"
 { $code
-    "FUNCTION: void print_point ( Point* p ) ;"
+    "FUNCTION: void print_point ( Point* p )"
 } ;
 
 ARTICLE: "classes.struct" "Struct classes"