📄 goop.htm
字号:
<html>
<head>
<title>StrongForth.f Object Oriented Programming Glossary</title>
</head>
<body>
<h1>StrongForth.f Object Oriented Programming Glossary</h1>
<hr><p><pre><b>! ( SINGLE BADDRESS -> 1ST -- )</b></pre></p>
<p>Store <kbd>SINGLE</kbd> in the bit field specified by <kbd>BADDRESS</kbd>.
Only the number of low-order bits corresponding to the length of the bit
field are transferred.</p>
<hr><p><pre><b>(@SIZE) ( BADDRESS -> SINGLE -- LOGICAL UNSIGNED )</b></pre></p>
<p><kbd>LOGICAL</kbd> is the content of the bit field stored at
address <kbd>BADDRESS -> SINGLE</kbd>. If the length of the bit field is
lower than the size of a cell, its value is extended with leading zero
bits. <kbd>UNSIGNED</kbd> is the length of the bit field.</p>
<p><kbd>(@SIZE)</kbd> is an internal definition used by <kbd>@</kbd>.</p>
<hr><p><pre><b>(BIND) ( DATA-TYPE "<spaces><em>name</em>" -- )</b></pre></p>
<p>Skip leading space delimiters. Parse <em>name</em> delimited by a space.
Find virtual member <em>name</em>. Statically bind <em>name</em> to class
<kbd>DATA-TYPE</kbd> and compile it. An exception is thrown if the system
is in interpretation state, if <kbd>DATA-TYPE</kbd> is not a class, or if
no virtual member with name <em>name</em> is found. An ambiguous condition
exists if <em>name</em> is not a virtual member of class <kbd>DATA-TYPE</kbd>.</p>
<hr><p><pre><b>(BVARIABLE) ( STACK-DIAGRAM -- 1ST )</b></pre></p>
<p>Compile the stack diagram of a bit field variable into the dictionary.
Modify <kbd>STACK-DIAGRAM</kbd>. The compiler data heap pointer
is assumed to point to the compound data type of the variable.</p>
<hr><p><pre><b>(CVARIABLE) ( STACK-DIAGRAM -- 1ST )</b></pre></p>
<p>Compile the stack diagram of a character size variable into the dictionary.
Modify <kbd>STACK-DIAGRAM</kbd>. The compiler data heap pointer
is assumed to point to the compound data type of the variable.</p>
<hr><p><pre><b>(DELETE) ( OBJECT -- )</b></pre></p>
<p>Return the chunk of contiguous memory space occupied by the object
<kbd>OBJECT</kbd> to the system for later allocation. An ambiguous
condition exists if <kbd>OBJECT</kbd> was not previously created by
<kbd>(NEW)</kbd>.
An exception is thrown if the memory space canot be returned.</p>
<hr><p><pre><b>(MEMBER) ( STRUCT-SIZE UNSIGNED "<spaces><em>name</em>" -- 1ST )</b></pre></p>
<p>Perform the semantics of <kbd>AUTOTHIS</kbd> if <kbd>THIS-CLASS</kbd>
is a class.</p>
<p>Skip leading space delimiters. Parse <em>name</em> delimited by a
space. Create a new definition for <em>name</em> with the execution semantics
defined below, and make it the latest definition. <kbd>1ST</kbd> is equal
to <kbd>STRUCT-SIZE</kbd> aligned to cell size, plus <kbd>UNSIGNED</kbd>
times the number of bits in one address unit.</p>
<p><em>name</em> is referred to as a <em>data member</em>.</p>
Execution: <b><kbd>( x -- ADDRESS -> y )</kbd></b>
<br><kbd>ADDRESS -> y</kbd> is the address of the data member of the structure or
object <kbd>x</kbd>, whose offset is equal to <kbd>STRUCT-SIZE</kbd> divided
by the number of bits in one address unit.
<kbd>x</kbd> is a structure or object of the data type <kbd>THIS-CLASS</kbd>
at the time <em>name</em> was created. <kbd>y</kbd> is the data type of
the data member, which is obtained from the data type heap at the time
<em>name</em> was created.</p>
<hr><p><pre><b>(NEW) ( ADDRESS ADDRESS -> STRUCTURE -- 3RD )</b></pre></p>
<p><kbd>3RD</kbd> is the structure that starts at address <kbd>DATA</kbd>.</p>
<hr><p><pre><b>(NEW) ( CADDRESS ADDRESS -> STRUCTURE -- 3RD )</b></pre></p>
<p><kbd>3RD</kbd> is the structure that starts at address <kbd>CDATA</kbd>.</p>
<hr><p><pre><b>(NEW) ( ADDRESS -> STRUCTURE -- 2ND )</b></pre></p>
<p>Allocate a chunk of contiguous memory space for a structure
<kbd>STRUCTURE</kbd>, and return the allocated structure as <kbd>2ND</kbd>.
The initial contents of the allocated structure's members are undefined.
An exception
is thrown if memory allocation fails. An ambiguous condition exists if
<kbd>ADDRESS -> STRUCTURE</kbd> is not the address of a cell that contains
the size in address units of the structure <kbd>STRUCTURE</kbd>.</p>
<p>Note: <kbd>ADDRESS -> STRUCTURE</kbd> is not the address of an item of
data type <kbd>STRUCTURE</kbd>.</p>
<hr><p><pre><b>(NEW) ( ADDRESS ADDRESS -> OBJECT -- 3RD )</b></pre></p>
<p>Initialize the virtual member table pointer of an object with data type
<kbd>OBJECT</kbd> starting at address <kbd>DATA</kbd> with
<kbd>ADDRESS -> OBJECT</kbd>, and return the object as <kbd>3RD</kbd>.
An ambiguous condition exists if <kbd>ADDRESS -> OBJECT</kbd> is not the
address of the virtual member table of the class <kbd>OBJECT</kbd>.</p>
<p>Note: <kbd>ADDRESS -> OBJECT</kbd> is not the address of an item of
data type <kbd>OBJECT</kbd>.</p>
<hr><p><pre><b>(NEW) ( CADDRESS ADDRESS -> OBJECT -- 3RD )</b></pre></p>
<p>Initialize the virtual member table pointer of an object with data type
<kbd>OBJECT</kbd> starting at address <kbd>CDATA</kbd> with
<kbd>ADDRESS -> OBJECT</kbd>, and return the object as <kbd>3RD</kbd>.
An ambiguous condition exists if <kbd>ADDRESS -> OBJECT</kbd> is not the
address of the virtual member table of the class <kbd>OBJECT</kbd>.</p>
<p>Note: <kbd>ADDRESS -> OBJECT</kbd> is not the address of an item of
data type <kbd>OBJECT</kbd>.</p>
<hr><p><pre><b>(NEW) ( ADDRESS -> OBJECT -- 2ND )</b></pre></p>
<p>Allocate a chunk of contiguous memory space for an object
<kbd>OBJECT</kbd>. Initialize the virtual member table pointer of the
object with <kbd>ADDRESS -> OBJECT</kbd>, and return the object as
<kbd>2ND</kbd>. The initial contents of the allocated object's members
are undefined. An exception
is thrown if memory allocation fails. An ambiguous condition exists if
<kbd>ADDRESS -> OBJECT</kbd> is not the address of the virtual member
table of the object <kbd>OBJECT</kbd>.
<p>Note: <kbd>ADDRESS -> OBJECT</kbd> is not the address of an item of
data type <kbd>OBJECT</kbd>.</p>
<hr><p><pre><b>+ ( BADDRESS INTEGER -- 1ST )</b></pre></p>
<p>Add <kbd>INTEGER</kbd> to the bit field address <kbd>BADDRESS</kbd>,
giving the new bit field address <kbd>1ST</kbd>. <kbd>INTEGER</kbd> is
automatically multiplied with the length of the bit field before the
actual addition takes place. The result typically specifies a bit field that
starts at a different bit position.</p>
<hr><p><pre><b>+! ( INTEGER BADDRESS -> INTEGER -- )</b></pre></p>
<p>Add <kbd>INTEGER</kbd> to the content of the bit field specified by
<kbd>BADDRESS -> INTEGER</kbd>. Only the number of low-order bits corresponding to the
length of the bit field are transferred.</p>
<hr><p><pre><b>+! ( INTEGER ADDRESS -> BADDRESS -- )</b></pre></p>
<p>Add <kbd>INTEGER</kbd> to the bit field address stored at
address <kbd>ADDRESS -> BADDRESS</kbd>. <kbd>INTEGER</kbd> is automatically
multiplied with the length of the bit field before the actual addition
takes place. The result typically specifies a bit field that starts at a
different bit position.</p>
<hr><p><pre><b>- ( BADDRESS INTEGER -- 1ST )</b></pre></p>
<p>Subtract <kbd>INTEGER</kbd> from the bit field address
<kbd>BADDRESS</kbd>, giving the new bit field address <kbd>1ST</kbd>.
<kbd>INTEGER</kbd> is automatically multiplied with the length of the bit
field before the actual subtraction takes place. The result typically specifies a
bit field that starts at a different bit position.</p>
<hr><p><pre><b>1+ ( BADDRESS -- 1ST )</b></pre></p>
<p><kbd>1ST</kbd> is the address of a bit field that starts one bit after
the most significant bit of the bit field specified by
<kbd>BADDRESS</kbd>. Both bit fields have the same length.</p>
<hr><p><pre><b>1- ( BADDRESS -- 1ST )</b></pre></p>
<p><kbd>1ST</kbd> is the address of a bit field that ends one bit before
the least significant bit of the bit field specified by
<kbd>BADDRESS</kbd>. Both bit fields have the same length</p>
<hr><p><pre><b>:MEMBER ( OBJ-SIZE "<spaces><em>name</em>" -- 1ST COLON-SYS )</b></pre></p>
<p>Skip leading space delimiters.
Parse <em>name</em> delimited by a space.
Find <em>name</em> in the <kbd>AUTOTHIS</kbd> word list.
If <em>name</em> is not found, create an immediate definition with this
name and the semantics given below in the <kbd>AUTOTHIS</kbd> word list.
Create another definition for <em>name</em> in the current compilation
word list, called a <em>colon definition</em>.
Enter compilation state and initialize the compiler data type heap and
the local dictionary.
Start the current definition, producing <kbd>COLON-SYS</kbd>.
Append the initiation semantics given below to the current definition.
The execution semantics of <em>name</em> will be
determined by the words compiled into the body of the definition.
The current definition can not be found in the dictionary until it is
finished or until the execution of <kbd>DOES></kbd>.</p>
<p>Initiation: <b><kbd>( -- ) ( R: -- nest-sys )</kbd></b>
<br>Save information <kbd>nest-sys</kbd> about the calling definition.</p>
<p><em>name</em> Execution (current compilation word list): <b><kbd>( -- )</kbd></b>
<br>Execute the definition <em>name</em>.</p>
<p><em>name</em> Execution (<kbd>AUTOTHIS</kbd> word list): <b><kbd>( -- )</kbd></b>
<br>Evaluate <kbd>THIS</kbd>. Remove the <kbd>AUTOTHIS</kbd> word list
from the search order, evaluate <em>name</em> and reappend
the <kbd>AUTOTHIS</kbd> word list to the search order.</p>
<p>Note that the new definition does have no stack effects by default.
Stack effects have to be specified separately if they are intended.
By using a stack diagram phrase <kbd>( ... -- ... )</kbd> immediately
following <kbd>:</kbd> and the definition name, the new definition is
modified to incorporate stack effects. An ambiguous condition exists if
no input parameters are specified, or if the last input parameter does
not have the data type of the current class.</p>
<hr><p><pre><b>>LAST ( DATA-TYPE -- ADDRESS -> ADDRESS )</b></pre></p>
<p><kbd>ADDRESS -> ADDRESS</kbd> is the address of the first of two cells.
The first cell contains the address offset of the latest definition of
the <kbd>AUTOTHIS</kbd> word list that belongs to the class
<kbd>DATA-TYPE</kbd>.
The second cell contains the address offset of the latest definition of
the <kbd>PROTECTED</kbd> word list that belongs to the class
<kbd>DATA-TYPE</kbd>.
An exception is thrown if <kbd>DATA-TYPE</kbd> is not a class.</p>
<hr><p><pre><b>>THIS ( -- )</b></pre></p>
<p>Interpretation:
<br>An exception is thrown if <kbd>>THIS</kbd> is interpreted.</p>
<p>Compilation:
<br>Create a local with name <kbd>THIS</kbd>. Append the runtime
semantics given below to the current definition.</p>
<p>Runtime: <b><kbd>( SINGLE -- )</kbd></b>
<br>Store <kbd>SINGLE</kbd> into the local <kbd>THIS</kbd>.</p>
<p><kbd>>THIS</kbd> is an immediate word.</p>
<hr><p><pre><b>>VTABLE ( DATA-TYPE -- ADDRESS -> ADDRESS )</b></pre></p>
<p><kbd>ADDRESS -> ADDRESS</kbd> is the address of the first of two cells.
The first cell contains the address of the virtual member table of the
class <kbd>DATA-TYPE</kbd>.
The second cell contains the address of the friends table of the class
<kbd>DATA-TYPE</kbd>.
An exception is thrown if <kbd>DATA-TYPE</kbd> is not a class.</p>
<hr><p><pre><b>?AUTOTHIS ( "<spaces><em>name</em>" -- "<spaces><em>name</em>" )</b></pre></p>
<p>Perform the semantics of <kbd>AUTOTHIS</kbd> if <kbd>THIS-CLASS</kbd>
is equal to <kbd>OBJECT</kbd> or a direct or indirect subtype of
<kbd>OBJECT</kbd>.</p>
<hr><p><pre><b>?OBJECT ( DATA-TYPE -- ADDRESS )</b></pre></p>
<p><kbd>ADDRESS</kbd> is the address of the data field of
the definition that is associated with <kbd>DATA-TYPE</kbd>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -