Author Topic: ElseIf Limitatation ?  (Read 6825 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Guest
ElseIf Limitatation ?
« on: February 14, 2015, 03:43:38 PM »
Hi Charles

Do you know that number of ElseIf statments are limited to 25 ?
I just discoverd this when i try to add new command in my interpreter parser and
my new elseif is 26  ???

If ...

elseif...

elseif..

end if


block

so if number of elseif is more than 24 then program not work  :o

of course i can replace them with ordinary if/end if but i really dont know that else if have limitation

Charles Pegge

  • Guest
Re: ElseIf Limitatation ?
« Reply #1 on: February 14, 2015, 04:11:23 PM »
There are no limitations on elseifs in Oxygen. It is just a repeating pattern:

if  not(new condition) then goto next else
...
goto next endif:
else:
if  not(new condition) then goto next else
...
goto next endif:
else:
if  not(new condition) then goto next else
...
else:
...
endif:

There is, however, a limit on nesting depth for blocks: I have set it to 100, which I hope is high enough, never to be exceeded.

JRS

  • Guest
Re: ElseIf Limitatation ?
« Reply #2 on: February 14, 2015, 04:35:03 PM »
Quote
There is, however, a limit on nesting depth for blocks: I have set it to 100, which I hope is high enough, never to be exceeded.

Can these parameters/limits be O2 system variable? In SB the basic.conf files hold the overrides for limits and defaults.

Charles Pegge

  • Guest
Re: ElseIf Limitatation ?
« Reply #3 on: February 14, 2015, 04:55:36 PM »
Hi John,

There are quite a large number of fixed size buffers/arrays, hard coded at compile time. They have rarely needed to be adjusted during the course of Oxygen's evolution. Flexibility comes at a price :)

Most of them can be found in src/o2glob.bas

Aurel

  • Guest
Re: ElseIf Limitatation ?
« Reply #4 on: February 15, 2015, 04:14:22 AM »
Charles you get me wrong
i was talk about this :
(this code is part of parser with if/elseif /end if.

Code: [Select]
'check command :::

If c$="DEFN"
parse_DEFINT()

ElseIf c$="IF"
    parse_IF()

ElseIf c$="ENDIF"
    parse_ENDIF()

ElseIf c$="SET"
    parse_SET()

ElseIf c$="NARRAY"
    parse_ARRAYN()

ElseIf c$="WFORM"
parse_WINDOW()

ElseIf c$="FOR"
parse_FOR()

ElseIf c$="NEXT"
    parse_NEXT()

ElseIf c$ = "TXCOLOR"
parse_TxColor()

ElseIf c$="WTEXT"
parse_wtext()

ElseIf c$="LINE"
    parse_LineXY()

ElseIf c$="CIRCLE"
    parse_Circle()

ElseIf c$="RECT"
    parse_Rect()

ElseIf c$="PIX"
    parse_PsetXY()

ElseIf c$="JUMP"
    parse_JUMP()

ElseIf c$="LABEL"
    parse_LABEL()

'####################
ElseIf c$="MBOXGTW"
    parse_MBoxGetWord()
'......................
'ElseIf c$="CALL"
    'parse_CALL()

'ElseIf c$="FUNC"
   ' parse_FUNC()

'ElseIf c$="ENDFUNC"
   ' parse_ENDFUNC()
'......................
ElseIf c$="WCOLOR"
    parse_WINCOLOR()

ElseIf c$="WCON"
    parse_WINCONTROL()

ElseIf c$="WAIT"
    parse_WAIT()

ElseIf c$="@OFF"
    parse_OFF()

ElseIf c$="@ONCLICK"
    parse_OnClick()

ElseIf c$="@MOUSEMOVE"
    parse_MouseMove()

ElseIf c$="@MOUSEX"
    parse_MouseX()

ElseIf c$="@MOUSEY"
    parse_MouseY()

End If

well if i add one more elseif condition then program refuse to work or start
so it is clear if is more than 25 elseif then program not work .

Peter

  • Guest
Re: ElseIf Limitatation ?
« Reply #5 on: February 15, 2015, 10:12:52 AM »
Not true,  Aurel
Code: [Select]
int a=10,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=1

if a=1 then
   print a
elseif b=1 then   
   print a
elseif b=1 then   
   print a
elseif c=1 then   
   print a
elseif d=1 then   
   print a
elseif f=1 then   
   print a
elseif g=1 then   
   print a
elseif h=1 then   
   print a
elseif i=1 then   
   print a
elseif j=1 then   
   print a
elseif k=1 then   
   print a   
elseif l=1 then   
   print a
elseif m=1 then   
   print a
elseif n=1 then   
   print a
elseif o=1 then   
   print a
elseif p=1 then   
   print a
elseif q=1 then   
   print a
elseif r=1 then   
   print a
elseif s=1 then   
   print a
elseif t=1 then   
   print a
elseif u=1 then   
   print a
elseif v=1 then   
   print a
elseif w=1 then   
   print a
elseif x=1 then   
   print a
elseif y=1 then   
   print a
elseif z=1 then   
   print a
endif

print "okay"

Aurel

  • Guest
Re: ElseIf Limitatation ?
« Reply #6 on: February 15, 2015, 10:33:50 AM »
Yes it is because i have strings NOT integers

Aurel

  • Guest
Re: ElseIf Limitatation ?
« Reply #7 on: February 15, 2015, 10:47:01 AM »
peter try this one ...so must be printed last string which is OK
but is not printed OK then 26

Code: [Select]
string a="26",b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x="OK",y,z="26"

if a=z
   print a
elseif b=z   
   print a
elseif b=z   
   print a
elseif c=z   
   print a
elseif d=z   
   print a
elseif f=z   
   print a
elseif g=z   
   print a
elseif h=z   
   print a
elseif i=z   
   print a
elseif j=z   
   print a
elseif k=z   
   print a   
elseif l=z   
   print a
elseif m=z 
   print a
elseif n=z   
   print a
elseif o=z   
   print a
elseif p=z   
   print a
elseif q=z   
   print a
elseif r=z   
   print a
elseif s=z   
   print a
elseif t=z   
   print a
elseif u=z   
   print a
elseif v=z   
   print a
elseif w=z   
   print a
elseif x=z   
   print a
elseif y=z   
   print a
elseif z=a   
   print x
endif

print "okay"
 

Charles Pegge

  • Guest
Re: ElseIf Limitatation ?
« Reply #8 on: February 15, 2015, 12:09:47 PM »
Hi Aurel,
your example works as expected. If you delete the first 'if a=z' then you will reach the final 'if a=z' and produce x 'OK'

Peter

  • Guest
Re: ElseIf Limitatation ?
« Reply #9 on: February 15, 2015, 12:28:34 PM »
Aurel;

.

Aurel

  • Guest
Re: ElseIf Limitatation ?
« Reply #10 on: February 15, 2015, 12:54:28 PM »
sorry charles but i don't post without reason
i have tested my original if/elseif and not work as it should be ...
for example what result you get with this program...
i get 2   ::)

Code: [Select]
string a="2",b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,zz=""

if a=z      '1
   print "1"
 
elseif b=z  '2
   print a
 
elseif c=z  '3
   print a

elseif d=z  '4
   print a

elseif e=z  '5
   print a

elseif f=z  '6
   print a

elseif g=z  '7
   print a

elseif h=z  '8
   print a

elseif i=z  '9
   print a

elseif j=z  '10
   print a

elseif k=z  '11
   print a
   
elseif l=z  '12 
   print a

elseif m=z  '13
   print a

elseif n=z  '14 
   print a

elseif o=z  '15
   print a

elseif p=z  '16
   print a

elseif q=z  '17
   print a

elseif r=z  '18
   print a

elseif s=z  '19
   print a

elseif t=z  '20
   print a

elseif u=z  '21
   print a

elseif v=z  '22 
   print a

elseif w=z  '23
   print a

elseif a=zz  '24
   print "24"

'elseif y=""  '25    'y=""
  ' print "OK"       'print "OK"

'elseif zz=a  '26   comment this part and change in 25 item a to "" empty
  ' print "OK"

end if

 

Charles Pegge

  • Guest
Re: ElseIf Limitatation ?
« Reply #11 on: February 15, 2015, 01:05:12 PM »
2 is the correct answer :)

Peter

  • Guest
Re: ElseIf Limitatation ?
« Reply #12 on: February 15, 2015, 01:47:50 PM »
2 is the correct answer!  ;D

Aurel

  • Guest
Re: ElseIf Limitatation ?
« Reply #13 on: February 15, 2015, 03:04:28 PM »
I really don't know what is wrong with version of o2 dll which i use
and it looks that i must  avoid all SELECT /END SELECT things
and use IF / END IF
Also i need to modify all event messages....c***
 ::)

Peter

  • Guest
Re: ElseIf Limitatation ?
« Reply #14 on: February 15, 2015, 03:30:18 PM »
Poor Aurel, there is a new dll in space.    :D