1 (* Copyright (C) 2009,2015 Matthew Fluet.
2 * Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
9 signature C_FUNCTION_STRUCTS =
11 structure CType: C_TYPE
14 signature C_FUNCTION =
16 include C_FUNCTION_STRUCTS
20 datatype t = Cdecl | Stdcall
22 val layout: t -> Layout.t
23 val toString: t -> string
31 | Runtime of {(* bytesNeeded = SOME i means that the i'th
32 * argument to the function is a word that
33 * specifies the number of bytes that must be
34 * free in order for the C function to succeed.
35 * Limit check insertion is responsible for
36 * making sure that the bytesNeeded is available.
38 bytesNeeded: int option,
39 ensuresBytesFree: bool,
41 maySwitchThreads: bool,
42 modifiesFrontier: bool,
51 val layout: t -> Layout.t
52 val toString: t -> string
54 val bytesNeeded: t -> int option
55 val ensuresBytesFree: t -> bool
57 val maySwitchThreads: t -> bool
58 val modifiesFrontier: t -> bool
59 val readsStackTop: t -> bool
60 val writesStackTop: t -> bool
63 structure SymbolScope:
65 datatype t = External | Private | Public
67 val layout: t -> Layout.t
68 val toString: t -> string
73 datatype t = Direct of string | Indirect
75 val layout: t -> Layout.t
76 val toString: t -> string
79 datatype 'a t = T of {args: 'a vector,
80 convention: Convention.t,
82 prototype: CType.t vector * CType.t option,
84 symbolScope: SymbolScope.t,
85 (* target = Indirect means that the 0'th
86 * argument to the function is a word
87 * that specifies the target.
91 val args: 'a t -> 'a vector
92 val bytesNeeded: 'a t -> int option
93 val convention: 'a t -> Convention.t
94 val ensuresBytesFree: 'a t -> bool
95 val equals: 'a t * 'a t -> bool
96 val cPointerType: 'a t -> string
97 val cPrototype: 'a t -> string
98 val isOk: 'a t * {isUnit: 'a -> bool} -> bool
99 val layout: 'a t * ('a -> Layout.t) -> Layout.t
100 val map: 'a t * ('a -> 'b) -> 'b t
101 val mayGC: 'a t -> bool
102 val maySwitchThreads: 'a t -> bool
103 val modifiesFrontier: 'a t -> bool
104 val prototype: 'a t -> CType.t vector * CType.t option
105 val readsStackTop: 'a t -> bool
106 val return: 'a t -> 'a
107 val symbolScope: 'a t -> SymbolScope.t
108 val target: 'a t -> Target.t
109 val writesStackTop: 'a t -> bool
110 val vanilla: {args: 'a vector,
112 prototype: CType.t vector * CType.t option,