Re: Adding a GUI to a Forth system
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
Re: Adding a GUI to a Forth system         


Author: Mike T
Date: Jul 11, 2006 07:35

Hi Gerry,

My answer to question five, the following alternative approaches spring
to mind:

1 Repackage your C++ Forth as a DLL and host that within the VB
process. You should be able to provide a simple Forth/VB interface
based on TYPE, EMIT, ACCEPT, REFILL, etc. You will have to provide
other words (ie. functions/callbacks) for driving the GUI. A separate
makefile can be used for generating a standalone EXE Forth. You can
debug your Forth using the C++ debugger by specifying VB.EXE as the
debug process.
2 Provide a mapping to a C++ GUI library, such as MFC, within your C++
Forth. This sounds quite awkward and a lot of work.
3 Devise a foreign function interface within your Forth so that you can
make direct Win32 OS calls. Lots of work but will give the most
flexibility.

My view is that GUI coding can be very time consuming and fiddly.
Driving a simple bespoke interface such as an Othello board should work
fine using streams. If you are happy with your approach then stick
with that.
Show full article (1.02Kb)
5 Comments
Re: using MISC (post 1987 Forth hardware) opcodes         


Author: Brad Eckert
Date: Jul 12, 2006 08:10

Adam Warner wrote:
>
> And elsewhere in this thread you write, "Our goal is to make the hardware
> and software smaller, cheaper, faster, and easier to program." I don't see
> a conceptual foundation for the claim this hardware/software combination
> is easier to program.
>
I think this assertion relates to the psychology of Forth programming.
Their version of Forth takes the "virtual" out of VM. colorForth code
on a C18 is written to the C18's restrictions and strengths. It has few
keywords to remember and the set of words that are opcodes is small and
simple. Your restrictions are real hardware, not an abstract model.
It's not ANS so you don't treat it like ANS. Maybe that's why Jeff says
it's "Easier to program". That's not to say it can't be portable. You
can build a portable app on top...
Show full article (1.06Kb)
no comments
Re: using MISC (post 1987 Forth hardware) opcodes         


Author: Jeff Fox
Date: Jul 12, 2006 09:50

Adam Warner wrote:
> And elsewhere in this thread you write, "Our goal is to make the hardware
> and software smaller, cheaper, faster, and easier to program." I don't see
> a conceptual foundation for the claim this hardware/software combination
> is easier to program.

The documentation goes back almost twenty years. If you have been
following it you have seen the explanations of the conceptional
foundation for each of the changes introduced. Because much of
it is ancient history now probably the only place you will find it is
in the old pages at my site that document that fifteen year period
where Dr. Ting and I wrote the only documentation.

Take the removal of ELSE for instance.

This clearly had nothing to do with hardware in that an ELSE is
just a jump and the machines all have had jump instructions.

Like dozens of other things Chuck explained his reasoning.

People had experimented with factoring Forth code many different
ways and there were many debates about favoring using ; or
facoring using IF ELSE THEN or IF THEN or nested IFs and
BEGINs and FORs and DOs and CASE and RECURSE etc.
Show full article (13.94Kb)
3 Comments
Re: using MISC (post 1987 Forth hardware) opcodes         


Author: Adam Warner
Date: Jul 13, 2006 02:33

On Wed, 12 Jul 2006 09:50:45 -0700, Jeff Fox wrote:
> You have to understand the conceptual foundation about how Forth code
> should be constructed and factored. And people do get confused about how
> code can have short words and lots of : and ; and also use a minimal
> amount of the stacks!

Again, you can only use a bounded amount of stack with tail recursion or
the translation of a recursive definition into an iterative form.

A tail recursive Forth word will call RECURSE as the last thing it does
before exiting the word. A Forth compiler can translate this call into a
jump to the start of the word.

A tail recursive definition is typically harder to write than a non-tail
recursive definition. Here's an example I came up with within the
limitations of my Forth knowledge: Write recursive and tail recursive
words to naively sum the integers from 1 to the first element on the stack.

: non-tail-recursive-sum dup if dup 1- recurse + then ;

This is not tail recursive because + is called after RECURSE before
leaving the word. It is easy to understand because of the recursion:
If the TOS is non-zero, add the TOS to the return value of
non-tail-recursive-sum with input one less than the original TOS.
Show full article (2.57Kb)
no comments
Re: using MISC (post 1987 Forth hardware) opcodes         


Author: j2thomas
Date: Jul 22, 2006 08:36

George Hubert wrote:
> There is still one problem; TO also has to work with locals as well so
>>BODY would have to return the address of the data associated with the local which
> would be in the local (or return) stack when the xt is a local and not the address of it's
> data area (which probably contains the offset into the local stack) so it would be difficult
> implementing TO using >BODY and ! (unless the Forth doesn't implement locals).

You're right.

So the problem with TO is using the same name for locals and for
nonlocal VALUEs. And that makes a problem for standardising VALUE .

Common practice. Hard to standardise. There are Forths that provide
both behaviors, but it was hard to require Forths to provide both
behaviors.
no comments
Classifying Forth         


Author: j2thomas
Date: Jul 26, 2006 05:03

Ed wrote:
> IMO, the Forth Standard ought to describe a self-consistent (if only virtual)
> Forth model. Otherwise, it becomes a "grab bag" of contradictory ideas that
> somehow have to be glued together.

Since the ANS process required wide agreement, it couldn't help but be
a grab bag. It was only through great effort that it became as
consistent as it did.
> An example of the latter fractured approach was vocabularies. The 'solution'
> to the diverse implementations of VOCABULARY was to have a search-order
> toolkit. But this was so messy that applications rarely bothered. The result
> is that most forths go on to implement the ONLY ALSO extension words
> (thereby making it the defacto). One wonders whether it would have been
> better to have the 'extension' wordset as the core and relegate the toolkit
> words to the 'extentions' (or just forget them altogether :)

They couldn't agree on ONLY ALSO . By putting that into an optional
extension they standardised its usage without forcing it on people who
didn't want it. And if you come up with something better you can
implement it in ANS Forth and give it away with your applications.
Show full article (10.25Kb)
no comments