Re: Fouth

new topic     » goto parent     » topic index » view thread      » older message » newer message

I think I mentioned this some time ago: PostScript is typically a
forth-type language, it uses a stack, dictionnaries, reverse polnish
notation;
you can define your own procedures, handle files and user input.
You can run a PostScript program with the GhostScript shell (free), or
send it to a printer (and the printer's cpu does the processing)
A little example:

----------------------------------------------------------------------------
----------------
%!
/mt {moveto} def
/lt {lineto} def
/rl {rlineto} def
/rm {rmoveto} def
/mm { 2.835 mul } def
/s {show} def
% FONT DEFINITIONS
/Helvetica findfont /H0 exch def
/Helvetica findfont 9 scalefont /H9 exch def
/Helvetica findfont 10 scalefont /H10 exch def
/Helvetica findfont 11 scalefont /H11 exch def
/Helvetica findfont 12 scalefont /H12 exch def
/Helvetica findfont 25 scalefont /H25 exch def
/Helvetica-Bold findfont 12 scalefont /HB12 exch def
/Helvetica-BoldOblique findfont 12 scalefont /HBO12 exch def
/Helvetica-Oblique findfont 12 scalefont /HO12 exch def

% this procedure writes a centered string, and adapts the character's width
% usage : width  x y (texte) centersize
/centersize {
/texte exch def
/y exch def
/x exch def
/w exch def
H12 setfont
texte stringwidth pop dup
w mm gt
{ w mm exch div 12 mul
/largeur_fonte exch def
H0 findfont [ largeur_fonte 0 0 12 0 0 ] makefont setfont
texte stringwidth pop 2 div
x mm exch sub y mm mt texte s
}{
2 div x mm exch sub y mm mt texte s
} ifelse
} def

% ------------------------------------
% usage :  x y (texte) locate
/locate {
/texte exch def
/y exch def
/x exch def
x mm y mm mt
texte s
} def
% -----------------------------------------

0 setgray
50 mm 30 mm 30 mm (Hello Euphorians!) centersize

showpage

 ------ end of example ---------------
of course, it's used essentially for PostScript printers, but you could do
much more of it. After all, Sun used a postScript based system called xnews
for its Sun 3 stations.
if someone is interested, I can bring him more information...
Riwal Raude
rauder at thmulti.com
 ----------
From: Bernie Ryan
To: EUPHORIA at LISTSERV.MUOHIO.EDU
Subject: Re: Fouth
Date: Tuesday 16 March 1999 20:02

David
     Has anyone ever written a Forth like language that was extendable
     like Forth but didn't use such criptic syntax?
Bernie

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu