This commit is contained in:
Daniella / Tove 2022-02-23 18:08:19 +01:00
commit 02e7a5b098

View file

@ -35,6 +35,14 @@ native isfloat
native islong
native isdouble
# "call a dynamically computed function" pop
# "Please keep in mind that this will throw a native error if" pop
# "called incorrectly - this means wrong layer parameter will" pop
# "instantly crash the program." pop
native _layer_call
func call {
0 _layer_call
}
native include
native putchar
native read
@ -42,8 +50,6 @@ native flength
native write
native type
native mktype
# "call a dynamically computed function" pop
native call
native typename
native istype
native settype
@ -244,3 +250,46 @@ func puts {
str i aget putchar
}
}
func anewput {
def size =size
def arr size anew =arr
def i 0 =i
while i size lt {
arr swap i swap aput
i 1 + =i
}
arr areverse
}
func areverse {
def arr =arr
def new arr alen anew =new
def i arr alen 1 - =i
def j 0 =j
while i 0 lt not {
new j arr i aget aput
j 1 + =j
i 1 - =i
}
new
}
func inc {
def varname =varname
( varname 1 _layer_call ) # "Get var" pop
1 + # "Increment" pop
( "=" varname strconcat 1 _layer_call ) # "Store var" pop
}
func dec {
def varname =varname
( varname 1 _layer_call ) # "Get var" pop
1 - # "Decrement" pop
( "=" varname strconcat 1 _layer_call ) # "Store var" pop
}