06-19-2013, 05:10 AM
I have 2 questions.
Question 1:
I have a script that outputs "a" to "z" strings, in the following way
a
.
.
z
==== next cycle
aa
ab
.
.
az
==== next cycle
aba
abc
abd
.
.
abz
==== somewhere in final cycle
abcde
abcde
abcde
But somewhere in the final cycle the string misses characters, it should be
abcdea
abcdeb
.
.
abcdez
My script:
Macro Macro17
Is it because 'x.fix' ?
Question 2:
is it possible to dynamically create variables and arrays:
Macro Macro19
I should have 3 variables: s0, s1, s2
Macro Macro19
I should have 3 arrays: s0, s1, s2
The code off course is totally wrong, but I only want to clarify the question.
Question 1:
I have a script that outputs "a" to "z" strings, in the following way
a
.
.
z
==== next cycle
aa
ab
.
.
az
==== next cycle
aba
abc
abd
.
.
abz
==== somewhere in final cycle
abcde
abcde
abcde
But somewhere in the final cycle the string misses characters, it should be
abcdea
abcdeb
.
.
abcdez
My script:
Macro Macro17
str s="abcdefghijklmnopqrstuvwxyz"
int i t1 t2
str x=" "
;;Each letter in charactercode array
ARRAY(int) b.create(s.len)
for(i 0 b.len)
,b[i]=s[i]
;;to output window strings:
;;a...z, aa ab ac...az, aba abc abd... abz, ...etc
for t1 0 7
,for t2 0 b.len
,,if(t1=0)
,,,x[0]=b[t2]
,,else
,,,x.fix(x.len+1)
,,,x[t1-1]=b[t1-1]
,,,x[t1]=b[t2]
,,out x
Is it because 'x.fix' ?
Quote:Must not exceed the number of bytes in the string buffer (nc property).
Question 2:
is it possible to dynamically create variables and arrays:
Macro Macro19
I should have 3 variables: s0, s1, s2
Macro Macro19
I should have 3 arrays: s0, s1, s2
The code off course is totally wrong, but I only want to clarify the question.