mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Added assert
This commit is contained in:
parent
eeddb0b25a
commit
2b9adec087
6 changed files with 15 additions and 2 deletions
BIN
lama-spec.pdf
BIN
lama-spec.pdf
Binary file not shown.
|
|
@ -1,3 +1,4 @@
|
||||||
|
F,assert;
|
||||||
F,getEnv;
|
F,getEnv;
|
||||||
F,system;
|
F,system;
|
||||||
V,sysargs;
|
V,sysargs;
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,15 @@ static void failure (char *s, ...) {
|
||||||
vfailure (s, args);
|
vfailure (s, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lassert (void *f, char *s, ...) {
|
||||||
|
if (!UNBOX(f)) {
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, s);
|
||||||
|
vfailure (s, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# define ASSERT_BOXED(memo, x) \
|
# define ASSERT_BOXED(memo, x) \
|
||||||
do if (UNBOXED(x)) failure ("boxed value expected in %s\n", memo); while (0)
|
do if (UNBOXED(x)) failure ("boxed value expected in %s\n", memo); while (0)
|
||||||
# define ASSERT_UNBOXED(memo, x) \
|
# define ASSERT_UNBOXED(memo, x) \
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ is added implicitly by the compiler and can not be specified by an end user.
|
||||||
|
|
||||||
The following declarations are accessible:
|
The following declarations are accessible:
|
||||||
|
|
||||||
|
\descr{\lstinline|fun assert (n, s, ...)|}{Asserts that \lstinline|n| is non-zero; otherwise raises \lstinline|failure| with
|
||||||
|
a corresponding error message.}
|
||||||
|
|
||||||
\descr{\lstinline|fun stringInt (s)|}{Converts a string representation of a signed decimal number into integer.}
|
\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 read ()|}{Reads an integer value from the standard input, printing a prompt "\lstinline|>|".}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
let path = "/home/db/.opam/4.07.1+fp/share/Lama"
|
let path = "/home/db/.opam/4.07.1+fp+flambda/share/Lama"
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
let version = "Version 1.00, 19252991a, Thu Dec 24 02:54:54 2020 +0300"
|
let version = "Version 1.00, eeddb0b25, Tue Jan 12 01:14:18 2021 +0300"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue