Discussion:
The same Forth on different OS
(too old to reply)
Yves Surrel
2004-08-18 08:32:13 UTC
Permalink
Hello

I am a long user of Forth, since I discovered it in the early '80s
when it had to be downloaded from a tape to my 6502-based "Oric 1". I
have always stuck to Forth as I recognize it as clever, simple,
powerful and unlimited. However I also used Delphi, I am a certified
developer in Labview (a scientific software by National Instruments,
http://www.ni.com), I had a look to TCL/Tk, Java, Python...

I am a scientist, not a developer. For me software is a tool, not a
goal. I expect to spend minimum time to achieve what I want. I am
looking for the simplest and most powerful solutions, not fighting for
a particular "chapel". That's why I use Labview for some needs, which
is undoubtedly simple and powerful (graphical programming)

I love the Mac from the beginning, but had to develop for Wintel
because it is an industry standard (don't ask me _why_ it became a
standard, as I always heard people complaining about it...). So I used
Win32Forth these last years to develop a software which is now used in
a professional application (basically image processing for quality
control in manufacturing industries).

The architecture is the following. I separated the calculation kernel
from the human interface, thanks to the ability of Win32Forth to
generate DLL's very easily. I developped the first version of the
interface with Delphi. The forth DLL has a single entry point which
expects a string to be interpreted. So the interface can use all the
power of forth very easily. If a new call is needed, it suffices to
send the appropriate string to the forth interpreter. The DLL needs
not be changed, which is very practical.

For team working, this separation is excellent: some guys work on the
interface and I work on the kernel, and there is no mixture. The fact
that the programming language is not the same helps keeping
functionalities well separated. Different human interfaces can be
developped depending on the client requirements: e.g; a "laboratory"
one, giving full access to all possibilities, even giving access to a
forth terminal, thus providing the user a full object-oriented
development system with interpreter, compiler, decompiler, assembler,
disassembler, debugger (all this in a <1Meg DLL!), or a "blue collar"
one with a red button "Go" and an indicator: green (test passed OK) or
red (test failed).

My concern is today: what about system-independence, more precisely
Wintel-independence? As you probably knows, Win32Forth and Mops are
very close. I mostly used the former, I mentioned why, although I have
a very good feeling about Mops (e.g. Mops allows multiple inheritance,
W32F does not).

I regret that both systems are too intricately relying on 1) the
processor type 2) the operating system 3) the windowing system. I
would be very happy with an architecture with layers separating:

-the interface to the processor (I recognize that in general there is
a single file gathering all assembly code definitions for @, !, etc,
so this "layer" mostly already exists)
-the interface to the operating system;
-the interface to the windowing system and user input-output.

Why reinvent the wheel? Java could be a good way to have a windowed
interface to a forth kernel, not depending on a particular OS. Is it
an interesting challenge to be able to build the visual interface in
forth? In my opinion: _no_ because there are freeware tools that allow
to build it more easily and quickly. (ForthForm in the Win32Forth
world is nice, yet limited and... Windows-specific...). JBuilder you
can download free from Borland corresponds to lots of engineer-years
of development. Why not use that? Have a look at JEdit, developped in
Java: it works and looks fine on Mac OS X and Windows. Very
convincing.

I really would be happy with a forth development going towards:
-melting all good features from win32Forth and Mops into a single
system-independent "resource" (shared library or something more
clever...), so that the (too small) communities of forth developpers
can work together (this is really needed!);
-development of a system-independent RAD (rapid application
development) allowing the use of the system-independent Forth above
(maybe it suffices to use JBuilder and implement some Java classes to
make the appropriate calls and callbacks...). I mention Java, it may
be Tcl/Tk or wxPython or whatever.

Remember that the modern trend in programming is the MVC
(model-view-controller) architecture, where roles are well defined and
separated in different software entities.

I post also this message to http://groups.yahoo.com/group/win32forth/

Cheers


Yves
ward mcfarland
2004-08-18 12:58:05 UTC
Permalink
Post by Yves Surrel
I post also this message to http://groups.yahoo.com/group/win32forth/
This category of topic usually generates a lively discussion on
comp.lang.forth although it might degenerate into an argument about the
inadequacies of the ANS standard. It has been a dream of many to have a
cross-platform syntax-identical Forth.

...


A few random thoughts on pursuing the holy grail of unified source
cross-platform development...


Mac users do not like GUI's that look like they were cloned from a PC,
and I suspect the converse is also true.


It is not just Windows/Menus/Controls/Dialogs that differ between the
various OS's - event handling, networking, inter-application
communication, help functions, scripting, hardware interfacing,
internationalization, etc are all quite different. Even the same data
structures saved to files can be different (Big vs Little Endian memory)



One problem I see relying on Java is that Java has not seemed to live up
to its initial hype. Do you know of any solid commercial applications
written in java?


If you just want to isolate the GUI and display, it would be worth
looking into OpenGL which is capable of some impressive graphics with
minimal coding. The OpenGL wordset is platform independent, so it only
remains to provide Forth<->OS glue for the GL primitives, and the "good
stuff" is all usable in Forth. Jorge Acerda Macia has done some of this
for GForth, George Kozlowski in MacForth, and Nao Sacrada in Mops (see
this newsgroup about 4-5 months ago). Perhaps we could find some
Windows Forthers using OpenGL and jointly work up a "Forth OpenGL
standard". The interesting thing to me about OpenGL is that besides
things like doing fancy animated 3-D graphics it also is a full run-time
"shell" that does all the basic event handling, window management, etc
in a platform-appropriate way. Forth "Handlers" are easily installed for
handling program-specific stuff, like mouse-clicks, keypresses, menu
selection, etc. So you I have a nice OS X demo of an OpenGL
stand-alone program with forth handlers for a few actions - it required
only minimal recoding to convert a GForth OpenGL example to Carbon
MacForth. (email me if you want either to d/l the demo or the source -
the GForth source is supplied in GForth.)


NextStep (the ancestor of Coocoa) has versions for Windows and various
Unix's, I believe.


REALbasic <http://www.realsoftware.com/> can do cross-platform
development.


Runtime Revolution is a cross-platform RAD-like solution that has been
around for several years: <http://www.runrev.com/>





- ward
Conrad Weyns
2004-08-20 07:25:23 UTC
Permalink
Post by ward mcfarland
Post by Yves Surrel
I post also this message to http://groups.yahoo.com/group/win32forth/
This category of topic usually generates a lively discussion on
[...]
Post by ward mcfarland
One problem I see relying on Java is that Java has not seemed to live up
to its initial hype. Do you know of any solid commercial applications
written in java?
Together Control Center
http://www.borland.com/together/controlcenter/index.html

They went Java-only, a number of years ago.
I.m.o, a very good example of what can be done in Java.
I have only run it on a Windoze box though so I have no idea how well it
does on other platforms!
I have had the dubuous pleasure of trying signed Java Applets across Mac &
Win and it nearly killed me. It never got any further than a set of
prototypes and a 20 page report :) Never again!
Post by ward mcfarland
If you just want to isolate the GUI and display, it would be worth
looking into OpenGL which is capable of some impressive graphics with
minimal coding. The OpenGL wordset is platform independent, so it only
remains to provide Forth<->OS glue for the GL primitives, and the "good
stuff" is all usable in Forth. Jorge Acerda Macia has done some of this
for GForth, George Kozlowski in MacForth, and Nao Sacrada in Mops (see
this newsgroup about 4-5 months ago). Perhaps we could find some
Windows Forthers using OpenGL and jointly work up a "Forth OpenGL
standard". The interesting thing to me about OpenGL is that besides
things like doing fancy animated 3-D graphics it also is a full run-time
"shell" that does all the basic event handling, window management, etc
in a platform-appropriate way. Forth "Handlers" are easily installed for
handling program-specific stuff, like mouse-clicks, keypresses, menu
selection, etc. So you I have a nice OS X demo of an OpenGL
stand-alone program with forth handlers for a few actions - it required
only minimal recoding to convert a GForth OpenGL example to Carbon
MacForth. (email me if you want either to d/l the demo or the source -
the GForth source is supplied in GForth.)
I recently suggested looking into OpenGL for our next gui version at my
place of work.
The Windows .NET gurus (they are gaining ground at a steady pace)
immediately turned it down in favour of some Windows technology that I
allready forgot the name of, but it sounded like "Direct-something-??".

Regards,
Conrad Weyns
Post by ward mcfarland
NextStep (the ancestor of Coocoa) has versions for Windows and various
Unix's, I believe.
REALbasic <http://www.realsoftware.com/> can do cross-platform
development.
Runtime Revolution is a cross-platform RAD-like solution that has been
around for several years: <http://www.runrev.com/>
- ward
ward mcfarland
2004-08-20 11:04:43 UTC
Permalink
Post by Conrad Weyns
I recently suggested looking into OpenGL for our next gui version at my
place of work.
The Windows .NET gurus (they are gaining ground at a steady pace)
immediately turned it down in favour of some Windows technology that I
allready forgot the name of, but it sounded like "Direct-something-??".
It is interesting to look at the list of high-end cross-platform
applications (especially high-performance games) that are coded in
OpenGL: <http://opengl.org/applications/index.html>

Clearly, your employers have no plans for EVER porting to Linux, Unix,
OS X, in which case their choice may be ok - to be sure, you or they
should study some of the results of a Google search of "OpenGL vs
Direct3D", especially the nice overview at:
<http://www.gamedev.net/reference/articles/article1775.asp>


An OS X OpenGL demo with the MacForth source used to build it is at
<http://www2.megawolf.com/~ward/updates/OpenGLdemo.sit>. The OpenGL
Forth code is almost identical to the gForth version (slightly different
syntax for the Framework calls and callbacks, a bug fix for 10.3, and
manually included rather than .h-imported constants.) The only
OS-specific stuff that really would be needed to use OpenGL is the glue
for the OpenGL Framework calls and the glue to allow callbacks from the
Frameworks back into Forth.

-- w
Mike Hore
2004-08-26 01:51:28 UTC
Permalink
Post by ward mcfarland
...
An OS X OpenGL demo with the MacForth source used to build it is at
<http://www2.megawolf.com/~ward/updates/OpenGLdemo.sit>.
The current Mops release (5.5) also includes an OpenGL demo.

Cheers, Mike.

----------------------------------------------------------------
Mike Hore ***@OVE.invalid.icasolution.com.au
----------------------------------------------------------------
ward mcfarland
2004-08-26 17:48:27 UTC
Permalink
Post by Mike Hore
Post by ward mcfarland
...
An OS X OpenGL demo with the MacForth source used to build it is at
<http://www2.megawolf.com/~ward/updates/OpenGLdemo.sit>.
The current Mops release (5.5) also includes an OpenGL demo.
Yes, also derived from the same Gforth demo as ours, but rewritten in a
Mops-object form, so it its syntax is very different.

The original question was how to have a cross-platform Forth syntax for
GUI - I was suggesting OpenGL and GLUT as a possible solution.

-- w
Alex McDonald
2004-08-20 11:01:38 UTC
Permalink
"ward mcfarland" <***@megawolf.com> wrote in message news:1gipagv.1ula8cpm1zmsaN%***@megawolf.com...

===snipped
Post by ward mcfarland
If you just want to isolate the GUI and display, it would be worth
looking into OpenGL which is capable of some impressive graphics with
minimal coding. The OpenGL wordset is platform independent, so it only
remains to provide Forth<->OS glue for the GL primitives, and the "good
stuff" is all usable in Forth. Jorge Acerda Macia has done some of this
for GForth, George Kozlowski in MacForth, and Nao Sacrada in Mops (see
this newsgroup about 4-5 months ago). Perhaps we could find some
Windows Forthers using OpenGL and jointly work up a "Forth OpenGL
standard".
Jos vd Ven has written Win32Forth wrappers for OpenGL code; you can find his
homepage at http://home.planet.nl/~josv/
--
Regards
Alex McDonald
Alex McDonald
2004-08-18 15:16:34 UTC
Permalink
Post by Yves Surrel
I love the Mac from the beginning, but had to develop for
Wintel because it is an industry standard (don't ask me _why_
it became a standard, as I always heard people complaining
about it...). So I used Win32Forth these last years to
develop a software which is now used in a professional
application (basically image processing for quality control
in manufacturing industries).
Excellent! Which versions of W32F? We could do with the advertising kudos;
would your company be willing to let us advertise the fact?
Post by Yves Surrel
The architecture is the following. I separated the
calculation kernel from the human interface, thanks to the
ability of Win32Forth to generate DLL's very easily.
Ah, then it must be 4.2, since 6 lost that ability. Shame... We'll just have
to fix it.
Post by Yves Surrel
I
developped the first version of the interface with Delphi.
The forth DLL has a single entry point which expects a string
to be interpreted. So the interface can use all the power of
forth very easily. If a new call is needed, it suffices to
send the appropriate string to the forth interpreter. The DLL
needs not be changed, which is very practical.
For team working, this separation is excellent: some guys
work on the interface and I work on the kernel, and there is
no mixture. The fact that the programming language is not the
same helps keeping functionalities well separated. Different
human interfaces can be developped depending on the client
requirements: e.g; a "laboratory" one, giving full access to
all possibilities, even giving access to a forth terminal,
thus providing the user a full object-oriented development
system with interpreter, compiler, decompiler, assembler,
disassembler, debugger (all this in a <1Meg DLL!), or a "blue
collar" one with a red button "Go" and an indicator: green
(test passed OK) or red (test failed).
My concern is today: what about system-independence, more
precisely Wintel-independence? As you probably knows,
Win32Forth and Mops are very close. I mostly used the former,
I mentioned why, although I have a very good feeling about
Mops (e.g. Mops allows multiple inheritance, W32F does not).
I regret that both systems are too intricately relying on 1)
the processor type 2) the operating system 3) the windowing
system.
True, for reasons discussed below.
Post by Yves Surrel
I would be very happy with an architecture with
-the interface to the processor (I recognize that in general
there is a single file gathering all assembly code
exists)
Which is where the problem starts. The kernel is heavily dependant on the
Intel x86 architecture, which is not what a Mac uses; it's Motorola 68000
based. That would require a complete rewrite.
Post by Yves Surrel
-the interface to the operating system;
Just as difficult; there are not that many similarities. Take multitasking
for instance. This would probably demand a POSIX compliant interface,
something Windows doesn't make easy.
Post by Yves Surrel
-the
interface to the windowing system and user input-output.
Easier.
Post by Yves Surrel
Why reinvent the wheel? Java could be a good way to have a
windowed interface to a forth kernel, not depending on a
particular OS. Is it an interesting challenge to be able to
build the visual interface in forth? In my opinion: _no_
because there are freeware tools that allow to build it more
easily and quickly. (ForthForm in the Win32Forth world is
nice, yet limited and... Windows-specific...). JBuilder you
can download free from Borland corresponds to lots of
engineer-years of development. Why not use that? Have a look
at JEdit, developped in
Java: it works and looks fine on Mac OS X and Windows. Very
convincing.
That's a possible route, as are other libraries such as wxWidgets (used by
Python, as you note). Unfortunately, most have C++ interfaces (the GUI
paradigm is a good fit with OO languages), which are impossible to cope
with; Jbuilder looks interesting though.
Post by Yves Surrel
I really would be happy with a forth development going
towards: -melting all good features from win32Forth and Mops
into a single system-independent "resource" (shared library
or something more clever...), so that the (too small)
communities of forth developpers can work together (this is
really needed!); -development of a system-independent RAD
(rapid application
development) allowing the use of the system-independent Forth
above (maybe it suffices to use JBuilder and implement some
Java classes to make the appropriate calls and callbacks...).
I mention Java, it may be Tcl/Tk or wxPython or whatever.
Remember that the modern trend in programming is the MVC
(model-view-controller) architecture, where roles are well
defined and separated in different software entities.
I post also this message to comp.lang.forth.mac
I suspect this is a different Forth altogether, that would require to be
built from the ground up. There's just too mich baggage in W32F (I can't
speak for MOPS, but the same is possibly true). What may be better is a
coalescing of the OOP part of MOPS and W32F, and the development of standard
OO libraries for both (somethong Doug Hoffman advocates). Then a window
class could be implement natively on each system; you as an app programmer
wouldn't see that. Then the separation would be;

+--- class layer ---+
| |
W32F MOPS

Then you're not interested in the OS, the windowing system or the OS
interface.
--
Regards
Alex McDonald
Mike Hore
2004-08-18 23:52:56 UTC
Permalink
Post by Alex McDonald
...
Which is where the problem starts. The kernel is heavily dependant on the
Intel x86 architecture, which is not what a Mac uses; it's Motorola 68000
based.
Hi Alex, just a tiny nitpick -- since 1992 or thereabouts, it's based
on the PowerPC.

But the point stands that this is still big-endian, and VERY different
from the x86 (or should I say ia32?) line of processors.
Post by Alex McDonald
Post by Yves Surrel
Remember that the modern trend in programming is the MVC
(model-view-controller) architecture, where roles are well
defined and separated in different software entities.
I post also this message to comp.lang.forth.mac
I suspect this is a different Forth altogether, that would require to be
built from the ground up. There's just too mich baggage in W32F (I can't
speak for MOPS, but the same is possibly true).
Possibly, though there's no technical reason that a new class
structure couldn't be written to sit above the code generator.

The problems aren't technical, they're just practical -- everyone's got
day jobs, and not enough time to take on such a big effort. There
would have to be an obvious big payoff to justify the time taken.

Then even if there were volunteers, the whole thing would have to be
specified, and I have a sneaking suspicion that to get consensus on
a specification might be a bit challenging ;-)

Cheers, Mike.


----------------------------------------------------------------
Mike Hore ***@OVE.invalid.icasolution.com.au
----------------------------------------------------------------
Alex McDonald
2004-08-19 15:46:14 UTC
Permalink
Post by Mike Hore
Post by Alex McDonald
...
Which is where the problem starts. The kernel is heavily dependant on the
Intel x86 architecture, which is not what a Mac uses; it's Motorola 68000
based.
Hi Alex, just a tiny nitpick -- since 1992 or thereabouts, it's based
on the PowerPC.
But the point stands that this is still big-endian, and VERY different
from the x86 (or should I say ia32?) line of processors.
Thank you for the correction; I should have known about PowerPC.
Post by Mike Hore
Post by Alex McDonald
Post by Yves Surrel
Remember that the modern trend in programming is the MVC
(model-view-controller) architecture, where roles are well
defined and separated in different software entities.
I post also this message to comp.lang.forth.mac
I suspect this is a different Forth altogether, that would require to be
built from the ground up. There's just too mich baggage in W32F (I can't
speak for MOPS, but the same is possibly true).
Possibly, though there's no technical reason that a new class
structure couldn't be written to sit above the code generator.
The problems aren't technical, they're just practical -- everyone's got
day jobs, and not enough time to take on such a big effort. There
would have to be an obvious big payoff to justify the time taken.
Then even if there were volunteers, the whole thing would have to be
specified, and I have a sneaking suspicion that to get consensus on
a specification might be a bit challenging ;-)
Which is where MOPS and W32F diverged way back; Andrew McKewan's
implementation differs from MOPS, and imho it's too late to rewind the
clock.
--
Regards
Alex McDonald
Stephen Pelc
2004-08-19 11:29:52 UTC
Permalink
Post by Yves Surrel
My concern is today: what about system-independence, more precisely
Wintel-independence? As you probably knows, Win32Forth and Mops are
very close. I mostly used the former, I mentioned why, although I have
a very good feeling about Mops (e.g. Mops allows multiple inheritance,
W32F does not).
I regret that both systems are too intricately relying on 1) the
processor type 2) the operating system 3) the windowing system. I
We tried to do this with VFX Forth, which runs under i32, and
has an ARM prototype. There is a Windows version that generates
DLLs, and we have a prototype Linux port. A Neon OOP library
is included.

The CPU dependent parts are code generation, start up code and
OS interface. The code generator for VFX is about 5000 lines
of code. The start up and callback interface is a few hundred
lines, much of which has to with insulating the kernel from
OS dependencies at build time. In total the OS interface is
less than 30 coded routines.

The windowing system is a nightmare! I'd really like to
find a library with a C interface (to avoid the C++ name
mangling issues), but we have not yet found a stable one that
satisfies most users. The alternative is to use something
like Bernd Paysan's Minos/Theseus system.

Stephen
--
Stephen Pelc, ***@INVALID.mpeltd.demon.co.uk
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeltd.demon.co.uk - free VFX Forth downloads
Charles A. Davis
2004-09-13 16:18:35 UTC
Permalink
Post by Stephen Pelc
We tried to do this with VFX Forth, which runs under i32, and
has an ARM prototype. There is a Windows version that generates
DLLs, and we have a prototype Linux port. A Neon OOP library
is included.
The CPU dependent parts are code generation, start up code and
OS interface. The code generator for VFX is about 5000 lines
of code. The start up and callback interface is a few hundred
lines, much of which has to with insulating the kernel from
OS dependencies at build time. In total the OS interface is
less than 30 coded routines.
What is the chance of digging way back in history, to the INITIAL aim of
FORTH, and do the OS in FORTH to start with?
Post by Stephen Pelc
The windowing system is a nightmare! I'd really like to
find a library with a C interface (to avoid the C++ name
mangling issues), but we have not yet found a stable one that
satisfies most users. The alternative is to use something
like Bernd Paysan's Minos/Theseus system.
Stephen
--
Stephen Pelc
2004-09-14 12:16:59 UTC
Permalink
On Mon, 13 Sep 2004 12:18:35 -0400, "Charles A. Davis"
Post by Charles A. Davis
What is the chance of digging way back in history, to the INITIAL aim of
FORTH, and do the OS in FORTH to start with?
Our cross compilers do this for embedded systems. All VFX Forths
are built using cross compilers. The I/O interfaces make system
calls for hosted Forths rather than to more orth words in embedded
systems.

Stephen
--
Stephen Pelc, ***@INVALID.mpeltd.demon.co.uk
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeltd.demon.co.uk - free VFX Forth downloads

Yves Surrel
2004-08-23 09:28:41 UTC
Permalink
Hello
Thank you for reacting.

Good ideas about OpenGL. I spent some time browsing about. In fact,
OpenGL by itself does not handles user events (keyboard and mouse).
This is done by a wrapping software layer (GL Utility or GLUT, or
FreeGLUT that seems to be more maintained). The openGL demo at
<http://www2.megawolf.com/~ward/updates/OpenGLdemo.sit> is veeeeery
nice! However, GLUT implements only very limited features, e.g. only
popup menus.

It would be very useful to have a common Forth interface to OpenGL
(W32Forth and PowerMops and others).

However, I still assert that the windowing stuff should be separated
from forth, even in a different language, OO-forth dealing only with
non-display-related issues (at least low-level ones). Think to forth
in this framework as a resource accessed by the user interface.

I am wondering whether a client-server architecture could be
interesting. A Forth server could be nice. What could be the best
communication between clients and the server:
-shared library could be a solution (I have still some problems, see
the thread "Shared libraries" in this forum...);
-OS messaging system (OS dependent..., what about speed?)
-using sockets (same question...)
-other?

The built-in interpreter and compiler of Forth makes the server
concept very attractive. The clients have only to communicate with
strings (think of the communication to a database server with SQL, for
example), with the enormous advantage of the extensible wordset. At
configuration time, the client sends the string ": MyProc < known
words > ;" and at execution time it sends "MyProc". Very practival and
efficient. All the power of and object-oriented engine available to
any client.

But please try to think about separation of user interface and the
Forth core.

Cheers

Yves
Continue reading on narkive:
Loading...