seal
( --- )
"seal". Converts an Until source file into 'binary' form for later
loading. It allows Until applications to be distributed without
allowing users access to source code. The following line seals
CALC.APP:
seal calc.app
search
( 'string 'search --- f|'match )
"search". Search string for the substring search. The
address of the match is returned when search is found or
0 for no match. For example:
inbuf " xxx" search
returns the match address or 0 when no match occurs.
search&insert
( 'string 'search 'insert --- f|'match )
"search and insert". Search string for the substring, search,
and insert insert after the match point. The address of the end of
the match is returned on match or 0 for no match. For example:
inbuf " is" " not" search&insert
will change an occurrence of "is" into "is not".
SEEK_CUR
( --- 1 )
"seek-cur". Sets seek mode to relative to the current file position. Use
with fseek.
SEEK_END
( --- 2 )
"seek-end". Sets seek mode to relative to end of file. Use
with fseek.
SEEK_SET
( --- 0 )
"seek-set". Sets seek mode to beginning of the file. Used
with fseek.
sengine
( --- )
"s-engine". Interpret the SGML document opened by a previous call
to sengine-init. Each SGML tag is extracted then executed.
sengine_init
( 'SGML-file --- )
"s-engine-init". Open the SGML file whose name is specified by
the string whose address in on the parameter stack. The SGML
filename can be passed as a string:
" anyfile.sgm" sengine_init
shell
( --- )
"shell". Spawn/fork/whatever a shell to the OS.
shell
Log off to exit the shell and return to Until. This is exit
in DOS, Control-D in **ix, and logout in VMS.
show_stack
( tf --- )
"show-stack". Turn on/off the stack display in the upper right corner
of the screen.
sign
( n --- )
"sign". The number on the top of the stack is compared to zero. A
`-' is added to the current output number string if n is
negative.
<# # # SIGN #>
will generate a two digit numeric string with leading sign. The
numeric string is constructed in pad.
sign is used with the number formatting words <# ... #>.
: 2digits <# SIGN # # #> type ;
-1234 2digits
34-
smudge
( 'word --- )
"smudge". Hide the word whose address is on the top of the stack
from the system. Used in the form:
' aword smudge
It is generally used during compilation to prevent the word currently
being define from being found. This prevents accidental recursion.
smudge expects the word address (WA) in Until.
space
( --- )
"space". Output a space to the terminal.
spaces
( n --- )
"spaces". Output n spaces to the terminal. Logically spaces
is:
: spaces 0 do space loop ; ( n --- )
The line:
0 spaces
outputs no spaces. This is slightly different from normal Forth behavior,
so beware.
span
( --- 'span )
"span". Returns the address of span. It contains the number of
characters read in the last expect call.
state
( --- 'state)
"state". Leave the address of the variable containing the
current compilation state on the stack. state is zero during
interactive mode and non-zero during compilation.
stab
High level (char 'destination --- )
"stab". Store a byte, or stab, appends a byte to the end of the counted
string whose address is specified by destination. The count
byte is automatically incremented. stab only works with
counted strings and is high level code found in STOIC.APP.
STDIN
( --- fd-stdin )
"standard-in". Leave the file descriptor on the stack for STDIN. Most
systems open STDIN by default.
STDOUT
( --- fd-stdout )
"standard-out". Leave the file descriptor on the stack for STDOUT. Most
systems open STDOUT by default.
strap
High level ('source 'destination --- )
"strap". The string append word appends the contents of the source
string, 'source, to the destination string, 'destination.
Both source and destination string must be a counted string.
strap only works with
counted strings and is high level code found in STOIC.APP.
strcat
( 'dest 'source --- 'dest )
"s-t-r cat". Concatenate the source string to the destination string.
strcat only works with null terminated strings.
strcmp
( 'string1 'string2 --- <1|0|>1 )
"s-t-r c-m-p". Compare two strings. Zero means the strings match. If
the return value is less than zero, string1 is less than string2. If
the return value is positive, string1 is greater than string2.
strcat only works with null terminated strings.
<1 string1 < string2
0 string1 = string2
>1 string1> string2
strcpy
( 'dest 'source --- 'dest )
"s-t-r c-p-y". Copy the string whose address is source
into the string at dest. No check is made for string overflow.
strcat only works with null terminated strings.
strncat
( 'dest 'source len --- )
"s-t-r-n-c-a-t". Concatenate n bytes of the source string to
the destination string.
strcat only works with null terminated strings.
strncmp
( 'string1 'string2 len --- )
"s-t-r-n-c-m-p". Compare two strings for n bytes.
strcat only works with null terminated strings.
strncpy
( 'dest 'source len --- )
"s-t-r-n-c-p-y". Copy n bytes of one string to another.
strcat only works with null terminated strings.
string
( len --- )
"string". Define a string array of len bytes. At run-time,
the address of the count byte is left on the stack.
100 string text ( len --- )
text ( --- 'text )
This is equivalent to:
variable text 100 allot
string_returns
( tf --- )
"string return". C string functions have the nasty habit of
returning values that most C programmers ignore. This causes code
that is a mess in Until to explicitly drop unused function values.
This word controls whether the C string words return values to
the parameter stack.
true string_return \ String words return values
false string_return \ String words do not return values
This approach gives the programmer a choice. The words affected
by string_returns are:
- strcat
- strcpy
- strncat
- strncpy
strret
( --- return-value )
"s-t-r-r-e-t". Return the value of the last C string word call.
strupr
( 'string --- 'STRING )
Convert the null terminated string whose address is string
to all upper case.
sub
( 'string 'search 'replace --- tf )
"sub". The global search and replace word searches string
for search and replaces it with replace when a
match occurs. This version performs only a single replacement
per call.
swap
( n1 n2 --- n2 n1 )
"swap". Swap the top two entries on the top of the stack.
1 2 swap
results in the top stack entry being 2 and the second entry
being 1.
system
( --- )
"system". Used in the form:
" command" system
This command shells out to the operating system and executes the
command, such as dir.
Table of Contents
Next Section