source: project/wiki/eggref/4/blob-utils @ 35232

Last change on this file since 35232 was 35232, checked in by Kon Lovett, 4 years ago

rel 1.1.0

File size: 6.3 KB
Line 
1[[tags: egg]]
2
3== blob-utils
4
5[[toc:]]
6
7
8== Documentation
9
10=== Blob Hexadecimal
11
12Blob representation as a hexadecimal string.
13
14==== Usage
15
16<enscript language=scheme>
17(require-extension blob-hexadecimal)
18</enscript>
19
20==== blob->hex
21
22<procedure>(blob->hex BLOB [START [END]]) -> string</procedure>
23
24Returns a hexadecimal represenation of {{BLOB}}. {{START}} and {{END}} are
25subbyte limits.
26
27{{BLOB}} is treated as a string of bytes, a byte-vector.
28
29=== Blob Set Int
30
31Stuff integers into a blob.
32
33==== Usage
34
35<enscript language=scheme>
36(require-extension blob-set-int)
37</enscript>
38
39==== blob-set-u8!
40
41<procedure>(blob-set-u8! BLOB N [(OFFSET 0)])</procedure>
42
43Sets the byte at {{OFFSET}} to {{N}} in {{BLOB}}.
44
45==== blob-set-u16-le!
46
47<procedure>(blob-set-u16-le! BLOB N [(OFFSET 0)])</procedure>
48
49Sets the 2 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using little-endian byte order.
50
51==== blob-set-u16-be!
52
53<procedure>(blob-set-u16-be! BLOB N [(OFFSET 0)])</procedure>
54
55Sets the 2 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using big-endian byte order.
56
57==== blob-set-u32-le!
58
59<procedure>(blob-set-u32-le! BLOB N [(OFFSET 0)])</procedure>
60
61Sets the 4 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using little-endian byte order.
62
63==== blob-set-u32-be!
64
65<procedure>(blob-set-u32-be! BLOB N [(OFFSET 0)])</procedure>
66
67Sets the 4 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using big-endian byte order.
68
69==== blob-set-u64-le!
70
71<procedure>(blob-set-u64-le! BLOB N [(OFFSET 0)])</procedure>
72
73Sets the 8 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using little-endian byte order.
74
75==== blob-set-u64-be!
76
77<procedure>(blob-set-u64-be! BLOB N [(OFFSET 0)])</procedure>
78
79Sets the 8 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using big-endian byte order.
80
81==== *blob-set-u8!
82
83<procedure>(*blob-set-u8! BLOB N OFFSET)</procedure>
84
85Sets the byte at {{OFFSET}} to {{N}} in {{BLOB}}.
86
87Performs no argument checking.
88
89==== *blob-set-u16-le!
90
91<procedure>(*blob-set-u16-le! BLOB N OFFSET)</procedure>
92
93Sets the 2 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using little-endian byte order.
94
95Performs no argument checking.
96
97==== *blob-set-u16-be!
98
99<procedure>(*blob-set-u16-be! BLOB N OFFSET)</procedure>
100
101Sets the 2 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using big-endian byte order.
102
103Performs no argument checking.
104
105==== *blob-set-u32-le!
106
107<procedure>(*blob-set-u32-le! BLOB N OFFSET)</procedure>
108
109Sets the 4 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using little-endian byte order.
110
111Performs no argument checking.
112
113==== *blob-set-u32-be!
114
115<procedure>(*blob-set-u32-be! BLOB N OFFSET)</procedure>
116
117Sets the 4 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using big-endian byte order.
118
119Performs no argument checking.
120
121==== *blob-set-u64-le!
122
123<procedure>(*blob-set-u64-le! BLOB N OFFSET)</procedure>
124
125Sets the 8 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using little-endian byte order.
126
127Performs no argument checking.
128
129==== *blob-set-u64-be!
130
131<procedure>(*blob-set-u64-be! BLOB N OFFSET)</procedure>
132
133Sets the 8 bytes at {{OFFSET}} to {{N}} in {{BLOB}} using big-endian byte order.
134
135Performs no argument checking.
136
137=== Pack- Integer
138
139Blob representation as a hexadecimal string.
140
141==== Usage
142
143<enscript language=scheme>
144(require-extension pack-integer)
145</enscript>
146
147==== pack-u8
148
149<procedure>(pack-u8 N [kind: KIND] [start: START]) -> (or string blob u8vector)</procedure>
150
151Returns the number {{N}} packed into an object of {{KIND}}, at position {{START}}.
152
153; {{KIND}} : {{(or symbol (or string blob u8vector))}}
154; {{START}} : {{fixnum}} ; >= 0
155
156==== pack-u16
157
158<procedure>(pack-u16 N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)</procedure>
159
160Returns the number {{N}} packed into an object of {{KIND}}, at position {{START}}.
161
162; {{KIND}} : {{(or symbol (or string blob u8vector))}}
163; {{START}} : {{fixnum}} ; {{(<= 0 ...)}}
164; {{ORDER}} : {{symbol}} ; {{big-endian be big little-endian le little}}
165
166==== pack-u32
167
168<procedure>(pack-u32 N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)</procedure>
169
170Returns the number {{N}} packed into an object of {{KIND}}, at position {{START}}.
171
172; {{KIND}} : {{(or symbol (or string blob u8vector))}}
173; {{START}} : {{fixnum}} ; {{(<= 0 ...)}}
174; {{ORDER}} : {{symbol}} ; {{big-endian be big little-endian le little}}
175
176==== pack-u64
177
178<procedure>(pack-u64 N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)</procedure>
179
180Returns the number {{N}} packed into an object of {{KIND}}, at position {{START}}.
181
182; {{KIND}} : {{(or symbol (or string blob u8vector))}}
183; {{START}} : {{fixnum}} ; {{(<= 0 ...)}}
184; {{ORDER}} : {{symbol}} ; {{big-endian be big little-endian le little}}
185
186==== pack-integer
187
188<procedure>(pack-integer N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)</procedure>
189
190Returns the number {{N}} packed into an object of {{KIND}}, at position {{START}}.
191
192; {{KIND}} : {{(or symbol (or string blob u8vector))}}
193; {{START}} : {{fixnum}} ; {{(<= 0 ...)}}
194; {{ORDER}} : {{symbol}} ; {{big-endian be big little-endian le little}}
195
196
197== Requirements
198
199[[string-utils]]
200[[check-errors]]
201
202[[setup-helper]]
203[[test]]
204
205
206== Author
207
208[[/users/kon-lovett|Kon Lovett]]
209
210
211== Version history
212
213; 1.1.0 : Added {{pack-integer}} module.
214; 1.0.4 :
215; 1.0.3 : Reverted 64 bit support.
216; 1.0.2 : Removed 64 bit support.
217; 1.0.1 :
218; 1.0.0 : Hello (Some from string-utils)
219
220
221== License
222
223Copyright (C) 2012-2018 Kon Lovett.  All rights reserved.
224
225Permission is hereby granted, free of charge, to any person obtaining a
226copy of this software and associated documentation files (the Software),
227to deal in the Software without restriction, including without limitation
228the rights to use, copy, modify, merge, publish, distribute, sublicense,
229and/or sell copies of the Software, and to permit persons to whom the
230Software is furnished to do so, subject to the following conditions:
231
232The above copyright notice and this permission notice shall be included
233in all copies or substantial portions of the Software.
234
235THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
236IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
237FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
238THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
239OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
240ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
241OTHER DEALINGS IN THE SOFTWARE.
Note: See TracBrowser for help on using the repository browser.