Oxygen Basic
Programming => Problems & Solutions => Topic started by: Arnold on February 15, 2015, 12:28:07 PM
-
Hi Charles,
I found in examples\System\Threads in the demo together.o2bas the first lines:
'================================================
'MULTIPLE THREADS WITH SYNC FOR STRING PROCESSING
'================================================
#include "$\inc\minwin.inc"
#define INFINITE 0xFFFFFFFF 'Infinite timeout
This results to the error:
Linker found unidentified names:
timeout: level 0
If I use // or ; instead of ' then the demo runs ok.
And if I use rem or REM then the demo runs forever and uses increasing memory until I kill gxo2.exe with the Task-Manager. I do not know if this is the case only with my 32bit system?
Roland
-
And there is another small error in examples\System\SharedMem:
in the demo SharedMemClient.o2bas there is this code at about line 43:
& pBuf = MapViewOfFile(hMapFile, // handle to map object
FILE_MAP_ALL_ACCESS, // read/write permission
0,
0,
BUF_SIZE);
if (& pBuf == 0)
this results to the error:
RROR: Too many right brackets (..))
WORD: }
LINE: 65
FILE: main source
PASS: 1
If I modify to:
if (&pBuf == 0)
then the demo runs ok. I wonder why & pBuf = MapViewOfFile(hMapFile does work, but the second use of & pBuf does not work?
-
Hi Roland,
Yes, #defines have become sensitive to '.. basic comments in conflict with c character literals.
These thread and shared-mem examples require additional attention.
Thanks!
-
#define should no longer contain BASIC comments
but the other problems are fixed.
Oxygen Update
http://www.oxygenbasic.org/o2zips/Oxygen.zip
-
Hi Charles,
it is incredible how fast you can find a solution.
Unfortunately with the last build of Feb. 15. there is now an error message with some demos which was not with the o2hbuilds before e.g. in c:\oxygenbasic\examples\OpenGl:
BezierClosed1.o2bas
; ASM ERR: rect rc!! Unidentified instruction: rect
; AFTER: .getclientwhxy#sys#sys#sys#sys#sys
; LINE: 115
getclientwhxy is in WinUtil.inc but all these demos worked ok before.
I would also like to share my observations with comments. Oxygen can recognize 5 different kind of comments: ; rem // ' /* */ (Did a forget any?). This is a lot compared with other languages which only use one or two ways to comment, sometimes only in one line. But this can of course get very complex. I tried together.o2bas with your last update using some combinations:
#define INFINITE 0xFFFFFFFF //Infinite timeout --> ok
#define INFINITE 0xFFFFFFFF ; Infinite timeout --> ok
#define INFINITE 0xFFFFFFFF /*Infinite timeout*/ --> ok
#define INFINITE 0xFFFFFFFF ' Infinite timeout --> linker error --> ok
#define INFINITE 0xFFFFFFFF rem Infinite timeout --> linker error --> ok
#define INFINITE 0xFFFFFFFF // ; rem '[* Infinite timeout *] --> ok
#define INFINITE 0xFFFFFFFF rem // ; rem '[* Infinite timeout *] --> linker error --> ok
#define INFINITE 0xFFFFFFFF '// ; rem '[* Infinite timeout *] --> too many nests, should be linker error?
#define INFINITE 0xFFFFFFFF '//Infinite timeout --> gxo2.exe must be killed
#define INFINITE 0xFFFFFFFF ' //Infinite timeout --> gives strange result
#define INFINITE 0xFFFFFFFF rem//Infinite timeout --> linker error --> ok
There are some more possible combinations. As a newbie I do things which I would normally not think about. But the combinagion '// and ' // should perhaps be examined. Maybe it is possible that after #define rem and ' simply return a linker error as is in some cases?
But undoing the ASM ERR is more important.
Roland
-
Hi Roland,
I've already caught the first error. That was a WinUtil.o2bas error rather than from the compiler itself. RECT & POINT now capitalised.
I will try to make #define ascii 39 quotemarks a little more robust, but in general, avoid using #define with Basic syntax.
Thanks
Charles
PS: if the quotemarks are not in short pairs - a Basic comment is now assumed:
Oxygen Update
http://www.oxygenbasic.org/o2zips/Oxygen.zip
-
Hi Charles,
with the last update the error message has gone away. Hopefully you are not annoyed about my claims which sometimes are really marginal. But as I am in a learning stage my thought is that it should not harm to notify you about what could happen. My questions are also a reminder for me what I can do and what I should avoid. If I would not be convinced of OxygenBasic's stable fundament and of your brilliant capabilities I would not say anything.
So probably I will still have some questions about OxygenBasic (maybe a handful). With nearly 800 demos this should be tolerable. Then I will be ready to be a bit more constructive / productive (hopefully).
Roland