Would PS make a good microcontroller language? 
Author Message
 Would PS make a good microcontroller language?

I'm interested in languages for embedded applications and
microcontrollers.  I'm somewhat familiar with both FORTH and
postscript.   While FORTH is the obvious choice for a small language to
be embedded in the ROMs of a microcontrolled project, I really like the
PS syntax and its abstractions.  I've been wondering if it could be
adapted for microcontrolled applications.

Of course, I'm not talking about a full-blown PostScript
implementation.  What if we could strip out all of the graphics-
oriented aspects of PS and just use a minimal systemdict -- that is, a
dictionary consisting only of the "reserved" words and a few other useful
procedures.

If this is actually feasible, it brings up some other questions:

Can we come up with a list of what would be considered the "reserved"
or "minimal" words?

FORTH has explicit "compile" and "interpret" modes, whereas the Red
Book makes no mention of such states.  Does PS ever dynamically compile
the code it executes as FORTH does?

How small is the PS interpreter kernel?

How does the implementation of PS differ from other stack-based
languages?  Will I be able to locate any references on the
implementation?  (Or is this what I'll have to pay Adobe big bucks
for?)

Is the PostScript _langauge_ itself copyrighted or patented?  I don't
think so, but I could be wrong.

Thanks for any insight you can give.

--

Sacramento Network Access
System Administrator/Technical Support/Engineering
Home page: http://www.*-*-*.com/



Mon, 09 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

: I'm interested in languages for embedded applications and
: microcontrollers.  I'm somewhat familiar with both FORTH and
: PostScript.   While FORTH is the obvious choice for a small language to
: be embedded in the ROMs of a microcontrolled project, I really like the
: PS syntax and its abstractions.  I've been wondering if it could be
: adapted for microcontrolled applications.

I've been thinking the same thing. As soon as I feel comfortable with
FORTH, I'm going to write a "postFORTH" containing elements of both
languages.

: FORTH has explicit "compile" and "interpret" modes, whereas the Red
: Book makes no mention of such states.  Does PS ever dynamically compile
: the code it executes as FORTH does?

How about /inch {72 mul} def vs. : INCH 72 * ;

Or am I misinterpreting the question?

: How small is the PS interpreter kernel?

I would imagine over a meg, maybe 2, in most implementations. But I'm
guessing.

: How does the implementation of PS differ from other stack-based
: languages?  Will I be able to locate any references on the
: implementation?  (Or is this what I'll have to pay Adobe big bucks
: for?)

Implement it as a FORTH. Use an additional cell for each arg to indicate
its type if you want words like cvs to work.

: Is the PostScript _langauge_ itself copyrighted or patented?  I don't
: think so, but I could be wrong.

See section 1.4 of the Red Book for details. And email me if you want to
help out with postFORTH rather than start your own. - John
--

Home page: http://world.std.com/~jcomeau/
Disclaimer: Don't risk anything of value based on my advice.
"Anybody can do the difficult stuff. Call me when it's impossible."



Mon, 09 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

First what a crazy idea.

Postscript is only interpetive, no compiled version. Why would you compile
a printed page.

The GNU has a free version of postscript available called ghostscript its
exe size is like a meg. It is available may places on the net.

Postscript without graphics is like ice tea without ice. The command
language is very limited when not used with graphics But as a bases for a
stack based language it has many good ideas.



Tue, 10 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

: First what a crazy idea.

What a Philistine. I make a living implementing people's crazy ideas.

: Postscript is only interpetive, no compiled version. Why would you compile
: a printed page.

It compiles as it goes along, like FORTH does. You need to understand a
little more about how computers work.

: The GNU has a free version of postscript available called ghostscript its
: exe size is like a meg. It is available may places on the net.

Yes, it's too big and buggy for a microcontroller. Haven't you noticed
all the posts about "GS error 255? HELP!!!" How'd you like your microwave
to show "255" every time you tried to warm up yesterday's pizza?

: Postscript without graphics is like ice tea without ice. The command
: language is very limited when not used with graphics But as a bases for a
: stack based language it has many good ideas.

Now you're talking some sense. Yes, I'll leave some of the graphics
primitives. There may be hope for you yet. 8^) - John
--

Home page: http://world.std.com/~jcomeau/
Disclaimer: Don't risk anything of value based on my advice.
"Anybody can do the difficult stuff. Call me when it's impossible."



Tue, 10 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?


Quote:

> Of course, I'm not talking about a full-blown PostScript
> implementation.  What if we could strip out all of the graphics-
> oriented aspects of PS and just use a minimal systemdict -- that is, a
> dictionary consisting only of the "reserved" words and a few other useful
> procedures.

There is already a version of PostScript out there that is like this.
They have stripped out the graphics stuff and added some features for
transportable software agents.  It might be worth a look.  The WWW address
is <http://www.cs.colorado.edu/~arcadia/Software/tps.html>.

Stuart

===========================================================

Research Interests: agents, information retrieval, reactive planning
"We are being flim-flammed by Bill Gates and his partners.  Look at Windows 95.
That's a lot of flimflam, you know."   Ray Bradbury



Tue, 10 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

When asked to define PostScript, Don Lancaster says that it's a superb
general-purpose computer language which, parenthetically, just happens to
excel at putting marks on a page. :-)

--




Tue, 10 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?


Quote:
>Can we come up with a list of what would be considered the "reserved"
>or "minimal" words?

Many FORTH words are defined in terms of other FORTH words.  It is this
that makes the FORTH kernel small.  In PostScript, this happens very little.  
This makes the ``minimal'' kernel considerably larger, and probably means that
no two people will agree on what minial is....

Also, the save and restore memory model introduces complications that you can
probably do without if you want a small language.

Quote:

>FORTH has explicit "compile" and "interpret" modes, whereas the Red
>Book makes no mention of such states.  Does PS ever dynamically compile
>the code it executes as FORTH does?

The ``bind'' operator gives a hint to the interpreter that the procedure
operand is one that is likely to be executed a number of times.  The
interpreter is free to do whatever it likes to this procedure, so long as the
*visible* results conform to what the PLRM specifies.

Quote:
>How does the implementation of PS differ from other stack-based
>languages?  Will I be able to locate any references on the

If you want a language whose implementation bootstraps from a small kernel,
better stick to FORTH (or even a small Lisp).  If you want a portable
microcontroller langauge that will makes you rich, Java is probably a good bet
at the moment:-).

Implementing a PostScript interpreter for any purpose other than making marks
on paper or film is probably best left as an intellectual exercise.

============================================================================
Ian Kemmish                 18 Durham Close, Biggleswade, Beds SG18 8HZ

Info on Jaws and 5D's other products on http://www.five-d.com/5d
============================================================================
`The customer is King, but the proprietor is God'



Wed, 11 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

Quote:


>>FORTH has explicit "compile" and "interpret" modes, whereas the Red
>>Book makes no mention of such states.  Does PS ever dynamically compile
>>the code it executes as FORTH does?
>The ``bind'' operator gives a hint to the interpreter that the procedure
>operand is one that is likely to be executed a number of times.  The
>interpreter is free to do whatever it likes to this procedure, so long as the
>*visible* results conform to what the PLRM specifies.

bind don't just give a hint. bind replaces executable operators by
their values. This means, you can change any executable operator later
without any effect on the procedure, which bind operated on. There are
lots of cases, where ignoring bind will break PostScript programs.

73, Mario
--

Institut fuer Robotik und Prozessinformatik der TU Braunschweig
Hamburger Strasse 267, 38114 Braunschweig, Germany



Sat, 14 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?


Quote:

>>The ``bind'' operator gives a hint to the interpreter that the procedure
>>operand is one that is likely to be executed a number of times.  The
>>interpreter is free to do whatever it likes to this procedure, so long as
>>the *visible* results conform to what the PLRM specifies.

>bind don't just give a hint. bind replaces executable operators by
>their values. This means, you can change any executable operator later
>without any effect on the procedure, which bind operated on. There are
>lots of cases, where ignoring bind will break PostScript programs.

I think the original poster's point was that, in principle, a
PostScript interpreter could implement `bind' by compiling the given
procedure down to bytecode, native code, or whatever, subject to the
constraints that it still acts the same. The interpreter would have to
perform a normal `bind' as well, so that the bound procedure looked
the same to the PS programs, but if it wanted to, it could invisibly
attach a fast implementation of the procedure to that array object,
and use it instead of the normal execution method when the array was
executed. The only way (other than increased speed) that you could
tell that this was going on would be by looking at the execution stack
from inside a procedure called by the bound procedure, and this too
could be faked, if the implementers thought it worth the trouble (and
speed penalty).

--



Sun, 15 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?


Quote:


>>Can we come up with a list of what would be considered the "reserved"
>>or "minimal" words?

>Many FORTH words are defined in terms of other FORTH words.  It is this
>that makes the FORTH kernel small.  In PostScript, this happens very little.  
>This makes the ``minimal'' kernel considerably larger, and probably means that
>no two people will agree on what minial is....

>Also, the save and restore memory model introduces complications that you can
>probably do without if you want a small language.

The save/restore memory model is a little "goofy" compared with most others;
a mark/release paradigm may have been a little friendlier.

Otherwise, though, PostScript really isn't that bad as a language.  The core
really isn't all THAT big; even operators like "]" or ">>" could be written
fairly easily using
  counttomark, array/dict, for, put, dup, and roll.
[all of which I would suggest are probably "core" functions although the
counttomark operator could be rewritten--slowly--as a function of others],
and "for" could be rewritten using "loop".]

As for implementation speed, PostScript isn't nearly so bad as people often
make it out to be.  The conversion of tokens to names is done only once,
when they are read in, even for non-bound procedures.  For bound procedures,
the system doesn't need to do much to execute a statement--essentially the
main loop could look like this:

  if (current_pc->thingtype == operator)
    current_pc->value->op(currentpc);

--
-------------------------------------------------------------------------------

 John Payson         |   Un animal aussi beau qu'un chat."       |  ( o o )



Sun, 15 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

Hi Folks,

I have some programs generating Postscript with downloadable pixelfonts
within the file. If I try tro print it on Apple laserwriters or if I use
GhostScript every thing works fine. However if I try them on HP-Deskjet
printers (with Postcript capability ) I get the error message :

ERROR:invalidfont
OFFENDING COMMAND:definefont

STACK:

What can be the problem with the following file?

%!PS-Adobe-2.0
%%Pages: (attend)
%%EndComments
%%Page:      1     1
save
/lt {lineto} def /mt {moveto} def /rm {rmoveto} def 0.1 0.1 scale 0 7300 mt
/saveset save def
 saveset restore  %         100    0%

/newfont 255 dict def newfont begin /FontType 3 def
/FontMatrix [2.4 0 0 2.4 0 0] def
/Encoding 256 array def 0 1 255 {Encoding exch {25 0 setcharwidth} put} for
Encoding 33 {25 0  setcharwidth 0 -2 translate 16 28 scale
16 28 true [16 0 0 -28 0 28]
{<001C003E003E003E003E003E003E003E001C003E001C001C001C001C001C001C001C00
1C001C0008000000000000001C003E003E003E001C>} imagemask} put
 /BuildChar {exch begin Encoding exch get end exec} def end
/font0 newfont definefont pop

/saveset save def 0 7300 mt

saveset restore /font0 findfont setfont /saveset save def
gsave 1061 3580 translate 4320 3600 scale
showpage

Thanks in advance
      Jouk Jansen
--

Quote:
>------------------------------------------------------------------------------<

  Jouk Jansen


  Universiteit van Amsterdam            uu     uu  vv        vv      aa
  Laboratorium voor Kristallografie     uu     uu   vv      vv      aaaa
  Nieuwe Achtergracht 166               uu     uu    vv    vv      aa  aa
  1018 WV Amsterdam                     uu     uu     vv  vv      aaaaaaaa
  Nederland                             uuuuuuuuu      vvvv      aaaaaaaaaa
  tel. 31-20-5257041                     uuuuuuu        vv      aa        aa

  Technische Universiteit Delft        tttttttttt  uu     uu  ddddddd
  Nationaal centrum voor HREM          tttttttttt  uu     uu  dd    dd
  Rotterdamseweg 137                       tt      uu     uu  dd     dd
  2628 AL Delft                            tt      uu     uu  dd     dd
  Nederland                                tt      uu     uu  dd    dd
  tel. 31-15-2781536                       tt       uuuuuuu   ddddddd

Quote:
>--------------



Fri, 20 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?


Quote:

>Hi Folks,

>I have some programs generating Postscript with downloadable pixelfonts
>within the file. If I try tro print it on Apple laserwriters or if I use
>GhostScript every thing works fine. However if I try them on HP-Deskjet
>printers (with Postcript capability ) I get the error message :

>ERROR:invalidfont
>OFFENDING COMMAND:definefont

>/Encoding 256 array def 0 1 255 {Encoding exch {25 0 setcharwidth} put} for
>Encoding 33 {25 0  setcharwidth 0 -2 translate 16 28 scale
>16 28 true [16 0 0 -28 0 28]
>{<001C003E003E003E003E003E003E003E001C003E001C001C001C001C001C001C001C00
>1C001C0008000000000000001C003E003E003E001C>} imagemask} put
> /BuildChar {exch begin Encoding exch get end exec} def end

Strictly speaking, this font has an invalid Encoding array.  Now, type 3 fonts
that have BuildChar but no BuildGlyph don't really need an encoding array,
which explains why it might work on some implementations.  However, other
implementations (including Adobe's newest versions) do more strict type
checking at definefont time rather than waiting for the font to fall over
later.  On such an implementation, *any* font that includes an Encoding array
will probably get slung out if not all of the elements of Encoding are names.

The ideologically sound way to build a type 3 font, is to have Encoding map
character codes to glyph names, and have a dictionary called CharProcs that
maps glyph names to procedures that buid the glyphs.

============================================================================
Ian Kemmish                 18 Durham Close, Biggleswade, Beds SG18 8HZ

Info on Jaws and 5D's other products on http://www.five-d.com/5d
============================================================================
`The customer is King, but the proprietor is God'



Fri, 20 Nov 1998 03:00:00 GMT  
 Would PS make a good microcontroller language?

Quote:

>Hi Folks,
>I have some programs generating Postscript with downloadable pixelfonts
>within the file. If I try tro print it on Apple laserwriters or if I use
>GhostScript every thing works fine. However if I try them on HP-Deskjet
>printers (with Postcript capability ) I get the error message :
>ERROR:invalidfont
>OFFENDING COMMAND:definefont

I ran this through PSAlter, which is designed to be picky, and it
said:

Error name: invalidfont; Offending command: --definefont--

Font dictionary is missing a required key - /FontBBox

A number of entries are compulsory in a dictionary which is to be used
as a font. Which keys are compulsory depends on FontType. Key
/FontBBox was missing.

----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  



Sat, 21 Nov 1998 03:00:00 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. This language makes no sense!

2. Best language?

3. RTL-the better Language for HP750C?

4. Best tools/language for internet database? Advice please

5. best scripting language for server related tasks ??

6. Suggestions on a good VB Language reference??

7. PS/PCL language switching with HP 33439Q PS cartridge

8. WSH that makes a url file Makes BlueDragon.url

9. Splitting an already made PS documents in even and odd pages

10. Making EPSs of PS sources?

11. What makes small PS files?

12. Acrobat 3 makes different PS?

 

 
Powered by phpBB® Forum Software