Created
October 22, 2018 18:20
-
-
Save ThomasTheSpaceFox/ff64aa13bf1f922111b34ce5b981c835 to your computer and use it in GitHub Desktop.
A basic SSTNPL iterator example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SSTNPL tutorial part 3: iterators | |
var cb=0 | |
#### Basic Iterators #### | |
uiter itval,test1,@-5,@5 | |
newline | |
diter itval,test1,@5,@-5 | |
newline | |
#### Double Iterators #### | |
u2iter itvalx,itvaly,test2,@-5,@5,@-1,@1 | |
newline | |
d2iter itvalx,itvaly,test2,@5,@-5,@1,@-1 | |
newline | |
#### iterating over rows #### | |
uiter itval,getat1,@0,@2 | |
newline | |
#### iterating over columns #### | |
uiter itval,getat1B,@0,@2 | |
newline | |
#### Over the whole thing #### | |
u2iter itvalx,itvaly,getat2,@0,@2,@0,@2 | |
newline | |
stop | |
#### Our table #### | |
table sam,3,3 | |
tstr 123 | |
tstr abc | |
tstr xyz | |
########### associated subroutines below ########### | |
#### Basic iterators (subroutine) #### | |
label test1 | |
dumpd itval | |
return | |
#### Double iterators (subroutine) #### | |
label test2 | |
dumpd itvalx | |
dumpd itvaly | |
return | |
#### iterating over rows (subroutine) #### | |
label getat1 | |
tabr sam,itval,@0 | |
set cb | |
chardump cb | |
return | |
#### iterating over columns (subroutine) #### | |
label getat1B | |
tabr sam,@0,itval | |
set cb | |
chardump cb | |
return | |
#### over the whole thing (subroutine) #### | |
label getat2 | |
tabr sam,itvalx,itvaly | |
set cb | |
chardump cb | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment