% OLdProgMacros.tex of January 9, 1984 4:59 pm --- Stolfi % Old macros for programs (removed from BasicMacros.tex of Dec. 83) % Uses counters 3 (to compute useful width), 5 (current nesting % level), and 4 (loop variable to count bars) % Parameters to be defined by user (in pt unless stated otherwise): % \progwidth = line width for program text % PROGRAMS % Displayed programs and fragments % Usage: % {\prog % WHILE foo DO % X\pgets 0; % X\pgets X + 1; % ... % ENDLOOP % \endprog} % % NOTES: % 1. THE BRACES AROUND \prog...\endprog ARE ESSENTIAL! % 2. Programs are typeset in fixed-pitch font. % 3. Blanks are significant % 4. Carriage returns ( in example) are defined as \par, % so that the program is printed exactly as you type it. % Carriage returns are required after \prog and before \endprog. % 5. To get back to normal text mode inside a \prog, use . % 6. Comments in standard format are obtained by \pcomm{text} \def\prog{\par\vskip1.0ex plus0.5ex\penalty-500 \parskip 0 pt \hsize\progwidth pt \chcode'40_13\chcode'15_13\def\ {\par}\fx{}} \def\endprog{\par\vskip1.0ex plus0.5ex\hsize\textwidth pt\penalty-600} \def\pgets{$\gets$} % assignment arrow in progs % Comments in programs % Use \pcomm{Blah Blah} for standard comments (delimited by braces). % In general, use {\prm Blah blah} to get normal text inside a \prog. \def\prm{\chcode'40_10\chcode'15_5\rm } % to get roman font in progs \def\pcomm{\hbox{$\{$} \chcode'40_10\chcode'15_5\pcommaux} \def\pcommaux#1{{\rm #1}\chcode'40_13\chcode'15_13\ \hbox{$\}$}} % Program fragments in text mode. % Usage:$\prg{x\pgets x + 1}$ \def\prg#1{\hbox{\fx #1}} Κ―– "tex" style˜šœ;˜;JšœD˜DJšœr˜ršœD˜DJšœ,˜,——šœ ˜ šœ#˜#Jšœl˜lJšœΛ˜ΛJšœΛ˜ΛJšœ7˜7—šœ˜Jšœ˜JšœΑ˜Α—šœ"˜"Jšœ˜Jšœ˜——J˜—…— U