3 %% Copyright (C) 2000-2015 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
13 % Defining some special character for use inside typewriter
14 % text without using the verbatim environment
17 \def\bslash{\char'134}
18 \def\circonf{\char'136}
21 \newcommand{\includecodesnip}[1]{\lstinputlisting[stepnumber=0,xleftmargin=\parindent,frame=]{#1}}{}
22 \newcommand{\includestruct}[1]{\lstinputlisting[stepnumber=0]{#1}}{}
23 \newcommand{\includecodesample}[1]{\lstinputlisting{#1}}{}
26 % Defining some commands to manipulate counter to avoid ude of
27 % \label and \ref commands (and related problem to remeber the
28 % used labels) to refer nearest objects
31 \newcounter{usercount} % define a new counter for internal use
35 \newcommand{\cureq}{(\theequation)}
37 \setcounter{usercount}{\value{equation}}%
38 \addtocounter{usercount}{1}%
39 (\thechapter.\theusercount)}
41 \setcounter{usercount}{\value{equation}}%
42 \addtocounter{usercount}{-1}%
43 (\thechapter.\theusercount)}
45 % Macro to put picture (in format PICT) inside a figure
47 \newcommand{\pictfig}[3]{
48 \begin{minipage}[t][#1][b]{#2}
49 \mbox{\special{pict=#3}}
54 % Macro to create a special environment for function prototypes
57 \newenvironment{prototype}[2]
58 {% defining what is done by \begin
61 \begin{boxedminipage}[c]{14cm}
63 \begin{description*}{}{}
64 \item \texttt{\#include <#1>}
65 \item \texttt{#2} \par
66 % \begin{lstlisting}{}
71 {% defining what is done by \end
80 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.0cm}}}
83 % Slighty different environment to be used for multi-header,
84 % multi-functions boxed description
86 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
87 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
88 \newcommand{\bodydesc}[1]{\par \end{description*} #1
89 \begin{description*}{}{} \baselineskip=0pt
93 \newenvironment{functions}
94 {% defining what is done by \begin
97 \begin{boxedminipage}[c]{14cm}
99 \begin{description*}{}{}
101 {% defining what is done by \end
111 % Wrapper for shell command, functions, filenames, links,
112 % variables, macros, and everything can be useul,
114 \newcommand{\cmd}[1]{\texttt{#1}} % shell command
115 \newcommand{\code}[1]{\texttt{#1}} % for simple code
117 \newcommand{\myfunc}[1]{\texttt{#1}} % for my functions
119 \newcommand{\func}[1]{%
121 %\index{funzione!{#1}@{{\tt {#1}}}}\texttt{#1}%
122 %\index{#1@{{\tt {#1}} (funzione)}}\texttt{#1}%
125 \newcommand{\funcd}[1]{%
126 \index{funzione!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
127 %\index{#1@{{\tt {#1}} (funzione)}!definizione di}\texttt{#1}%
129 \newcommand{\funcm}[1]{%
130 \index{funzione!{#1}@{{\tt {#1}}}!menzione di}\texttt{#1}%
131 %\index{#1@{{\tt {#1}} (funzione)}!definizione di}\texttt{#1}%
134 \newcommand{\macro}[1]{%
135 \index{macro!{#1}@{{\tt {#1}}}}\texttt{#1}%
136 %\index{#1@{{\tt {#1}} (macro)}}\texttt{#1}%
139 \newcommand{\errcode}[1]{%
141 %\index{errore!{#1}@{{\tt {#1}}}}\texttt{#1}%
142 %\index{#1@{{\tt {#1}} (errore)}}\texttt{#1}%
145 \newcommand{\errval}[1]{\texttt{#1}} % value
146 \newcommand{\var}[1]{\texttt{#1}} % variable
147 \newcommand{\val}[1]{\texttt{#1}} % value
149 \newcommand{\signal}[1]{%
150 \index{segnale!{#1}@{{\tt {#1}}}}\texttt{#1}%
151 %\index{#1@{{\tt {#1}} (costante)}}\texttt{#1}%
154 \newcommand{\const}[1]{%
155 \index{costante!{#1}@{{\tt {#1}}}}\texttt{#1}%
156 %\index{#1@{{\tt {#1}} (costante)}}\texttt{#1}%
159 \newcommand{\instruction}[1]{%
160 \index{istruzione linguaggio C!{#1}@{{\tt {#1}}}}\texttt{#1}%
161 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
164 \newcommand{\direct}[1]{%
165 \index{direttiva linguaggio C!{#1}@{{\tt {#1}}}}\texttt{#1}%
166 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
169 \newcommand{\file}[1]{\texttt{#1}} % file name
170 \newcommand{\link}[1]{\texttt{#1}} % html link
171 \newcommand{\ctyp}[1]{\texttt{#1}} % C standard type
173 \newcommand{\headfile}[1]{%
174 %\index{file!include!{#1}@{{\tt {#1}}}}\texttt{#1}%
178 \newcommand{\procfile}[1]{%
179 \index{file!filesystem~\texttt{/proc}!{#1}@{{\tt {#1}}}}\texttt{#1}%
180 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
182 \newcommand{\sysfile}[1]{%
183 \index{file!di~sistema!{#1}@{{\tt {#1}}}}\texttt{#1}%
184 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
186 \newcommand{\conffile}[1]{%
187 \index{file!di~configurazione!{#1}@{{\tt {#1}}}}\texttt{#1}%
188 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
189 } % configuration file name
190 \newcommand{\procrelfile}[2]{%
191 \index{file!filesystem~\texttt{/proc}!{#1/#2}@{{\tt {#1/#2}}}}\texttt{#2}%
192 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
195 \newcommand{\sysctlfile}[1]{%
196 \index{file!file di controllo (sotto \texttt{/proc/sys})!{#1}@{{\tt {#1}}}}\texttt{/proc/sys/#1}%
197 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
198 } % /proc/sys file name
200 \newcommand{\sysctlrelfile}[2]{%
201 \index{file!file di controllo (sotto \texttt{/proc/sys})!{#1/#2}@{{\tt {#1/#2}}}}\texttt{#2}%
202 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
203 } % /proc/sys file name
206 \newcommand{\kstruct}[1]{%
207 \index{struttura dati del kernel!{#1}@{{\tt {#1}}}}\texttt{#1}%
208 %\index{#1@{{\tt {#1}} (struttura dati)}}\texttt{#1}%
210 \newcommand{\kstructd}[1]{%
211 \index{struttura dati del kernel!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
212 %\index{#1@{{\tt {#1}} (struttura dati)}!definizione di}\texttt{#1}%
214 \newcommand{\type}[1]{%
215 \index{tipo di dato!{#1}@{{\tt {#1}}}}\texttt{#1}%
216 %\index{#1@{{\tt {#1}} (tipo)}}\texttt{#1}%
218 \newcommand{\struct}[1]{%
219 \index{struttura dati!{#1}@{{\tt {#1}}}}\texttt{#1}%
220 %\index{#1@{{\tt {#1}} (struttura dati)}}\texttt{#1}%
222 \newcommand{\structd}[1]{%
223 \index{struttura dati!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
224 %\index{#1@{{\tt {#1}} (struttura dati)}!definizione di}\texttt{#1}%
226 \newcommand{\param}[1]{\texttt{#1}} % function parameter
227 \newcommand{\acr}[1]{\textsl{#1}} % acrostic (for glibc, ext2, ecc.)
229 \newcommand{\ids}[1]{\textsl{#1}} % Identifier (PID, GID, UID, TID, ecc.)
230 \newcommand{\envvar}[1]{\texttt{#1}} % environment variable
231 \newcommand{\samplefunc}[1]{\texttt{#1}} % funzione degli esempi
233 \newcommand{\itindex}[1]{%
234 \index{#1@{\textit{#1}}}%
237 \newcommand{\itindbeg}[1]{%
238 \index{#1@{\textit{#1}}|(}%
240 \newcommand{\itindend}[1]{%
241 \index{#1@{\textit{#1}}|)}%
243 \newcommand{\itindsub}[2]{%
244 \index{#1@{\textit{#1}}!\textit{#2}}%
247 % Aggiunte di Mirko per la gestione delle tabelle complicate come immagini
248 % nella traslazione in HTML
249 \newenvironment{usepicture}{}{}{}{}
252 % Macro di definizione di alcune lunghezze usate per le formattazioni
254 \newlength{\codesamplewidth}
255 \setlength{\codesamplewidth}{0.95\textwidth}
257 \newlength{\funcboxwidth}
258 \setlength{\funcboxwidth}{0.85\textwidth}
262 % Nuove macro per diversa formattazione delle definizioni delle funzioni
264 \newcommand{\fhead}[1]{\texttt{\#include <#1>}\par}
265 \newcommand{\fdecl}[1]{\texttt{#1}\par}
266 \newcommand{\fdesc}[1]{\hfill{#1}\par}
268 \newenvironment{funcproto}[2]
269 {% defining what is done by \begin
278 {% defining what is done by \end
284 \newenvironment{funcbox}
285 {% defining what is done by \begin
287 \begin{boxedminipage}[c]{\funcboxwidth}
290 {% defining what is done by \end
301 %%% TeX-master: "gapil"