5 lines
5.0 KiB
Plaintext
5 lines
5.0 KiB
Plaintext
The Call-C-Function MISCN opcode
|
||
This opcode calls the specified C function, performaing conversion of arguments and result as needed, and returning an indication of any errors it encounters.
|
||
|
||
(MISCN CALL-C Function Conversion-spec Return-Code &REST Args-To-C-Fn)
|
||
Function is a Lisp integer (FIXP or SMALLP) containing the address of the function to be called. CALL-C checks for some special values, 0 (meaning the function was never loaded) and -1 (meaning the function was loaded once, and subsequently unloaded at user request), and -2 (meaning that the function has been loaded, but there are unresolved externals).
|
||
Conversion-spec specifies how the arguments and function-result are to be converted.
|
||
This is a Lisp pointer to a block of 16-bit entries:
|
||
+------------------------+
|
||
+ Result Conversion Spec |
|
||
+------------------------+
|
||
| Arg 0 Conversion |
|
||
+------------------------+
|
||
| Arg 1 Conversion |
|
||
+------------------------+
|
||
| etc. |
|
||
+------------------------+
|
||
| -0- |
|
||
+------------------------+
|
||
Possible values for the conversion fields:
|
||
0 VOID (return only, return NIL)
|
||
1 int (Lisp SMALLP/FIXP <=> 32-bit integer)
|
||
2 char (Lisp SMALLP/CHARACTER <=> char)
|
||
3 float
|
||
4 long
|
||
5 short
|
||
6 lisp
|
||
7 cpointer
|
||
Return-Code is a FIXP cell into which CALL-C places a return value. Possible values are:
|
||
0 Successful call and return
|
||
+n conversion error on argument n
|
||
-1 conversion error on result
|
||
-2 signal encountered while running C??
|
||
DEFFOREIGNÿÿ |