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
Copy file name to clipboardExpand all lines: libscript/src/bitwise.mlc
+5-12Lines changed: 5 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ This module specifies the syntax definitions and bindings for bitwise operations
4
4
5
5
module com.livecode.bitwise
6
6
7
-
public foreign handler MCBitwiseEvalBitwiseAnd(in Left as integer, in Right as integer, out Value as integer) as undefined binds to "<builtin>"
8
-
public foreign handler MCBitwiseEvalBitwiseOr(in Left as integer, in Right as integer, out Value as integer) as undefined binds to "<builtin>"
9
-
public foreign handler MCBitwiseEvalBitwiseNot(in Operand as integer, out Value as integer) as undefined binds to "<builtin>"
10
-
public foreign handler MCBitwiseEvalBitwiseXor(in Left as integer, in Right as integer, out Value as integer) as undefined binds to "<builtin>"
7
+
public foreign handler MCBitwiseEvalBitwiseAnd(in Left as int, in Right as int, out Value as int) as undefined binds to "<builtin>"
8
+
public foreign handler MCBitwiseEvalBitwiseOr(in Left as int, in Right as int, out Value as int) as undefined binds to "<builtin>"
9
+
public foreign handler MCBitwiseEvalBitwiseNot(in Operand as int, out Value as int) as undefined binds to "<builtin>"
10
+
public foreign handler MCBitwiseEvalBitwiseXor(in Left as int, in Right as int, out Value as int) as undefined binds to "<builtin>"
11
11
12
-
public foreign handler MCBitwiseEvalBitwiseShift(in Target as integer, in Shift as integer, out Value as integer) as undefined binds to "<builtin>"
12
+
public foreign handler MCBitwiseEvalBitwiseShift(in Target as int, in Shift as int, out Value as int) as undefined binds to "<builtin>"
13
13
14
14
--
15
15
@@ -85,13 +85,6 @@ Summary: Performs a bitwise NOT operation on the binary representation of
85
85
86
86
Operand: An expression which evaluates to an integer.
87
87
output: The integer whose binary representation is the result of the bitwise NOT operation.
88
-
89
-
Example:
90
-
variable tVar as int
91
-
put bitwise not (2 * (2^31 - 1)) into tVar -- tVar contains 1
92
-
93
-
Description:
94
-
Each bit of <Left> bitwise or <Right> is 1 if and only if exactly one of the corresponding bits of the binary representation of <Left> and that of <Right> is 1. Otherwise it is 0.
95
88
*/
96
89
97
90
syntax BitwiseNot is prefix operator with precedence 1
Copy file name to clipboardExpand all lines: libscript/src/byte.mlc
+56-15Lines changed: 56 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
This module specifies the syntax definitions and bindings for operations on binary data in modular LiveCode.
2
+
This library consists of the operations on bytes included in the standard library of modular LiveCode.
3
3
*/
4
4
5
5
module com.livecode.byte
@@ -53,9 +53,11 @@ Summary: Finds the first or last occurrence of <Needle> within <Targe
53
53
54
54
Needle: An expression which evaluates to binary data.
55
55
Target: An expression which evaluates to binary data.
56
-
output: Returns the number of bytes between the first byte of <Target> and the first or last occurrence of <Needle> within <Target>.
57
-
Returns 0 if <Needle> does not occur within <Target>.
58
-
Searches for first occurrence if neither first nor last is specified.
56
+
output: Returns the offset of <Needle> in <Target>.
57
+
58
+
Description:
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
+
59
61
*/
60
62
61
63
syntax ByteOffset is prefix operator with precedence 1
@@ -71,9 +73,10 @@ Summary: Finds the first or last occurrence of <Needle> after a speci
71
73
Needle: An expression which evaluates to binary data.
72
74
Target: An expression which evaluates to binary data.
73
75
After: An expression which evaluates to a valid integer index of Target.
74
-
output: Returns the number of bytes between the first byte of <Target> and the first or last occurrence of <Needle> after index <After> in <Target>.
75
-
Returns 0 if <Needle> does not occur after index <After> in <Target>.
76
-
Searches for first occurrence if neither first nor last is specified.
76
+
output: Returns the offset of <Needle> after index <After> in <Target>.
77
+
78
+
Description:
79
+
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.
77
80
*/
78
81
79
82
syntax ByteOffsetAfter is prefix operator with precedence 1
@@ -89,9 +92,10 @@ Summary: Finds the first or last occurrence of <Needle> before a spec
89
92
Needle: An expression which evaluates to binary data.
90
93
Target: An expression which evaluates to binary data.
91
94
After: An expression which evaluates to a valid integer index of Target.
92
-
output: Returns the number of bytes between the first byte of <Target> and the first or last occurrence of <Needle> before index <Before> in <Target>.
93
-
Returns 0 if <Needle> does not occur before index <Before> in <Target>.
94
-
Searches for last occurrence if neither first nor last is specified.
95
+
output: Returns the offset of <Needle> before index <Before> in <Target>.
96
+
97
+
Description:
98
+
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.
95
99
96
100
*/
97
101
@@ -106,6 +110,9 @@ Summary: Determines whether <Needle> is in <Target>.
106
110
Needle: An expression which evaluates to a single byte of binary data.
107
111
Target: An expression which evaluates to binary data.
108
112
output: True if <Needle> is among the bytes of <Target>, and false otherwise.
113
+
114
+
Description:
115
+
>*Note:* It is an error if <Needle> evaluates to data consisting of more than one byte.
109
116
*/
110
117
111
118
syntax IsAmongTheBytesOf is neutral binary operator with precedence 1
Needle: An expression which evaluates to binary data.
148
161
Target: An expression which evaluates to binary data.
149
162
output: True if the bytes of <Needle> occur as a final subsequence of the bytes of <Target>, and false otherwise.
163
+
164
+
Description:
165
+
>*Note:* Since the empty data is a final subsequence of every sequence of bytes, every sequence of bytes ends with the empty data.
150
166
*/
151
167
152
168
syntax EndsWithBytes is neutral binary operator with precedence 1
@@ -162,12 +178,13 @@ end syntax
162
178
Summary: Designates the byte of data at index <Index> in <Target>.
163
179
Index: An expression which evaluates to a valid integer index of <Target>.
164
180
Target: An expression which evaluates to binary data.
165
-
output: Either locates the byte of data at the given index either for use as the target container of another operation,
166
-
or evaluates the byte of data at the given index as the source of another operation.
167
181
168
-
Example: delete byte 5 of tData // Locates byte 5 and removes it from tData
182
+
Example: put the empty data into byte 5 of tData // Locates byte 5 and removes it from tData
169
183
Example: get byte 5 of tData // Evaluates byte 5
170
184
185
+
Description:
186
+
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.
187
+
171
188
*/
172
189
173
190
syntax SingletonByteOf is prefix operator with precedence 1
@@ -184,12 +201,13 @@ Summary: Designates the bytes of data between indices <Start> and <Fi
184
201
Start: An expression which evaluates to a valid integer index of <Target>.
185
202
Finish: An expression which evaluates to a valid integer index of <Target>.
186
203
Target: An expression which evaluates to binary data.
187
-
output: Either locates the bytes of data between the given indices either for use as the target container of another operation,
188
-
or evaluates the bytes of data at the given indices as the source of another operation.
189
204
190
205
Example: put tBytes into byte 5 to 10 of tData // Locates bytes 5 to 10 and replace them with tBytes
191
206
Example: get byte 5 to 10 of tData // Evaluates bytes 5 to 10
192
207
208
+
Description:
209
+
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.
210
+
193
211
*/
194
212
195
213
syntax RangeByteOf is prefix operator with precedence 1
@@ -201,12 +219,35 @@ end syntax
201
219
202
220
--
203
221
222
+
/*
223
+
Summary: Designates the location beween byte <Index> - 1 and <Index> of <Target>
224
+
225
+
Index: An expression which evaluates to a valid integer index of <Target>.
226
+
Target: An expression which evaluates to binary data.
227
+
228
+
Description:
229
+
Use with the put statement to insert bytes in the specified location without removal.
230
+
231
+
*/
232
+
204
233
syntax BeforeByteOf is prefix operator with precedence 1
Copy file name to clipboardExpand all lines: libscript/src/char.mlc
+90-16Lines changed: 90 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,7 @@
1
+
/*
2
+
This library consists of the operations on chars included in the standard library of modular LiveCode.
3
+
*/
4
+
1
5
module com.livecode.char
2
6
3
7
public foreign handler MCCharFetchCharOf(in Index as index, in Target as string, out Value as string) as undefined binds to "<builtin>"
@@ -16,6 +20,9 @@ public foreign handler MCCharEvalOffsetOfChars(in IsLast as bool, in Needle as s
16
20
public foreign handler MCCharEvalOffsetOfCharsBefore(in IsLast as bool, in Needle as string, in Before as index, in Target as string, out Offset as index) as undefined binds to "<builtin>"
17
21
public foreign handler MCCharEvalOffsetOfCharsAfter(in IsFirst as bool, in Needle as string, in After as index, in Target as string, out Offset as index) as undefined binds to "<builtin>"
18
22
23
+
public foreign handler MCCharEvalBeginsWith(in Source as string, in Prefix as string, out Result as bool) as undefined binds to "<builtin>"
24
+
public foreign handler MCCharEvalEndsWith(in Source as string, in Suffix as string, out Result as bool) as undefined binds to "<builtin>"
25
+
19
26
public foreign handler MCCharEvalNewlineCharacter(out Value as string) as undefined binds to "<builtin>"
20
27
21
28
public foreign handler MCCharRepeatForEachChar(inout Iterator as optional pointer, out Iterand as string, in Container as string) as bool binds to "<builtin>"
@@ -88,7 +95,7 @@ Example: put tChars into char 5 to 10 of tString // Locates chars 5 to 10 of
88
95
Example: get char 5 to 10 of tString // Evaluates chars 5 to 10
89
96
90
97
Description:
91
-
Either locates the chars between the given indices either for use as the target container of another operation, or evaluates the chars at the given indices as the source of another operation.
98
+
Either locates the chars between the given indices for use as the target container of another operation, or evaluates the chars at the given indices as the source of another operation.
92
99
93
100
*/
94
101
@@ -119,12 +126,54 @@ end syntax
119
126
120
127
--
121
128
129
+
/*
130
+
Summary: Designates the location beween char <Index> - 1 and <Index> of <Target>
131
+
132
+
Index: An expression which evaluates to a valid integer index of <Target>.
133
+
Target: An expression which evaluates to a string.
134
+
135
+
Example:
136
+
variable tVar as string
137
+
put "This is false" into tVar
138
+
put "sentence " before char 6 of tVar -- tVar contains "This sentence is false"
139
+
140
+
Description:
141
+
Use with the put statement to insert a string in the specified location without removal.
142
+
143
+
*/
144
+
122
145
syntax BeforeCharOf is prefix operator with precedence 1
put "http://www.livecode.com/index.php" into tAddress
255
+
put "http://www.livecode.com/index.html" into tAddress
207
256
put the last offset of "." in tAddress into tLastDot
208
257
put the offset of "." before tLastDot in tAddress into tVar
209
258
put char tVar + 1 to tVar + 3 of tAddress into tTLD -- tTLD contains "com"
210
259
211
-
212
260
Description:
213
261
The first (respectively last) offset of <Needle> in <Target> is number of chars between the first char of <Target>, and the first (respectively last) occurrence of <Needle> in the substring of <Target> ending at char <Before> - 1. If neither first or last is specified, then the last offset is found. If <Needle> does not occur in the given substring of <Target>, then the output is 0.
0 commit comments