BugFix Challenge

Started by Zlatko Vid, April 02, 2026, 12:00:10 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Theo Gottwald

@Zlatko Vid
1. Is the source code of the actual Oxygen release anywhere downloadable?
2. What exact is the problem that needs to be fixed?
At least these Informations you must give the KI.
Then try again with Qwen 3.6 - it should find the problem.

Charles Pegge

Hi Theo,

The source code for the OxygenBasic compiler DLLs is in inc\self. The complete system is here. It is all that I use.

Hi Aurel,
Case strings are restricted to the first 4 bytes because the key string is converted into a dword. It's close to the bare metal :)

Zlatko Vid

Quote2. What exact is the problem that needs to be fixed?

Hi Theo

Exact problem is in function call and execution
for example :
add(1,2)
should be 3 but stupid interpreter constantly throw 0
that is why i said that in console type of programs is hard to follow
or track errors it is much easier with message box aka print in GUI version of o2.
I hope that you understand it now
yeah sorry maybe looks confusing...

Hi Charles
yeah you many times explain this to me
what confuses me is ..is ir 4 bytes or 4 first characters
uff..

  •  

Charles Pegge

#18
Hi Aurel,
I'ts the first 4 bytes. which could be only 2 wide characters (unicode)

I checked these direct string cases. Unfortunately this hack will no longer work. However, you can use any ascii combo of any string character to use in your cases:

string s="abc" 'test case
'
select asc(s,2)
  case "a" : print "A"
  case "b" : print "B"
  case "c" : print "C"
  case else : print "no match"
end select

Charles Pegge

#19
To digress a little:

As of March 2024, OxygenBasic supports the combination of CASE and full conditional expressions in one block. You can use this facility to case-evaluate strings of any length:

string s
s="abcd"
select asc s
  'embedded conditional expressions
  case s="abcde" : print "ABCDE"
  case s="abcd"  : print "ABCD"
  case s="abc"   : print "ABC"
  'normal cases
  case "a" : print "A"
  case "b" : print "B"
  '
  case else : print "no match"
end select


Zlatko Vid

Thanks Charles
I don't know that this work
also i see u use asc inside select statement
so i try without asc
and work ...okay  ;)
  •  

Zlatko Vid

..this also work with lcase(s)

string s
s="abcdefghijklmnopqrstuvwxyz"
select lcase(s)
  'embedded conditional expressions
  case s="abcde" : print "ABCDE"
  case s="abcdefghijklmnopqrstuvwxyz"  : print "Alphabet - Match!"
  case s="abc"   : print "ABC"
  'normal cases
  case "a" : print "A"
  case "b" : print "B"
  '
  case else : print "no match"
end select
 
  •  

Zlatko Vid

and this one too...
select chr(115)
  'embedded conditional expressions
  case s="abcde" : print "ABCDE"
  case s="abcdefghijklmnopqrstuvwxyz"  : print "Alphabet - Match!"
  case s="abc"   : print "ABC"
  'normal cases
  case "a" : print "A"
  case "b" : print "B"
  '
  case else : print "no match"
end select
  •  

Charles Pegge

In your examples, the matching case is evaluated as a full expression. It would not work the other cases.

But I have just put in an error trap to prevent select strings ! :)

Zlatko Vid

you mean you put asc ?
  •  

Charles Pegge

Yes, For normal cases, use asc() or any byte value that represents the characters you want to select for.

Here is another example:
'select with compound asc expression
string s
s="ab"
'ab == 0x61 0x62
int a=asc(s,1)+asc(s,2)*256
select a
  case "ac" : print "AC" '0x61 0x63
  case "ab" : print "AB" '0x61 0x62
  case else : print "no match"
end select