Win32Forth Version 3.2 Released (long) 
Author Message
 Win32Forth Version 3.2 Released (long)

Hello all,

I have just released Win32Forth version 3.2

It was uploaded to as files;

I have asked Skip to put them on his Compiler page in place of
version 3.1.

Here is a list of the changes since somewhere after version 3.1 on
May 1st till the present;

July 26th, 1996 - 12:00
********************* Release Version 3.2 *********************

July 23rd, 1996 - 17:04 tjz
Found and fixed a bug in WinView that would cause a crash when opening
binary files.  Seems I was using the wrong polarity conditonal on the
test that was used to expand the line pointer table size.  This resulted
in more or less continuous pointer table expansion until all computer
memory was used up.  Not good!  FIXED

July 22nd, 1996 - 16:47 tjz
Tested compiling the wrapper in Microsoft Visual C++ 4.0b2.  It seems to
work without any changes.

July 19th, 1996 - 9:10 tjz
Received a bug report from Jih-tung Pai, that there was a stack error in
the word UNLINK-MALLOC, which is used by FREE.  He was correct, it has
been corrected.  Thank you Jih-tung Pai.

July 18th, 1996 - 10:46 tjz
Modified "FSAVE, so it won't allow saving to the currently executing
program.  Even though you could try to do this before, it would fail.
Now it fails, but warns that you shouldn't even try to do that.

Improved the implementation for C+PLACE.  Suggested by Mihail Maksimov.

July 16th, 1996 - 9:04 tjz
Bernd reported that s" could only be used once interpretively, and if it
was used a second time, would overwrite the first string.  I added a
a defered word NEW$ that allows forward referencing the NEW$ semi-static
buffers implemented in POINTER.F. Modified S", C" and Z" to use NEW$ when

July 12th, 1996 - 9:40 tjz
Moved CurrentMenu and CurrentPopup into the Window Class, making them
local to each window, rather than having them be global.  This was needed
so that an application could have more than one window, and have a
separate menubar and right mouse popup menu for each window defined in an
application.  This change will require an application change as shown in
the following code segment.

--------------------------  SETTING POPUPBAR  ---------------------------
The following lines were extracted from WINDEMO.F.
NOTE: that several lines not relavent to this illustration have been
removed to simplify the example code.
:M Classinit:   ( -- )
     ClassInit: super
\     self to CurrentWindow                  \ COMMENT OUT THIS LINE
\     Demo-popup-Bar  to CurrentPopup        \ COMMENT OUT THIS LINE

:M On_Init:     ( -- )
     On_Init: super
     2    SetId: vga-bit-window
     self Start: vga-bit-window
\     self Start: CurrentPopup               \ COMMENT OUT THIS LINE
     Demo-popup-Bar SetPopupBar: vga-bit-window \ ADD THIS LINE

MORE NOTES: WinDemo is an example of an application that has a window
that contains a child window.  The child window is the window into which
drawing is done.  When the right mouse button is pressed, it is located
within the area of this vga-bit-window, so the SetPopupBar: method must
be performed on the child window vga-bit-window.  In an application that
has several child windows, a separate right mouse popup menu can be
installed for each child window in the application.  This results in a
much more flexible implementation.

Moved several facilities into WINDOW.F;


Added to ClassInit:

        self to CurrentWindow

Added to On_Close:

        Close: CurrentMenu

These changes simplify applications that use menus and right mouse popup
menus. All example programs that use these facilities have been updated;


July 11th, 1996 - 15:46 tjz
Included a new version of Jim's assembler 486ASM.F, version 1.24.  Jim
fixed a couple of bugs.  Made some modifications to the hyper text
compiler to change the file recognition character from 249 to a TAB.  The
249 character was causing problems with the extended character set
support. Also enhanced the code to exclude comments in source from being
hyper text compiled.

Modified all occurances of 'MessageBox' in Win32Forth to put up a message
dialog that is application modal.  It was just too easy to attempt to
invoke multiple instances of the same message dialog, which would then
cause a crash when they were closed, because the message box handle would
already be NULL.  The only significant difference you will see, is that
message dialogs now appear in the center of the screen instead of in the
center of the application window.

July 10th, 1996 - 14:41 tjz
Made changes suggested by Marcos Cruz to allow extended character sets to
be used with Win32Forth and WinView.  I don't know if they are complete,
or even absolutely functional, since I don't use anything other than
American English, but I'm sure someone will tell me if there is a

Also added UPPER-CASE and new LOWER-CASE functions to WinView to use the
Win32API calls CharUpperBuff and CharLowerBuff for case conversion.
These should work properly for all countries.  At least in theory.

July 1st, 1996 - 11:12 tjz
Made some minor adjustments to DC.F and WINVIEW.F to correct problems
with the way WinView printed text containing underscores on A4 (A5?)
paper.  It was truncating them, making them invisible.  Not good.  FIXED
I think.

June 28th, 1996 - 12:14 tjz
Corrected a bug in OPTIMIZE, in file OPTIMIZE.F.  I was optimizing away
'POP EBX' followed by 'PUSH EBX'.  This is bad! Need to replace them with
the instruction; 'MOV EBX, 0 [ESP]'.  FIXED

June 27th, 1996 - 10:51 tjz
Renamed MAKEDLL.F to FORTHDLL.F to be more consistent with the other
example files used in the FORTHDLL. Updates several of these files and
added some new one.  The list is something like this;

        --- Forth FORTHDLL.DLL Application Creation Files ---

        MESSAGES.F      loaded first onto Win32Forth, defines message
                        support, and the facility to define callable DLL
        FORTHDLL.F      loaded after your application.  Saves the Forth
                        Image as a resource in FORTHDLL.DLL, and
                        automatically builds MESSAGES.H and MESSAGES.BAS
                        which are used to interface to the FORTHDLL.DLL
                        from Visual C or Visual Basic.

        --- Visual C FORTHDLL.DLL Wrapper Project Files ---

        FORTHDLL.MAK    Visual C project file to build the DLL wrapper.
                        You must compile this with Visual C before doing
                        anything with Win32Forth to make a DLL.
        FORTHDLL.DEF    File needed to build FORTHDLL.DLL
        FORTHDLL.RC     File needed to build FORTHDLL.DLL
        FORTH.C         File needed to build FORTHDLL.DLL
        TERM.C          File needed to build FORTHDLL.DLL
        FORTH.ICO       File needed to build FORTHDLL.DLL
        ICON1.C         File needed to build FORTHDLL.DLL
        FORTH.H         File needed to build FORTHDLL.DLL
        TERM.H          File needed to build FORTHDLL.DLL

        --- Visual C FORTHDLL.DLL Access Files ---

        FORTHDLL.H      The automatically generated message constant file
                        that would be included in a Visual C project file
                        that wanted to access the FORTHDLL.DLL.  No
                        project for Visual C is provided, only the
                        following Visual Basic demo program following.

        --- Visual Basic FORTHDLL.DLL Access Files ---

        FORTHDLL.VBP    Visual Basic project file to demonstrate calling
        MESSAGES.BAS    The automatically generated message constant file
                        that must be included in your Visual Basic
                        project file.
        FORTHDLL.BAS    Demonstration Visual Basic source file that
                        contains the interface to the FORTHDLL entry

Making a DLL requires the following steps;

  1. Build the FORTHDLL.DLL with Visual C.

  2. Edit and compile your DLL application including MESSAGES.F at the
     beginning nd FORTHDLL.F at the end.  DLL entry points are defined
     with the :DLLFunc subfunction defining word.  After compiling
     FORTHDLL.F, the DLL FORTHDLL.DLL will have been updated with your
     applications Forth Image.

  3. Edit and compile the Visual Basic FORTHDLL.BAS file to include the
     :DLLFunc subfunctions you added to FORTHDLL.DLL.

  4. Debug and iterate on steps 2 through 4 until you application works
     the way you want it to.

  5. Save the compiled Visual Basic program as an EXE.

  6. Run the Visual Basic EXE, and you are done.

  7. Distribute the DLL.

Added another form of optimizing to OPTIMIZE.F.  It code compiles inline
any simple colon definitions is finds while optimizing.  That is it looks
inside any colon definition it finds, and if the colon definition
contains only optimizable words, then the definition is inlined with
optimization rather than switching back to high level code and compiling
a threaded call.

June 26th, 1996 - 10:54 tjz
Added additional word documentation to FKERNEL.F.

June 25th, 1996 - 12:46 tjz
Several people found that there were open file problems when starting
WinView with the "reopen same file as last session" button option
selected.  This was caused by a bug in the Registry Get Key function.  I
was using a local string buffer that was getting deallocated before it
was being used.  FIXED

Also fixed some problems related to automatically saving edit changes.

June 24th, 1996 - 14:55 tjz
Added additional optimizations as suggested by;

He found that a bunch of kernel code words begin with "PUSH EBX" and end
with "POP EBX".  These pairs can be optimized out of existence.

June 10th, 1996 - 11:20 tjz
Got rid of the EXCEPTIONS vocabulary, moved its few words into HIDDEN.
Moved Registry support lower in the load order.

June 7th, 1996 - 11:22 tjz
Added several Pinhole optimizers to OPTIMIZE.F.  It now looks for
literals to preceed words like +, -, AND, OR, XOR, !, +!, C!, C+!,
LSHIFT, RSHIFT and +TO.  When these are found, it compiles an instruction
that contains the preceeding literal, saving several bytes.  These
optimizers recover most of the extra space consumed by simply turning on
the optimizer and laying code down inline right out of the kernel.

June 5th, 1996 - 9:47 tjz
Fixed several bugs in OPTIMIZE.F.  I have been able to compile the
entire WinView Editor in optimize mode, and have the resulting
executable runable.  This is not however something I would normally want
to do, since the resulting program is about twice as big as the
un-optimized program.  The optimizer is for speed, and as such should
only be used on program code sections that need to be faster, not entire

Also received a bug report from Ribert Smith.  He found that the print
dialog in WinView wouldn't come up for user selection after the first
time you printed.  This was a bug in the wrapper relating to the way I
was initializing the printer.  FIXED

NOTE:  The Print button in Winview is designed to display the print
dialog only the first time you go to print.  If you have already printed
at least one page, then the printer button on the toolbar just goes ahead
and prints.  If you want to select parameters other than the ones used
last time you printed, then you need to use the "Print File..." menu item
under the File menu.

At the suggestion of Robert Smith, I also added an option in the WinView
preverences dialog to turn off the printing of page borders.  Currently
this also diables the printing of the footer date, and page numbers.

Munroe C. Clayton and others reported a bug in F** and FEXP in the
floating point.  I passed the report on to Robert Smith, and he supplied
information that his original testing was done on another assembler.
Subsequent testing determined that the code generated by the earlier
assembler for the instructions FSUB and FSUBR was reversed. This was
effecting the assembly functions FEXP and FEXPM1.  These are used in
various floating point operators.  I determined with Andrew's help that
Jim's assembler was generating correct instructions, but the floating
point code had been adjusted to produce correct code with the previous
assemblers reversed instructions.  I corrected FLOAT.F to account for
Jim's assembler being correct.  I hope this fixes the problems, but I
will have to wait for further feedback and verification.

June 3rd, 1996 - 13:46 tjz
Made TempRect into an object of class Rectangle.  This will have a
significant impact on any application code that uses the word TempRect.
The new object TempRect is defined at the end of CLASS.F, and provides
methods for setting, erasing and displaying the fields of the rectangle.
Usage of TempRect is much cleaner than before, but it is quite different,
so you will want to look as how it is used in the various places in
Win32Forth for examples of how it is now used.  Here is an overview;

Old way
                                        \ init TempRect and return
        x y 'x 'y TempRect dup>r        \ its address

        r> DeleteRect                   \ erase TempRect after use

New Way

        x y 'x 'y SetRect: TempRect     \ init TempRect

        TempRect.AddrOf hdc Call GetClientRect \ call window with rect

        TempRect.Right      ( -- n1 )   \ get the "right" field of rect

        EraseRect: TempRect             \ erase TempRect after use

As you can see it certainly is quite different.  I think it is also much
more readable than before. While the Old way appears to have been
reentrant, in reality there was really only one TempBuf, which was
re-used each time TempRect was referenced.

WARNING: I have found that the DOTTED '.' notation cannot be used on
dynamically created objects.  This is because there is no way currently
to determine at compile-time which class the object refers to. This is
inconvenient in the cases similar to the above where you might like to
create a rectangle dynamically and then dispose of it after use.

May 31st, 1996 - 13:24 tjz
Modified the way the menu and toolbar words work.  Added a new word that
must be used to complete the definitions of any of the "BAR" words, such
as MENUBAR, TOOLBAR, POPUPBAR etc..  All of these bar defining words
should be completed with the word ENDBAR.  This change allows the lower
level utility words that are used in building the various bars to be
hidden except when they are needed, reducing the number of functions
dumped in the Forth vocabulary by a significant number.  Here is an
extract from the example program WINDEMO.F that illustrates the use of

    POPUPBAR Demo-Popup-bar
        POPUP " "
            MENUITEM        "Open File..."  'O' +k_control pushkey  ;
            MENUITEM        "Print File..." 'P' +k_control pushkey  ;
            MENUITEM        "Exit"          bye                     ;

May 30th, 1996 - 18:09 tjz
Added a file MODULE.F to Win32Forth.  A simple implementation for
function scoping, used in the form;

INTERNAL        \ internal definitions start here

... define the internal definitions ...

EXTERNAL        \ externally available definitions start here

... define the definitions you want to be available externally ...

MODULE          \ finish up the module.

There are other implementations, but this was one I liked from way back.
Internal definitions are automatically placed in the HIDDEN vocabulary,
so they can be obtained later if needed.

May 29th, 1996 - 10:05 tjz
Moved CLASS.F down lower in the load order to make OOP available earlier
in the extend process.

May 24th, 1996 - 12:10 tjz
Moved the local variable support down into the kernel.  No support by the
meta compiler, but at least local variables can now be used as soon as
the kernel starts up.

May 23rd, 1996 - 15:48 tjz
Modified the Control-L (load highlighted text) command in WinView to feed
the highlighted text through the Win32Forth keyboard macro mechanism
rather than feeding it through a file called TEMP.F.  The way it now
works, is WinView simply does a text copy to the clipboard of the
highlighted text, then tells forth to perform a paste and load, which
causes the text in the clipboard to be entered through the keyboard.

Also added a Paste function in the new Edit menu to Win32Forth.

May 22nd, 1996 - 14:47 tjz
Added some more instructional sections about objects to STARTUP.TXT.
Re-inserted 'DINT' as an object data type, so it could be used in the
directory continguous data structure example in STARTUP.TXT.

May 21st, 1996 - 9:19 tjz
Added the words to support dynamic objects as follows;

HEAP>   ( -<classname>- ) allocate and init an object of "classname"
NEW>    ( -<classname>- ) synonym for HEAP>, more C++ like
DISPOSE ( a1 -- )         dispose of object a1 after executing the
                          default distructor method "~:"
~:                        the default object destructor method

Dynamically allocated objects are initialized using the ClassInit:
method, just like any other instance of a class.  When you are done using
the object, you can dispose of its instance by passing its address to
DISPOSE, which will execute the destructor method "~:" and then release
the memory space used by the object.

Moved the hashed dictionary code out of PRIMUTIL, down into the kernel
and meta compiler.  Moved N(FIND) down into the kernel, and renamed it to
(FIND), eliminating the old (FIND) from the kernel.  There used to be a
word called HASH, that was only used by the Object code, and another word
called "#HASH that was used by the Forth system for headers and
dictionary searches.  I have renamed HASH to METHOD-HASH, to avoid
someone thinking the two hashes are the same, they are not.

May 20th, 1996 - 15:02 tjz
Revamped memory allocation and deallocaton.  Dynamic memory that is
allocated by a program will now automatically get released, even if you
don't release it.  This functionality is built into ALLOCATE, MALLOC,

A side effect of this modification, is that FREE which previously
returned a dummy FLASE flag, because no FREE could fail, now validates
the pointer about to be freed, and will return a TRUE (failure) flag if
the pointer isn't on the list of valid memory pointers.  The word RELEASE
which used to just discard the dummy flag, now checks the flag, and
performs an abort if the FREE fails.  The side effect of this, is that
you need to use FREE instead of RELEASE if you want to handle errors

May 17th, 1996 - 14:44 tjz
Additional changes to CLASS.F, to add a pair of words RECORD: and ;RECORD
to tell the compiler to force all data objects defined INSIDE A CLASS
between these words to be contiguous, and to define a data object that
doesn't consume any space, but returns the address of the start of the
record. They are used as follows;

 :Class Point <Super Object
         int x
         int y

First we define a class POINT that has two data items, one for X and one
for Y.

 :Class Rect <Super Object

         Point lowleft  
         Point topright

 Record: myDoublePoint          \ returns address of start of record
         Point upleft
         Point botright


Then when POINT is used in RECT, LOWLEFT, and 'TOPRIGHT' are defined
inside RECT with class pointers so that they will be decompilable later.
The Points UPLEFT and BOTRIGHT however are defined inside the RECORD:
;RECORD boundries, so their data areas will occur contiguous with each
other so they can be passed to the operating system as a defined

NOTE:  The Points UPLEFT and BOTLEFT above are used as data object of the
Rect class, NOT AS SUBFIELDS of myDoublePoint.  myDoublePoint is just
used to return the address of the start of the structure if you need to
pass it to the operating system or another method or function.

REMEMBER: RECORD: and ;RECORD can only be used inside the definition of a
class or object.

May 16th, 1996 - 15:40 tjz
Received some changes to CLASS.F from Martin Laeuter that allow
non-ClassPointer classes to be built that can contain hard user defined
data structures.  Normally a classpointer is included with each data
object compiled into a class, so it can later be decompiled.  This is
inconvenient in some cases, because you may want to create a data
structure that will be passed to the operating system which needs to be
in a particular form, and should not contain any extra stuff.  I believe
Martin's changed solve this problem.

May 15th, 1996 - 16:55 tjz
Fixed a long standing bug in WinView that would cause it to delete the
first character of some words occasionally while performing word wrap on
a paragraph.

May 14th, 1996 - 16:06 tjz
Added checking to the de{*filter*} Jump command, to prevent it from allowing
the Jump command to be used unless the word about to be executed is a
branch operation like: BRANCH, ?BRANCH, _UNTIL, _REPEAT, _WHILE, _OF,
(LOOP), or (+LOOP).  Allowing a Jump command at other execution locations
could have caused a crash.

May 10th, 1996 - 14:33 tjz
Modified Win32Forth to save its console location in the registry, instead
of in the windows .INI.  Also am now saving the install directory in the
registry so Forth can know where to find the KERNEL.BIN file that is
needed when a FSAVE is performed.  The implecation of this, is that if
you move Win32Forth to another disk drive that already has a version of
Win32Forth already installed on it, then you might get into a situation
where one of the copies of Forth will use the KERNEL.BIN from the other.
To prevent this, I am checking the Win32Forth version number in the
register.  If the number doesn't match, then the copy just run,
re-registers itself as the current installed copy of Win32Forth.

May 9th, 1996 - 8:59 tjz
Corrected the spelling of Andy Korsak's name in the about dialog.  I'm
sorry for the mistake Andy.

Received several corrections from Ulrich Hoffmann. One was a bug in
PRINT-DIR-FILES, and another was a potential problem in EVALUATE.  The
rest were cleanup corrections. Thank you Ulrich.

Replaced almost all occurances of COMPILE and [COMPILE] with POSTPONE in
all source files.  The only exception is in FKERNEL.F, where POSTPONE is
not available in the meta compiler.  This has no effect on the actual
code that gets compiled, but makes everything slightly more ANS like.

May 7th, 1996 - 10:40 tjz
Found and fixed the "extra cr" bug in the de{*filter*} that was causing an
extra carraige return to be display on each single step.

Setting a breakpoint from within WinView, is now done in any of the ways
as follows;

1. Click the "bug" button and enter the word name.

2. Put the cursor in a word in the source and hold down control while
   clicking the "bug" button.

3. Press control-B, if the cursor is in a word, then that word will be
   selected as the debug word.  If you are in white space, then the
   breakpoint dialog will be brought up. Hold down Control-shift-B to
   always popup the breakpoint dialog.

MORE NOTES:  If you are in the middle of debugging, and you decide you
would like to set your breakpoint to another location, then you can do
this by pressing the "bug" icon again.  Enter the name of the new word
you want to debug, then press the "to BP" button in the de{*filter*} window.
This will allow execution to continue till the new breakpoint is

WARNING: Pressing the "Step" button after setting a new breakpoint
instead of the "to BP" button de{*filter*} will result in a trace error.

Added an Inquire button to the de{*filter*}. The line you enter is passed to
the Win32Forth application for interpretation, and any stack results are
displayed on the line below the button.  There is however only room for a
couple of numbers to be displayed, and it won't even try to display more
than four values.  Use caution, as it is easy to crash the application
being debugged using words that do more than just return a number on the
stack.  Vocabulary search order is not restored after a command, so you
can easily interfere with the operation of the target.  Also note, that
you do not have access to the target stack, since the code is intrpreted
during a callback, which has its own stacks.

If you click the inquire button while holding down the Control key, a
word under the cursor in the editor will be picked up and passed to the
target for interpretation.  If you also hold down the Shift key, then you
will be allowed to edit the command line before the command line is
interpreted.  This is very powerful, but if for example you has
'VOC#THREADS' highlighted, and you press Control and Inquire, then the
target will probably crash, since there is no vocabulary address on the
stack for voc#threads to use.

Remember, in human terms, power corrupts, and absolute power corrupts
absolutely. You have the power, be careful how you use it.

May 6th, 1996 - 15:55 tjz         w32f32b4
Finally got the de{*filter*} working fairly well from WinView. The BUG icon
lets you set a breakpoint into a currently running Win32Forth program.
The de{*filter*} window lets you perform most of the normal Forth de{*filter*}
commands from within WinView.  Nesting and Unnesting is a little slow,
becuase of all the searching that is going on during these events, so
you may have to wait a few seconds after pressing the "Into" or "Out of"
de{*filter*} buttons before the screen updates.  Overall, I think it works
pretty well.

HINTS: The search path for the WinView editor needs to include the path
to the source files of the program you are debugging, or it won't be able
to find the source files.

May 2nd, 1996 - 9:58 tjz
Extended the Object syntax to support a non space delimited syntax for
method specification on an object.  It works like this;

    old syntax (still valid)

            Start: ThePrinter

    new syntax


You can also use dots to specify objects with objects as follows;

    old syntax (still valid)

            Get: ThePrinter.PRINTCOLOR.colorref

    new syntax


    Alternate syntax for Get:


NOTE: The Get method is the default method for a dotted object if
none is specified, the following will "Get: the colorref of the
PRINTCOLOR object inside ThePrinter

NOTE: All classes have been switched to ClassPointer classes, that is,
all objects created, contain pointers to their defining class.  This was
done so that the dotted syntax would work, and so the decompiler would
work properly.  The implication is that data objects within other classes
or objects are separated from each other by a CELL which contains the
pointer to the data objects class.  This makes it effectively impossible
to build a data structure using objects that need to be defined as
continguous with each other, as might be the case if you were trying to
pass a data structure to the operating system.  We are working on a
solution to this, but we haven't come up with one yet.

May 1st, 1996 - 11:11 tjz
Added the WinView command Control-L to the File menu, to tell Win32Forth
to load the currently highlighted text.  If no line is highlighted, then
the current cursor line is highlighted and it is loaded.  This works by
copying the highlighted text into the file <curdir>\TEMP.F and then
WinView tells Win32Forth to perform an FLOAD <curdir>\TEMP.F.  

NOTE: Due to thread prioprity problems, you may need to move the mouse
over the Win32Forth console window to allow it to get some execution
priority so the highlighted text will actually be loaded.

Adde the additional de{*filter*} commands to the Edit menu as;

        Control+B       set breakpoint and open debug window
        Control+D       just open the debug window

Tue, 12 Jan 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Win32Forth Version 3.2 Released (short version)

2. Win32Forth Version 3.5 Released (LONG)

3. Product Scope 32 Bookmarks, Version 3.2 Officially released!

4. Win32Forth version 4.0 Released

5. J, Version 3.2 for Mac

6. J, Version 3.2

7. Beta Product Scope 32 Bookmarks Version 3.2 - Profile Exchange

8. TpForth 3.2 update 1 has been released

9. Mops 3.2 released

10. Free Berkeley Logo version 3.2 available

11. ANNOUNCE: GNU id-utils 3.2 released

12. Visual Eiffel 3.2 released (Windows, Linux)


Powered by phpBB® Forum Software