-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinary_read_notes
More file actions
135 lines (88 loc) · 2.54 KB
/
binary_read_notes
File metadata and controls
135 lines (88 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
appendable arrays:
- processing pngs
-
struct chunk {
u32be length @add_to(.type);
char[4] type;
when(.type) {
"IHDR" -> ihdr_type,
"gAMA" -> u32be,
else -> u8[.length]
} data @array_print(10, -, -, 0, 0) @add_to(.type);
u32 crc;
}
struct png_file {
i8[8] png_sig @array_print(-, -, -, 0, 0);
chunk[?] chunks;
}
- this needs reading the entire struct/array before determining if it should be appendable
New addtions: ?
- appendable arrays?
- position of specific items in the stream? maybe?
- position_of(variable)
- seek_to(position_of(var))
Todo:
- print a value in hex or binary or oct - Done
- @print_option(hex)
- printing values - done
- limit array size, etc.
- no printing at all
- print number of items per row
- sizeof_byte, sizeof_bit (variable) ~ maybe?
- needed for dynamically changing fields
===========================================================
- conditional reads - done
- depend on another field for reading
- if X == Y read otherwise skip
- When types
- check item and read based on value
=================================================================
Optional reads
if(peek(typename)) {
}
================================================================
>8 && <2
(!>i+2) && (< i - 1) || |2 && &2 )
>1
=============================================================
New Additions:
- assert
- check if a value is a specific thing?
- global turn off assert?
- turn off assert for specific struct?
syntax:
@assert( 0 ) == normal val check
@assert("BM") == string checking
@assert([ 1, 2 ]) == array checking
i32 val @assert(some_val);
struct assert_test {
i32 val1 @assert(2);
i8 val2 @assert( 10 );
}
i32 val1 @assert( 0 ); val1 == 0 //implicit equal
i32 val1 @assert( ==0 ); val1 == 0 //explicit equal
i32 val1 @assert( >=0 ); val1 >= 0 //explicit equal
i32 val1 @assert( 0 && 1 ); val1 >= 0 // and
-Todo
- multiple checks
- bitfield check? maybe
- Done
- peek - done
- output val without reading? (read and rewind)
- could be used for ifs
- conditional reads
- depend on another field for reading
- if X == Y read otherwise skip
- array size dependency - done
- specify array size in terms of data fields
- creates dependency ->
- don't read "until" specific field has a value?
- out of order specification?
- unions/conditional structs? - conditon
- ???
- enums - done
- good for easier flag/bit checking
- skip - maybe
- rename to "skip_bits" and also add "skip_bytes"
---
text editor