From 7b64bbce7b62cfd564d6a0d664ae7ce07b707225 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 31 Jan 2016 15:52:34 +0100 Subject: Documentation --- CleanC.dcl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'CleanC.dcl') 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 -- cgit v1.2.3