Recent Posts

Pages: [1] 2 3 ... 10
1
Introducing Oxygen / Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Last post by John on April 24, 2019, 07:47:34 AM »
It would nice if Mr. Roca would join us again and pickup where he left off with his documention effort.

2
Introducing Oxygen / Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Last post by Charles Pegge on April 24, 2019, 06:39:08 AM »
Thanks, Roland.

I'll update the manual:

Code: [Select]
data       "#autodim 13 44"
'action:   enable variables to be created without a Dim statement
'use:      for mall, informal programs.
'example:  #autodim on
'related: 
'group:    directives
'updated:  24/04/2019
3
Introducing Oxygen / Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Last post by Arnold on April 24, 2019, 02:50:16 AM »
Hi Charles,

this is stated in Oxygen Helpfile:

#autodim
ACTION: enable variables to be created without a Dim statement
 
USE: switch off this mode for stricter compiling!
 
EXAMPLE: #autodim off

REMARKS: this mode is normally active.
 
In older versions of Oxygenbasic #autodim was the default, since version B0 the default is: #autodim off. From my experience, I can confirm that this behaviour is much less error-prone. Could 'active' be changed to 'disabled' in the next Oxygen Helpfile? I suppose the option now is #autodim on?

Roland
4
Data Processing / Re: Something for fun
« Last post by Aurel on April 23, 2019, 06:05:09 AM »
Arnold ..and anyone who wish to try
in attachment is a quick fix of ANIscript-tokenizer (transparent)
even if you cannot see processing because is very quick
but you will see some actions...

so unpack content of zip and:

compile ANI_v4.o2bas
click second button ( open file icon)
select file EDBasic.bas      ps...simple interpreter by EdDavis written in qbasic(i think).
open that file in richedit control
then confirm
and relax and watch

file have 347 lines of code

ps.. nice thing to add would be progress bar ?
5
Problems & Solutions / Re: String SELECT - tip&trick
« Last post by Aurel on April 23, 2019, 04:39:52 AM »
Hi Arnold

Quote
I cannot imagine that your approach will work properly in the long run.

Yes i suspect that ..so i tested it in my microA tokenizer program
and also in my ANIscript program .
https://www.oxygenbasic.org/forum/index.php?topic=1485.0
https://www.oxygenbasic.org/forum/index.php?topic=1866.0
And i both cases work very good .  :)
And you can try it.

I know that Charles tell me that is only 4 char tested but from what i see it works with larger strings too.
6
Introducing Oxygen / Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Last post by Charles Pegge on April 23, 2019, 02:46:25 AM »
Hi Roland,

.here is used internally. I will change this internal label to something decorated with underscores.
7
Introducing Oxygen / Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Last post by Arnold on April 23, 2019, 01:19:10 AM »
Hi Charles,

as is, this little code will crash:

Code: [Select]
$ filename "Here.exe"
'uses rtl32
'uses rtl64

uses console

dim a$ as string

a$="abcdefg"

goto here              'here will crash?
a$ = "1234567890"       'this does not get executed

here:
a$ = right$(a$,5)

print a$

printl "Enter..."
waitkey

If I replace "here" with "there" everything will work fine. You applied here in some cases too like:
    call fwd here : .here : pop eax : sub eax,here : add eax,bssdata

but this is labelled as .here, perhaps this does conflict with here:  It is not a major problem, I only wanted to notify you about the behaviour.

Roland
8
Problems & Solutions / Re: String SELECT - tip&trick
« Last post by Arnold on April 23, 2019, 12:42:48 AM »
Hi Aurel,

I cannot imagine that your approach will work properly in the long run. Reading Oxygen Help file and the demos \examples\basics\Select.bas, Switch.o2bas, SelectAscii.o2bas I can see that only numeric values like sys, int, byte etc. are used with the select / switch case block which corresponds to the C standard.

I noticed that this topic has been already discussed:

Why SELECT not respond on string variable? 
https://www.oxygenbasic.org/forum/index.php?topic=1499.msg16329#msg16329

and look at reply# 8:
"Careful! Only the first 4 characters are tested, as an integer"

Probably the simplest way in Oxygenbasic is to use the if .. then .. elseif .. else .. endif conditional block for comparing strings (see reply#1).
 
9
Problems & Solutions / Re: String SELECT - tip&trick
« Last post by Aurel on April 22, 2019, 01:06:26 AM »
Here is example using macro function:

Code: [Select]
'selection with INT
'using macro function
macro strSelect(s)
sys p at strptr s
select p
case "Oxygen"
print "NO"
case "oxyGen"
print "OK-SELECTED"
case else
print "Unknown selection!"
end select
end macro

'input string...
string s = "oxyGen"
'call macro...
strSelect(s)
10
Problems & Solutions / String SELECT - tip&trick
« Last post by Aurel on April 22, 2019, 12:38:09 AM »
I often forget how to use SELECT with string type
and some things not work as it should be
so i was tested all possible options
and i found one strange things....

in some cases
byte b at strptr(s)

select b

....


work without problems but in this one not:

Code: [Select]
'str pointer - select
#autodim off
string s = "Oxy"
'print p + len(s)
byte b at strptr(s)

select b

case "basic"
print "NO!"

case "OXYGEN"
    print "NO!"

case "Oxy"
    print "YES"

end select

print "ok"

so you can try..just print OK

then i try to use INT instead of byte:
Code: [Select]
'selection with INT
'string casting -> select/filtering

string s="SELECT_STRING_WITH INTEGER" ' more than 4 chars
'(i AS string pointer)
INT i at strptr s  ' integer pointer cast string s

select i
case "SELECT_STRING_WITH INTEGER"
print "OK..this WORK!"

case "PRINT"
print "OK..just to compare"

    case else
       print " Error : Unknown selection!-> "

end select

print "OK!"

also work if type is SYS

Code: [Select]
'selection with INT
'string casting -> select/filtering

string s="SELECT_STRING_WITH INTEGER" ' more than 4 chars
'(i AS string pointer)
SYS i at strptr s  ' integer pointer cast string s

select i
case "SELECT_STRING_WITH INTEGER"
print "OK..this WORK!"

case "PRINT"
print "OK..just to compare"

    case else
       print " Error : Unknown selection!-> "

end select

print "OK!"
Pages: [1] 2 3 ... 10