Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6250205

Browse files
committed
Use {methoddesc} instead of {funcdesc} for object methods.
1 parent 898601b commit 6250205

2 files changed

Lines changed: 112 additions & 108 deletions

File tree

Doc/lib/libxdrlib.tex

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ \subsection{Packer Objects}
3232

3333
\class{Packer} instances have the following methods:
3434

35-
\begin{funcdesc}{get_buffer}{}
35+
\begin{methoddesc}[Packer]{get_buffer}{}
3636
Returns the current pack buffer as a string.
37-
\end{funcdesc}
37+
\end{methoddesc}
3838

39-
\begin{funcdesc}{reset}{}
39+
\begin{methoddesc}[Packer]{reset}{}
4040
Resets the pack buffer to the empty string.
41-
\end{funcdesc}
41+
\end{methoddesc}
4242

4343
In general, you can pack any of the most common XDR data types by
4444
calling the appropriate \code{pack_\var{type}()} method. Each method
@@ -47,161 +47,163 @@ \subsection{Packer Objects}
4747
\method{pack_int()}, \method{pack_enum()}, \method{pack_bool()},
4848
\method{pack_uhyper()}, and \method{pack_hyper()}.
4949

50-
\begin{funcdesc}{pack_float}{value}
50+
\begin{methoddesc}[Packer]{pack_float}{value}
5151
Packs the single-precision floating point number \var{value}.
52-
\end{funcdesc}
52+
\end{methoddesc}
5353

54-
\begin{funcdesc}{pack_double}{value}
54+
\begin{methoddesc}[Packer]{pack_double}{value}
5555
Packs the double-precision floating point number \var{value}.
56-
\end{funcdesc}
56+
\end{methoddesc}
5757

5858
The following methods support packing strings, bytes, and opaque data:
5959

60-
\begin{funcdesc}{pack_fstring}{n, s}
60+
\begin{methoddesc}[Packer]{pack_fstring}{n, s}
6161
Packs a fixed length string, \var{s}. \var{n} is the length of the
6262
string but it is \emph{not} packed into the data buffer. The string
6363
is padded with null bytes if necessary to guaranteed 4 byte alignment.
64-
\end{funcdesc}
64+
\end{methoddesc}
6565

66-
\begin{funcdesc}{pack_fopaque}{n, data}
66+
\begin{methoddesc}[Packer]{pack_fopaque}{n, data}
6767
Packs a fixed length opaque data stream, similarly to
6868
\method{pack_fstring()}.
69-
\end{funcdesc}
69+
\end{methoddesc}
7070

71-
\begin{funcdesc}{pack_string}{s}
71+
\begin{methoddesc}[Packer]{pack_string}{s}
7272
Packs a variable length string, \var{s}. The length of the string is
7373
first packed as an unsigned integer, then the string data is packed
7474
with \method{pack_fstring()}.
75-
\end{funcdesc}
75+
\end{methoddesc}
7676

77-
\begin{funcdesc}{pack_opaque}{data}
77+
\begin{methoddesc}[Packer]{pack_opaque}{data}
7878
Packs a variable length opaque data string, similarly to
7979
\method{pack_string()}.
80-
\end{funcdesc}
80+
\end{methoddesc}
8181

82-
\begin{funcdesc}{pack_bytes}{bytes}
82+
\begin{methoddesc}[Packer]{pack_bytes}{bytes}
8383
Packs a variable length byte stream, similarly to \method{pack_string()}.
84-
\end{funcdesc}
84+
\end{methoddesc}
8585

8686
The following methods support packing arrays and lists:
8787

88-
\begin{funcdesc}{pack_list}{list, pack_item}
88+
\begin{methoddesc}[Packer]{pack_list}{list, pack_item}
8989
Packs a \var{list} of homogeneous items. This method is useful for
9090
lists with an indeterminate size; i.e. the size is not available until
9191
the entire list has been walked. For each item in the list, an
9292
unsigned integer \code{1} is packed first, followed by the data value
9393
from the list. \var{pack_item} is the function that is called to pack
9494
the individual item. At the end of the list, an unsigned integer
9595
\code{0} is packed.
96-
\end{funcdesc}
96+
\end{methoddesc}
9797

98-
\begin{funcdesc}{pack_farray}{n, array, pack_item}
98+
\begin{methoddesc}[Packer]{pack_farray}{n, array, pack_item}
9999
Packs a fixed length list (\var{array}) of homogeneous items. \var{n}
100100
is the length of the list; it is \emph{not} packed into the buffer,
101101
but a \exception{ValueError} exception is raised if
102102
\code{len(\var{array})} is not equal to \var{n}. As above,
103103
\var{pack_item} is the function used to pack each element.
104-
\end{funcdesc}
104+
\end{methoddesc}
105105

106-
\begin{funcdesc}{pack_array}{list, pack_item}
106+
\begin{methoddesc}[Packer]{pack_array}{list, pack_item}
107107
Packs a variable length \var{list} of homogeneous items. First, the
108108
length of the list is packed as an unsigned integer, then each element
109109
is packed as in \method{pack_farray()} above.
110-
\end{funcdesc}
110+
\end{methoddesc}
111+
111112

112113
\subsection{Unpacker Objects}
113114
\label{xdr-unpacker-objects}
114115

115116
The \class{Unpacker} class offers the following methods:
116117

117-
\begin{funcdesc}{reset}{data}
118+
\begin{methoddesc}[Unpacker]{reset}{data}
118119
Resets the string buffer with the given \var{data}.
119-
\end{funcdesc}
120+
\end{methoddesc}
120121

121-
\begin{funcdesc}{get_position}{}
122+
\begin{methoddesc}[Unpacker]{get_position}{}
122123
Returns the current unpack position in the data buffer.
123-
\end{funcdesc}
124+
\end{methoddesc}
124125

125-
\begin{funcdesc}{set_position}{position}
126+
\begin{methoddesc}[Unpacker]{set_position}{position}
126127
Sets the data buffer unpack position to \var{position}. You should be
127128
careful about using \method{get_position()} and \method{set_position()}.
128-
\end{funcdesc}
129+
\end{methoddesc}
129130

130-
\begin{funcdesc}{get_buffer}{}
131+
\begin{methoddesc}[Unpacker]{get_buffer}{}
131132
Returns the current unpack data buffer as a string.
132-
\end{funcdesc}
133+
\end{methoddesc}
133134

134-
\begin{funcdesc}{done}{}
135+
\begin{methoddesc}[Unpacker]{done}{}
135136
Indicates unpack completion. Raises an \exception{Error} exception
136137
if all of the data has not been unpacked.
137-
\end{funcdesc}
138+
\end{methoddesc}
138139

139140
In addition, every data type that can be packed with a \class{Packer},
140141
can be unpacked with an \class{Unpacker}. Unpacking methods are of the
141142
form \code{unpack_\var{type}()}, and take no arguments. They return the
142143
unpacked object.
143144

144-
\begin{funcdesc}{unpack_float}{}
145+
\begin{methoddesc}[Unpacker]{unpack_float}{}
145146
Unpacks a single-precision floating point number.
146-
\end{funcdesc}
147+
\end{methoddesc}
147148

148-
\begin{funcdesc}{unpack_double}{}
149+
\begin{methoddesc}[Unpacker]{unpack_double}{}
149150
Unpacks a double-precision floating point number, similarly to
150151
\method{unpack_float()}.
151-
\end{funcdesc}
152+
\end{methoddesc}
152153

153154
In addition, the following methods unpack strings, bytes, and opaque
154155
data:
155156

156-
\begin{funcdesc}{unpack_fstring}{n}
157+
\begin{methoddesc}[Unpacker]{unpack_fstring}{n}
157158
Unpacks and returns a fixed length string. \var{n} is the number of
158159
characters expected. Padding with null bytes to guaranteed 4 byte
159160
alignment is assumed.
160-
\end{funcdesc}
161+
\end{methoddesc}
161162

162-
\begin{funcdesc}{unpack_fopaque}{n}
163+
\begin{methoddesc}[Unpacker]{unpack_fopaque}{n}
163164
Unpacks and returns a fixed length opaque data stream, similarly to
164165
\method{unpack_fstring()}.
165-
\end{funcdesc}
166+
\end{methoddesc}
166167

167-
\begin{funcdesc}{unpack_string}{}
168+
\begin{methoddesc}[Unpacker]{unpack_string}{}
168169
Unpacks and returns a variable length string. The length of the
169170
string is first unpacked as an unsigned integer, then the string data
170171
is unpacked with \method{unpack_fstring()}.
171-
\end{funcdesc}
172+
\end{methoddesc}
172173

173-
\begin{funcdesc}{unpack_opaque}{}
174+
\begin{methoddesc}[Unpacker]{unpack_opaque}{}
174175
Unpacks and returns a variable length opaque data string, similarly to
175176
\method{unpack_string()}.
176-
\end{funcdesc}
177+
\end{methoddesc}
177178

178-
\begin{funcdesc}{unpack_bytes}{}
179+
\begin{methoddesc}[Unpacker]{unpack_bytes}{}
179180
Unpacks and returns a variable length byte stream, similarly to
180181
\method{unpack_string()}.
181-
\end{funcdesc}
182+
\end{methoddesc}
182183

183184
The following methods support unpacking arrays and lists:
184185

185-
\begin{funcdesc}{unpack_list}{unpack_item}
186+
\begin{methoddesc}[Unpacker]{unpack_list}{unpack_item}
186187
Unpacks and returns a list of homogeneous items. The list is unpacked
187188
one element at a time
188189
by first unpacking an unsigned integer flag. If the flag is \code{1},
189190
then the item is unpacked and appended to the list. A flag of
190191
\code{0} indicates the end of the list. \var{unpack_item} is the
191192
function that is called to unpack the items.
192-
\end{funcdesc}
193+
\end{methoddesc}
193194

194-
\begin{funcdesc}{unpack_farray}{n, unpack_item}
195+
\begin{methoddesc}[Unpacker]{unpack_farray}{n, unpack_item}
195196
Unpacks and returns (as a list) a fixed length array of homogeneous
196197
items. \var{n} is number of list elements to expect in the buffer.
197198
As above, \var{unpack_item} is the function used to unpack each element.
198-
\end{funcdesc}
199+
\end{methoddesc}
199200

200-
\begin{funcdesc}{unpack_array}{unpack_item}
201+
\begin{methoddesc}[Unpacker]{unpack_array}{unpack_item}
201202
Unpacks and returns a variable length \var{list} of homogeneous items.
202203
First, the length of the list is unpacked as an unsigned integer, then
203204
each element is unpacked as in \method{unpack_farray()} above.
204-
\end{funcdesc}
205+
\end{methoddesc}
206+
205207

206208
\subsection{Exceptions}
207209
\nodename{Exceptions in xdrlib module}

0 commit comments

Comments
 (0)