Forth Updates
Volume Number: 2
Issue Number: 5
Column Tag: Threaded Code
Updates for Mach1 and Neon 
By Jörg Langowski, EMBL, C/O I.L.L., Grenoble, Cedex, France,
MacTutor Editorial Board
"In Our Mail
This time, I have no specific subject to cover, but would rather like to address a
few points that came up while browsing through my mail lately. Also, I want to inform
you on updates of NEON and Mach1 that just came in. (Judging from the productivity of
some of the developers, the next updates will probably be out even before this comes
back from the printer's...)
We received a letter from Finland; Juri Munkki from Helsinki sent the following
interesting note:
"I received my HD 20 yesterday and I found some problems with using it for
Forth development using MacForth Level 3. The problems arise when trying to access
files from directories outside the Forth folder [this seems to be one of the standard
problems in HFS. J.L.]. I was very glad to see that my terminal program worked
correctly with HFS and used that knowledge to add a new command to MacForth.
MacForth activates windows automatically when an activation event is received.
This is not desirable when returning from a standard file-call because it interrupts the
execution of the calling program. Before receiving Level 3, I used a special window for
calling the standard file package and used two different activate procedures. Level 3
documentation explained the Event.Table and I was capable of simplifying the calling of
these extremely important routines.
The main reason my program worked was that it used PBSetVol to change the
default directory. This simple technique of calling SetVol after SFGetFile and
PutFile allows me to use standard MacForth file commands without any modification of
the internal structure FCBs.
The routine below [Listing 1] fits in one block (if left without comments) and is
very helpful in using the HFS folders.
Listing 1 : Select directory, by Juri Munkki
( Directory Mount utility) ( 011086 JAM)
create SFReply 76 allot
SFReply 76 erase ( standard file reply record)
create OurParams 32 allot
OurParams 32 erase ( our param block)
hex A015 os.trap SetVol ( PBSetVol OS trap )
A9EA w>mt Pack3 ( standard file package)
variable act.ev.proc ( standard action for activate )
: seldir ( lets the user choose a default directory )
activate.event 2* event.table + w@ act.ev.proc !
( save old activate.event vector )
0 activate.event 2* event.table + w!
( disable vector temporarily )
00400040 " " 0 -1 0 wbury 0 0 sfreply 2 pack3
Û( call SFGetfile)
act.ev.proc @ activate.event 2* event.table + w!
( reset activate vector)
SFReply c@ if ( file was selected)
SFReply 6+ w@ OurParams 16 + w!
OurParams SetVol then
;
axe SetVol axe Pack3 axe act.ev.proc
axe SFReply axe OurParams
decimal