1
0

grabit 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. POSTLIB=/sys/lib/postscript/prologues
  7. PROLOGUE=$POSTLIB/grabit.ps
  8. COPYFILE=
  9. RECURSIVE=true
  10. OMITNAMES='/Grabit /GrabitDict'
  11. NONCONFORMING='%!PS'
  12. ENDPROLOG='%%EndProlog'
  13. BEGINSETUP='%%BeginSetup'
  14. ENDSETUP='%%EndSetup'
  15. TRAILER='%%Trailer'
  16. SETUP=GrabitSetup
  17. while (! ~ $#* 0 && ~ $1 -*) {
  18. switch ($1) {
  19. case -d; RECURSIVE=false
  20. case -o; shift; OMITNAMES=$OMITNAMES' '$1
  21. case -o*; OMITNAMES=$OMITNAMES' '`{echo $1 | sed s/-o//}
  22. case -C; shift; COPYFILE=$COPYFILE' '$1
  23. case -C*; COPYFILE=$COPYFILE' '`{echo $1 | sed s/-C//}
  24. case -L; shift; PROLOGUE=$1
  25. case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
  26. case --;
  27. case -*; echo $0: illegal option $1 >[1=2]; exit 1
  28. }
  29. shift
  30. done
  31. echo $NONCONFORMING
  32. cat $PROLOGUE
  33. echo $ENDPROLOG
  34. echo $BEGINSETUP
  35. if (~ $COPYFILE '') COPYFILE=/dev/null
  36. cat $COPYFILE
  37. echo 'GrabitDict begin'
  38. echo '/recursive '$RECURSIVE' def'
  39. echo mark
  40. for (i in $OMITNAMES) {
  41. switch ($i) {
  42. case /*; echo $i
  43. case ?*; echo /$i
  44. }
  45. }
  46. echo GrabitSetup
  47. echo end
  48. echo $ENDSETUP
  49. for (i) echo $i Grabit