Update of /cvsroot/wisp/wisp/doc/examples
In directory usw-pr-cvs1:/tmp/cvs-serv25684/doc/examples
Modified Files:
.cvsignore Makefile.am
Added Files:
bufinput.wth
Log Message:
Created the beginnings of Worth-level assemblying.
--- NEW FILE: bufinput.wth ---
;;;; bufinput.wth - buffered input
;;
;; Copyleft © 2002 by Andres Soolo (di...@us...)
;; This file is licensed under the GNU GPL v2. If you
;; don't know what that means, please do read the GPL.
;;
;;;; @(#) $Id: bufinput.wth,v 1.1 2002/09/30 18:24:55 digg Exp $
(include io)
(include linux)
(macro inbuf-size 80)
(macro instruc-size inbuf-size 4 +)
(macro instruc.start@ inbuf-size + byte@)
(macro instruc.start! inbuf-size + byte!)
(macro instruc.stop@ inbuf-size 1 + + byte@)
(macro instruc.stop! inbuf-size 1 + + byte!)
(macro instruc.eof@ inbuf-size 2 + + byte@)
(macro instruc.eof! inbuf-size 2 + + byte!)
(macro instruc.fd@ inbuf-size 3 + + byte@)
(macro instruc.fd! inbuf-size 3 + + byte!)
(macro init-instruc
0 over instruc.start!
0 over instruc.stop!
0 over instruc.eof!
0 swap instruc.fd!)
(macro shift-instruc
dup instruc.start@ dup if
over +
over dup dup instruc.start@ swap instruc.stop@ - bytemove
dup instruc.stop@ over instruc.start@ - over instruc.stop!
0 swap instruc.start!
else 2drop then)
(macro fill-instruc
dup instruc.eof@ unless
dup shift-instruc
dup dup instruc.stop@ 2dup + swap inbuf-size swap -
rot instruc.fd@ -rot sys.read
cond dup 0 > if
swap dup instruc.stop@ rot + swap instruc.stop!
else dup 0 = if
drop 1 swap instruc.eof!
else
negate hexprint " error occurred\n" type 1 sys.exit
thens
else
drop
then)
(macro EOF -1)
(defun instruc-getchar
swap
dup dup instruc.start@ swap instruc.stop@ u>= if
dup fill-instruc
then
dup dup instruc.start@ swap instruc.stop@ u< if
dup instruc.start@ 2dup + byte@ -rot 1+ swap instruc.start!
else
drop EOF
then
swap)
(macro whitespace? #\space <=)
(defun _start
instruc-size 0 allocate
dup init-instruc
begin dup instruc-getchar dup EOF <> while
dup dup #\space #\U+7F within over #\[ <> and over #\] <> and if
emit
else
#\[ emit
16 /mod emit-digit emit-digit #\] emit
then
#\newline = if cr then
repeat
"\nThe End\n" type)
; vim: ft=worth
Index: .cvsignore
===================================================================
RCS file: /cvsroot/wisp/wisp/doc/examples/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- .cvsignore 22 Jul 2002 14:36:47 -0000 1.2
+++ .cvsignore 30 Sep 2002 18:24:55 -0000 1.3
@@ -1,4 +1,11 @@
.*.swp
Makefile
Makefile.in
+angry
+argenv
+banana
+bufinput
+false
+foo*
gmon.out
+hello
Index: Makefile.am
===================================================================
RCS file: /cvsroot/wisp/wisp/doc/examples/Makefile.am,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- Makefile.am 30 Sep 2002 18:24:37 -0000 1.38
+++ Makefile.am 30 Sep 2002 18:24:55 -0000 1.39
@@ -6,16 +6,24 @@
#
#### @(#) $Id$
+WORTH_EXAMPLES = angry.wth argenv.wth banana.wth bufinput.wth \
+ false.wth hello.wth
+
EXTRA_DIST = closure.wisp quine.wisp signal.wisp \
rawkey.wisp \
find.wisp \
- hello.was hello.wth banana.wth false.wth angry.wth argenv.wth \
+ hello.was \
+ $(WORTH_EXAMPLES) \
.cvsignore
%: %.wth
WISP_PATH=$(top_srcdir)/modules $(top_builddir)/src/wisp \
$(top_srcdir)/tools/worth $<
+%.was: %.wth
+ WISP_PATH=$(top_srcdir)/modules $(top_builddir)/src/wisp \
+ $(top_srcdir)/tools/worth -III $<
+
exampledir = ${prefix}/share/doc/wisp/examples
install: install-dir install-readable
@@ -26,8 +34,7 @@
install-readable: closure.wisp quine.wisp signal.wisp \
rawkey.wisp \
find.wisp \
- hello.was hello.wth banana.wth false.wth angry.wth \
- argenv.wth
+ hello.was $(WORTH_EXAMPLES)
install -m644 $^ ${exampledir}
check: quine-check
|