diff options
| author | Richard M. Stallman | 2006-09-08 11:59:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-09-08 11:59:33 +0000 |
| commit | 3ac5a59d71e23392cdc31f609a9ce32e80f42dfd (patch) | |
| tree | a866a51917e02559c67cae7e4adca0b5743da601 | |
| parent | e3d47a1509af730e944e6d45b7aeb1a4c2c57d1f (diff) | |
| download | emacs-3ac5a59d71e23392cdc31f609a9ce32e80f42dfd.tar.gz emacs-3ac5a59d71e23392cdc31f609a9ce32e80f42dfd.zip | |
(bindat-unpack): Doc fix.
| -rw-r--r-- | lisp/emacs-lisp/bindat.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 1b37f3f772f..792272ef88a 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el | |||
| @@ -66,13 +66,13 @@ | |||
| 66 | ;; | 66 | ;; |
| 67 | ;; The corresponding Lisp bindat specification looks like this: | 67 | ;; The corresponding Lisp bindat specification looks like this: |
| 68 | ;; | 68 | ;; |
| 69 | ;; (setq header-spec | 69 | ;; (setq header-bindat-spec |
| 70 | ;; '((dest-ip ip) | 70 | ;; '((dest-ip ip) |
| 71 | ;; (src-ip ip) | 71 | ;; (src-ip ip) |
| 72 | ;; (dest-port u16) | 72 | ;; (dest-port u16) |
| 73 | ;; (src-port u16))) | 73 | ;; (src-port u16))) |
| 74 | ;; | 74 | ;; |
| 75 | ;; (setq data-spec | 75 | ;; (setq data-bindat-spec |
| 76 | ;; '((type u8) | 76 | ;; '((type u8) |
| 77 | ;; (opcode u8) | 77 | ;; (opcode u8) |
| 78 | ;; (length u16r) ;; little endian order | 78 | ;; (length u16r) ;; little endian order |
| @@ -80,12 +80,12 @@ | |||
| 80 | ;; (data vec (length)) | 80 | ;; (data vec (length)) |
| 81 | ;; (align 4))) | 81 | ;; (align 4))) |
| 82 | ;; | 82 | ;; |
| 83 | ;; (setq packet-spec | 83 | ;; (setq packet-bindat-spec |
| 84 | ;; '((header struct header-spec) | 84 | ;; '((header struct header-bindat-spec) |
| 85 | ;; (items u8) | 85 | ;; (items u8) |
| 86 | ;; (fill 3) | 86 | ;; (fill 3) |
| 87 | ;; (item repeat (items) | 87 | ;; (item repeat (items) |
| 88 | ;; (struct data-spec)))) | 88 | ;; (struct data-bindat-spec)))) |
| 89 | ;; | 89 | ;; |
| 90 | ;; | 90 | ;; |
| 91 | ;; A binary data representation may look like | 91 | ;; A binary data representation may look like |
| @@ -121,6 +121,9 @@ | |||
| 121 | ;; Binary Data Structure Specification Format | 121 | ;; Binary Data Structure Specification Format |
| 122 | ;; ------------------------------------------ | 122 | ;; ------------------------------------------ |
| 123 | 123 | ||
| 124 | ;; We recommend using names that end in `-bindat-spec'; such names | ||
| 125 | ;; are recognized automatically as "risky" variables. | ||
| 126 | |||
| 124 | ;; The data specification is formatted as follows: | 127 | ;; The data specification is formatted as follows: |
| 125 | 128 | ||
| 126 | ;; SPEC ::= ( ITEM... ) | 129 | ;; SPEC ::= ( ITEM... ) |
| @@ -342,8 +345,8 @@ | |||
| 342 | 345 | ||
| 343 | (defun bindat-unpack (spec bindat-raw &optional bindat-idx) | 346 | (defun bindat-unpack (spec bindat-raw &optional bindat-idx) |
| 344 | "Return structured data according to SPEC for binary data in BINDAT-RAW. | 347 | "Return structured data according to SPEC for binary data in BINDAT-RAW. |
| 345 | BINDAT-RAW is a unibyte string or vector. Optional third arg BINDAT-IDX specifies | 348 | BINDAT-RAW is a unibyte string or vector. |
| 346 | the starting offset in BINDAT-RAW." | 349 | Optional third arg BINDAT-IDX specifies the starting offset in BINDAT-RAW." |
| 347 | (when (multibyte-string-p bindat-raw) | 350 | (when (multibyte-string-p bindat-raw) |
| 348 | (error "String is multibyte")) | 351 | (error "String is multibyte")) |
| 349 | (unless bindat-idx (setq bindat-idx 0)) | 352 | (unless bindat-idx (setq bindat-idx 0)) |