aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog8
-rw-r--r--src/interp/Makefile.in6
-rw-r--r--src/interp/io.boot65
-rw-r--r--src/interp/lexing.boot1
-rw-r--r--src/interp/preparse.lisp9
5 files changed, 81 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7167c7b1..fdf8f767 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-06 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/Makefile.in (OBJS): Include io.$(FASLEXT).
+ (io.$(FASLEXT)): New rule.
+ * interp/io.boot: New.
+ * interp/preparse.lisp: Use storeBlanks!.
+ (STOREBLANKS): Remove.
+
2012-05-05 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/preparse.lisp (ADDCLOSE): Move to spad-parser.boot.
diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in
index ac5a584e..e4201fd6 100644
--- a/src/interp/Makefile.in
+++ b/src/interp/Makefile.in
@@ -55,7 +55,7 @@ OBJS= boot-pkg.$(FASLEXT) types.$(FASLEXT) \
sys-driver.$(FASLEXT) sys-constants.$(FASLEXT) \
hash.$(FASLEXT) lisp-backend.$(FASLEXT) \
sys-globals.$(FASLEXT) vmlisp.$(FASLEXT) \
- sys-os.$(FASLEXT) \
+ io.$(FASLEXT) sys-os.$(FASLEXT) \
sys-utility.$(FASLEXT) lexing.$(FASLEXT) \
diagnostics.$(FASLEXT) \
union.$(FASLEXT) sys-macros.$(FASLEXT) \
@@ -327,7 +327,8 @@ preparse.$(FASLEXT): parsing.$(FASLEXT)
parsing.$(FASLEXT): lexing.$(FASLEXT) macros.$(FASLEXT)
nlib.$(FASLEXT): macros.$(FASLEXT)
macros.$(FASLEXT): sys-macros.$(FASLEXT) sys-utility.$(FASLEXT)
-lexing.$(FASLEXT): sys-utility.$(FASLEXT) sys-macros.$(FASLEXT)
+lexing.$(FASLEXT): sys-utility.$(FASLEXT) sys-macros.$(FASLEXT) \
+ io.$(FASLEXT)
## The new parser component roughtly is:
## astr.boot dq.boot incl.boot pile.boot ptrees.boot
@@ -389,6 +390,7 @@ ggreater.$(FASLEXT): vmlisp.$(FASLEXT)
lisp-backend.$(FASLEXT): sys-macros.$(FASLEXT)
sys-utility.$(FASLEXT): vmlisp.$(FASLEXT) sys-os.$(FASLEXT) hash.$(FASLEXT)
vmlisp.$(FASLEXT): types.$(FASLEXT) sys-globals.$(FASLEXT)
+io.$(FASLEXT): sys-constants.$(FASLEXT)
types.$(FASLEXT): boot-pkg.$(FASLEXT)
boot-pkg.$(FASLEXT): boot-pkg.lisp
diff --git a/src/interp/io.boot b/src/interp/io.boot
new file mode 100644
index 00000000..4214fcf8
--- /dev/null
+++ b/src/interp/io.boot
@@ -0,0 +1,65 @@
+-- Copyright (C) 2012, Gabriel Dos Reis.
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions are
+-- met:
+--
+-- - Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+--
+-- - Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in
+-- the documentation and/or other materials provided with the
+-- distribution.
+--
+-- - Neither the name of OpenAxiom. nor the names of its contributors
+-- may be used to endorse or promote products derived from this
+-- software without specific prior written permission.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+-- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+-- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys_-constants
+
+namespace BOOT
+
+module io where
+ blankChar? : %Char -> %Boolean
+
+--%
+--% Individual character routines
+--%
+
+++ Return true if character `c' is a space character.
+macro spaceChar? c ==
+ c = char " "
+
+++ Return true if character `c' is a horizontal tab character
+macro tabChar? c ==
+ c = abstractChar 9
+
+
+++ Return true if character `c' is either a space or a horitonal tab.
+blankChar? c ==
+ spaceChar? c or tabChar? c
+
+
+--%
+--% String manipulation routines.
+--%
+
+++ Replace all characters in `s' with space characters.
+storeBlank!(s,n) ==
+ for i in 0..maxIndex s repeat
+ s.i := char " "
+ s
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot
index 4cb4f9cc..4b357918 100644
--- a/src/interp/lexing.boot
+++ b/src/interp/lexing.boot
@@ -36,6 +36,7 @@
import sys_-utility
import sys_-macros
+import io
namespace BOOT
diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp
index 5b0e6193..0fd7bc3a 100644
--- a/src/interp/preparse.lisp
+++ b/src/interp/preparse.lisp
@@ -219,9 +219,6 @@
(dolist (X L) (format t "~5d. ~a~%" (car x) (cdr x)))
(format t "~%"))))
-(DEFUN STOREBLANKS (LINE N)
- (DO ((I 0 (1+ I))) ((= I N) LINE) (SETF (CHAR LINE I) #\ )))
-
(DEFUN INITIAL-SUBSTRING (PATTERN LINE)
(let ((ind (mismatch PATTERN LINE)))
(OR (NULL IND) (EQL IND (SIZE PATTERN)))))
@@ -234,11 +231,11 @@
(COND ((CHAR= (ELT LINE 0) #\) )
(COND
((INITIAL-SUBSTRING ")if" LINE)
- (COND ((EVAL (|string2BootTree| (STOREBLANKS LINE 3)))
+ (COND ((EVAL (|string2BootTree| (|storeBlanks!| LINE 3)))
(RETURN (preparseReadLine X)))
('T (RETURN (SKIP-IFBLOCK X)))))
((INITIAL-SUBSTRING ")elseif" LINE)
- (COND ((EVAL (|string2BootTree| (STOREBLANKS LINE 7)))
+ (COND ((EVAL (|string2BootTree| (|storeBlanks!| LINE 7)))
(RETURN (preparseReadLine X)))
('T (RETURN (SKIP-IFBLOCK X)))))
((INITIAL-SUBSTRING ")else" LINE)
@@ -267,7 +264,7 @@
(COND ((CHAR= (ELT LINE 0) #\) )
(COND
((INITIAL-SUBSTRING ")if" LINE)
- (COND ((EVAL (|string2BootTree| (STOREBLANKS LINE 3)))
+ (COND ((EVAL (|string2BootTree| (|storeBlanks!| LINE 3)))
(RETURN (preparseReadLine X)))
('T (RETURN (SKIP-IFBLOCK X)))))
((INITIAL-SUBSTRING ")elseif" LINE)