I
I-F AB
Guest
Hi all,
I wrote some code a couple of weeks ago which I now think may have
some runtime inefficiencies in it.
I'm not sure if I've written it the right way but now I think I might
be doing things in a potentially slow way, especially if I'm dealing
with a monstrous layout of >40 cells.
I'm thinking of using an array but somehow I'm stumped.
Could anyone help me on this?
Example of a typical input:
ListIn = '( "nor2" "res4" "or6" "res7" "aoi3" "aoi1" )
Mode = "Hilite"
****************************************************************************************
procedure( CBOnArr2Inst(ListIn Mode)
prog( (OpsList SizeList elemStr Ops)
OpsList = '()
SizeList = length(ListIn)
for( elem 1 SizeList
sprintf(elemStr "%n" elem) ;convert no. -> string
; evalstring( strcat( "\\" elem "=\"" elem "\"") )
evalstring( strcat("ElemCell_" elemStr
" = \"" nthelem(elem ListIn) "\"") )
;create list of operations
if( Mode == "Switch" then
Ops = strcat("CBButtons2(ElemCell_" elemStr ")")
else ;else if/case
Ops = strcat("CBButtons1(ElemCell_" elemStr ")")
) ;if
OpsList = append1(OpsList Ops)
);for
return(OpsList)
) ;prog
) ;proc CBOnArr2Inst
****************************************************************************************
This code is actually used for a GUI.
It works as I want it but may cause some problems in runtime when I
start putting everything together. The input would be from a GUI for
example:
1st buttonboxfield: ?callback CBOnArr2Inst(OriList
"Hilite")
2nd buttonboxfield: ?callback CBOnArr2Inst(NuList
"Switch")
Thanks.
Best Regards,
I-FAB
I wrote some code a couple of weeks ago which I now think may have
some runtime inefficiencies in it.
I'm not sure if I've written it the right way but now I think I might
be doing things in a potentially slow way, especially if I'm dealing
with a monstrous layout of >40 cells.
I'm thinking of using an array but somehow I'm stumped.
Could anyone help me on this?
Example of a typical input:
ListIn = '( "nor2" "res4" "or6" "res7" "aoi3" "aoi1" )
Mode = "Hilite"
****************************************************************************************
procedure( CBOnArr2Inst(ListIn Mode)
prog( (OpsList SizeList elemStr Ops)
OpsList = '()
SizeList = length(ListIn)
for( elem 1 SizeList
sprintf(elemStr "%n" elem) ;convert no. -> string
; evalstring( strcat( "\\" elem "=\"" elem "\"") )
evalstring( strcat("ElemCell_" elemStr
" = \"" nthelem(elem ListIn) "\"") )
;create list of operations
if( Mode == "Switch" then
Ops = strcat("CBButtons2(ElemCell_" elemStr ")")
else ;else if/case
Ops = strcat("CBButtons1(ElemCell_" elemStr ")")
) ;if
OpsList = append1(OpsList Ops)
);for
return(OpsList)
) ;prog
) ;proc CBOnArr2Inst
****************************************************************************************
This code is actually used for a GUI.
It works as I want it but may cause some problems in runtime when I
start putting everything together. The input would be from a GUI for
example:
1st buttonboxfield: ?callback CBOnArr2Inst(OriList
"Hilite")
2nd buttonboxfield: ?callback CBOnArr2Inst(NuList
"Switch")
Thanks.
Best Regards,
I-FAB