/** The MIT License (MIT) Copyright (c) 2016 Camil Staps Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ definition module CleanC from StdClass import class toInt, class toString, class toReal, class fromInt, class fromString, class fromReal :: State :: CType = Int | String | Real :: CParam = CI Int | CS String | CR Real cNewState :: *State instance toInt CParam instance toString CParam instance toReal CParam class fromCParam a :: CParam -> a instance fromCParam Int instance fromCParam String instance fromCParam Real instance fromInt CParam instance fromString CParam instance fromReal CParam class toCParam a :: a -> CParam instance toCParam Int instance toCParam String instance toCParam Real class toCParamList a :: a -> [CParam] instance toCParamList [CParam] instance toCParamList Int instance toCParamList String instance toCParamList Real instance toCParamList (a,b) | toCParam a & toCParam b instance toCParamList (a,b,c) | toCParam a & toCParam b & toCParam c instance toCParamList (a,b,c,d) | toCParam a & toCParam b & toCParam c & toCParam d instance toCParamList (a,b,c,d,e) | toCParam a & toCParam b & toCParam c & toCParam d & toCParam e 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 cInit :: !*State -> *State cPuti :: !Int !*State -> *State cPuts :: !String !*State -> *State cPutr :: !Real !*State -> *State cPutParam :: !CParam -> *State -> *State cSetReturnType :: !CType -> *State -> *State cCall_ :: !String !*State -> *State cGeti :: !*State -> (!Int, !*State) cGets :: !*State -> (!String, !*State) cGetr :: !*State -> (!Real, !*State) cCall :: !CType !String !a !*State -> (!CParam, !*State) | toCParamList a