Q:Which free forth? 
Author Message
 Q:Which free forth?

Which free forths can make standalone applications?
Thanks.

    Damir



Wed, 17 Mar 2004 04:47:15 GMT  
 Q:Which free forth?

Quote:

> Which free forths can make standalone applications?
> Thanks.

>     Damir

Well, any Forth that can write to a file can make standalone
applications, possibly with some work.  "standalone application"
is overloaded, but I'll assume that you mean a file in the
favorite executable format of your operating system.  So you
want a hosted Forth, and I'll assume that you also don't want
to learn lots of nitty things like the actual format of such
executables and the your system's machine code.  There are
several Forths that can do this for you.  They are

  1) Quartus Forth for PalmOS, and
  2) a number of C-library-type Forths.  www.forth.org links
     to these.

An alternate (and more literal) interpretation of your question
would make Enth an option, see pringle.sphosting.com/index.html
The current version doesn't run on any machine I have, but the
older ones are fine.

People ask your question so many times and for I suspect so
many (always unstated -- these people never even bother to
explain their terminology, or give any real information on
what they want!) reasons, that I'm starting to get dubious at
the whole idea.  Why do you want "standalone executables"?
Forth ain't enough for you?  I find that I understand people
who ask this question less an less every year.



Wed, 17 Mar 2004 12:17:23 GMT  
 Q:Which free forth?

Quote:


> > Which free forths can make standalone applications?
> > Thanks.

> >     Damir

> Well, any Forth that can write to a file can make standalone
> applications, possibly with some work.  "standalone application"
> is overloaded, but I'll assume that you mean a file in the
> favorite executable format of your operating system.  So you
> want a hosted Forth, and I'll assume that you also don't want
> to learn lots of nitty things like the actual format of such
> executables and the your system's machine code.  There are
> several Forths that can do this for you.  They are

>   1) Quartus Forth for PalmOS, and
>   2) a number of C-library-type Forths.  www.forth.org links
>      to these.

> An alternate (and more literal) interpretation of your question
> would make Enth an option, see pringle.sphosting.com/index.html
> The current version doesn't run on any machine I have, but the
> older ones are fine.

> People ask your question so many times and for I suspect so
> many (always unstated -- these people never even bother to
> explain their terminology, or give any real information on
> what they want!) reasons, that I'm starting to get dubious at
> the whole idea.  Why do you want "standalone executables"?
> Forth ain't enough for you?  I find that I understand people
> who ask this question less an less every year.

I used to have a pair of DOS programs, ENTAB.COM and DETAB.COM that I
found very useful. One of them is lost, and it I don't find it on an old
disk, I will recreate it the next time I need it, using F-PC or F83 and
make a stand-alone program ENTAB.EXE that I can pass on to others. I'm
puzzled by your puzzlement.

Jerry
--
Engineering is the art of making what you want from things you can get.
-----------------------------------------------------------------------



Fri, 19 Mar 2004 00:50:06 GMT  
 Q:Which free forth?

Quote:
> I used to have a pair of DOS programs, ENTAB.COM and DETAB.COM that I
> found very useful. One of them is lost, and it I don't find it on an old
> disk, I will recreate it the next time I need it, using F-PC or F83 and
> make a stand-alone program ENTAB.EXE that I can pass on to others.

0 [IF] =================================================================

DETAB and ENTAB have simple logic, and programming them should be
left as an exercise.

DETAB is more useful.  Here is a tidier version than the one in
http://home.earthlink.net/~neilbawd/. It uses functions from the
"How to read a file" tutorial.

I have DETAB as a line filter, but you may want it as a sponge if
you don't support line filters.

TRIM discards trailing white space.

----------------------------------------------------------------- [THEN]

    9 CONSTANT TAB-CHAR

    4 VALUE #Tab-Spaces

    VARIABLE OUT

    : .DETAB  ( str len -- )
        0 OUT !
        BOUNDS ?DO                             ( )


                    dup SPACES
                    OUT +!                     ( )
            ELSE

                1 OUT +!
            THEN
        LOOP ;

    : DETAB   ( filename . -- )
        OPEN-INPUT          ( )
        TRAVERSE-INPUT  TRIM  .DETAB CR  REPEAT
        CLOSE-INPUT ;

(
--  

)



Fri, 19 Mar 2004 06:38:30 GMT  
 Q:Which free forth?

Quote:

>I have DETAB as a line filter, but you may want it as a sponge if
>you don't support line filters.

I assume line filters are the way people work in Unix shells, i.e.
"piping", but what's a "sponge"?

--
        Bart.



Fri, 19 Mar 2004 07:39:01 GMT  
 Q:Which free forth?

Quote:


> >I have DETAB as a line filter, but you may want it as a sponge if
> >you don't support line filters.

> I assume line filters are the way people work in Unix shells, i.e.
> "piping", but what's a "sponge"?

> --
>         Bart.

That would have been my question, too. Also, my ENTAB and DETAB take a
number from the command line that describes the space equivalence of a
tab. Piping through, I can go from a TAB8 file to a TAB4 file, etc.

Jerry
--
Engineering is the art of making what you want from things you can get.
-----------------------------------------------------------------------



Fri, 19 Mar 2004 07:57:48 GMT  
 Q:Which free forth?

Quote:


>>> I have DETAB as a line filter, but you may want it as a sponge if
>>> you don't support line filters.

>> I assume line filters are the way people work in Unix shells, i.e.
>> "piping", but what's a "sponge"?

>> --
>> Bart.

> That would have been my question, too. Also, my ENTAB and DETAB take a
> number from the command line that describes the space equivalence of a
> tab. Piping through, I can go from a TAB8 file to a TAB4 file, etc.

> Jerry

From JARGON File

  sponge
     n. [Unix] A special case of a filter that reads its entire input
     before writing any output; the canonical example is a sort utility.
     Unlike most filters, a sponge can conveniently overwrite the input
     file with the output data stream....

  slurp
     vt. To read a large data file entirely into core before working on it.
     This may be contrasted with the strategy of reading a small piece at a
     time, processing it, and then reading the next piece. "This program
     slurps in a 1K-by-1K matrix and does an FFT."

A sponge can be written using SLURP with output redirection.

SPONGE????????????? ( "file-name" -- src length file-id )
   Slurp file-name, delete file-name, and create file-name for output
   redirection.

For an example of a sponge, see DETAB.

SLURP?????????????? ( file-id -- addr length )
   Read all of the file into allocated memory. Return address and length.
   When memory is no longer needed, you must BURP.

BURP??????????????? ( -- )
   Free the memory allocated by SLURP.

Please see: http://home.earthlink.net/~neilbawd/

There are pages on Output redirection and SPONGE, SLURP, Line Filters,
Line Filter Examples.  (Line Filters and Line Filter Examples are being
simplified this year.)

A line filter is a filter that works on lines.  Almost all my
applications are line filters. The definition of line filter is not
portable, but I think could be implemented with knowledge of Editor/
Forth clipboard. I think that emacs could come close enough.

With a line filter I select a section of text in an editor window,
copy it to the clipboard, and then execute the line filter.  Output
goes into the editor window.

My line filter for DETAB is DT and the new form of definition is:

    : DT   2 BACKSPACES
        LINE-FILTER  TRIM  .DETAB CR  REPEAT ;

The formatting in my writing is done with line filters.

With the exception of LINE-FILTER, all my Forth work is Standard
(ANS) Forth.

(
--  

)



Fri, 19 Mar 2004 09:33:14 GMT  
 Q:Which free forth?


Quote:
>SPONGE????????????? ( "file-name" -- src length file-id )
>   Slurp file-name, delete file-name, and create file-name for output
>   redirection.

So when you run out of disk space, you lose the input?  Ouch.

Quote:
>SLURP?????????????? ( file-id -- addr length )
>   Read all of the file into allocated memory. Return address and length.
>   When memory is no longer needed, you must BURP.

this is called SLURP-FID in the current development version of Gforth.
Maybe I will rename it into SLURP.

Quote:
>BURP??????????????? ( -- )
>   Free the memory allocated by SLURP.

What about multiple SLURPs?  With SLURP-FID, FREE works; however, I
guess a special deallocator would be helpful if we ever implemented
SLURP-FID using mmap.

- anton
--
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html



Tue, 23 Mar 2004 22:14:43 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. several Qs

2. Qs on CLUBMGR, Template BUG ???

3. Qs

4. Qs about language nomenclature

5. New newbies Qs on Ruby

6. Newbie Qs: startup time, Module.constants, chdir, Ruby distro's library

7. Qs on Ruby and DbC/Smalltalk

8. 2 Qs: IndexedFaceSets & browsers

9. Qs re 'Write & 'Read

10. newbie obj files Qs

11. NASM Qs

12. Newbie Pmode Qs

 

 
Powered by phpBB® Forum Software