Lavoro fatto a casa senza ADSL, correzioni multiple agli indici, documentato
[gapil.git] / macro.tex
1 %% macro.tex
2 %%
3 %% Copyright (C) 2000-2005 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 "Un preambolo",
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 % equations commands
20 %
21 \newcommand{\cureq}{(\theequation)}
22 \newcommand{\nxeq}{%
23 \setcounter{usercount}{\value{equation}}%
24 \addtocounter{usercount}{1}%
25 (\thechapter.\theusercount)}
26 \newcommand{\preeq}{%
27 \setcounter{usercount}{\value{equation}}%
28 \addtocounter{usercount}{-1}%
29 (\thechapter.\theusercount)}
30 %
31 % Macro to put picture (in format PICT) inside a figure
32 %
33 \newcommand{\pictfig}[3]{
34         \begin{minipage}[t][#1][b]{#2}
35         \mbox{\special{pict=#3}}
36 %    \vspace{3cm}
37     \end{minipage}
38 }
39 %
40 % Macro to create a special environment for function prototypes
41 % boxed description
42 %
43 \newenvironment{prototype}[2]
44 {% defining what is done by \begin
45   \nobreak
46   \center
47   \begin{boxedminipage}[c]{14cm}
48   \footnotesize
49     \begin{description*}{}{} 
50     \item \texttt{\#include <#1>}
51     \item \texttt{#2} \par
52 %   \begin{lstlisting}{}
53 % #1
54 % #2
55 %   \end{lstlisting}
56 }
57 {% defining what is done by \end
58 %  \end{list} 
59 %  \par 
60 \end{description*}
61 \end{boxedminipage}
62 \vspace{6pt}
63 \par
64 \normalsize 
65 }
66 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.5cm}}}
67 {\end{basedescript}}
68 %
69 % Slighty different envirnoment to be used for multi-header, 
70 % multi-functions boxed description
71 %
72 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
73 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
74 \newcommand{\bodydesc}[1]{\par \end{description*} #1
75  \begin{description*}{}{} \baselineskip=0pt
76  \item \vspace{-4pt}
77
78
79 \newenvironment{functions}
80 {% defining what is done by \begin
81   \nobreak
82   \center
83     \begin{boxedminipage}[c]{14cm}
84       \footnotesize
85     \begin{description*}{}{} 
86 }
87 {% defining what is done by \end
88       \end{description*}
89     \end{boxedminipage}
90     \vspace{6pt}
91      \par
92     \normalsize 
93 %\break
94 }
95
96 %
97 % Wrapper for shell command, functions, filenames, links,
98 % variables, macros,  and everything can be useul, 
99 %
100 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
101 \newcommand{\code}[1]{\texttt{#1}}    % for simple code
102
103 \newcommand{\func}[1]{%
104 \index{funzione!{#1}@{{\tt {#1}}}}\texttt{#1}%
105 %\index{#1@{{\tt {#1}} (funzione)}}\texttt{#1}%
106 }
107
108 \newcommand{\funcd}[1]{%
109 \index{funzione!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
110 %\index{#1@{{\tt {#1}} (funzione)}!definizione di}\texttt{#1}%
111 }
112
113 \newcommand{\macro}[1]{%
114 \index{macro!{#1}@{{\tt {#1}}}}\texttt{#1}%
115 %\index{#1@{{\tt {#1}} (macro)}}\texttt{#1}%
116 }
117
118 \newcommand{\errcode}[1]{%
119 \index{errore!{#1}@{{\tt {#1}}}}\texttt{#1}%
120 %\index{#1@{{\tt {#1}} (errore)}}\texttt{#1}%
121 }
122
123 \newcommand{\errval}[1]{\texttt{#1}}     % value 
124 \newcommand{\var}[1]{\texttt{#1}}     % variable 
125 \newcommand{\val}[1]{\texttt{#1}}     % value 
126
127 \newcommand{\const}[1]{%
128 \index{costante!{#1}@{{\tt {#1}}}}\texttt{#1}%
129 %\index{#1@{{\tt {#1}} (costante)}}\texttt{#1}%
130 }                                     % constant name
131
132 \newcommand{\direct}[1]{%
133 \index{direttiva!{#1}@{{\tt {#1}}}}\texttt{#1}%
134 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
135 }                                     % constant name
136
137 \newcommand{\file}[1]{\texttt{#1}}    % file name
138 \newcommand{\link}[1]{\texttt{#1}}    % html link
139 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
140
141 \newcommand{\type}[1]{%
142 \index{tipo!{#1}@{{\tt {#1}}}}\texttt{#1}%
143 %\index{#1@{{\tt {#1}} (tipo)}}\texttt{#1}%
144 }                                     % system type
145 \newcommand{\struct}[1]{%
146 \index{struttura dati!{#1}@{{\tt {#1}}}}\texttt{#1}%
147 %\index{#1@{{\tt {#1}} (struttura dati)}}\texttt{#1}%
148 }                                     % struttura dati
149 \newcommand{\structd}[1]{%
150 \index{struttura dati!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
151 %\index{#1@{{\tt {#1}} (struttura dati)}!definizione di}\texttt{#1}%
152 }                                     % struttura dati
153 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
154 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, ecc.)
155
156 \newcommand{\itindex}[1]{%
157 \index{#1@{\textit{#1}}}%
158 }
159
160 \newcommand{\itindbeg}[1]{%
161 \index{#1@{\textit{#1}}|(}%
162 }
163 \newcommand{\itindend}[1]{%
164 \index{#1@{\textit{#1}}|)}%
165 }
166 \newcommand{\itindsub}[2]{%
167 \index{#1@{\textit{#1}}!\textit{#2}}%
168 }
169
170 % Aggiunte di Mirko per la gestione delle tabelle complicate come immagini
171 % nella traslazione in HTML
172 \newenvironment{usepicture}{}{}{}{}
173
174 %%% Local Variables: 
175 %%% mode: latex
176 %%% TeX-master: "gapil"
177 %%% End: