diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/boot/strap/tokens.clisp | 13 | ||||
-rw-r--r-- | src/boot/tokens.boot | 1 | ||||
-rw-r--r-- | src/lisp/core.lisp.in | 17 |
4 files changed, 32 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2b59d00f..09307931 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-10-05 Gabriel Dos Reis <gdr@cse.tamu.edu> + + * lisp/core.lisp.in (eof?): New. + (listToString): Likewise. + (formatToString): Likewise. + * boot/tokens.boot: Add fifth as builtin library function. + 2011-10-04 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/lexing.boot: Add support for Token abstract datatype. diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp index ba4e28a2..fac4526d 100644 --- a/src/boot/strap/tokens.clisp +++ b/src/boot/strap/tokens.clisp @@ -185,12 +185,13 @@ (LIST '|copyString| 'COPY-SEQ) (LIST '|copyTree| 'COPY-TREE) (LIST '|copyVector| 'COPY-SEQ) (LIST '|croak| 'CROAK) (LIST '|digit?| 'DIGIT-CHAR-P) (LIST '|drop| 'DROP) - (LIST '|exit| 'EXIT) (LIST '|false| 'NIL) (LIST '|first| 'CAR) - (LIST '|float?| 'FLOATP) (LIST '|flushOutput| 'FORCE-OUTPUT) - (LIST '|fourth| 'CADDDR) (LIST '|function| 'FUNCTION) - (LIST '|function?| 'FUNCTIONP) (LIST '|gensym| 'GENSYM) - (LIST '|genvar| 'GENVAR) (LIST '|integer?| 'INTEGERP) - (LIST 'LAST '|last|) (LIST '|list| 'LIST) (LIST '|listEq?| 'EQUAL) + (LIST '|exit| 'EXIT) (LIST '|false| 'NIL) (LIST '|fifth| 'FIFTH) + (LIST '|first| 'CAR) (LIST '|float?| 'FLOATP) + (LIST '|flushOutput| 'FORCE-OUTPUT) (LIST '|fourth| 'CADDDR) + (LIST '|function| 'FUNCTION) (LIST '|function?| 'FUNCTIONP) + (LIST '|gensym| 'GENSYM) (LIST '|genvar| 'GENVAR) + (LIST '|integer?| 'INTEGERP) (LIST 'LAST '|last|) + (LIST '|list| 'LIST) (LIST '|listEq?| 'EQUAL) (LIST '|lowerCase?| 'LOWER-CASE-P) (LIST '|makeSymbol| 'INTERN) (LIST '|maxIndex| 'MAXINDEX) (LIST '|mkpf| 'MKPF) (LIST '|newString| 'MAKE-STRING) (LIST '|newVector| 'MAKE-ARRAY) diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot index 14abfeec..56e1b051 100644 --- a/src/boot/tokens.boot +++ b/src/boot/tokens.boot @@ -260,6 +260,7 @@ for i in [ _ ["drop", "DROP"] , _ ["exit", "EXIT"] , _ ["false", 'NIL] , _ + ["fifth", "FIFTH"] , _ ["first", "CAR"] , _ ["float?", "FLOATP"] , _ ["flushOutput", "FORCE-OUTPUT"], _ diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in index ba19d87f..d9bce925 100644 --- a/src/lisp/core.lisp.in +++ b/src/lisp/core.lisp.in @@ -98,10 +98,12 @@ "outputTextFile" "closeFile" "closeStream" + "eof?" "prettyPrint" "readLine" "readExpr" "readIntegerIfCan" + "formatToString" ;; compiler data structures "%Mode" @@ -138,6 +140,7 @@ "makeByteArray" "makeBitVector" "makeString" + "listToString" "%hasFeature" "%systemOptions" @@ -525,6 +528,9 @@ (defmacro |closeStream| (s) `(close ,s)) +(defmacro |eof?| (s) + `(null (peek-char nil ,s nil nil nil))) + ;; Read a line from the input text file. Quietly return ;; %nothing at end of file. (defmacro |readLine| (f) @@ -550,6 +556,9 @@ (*print-level* nil)) (prin1 x s))) +(defmacro |formatToString| (&rest args) + `(format nil ,@args)) + ;; ;; -*- OpenAxiom filesystem -*- ;; @@ -1373,6 +1382,14 @@ (defun |makeString| (n &optional (c (code-char 0))) (make-string n :initial-element c)) +(defun |listToString| (l) + (let ((s (|makeString| (list-length l)))) + (do ((i 0 (1+ i))) + (null l) + (setf (schar s i) (car l)) + (setq l (cdr l))) + s)) + ;; native data type translation table (defconstant |$NativeTypeTable| '((|void| . @void_type@) |