support for documentation in packages.

This commit is contained in:
Vitor Santos Costa 2011-06-12 22:26:04 +01:00
parent 261e02b43e
commit 9eabaa580c
13 changed files with 3802 additions and 271 deletions

View File

@ -682,6 +682,7 @@ all: startup.yss
@INSTALL_DLLS@ (cd library/tries; $(MAKE))
@INSTALL_DLLS@ (cd packages/clib; $(MAKE))
@INSTALL_DLLS@ (cd packages/http; $(MAKE))
# @INSTALL_DLLS@ (cd packages/pldoc; $(MAKE))
@INSTALL_DLLS@ (cd packages/plunit; $(MAKE))
@INSTALL_DLLS@ (cd packages/R; $(MAKE))
@INSTALL_DLLS@ (cd packages/RDF; $(MAKE))
@ -743,6 +744,7 @@ install_unix: startup.yss libYap.a
@INSTALL_DLLS@ (cd library/tries; $(MAKE) install)
@INSTALL_DLLS@ (cd packages/clib; $(MAKE) install)
@INSTALL_DLLS@ (cd packages/http; $(MAKE) install)
@INSTALL_DLLS@ (cd packages/pldoc; $(MAKE) install)
@INSTALL_DLLS@ (cd packages/plunit; $(MAKE) install)
@INSTALL_DLLS@ (cd packages/sgml; $(MAKE) install)
@INSTALL_DLLS@ (cd packages/R; $(MAKE) install)
@ -796,6 +798,7 @@ install_win32: startup.yss
@INSTALL_YAPR@ (cd packages/YapR; $(MAKE) install)
(cd library/tries; $(MAKE) install)
(cd packages/clib; $(MAKE) install)
(cd packages/pldoc; $(MAKE) install)
(cd packages/plunit; $(MAKE) install)
(cd packages/http; $(MAKE) install)
(cd packages/R; $(MAKE) install)
@ -855,6 +858,7 @@ clean: clean_docs
@INSTALL_DLLS@ (cd library/tries; $(MAKE) clean)
@INSTALL_DLLS@ (cd packages/clib; $(MAKE) clean)
@INSTALL_DLLS@ (cd packages/http; $(MAKE) clean)
@INSTALL_DLLS@ (cd packages/pldoc; $(MAKE) clean)
@INSTALL_DLLS@ (cd packages/plunit; $(MAKE) clean)
@INSTALL_DLLS@ (cd packages/R; $(MAKE) clean)
@INSTALL_DLLS@ (cd packages/RDF; $(MAKE) clean)

534
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2042,6 +2042,7 @@ mkdir -p packages/jpl/examples/java
mkdir -p packages/meld
mkdir -p packages/PLStream
mkdir -p packages/PLStream/libtai
mkdir -p packages/pldoc
mkdir -p packages/plunit
mkdir -p packages/ProbLog
mkdir -p packages/ProbLog/simplecudd
@ -2080,6 +2081,7 @@ AC_CONFIG_FILES([packages/cplint/approx/simplecuddLPADs/Makefile])
AC_CONFIG_FILES([packages/http/Makefile])
AC_CONFIG_FILES([packages/meld/Makefile])
AC_CONFIG_FILES([packages/PLStream/libtai/Makefile])
AC_CONFIG_FILES([packages/pldoc/Makefile])
AC_CONFIG_FILES([packages/plunit/Makefile])
AC_CONFIG_FILES([packages/ProbLog/Makefile ])
AC_CONFIG_FILES([packages/R/Makefile])

179
man/doc2tex Executable file
View File

@ -0,0 +1,179 @@
#!/usr/bin/env perl
sub printTeX
{ s/`([@\w]+)\s*<->([a-z]\w*)/\\index{\l\1,\\both{\2}}`\\classboth{\1}{\2}/g;
s/`([@\w]+)\s*<-([a-z]\w*)/\\index{\l\1,\\get{\2}}`\\classget{\1}{\2}/g;
s/`([@\w]+)\s*->([a-z]\w*)/\\index{\l\1,\\send{\2}}`\\classsend{\1}{\2}/g;
s/<->([a-z]\w*)/\\both{\1}/g;
s/<-([a-z]\w*)/\\get{\1}/g;
s/->([a-z]\w*)/\\send{\1}/g;
s/(^|\s|\()([a-z]\w+)\/((\d+|\[\d+(-|,)\d+\]))/\1\\index{\2\/\3}\\predref{\2}{\3}/g;
s/(\s+|^)([a-z]\w+)\/\/((\d+|\[\d+(-|,)\d+\]))/\1\\index{\2\/\/\3}\\dcgref{\2}{\3}/g;
s/(\w\.\w)\.(\s+[a-z])/\1.\\\2/g;
s/(^|[^\w}\\])@([a-z]\w*)/\1\\index{@\2}\\objectname{\2}/g;
s/(^|[^'])<(\w[-~\w]*)>/\1\\bnfmeta{\2}/g;
s/\\class{([<\\=>]*)}/\\verb!\1!/g;
s/==>/\$\\longrightarrow\$/g;
s/^((\\index{[^}]+})+) *$/\1%/;
s/(\\index{[^}]*)\\index{[^}]*}([^}]*})/\1\2/g;
s/(\\class(get|send|both){)\\index{[^}]*}/\1/g;
s/(PL_[a-z_]*)\(([^\)]*)\)/\\funcref{\1}{\2}/g;
# Prolog special arguments ...
# TBD: pick these up automatically from pl.sty
s/\\file{([^}]*\\bnfmeta[^}]*)}/\\metafile{\1}/g;
s/\\file{([^}]*\\arg[^}]*)}/\\metafile{\1}/g;
s/\\file{([^}]+)}/\\file@\1@/g;
s/\\htmloutput{([^}]+)}/\\htmloutput@\1@/g;
s/{#!}/{\\Sexe}/g;
s/{#>}/{\\Scgt}/g;
s/{#>=}/{\\Scge}/g;
s/{#<}/{\\Sclt}/g;
s/{#=<}/{\\Scle}/g;
s/{#=}/{\\Sceq}/g;
s/{#\\=}/{\\Scne}/g;
s/{#\\}/{\\Snot}/g;
s/{#\\\/}/{\\Sor}/g;
s/{#\/\\}/{\\Sand}/g;
s/{#<=>}/{\\Sequiv}/g;
s/{#<=}/{\\Slimpl}/g;
s/{#=>}/{\\Srimpl}/g;
s/{#<==}/{\\Slimplies}/g;
s/{#==>}/{\\Srimplies}/g;
s/{#<==>}/{\\Scequal}/g;
s/{#=\\=}/{\\Scine}/g;
s/{#=:=}/{\\Scieq}/g;
s/{!}/{\\Scut}/g;
s/{,}/{\\Scomma}/g;
s/{->}/{\\Sifthen}/g;
s/{\*->}/{\\Ssoftcut}/g;
s/{\.}/{\\Sdot}/g;
s/{;}/{\\Ssemicolon}/g;
s/{<}/{\\Slt}/g;
s/{><}/{\\Sxor}/g;
s/{=}/{\\Seq}/g;
s/{=\.\.}/{\\Suniv}/g;
s/{=:=}/{\\Saeq}/g;
s/{=<}/{\\Sle}/g;
s/{<=}/{\\Sel}/g;
s/{==}/{\\Sequal}/g;
s/{=@=}/{\\Sstructeq}/g;
s/{\\=@=}/{\\Sstructneq}/g;
s/{=\\=}/{\\Sane}/g;
s/{>}/{\\Sgt}/g;
s/{>=}/{\\Sge}/g;
s/{@<}/{\\Stlt}/g;
s/{@=<}/{\\Stle}/g;
s/{@>}/{\\Stgt}/g;
s/{@>=}/{\\Stge}/g;
s/{\\\+}/{\\Snot}/g;
s/{\\=}/{\\Sne}/g;
s/{\\==}/{\\Snequal}/g;
s/{\^}/{\\Shat}/g;
s/{\|}/{\\Sbar}/g;
s/{\*}/{\\Stimes}/g;
s/{\*\*}/{\\Spow}/g;
s/{\+}/{\\Splus}/g;
s/{-}/{\\Sminus}/g;
s/{\/}/{\\Sdiv}/g;
s/{\/\/}/{\\Sidiv}/g;
s/{\/\\}/{\\Sand}/g;
s/{<<}/{\\Slshift}/g;
s/{>>}/{\\Srshift}/g;
s/{\\}/{\\Sneg}/g;
s/{\\\/}/{\\Sor}/g;
s/{\$}/{\\Sdollar}/g;
s/{\?}/{\\Squest}/g;
s/{:}/{\\Smodule}/g;
s/{:-}/{\\Sneck}/g;
s/{\?-}/{\\Sdirective}/g;
s/{-->}/{\\Sdcg}/g;
s/{~}/{\\Stilde}/g;
s/{%}/{\\Spercent}/g;
s/{{}}/{\\Scurl}/g;
s/{xXX..\\}/{\\SxXX}/g;
s/\\file@([^@]+)@/\\file{\1}/g;
s/\\htmloutput@([^@]+)@/\\htmloutput{\1}/g;
print;
}
sub expandTabs
{ while ( ($i = index($_, "\t")) != $[-1 )
{ $nspaces = 8 - $i % 8;
for( $spaces="", $i=0; $i<$nspaces; $i++ )
{ $spaces .= " ";
}
s/\t/$spaces/;
}
}
sub
expandSpecials
{ s/\^/\\verb!^!/g;
s/\|/\\verb!|!/g;
}
sub printCode
{ print;
while (<ARGV> )
{ &expandTabs;
print;
if ( /\\end{(code|verbatim)}/ )
{ return;
}
}
}
sub printPceCode
{ $line = 0;
print;
while (<ARGV> )
{ $line++;
&expandTabs;
if ( /\\end{pcecode}/ )
{ print;
return;
}
chomp;
print "\\lineno{$line}\\verb`$_`\n";
}
}
sub skiptonext
{ while (<ARGV>)
{ if ( ! /^\s*$/ )
{ return;
}
last;
}
while (<ARGV>)
{ if ( ! /^\s*$/ )
{ return;
}
}
}
# MAIN PROGRAM
while (<>)
{ while ( /\\begin{pcecode}/ )
{ &printPceCode;
print "\n\\noindent\n";
&skiptonext;
}
while ( /\\begin{(code|verbatim)}/ )
{ &printCode;
print "\n\\noindent\n";
&skiptonext;
}
&printTeX;
}

43
man/fancychap.sty Normal file
View File

@ -0,0 +1,43 @@
\font\chapnum = cminch
\font\chaptitle = cmssbx10 scaled \magstep5
\def\booktitle{\mbox{}}
\newdimen\titlewidth
\newdimen\titlenumwidth
\titlewidth\textwidth
\titlenumwidth 3cm
\addtolength{\titlewidth}{-\titlenumwidth}
%----------------------------------------------------------------------
% Chapters
%----------------------------------------------------------------------
\def\breakit{\ } % allow linebreak in chapter title
\def\@makechapterhead#1{ % Heading for \chapter command
\vspace*{0pt} % Space at top of text page.
{ \parindent 0pt \raggedright
\ifnum \c@secnumdepth >\m@ne % IF secnumdepth > -1 THEN
\begin{minipage}{\headwidth}
\parbox[b]{\titlewidth}{%
\def\breakit{\par}\raggedright
\baselineskip .33in {\chaptitle #1}}\nobreak
\parbox[b]{\titlenumwidth}{\raggedleft {\chapnum \thechapter}}
\par\vskip 3pt
\rule[0pt]{\headwidth}{4pt}
\end{minipage}
\fi
\vskip 20pt
\nobreak % TeX penalty to prevent pagebreak.
} }
\def\@makeschapterhead#1{ % Heading for \chapter* command
\vspace*{0pt} % Space at top of page.
\markboth{\booktitle}{#1}
{ \parindent 0pt \raggedright
\begin{minipage}{\headwidth}
\parbox[b]{\titlewidth}{\raggedright {\chaptitle #1}}
\par\vskip 5pt
\rule[0pt]{\headwidth}{4pt}
\end{minipage}
\nobreak % TeX penalty to prevent page break.
\vskip 30pt % Space between title and text.
}}

174
man/html.sty Normal file
View File

@ -0,0 +1,174 @@
% HTML.sty
%
% Provide LaTeX definitions for the latex2html translator.
% Requires LaTeX2e or later
%
% Author: Jan Wielemaker, SWI, University of Amsterdam
% \onefile
%
% Do not section the output (i.e. put all output in the same HTML file).
\newcommand{\onefile}{}
% \bodycolor{Color}
%
% Define colour for running text body (<BODY BGCOLOR=Color>).
\newcommand{\bodycolor}[1]{}
% \linkimage{Id}{ImagePath}
%
% Define image to use for specified link id
\newcommand{\linkimage}[2]{}
% \htmlmainfile{File}
% \htmloutput{Directory}
%
% Define the main output file and directory
\newcommand{\htmlmainfile}[1]{}
\newcommand{\htmloutput}[1]{}
% htmlfiledepth{Depth}
%
% Defines the depth at which sections are split into separate files
% Default is 2 (each subsection produces a file). See also \onefile
\newcommand{\htmlfiledepth}[1]{}
% \email[TextToShow]{URL}
% \url[TextToShow]{URL}
%
% References to E-mail addresses and general URL's. If the optional
% argument is provided, this is the text printed for the label. Otherwise
% the address itself is printed.
\def\url{\@ifnextchar[{\@url}{\@plainurl}}
\def\@url[#1]#2{#1}
\def\@plainurl#1{{\tt #1}}
\let\email=\url
% \begin{shortlist} ... \end{shortlist}
%
% As itemize environment, but do not include extra space between the
% items.
\newenvironment{shortlist}{%
\begin{itemize}\setlength{\itemsep}{0pt}}{%
\end{itemize}}
% \begin{dlist} ... \end{dlist}
%
% As description environment, but start a newline after the item
\let\latexitem=\item
\newenvironment{dlist}{%
\begin{description}%
\def\item[##1]{\latexitem[##1]\hfill\\}}{%
\end{description}}
\newenvironment{itemlist}
{\itemize
\renewcommand\makelabel[1]{%
\hspace\labelwidth
\llap{\@itemlabel}%
\hspace\labelsep
\makebox[\linewidth][l]{\it ##1}%
\hspace{-\labelsep}}%
}%
{\enditemize}
% \var{Var}
%
% Indicate Var is a variable or argument.
\def\var#1{{\it #1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Comment.sty version 2.0, 19 June 1992
% selectively in/exclude pieces of text: the user can define new
% comment versions, and each is controlled separately.
% This style can be used with plain TeX or LaTeX, and probably
% most other packages too.
%
% Examples of use in LaTeX and TeX follow \endinput
%
% Author
% Victor Eijkhout
% Department of Computer Science
% University Tennessee at Knoxville
% 104 Ayres Hall
% Knoxville, TN 37996
% USA
%
% eijkhout@cs.utk.edu
%
% Usage: all text included in between
% \comment ... \endcomment
% or \begin{comment} ... \end{comment}
% is discarded. The closing command should appear on a line
% of its own. No starting spaces, nothing after it.
% This environment should work with arbitrary amounts
% of comment.
%
% Other 'comment' environments are defined by
% and are selected/deselected with
% \includecomment{versiona}
% \excludecoment{versionb}
%
% These environments are used as
% \versiona ... \endversiona
% or \begin{versiona} ... \end{versiona}
% with the closing command again on a line of its own.
%
% Basic approach:
% to comment something out, scoop up every line in verbatim mode
% as macro argument, then throw it away.
% For inclusions, both the opening and closing comands
% are defined as noop
%
% Changed \next to \html@next to prevent clashes with other sty files
% (mike@emn.fr)
% Changed \html@next to \htmlnext so the \makeatletter and
% \makeatother commands could be removed (they were causing other
% style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
% Changed \htmlnext back to \html@next...
\makeatletter
\def\makeinnocent#1{\catcode`#1=12 }
\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
\def\ThrowAwayComment#1{\begingroup
\def\CurrentComment{#1}%
\let\do\makeinnocent \dospecials
\makeinnocent\^^L% and whatever other special cases
\endlinechar`\^^M \catcode`\^^M=12 \xComment}
{\catcode`\^^M=12 \endlinechar=-1 %
\gdef\xComment#1^^M{\def\test{#1}
\csarg\ifx{PlainEnd\CurrentComment Test}\test
\let\html@next\endgroup
\else \csarg\ifx{LaLaEnd\CurrentComment Test}\test
\edef\html@next{\endgroup\noexpand\end{\CurrentComment}}
\else \let\html@next\xComment
\fi \fi \html@next}
}
\makeatother
\def\includecomment
#1{\expandafter\def\csname#1\endcsname{}%
\expandafter\def\csname end#1\endcsname{}}
\def\excludecomment
#1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}%
{\escapechar=-1\relax
\csarg\xdef{PlainEnd#1Test}{\string\\end#1}%
\csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}%
}}
\excludecomment{comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\excludecomment{htmlonly}
\newenvironment{latexonly}{}{}

1254
man/name.bst Normal file

File diff suppressed because it is too large Load Diff

1102
man/pl.bib Normal file

File diff suppressed because it is too large Load Diff

508
man/pl.sty Normal file
View File

@ -0,0 +1,508 @@
% SWI-Prolog document-style
% Test for PDF generation using pdflatex
\usepackage{ifpdf}
%Old tex versions
%\newif\ifpdf
%\ifx\pdfoutput\undefined
% \pdffalse
%\else
% \pdfoutput=1
% \pdftrue
%\fi
% Get hyperrefs to work
\usepackage{makeidx}
\usepackage{url}
\ifpdf
\usepackage[pdftex,colorlinks=true,urlcolor=blue]{hyperref}
\pdfcompresslevel=9
% \pdfcatalog{
% /PageMode /UseOutLines
% }
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.pdf,.jpg,.png}
\else
\usepackage[dvips]{graphicx}
\DeclareGraphicsExtensions{.eps,.ps}
\fi
\graphicspath{{figs/}{./}}
% Other styles
\usepackage{a4wide}
\usepackage{longtable}
\usepackage{ifthen}
\usepackage{dcolumn}
\usepackage{calc}
\setlongtables
\catcode`\^^A=8% downarrow are for subscripts
\catcode`\_=\active
\def_{\ifmmode\else\_\fi}
\def\vobeyspaces{\@vobeyspaces}
\newcommand{\onlinebreak}{}
% References
\newcommand{\secref}[1]{section~\ref{sec:#1}}
\newcommand{\appref}[1]{appendix~\ref{sec:#1}}
\newcommand{\chapref}[1]{chapter~\ref{sec:#1}}
\newcommand{\figref}[1]{figure~\ref{fig:#1}}
\newcommand{\tabref}[1]{table~\ref{tab:#1}}
\newcommand{\Secref}[1]{Section~\ref{sec:#1}}
\newcommand{\Appref}[1]{Appendix~\ref{sec:#1}}
\newcommand{\Chapref}[1]{Chapter~\ref{sec:#1}}
\newcommand{\Figref}[1]{Figure~\ref{fig:#1}}
\newcommand{\Tabref}[1]{Table~\ref{tab:#1}}
\newcommand{\tm}{$^{tm}$}
\newcommand{\reffont}{\tt}
\newcommand{\predref}[2]{% % functor/arity
\mbox{\reffont #1/#2}}
\newcommand{\dcgref}[2]{% % functor//arity
\mbox{\reffont #1//#2}}
\newcommand{\qpredref}[3]{% % module:functor/arity
\mbox{\reffont #1:#2/#3}}
\newcommand{\qdcgref}[3]{% % module:functor//arity
\mbox{\reffont #1:#2//#3}}
\newcommand{\nopredref}[2]{% % functor/arity (external)
\mbox{\reffont #1/#2}}
\newcommand{\functor}[2]{% % functor/arity (no predicate)
\mbox{\reffont #1/#2}}
\newcommand{\manref}[2]{% % page(n)
\mbox{{\reffont #1(}{\rm #2}{\tt )}}}
\newcommand{\funcref}[2]{% % function(Args...)
\mbox{{\reffont #1(}{\it #2}{\tt )}}}
\newcommand{\prologflag}[1]{%
\mbox{\reffont #1}}
% Descriptions (definitions) of various things
% Note: I do not know where the 1ex comes from. This should fit
% exactly, but appearently some dimension is missing. I suspect
% a space creaping in somewhere.
\def\@nodescription{false}
\newcommand{\defentry}[1]{\definition{#1}}
\newcommand{\definition}[1]{%
\onlinebreak%
\ifthenelse{\equal{\@nodescription}{true}}{%
\def\@nodescription{false}%
\makebox[-\leftmargin]{\mbox{}}\makebox[\linewidth+\leftmargin-1ex][l]{\bf #1}\\}{%
\item[{\makebox[\linewidth+\leftmargin-1ex][l]{#1}}]}}
\newcommand{\nodescription}{\def\@nodescription{true}}
\makeatletter
\def\cmdlineoptionitem{\@ifstar{\@gluedcmdoptitem}{\@cmdoptitem}}
\def\@gluedcmdoptitem#1#2{\definition{\texttt{#1}\var{#2}}}
\def\@cmdoptitem#1#2{\definition{\texttt{#1} \var{#2}}}
\makeatother
\newcommand{\longoptionitem}[2]{%
\ifthenelse{\equal{}{#2}}{%
\definition{-{}-#1}}{%
\definition{-{}-#1={\it #2}}}\ignorespaces}
\newcommand{\longoption}[2]{%
\ifthenelse{\equal{}{#2}}{%
\mbox{\reffont -{}-#1}}{%
\mbox{\reffont -{}-#1={\it #2}}}}
\newcommand{\traceoption}[3]{%
\definition{{\tt #1} (#2)}#3%
\ignorespaces}
\newcommand{\pleaseoption}[3]{%
\definition{#1 {\it #2} {\rm(default: \it #3)}}%
\ignorespaces}
%\prologflagitem{Name}{Type}{Access}
\newcommand{\prologflagitem}[3]{%
\definition{#1 {\it (#2%
\ifthenelse{\equal{rw}{#3}}{, changeable}{})}}%
\index{flag:#1}\ignorespaces}
\newcommand{\escapeitem}[1]{%
\definition{\Sesc{\tt #1}}
\ignorespaces}
\newcommand{\fmtchar}[1]{%
\item[\tt #1]%
\ignorespaces}
% \directive{Name}{Arity}{Args}
% \predicate[Attibutes]{Name}{Arity}{Args}
% \infixop{Name}{Left}{Right}
% \prefixop{Name}{Right}
% \dcg[Attibutes]{Name}{Arity}{Args}
%
% Predicate descriptions. Must appear in a description
% environment.
\newcommand{\resitem}[1]{%
\defentry{#1}%
\index{#1}\ignorespaces}
\makeatletter
\def\predatt#1{\hfill{\it\footnotesize[#1]}}
\def\predicate{\@ifnextchar[{\@attpredicate}{\@predicate}}
\def\qpredicate{\@ifnextchar[{\@attqpredicate}{\@qpredicate}}
\def\@predicate#1#2#3{%
\ifthenelse{\equal{#2}{0}}{%
\defentry{#1}}{%
\defentry{#1({\it #3})}}%
\index{#1/#2}\ignorespaces}
\def\@attpredicate[#1]#2#3#4{%
\ifthenelse{\equal{#3}{0}}{%
\defentry{#2\predatt{#1}}}{%
\defentry{#2({\it #4})\predatt{#1}}}%
\index{#2/#3}\ignorespaces}
\def\@qpredicate#1#2#3#4{%
\ifthenelse{\equal{#3}{0}}{%
\defentry{#1:#2}}{%
\defentry{#1:#2({\it #4})}}%
\index{#1/#2}\ignorespaces}
\def\@attqpredicate[#1]#2#3#4#5{%
\ifthenelse{\equal{#4}{0}}{%
\defentry{#2:#3\predatt{#1}}}{%
\defentry{#2:#3({\it #5})\predatt{#1}}}%
\index{#2/#3}\ignorespaces}
\def\directive{\@ifnextchar[{\@attdirective}{\@directive}}
\def\@directive#1#2#3{%
\ifthenelse{\equal{#2}{0}}{%
\defentry{:- #1}}{%
\defentry{:- #1({\it #3})}}%
\index{#1/#2}\ignorespaces}
\def\@attdirective[#1]#2#3#4{%
\ifthenelse{\equal{#3}{0}}{%
\defentry{:- #2\predatt{#1}}}{%
\defentry{:- #2({\it #4})\predatt{#1}}}%
\index{#2/#3}\ignorespaces}
\def\dcg{\@ifnextchar[{\@attdcg}{\@dcg}}
\def\@dcg#1#2#3{%
\ifthenelse{\equal{#2}{0}}{%
\defentry{#1}}{%
\defentry{#1({\it #3}) \texttt{//}}}%
\index{#1/#2}\ignorespaces}
\def\@attdcg[#1]#2#3#4{%
\ifthenelse{\equal{#3}{0}}{%
\defentry{#2 \texttt{//}\predatt{#1}}}{%
\defentry{#2({\it #4}) \texttt{//}\predatt{#1}}}%
\index{#2//#3}\ignorespaces}
\def\infixop{\@ifnextchar[{\@attinfixop}{\@infixop}}
\def\@infixop#1#2#3{%
\defentry{{\it #2} #1 {\it #3}}%
\index{#1/2}\ignorespaces}
\def\@attinfixop[#1]#2#3#4{%
\defentry{{\it #3} #2 {\it #4}\predatt{#1}}%
\index{#2/2}\ignorespaces}
\def\prefixop{\@ifnextchar[{\@attprefixop}{\@prefixop}}
\def\@prefixop#1#2{%
\defentry{#1 {\it #2}}%
\index{#1/1}\ignorespaces}
\def\@attprefixop[#1]#2#3{%
\defentry{#2 {\it #3}\predatt{#1}}%
\index{#2/1}\ignorespaces}
\makeatother
% \termitem{functor}{Args}
% \infixtermitem{functor}{Left}{Right}
% \prefixtermitem{functor}{Right}
% \postfixtermitem{functor}{Left}
%
% Terms in description lists. Typically used to describe various
% possible values or types for a term.
\newcommand{\termitem}[2]{%
\ifthenelse{\equal{}{#2}}{%
\definition{#1}}{%
\definition{#1({\it #2})}}\ignorespaces}
\newcommand{\infixtermitem}[3]{%
\definition{{\it #2} #1 {\it #3}}\ignorespaces}
\newcommand{\prefixtermitem}[2]{%
\definition{#1 {\it #2}}\ignorespaces}
\newcommand{\postfixtermitem}[2]{%
\definition{{\it #2} #1}\ignorespaces}
% \term{functor}{Args}
% \infixterm{functor}{Left}{Right}
% \prefixterm{functor}{Right}
% \postfixterm{functor}{Left}
%
% Terms used in running text.
\def\term{}
\renewcommand{\term}[2]{%
\ifthenelse{\equal{\protect}{\protect#2}}{%
{\reffont #1}}{%
{\reffont #1}({\it #2})}}
\newcommand{\infixterm}[3]{{\it #2} #1 {\it #3}}
\newcommand{\prefixterm}[2]{#1 {\it #2}}
\newcommand{\postfixterm}[2]{{\it #2} #1}
\newcommand{\errorterm}[2]{\mbox{\tt%
\ifthenelse{\equal{}{#2}}{%
#1}{%
#1(#2)}}}
\newcommand{\cfunction}[3]{%
\defentry{{\tt #1} #2{\rm (}{\it #3}{\rm )}}%
\index{#2()}\ignorespaces}
\newcommand{\constructor}[2]{%
\defentry{#1::#1{\rm (}{\it #2}{\rm )}}%
\index{#1::#1()}\ignorespaces}
\newcommand{\destructor}[1]{%
\defentry{#1::\Stilde{}#1{\rm ()}}%
\index{#1::\Stilde{}#1()}\ignorespaces}
\newcommand{\cppcast}[2]{%
\defentry{#1::operator #2{\rm ({\it void})}}%
\index{#1::operator #2()}\ignorespaces}
\newcommand{\cdecl}[2]{{\tt #1} {\em #2}}
\newcommand{\cmacro}[3]{%
\defentry{{\it #1} #2({\it #3})}%
\index{#2()}\ignorespaces}
\newcommand{\constitem}[1]{%
\definition{#1}%
\index{#1}\ignorespaces}
\newcommand{\cglobalvar}[1]{{\tt #1}}
\newcommand{\classitem}[1]{%
\definition{Class #1}%
\index{#1 \string\idxtype{class}}\ignorespaces}
\newcommand{\menuitem}[2]{%
\ifthenelse{\equal{\protect}{\protect#2}}{%
\definition{\textsf #1}}{%
\definition{\textsf #1 ({\it #2})}}%
\index{#1 \string\idxtype{menu}}%
\ignorespaces}
% \tag{Keyword}
%
% PlDoc @keyword expansion. \mtag{Keyword} is a multi-valued tag
\newcommand{\tag}[1]{%
\item[#1]}
\newcommand{\mtag}[1]{%
\item[#1]\mbox{}\\}
\newcommand{\bnfmeta}[1]{\ifmmode{\langle\mbox{\it #1}\rangle}\else$\langle\mbox{\it #1}\rangle$\fi}
\newcommand{\bnfor}{\ifmmode\mid\else$\mid$\fi}
\newcommand{\isa}{& ::= &}
\newcommand{\ora}{& $\mid$ &}
\renewcommand{\arg}[1]{\ifmmode\mbox{\em #1}\else{\it #1}\fi}
\newcommand{\class}[1]{{\em #1}\index{#1 \string\idxtype{class}}}
\newcommand{\classs}[1]{{\em #1s}\index{#1 \string\idxtype{class}}}
\newcommand{\demo}[1]{{\sf #1}\index{#1 \string\idxtype{demo}}}
\newcommand{\pllib}[1]{{\texttt{#1}}\index{#1 \string\idxtype{library}}}
\newcommand{\clib}[1]{{\tt #1}\index{#1 \string\idxtype{library}}}
\newcommand{\tool}[1]{{\em #1}\index{#1 \string\idxtype{tool}}}
\newcommand{\menuref}[1]{\textsf{#1}\index{#1 \string\idxtype{menu}}}
\newcommand{\constf}[1]{{\reffont #1}}
\newcommand{\const}[1]{{\tt #1}}
\newcommand{\plflag}[1]{{\tt #1}}
\newcommand{\type}[1]{{\reffont #1}}
\newcommand{\idx}[1]{#1\index{#1}}
\newcommand{\foreseen}[1]{\footnote{#1}}
\newcommand{\metafile}[1]{\mbox{\tt #1}}
\newcommand\file{\begingroup \urlstyle{tt}\Url}
\newcommand\email{\begingroup \urlstyle{tt}\Url}
\newcommand{\env}[1]{\mbox{\tt #1}}
\newcommand{\except}[1]{\mbox{\tt #1}}
\newcommand{\exam}[1]{\mbox{\tt #1}}
\newcommand{\module}[1]{\mbox{\reffont #1}}
\newcommand{\fileext}[1]{\mbox{\texttt{.#1}}}
\newcommand{\option}[1]{\mbox{\tt #1}}
\newcommand{\resource}[1]{\mbox{\reffont #1}}
\newcommand{\cmdlineoption}[1]{\mbox{\tt #1}}
\newcommand{\argoption}[2]{\mbox{\tt #1 \em #2}}
\newcommand{\ctype}[1]{{\texttt{#1}}}
\newcommand{\op}[1]{{\tt #1}}
\newcommand{\program}[1]{\texttt{#1}}
\newcommand{\manpage}[2]{{\bf #1}(#2)}
\newcommand{\chr}[1]{{\tt #1}}
\newcommand{\jargon}[1]{{\em #1}}
\newcommand{\strong}[1]{{\bf #1}}
\newcommand{\texcmd}[1]{{\Sesc}{\tt #1}}
\newcommand{\texenv}[1]{{\tt #1}}
\newcommand{\texmode}[1]{{\tt #1}}
\newcommand{\HTML}[1]{{\bf #1}}
\newcommand{\libdoc}[2]{\section{\pllib{#1}: #2}}
\newcommand{\key}[1]{{\sf #1}}
\newcommand{\menu}[2]{%
{\sf #1}%
\ifthenelse{\equal{#2}{}}{%
}{%
~(\texttt{#2})}}
\newcommand\satom{\begingroup \urlstyle{tt}\Url}
\newcommand\fmtseq{\begingroup \urlstyle{tt}\Url}
\urldef{\Sexe}\satom{#!} % #!
\urldef{\Scgt}\satom{#>} % #>
\urldef{\Scge}\satom{#>=} % #>=
\urldef{\Sclt}\satom{#<} % #<
\urldef{\Scle}\satom{#=<} % #=<
\urldef{\Sceq}\satom{#=} % #=
\urldef{\Scne}\satom{#\=} % #\=
\urldef{\Scnot}\satom{#\} % #\
\urldef{\Scor}\satom{#\/} % #\/
\urldef{\Scand}\satom{#/\} % #/\
\urldef{\Sequiv}\satom{#<=>} % #<=>
\urldef{\Slimpl}\satom{#<=} % #<=
\urldef{\Srimpl}\satom{#=>} % #=>
\urldef{\Slimplies}\satom{#<==} % #<==
\urldef{\Srimplies}\satom{#==>} % #==>
\urldef{\Scequal}\satom{#<==>} % #<==>
\urldef{\Scieq}\satom{#=:=} % #=:=
\urldef{\Scine}\satom{#=\=} % #=\=
\urldef{\Scut}\satom{!} % !
\urldef{\Scomma}\satom{,} % ,
\urldef{\Sifthen}\satom{->} % ->
\urldef{\Ssoftcut}\satom{*->} % *->
\urldef{\Sdot}\satom{.} % .
\urldef{\Ssemicolon}\satom{;} % ;
\urldef{\Slt}\satom{<} % <
\urldef{\Sxor}\satom{><} % ><
\urldef{\Seq}\satom{=} % =
\urldef{\Suniv}\satom{=..} % =..
\urldef{\Saeq}\satom{=:=} % =:=
\urldef{\Sle}\satom{=<} % =<
\urldef{\Sel}\satom{<=} % <=
\urldef{\Sequal}\satom{==} % ==
\urldef{\Sstructeq}\satom{=@=} % =@=
\urldef{\Sstructneq}\satom{\=@=} % \=@=
\urldef{\Sane}\satom{=\=} % =\=
\urldef{\Sgt}\satom{>} % >
\urldef{\Sge}\satom{>=} % >=
\urldef{\Stlt}\satom{@<} % @<
\urldef{\Stle}\satom{@=<} % @=<
\urldef{\Stgt}\satom{@>} % @>
\urldef{\Stge}\satom{@>=} % @>=
\urldef{\Snot}\satom{\+} % \+
\urldef{\Sne}\satom{\=} % \=
\urldef{\Snequal}\satom{\==} % \==
\urldef{\Shat}\satom{^} % ^
\urldef{\Sbar}\satom{|} % |
\urldef{\Stimes}\satom{*} % *
\urldef{\Spow}\satom{**} % **
\urldef{\Splus}\satom{+} % +
\urldef{\Sminus}\satom{-} % -
\urldef{\Sdiv}\satom{/} % /
\urldef{\Sidiv}\satom{//} % //
\urldef{\Sand}\satom{/\} % /\
\urldef{\Slshift}\satom{<<} % <<
\urldef{\Srshift}\satom{>>} % >>
\urldef{\Sneg}\satom{\} % \
\urldef{\Sesc}\satom{\} % \
\urldef{\Sor}\satom{\/} % \/
\urldef{\Sdollar}\satom{$} % $
\urldef{\Squest}\satom{?} % ?
\urldef{\Smodule}\satom{:} % :
\urldef{\Sneck}\satom{:-} % :-
\urldef{\Sdirective}\satom{?-} % ?-
\urldef{\Sdcg}\satom{-->} % -->
\urldef{\Bc}\satom{\c} % \c
\urldef{\Bn}\satom{\n} % \n
\urldef{\Br}\satom{\r} % \r
\urldef{\Bl}\satom{\l} % \l
\urldef{\BB}\satom{\\} % \\
\urldef{\Stilde}\satom{~} % ~
\urldef{\Spercent}\satom{%} % %
\urldef{\Shash}\satom{#} % #
\urldef{\Scurl}\satom{{}} % {}
\urldef{\SxXX}\satom{xXX..\} % xXX..\
\newcommand{\bug}[1]{\footnote{BUG: #1}}
\newcommand{\mod}[2]{#1 \mbox{\rm mod} #2}
\newcommand{\rem}[2]{#1 \mbox{\rm rem} #2}
\newcommand{\pow}[2]{{#1}^{#2}}
\newcommand{\bsl}[0]{\Sesc}
% Index handling
\newcommand{\idxtype}[1]{{\small\em #1}}
% Prolog predicate summary
\newenvironment{summarylist}[1]{\begin{longtable}[l]{#1}}{\end{longtable}}
\newcommand{\predicatesummary}[3]{#1/#2 & #3 \\}
\newcommand{\oppredsummary}[5]{#1/#2 & #5 \\}
\newcommand{\functionsummary}[3]{#1/#2 & #3 \\}
\newcommand{\opfuncsummary}[5]{#1/#2 & #5 \\}
\newcommand{\opsummary}[4]{#3 & #1 & #2 & #4 \\}
\newcommand{\hook}[1]{(hook)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CODE environment %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyvrb}
\usepackage{color}
%\definecolor{codeboxcolor}{rgb}{0.7,0.7,0.7}
\definecolor{codeboxcolor}{rgb}{0.4,0.4,0.4}
\DefineVerbatimEnvironment%
{code}{Verbatim}
{frame=single,
framerule=0.2pt,
rulecolor=\color{codeboxcolor},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INCLUDE FIGURES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PostScript figures
% \postscriptfig[width=5in]{label}{Title}
\makeatletter
\def\postscriptfig{\@ifnextchar[{\@scaledpostscriptfig}{\@postscriptfig}}
\def\@scaledpostscriptfig[#1]#2#3{%
\begin{figure}%
\centerline{\includegraphics[#1]{#2}}
\caption{#3}
\label{fig:#2}
\end{figure}}
\def\@postscriptfig#1#2{%
\begin{figure}%
\centerline{\includegraphics{#1}}
\caption{#2}
\label{fig:#1}
\end{figure}}
\makeatother
% \begin{tabularlp}{longest-text}
\newlength{\tabDright}
\newlength{\tabDleft}
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\newcommand{\raggedrightcolumn}{\PreserveBackslash\raggedright\hspace{0pt}}
\newenvironment{tabularlp}[1]%
{\settowidth{\tabDleft}{#1}%
\setlength{\tabDright}{\linewidth-\columnsep*3-\tabDleft}%
\begin{tabular}{|p{\tabDleft}|>{\raggedrightcolumn}p{\tabDright}|}}%
{\end{tabular}}
% \begin{tags} ... \end{tags}
\newenvironment{tags}%
{\begin{quote}\begin{description}%
\setlength{\itemsep}{0pt}%
\footnotesize}%
{\end{description}\end{quote}}
% \begin{parameters} ... \end{parameters}
\newenvironment{parameters}%
{\par%
\makebox[\linewidth]{\hfill\footnotesize Parameters}
\begin{tabular*}{\linewidth}{lp{0.7\linewidth}}
\hline}%
{\end{tabular*}}

32
man/plpage.sty Normal file
View File

@ -0,0 +1,32 @@
%% Define Prolog manual page and header layout
\usepackage{fancyheadings}
\usepackage{fancychap}
% PAGESTYLE
%
% Chapter date
% ---------------------------------------
%
% bla, bla, bla, ...
%
% \bottomleft - page - \bottomright
\def\arabicday{\number\year-\number\month-\number\day}
\providecommand{\runningtitle}{none}
\ifthenelse{\equal{\runningtitle}{none}}{%
\relax}{%
\pagestyle{fancyplain}
\headheight 14pt
\def\chaptermark{\mbox{}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}} % remember chapter title
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\bf\rightmark}}
\rhead[\fancyplain{}{\bf\leftmark}]{\fancyplain{}{\bf\thepage}}
\footrulewidth 0.2pt
\lfoot[\tiny \runningtitle]{}
\rfoot[]{\tiny \runningtitle}
\cfoot{}}

221
man/runtex Executable file
View File

@ -0,0 +1,221 @@
#!/bin/bash
#
# Automate running LaTeX
program=`basename $0`
tex=latex
format=dvi
rerun='Rerun to get cross-references right'
maxruns=4
quiet=false
function texclean
{ rm -f *.idx *.ind *.ilg *.aux *.log *.lof *.out *.toc *.blg
}
# make runtex --clean work without GNU getopt
case "$1" in
--clean)
texclean
exit 0
;;
esac
appbase=`dirname $0`
case "$appbase" in
/*)
;;
.) appbase=`pwd`
;;
./*|../*)
appbase="`pwd`/$appbase"
clean=false
while [ $clean = false ]; do
b=`echo $appbase | sed -e 's@/\./@/@g' -e 's@/[a-z]*/\.\./@/@g'`
if [ "x$b" = "x$appbase" ]; then
clean=true
else
appbase="$b"
fi
done
;;
*) echo "ERROR: runtex must be called with relative or absolute path"
exit 1
;;
esac
echo "runtex application base = $appbase"
function addinput
{ if [ -z "$TEXINPUTS" ]; then
export TEXINPUTS="$1::"
else
export TEXINPUTS=$TEXINPUTS:$1::
fi
}
function addbstinput
{ if [ -z "$BSTINPUTS" ]; then
export BSTINPUTS="$1::"
else
export BSTINPUTS=$BSTINPUTS:$1::
fi
}
function addbibinput
{ if [ -z "$BIBINPUTS" ]; then
export BIBINPUTS="$1::"
else
export BIBINPUTS=$BIBINPUTS:$1::
fi
}
function usage
{ echo "Usage:"
echo ""
echo " $program [options] file"
echo ""
echo "Options:"
echo ""
echo " --pdf Use pdflatex and make .pdf images"
echo " --dvi Use latex"
echo " --help Print this message"
echo " --maxruns=# Specify maximum # runs"
echo " --clean Just remove TeX temporary files"
}
if [ -d $appbase ]; then
addinput $appbase
addbstinput $appbase
addbibinput $appbase
fi
argp=true
while [ $argp = true ] ; do
case "$1" in
--pdf)
tex=pdflatex
format=pdf
shift ;;
--dvi)
tex=latex
format=dvi
shift ;;
--quiet)
quiet=true;
shift ;;
--maxruns=*)
maxruns="`echo $1 | sed 's/--maxruns=//'`"
shift ;;
--inputs=*)
addinput "`echo $1 | sed 's/--inputs=//'`"
shift ;;
--help)
usage
exit 0 ;;
--clean)
texclean
exit 0
;;
--*)
usage
exit 1 ;;
*)
argp=false;
;;
esac
done
if [ -z "$1" ]; then
usage
exit 1
fi
file="$1"
# ensure .tex suffix
if [ ${file%.tex} = $file ]; then
file=$file.tex
fi
doc=${file%.tex}
if [ -r Makefile ] && grep -q '^tex:' Makefile; then
make tex
fi
cont=yes
done=0
while [ $cont != "no" ]; do
cont=maybe
# fix index problems
if [ -r $doc.idx ]; then
cp $doc.idx $doc.idx.$$
if [ -x $appbase/correctindex ]; then
$appbase/correctindex $doc.idx
fi
if [ -r $appbase/makeindex.ist ]; then
makeindex -s $appbase/makeindex.ist $doc
else
makeindex $doc
fi
fi
if test -r $doc.aux && grep -qw bibdata $doc.aux; then
if [ -f $doc.bbl ]; then cp $doc.bbl $doc.bbl$$; fi
echo "%%% Running Bibtex"
bibtex $doc
if [ -r $doc.bbl -a -r $doc.bbl.$$ ]; then
if cmp -s $doc.bbl $doc.bbl.$$; then
true
else
cont=yes
echo "*** Bibtex output changed. Rerunning $tex ***"
fi
fi
rm -f $doc.bbl$$
fi
if [ `basename $tex` = pdflatex -a -r $appbase/Makefile.pdf ]; then
make -f $appbase/Makefile.pdf
fi
rm -f $doc.log
if [ $quiet == true ]; then
$tex $doc -file-line-error -halt-on-error >/dev/null
else
$tex $doc
fi
if [ $? != 0 ]; then
rm -f $doc.idx.$$
exit $?;
fi
if grep -q "$rerun" $doc.log; then
echo "*** Cross-references changed. Rerunning $tex ***"
cont=yes
else
if [ -r $doc.idx -a -r $doc.idx.$$ ]; then
if cmp -s $doc.idx $doc.idx.$$; then
true
else
ls -l $doc.idx $doc.idx.$$
cont=yes
echo "*** Index changed. Rerunning $tex ***"
fi
fi
fi
rm -f $doc.idx.$$
done=$(($done+1))
if [ $done = $maxruns ]; then cont=no; fi
if [ $cont = maybe ]; then cont=no; fi
done
if grep -q Warning $doc.log; then
echo ""
echo "*****************************"
echo "The following warnings remain"
echo "*****************************"
grep Warning $doc.log
fi

View File

@ -47,13 +47,15 @@ CMFLAGS=@SHLIB_CFLAGS@
CIFLAGS=
CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) $(PKGCFLAGS) @DEFS@
RUNTEX = true
LDSOFLAGS=@LDFLAGS@ @EXTRA_LIBS_FOR_SWIDLLS@
LDFLAGS=$(PKGLDFLAGS)
MKINDEX=$(PL) -f none -g make -t halt
.txt.tex:
swipl -f script.pl -g "doc_latex('$*.txt','$*.tex',[stand_alone(false)]),halt" -t "halt(1)"
PUBLICPL=swipl
PLTOTEX=$(PUBLICPL) -q -s pltotex.pl -g pltotex --

View File

@ -27,6 +27,8 @@ INSTALL_SCRIPT=@INSTALL_SCRIPT@
################################################################
LATEX=latex
DOC2TEX=@abs_top_srcdir@/man/doc2tex
RUNTEX=@abs_top_srcdir@/man/runtex
TEX=$(DOC).tex $(SUBTEX)
DVI=$(DOC).dvi
PDF=$(DOC).pdf
@ -50,12 +52,16 @@ $(HTML): $(TEX)
mv html/index.html $@
$(PDF): $(TEX)
../../man/runtex --pdf $(DOC)
$(srcdir)/../../man/runtex --pdf $(DOC)
$(TEX): $(DOC2TEX)
%.tex : $(srcdir)/%.doc
$(DOC2TEX) $< > $@
.doc.tex:
$(DOC2TEX) $*.doc > $*.tex
%.tex : $(srcdir)/%.txt
$(PUBLICPL) -f none -g "doc_latex('$<','$@',[stand_alone(false)]),halt" -t "halt(1)"
%.tex : $(srcdir)/%.pl
$(PLTOTEX) $< > $@
# Get the Prolog dialect specific part of the Makefiles