HP3000-L Archives

August 2002, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Wirt Atmar <[log in to unmask]>
Reply To:
Date:
Thu, 15 Aug 2002 15:23:52 EDT
Content-Type:
text/plain
Parts/Attachments:
text/plain (87 lines)
Jeff writes:

> As I wrote above, the CI does not know the command is a comment
>  command until it has resolved variables (well, at least until
>  it resolves the command name token).  I use the above construct
>  fairly effectively as a way to add tracing/debugging info to a
>  script without lots of IF statements.
>
>  But, then, I have a bias as it's my design... ;-)

We have virtually the same design as the CI in QueryCalc (and we put it in
before the CI scripting material even existed), although we call it the
"QueryCalc macro language". A sample is the following:

   490     >***********************
   500     > label maker routine
   510     >***********************
   520   label:
   530     %row=%currow
   540     %col=%curcol
   550     %pag=%curpag
   560     /rep ac8
   570     %row=%row+1
   580     if $ac9<>$"" then do
   590       /rep ac9
   600       %row=%row+1
   610     doend
   620     if $ac10<>$"" then do
   630       /rep ac10
   640       %row=%row+1
   650     doend
   660     if $ac11<>$"" then do
   670       /rep ac11
   680       %row=%row+1
   690     doend
   700     /rep ac15
   710     %row=%row+2
   720     /rep ac18
   730     > if $ac16=$"CA" then do
   740     >   /rep ac17
   750     > doend
   760     %currow=%currow+20
   770     if %currow>60 then do
   780       %currow=11
   790       %curcol=%curcol+11
   800       if %curcol>20 then do
   810         %currow=11
   820         %curcol=4
   821         /printer phaser 850dp
   830         /print i s
   840         /clr i
   850         /rep e>i
   860       doend
   870     doend
   880     goto loop
   890   exit:

Just a bit of explanation: lines that begin with ">" are comments. Values
that have a percent symbol attached are macrovariables (e.g., "%row"). And
lines that have "*+1R+2C" are relative cell addresses, beginning from
wherever the cursor is currently (The "*" means current cursor location).

When we scan a line, we do it in this fashion, which I will argue is the only
appropriate fashion for this kind of thing:

    1. If line begins with comment symbol, skip to next line immediately.

    2. Line is scanned for "%" symbols. If found, and the macrovariable is
determined to be legitimate, the macrovariable is excised and its value
substituted into the line.

    3. Line is scanned for "*" symbols. If found, and the relative cell
address is determined to be legitimate, the row, page, column address is made
real and substituted into the line.

    4. The line is then handed off to QueryCalc's command interpreter, just
as if the user had typed the substituted (if any) line in by hand.

I don't think any other sequence of variable substitutions will work. Most
especially important is that lines 730-750 above are never interpreted, even
though they're legitimate commands.

Wirt Atmar

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2