Transizione \macro{} -> \const{}, \errcode{}, \val{}
[gapil.git] / macro.tex
1 %% macro.tex
2 %%
3 %% Copyright (C) 2000-2002 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   \center
59   \begin{boxedminipage}[c]{14cm}
60   \footnotesize
61     \begin{description*}{}{} 
62     \item \texttt{\#include <#1>}
63     \item \texttt{#2} \par
64 %   \begin{lstlisting}{}
65 % #1
66 % #2
67 %   \end{lstlisting}
68 }
69 {% defining what is done by \end
70 %  \end{list} 
71 %  \par 
72 \end{description*}
73 \end{boxedminipage}
74 \vspace{6pt}
75 \par
76 \normalsize 
77 }
78 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.5cm}}}
79 {\end{basedescript}}
80 %
81 % Slighty different envirnoment to be used for multi-header, 
82 % multi-functions boxed description
83 %
84 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
85 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
86 \newcommand{\bodydesc}[1]{\par \end{description*} #1
87  \begin{description*}{}{} \baselineskip=0pt
88  \item \vspace{-4pt}
89
90
91 \newenvironment{functions}
92 {% defining what is done by \begin
93   \center
94     \begin{boxedminipage}[c]{14cm}
95       \footnotesize
96     \begin{description*}{}{} 
97 }
98 {% defining what is done by \end
99       \end{description*}
100     \end{boxedminipage}
101     \vspace{6pt}
102      \par
103     \normalsize 
104 %\break
105 }
106 %
107 % Wrapper for shell command, functions, filenames, links,
108 % variables, macros,  and everything can be useul, 
109 %
110 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
111 \newcommand{\code}[1]{\texttt{#1}}    % for simple code
112 \newcommand{\func}[1]{%
113 \index{#1@{{\tt {#1}} (funzione)}}\texttt{#1}%
114 }
115 \newcommand{\macro}[1]{%
116 \index{#1@{{\tt {#1}} (macro)}}\texttt{#1}
117 }                                     % macro constant
118 \newcommand{\errcode}[1]{%
119 \index{#1@{{\tt {#1}} (errore)}}\texttt{#1}%
120 }                                     % macro constant
121 \newcommand{\var}[1]{\texttt{#1}}     % variable 
122 \newcommand{\val}[1]{\texttt{#1}}     % value 
123 \newcommand{\const}[1]{
124 \index{#1@{{\tt {#1}} (costante)}}\texttt{#1}
125 }                                     % constant name
126 \newcommand{\file}[1]{\texttt{#1}}    % file name
127 \newcommand{\link}[1]{\texttt{#1}}    % html link
128 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
129 \newcommand{\type}[1]{%
130 \index{#1@{{\tt {#1}} (tipo)}}\texttt{#1}%
131 }                                     % system type
132 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
133 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, etc.)
134
135
136 %%% Local Variables: 
137 %%% mode: latex
138 %%% TeX-master: "gapil"
139 %%% End: