summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/plweb/pl.sty
blob: 8062ef34257c5c272e4a21d177717e412e3deea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
%%
%% This is file `pl.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pl.dtx  (with options: `pl')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from pl.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file pl.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\def\filename{pl.doc}
\def\fileversion{3.0}
\def\filedate{1996/05/30}
\def\docversion{2.5}
\def\docdate{1995/11/28}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
   Prolog Documentation in LaTeX. Version \fileversion\@spaces gene \filedate
%%
%% Purpose:
%%   Style option for LaTeX to provide routines to document Prolog programs.
%%
%% Documentation: see seperate LaTeX document `pl.tex'
%%
%% Author: Gerd Neugebauer
%%         Mainzer Str. 8
%%         56321 Rhens (Germany)
%% Mail:   gerd@informatik.uni-koblenz.de
%%
%% Copyright (C) 1995-1996 Gerd Neugebauer
%%
%%  pl.doc is distributed in the hope  that it will  be useful, but WITHOUT
%%  ANY WARRANTY.    No author or   distributor accepts  responsibility  to
%%  anyone for the  consequences of using  it or for  whether it serves any
%%  particular purpose or works at all, unless he says so in writing.
%%
%%  Everyone is granted permission to copy, modify and redistribute pl.doc,
%%  provided this copyright notice  is preserved and any modifications  are
%%  indicated.
%%
%%
%%  This  style is still under  development and may  be replaced with a new
%%  version  which  provides an enhanced   functionality.  Any comments are
%%  welcome but don't expect ANY help from my side.
%%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ifx\documentclass\relax \else
  \ProvidesPackage{pl}[\filedate\space gene (\fileversion)]
\fi
\def\PrologFont{\small\tt}
\def\PrologIndent{2em}
\def\PrologNumberFont{\tiny\rm}
\def\PrologRuleWidth{0pt}
\def\PrologListFont{\small\tt}
\def\PrologListIndent{2em}
\def\PrologModule#1#2{\section{The Module {\tt #1}}}
\def\PrologFile#1#2{\section{The File {\tt #1}}}
\def\PredicateFont{\tt}
\def\PredicateFileFont{\small\sf}
\def\PredicateSkip{\smallskip}
\def\PredicateIndent{5em}
\def\PredicateFileExtension{}
\def\PredicateFileWidth{5em}
\def\PredicateFileSep{1em}
\def\PredicateBoxSep{3pt}
\def\PredicateBoxRule{0.5pt}
\def\PredicateIndex#1{\index{#1}}
\newif\ifPrologNumberLines
\def\PrologEXPORTS{}
\def\PrologFILE{}
\def\PrologDialect#1{%
  \@ifundefined{PL@start@module@#1}%
                {\message{*** Prolog dialect #1 is undefined. Ignored.}}%
                {\gdef\PL@Dialect{#1}}}
\def\PL@Dialect{eclipse}
\gdef\PL@@delayed{}
\newcount\PL@line
\gdef\PL@code@setup{\PrologFont\parskip=0ex\parindent=0pt
  \ifx\PL@@delayed\empty\else%
    \parbox{\PrologIndent}{%
      \ifPrologNumberLines \PrologNumberFont \the\PL@line%
      \global\advance\PL@line1
      \else\ \fi}\PL@@delayed%
    \gdef\PL@@delayed{}\par
  \fi%
  \def\par{\leavevmode\egroup\box0\endgraf}
  \def\do##1{\catcode`##1=12 }\dospecials
  \obeyspaces
  \obeylines
  \catcode`\^^I=13
  \everypar{\parbox{\PrologIndent}{%
      \ifPrologNumberLines \PrologNumberFont \the\PL@line%
      \global\advance\PL@line1
      \fi
      \hfill}\PL@code@startbox}}
\def\PL@code@startbox{\setbox0=\hbox\bgroup}
{\catcode`\^^I=13
 \gdef^^I{\leavevmode\egroup
   \dimen0=\wd0 % the width so far, or since the previous tab
   \setbox1=\hbox{\PrologFont\space}\dimen1=8\wd1
   \divide\dimen0   by\dimen1
   \multiply\dimen0 by\dimen1 % compute previous multiple of tab
   \advance\dimen0  by\dimen1 % advance to next multiple of tab
   \wd0=\dimen0 \box0 \PL@code@startbox}%
}
{\obeyspaces\global\let =\ }
\def\PL*/{\PL@PL@init%
  \begingroup
  \PL@code@setup
  \PL@doPL}
{\catcode`\|=0 \catcode`\\=12
  |obeylines|gdef|PL@doPL^^M#1/*PL{#1|endgroup|PL@PL@exit}}
\def\PL@PL@init{%
        \ifdim\PrologRuleWidth>0pt%
          \par\noindent\rule{\textwidth}{\PrologRuleWidth}\par%
        \else\medskip\par\fi}
\def\PL@PL@exit{%
        \ifdim\PrologRuleWidth>0pt%
          \vspace{-2ex}\noindent\rule{\textwidth}{\PrologRuleWidth}\par%
        \else\smallskip\par\fi}
\def\PL@INIT{\begingroup\catcode`:=13\catcode`/=13}
\def\PL@EXIT{\endgroup}
\gdef\PrologInput{%
  \begingroup
  \catcode`\_=12
  \PL@Input
}
\PL@INIT
\gdef\PL@Input#1{%
  \gdef\PrologFILE{#1}%
  \gdef\PrologMODULE{}%
  \gdef\PrologEXPORTS{}%
  \global\PL@line=1%
  \endgroup
  \PL@INIT%
  \let:=\PL@COLON
  \let/=\PL@SLASH
  \input{#1}%
  \gdef\PrologFILE{}%
  \gdef\PrologMODULE{}%
  \gdef\PrologEXPORTS{}%
  }
\PL@EXIT
\def\EndProlog#1*/{}
\def\PL@SLASH{\@ifnextchar*{%
    \PL@EXIT
    \PL@US@start
    \PL@SLASH@STAR}{/}}
\def\PL@SLASH@STAR*{%
  \PrologFile{\PrologFILE}{}%
  \PL@US@end}
\def\PL@COLON{\@ifnextchar-{\PL@goal}{: }}
\def\PL@goal-{%
  \PL@EXIT
  \PL@US@start
  \@ifnextchar m{\csname PL@start@module@\PL@Dialect\endcsname}%
  {\@ifnextchar t{\PL@start@true}%
    {\csname PL@start@file@\PL@Dialect\endcsname}}}
\def\PL@start@true true. /*{%
  \PrologFile{\PrologFILE}{}%
  \PL@US@end}
\def\PL@start@module@eclipse module#1(#2). /*{%
  \global\PL@line=1
  \gdef\PL@@delayed{:- module#1(#2).}
  \gdef\PrologMODULE{#2}%
  \catcode`\,=13 %
  \PrologModule{\PrologFILE}{}%
  \PL@US@end}
\def\PL@start@module@quintus module(#1,{%
  \global\PL@line=1
  \gdef\PrologFILE{#1}%
  \catcode`\,=13 %
  \PL@start@module@quintus@}
\def\PL@start@module@quintus@[#1]). /*{%
  \gdef\PrologEXPORTS{#1}%
  \PrologModule{\PrologFILE}{#1}%
  \PL@US@end}
\let\PL@start@module@cprolog=\PL@start@module@quintus
\let\PL@start@module@sixtus=\PL@start@module@eclipse
\let\PL@start@module@swiprolog=\PL@start@module@quintus
\let\PL@start@module@sbprolog=\PL@start@module@quintus
\let\PL@start@module@binprolog=\PL@start@module@eclipse
\def\Predicate{\PL@US@start\Predicate@}
\def\Predicate@#1/#2(#3).{%
  \PredicateSkip\par\noindent%
  {\setbox1=\hbox{\PredicateFileFont \PrologFILE\PredicateFileExtension}%
   \fboxrule=\PredicateBoxRule%
   \fboxsep=\PredicateBoxSep%
   \fbox{\PredicateIndex{#1/#2}%
         \dimen255=\wd1
         \ifdim\dimen255<\PredicateFileWidth \dimen255=\PredicateFileWidth \fi
         \dimen255=-\dimen255
         \advance\dimen255 by-\PredicateFileSep
         \advance\dimen255 by \textwidth
         \parbox{\dimen255}{\raggedright
                 \setbox0=\hbox{\normalsize\PredicateFont #1(}
                 \dimen254=\wd0

                 \ifdim\dimen254>\PredicateIndent \dimen254=\PredicateIndent\fi
                 \dimen253=\dimen255 \advance\dimen253 by -\dimen254
                 \parshape=2 0mm \dimen255 \dimen254 \dimen253
                 \normalsize\PredicateFont #1\ifx\@empty#3 \else(#3)\fi
        }}%
    \hfill \box1\PredicateSkip\par
  }\PL@US@end}
\def\PrologList{\par\noindent%
  \PL@US@start
  \PrologListFont
  \catcode`\,=13%
  \parindent=\PrologListIndent\parskip=0pt\par
  \PL@List}
{\catcode`\,=13
\gdef\PL@List[#1]{%
  \def,{\par}%
  #1
  \PL@US@end\par}
}
\def\PrologListEXPORTS{\PrologList[\PrologEXPORTS]}
\def\PL@US@start{\begingroup\catcode`\_=13 }
\def\PL@US@end{\endgroup }
\def\WithUnderscore{\begingroup\catcode`\_=13 \With@Underscore}
\def\With@Underscore#1{#1\endgroup}
\def\Listing#1{\par\begingroup%
  \PL@line=1%
  \PL@code@setup%
  \input{#1}%
  \endgroup}
\endinput
%%
%% End of file `pl.sty'.