Skip to content

Commit 550fea6

Browse files
author
runrevali
committed
[[ StdMlc ]] Various tweaks to std mlc files
1 parent d69ec71 commit 550fea6

File tree

5 files changed

+34
-174
lines changed

5 files changed

+34
-174
lines changed

libscript/src/byte.mlc

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -221,41 +221,4 @@ end syntax
221221

222222
--
223223

224-
/*
225-
Summary: Designates the location beween byte <Index> - 1 and <Index> of <Target>
226-
227-
Index: An expression which evaluates to a valid integer index of <Target>.
228-
Target: An expression which evaluates to binary data.
229-
230-
Description:
231-
Use with the put statement to insert bytes in the specified location without removal.
232-
233-
*/
234-
235-
syntax BeforeByteOf is prefix operator with precedence 1
236-
"before" "byte" <Index: Expression> "of" <Target: Expression>
237-
begin
238-
StoreBeforeByteOf(input, Index, Target)
239-
end syntax
240-
241-
242-
/*
243-
Summary: Designates the location beween byte <Index> and <Index> + 1 of <Target>
244-
245-
Index: An expression which evaluates to a valid integer index of <Target>.
246-
Target: An expression which evaluates to binary data.
247-
248-
Description:
249-
Use with the put statement to insert bytes in the specified location without removal.
250-
251-
*/
252-
253-
syntax AfterByteOf is prefix operator with precedence 1
254-
"after" "byte" <Index: Expression> "of" <Target: Expression>
255-
begin
256-
StoreAfterByteOf(input, Index, Target)
257-
end syntax
258-
259-
--
260-
261224
end module

libscript/src/char.mlc

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -130,62 +130,6 @@ end syntax
130130

131131
--
132132

133-
/*
134-
Summary: Designates the location beween char <Index> - 1 and <Index> of <Target>
135-
136-
Index: An expression which evaluates to a valid integer index of <Target>.
137-
Target: An expression which evaluates to a string.
138-
139-
Example:
140-
variable tVar as string
141-
put "This is false" into tVar
142-
put "sentence " before char 6 of tVar -- tVar contains "This sentence is false"
143-
144-
Description:
145-
Use with the put statement to insert a string in the specified location without removal.
146-
147-
*/
148-
149-
syntax BeforeCharOf is prefix operator with precedence 1
150-
"before" "char" <Index: Expression> "of" <Target: Expression>
151-
begin
152-
MCCharStoreBeforeCharOf(input, Index, Target)
153-
end syntax
154-
155-
/*
156-
Summary: Designates the location beween char <Index> and <Index> + 1 of <Target>
157-
158-
Index: An expression which evaluates to a valid integer index of <Target>.
159-
Target: An expression which evaluates to a string.
160-
161-
Example:
162-
variable tVar as string
163-
put "123" into tVar
164-
165-
variable tCount
166-
put the number of chars in tVar into tCount
167-
subtract 1 from tCount
168-
169-
repeat tCount times
170-
put "," after char tCount of tVar
171-
subtract 1 from tCount
172-
end repeat
173-
174-
// tVar contains 1,2,3
175-
176-
Description:
177-
Use with the put statement to insert a string in the specified location without removal.
178-
179-
*/
180-
181-
syntax AfterCharOf is prefix operator with precedence 1
182-
"after" "char" <Index: Expression> "of" <Target: Expression>
183-
begin
184-
MCCharStoreAfterCharOf(input, Index, Target)
185-
end syntax
186-
187-
--
188-
189133
/*
190134

191135
Summary: Finds the first or last occurrence of <Needle> within <Target>

libscript/src/list.mlc

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -277,68 +277,6 @@ end syntax
277277

278278
--
279279

280-
/*
281-
Summary: Designates the location beween element <Index> - 1 and <Index> of <Target>
282-
283-
Index: An expression which evaluates to a valid integer index of <Target>.
284-
Target: An expression which evaluates to a list.
285-
286-
Example:
287-
variable tVar as list
288-
put the empty list into tVar
289-
push 1 onto tVar
290-
push 3 onto tVar
291-
put 2 before element 2 of tVar -- tVar is the list [1,2,3]
292-
293-
Description:
294-
Use with the put statement to insert an element in the specified location without removal.
295-
After executing
296-
297-
put tVar before element 5 of tList
298-
299-
tVar is the element at index 5 of tList, and every subsequent element has its index incremented by 1.
300-
301-
>*Note:* It is an error if <Index> is out of range.
302-
*/
303-
syntax BeforeElementOf is prefix operator with precedence 1
304-
"before" "element" <Index: Expression> "of" <Target: Expression>
305-
begin
306-
MCListStoreBeforeElementOf(input, Index, Target)
307-
end syntax
308-
309-
310-
/*
311-
Summary: Designates the location beween element <Index> and <Index> + 1 of <Target>
312-
313-
Index: An expression which evaluates to a valid integer index of <Target>.
314-
Target: An expression which evaluates to a list.
315-
316-
Example:
317-
variable tVar as list
318-
put the empty list into tVar
319-
push 1 onto tVar
320-
push 3 onto tVar
321-
put 2 after element 1 of tVar -- tVar is the list [1,2,3]
322-
323-
Description:
324-
Use with the put statement to insert an element in the specified location without removal.
325-
After executing
326-
327-
put tVar after element 5 of tList
328-
329-
tVar is the element at index 6 of tList, and every subsequent element has its index incremented by 1.
330-
331-
>*Note:* It is an error if <Index> is out of range.
332-
*/
333-
334-
syntax AfterElementOf is prefix operator with precedence 1
335-
"after" "element" <Index: Expression> "of" <Target: Expression>
336-
begin
337-
MCListStoreAfterElementOf(input, Index, Target)
338-
end syntax
339-
340-
--
341-
342280
/*
343281

344282
Summary: Removes the elements of <Target> from <Start > to <Finish> and inserts each of the elements of

libscript/src/module-arithmetic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ extern "C" void MCArithmeticEvalNumberModNumber(MCNumberRef p_left, MCNumberRef
280280
t_right = MCNumberFetchAsReal(p_right);
281281

282282
double t_result;
283-
MCArithmeticEvalRealModReal(t_left, t_left, t_result);
283+
MCArithmeticEvalRealModReal(t_left, t_right, t_result);
284284

285285
MCNumberCreateWithReal(t_result, r_output);
286286
}
@@ -319,7 +319,7 @@ extern "C" void MCArithmeticEvalNumberWrapNumber(MCNumberRef p_left, MCNumberRef
319319
t_right = MCNumberFetchAsReal(p_right);
320320

321321
double t_result;
322-
MCArithmeticEvalRealWrapReal(t_left, t_left, t_result);
322+
MCArithmeticEvalRealWrapReal(t_left, t_right, t_result);
323323

324324
MCNumberCreateWithReal(t_result, r_output);
325325
}

toolchain/lc-compile/test.mlc

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ public handler test()
88
put newline into tDelimiter
99

1010
testLogic(tResults)
11-
--testList(tResults)
12-
--testSort(tResults)
11+
testList(tResults)
12+
testSort(tResults)
1313
testArithmetic(tResults)
1414
testChar(tResults)
1515
testBitwise(tResults)
1616
testArray(tResults)
1717
testString(tResults)
18-
18+
1919
variable tResultString as string
2020
put the empty string into tResultString
2121
combine tResults with tDelimiter into tResultString
@@ -73,24 +73,39 @@ public handler testArray(inout xResults as list)
7373
variable tArray as array
7474
put the empty array into tArray
7575

76+
put "value1" into tArray["key1"]
77+
put "value2" into tArray["key2"]
78+
put "value3" into tArray["key3"]
7679

77-
78-
--put "value1" into tArray[ "key1" ]
79-
--put "value2" into tArray["key2"]
80-
--put "value3" into tArray["key3"]
80+
testLog("Array", "Count", the number of elements in tArray is 3, xResults)
8181

8282
variable tKeys as list
8383
put the keys of tArray into tKeys
8484

85+
testLog("Array", "CountKeysOf", the number of elements in tKeys is 3, xResults)
86+
8587
variable tKeysString as string
8688
combine tKeys with "," into tKeysString
8789

88-
testLog("", "", tKeysString is the empty string, xResults)
90+
testLog("Array", "KeysOf", tKeysString contains "key1", xResults)
91+
testLog("Array", "KeysOf", tKeysString contains "key2", xResults)
92+
testLog("Array", "KeysOf", tKeysString contains "key3", xResults)
93+
94+
variable tElements as list
95+
put the elements of tArray into tElements
96+
97+
testLog("Array", "CountElementssOf", the number of elements in tElements is 3, xResults)
98+
99+
testLog("Array", "ElementsOf", "value1" is in tElements, xResults)
100+
testLog("Array", "ElementsOf", "value2" is in tElements, xResults)
101+
testLog("Array", "ElementsOf", "value3" is in tElements, xResults)
102+
103+
testLog("Array", "IsAmongTheKeys", "key1" is among the keys of tArray, xResults)
89104

90-
--testLog("Array", "ArrayKeysOf", tKeysString contains "key1", xResults)
91-
--testLog("Array", "ArrayKeysOf", tKeysString contains "key2", xResults)
92-
--testLog("Array", "ArrayKeysOf", tKeysString contains "key3", xResults)
105+
--testLog("Array", "IsAmongTheElements", "value1" is among the keys of tArray, xResults)
93106

107+
testLog("Array", "ElementOf", tArray["key1"] is "value1", xResults)
108+
94109
end handler
95110

96111
public handler testBitwise(inout xResults as list)
@@ -291,7 +306,7 @@ public handler testArithmetic(inout xResults as list)
291306
testLog("Arithmetic", "TimesReal", tLeftReal * tRightReal is 20, xResults)
292307
testLog("Arithmetic", "TimesNum", 10 * 2 is 20, xResults)
293308

294-
/*
309+
295310
testLog("Arithmetic", "DivideInt", tLeft / tRight is 5, xResults)
296311
testLog("Arithmetic", "DivideReal", tLeftReal / tRightReal is 5, xResults)
297312
testLog("Arithmetic", "DivideNum", 10 / 2 is 5, xResults)
@@ -301,6 +316,7 @@ public handler testArithmetic(inout xResults as list)
301316

302317
testLog("Arithmetic", "ModInt", tLeft mod (tRight + tOne) is 1, xResults)
303318
testLog("Arithmetic", "ModNum", 5 mod 3 is 2, xResults)
319+
304320
testLog("Arithmetic", "Wrap", 5 wrap 3 is 2, xResults)
305321
testLog("Arithmetic", "Wrap", -3 wrap 3 is -3, xResults)
306322

@@ -323,7 +339,7 @@ public handler testArithmetic(inout xResults as list)
323339
testLog("Arithmetic", "LessThanOrEqualToInt", not tLeft <= tRight, xResults)
324340
testLog("Arithmetic", "LessThanOrEqualToNum", 1 <= 1, xResults)
325341
testLog("Arithmetic", "LessThanOrEqualToNum", not 2 <= 1, xResults)
326-
*/
342+
327343
end handler
328344

329345
public handler testList(inout xResults as list)
@@ -365,8 +381,8 @@ public handler testList(inout xResults as list)
365381
testLog("List", "SpliceAfter", the tail of tSubList is 1, xResults)
366382
testLog("List", "SpliceAfter", tSubList contains tTestList, xResults)
367383

368-
--put "ZZZZ" into tTestList[1]
369-
--testLog("List", "SingletonElement", tTestList[1] is "ZZZZ", xResults)
384+
put "ZZZZ" into tTestList[1]
385+
testLog("List", "SingletonElement", tTestList[1] is "ZZZZ", xResults)
370386

371387
end handler
372388

@@ -380,15 +396,14 @@ public handler testSort(inout xResults as list)
380396
push 1 onto tTestList
381397

382398
sort tTestList in ascending numeric order
383-
/*
399+
384400
testLog("Sort", "AscendingNumeric", the head of tTestList is 1, xResults)
385401
testLog("Sort", "NumericStable", the tail of tTestList is "abcd", xResults)
386402

387403
sort tTestList in ascending text order
388404

389405
testLog("Sort", "AscendingText", the head of tTestList is "abcd", xResults)
390406
testLog("Sort", "TextStable", the tail of tTestList is 2, xResults)
391-
*/
392407
end handler
393408

394409
end module

0 commit comments

Comments
 (0)