stevev@greylady.uoregon.edu (Steve VanDevender) (03/27/91)
I picked up the ten-line stack display program 'STKV' last night,
and I liked it but for a few small bugs. One is that since list
concatenation takes precedence over string concatenation, a list
on the stack would appear as:
{ 1 ": " foo bar baz }
instead of
1: { foo bar baz }
The other potential bug was that the program assumed you have a
131 x 64 PICT, so if your PICT was larger, it would write into
the upper left of a larger PICT but display the PICT centered.
It was also not nearly as tightly written as it could be, so here
is my improved version of STKV:
STKV: checksum #22013d, 172.5 bytes
%%HP: T(3)A(D)F(.);
\<<
IF DEPTH @ if anything's on the stack
THEN PICT RCL @ recall the current PICT GROB
PICT PURGE @ purge the PICT; a new 131x64 PICT will be created
1 DEPTH 2 - 10 MIN @ view up to 10 levels or as many as there are if less
FOR j
PICT #0d @ push PICT and x-coordinate of display line
#60d j #6d * - @ calculate y coordinate of stack line
2 \->LIST @ and put coordinates in list
j ": " OVER @ get j and the string it will be added to, copy j
5 + PICK \->STR @ get stack object in level j and convert to a string
+ + @ concatenate j, ": ", string of level j
1 \->GROB @ make into a GROB with smallest font
REPL @ place in PICT
NEXT
{ } PVIEW @ display PICT in scrolling mode (but it won't scroll)
PICT STO @ restore old PICT
END
\>>
--
Steve VanDevender stevev@greylady.uoregon.edu
"Bipedalism--an unrecognized disease affecting over 99% of the population.
Symptoms include lack of traffic sense, slow rate of travel, and the
classic, easily recognized behavior known as walking."ahernsd@mentor.cc.purdue.edu (Dynastar) (03/28/91)
A possible bug I may have found in this program is when it displays a
program. The last character before the >> is a solid character.
In other words, it displays
1: << X COS_>> where _ is a solid character
rather than
1: << X COS >>
I assume this block is a carriage return, but I don't know how
to fix this error. Any ideas?
--
Sean Ahern ----------- Purdue University --------- ahernsd@mentor.cc.purdue.edu
Dan Quayle: "Japan is an important ally of ours. Japan and the United States
of the Western industrialized capacity, 60 percent of the GNP,
:-) two countries. That's a statement in and of itself."stevev@greylady.uoregon.edu (Steve VanDevender) (03/30/91)
I assume that this is because \->STR converts an object to appear as it would in the editor, so there is a block after each program open quote and one before each program close quote. Anyone know a SYSEVAL that converts an object to its compact stack display? -- Steve VanDevender stevev@greylady.uoregon.edu "Bipedalism--an unrecognized disease affecting over 99% of the population. Symptoms include lack of traffic sense, slow rate of travel, and the classic, easily recognized behavior known as walking."
bson@rice-chex.ai.mit.edu (Jan Brittenson) (03/31/91)
In a posting of [30 Mar 91 01:15:15 GMT] stevev@greylady.uoregon.edu (Steve VanDevender) writes: > Anyone know a SYSEVAL that converts an object to its compact stack > display? You may find the following addresses useful: #1596e Converts object and index to stack display string Expects: 3: index.sysbin (stack level index) 2: object (any object) 1: maxlen.sysbin (maximum string size - 1) #15955 Same, but uses maxlen = 19 decimal (i.e. 20 chars) Expects: 2: index.sysbin 1: object.any For example: :&:5 EVAL @ Index <5> << 1 2 3 << 4 5 6 >> 7 8 >> @ Object #15955h SYSEVAL --> "5: << 1 2 3 << 4 5 6 >> 7 " The program delimiters and the ellipsis are of course only one character each. -- Jan Brittenson bson@ai.mit.edu