xref: /plan9/sys/src/cmd/postscript/grabit/grabit.rc (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1#!/bin/rc
2# Print a listing of an object, often a dictionary or an array. Something
3# like ==, but the output is often easier to read and closer to PostScript
4# that can be sent back through the interpreter.
5#
6
7POSTLIB=/sys/lib/postscript/prologues
8PROLOGUE=$POSTLIB/grabit.ps
9
10COPYFILE=
11RECURSIVE=true
12OMITNAMES='/Grabit /GrabitDict'
13
14NONCONFORMING='%!PS'
15ENDPROLOG='%%EndProlog'
16BEGINSETUP='%%BeginSetup'
17ENDSETUP='%%EndSetup'
18TRAILER='%%Trailer'
19
20SETUP=GrabitSetup
21
22while (! ~ $#* 0 && ~ $1 -*) {
23	switch ($1) {
24	case -d;  RECURSIVE=false
25
26	case -o;  shift; OMITNAMES=$OMITNAMES' '$1
27	case -o*; OMITNAMES=$OMITNAMES' '`{echo $1 | sed s/-o//}
28
29	case -C;  shift; COPYFILE=$COPYFILE' '$1
30	case -C*; COPYFILE=$COPYFILE' '`{echo $1 | sed s/-C//}
31
32	case -L;  shift; PROLOGUE=$1
33	case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
34
35	case --;
36
37	case -*;  echo $0: illegal option $1 >[1=2]; exit 1
38    }
39    shift
40done
41
42echo $NONCONFORMING
43cat $PROLOGUE
44echo $ENDPROLOG
45echo $BEGINSETUP
46if (~ $COPYFILE '') COPYFILE=/dev/null
47cat $COPYFILE
48echo 'GrabitDict begin'
49echo '/recursive '$RECURSIVE' def'
50
51echo mark
52for (i in $OMITNAMES) {
53	switch ($i) {
54	case /*; echo $i
55	case ?*; echo /$i
56	}
57}
58echo GrabitSetup
59
60echo end
61echo $ENDSETUP
62
63for (i) echo $i Grabit
64
65