source: project/wiki/eggref/4/endian-blob @ 26447

Last change on this file since 26447 was 26447, checked in by Ivan Raikov, 9 years ago

endian-blob version history update

File size: 4.8 KB
Line 
1[[tags: eggs]]
2[[toc:]]
3
4== endian-blob
5
6=== Description
7
8{{endian-blob}} is a library of endian-specific procedures for
9converting blobs to numeric values and vectors.
10
11=== Library Procedures
12
13==== Predicates and constants
14
15<procedure>(endian-blob? X) => BOOL</procedure>
16
17Returns {{#t}} if the given object is an endian blob, {{#f}}
18otherwise.
19
20* {{MSB}}
21* {{LSB}}
22
23These constants specify most-significant or least-significant byte
24order, respectively.
25
26==== Converting to and from byte blobs
27
28<procedure>(byte-blob->endian-blob BYTE-BLOB BYTE-ORDER)</procedure>
29
30Returns an endian blob containing the given byte-blob. Argument
31{{BYTE-ORDER}} is one of {{MSB}} or {{LSB}}.
32
33==== Converting to and from numbers and numeric vectors
34
35<procedure>(endian-blob->sint1 ENDIAN-BLOB) => NUMBER</procedure><br>
36<procedure>(endian-blob->sint2 ENDIAN-BLOB) => NUMBER</procedure><br>
37<procedure>(endian-blob->sint4 ENDIAN-BLOB) => NUMBER</procedure><br>
38<procedure>(sint1->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
39<procedure>(sint2->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
40<procedure>(sint4->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
41
42These procedures convert between endian blobs and signed integers of
43size 1, 2, or 4 bytes, respectively. Exceptions are thrown if the
44given endian blobs are of incorrect size, or if the given numbers are
45too big to fit in the specified size.
46
47<procedure>(endian-blob->uint1 ENDIAN-BLOB) => NUMBER</procedure><br>
48<procedure>(endian-blob->uint2 ENDIAN-BLOB) => NUMBER</procedure><br>
49<procedure>(endian-blob->uint4 ENDIAN-BLOB) => NUMBER</procedure><br>
50<procedure>(uint1->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
51<procedure>(uint2->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
52<procedure>(uint4->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
53
54These procedures convert between endian blobs and unsigned integers of
55size 1, 2, or 4 bytes, respectively. Exceptions are thrown if the
56given endian blobs are of incorrect size, or if the given numbers are
57too big to fit in the specified size.
58
59<procedure>(endian-blob->ieee_float32 ENDIAN-BLOB) => NUMBER</procedure><br>
60<procedure>(endian-blob->ieee_float64 ENDIAN-BLOB) => NUMBER</procedure><br>
61<procedure>(ieee_float32->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
62<procedure>(ieee_float64->endian-blob NUMBER) => ENDIAN-BLOB</procedure><br>
63
64These procedures convert between endian blobs and IEEE floating point
65numbers of single or double precision, respectively. Exceptions are
66thrown if the given endian blobs are of incorrect size, or if the
67given numbers are too big to fit in the specified size.
68
69<procedure>(endian-blob->s8vector ENDIAN-BLOB) => S8VECTOR</procedure><br>
70<procedure>(endian-blob->s16vector ENDIAN-BLOB) => S16VECTOR</procedure><br>
71<procedure>(endian-blob->s32vector ENDIAN-BLOB) => S32VECTOR</procedure><br>
72<procedure>(endian-blob->u8vector ENDIAN-BLOB) => U8VECTOR</procedure><br>
73<procedure>(endian-blob->u16vector ENDIAN-BLOB) => U16VECTOR</procedure><br>
74<procedure>(endian-blob->u32vector ENDIAN-BLOB) => U32VECTOR</procedure><br>
75<procedure>(endian-blob->f32vector ENDIAN-BLOB) => F32VECTOR</procedure><br>
76<procedure>(endian-blob->f64vector ENDIAN-BLOB) => F64VECTOR</procedure><br>
77<procedure>(s8vector->endian-blob S8VECTOR) => ENDIAN-BLOB</procedure><br>
78<procedure>(s16vector->endian-blob S16VECTOR) => ENDIAN-BLOB</procedure><br>
79<procedure>(s32vector->endian-blob S32VECTOR) => ENDIAN-BLOB</procedure><br>
80<procedure>(u8vector->endian-blob U8VECTOR) => ENDIAN-BLOB</procedure><br>
81<procedure>(u16vector->endian-blob U16VECTOR) => ENDIAN-BLOB</procedure><br>
82<procedure>(u32vector->endian-blob U32VECTOR) => ENDIAN-BLOB</procedure><br>
83<procedure>(f32vector->endian-blob F32VECTOR) => ENDIAN-BLOB</procedure><br>
84<procedure>(f64vector->endian-blob F64VECTOR) => ENDIAN-BLOB</procedure><br>
85
86These procedures convert between endian blobs and the corresponding
87SRFI-4 vector type.
88
89=== Version History
90
91* 1.3 Added procedure endian-blob-length
92* 1.2 Fixed a bug in uint2->endian-blob (thanks to Shawn Rutledge)
93* 1.1 Some small optimizations
94* 1.0 Initial release
95
96=== License
97
98Copyright 2009-2012 Ivan Raikov.
99
100endian-port is based on routines from the C++ advanced I/O library and
101TIFF reader written by Oleg Kiselyov, as well as the floating-point
102I/O routines from GDB.
103
104endian-port is free software: you can redistribute it and/or modify
105it under the terms of the GNU General Public License as published by
106the Free Software Foundation, either version 3 of the License, or (at
107your option) any later version.
108
109endian-port is distributed in the hope that it will be useful, but
110WITHOUT ANY WARRANTY; without even the implied warranty of
111MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
112General Public License for more details.
113
114A full copy of the GPL license can be found at
115<http://www.gnu.org/licenses/>.
Note: See TracBrowser for help on using the repository browser.