892181540b782e0f62ff589bef28bb9c2dc5447e
[gapil.git] / macro.tex
1 %% macro.tex
2 %%
3 %% Copyright (C) 2000-2004 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 \newcommand{\func}[1]{%
103 \index{#1@{{\tt {#1}} (funzione)}}\texttt{#1}%
104 }
105 \newcommand{\funcd}[1]{%
106 \index{#1@{{\tt {#1}} (funzione)}!definizione di}\texttt{#1}%
107 }
108 \newcommand{\macro}[1]{%
109 \index{#1@{{\tt {#1}} (macro)}}\texttt{#1}%
110 }
111 \newcommand{\errcode}[1]{%
112 \index{#1@{{\tt {#1}} (errore)}}\texttt{#1}%
113 }
114 \newcommand{\errval}[1]{\texttt{#1}}     % value 
115 \newcommand{\var}[1]{\texttt{#1}}     % variable 
116 \newcommand{\val}[1]{\texttt{#1}}     % value 
117 \newcommand{\const}[1]{%
118 \index{#1@{{\tt {#1}} (costante)}}\texttt{#1}%
119 }                                     % constant name
120 \newcommand{\direct}[1]{%
121 \index{#1@{{\tt {#1}} (direttiva)}}\texttt{#1}%
122 }                                     % constant name
123 \newcommand{\file}[1]{\texttt{#1}}    % file name
124 \newcommand{\link}[1]{\texttt{#1}}    % html link
125 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
126 \newcommand{\type}[1]{%
127 \index{#1@{{\tt {#1}} (tipo)}}\texttt{#1}%
128 }                                     % system type
129 \newcommand{\struct}[1]{%
130 \index{#1@{{\tt {#1}} (struttura dati)}}\texttt{#1}%
131 }                                     % struttura dati
132 \newcommand{\structd}[1]{%
133 \index{#1@{{\tt {#1}} (struttura dati)}!definizione di}\texttt{#1}%
134 }                                     % struttura dati
135 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
136 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, etc.)
137
138
139 % Aggiunte di Mirko per la gestione delle tabelle complicate come immagini
140 % nella traslazione in HTML
141 \newenvironment{usepicture}{}{}{}{}
142
143 %%% Local Variables: 
144 %%% mode: latex
145 %%% TeX-master: "gapil"
146 %%% End: