Oxygen Basic
Programming => Bugs & Feature Requests => Topic started by: Emil_halim on April 19, 2014, 03:18:26 AM
-
Hi Charles,
I have just download the latest Oxygen DLL , then i tested on of my old HLasm with OXYgenbasic.
i got a wrong result with new upgrade.
here is my example
//*********************************
//* test program by Emil Halim *
//* 5 / 4 / 2013 *
//*********************************
indexbase 0
includepath "$/inc/"
$ filename "AscToDword.exe"
#include "RTL32.inc"
zstring a[]="12345"
addr edx,a : gosub AscToDwor_proc : add eax , 10
print eax //12355
end
==========================
AscToDwor_proc:
xor eax, eax ; clear eax
^ @@: movzx byte ecx, [edx] ; move 1 byte into ecx
^ lea eax, [eax+eax*4] ; eax = 5 * eax
^ lea eax, [eax*2+ecx-30h] ; eax = 2 * eax + (ecx-30h)
^ edx++ ; inc edx
^ cmp byte[edx], 0 ; if end of string then return
^ jne @b
^ ret
it prints 212353 instead of 12355
any help please?
-
Hi Peter,
welcome to Oxygen basic forum.
thanks you , i think the problem is old oxy dll was know the hex syntax 30h , but the new one did not.
Charles can you fix this please.
-
Hi Charles,
I have found another problem with the new oxy dll.
i have a declared dll function like this
! Graphics3D "_Graphics3D@20"(Dword Width,Height,depth=32, boolean fullScrn=false,VSync=false)
it was working okay, and now give me this error
ERROR: parameters mismatch for procedure graphics3d:
params given : #long#long#long#long#long#long@000_00
OPTIONS:
graphics3d(dword,dword,dword,dword,dword)
WORD: 0
LINE: 28
FILE: main source
PASS: 2
>Exit code: 0
i call it like this
Graphics3D(800,600)
so what could be the error here?
-
I think that something is wrong with new dll
because with old my programs work but with new i receive strange errors like
is on pic...
.
-
Hi Peter,
thanks , BTW that means the old version was buggy so it accepted boolean type.
any way , my big wish is that Oxygen basic is a bug free, so that i can trust in it's results.
-
Hi Emil,
Yes, I was attempting to remove undesirable number suffixes: h and o and e should be allowed through.
quick dll update:
http://oxygenbasic.org/o2zips/Oxygen.zip
As in C, bool is really an 32 bit integer
Test code:
typedef bool boolean
def true -1
def false 0
function Graphics3D "_Graphics3D@20" _
(Dword Width,Height,depth=32, boolean fullScrn=false,VSync=false)
print "depth " depth
end function
Graphics3D 100,200
---------------
'numbers with suffixes:
print 101h '257
print 101o '65
print 101.0e-4 '0.0101
Aurel, can you please provide an example of the string problem
-
What is the exact idea behind TRUE = -1, Charles?
-
thanks Charles,
i have another problem , see this declaration
! LoadMesh "_LoadMesh@12"(char* file="", sys EntityParent=0, char* meshName="") as sys
when calling it like that
ogrehead = LoadMesh("ogrehead.mesh",0)
i got this error
Linker found unidentified names:
file: level 0
meshname: level 0
BTW , the function accepts an empty NULL string as a default parameter , not a null pointer.
any help please.
-
Emil,
(re-edited)
I had not not considered using strings as default params.
there is an issue with '*' and default values
One solution is to use string instead of char*. They are compatible in this context.
Another is to create a char* type
typedef char *pchar
function f(pchar s="")
print strptr s
end function
f
Mike, -1 is a Basic truth :). Oxygen only does bitwise logic, currently.
-
Bulgarians nod to say "No" and shake their heads to say "Yes". :D
-
Is this correct?
With nose pointing in the z axis
Bulgarian Yes: glRotatef 20,0,0,1
Bulgarian No: glRotatef 20,1,0,0
-
Yes Charles, (that's a usual human "yes" :D )
You're perfectly correct. In fact, I was even trying to look up a better English word than "shake" in the dictionary but I failed - you don't have any other one to convey negation (neither do we BTW). By "shaking one's head" negatively, the English and the rest of the world (oh, those imperialistic lingual relics! ;) ) imply
glRotate(+/-20,0,1,0)
a few times and that's only natural and clear for all other earthlings but Bulgarians. They would convey negation by a one-time nod
glRotate(-/+20,1,0,0)
while their agreement would be conveyed with a one-time tilt
glRotate(-/+20,0,0,1)
of their head to their left shoulder, both gestures being performed invariably in that particular polarity.
It's almost impossible to communicate with a Bulgarian waiter in a restaurant; you have to ask them again and again until they would vocalize their answers.
But in ordinary life it's a convenient and customary simplification to say that Bulgarians just do it "the other way round" compared to us ordinary mortals. :)
-
Indian folks often do a few glRotatef +/-10,0,0,1 to indicate they agree with you. That could be a 'yes' but it certainly confused the Brits.
-
Another update for Emil. This fixes the default param '*' problem
quick dll update:
http://oxygenbasic.org/o2zips/Oxygen.zip
function f(char*s="Hello")
print s
end function
f
f "Hello World!"
-
thank's Charles.
works well here.
may i ask you about the states of c style syntax please.
-
Apart from occasional header fixes, further C syntax (c pointers & arrow notation etc) has a low priority at present.
-
Aurel, can you please provide an example of the string problem
Charles
Because i keep old oxygen dll-s i have tested my programs with this older versions
and in all this thing work properly but not in this new.
look in screenshot ...
it seems that parser not recognize keyword As properly ???
.
-
Thanks Aurel,
Could you try this release, an see what happens. I have removed 'as' as a casting keyword. I don't think anyone is using it for casting.
http://www.oxygenbasic.org/o2zips/Oxygen.zip
-
Ok Charles
But i am not sure what kind of casting is here ???
In older versions there is no PASS 2..right?
And with this new PASS 2 detect keyword As as casting
which is really weird..right?
ok i will try right now... ;)
-
Well with this dll error message is strange again ?
look in screenshot :o
.
-
Try this one. It will now report the line number, and include-file where the error occured.
It thinks that you are trying to "or" some string operands together :)
http://www.oxygenbasic.org/o2zips/Oxygen.zip
-
It thinks that you are trying to "or" some string operands together
Charles i don't know , code for that part is the same ..nothing is changed
And how in the world work with older version ?
Ok i will try with new one again.
PS.IF again not work i will post complete code with old dll in which work that you can try
directly what is wrong ...
-
Charles
something is very wrong with last dll because (as you can see from screenshot)
oxygen point in include file Line :2674
But awinh.inc have only 1430 lines :o
second
when i look into main code in line .2674 then
oxygen don't recognize operator OR in this line:
While (Look = "*" Or Look = "/")
what is a nonsense ..right?
and i repeat work perfectly in older oxygen.dll ( not in last two release )
in attachment is source code so you can try compile...
.
-
And here is version of dll which work fine.
I really don't know which version is but i am sure that are not two latest.
:-\
.
-
For Aurel.
(http://l.yimg.com/bt/api/res/1.2/xHstn8XAv3GS22jFMZrJPw--/YXBwaWQ9eW5ld3M7Zmk9ZmlsbDtoPTE4NztweW9mZj0wO3E9NzU7dz02MDA-/http://media.zenfs.com/en_us/News/ucomics.com/dt140424.gif)
Best part, Aurel will never appreciate the humor as translators don't work with images. :)
-
Not bad, John ;D
-
Yes work for that small example
but try compile ruben2 then tell me if compile ok on your computer?
and why compiler point on error in include file instead in main source ?
PS
Peter
This dll which work fine you post on my forum in OxyBasic package.
-
Thanks for posting your source, Aurel. I am on the case.
-
No problem Charles about that at all.
You will see that something is really ...really strange.
-
Aurel,
This one compiles and runs your code as far as the "No Source" message.
Some of the expressions you use generate complex assembly code. So it's a good stress test for the compiler :)
http://oxygenbasic.org/o2zips/Oxygen.zip
-
Some of the expressions you use generate complex assembly code.
Heh...
I have just one parser routine and few processing functions.
This one which create problems is from expression evaluator which original version
is created in PureBasic.
(In PureBasic this evaluator work extremly fast, it looks that is PB very fast with strings)
Hmmm why i use this evaluator?
Simply because is fast and don't create memory leaks.
As i say before with DLL which i currently use work fine and properly.
This message 'No Source' is ok ...so if you drag source file & drop into
this compiled exe(ruben2.exe) program is executed.
ok time to try... ;)
-
Charles
When i try to download dll from a given link i get this error msg ...
do you change something?
.
-
Sorry, it was meant to be zip rather than dll. Same as the previous.
I can see quite a few ways of boosting performance. For instance getting the next ascii code instead of getchar. Evaluating integers is much faster.
-
Evaluating integers is much faster
Hi Charles
Yes i agree But i already tried to implement your evaluator which is from my opinion
great but produce somehow mem leaks .
Only this evaluator don't produce mem leak ..how or why i don't know.
Maybe some sort of combination will work faster without leak ..
Anyway ...thank you very much on new DLL ;)
In attachment is a interpreter with few programs just to test Drag & Drop execution
:)
.
-
Anyone ...
is drag & drop work on your computer or not ?
thanks
-
Hi Aurel,
yes that is working nicely on Vista, thanks.
I'll see what can be done with Ascii vs Chars. It is easier to make gradual changes, rather than do something radical.
-
I'll see what can be done with Ascii vs Chars. It is easier to make gradual changes, rather than do something radical.
Yes i agree ,and you know this things far better than me.
-
An example of string elimination, producing more efficient binary
Before:
Function GetNum() as float
'print "SUB->GETNUM"
STRING Temp
If Asc(look) > 47 and Asc(look) < 58 ' read chars as numbers
'print "need number"
End if
While (Asc(Look) > 47 And Asc(Look) < 58) Or Asc(Look) = 46' dec.point
Temp = Temp + Look
Gosub getchar
'print "GetNum-TEMP:" + Temp
Wend
Return Val(Temp)
End Function
After:
Function GetNum() as double
'print "SUB->GETNUM"
sys c
byte *m=StreamPos-2+strptr(Stream)
do
select m
case "." : 'ok
case "0" to "9" : 'ok
case else : exit do
end select
@m++
c++
end do
if c
StreamPos+=c-1
GetChar
return Val((bstring) @b)
end if
End Function
GetChar is used to fit in with the rest of your program.
-
I've just plugged a memory leak associated with returning the ascii or val of a string expression. It's very specific. Examples:
return val(s+t)
return asc( mid(s,i,1) )
Thanks for exposing it, Aurel.
direct link for Oxygen.dll:
http://www.oxygenbasic.org/o2zips/Oxygen.zip
-
Hmm
I think that i understand ...you use byte pointer
Ok i will try ...thanks :)
-
Charles...
I am confused now ???
Is that mean that your method create memory leak
OR
you find memory leak in last DLL ?
-
It's a DLL fix. I found it by chance, when scruinising the Asm generated by string returns. The return jumped over the Temp-string garbage collector, instead of calling it.
It does not affect the code I posted above.
-
ok ;)
-
sorry Charles
But now is something wrong with compiled exes...not only with ruben interpreter then also with
ASciEdit to...
it looks that is something in conflict with win api becuse application crush when event is
triggered..for example after FileDialog or compile button is clicked.. ???
In package is old dll too.
And Charles
it looks that your version of GetNum not work
oxygen say ...there is no variable b
Function GetNum() as double
'print "SUB->GETNUM"
sys c
byte *m=StreamPos-2+strptr(Stream)
do
select m
case "." : 'ok
case "0" to "9" : 'ok
case else : exit do
end select
@m++
c++
end do
if c
StreamPos+=c-1
GetChar
return Val((bstring) @b)
end if
End Function
I look again and replace b with m and again not work for api graphics
what is really strange :o
then i replace this function with old and work ???
very very weird ...
.
-
Yes, sorry, there's missing lines. My code-pruning was overdone.
byte *b
@b=@m
Function GetNum() as double
'print "SUB->GETNUM"
sys c
byte *m=StreamPos-2+strptr(Stream)
byte*b
@b=@m
do
select m
case "." : 'ok
case "0" to "9" : 'ok
case else : exit do
end select
@m++
c++
end do
if c
StreamPos+=c-1
GetChar
return Val((bstring) @b)
end if
End Function
-
Charles
When you say:
- producing more efficient binary
do you mean faster execution?
So i tried two graphic programs with new GetNum() and looks to me that is not
faster than is even slower..is that possible?
I will built right now timer function to test time of execution then will see.
;)
-
After testing
difference are very small in execution but it looks that older DLL work
just a little bit faster then this new one.
it is not strange to me because execution of my small interpreter directly depend on
processing loop which read tokens from string array
so simply there is no significant speed up :-\
-
Aurel,
Something strange happening when ShellExecute is invoked. Will investigate further.
With regard to performance, the strategy is to reduce the number of string operations, in favour of integer operations, so the CPU has less work to do. That function is only one part of your parser.
PS:
ShellExecute is innocent. The problem was in the FileDialog prototype.
Cleanup for FileDialog:
Defext was defined as 'long', is now a string
Also using strptr for all string parameters.
FileDialog for awinh.inc
'FileDialog( $ iDir , $ filter ,$ title , % parent ,% flag )
Function FileDialog(String Dir, filter , Title , long Hwnd, Flags, string defext) As String
Dim ofn As OPENFILENAME
Dim filename[255] As zstring
INT retval
ofn.lStructSize = 76
ofn.hwndOwner = hWnd
ofn.hInstance = GetModuleHandle(0)
ofn.lpstrFilter = strptr filter
ofn.lpstrCustomFilter= NULL
ofn.nMaxCustFilter = 0
ofn.nFilterIndex = 2
ofn.lpstrFile = strptr filename 'zstring buffer
ofn.nMaxFile = 255
ofn.lpstrFileTitle = NULL
ofn.nMaxFileTitle = 0
ofn.lpstrInitialDir = strptr dir
ofn.lpstrTitle = strptr title
IF Flags = 0 then ofn.Flags = OFN_EXPLORER Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY
IF Flags = 1 then ofn.Flags = OFN_EXPLORER Or OFN_OVERWRITEPROMPT Or OFN_HIDEREADONLY
ofn.nFileOffset = 0
ofn.nFileExtension = 0
ofn.lpstrDefExt = strptr defext
ofn.lCustData = 0
ofn.lpfnHook = 0
ofn.lpTemplateName = NULL
' Execute the dialog box
IF Flags = 0 then retval = GetOpenFileName(ofn)
IF Flags = 1 then retval = GetSaveFileName(ofn)
Return filename
End Function
-
Yes i also think that is something wrong with shellExecute ...
so problem is in FileDialog ::)
hmm how then work with old DLL ?
ok i will fix things in FileDialog
thanks ;)