core: move the first function into carp template

This commit is contained in:
hellerve 2020-05-12 11:31:10 +02:00
parent f25db98861
commit d2235112dd
2 changed files with 1 additions and 11 deletions

View File

@ -18,6 +18,7 @@
(load-once "Interfaces.carp")
(load-once "Bool.carp")
(load-once "Macros.carp")
(load-once "Templates.carp")
(load-once "Generics.carp")
(load-once "Maybe.carp")
(load-once "Result.carp")

View File

@ -72,7 +72,6 @@ pointerModule = Env { envBindings = bindings
, envMode = ExternalEnv
, envFunctionNestingLevel = 0 }
where bindings = Map.fromList [ templatePointerCopy
, templatePointerEqual
, templatePointerToRef
, templatePointerToValue
, templatePointerAdd
@ -94,16 +93,6 @@ templatePointerCopy = defineTemplate
,"}"])
(const [])
templatePointerEqual = defineTemplate
(SymPath ["Pointer"] "eq")
(FuncTy [PointerTy (VarTy "p"), PointerTy (VarTy "p")] BoolTy StaticLifetimeTy)
"checks two pointers for equality."
(toTemplate "bool $NAME ($p *p1, $p *p2)")
(toTemplate $ unlines ["$DECL {"
," return p1 == p2;"
,"}"])
(const [])
-- | A template function for converting pointers to ref (it's up to the user of this function to make sure that is a safe operation).
templatePointerToRef = defineTemplate
(SymPath ["Pointer"] "to-ref")