]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/alien/c-types/c-types-docs.factor
Remove many uses of <int> and *int etc
[factor.git] / basis / alien / c-types / c-types-docs.factor
index 32c1d18d51d0154eec25e0bd7faa69b3b1f536da..8643ae8072597f0c71f28e98cd6ff656fa076afd 100644 (file)
@@ -121,38 +121,10 @@ $nl
 ARTICLE: "c-out-params" "Output parameters in C"
 "A frequently-occurring idiom in C code is the \"out parameter\". If a C function returns more than one value, the caller passes pointers of the correct type, and the C function writes its return values to those locations."
 $nl
-"Each numerical C type, together with " { $snippet "void*" } ", has an associated " { $emphasis "out parameter constructor" } " word which takes a Factor object as input, constructs a byte array of the correct size, and converts the Factor object to a C value stored into the byte array:"
-{ $subsections
-    <char>
-    <uchar>
-    <short>
-    <ushort>
-    <int>
-    <uint>
-    <long>
-    <ulong>
-    <longlong>
-    <ulonglong>
-    <float>
-    <double>
-    <void*>
-}
-"You call the out parameter constructor with the required initial value, then pass the byte array to the C function, which receives a pointer to the start of the byte array's data area. The C function then returns, leaving the result in the byte array; you read it back using the next set of words:"
-{ $subsections
-    *char
-    *uchar
-    *short
-    *ushort
-    *int
-    *uint
-    *long
-    *ulong
-    *longlong
-    *ulonglong
-    *float
-    *double
-    *void*
-}
+"To wrap Factor data for consumption by the FFI, we use a utility word that constructs a byte array of the correct size and converts the Factor object to a C value stored into that byte array:"
+{ $subsections <ref> }
+"You call the out parameter constructor with the required initial value, then pass the byte array to the C function, which receives a pointer to the start of the byte array's data area. The C function then returns, leaving the result in the byte array; you read it back using this word:"
+{ $subsections deref }
 "Note that while structure and union types do not get these words defined for them, there is no loss of generality since " { $link <void*> } " and " { $link *void* } " may be used." ;
 
 ARTICLE: "c-types.primitives" "Primitive C types"