aboutsummaryrefslogtreecommitdiff
path: root/CleanC.dcl
diff options
context:
space:
mode:
authorCamil Staps2016-01-31 15:52:34 +0100
committerCamil Staps2016-01-31 15:52:34 +0100
commit7b64bbce7b62cfd564d6a0d664ae7ce07b707225 (patch)
tree2d6209f09d04bead85435eef7c89b574dfeb4e0e /CleanC.dcl
parentExtended testing (diff)
Documentation
Diffstat (limited to 'CleanC.dcl')
-rw-r--r--CleanC.dcl10
1 files changed, 10 insertions, 0 deletions
diff --git a/CleanC.dcl b/CleanC.dcl
index ba744cd..a385a50 100644
--- a/CleanC.dcl
+++ b/CleanC.dcl
@@ -62,21 +62,31 @@ instance toCParamList (a,b,c,d,e) | toCParam a & toCParam b & toCParam c & toCPa
instance toCParamList (a,b,c,d,e,f) | toCParam a & toCParam b & toCParam c & toCParam d & toCParam e & toCParam f
instance toCParamList (a,b,c,d,e,f,g) | toCParam a & toCParam b & toCParam c & toCParam d & toCParam e & toCParam f & toCParam g
+// Must be called before using any other function, initialises the interface
cInit :: !*State -> *State
+// Low-level functions to send function arguments to C
cPuti :: !Int !*State -> *State
cPuts :: !String !*State -> *State
cPutr :: !Real !*State -> *State
+// Low-level: send any function argument to C
cPutParam :: !CParam -> *State -> *State
+// Low-level: set the return type of the function you're going to call
cSetReturnType :: !CType -> *State -> *State
+// Low-level: call a function
cCall_ :: !String !*State -> *State
+// Low-level: get the return value of a function
cGeti :: !*State -> (!Int, !*State)
cGets :: !*State -> (!String, !*State)
cGetr :: !*State -> (!Real, !*State)
+// Call a function with arguments and get the return value
+//
+// E.g., for a function int add(int x, int y) you would use:
+// (sum, st) = cCall Int "add" (15, 20) st
cCall :: !CType !String !a !*State -> (!CParam, !*State) | toCParamList a