diff options
| author | Thien-Thi Nguyen | 2006-05-27 00:49:32 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2006-05-27 00:49:32 +0000 |
| commit | f1b64ef1e59bad4490248e41da92affdca31e7ac (patch) | |
| tree | 1de6b8f8c3bd47b75c2bf4704934fd18c0c7b332 | |
| parent | 27af5d58f03d7792b0942cd1d57524f5fc8e469f (diff) | |
| download | emacs-f1b64ef1e59bad4490248e41da92affdca31e7ac.tar.gz emacs-f1b64ef1e59bad4490248e41da92affdca31e7ac.zip | |
(Bindat Functions): Explain term "total length".
Use it in `bindat-length' and `bindat-pack' descriptions.
| -rw-r--r-- | lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | lispref/processes.texi | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index a4bbd6b535e..53f5fd597af 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2006-05-27 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 2 | |||
| 3 | * processes.texi (Bindat Functions): Explain term "total length". | ||
| 4 | Use it in bindat-length and bindat-pack descriptions. | ||
| 5 | |||
| 1 | 2006-05-26 Eli Zaretskii <eliz@gnu.org> | 6 | 2006-05-26 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * tips.texi (Coding Conventions): Advise against using | 8 | * tips.texi (Coding Conventions): Advise against using |
diff --git a/lispref/processes.texi b/lispref/processes.texi index 501c4a65c57..64b5bdd77bd 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi | |||
| @@ -2268,10 +2268,17 @@ field @code{c} in the third element of subfield @code{b} of field | |||
| 2268 | @code{a}. (This corresponds to @code{struct.a.b[2].c} in C.) | 2268 | @code{a}. (This corresponds to @code{struct.a.b[2].c} in C.) |
| 2269 | @end defun | 2269 | @end defun |
| 2270 | 2270 | ||
| 2271 | Although packing and unpacking operations change the organization of | ||
| 2272 | data (in memory), they preserve the data's @dfn{total length}, which is | ||
| 2273 | the sum of all the fields' lengths, in bytes. This value is not | ||
| 2274 | generally inherent in either the specification or alist alone; instead, | ||
| 2275 | both pieces of information contribute to its calculation. Likewise, the | ||
| 2276 | length of a string or array being unpacked may be longer than the data's | ||
| 2277 | total length as described by the specification. | ||
| 2278 | |||
| 2271 | @defun bindat-length spec struct | 2279 | @defun bindat-length spec struct |
| 2272 | @c ??? I don't understand this at all -- rms | 2280 | This function returns the total length of the data in @var{struct}, |
| 2273 | This function returns the length in bytes of @var{struct}, according | 2281 | according to @var{spec}. |
| 2274 | to @var{spec}. | ||
| 2275 | @end defun | 2282 | @end defun |
| 2276 | 2283 | ||
| 2277 | @defun bindat-pack spec struct &optional raw-data pos | 2284 | @defun bindat-pack spec struct &optional raw-data pos |
| @@ -2281,6 +2288,9 @@ new byte array starting at the beginning. However, if @var{raw-data} | |||
| 2281 | is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to | 2288 | is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to |
| 2282 | pack into. If @var{pos} is non-@code{nil}, it specifies the starting | 2289 | pack into. If @var{pos} is non-@code{nil}, it specifies the starting |
| 2283 | offset for packing into @code{raw-data}. | 2290 | offset for packing into @code{raw-data}. |
| 2291 | |||
| 2292 | When pre-allocating, you should make sure @code{(length @var{raw-data})} | ||
| 2293 | meets or exceeds the total length to avoid an out-of-range error. | ||
| 2284 | @end defun | 2294 | @end defun |
| 2285 | 2295 | ||
| 2286 | @defun bindat-ip-to-string ip | 2296 | @defun bindat-ip-to-string ip |