2 /* builds a PostScript file from mpsl_quickref.txt */
3 /* (C) Angel Ortega 2006 - GPL */
5 print("%!PS-Adobe-1.0\n",
6 "%%BoundingBox: 0 0 594 841\n",
7 "%%Orientation: Landscape\n",
16 "/qr_colw { 280 } def\n",
17 "/qr_tabsep { 130 } def\n",
18 "/qr_rmarg { 12 } def\n",
19 "/qr_tmarg { -20 } def\n",
20 "/qr_maxy { -580 } def\n",
21 "/qr_maxx { 600 } def\n",
22 "/qr_fsize { 10 } def\n",
24 "/qr_prop { /Courier findfont qr_fsize 1 sub scalefont setfont } def\n",
25 "/qr_noprop { /Times-Roman findfont qr_fsize scalefont setfont } def\n",
26 "/qr_bold { /Times-Bold findfont qr_fsize scalefont setfont } def\n",
27 "/qr_page { 90 rotate /qr_xpos qr_rmarg def /qr_ypos qr_tmarg def } def\n",
30 " /qr_ypos qr_ypos qr_fsize sub def\n",
31 " qr_ypos qr_maxy lt { /qr_ypos qr_tmarg def\n",
32 " /qr_xpos qr_xpos qr_colw add def\n",
33 " qr_xpos qr_maxx gt { /qr_xpos qr_rmarg def } if\n",
38 " exch qr_xpos qr_ypos moveto qr_prop show\n",
39 " qr_xpos qr_tabsep add qr_ypos moveto qr_noprop show\n",
44 " qr_xpos qr_ypos moveto qr_bold show\n",
51 print("%%Page: 1 1\n",
61 while (line = read(STDIN)) {
65 line = sregex(line, "/\n$/", NULL);
68 line = sregex(line, "/\\\\/g", '\\');
69 line = sregex(line, "/\(/g", '\(');
70 line = sregex(line, "/\)/g", '\)');
72 /* leading asterisk? it's a title */
73 if ((l = regex([ "/^\*/", "/.*$/" ], line)) && size(l) == 2)
74 print("(", l[1], ") qr_title\n");
76 /* text-tabs-text: two columns */
77 if ((l = regex([ "/^[^\t]*/", "/\t+/", "/.*$/" ], line)) && size(l) == 3)
78 print("(", l[0], ") (", l[2], ") qr_2cols\n");
80 /* other: two columns, with empty second one */
81 print("(", line, ") () qr_2cols\n");
85 if (n_lines > 170) { /* 64 * 3 */
90 "%%Page: ", n_pag, " ", n_pag, "\n",
104 "%%Pages: ", n_pag, "\n",