16.10.2013 Views

5 - Forth Interest Group

5 - Forth Interest Group

5 - Forth Interest Group

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Attenbon <strong>Forth</strong> Authors!<br />

immediate \ Make the object immediate<br />

does><br />

opush<br />

\ Get object ptr. on ostack 1 Recognition<br />

\ We are compiling<br />

compile (lit) \ Compile obj ptr. as literal<br />

ostack->dstack \ Get object pointer<br />

, t<br />

\ There's the pointer<br />

compile opush \ Compile an object push<br />

compile (lit) \ Another literal is<br />

\ method code pointer<br />

find-method-code \ Get method's code pointer<br />

, t<br />

\ Compile that<br />

compile domethod \ Code to execute method<br />

odrop \ Don't need object anymore<br />

else \ We are interpreting<br />

exec-ob j \ Execute the object<br />

endif<br />

\ Complete a class definition<br />

: ;class<br />

clear-ivar-seg \ No ivars segment<br />

0 curr-class-off ! \ No current class<br />

,<br />

\ Special word that returns current object so object<br />

\ can send a message to itself. Use 'self' inside<br />

\ the methods definitions to refer to the current object.<br />

: self ( -- 1<br />

compile (lit)<br />

curr-class-off opush \ Get current object<br />

find-method-code \ Locate method code<br />

, t \ Store as literal<br />

compile odup \ Dup object<br />

compile domethod \ Execute method<br />

odrop \ Clear object stack<br />

; immediate<br />

\ Define a class's super class.<br />

\ A class will inherit instance variable space, methods, and<br />

\ startup methods from the super class. A class can override<br />

\ methods and startup methods.<br />

: body @ dup<br />

\ Store token address into super pointer of current class<br />

curr-class-off @ 4 +<br />

!t<br />

\ Copy ivars into local ivars<br />

dup @t curr-class-off @ !t<br />

\ Copy initial method<br />

6 + @t curr-class-off @ 6 + !t<br />

\ Define initialization method.<br />

\ This routine expects a method id on the top of the method<br />

\ stack. It stores that method id as the object's startup<br />

\ method.<br />

Author<br />

-<br />

To recognize and reward<br />

authors of <strong>Forth</strong>-related ar-<br />

ticles, the <strong>Forth</strong> <strong>Interest</strong><br />

<strong>Group</strong> (mG) has adopted<br />

the following Author Recog-<br />

nition Program.<br />

Articles<br />

The author of any <strong>Forth</strong>-<br />

related article published in a<br />

periodical or in the proceed-<br />

ings of a non-<strong>Forth</strong> confer-<br />

ence is awarded one year's<br />

membership in the <strong>Forth</strong><br />

<strong>Interest</strong> <strong>Group</strong>, subject to<br />

these conditions:<br />

a. The membership<br />

awarded is for the<br />

membership year fol-<br />

lowing the one during<br />

which the article was<br />

published<br />

b. Only one membership<br />

per person is awarded<br />

in any year, regard-<br />

less of the number of<br />

articles the person<br />

published in that year.<br />

c. The article's length<br />

must be one page or<br />

more in the magazine<br />

in which it appeared.<br />

d. The author must sub-<br />

mit the printed article<br />

(photocopies are ac-<br />

cepted) to the <strong>Forth</strong><br />

<strong>Interest</strong> <strong>Group</strong>, in-<br />

cluding identification<br />

of the magazine and<br />

issue in which it ap<br />

peared, within sixty<br />

days of publication.<br />

In return, the author<br />

will be sent a coupon<br />

good for the follow-<br />

ing year's member-<br />

ship.<br />

e. If ;he original article<br />

was published in a<br />

language other than<br />

English, the article<br />

must be accompanied<br />

I (Zisting continues.) I (Continues on nextpage.)<br />

<strong>Forth</strong> Dimensions 17 January 1992 February

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!