"@"

sym1

cnt1

sym2

cnt2

any

T

The result specification may either be one of the atoms

NIL void B byte # Byte (unsigned 8 bit) C char # Character (UTF-8, 1-4 bytes) I int # Integer (signed 32 bit) N long # Long or pointer (signed 64 bit) S string # String (UTF-8) -1.0 float # Scaled fixpoint number +1.0 double # Scaled fixpoint number T # Don't call, just assign handle and pointer

or nested lists of these atoms with size specifications to denote arrays and structures, e.g.

(N . 4) # long[4]; -> (1 2 3 4) (N (C . 4)) # {long; char[4];} -> (1234 ("a" "b" "c" NIL)) (N (B . 7)) # {long; byte[7];} -> (1234 (1 2 3 4 5 6 7))

Arguments can be

integers (up to 64-bit) or pointers, passed as numbers

strings, passed as symbols

fixpoint numbers, passed as cons pairs consisting of a the value and the scale (if the scale is positive, the number is passed as a double , otherwise as a float )

, otherwise as a ) structures, passed as lists with a variable in the CAR (to receive the returned structure data, ignored when the CAR is NIL ) a cons pair for the size and result specification in the CADR (see above), and an optional sequence of initialization items in the CDDR, where each may be a positive number, stored as an unsigned byte value a negative number, whose absolute value is stored as an unsigned integer a pair (num . cnt) where ' num ' is stored in a field of ' cnt ' bytes a pair (sym . cnt) where ' sym ' is stored as a null-terminated string in a field of ' cnt ' bytes a list (1.0 num ...) where the ' num ' elements (scaled fixpoint numbers) are stored as a sequence of double precision floating point numbers a list (-1.0 num ...) where the ' num ' elements (scaled fixpoint numbers) are stored as a sequence of single precision floating point numbers If the last CDR of the initialization sequence is a number, it is used as a fill-byte value for the remaining space in the structure.



native takes care of allocating memory for strings, arrays or structures, and frees that memory when done.

The number of fixpoint arguments is limited to six. For NaN or negative infinity NIL , and for positive infinity T is returned.

The C function may in turn call a function

long lisp(char*, long, long, long, long, long);

which accepts a symbol name as the first argument, and up to 5 numbers. lisp() calls that symbol with the five numbers, and expects a numeric return value. "Numbers" in this context are 64-bit scalars, and may not only represent integers, but also pointers or other encoded data. See also struct , lisp and errno .