Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /smlnj-c/trunk/c-calls.sig.sml
ViewVC logotype

Annotation of /smlnj-c/trunk/c-calls.sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2106 - (view) (download)

1 : monnier 249 (* c-calls.sig.sml
2 :     *
3 :     * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4 :     *
5 :     * Signature for an interface for calling user C functions from SML/NJ.
6 :     *)
7 :    
8 :     signature C_CALLS =
9 :     sig
10 :     (* an abstract pointer type *)
11 :     eqtype caddr
12 :     val NULL : caddr
13 :     val free : caddr -> unit
14 :     val index : (caddr * int) -> caddr
15 :     val difference : (caddr * caddr) -> Word32.word
16 :    
17 :     datatype ctype =
18 :     CaddrT
19 :     | CarrayT of (int * ctype)
20 :     | CcharT
21 :     | CdoubleT
22 :     | CfloatT
23 :     | CfunctionT of (ctype list * ctype)
24 :     | CintT
25 :     | ClongT
26 :     | CptrT of ctype
27 :     | CshortT
28 :     | CstringT (* C's null-terminated "char *" *)
29 :     | CstructT of ctype list
30 :     | CunionT of ctype list
31 :     | CvectorT of (int * ctype)
32 :     | CvoidT
33 :    
34 :     datatype cdata =
35 :     Caddr of caddr
36 :     | Carray of cdata Array.array
37 :     | Cchar of char
38 :     | Cdouble of real
39 :     | Cfloat of real
40 :     | Cfunction of cdata list -> cdata
41 :     | Cint of Word32.word
42 :     | Clong of Word32.word
43 :     | Cptr of cdata
44 :     | Cshort of Word32.word
45 :     | Cstring of string (* C's null-terminated "char *" *)
46 :     | Cstruct of cdata list
47 :     | Cunion of cdata
48 :     | Cvector of cdata Vector.vector
49 :     | Cvoid
50 :    
51 :     val datumMLtoC : ctype -> cdata -> (caddr * caddr list)
52 :     val datumCtoML : ctype -> caddr -> cdata
53 :    
54 :     (* number of bytes ctype uses in the C heap *)
55 :     (* size does not include pointed-to substructure (e.g. Cstring,Cptr) *)
56 :     val sizeof : ctype -> int
57 :    
58 :     (* total number of bytes the datum will occupy on the C heap *)
59 :     (* unlike sizeof, this includes all pointed-to substructure *)
60 :     val sizeofDatum : cdata -> int
61 :    
62 :     val hasType : cdata -> ctype
63 :    
64 :     exception EmptyAggregate
65 :     exception AggregateTooBig
66 :     exception BadReturnType of ctype
67 :     exception BadArgumentType of ctype
68 :     exception NotAPtr of ctype
69 :     exception UnimplementedForType
70 :    
71 :     val registerCFn : (string * ctype list * ctype) ->
72 :     (cdata list -> (cdata * caddr list))
73 :    
74 :     val registerAutoFreeCFn : (string * ctype list * ctype) ->
75 :     (cdata list -> cdata)
76 :     end (* signature C_CALLS *)
77 :    
78 :    
79 :    
80 :    
81 :    
82 :    
83 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0