Add believe_me and crash primitives to refc

This commit is contained in:
Edwin Brady 2020-10-11 18:51:45 +01:00
parent 3007b5a99d
commit 97e5f04c34
3 changed files with 12 additions and 0 deletions

View File

@ -242,6 +242,8 @@ cOp StrIndex [x, i] = "strIndex(" ++ x ++ ", " ++ i ++ ")"
cOp StrCons [x, y] = "strCons(" ++ x ++ ", " ++ y ++ ")"
cOp StrAppend [x, y] = "strAppend(" ++ x ++ ", " ++ y ++ ")"
cOp StrSubstr [x, y, z] = "strSubstr(" ++ x ++ ", " ++ y ++ ", " ++ z ++ ")"
cOp BelieveMe [_, _, x] = x
cOp Crash [_, msg] = "idris2_crash(" ++ msg ++ ");"
cOp fn args = plainOp (show fn) (toList args)

View File

@ -1,3 +1,4 @@
#include <unistd.h>
#include "prim.h"
Value *Prelude_IO_prim__getChar(Value *world)
@ -91,6 +92,14 @@ Value *sysOS(void)
return (Value *)makeString("Other");
#endif
}
Value* idris2_crash(Value* msg) {
Value_String* str = (Value_String*)msg;
printf("ERROR: %s\n", str->str);
exit(-1);
}
//
//
//

View File

@ -16,6 +16,7 @@ Value *writeIORef(Value *, Value *, Value *, Value *);
// Sys
Value *sysOS(void);
Value* idris2_crash(Value* msg);
// Array