% 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 (<cr> 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�\chcode'15�\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�\chcode'15𡤅\rm } % to get roman font in progs
\def\pcomm{\hbox{$\{$} \chcode'40�\chcode'15𡤅\pcommaux}
\def\pcommaux#1{{\rm #1}\chcode'40�\chcode'15�\ \hbox{$\}$}}
% Program fragments in text mode.
% Usage:$\prg{x\pgets x + 1}$
\def\prg#1{\hbox{\fx #1}}