5cc9c93590b4c0331f0c2283adabc198e3b16286
[gapil.git] / macro.tex
1 %% macro.tex
2 %%
3 %% Copyright (C) 2000-2007 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 %
13 % Defining some special character for use inside typewriter 
14 % text without using the verbatim environment
15 %
16 \def\tild{\char'176}
17 \def\bslash{\char'134}
18 \def\circonf{\char'136}
19 \def\invap{\char'140}
20 %
21 % Defining some commands to manipulate counter to avoid ude of 
22 % \label and \ref commands (and related problem to remeber the 
23 % used labels) to refer nearest objects
24 %
25 %
26 \newcounter{usercount}       % define a new counter for internal use
27 %
28 % equations commands
29 %
30 \newcommand{\cureq}{(\theequation)}
31 \newcommand{\nxeq}{%
32 \setcounter{usercount}{\value{equation}}%
33 \addtocounter{usercount}{1}%
34 (\thechapter.\theusercount)}
35 \newcommand{\preeq}{%
36 \setcounter{usercount}{\value{equation}}%
37 \addtocounter{usercount}{-1}%
38 (\thechapter.\theusercount)}
39 %
40 % Macro to put picture (in format PICT) inside a figure
41 %
42 \newcommand{\pictfig}[3]{
43         \begin{minipage}[t][#1][b]{#2}
44         \mbox{\special{pict=#3}}
45 %    \vspace{3cm}
46     \end{minipage}
47 }
48 %
49 % Macro to create a special environment for function prototypes
50 % boxed description
51 %
52 \newenvironment{prototype}[2]
53 {% defining what is done by \begin
54   \nobreak
55   \center
56   \begin{boxedminipage}[c]{14cm}
57   \footnotesize
58     \begin{description*}{}{} 
59     \item \texttt{\#include <#1>}
60     \item \texttt{#2} \par
61 %   \begin{lstlisting}{}
62 % #1
63 % #2
64 %   \end{lstlisting}
65 }
66 {% defining what is done by \end
67 %  \end{list} 
68 %  \par 
69 \end{description*}
70 \end{boxedminipage}
71 \vspace{6pt}
72 \par
73 \normalsize 
74 }
75 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.5cm}}}
76 {\end{basedescript}}
77 %
78 % Slighty different envirnoment to be used for multi-header, 
79 % multi-functions boxed description
80 %
81 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
82 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
83 \newcommand{\bodydesc}[1]{\par \end{description*} #1
84  \begin{description*}{}{} \baselineskip=0pt
85  \item \vspace{-4pt}
86
87
88 \newenvironment{functions}
89 {% defining what is done by \begin
90   \nobreak
91   \center
92     \begin{boxedminipage}[c]{14cm}
93       \footnotesize
94     \begin{description*}{}{} 
95 }
96 {% defining what is done by \end
97       \end{description*}
98     \end{boxedminipage}
99     \vspace{6pt}
100      \par
101     \normalsize 
102 %\break
103 }
104
105 %
106 % Wrapper for shell command, functions, filenames, links,
107 % variables, macros,  and everything can be useul, 
108 %
109 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
110 \newcommand{\code}[1]{\texttt{#1}}    % for simple code
111
112 \newcommand{\func}[1]{%
113 \index{funzione!{#1}@{{\tt {#1}}}}\texttt{#1}%
114 %\index{#1@{{\tt {#1}} (funzione)}}\texttt{#1}%
115 }
116
117 \newcommand{\funcd}[1]{%
118 \index{funzione!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
119 %\index{#1@{{\tt {#1}} (funzione)}!definizione di}\texttt{#1}%
120 }
121
122 \newcommand{\macro}[1]{%
123 \index{macro!{#1}@{{\tt {#1}}}}\texttt{#1}%
124 %\index{#1@{{\tt {#1}} (macro)}}\texttt{#1}%
125 }
126
127 \newcommand{\errcode}[1]{%
128 \index{errore!{#1}@{{\tt {#1}}}}\texttt{#1}%
129 %\index{#1@{{\tt {#1}} (errore)}}\texttt{#1}%
130 }
131
132 \newcommand{\errval}[1]{\texttt{#1}}     % value 
133 \newcommand{\var}[1]{\texttt{#1}}     % variable 
134 \newcommand{\val}[1]{\texttt{#1}}     % value 
135
136 \newcommand{\const}[1]{%
137 \index{costante!{#1}@{{\tt {#1}}}}\texttt{#1}%
138 %\index{#1@{{\tt {#1}} (costante)}}\texttt{#1}%
139 }                                     % constant name
140
141 \newcommand{\direct}[1]{%
142 \index{direttiva!{#1}@{{\tt {#1}}}}\texttt{#1}%
143 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
144 }                                     % constant name
145
146 \newcommand{\file}[1]{\texttt{#1}}    % file name
147 \newcommand{\link}[1]{\texttt{#1}}    % html link
148 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
149
150 \newcommand{\headfile}[1]{%
151 \index{file!include!{#1}@{{\tt {#1}}}}\texttt{#1}%
152 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
153 }                                     % header file name
154 \newcommand{\procfile}[1]{%
155 \index{file!filesystem~\texttt{/proc}!{#1}@{{\tt {#1}}}}\texttt{#1}%
156 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
157 }                                     % /proc file name
158 \newcommand{\sysfile}[1]{%
159 \index{file!di~sistema!{#1}@{{\tt {#1}}}}\texttt{#1}%
160 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
161 }                                     % system file name
162 \newcommand{\conffile}[1]{%
163 \index{file!di~configurazione!{#1}@{{\tt {#1}}}}\texttt{#1}%
164 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
165 }                                     % configuration file name
166 \newcommand{\procrelfile}[2]{%
167 \index{file!filesystem~\texttt{/proc}!{#1/#2}@{{\tt {#1/#2}}}}\texttt{#2}%
168 %\index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
169 }   
170
171
172 \newcommand{\type}[1]{%
173 \index{tipo!{#1}@{{\tt {#1}}}}\texttt{#1}%
174 %\index{#1@{{\tt {#1}} (tipo)}}\texttt{#1}%
175 }                                     % system type
176 \newcommand{\struct}[1]{%
177 \index{struttura dati!{#1}@{{\tt {#1}}}}\texttt{#1}%
178 %\index{#1@{{\tt {#1}} (struttura dati)}}\texttt{#1}%
179 }                                     % struttura dati
180 \newcommand{\structd}[1]{%
181 \index{struttura dati!{#1}@{{\tt {#1}}}!definizione di}\texttt{#1}%
182 %\index{#1@{{\tt {#1}} (struttura dati)}!definizione di}\texttt{#1}%
183 }                                     % struttura dati
184 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
185 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, ecc.)
186
187 \newcommand{\itindex}[1]{%
188 \index{#1@{\textit{#1}}}%
189 }
190
191 \newcommand{\itindbeg}[1]{%
192 \index{#1@{\textit{#1}}|(}%
193 }
194 \newcommand{\itindend}[1]{%
195 \index{#1@{\textit{#1}}|)}%
196 }
197 \newcommand{\itindsub}[2]{%
198 \index{#1@{\textit{#1}}!\textit{#2}}%
199 }
200
201 % Aggiunte di Mirko per la gestione delle tabelle complicate come immagini
202 % nella traslazione in HTML
203 \newenvironment{usepicture}{}{}{}{}
204
205 %%% Local Variables: 
206 %%% mode: latex
207 %%% TeX-master: "gapil"
208 %%% End: