Commit 54d3aafe authored by crook's avatar crook

-Added my name to the ToDo file under documentation

-Glossed the oof files
-Minor glossary additions elsewhere
-Another set of changes to gforth.ds; mainly the addition of material
 to the introductory chapter. Also, re-organised stuff in the oof
 sections and made a typo pass over a few other bits.
parent 47f6be38
......@@ -73,7 +73,7 @@ net (Joerg Plewe has posted a reference), but I think a program that
wires itself into the compiler (like etags.fs) is harder to fool by
search order tricks etc. EVALUATE is a problem.
*Documentation
*Documentation (Neal Crook, nac@forth.org is working on this)
A texinfo file
**glossaries of all wordsets.
*** Inclusion of stack comments, glossary comments, and wordset comments
......
This diff is collapsed.
......@@ -165,7 +165,9 @@ const Create bases 10 , 2 , A , 100 ,
[ [THEN] ]
source >in ! drop ; immediate
: \G ( -- ) \ gforth backslash
: \G ( -- ) \ gforth backslash-gee
\G Equivalent to @code{\} but used as a tag to annotate definition
\G comments into documentation.
POSTPONE \ ; immediate
\ \ object oriented search list 17mar93py
......
: method ( m v -- m' v ) Create over , swap cell+ swap
: method ( m v -- m' v ) \ mini-oof
\G Define a method.
Create over , swap cell+ swap
DOES> ( ... o -- ... ) @ over @ + @ execute ;
: var ( m v size -- m v' ) Create over , +
: var ( m v size -- m v' ) \ mini-oof
\G Define a variable with @var{size} bytes.
Create over , +
DOES> ( o -- addr ) @ + ;
: class ( class -- class methods vars ) dup 2@ ;
: end-class ( class methods vars -- )
Create here >r , dup , 2 cells ?DO ['] noop , 1 cells +LOOP
cell+ dup cell+ r> rot @ 2 cells /string move ;
: defines ( xt class "name" -- ) ' >body @ + ! ;
: new ( class -- o ) here over @ allot swap over ! ;
: :: ( class "name" -- ) ' >body @ + @ compile, ;
Create object 1 cells , 2 cells ,
: class ( class -- class methods vars ) \ mini-oof
\G Start the definition of a class.
dup 2@ ;
: end-class ( class methods vars -- ) \ mini-oof
\G End the definition of a class.
Create here >r , dup , 2 cells ?DO ['] noop , 1 cells +LOOP
cell+ dup cell+ r> rot @ 2 cells /string move ;
: defines ( xt class "name" -- ) \ mini-oof
\G Bind @var{xt} to the method @var{name} in class @var{class}.
' >body @ + ! ;
: new ( class -- o ) \ mini-oof
\G Create a new incarnation of the class @var{class}.
here over @ allot swap over ! ;
: :: ( class "name" -- ) \ mini-oof colon-colon
\G Compile the method @var{name} of the class @var{class} (not immediate!).
' >body @ + @ compile, ;
Create object ( -- a-addr ) \ mini-oof
1 cells , 2 cells ,
\G @var{object} is the base class of all objects.
This diff is collapsed.
......@@ -174,15 +174,15 @@ define? faligned 0= [IF]
types definitions
: static ( -- ) \ oof- oof
\G Create a class-wide cell sized variable
\G Create a class-wide cell-sized variable.
mallot Create , #static ,
DOES> @ o@ + ;
: method ( -- ) \ oof- oof
\G Create a method selector
\G Create a method selector.
mallot Create , #method ,
DOES> @ o@ + @ execute ;
: early ( -- ) \ oof- oof
\G Create a method selector for early binding
\G Create a method selector for early binding.
Create ['] crash , #early ,
DOES> @ execute ;
: var ( size -- ) \ oof- oof
......@@ -458,7 +458,7 @@ types definitions
\G Create an instance pointer
Create immediate lastob @ here lastob ! instptr, ;
: asptr ( class -- ) \ oof- oof
\G Create an alias to an instance pointer, casted to another class
\G Create an alias to an instance pointer, cast to another class.
cell+ @ Create immediate
lastob @ here lastob ! , , instptr> ;
......
......@@ -512,6 +512,8 @@ else if (n>0)
dup 0< IF drop -1 ELSE 0> 1 and THEN ;
toupper c1 -- c2 gforth
""For a character a-z, convert to the equivalent upper-case
character. All other characters are unchanged.""
c2 = toupper(c1);
:
dup [char] a - [ char z char a - 1 + ] Literal u< bl and - ;
......@@ -1442,6 +1444,10 @@ if (old_tp)
#endif
getenv c_addr1 u1 -- c_addr2 u2 gforth
""The string c-addr1 u1 specifies an environment variable. The string c-addr2 u2
is the host operating system's expansion of that environment variable. If the
environment variable does not exist, c-addr2 u2 specifies a string 0 characters
in length.""
c_addr2 = getenv(cstr(c_addr1,u1,1));
u2 = (c_addr2 == NULL ? 0 : strlen(c_addr2));
......
......@@ -72,8 +72,9 @@ DEFER nlcount ' noop IS nlcount
nlflag @ IF (nl) nlflag off THEN
XPos @ over + cols u>= IF (nl) THEN ;
: c-to-upper
dup [char] a >= over [char] z <= and if bl - then ;
: c-to-upper ( c1 -- c2 ) \ gforth
\ nac05feb1999 there is a primitive, toupper, with this function
dup [char] a >= over [char] z <= and if bl - then ;
: ctype ( adr len -- )
warp? dup XPos +! C-Output @
......
......@@ -44,7 +44,7 @@ AUser CSP
\ shell commands
0 Value $? ( -- n ) \ gforth
0 Value $? ( -- n ) \ gforth dollar-question
\G VALUE: The exit status returned by the most recently executed
\G @code{system} command.
......@@ -60,8 +60,8 @@ AUser CSP
\ stuff
: ]L ( compilation: n -- ; run-time: -- n )
\G equivalent to "] literal"
: ]L ( compilation: n -- ; run-time: -- n ) \ gforth
\G equivalent to @code{] literal}
] postpone literal ;
: in-dictionary? ( x -- f )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment