comparison lispref/processes.texi @ 71035:3574bac9e172

(Bindat Functions): Rename `pos' and `raw-data' to `bindat-idx' and `bindat-raw' for clarity.
author Kim F. Storm <storm@cua.dk>
date Sun, 28 May 2006 22:20:49 +0000
parents 442f0e624b27
children 4b4feab31516 a8190f7e546e
comparison
equal deleted inserted replaced
71034:ab929ce998c3 71035:3574bac9e172
2183 Evaluate @var{form}, a Lisp expression, for side-effect only. If the 2183 Evaluate @var{form}, a Lisp expression, for side-effect only. If the
2184 field name is specified, the value is bound to that field name. 2184 field name is specified, the value is bound to that field name.
2185 @var{form} can access and update these dynamically bound variables: 2185 @var{form} can access and update these dynamically bound variables:
2186 2186
2187 @table @code 2187 @table @code
2188 @item raw-data 2188 @item bindat-raw
2189 The data as a byte array. 2189 The data as a byte array.
2190 2190
2191 @item pos 2191 @item bindat-idx
2192 Current position of the unpacking or packing operation. 2192 Current index into bindat-raw of the unpacking or packing operation.
2193 2193
2194 @item struct 2194 @item struct
2195 Alist. 2195 Alist.
2196 2196
2197 @item last 2197 @item last
2241 2241
2242 @node Bindat Functions 2242 @node Bindat Functions
2243 @subsection Functions to Unpack and Pack Bytes 2243 @subsection Functions to Unpack and Pack Bytes
2244 2244
2245 In the following documentation, @var{spec} refers to a data layout 2245 In the following documentation, @var{spec} refers to a data layout
2246 specification, @code{raw-data} to a byte array, and @var{struct} to an 2246 specification, @code{bindat-raw} to a byte array, and @var{struct} to an
2247 alist representing unpacked field data. 2247 alist representing unpacked field data.
2248 2248
2249 @defun bindat-unpack spec raw-data &optional pos 2249 @defun bindat-unpack spec bindat-raw &optional bindat-idx
2250 This function unpacks data from the unibyte string or byte 2250 This function unpacks data from the unibyte string or byte
2251 array @code{raw-data} 2251 array @code{bindat-raw}
2252 according to @var{spec}. Normally this starts unpacking at the 2252 according to @var{spec}. Normally this starts unpacking at the
2253 beginning of the byte array, but if @var{pos} is non-@code{nil}, it 2253 beginning of the byte array, but if @var{bindat-idx} is non-@code{nil}, it
2254 specifies a zero-based starting position to use instead. 2254 specifies a zero-based starting position to use instead.
2255 2255
2256 The value is an alist or nested alist in which each element describes 2256 The value is an alist or nested alist in which each element describes
2257 one unpacked field. 2257 one unpacked field.
2258 @end defun 2258 @end defun
2281 @defun bindat-length spec struct 2281 @defun bindat-length spec struct
2282 This function returns the total length of the data in @var{struct}, 2282 This function returns the total length of the data in @var{struct},
2283 according to @var{spec}. 2283 according to @var{spec}.
2284 @end defun 2284 @end defun
2285 2285
2286 @defun bindat-pack spec struct &optional raw-data pos 2286 @defun bindat-pack spec struct &optional bindat-raw bindat-idx
2287 This function returns a byte array packed according to @var{spec} from 2287 This function returns a byte array packed according to @var{spec} from
2288 the data in the alist @var{struct}. Normally it creates and fills a 2288 the data in the alist @var{struct}. Normally it creates and fills a
2289 new byte array starting at the beginning. However, if @var{raw-data} 2289 new byte array starting at the beginning. However, if @var{bindat-raw}
2290 is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to 2290 is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to
2291 pack into. If @var{pos} is non-@code{nil}, it specifies the starting 2291 pack into. If @var{bindat-idx} is non-@code{nil}, it specifies the starting
2292 offset for packing into @code{raw-data}. 2292 offset for packing into @code{bindat-raw}.
2293 2293
2294 When pre-allocating, you should make sure @code{(length @var{raw-data})} 2294 When pre-allocating, you should make sure @code{(length @var{bindat-raw})}
2295 meets or exceeds the total length to avoid an out-of-range error. 2295 meets or exceeds the total length to avoid an out-of-range error.
2296 @end defun 2296 @end defun
2297 2297
2298 @defun bindat-ip-to-string ip 2298 @defun bindat-ip-to-string ip
2299 Convert the Internet address vector @var{ip} to a string in the usual 2299 Convert the Internet address vector @var{ip} to a string in the usual