home *** CD-ROM | disk | FTP | other *** search
- CREATE X
- CREATE |
- CREATE NAME
- EDIT
- ( EXEC -> string )
- : name cls 20 10 gotoxy
- ." Please enter a filename: "
- pad 40 expect over + 0 swap c!
- ;
- ~UP
- CREATE H
- EDIT
- create h 99 ,
- ~UP
- CREATE EJECT
- EDIT
- : eject
- name 1+ 32 createfile if h ! else ." error" abort endif
- 0 <# 12 hold #> h @ write drop drop
-
- ;
- ~UP
- CREATE P
- CREATE PRINT
- CREATE BUFFER
- EDIT
- create buffer 40 1024 * allot
- ~UP
- EDIT
- : PRINT
- 4 +
- dup @ 77777777 = not abort" Invalid text word "
- dup 8 + @ swap 4 + @ \ Get length, address.
- over 0 do \ For all characters,
- dup c@@ buffer i + c! 1+ \ Stack: buffer buffer length address.
- loop
- drop \ Drop the address.
- buffer swap h @ \ Buffer_addr count handle
- write if drop
- else
- ." Write error... ( {PRINT} in {P} )" abort
- endif
- ." <"
- ;
- ~UP
- CREATE PRINT_ALL
- EDIT
- : print_all
- ?dup if else exit endif
- dup comp
- dup >body print
- dup child print_all
- next print_all
- ;
- ~UP
- EDIT
- \ ( document execution addr -> )
- : p
- ?dup if else exit endif
- dup name 32 createfile
- if h ! else ." Can't open output file!" abort endif
- dup >body print
- child print_all
- h @ close ?dup drop drop
- ;
- ~UP
- EDIT
- : |
- >in @
- create
- >in !
- ' , \ Save execution address.
- 77777777 , \ Safety flag.
- >in @ , \ Save the address of text stream.
-
- 0 \ The initial count of the bytes.
- >in @ \ Get the pointer to the text.
- begin
- dup c@@ \ Is it zero?
- while \ While not null, increment the pointer.
- 1+ swap 1+ swap \ Increment the count and address.
- repeat
- >in ! \ point text pointer to null.
- , \ Save the byte count.
- does>
- @ p \ Get execution address and print.
- ;
- ~UP
- CREATE DOCUMENT
- CREATE CHAPTER1
- EDIT
- | chapter1
-
- Chapter 1
-
- In this chapter we will explain the
- various meanings to life, the universe,
- and everything.
- ~UP
- CREATE CHAPTER2
- EDIT
- | chapter2
-
- Chapter 2
-
- This section is about a young boy,
- and his trials in becoming a man.
- ~UP
- CREATE CHAPTER3
- EDIT
- | chapter3
-
- Chapter 3
-
- Here we give up any pretence of trying
- to make sense.
- ~UP
- EDIT
- | document
-
- An Example Document
- -- ------- --------
- ~UP
- EDIT
- \ Executing any text module ( one defined with | ) will create a file
- \ and write out all text of the executed module and all modules below it.
- \
- \ For example, exeucting document gives the entire document. Executing
- \ CHAPTER1 only writes out that chapter.
- create x
- ~UP
- ABORT