File: functions.sty

package info (click to toggle)
psp 0.5.5-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 4,820 kB
  • ctags: 2,333
  • sloc: perl: 21,074; ansic: 4,553; sh: 2,407; makefile: 461; php: 11; pascal: 6
file content (102 lines) | stat: -rw-r--r-- 3,656 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
%
% definitions related to function declarations/displays
% Copyright (c) 2000, FundsXpress Financial Network, Inc.
% This library is free software released "AS IS WITH ALL FAULTS"
% and WITHOUT ANY WARRANTIES under the terms of the GNU Lesser
% General Public License, Version 2.1, a copy of which can be
% found in the "COPYING" file of this distribution.
%
\def\argfont{\it}

\let\funcfont=\bf
\newcount\argc@ount
%\setlength{\marginparsep}{0.05in}
%\setlength{\marginparwidth}{1.45in}
%
%  This function fixes up the function name to be displayed in the
%  margin so that the krb5_, if any, is stripped.
%
%  Note: this is a hack; what's really happening is that name beginning with
%	krb5 will have its first five characters stripped from it.
%	This means that 'Krb5abc' will get rewritten to be 'bc'.
%	Unfortunately, we can't do better because of the underscore
%	hacks that are going on elsewhere.
%
%  WARNING: This is ugly; don't look at it too soon after lunch!
%     [tytso:19900920.2231EDT]
\newif\if@krbfunc
\def\endkrb{}
\def\fix@parname#1{\expandafter\parse@krb#1\endkrb%
\endkrb\endkrb\endkrb\endkrb}%  In case the argument is less
%				than five letters, we don't want to 
%				lose on the argument parsing.
\def\parse@krb#1#2#3#4#5#6\endkrb{\@krbfuncfalse%
\if#1k\if#2r\if#3b\if#45\@krbfunctrue\fi\fi\fi\fi%
\if@krbfunc#6\else#1#2#3#4#5#6\fi}
%
% funcdecl is used as \begin{funcdecl}{funcname}{return type}{firstline}
%
% see fixunder.sty for comments on why the \underrealtrue & \underrealfalse
% stuff is here.
\newenvironment{funcdecl}[3]{\underrealtrue\index{#1}\underrealfalse%
\smallskip
\gdef\funcn@me{#1}
\argc@ount=0\noindent%
\begin{tabbing}
MMMMM\= \kill
\noindent {\bf #1}\\
\>(#2) \argc@ount=0 {#1}(\= \+ \+ #3%
}{)
\end{tabbing}\nopagebreak
}

\newcommand{\docomm@}{\ifnum\argc@ount >0, \\\fi}
\newcommand{\funcvoid}{\argc@ount=0}
\newcommand{\funcin}{\docomm@\argc@ount=0{\sl /* IN */}\\}
\newcommand{\funcinout}{\docomm@\argc@ount=0{\sl /* IN/OUT */}\\}
\newcommand{\funcout}{\docomm@\argc@ount=0{\sl /* OUT */}\\}
\newcommand{\funcarg}[2]{\docomm@#1 {\argfont #2}\advance\argc@ount by1}
\newcommand{\funcoptarg}[2]{\docomm@[#1 {\argfont #2}]\advance\argc@ount by1}
\newcommand{\funcparam}[1]{{\argfont #1}}
\newcommand{\funcoptparam}[1]{[{\argfont #1}]}
\newcommand{\funcfuncarg}[2]{\docomm@#1 {\argfont #2}(\= \+ \argc@ount=0}
\newcommand{\funcendfuncarg}{), \- \\ \argc@ount=0}
\newcommand{\libname}[1]{{\argfont #1}}
\newcommand{\globalname}[1]{{\argfont #1}}
\newcommand{\ptsto}{->\discretionary{}{}{}}
\newcommand{\datatype}[1]{{\bf #1}}
\newcommand{\filename}[1]{{\sl #1\/}}

\newcommand{\funcname}[1]{\underrealtrue\index{#1}\underrealfalse{\funcfont #1}()}
\newcommand{\funcnamenoparens}[1]{\underrealtrue\index{#1}\underrealfalse{\funcfont #1}}
% the following can be used when several arguments of the same type
% are returned (e.g., instead of (string, string, string) will show
% (string foo, string bar, string baz))
\newcommand{\namedarg}[2]{#1 {\argfont #2}}

\newenvironment{hashfunc}[2]
  {\medskip \noindent \argc@ount=0 \tabcolsep=.1em \begin{tabular}{l@{}lll} (#2) #1 (}
  {\unskip ) \end{tabular}\par}
\newcommand\hashreq[2]{%
  \ifnum\argc@ount>0 \unskip ,\\ \fi
  & #2 & $\Rightarrow$ & \emph{#1}%
  \advance\argc@ount by 1%
}
\newcommand\hashopt[2]{\hashreq{#1{\rm]}}{[#2}}

\newenvironment{doc}
{\begin{list}{}%
  {\setlength{\leftmargin}{4.25em}%
  \setlength{\topsep}{1pt}%
  \setlength{\partopsep}{1pt}%
  }%
    \item[]}
 {\end{list}}


\newenvironment{keylist}{\begin{tabular}{lllp{10 cm}}\\}
{ \end{tabular}\\ \\}
\newcommand{\hashkey}[3]{%
   #2 & $\Rightarrow$ & \emph{#1} &  #3  \\%
}