May 14, 2024, 03:28:45 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


SELECT - CASE

Started by aurelCB, November 15, 2011, 01:33:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aurelCB

Hi...
I discover one (from my point of view) weird thing.
It looks that number of CASE are limited because i recive error
'compiler internal overflow'...
I found one topic on Aurora board that CASE are limited to 100 nodes...
same for EB - i use EB ?
Hmmm i really don't understand why is this limited to 100?

So another thing mrP say that is posibile to break select and continue again with
new SELECT, Ok i do this but statment DEFAULT do not respond properly on
new DEFAULT,,hmmm.

What is solution for this problem...?

thanks advance ..
Aurel

GWS

Hi Aurel,

Here's a little test program ..


openconsole
cls

x = 5

select x
case 1
print "First select: x = 1"
case 3
case 6
default
print "First select - x not found - procede to Second select"
endselect

select x
case 2
print "Second select: x = 2"
case 5
print "Second select: x = 5"
case 6
default
print "Second select - x not found"
endselect

do:until inkey$<>""
closeconsole
end


I don't see why you can't have as many 'Select' blocks as you need to deal with large numbers of test cases.

If a Case is not found in the first block, do nothing, but proceed into the next block - and so on.

all the best, :)

Graham
Tomorrow may be too late ..

aurelCB

Hi Graham

Problem is much more complex . ::)
But still i think that this limitation is not good at all,amount of CASE under SELECT is simply to small.
I dont wanna bothering you with details.
Ok i will see what i can do in another way...  ;)

GWS

Aurel,

You're no bother at all .. you know we all like to try and help if we can .. :)

I'm intrigued at what you might be up to, that requires so many Select conditions .. it certainly sounds complex ..  ;D

best wishes, :)

Graham
Tomorrow may be too late ..

billhsln

Maybe what you are trying to do could better be done with arrays?

Bill
When all else fails, get a bigger hammer.

aurelCB

November 15, 2011, 01:28:23 PM #5 Last Edit: November 15, 2011, 01:37:17 PM by aurelCB
Yeah...i know Graham... ;)
Huh after some thinking maybe solution is in hash table(dict).
Code will look like this:
FOR start = linenum TO smax
'wait 1
'----------------------------
GW1 = Ucase$(arg1[start])

'get string from hash table
temp$ = GW1
'check if is not empty
IF temp$ <> ""
IF LEFT$(temp$,1) <> "'" :'not comment
'set temp variable with subroutine adress
temp=VAL(DictLookup(lineHash,temp$))
IF temp <> 0
'jump indirectly to subroutine
!<fnSub>temp()
ELSE
exec_expr()
ENDIF
ENDIF
ENDIF
     

   
Next start

aurelCB

Oh my i think that im ready to write 'master's thesis' about hash tables ;D
however here is option on more classic way.
I remove statment DEFAULT from SELECT block1 and SELECT block2 and add
few IF/ENDIF checks. ;)

'end of block 2     
ENDSELECT

'if empty line
IF abscript[start]=""
match=1
clean()
ENDIF

'if comment is first char in line
IF LEFT$(abscript[start],1)="'"
match=1
clean()
ENDIF

'if is variable
IF match=0
exec_let()
IF error=1 THEN BREAKFOR
ENDIF