Oxygen Basic
Programming => Problems & Solutions => Topic started by: Aurel on November 26, 2012, 01:34:55 PM
-
Charles..
I think that something is wrong with IF/END IF block inside FOR/NEXT loop.
In my case i test string
FOR...
IF c$ = "one"
doOne()
END IF
IF c$ = "two"
doTwo()
END IF
IF c$ = "three"
doThree()
END IF
'this IF block refuse to work ???
IF c$ = "Four"
doFour()
END IF
NEXT
If i use IF/ELSEIF/END IF then work properly... ::)
So fourth IF block don't couse error but create invalid executable ???
Is this some kind of bug ,if is it- this is really weird...
Do you know for that?
-
Hi Aurel, I think the problem may be elsewhere. It is too fundamental to have escaped detection so far
Can you demonstrate the problem with a small program?
my test code:
function f1() as sys
return 1
end function
function f2() as sys
return 2
end function
function f3() as sys
return 3
end function
function f4() as sys
return 4
end function
sys a,i
string one="one"
string two="two"
string three="three"
string four="four"
string s="four"
for i=1 to 100
if s="one"
a+=f1
end if
if s="two"
a+=f2
end if
if s="three"
a+=f3
end if
if s="four"
a+=f4
end if
next
print a '400
Charles
-
Hi Charles,
X
-
Clipped the top of the program, now repaired. Sorry :)
-
No panic, ( IF/ELESIF/ELSE/ENDIF) works well with OxygenBasic!
-
No panic but in another computer don't respond.
Now work... ???
Is this problem maybe connected with manifast file?
When i compile program who already have manifest file then this
program in another folder(without manifest) not work...what is strange to me .. ::)
-
Hi Aurel,
I solved your problem.
sys a,m, string c1="one",c2="two",c3="three",c4="four"
Sub DoFour()
m +=1
End Sub
Sub DoThree()
m +=1
End Sub
Sub DoTwo()
m +=1
End Sub
Sub DoOne()
m +=1
End Sub
for a=1 to 10
IF c1 = "one" then
doOne()
END IF
IF c2 = "two"
doTwo()
END IF
IF c3 = "three"
doThree()
END IF
IF c4 = "Four" '<- make "four" and m will be 40!
doFour()
END IF
next
print "Aurel programming is weird " + m
Strings in capitals gives a wrong result! Help, Help, Help
-
Gee yes Peter you right literal (quoted)strings in upper case
gives a error- invalid final executable like this :
string s="FOUR"
for i=1 to 5
if s="ONE"
doOne()
end if
if s="TWO"
doTwo()
end if
if s="THREE"
doThree()
end if
if s="FOUR"
doFour()
end if
next
but when i change string s to lower case there is no error, like this ..
string s="four"
for i=1 to 5
if s="ONE"
doOne()
end if
if s="TWO"
doTwo()
end if
if s="THREE"
doThree()
end if
if s="FOUR"
doFour()
end if
next
So..this looks like a bug,right?
Another thing which i have found is under select/end select ...
instead of :
CASE "A"
i must write
CASE strPtr "A"
why is that ?
-
Hi Aurel,
sys a, m string c="AUREL", c1
for a=1 to 5
c1= asc(c,a)
select c1
case "A"
m +=1
case "U"
m +=1
case "R"
m +=1
case "E"
m +=1
case "L"
m +=1
end select
next
print "The Name has " + m + " Letters"
Nothing wrong here!
-
more complicated.
sys a,b,ma,mb,mc,md,me, string c="AAUUURELLL", c1
for b=1 to 1
for a=1 to 10
c1= asc(c,a)
select c1
case "A"
ma +=1
case "U"
mb +=1
case "R"
mc +=1
case "E"
md +=1
case "L"
me +=1
end select
next
next
print "Found " + ma + "x A"
print "Found " + mb + "x U"
print "Found " + mc + "x R"
print "Found " + md + "x E"
print "Found " + me + "x L"
-
I dont say that nothing is wrong.
I tell you that compiler don't say it is error because is not BUT
produced executable is not valid...that is a main problem...
-
You have got the wrong OXYGEN.DLL :D
Amen
-
Is not wrong oxygen.dll.... >:(
There is still one old problem connected with transformation from string
to strPtr - which solve problem in half but it is strange that program
when is used bstring - not crush without manifest
but using strptr() crush without manifest...geee ::)
so i must use bstring for - for example fill listbox control...grrr
I am not sure is this problem somehow connected with FB ???
All in all some things with strings simply don't work properly in usual way( in GUI programming).
-
produced executable is not valid...that is a main problem...
Try this one.
Charles
-
Hi Charles...
It looks that both examples 'compile and run' fine ;)
with or without manifest.
Hmm what is this;
#file "t2.exe"
I never see this before ???
is this something new ?
Do you have made changes in oxygen.dll & rtl32.inc ?
I will try do this directly in my program...
I don't wanna bothering you with strPtr or bstring but sometimes really drive me crazy ::)
-
Hi Aurel,
#file is for oxygen-dependent compiling, the other one strips out all oxygen.dll depenencies, and includes the run-time libraries instead.
-
Ok...good ;)
-
Corrected Oxygen.dll.
#lookahead was not working!
X
-
Thanks.. :)