Can I use string arrays? 
Author Message
 Can I use string arrays?

: Hi!
: I am new in postscript programming, and right now I came to a problem I
: cannot solve.
: I would like to use a two dimensional array of strings, but with no
: success.

While PostScript does not have support for multi-dimensional arrays, there
are interesting ways to link arrays, see Glenn C. Reid, _Thinking in
PostScript_ (Addison-Wesley, 1990), Chapter 12. As noted in Adobe's
_PostScript Language Reference Manual, 2nd Edition_ (Addison-Wesley,
1990), p. 38:

"The PostScript language directly supports only one-dimensional arrays.
Arrays of higher dimension may be constructed by using arrays as elements
of arrays, nested to any arbitrary depth."

: I can use an array of integers, and I can use strings, but I can't
: get the two work together, and I haven't find any reference.

May I recommend the two books mentioned above, and also _Real World
PostScript_, a nice anthology edited by Stephen F. Roth (Addison-Wesley
1988). There are also some example programs from the Adobe series of
manuals available on the Internet -- search PostScript -- some of which
involve arrays.

Please note that PostScript arrays are heterogenous: they may include
various types of objects, including integers, reals, strings, arrays, and
executable arrays (procedures):

[ (my text) 12 { 100 200 moveto } [ 200 1.24 1988 128 sqrt ] ]

: Can it be done?

Here it might be helpful to know more about a specific programming problem
or context that you would like to address. For example, it's common to use
an array of executable arrays (procedures) for certain kinds of
contingency situations.

This is the main use I've made of such nested arrays, and I'd be glad to
provide examples via e-mail. Others may have been more adventurous, and
Glenn Reid has interesting examples of linked arrays in the _Thinking
About PostScript_ book mentioned above.

Most respectfully,

Margo Schulter

(Please remove the extra . in my default address)

Tue, 09 Nov 1999 03:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Using string(literals) as key in associative arrays

2. BinaryRead - howto convert binary string back to string array

3. byte array to string

4. Save string array to a local file

5. Problem reading image data into an array of strings

6. Arrays, string indices ... and more

7. Returning Array of Strings from COM to JScript

8. Passing Array of string to component

9. Strings as array ??

10. Passing array of strings from ASP (JScript) to ATL COM

11. populating a multi-dimentional array with a string of characters

12. jScript Array and strings.


Powered by phpBB® Forum Software