You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source: An expression which evaluates to binary data.
26
26
Target: An expression which evaluates to a binary container.
27
-
28
-
Example:
29
-
variable tData as data
30
-
variable tPrefixData as data
31
-
...
32
-
put tPrefixData before tData
33
27
28
+
Description:
29
+
Use to insert bytes into data without replacement. Can be used either with a chunk expression to insert at a specified location, or without to prepend to the target data.
Source: An expression which evaluates to binary data.
46
44
Target: An expression which evaluates to a binary container.
47
45
48
-
Example: put tSuffixData after tData
49
-
50
46
Related: PutBytesAfter
47
+
48
+
Description:
49
+
Use to insert bytes into data without replacement. Can be used either with a chunk expression to insert at a specified location, or without to append to the target data.
50
+
51
+
Tags: Binary
51
52
*/
52
53
53
54
syntax PutBytesAfter is statement
@@ -66,7 +67,10 @@ Right: An expression which evaluates to binary data.
66
67
67
68
Returns: Binary data consisting of the value of the left hand expression with the value of the right hand expression appended to the end.
68
69
69
-
Example: put tLeft & tRight into tConcatenated
70
+
Description:
71
+
The result consists of the bytes of <Left> followed by those of <Right>.
72
+
73
+
Tags: Binary
70
74
*/
71
75
72
76
syntax ConcatenateBytes is left binary operator with precedence 2
@@ -83,9 +87,12 @@ Summary: Determines whether <Left> and <Right> are equal or not.
83
87
Left: An expression which evaluates to binary data.
84
88
Right: An expression which evaluates to binary data.
85
89
86
-
87
90
Returns: Returns true if the result of evaluating <Left> is the same as that of <Right>, and false otherwise.
88
91
92
+
Description:
93
+
Performs a byte by byte comparison of <Left> and <Right>, returning false if there is any difference.
94
+
95
+
Tags: Binary
89
96
*/
90
97
91
98
syntax DataIsData is neutral binary operator with precedence 5
@@ -100,9 +107,12 @@ Summary: Determines whether <Left> and <Right> are equal or not.
100
107
Left: An expression which evaluates to binary data.
101
108
Right: An expression which evaluates to binary data.
102
109
103
-
104
110
Returns: Returns false if the result of evaluating <Left> is the same as that of <Right>, and true otherwise.
105
111
112
+
Description:
113
+
Performs a byte by byte comparison of <Left> and <Right>, returning true if there is any difference.
114
+
115
+
Tags: Binary
106
116
*/
107
117
108
118
syntax DataIsNotData is neutral binary operator with precedence 5
@@ -118,8 +128,12 @@ Left: An expression which evaluates to binary data.
118
128
Right: An expression which evaluates to binary data.
119
129
120
130
121
-
Returns: Returns true if <Left> and <Right> are not equal, and the first byte in <Right> that is not equal to the
122
-
corresponding byte in <Left> is of greater value.
131
+
Returns: True if <Left> is less than <Right>, and false otherwise.
132
+
133
+
Description:
134
+
<Left> is less than <Right> if they are not equal, and the first byte in <Right> that is not equal to the corresponding byte in <Left> is of greater value.
135
+
136
+
Tags: Binary
123
137
*/
124
138
125
139
syntax DataIsLessThanData is neutral binary operator with precedence 3
@@ -135,8 +149,12 @@ Left: An expression which evaluates to binary data.
135
149
Right: An expression which evaluates to binary data.
136
150
137
151
138
-
Returns: Returns true if <Left> and <Right> are not equal, and the first byte in <Left> that is not equal to the
139
-
corresponding byte in <Right> is of greater value.
152
+
Returns: True if <Left> is greater than <Right>, and false otherwise.
153
+
154
+
Description:
155
+
<Left> is greater than <Right> if they are not equal, and the first byte in <Left> that is not equal to the corresponding byte in <Right> is of greater value.
156
+
157
+
Tags: Binary
140
158
*/
141
159
142
160
syntax DataIsGreaterThanData is neutral binary operator with precedence 3
@@ -147,6 +165,23 @@ end syntax
147
165
148
166
--
149
167
168
+
/*
169
+
170
+
Summary: Designates data of length 0.
171
+
172
+
Example:
173
+
variable tVar as data
174
+
variable tCount as number
175
+
put the empty data into tVar
176
+
put the number of bytes in tVar into tCount -- tCount is 0
177
+
178
+
Description:
179
+
Use ```the empty data``` to initialise a data variable.
Copy file name to clipboardExpand all lines: libscript/src/byte.mlc
+37-17Lines changed: 37 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -31,11 +31,11 @@ Summary: Counts the number of bytes in <Target>.
31
31
32
32
Target: An expression which evaluates to binary data.
33
33
34
-
Example:
34
+
Returns: The number of bytes in <Target>
35
35
36
-
repeat with x = 1 to the number of bytes in tData
37
-
// do something
38
-
end repeat
36
+
Description:
37
+
38
+
Tags: Binary
39
39
*/
40
40
41
41
syntax CountBytesOf is prefix operator with precedence 1
@@ -53,11 +53,12 @@ Summary: Finds the first or last occurrence of <Needle> within <Targe
53
53
Needle: An expression which evaluates to binary data.
54
54
Target: An expression which evaluates to binary data.
55
55
56
-
Returns: Returns the offset of <Needle> in <Target>.
56
+
Returns: Returns the offset of <Needle> in <Target>.
57
57
58
58
Description:
59
59
The first (respectively last) offset of <Needle> in <Target> is number of bytes between the first byte of <Target> and the first (respectively last) occurrence of <Needle>. If neither first or last is specified, then the first offset is found. If <Needle> does not occur in <Target>, then the output is 0.
60
60
61
+
Tags: Binary
61
62
*/
62
63
63
64
syntax ByteOffset is prefix operator with precedence 1
@@ -74,10 +75,12 @@ Needle: An expression which evaluates to binary data.
74
75
Target: An expression which evaluates to binary data.
75
76
After: An expression which evaluates to a valid integer index of Target.
76
77
77
-
Returns: Returns the offset of <Needle> after index <After> in <Target>.
78
+
Returns: Returns the offset of <Needle> after index <After> in <Target>.
78
79
79
80
Description:
80
81
The first (respectively last) offset of <Needle> in <Target> is number of bytes between byte <After> of <Target> and the first (respectively last) occurrence of <Needle> after <After>. If neither first or last is specified, then the first offset is found. If <Needle> does not occur after <After> in <Target>, then the output is 0.
82
+
83
+
Tags: Binary
81
84
*/
82
85
83
86
syntax ByteOffsetAfter is prefix operator with precedence 1
@@ -94,11 +97,12 @@ Needle: An expression which evaluates to binary data.
94
97
Target: An expression which evaluates to binary data.
95
98
After: An expression which evaluates to a valid integer index of Target.
96
99
97
-
Returns: Returns the offset of <Needle> before index <Before> in <Target>.
100
+
Returns: Returns the offset of <Needle> before index <Before> in <Target>.
98
101
99
102
Description:
100
103
The first (respectively last) offset of <Needle> in <Target> is number of bytes between the first byte of <Target> and the first (respectively last) occurrence of <Needle> before <Before>. If neither first or last is specified, then the last offset is found. If <Needle> does not occur before <Before> in <Target>, then the output is 0.
101
104
105
+
Tags: Binary
102
106
*/
103
107
104
108
syntax ByteOffsetBefore is prefix operator with precedence 1
@@ -112,10 +116,12 @@ Summary: Determines whether <Needle> is in <Target>.
112
116
Needle: An expression which evaluates to a single byte of binary data.
113
117
Target: An expression which evaluates to binary data.
114
118
115
-
Returns: True if <Needle> is among the bytes of <Target>, and false otherwise.
119
+
Returns: True if <Needle> is among the bytes of <Target>, and false otherwise.
116
120
117
121
Description:
118
122
>*Note:* It is an error if <Needle> evaluates to data consisting of more than one byte.
123
+
124
+
Tags: Binary
119
125
*/
120
126
121
127
syntax IsAmongTheBytesOf is neutral binary operator with precedence 1
Needle: An expression which evaluates to binary data.
166
176
Target: An expression which evaluates to binary data.
167
177
168
-
Returns: True if the bytes of <Needle> occur as a final subsequence of the bytes of <Target>, and false otherwise.
178
+
Returns: True if the bytes of <Needle> occur as a final subsequence of the bytes of <Target>, and false otherwise.
169
179
170
180
Description:
171
181
>*Note:* Since the empty data is a final subsequence of every sequence of bytes, every sequence of bytes ends with the empty data.
182
+
183
+
Tags: Binary
172
184
*/
173
185
174
186
syntax EndsWithBytes is neutral binary operator with precedence 1
@@ -185,13 +197,12 @@ Summary: Designates the byte of data at index <Index> in <Target>.
185
197
Index: An expression which evaluates to a valid integer index of <Target>.
186
198
Target: An expression which evaluates to binary data.
187
199
188
-
Example: put the empty data into byte 5 of tData // Locates byte 5 and removes it from tData
189
-
Example: get byte 5 of tData // Evaluates byte 5
190
-
191
200
Description:
192
201
Either locates the byte at the given index for use as the target container of another operation, or evaluates the byte at the given index as the source of another operation.
193
202
194
203
>*Note:* It is an error if <Index> is out of range.
204
+
205
+
Tags: Binary
195
206
*/
196
207
197
208
syntax SingletonByteOf is prefix operator with precedence 1
@@ -208,14 +219,13 @@ Summary: Designates the bytes of data between indices <Start> and <Fi
208
219
Start: An expression which evaluates to a valid integer index of <Target>.
209
220
Finish: An expression which evaluates to a valid integer index of <Target>.
210
221
Target: An expression which evaluates to binary data.
211
-
212
-
Example: put tBytes into byte 5 to 10 of tData // Locates bytes 5 to 10 and replace them with tBytes
213
-
Example: get byte 5 to 10 of tData // Evaluates bytes 5 to 10
214
222
215
223
Description:
216
224
Either locates the bytes between the given indices for use as the target container of another operation, or evaluates the bytes at the given indices as the source of another operation.
217
225
218
226
>*Note:* It is an error if either <Start> or <Finish> are out of range.
227
+
228
+
Tags: Binary
219
229
*/
220
230
221
231
syntax RangeByteOf is prefix operator with precedence 1
0 commit comments