Fixed bugs in runtime; added stringInt

This commit is contained in:
Dmitry Boulytchev 2020-02-23 01:36:30 +03:00
parent e0ad5aa89a
commit 2c85715ae0
4 changed files with 11 additions and 2 deletions

View file

@ -1,4 +1,5 @@
V,sysargs;
F,stringInt;
F,makeArray;
F,clone;
F,hash;

View file

@ -696,6 +696,12 @@ int inner_hash (int depth, unsigned acc, void *p) {
}
}
extern void* LstringInt (char *b) {
int n;
sscanf (b, "%d", &n);
return BOX(n);
}
extern int Lhash (void *p) {
return BOX(inner_hash (0, 0, p));
}
@ -1115,7 +1121,7 @@ extern void Bmatch_failure (void *v, char *fname, int line, int col) {
createStringBuf ();
printValue (v);
failure ("match failure at %s:%d:%d, value '%s'\n",
fname, line, col, stringBuf.contents);
fname, UNBOX(line), UNBOX(col), stringBuf.contents);
}
extern void* /*Lstrcat*/ Li__Infix_4343 (void *a, void *b) {

View file

@ -12,6 +12,8 @@ is added implicitly by the compiler and can not be specified by an end user.
The following declarations are accessible:
\descr{\lstinline|fun stringInt (s)|}{Converts a string representation of a signed decimal number into integer.}
\descr{\lstinline|fun read ()|}{Reads an integer value from the standard input, printing a prompt "\lstinline|>|".}
\descr{\lstinline|fun write (int)|}{Writes an integer value to the standard output.}

View file

@ -1 +1 @@
let version = "Version 1.00, 7ebbf65b, Thu Feb 20 20:25:29 2020 +0300"
let version = "Version 1.00, e0ad5aa8, Thu Feb 20 20:29:57 2020 +0300"