Versione diversa con alcune correzione sui criteri di download
[gapil.git] / macro.tex
1 %% macro.tex
2 %%
3 %% Copyright (C) 2000-2003 Simone Piccardi.  Permission is granted to
4 %% copy, distribute and/or modify this document under the terms of the GNU Free
5 %% Documentation License, Version 1.1 or any later version published by the
6 %% Free Software Foundation; with the Invariant Sections being "Prefazione",
7 %% with no Front-Cover Texts, and with no Back-Cover Texts.  A copy of the
8 %% license is included in the section entitled "GNU Free Documentation
9 %% License".
10 %%
11 %
12 % Defining some commands to manipulate counter to avoid ude of 
13 % \label and \ref commands (and related problem to remeber the 
14 % used labels) to refer nearest objects
15 %
16 %
17 \newcounter{usercount}       % define a new counter for internal use
18 %
19 % Figure commands
20 %
21 \newcommand{\figref}[1]{fig.~\ref{#1}}
22 %
23 % Tables commands
24 %
25 \newcommand{\tabref}[1]{tab.~\ref{#1}}
26 %
27 % equations commands
28 %
29 \newcommand{\cureq}{(\theequation)}
30 \newcommand{\nxeq}{%
31 \setcounter{usercount}{\value{equation}}%
32 \addtocounter{usercount}{1}%
33 (\thechapter.\theusercount)}
34 \newcommand{\preeq}{%
35 \setcounter{usercount}{\value{equation}}%
36 \addtocounter{usercount}{-1}%
37 (\thechapter.\theusercount)}
38 %
39 % Macro to put picture (in format PICT) inside a figure
40 %
41 \newcommand{\pictfig}[3]{
42         \begin{minipage}[t][#1][b]{#2}
43         \mbox{\special{pict=#3}}
44 %    \vspace{3cm}
45     \end{minipage}
46 }
47 %
48 % Command for section and chapters
49 %
50 \newcommand{\capref}[1]{cap.~\ref{#1}}
51 \newcommand{\secref}[1]{sez.~\ref{#1}}
52 %
53 % Macro to create a special environment for function prototypes
54 % boxed description
55 %
56 \newenvironment{prototype}[2]
57 {% defining what is done by \begin
58   \nobreak
59   \center
60   \begin{boxedminipage}[c]{14cm}
61   \footnotesize
62     \begin{description*}{}{} 
63     \item \texttt{\#include <#1>}
64     \item \texttt{#2} \par
65 %   \begin{lstlisting}{}
66 % #1
67 % #2
68 %   \end{lstlisting}
69 }
70 {% defining what is done by \end
71 %  \end{list} 
72 %  \par 
73 \end{description*}
74 \end{boxedminipage}
75 \vspace{6pt}
76 \par
77 \normalsize 
78 }
79 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.5cm}}}
80 {\end{basedescript}}
81 %
82 % Slighty different envirnoment to be used for multi-header, 
83 % multi-functions boxed description
84 %
85 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
86 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
87 \newcommand{\bodydesc}[1]{\par \end{description*} #1
88  \begin{description*}{}{} \baselineskip=0pt
89  \item \vspace{-4pt}
90
91
92 \newenvironment{functions}
93 {% defining what is done by \begin
94   \nobreak
95   \center
96     \begin{boxedminipage}[c]{14cm}
97       \footnotesize
98     \begin{description*}{}{} 
99 }
100 {% defining what is done by \end
101       \end{description*}
102     \end{boxedminipage}
103     \vspace{6pt}
104      \par
105     \normalsize 
106 %\break
107 }
108 %
109 % Wrapper for shell command, functions, filenames, links,
110 % variables, macros,  and everything can be useul, 
111 %
112 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
113 \newcommand{\code}[1]{\texttt{#1}}    % for simple code
114 \newcommand{\func}[1]{%
115 \index{#1@{{\tt {#1}} (funzione)}}\texttt{#1}%
116 }
117 \newcommand{\funcd}[1]{%
118 \index{#1@{{\tt {#1}} (funzione)}!definizione di}\texttt{#1}%
119 }
120 \newcommand{\macro}[1]{%
121 \index{#1@{{\tt {#1}} (macro)}}\texttt{#1}%
122 }
123 \newcommand{\errcode}[1]{%
124 \index{#1@{{\tt {#1}} (errore)}}\texttt{#1}%
125 }
126 \newcommand{\errval}[1]{\texttt{#1}}     % value 
127 \newcommand{\var}[1]{\texttt{#1}}     % variable 
128 \newcommand{\val}[1]{\texttt{#1}}     % value 
129 \newcommand{\const}[1]{%
130 \index{#1@{{\tt {#1}} (costante)}}\texttt{#1}%
131 }                                     % constant name
132 \newcommand{\direct}[1]{%
133 \index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
134 }                                     % constant name
135 \newcommand{\file}[1]{\texttt{#1}}    % file name
136 \newcommand{\link}[1]{\texttt{#1}}    % html link
137 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
138 \newcommand{\type}[1]{%
139 \index{#1@{{\tt {#1}} (tipo)}}\texttt{#1}%
140 }                                     % system type
141 \newcommand{\struct}[1]{%
142 \index{#1@{{\tt {#1}} (struttura dati)}}\texttt{#1}%
143 }                                     % struttura dati
144 \newcommand{\structd}[1]{%
145 \index{#1@{{\tt {#1}} (struttura dati)}!definizione di}\texttt{#1}%
146 }                                     % struttura dati
147 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
148 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, etc.)
149
150
151 % Aggiunte di Mirko per la gestione delle tabelle complicate come immagini
152 % nella traslazione in HTML
153 \newenvironment{usepicture}{}{}{}{}
154
155 %%% Local Variables: 
156 %%% mode: latex
157 %%% TeX-master: "gapil"
158 %%% End: