![]() |
|
STR problem (*solved*) - Printable Version +- Boriel Basic Forum (https://forum.boriel.com) +-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://forum.boriel.com/forumdisplay.php?fid=15) +---- Thread: STR problem (*solved*) (/showthread.php?tid=107) |
STR problem (*solved*) - LCD - 2009-05-11 Code: SUB MeineRoutine(x as uinteger,y as uinteger,a$ as string)
IF a$="Test" THEN erg$="Es wurde nur getestet"
ELSE erg$=a$+str(x)+" "+str(y)
end if
PRINT erg$
END SUB
MeineRoutine(30,11,"Hallo")I guess, this is a Problem with STR because this: Code: dim a as ubyte
a=20
print str(a)BTW: should POKE STRING adr,string$ work? I mean, if POKE UINTEGER works... Re: STR problem - boriel - 2009-05-11 The 1st problem seems a critical bug, so I'm going to fix it right now! (The function parameter STR(X) bug). On the other hand, this code works ok: Code: dim a as ubyte
a=20
print str(a)Emulator crashes are not related to the compiler (or should not be). Note: The POKE STRING ... is a rather strange case. I will check it, anyway. Re: STR problem - LCD - 2009-05-11 boriel Wrote:The 1st problem seems a critical bug, so I'm going to fix it right now! (The function parameter STR(X) bug). I was using SPIN 0.666, but after finding it a little "unstable" I should maybe switch to different emulator. It was a crash of the Spectrum code inside emulator. But I had cases where the emulator completly crashes (not from your compiler). I also found out that the compiler warnings ("x defined as float", or "x not used") causes the compiler to stop the compilation. But I don't give up... Re: STR problem - boriel - 2009-05-11 LCD Wrote:???boriel Wrote:The 1st problem seems a critical bug, so I'm going to fix it right now! (The function parameter STR(X) bug). Al this behavior is really odd and is scaring me... hock: Which codes produces "x defined as float" or "x not used"? "x not used" should appear if x variable is not used and optimization level (-O) > 1. E.g. -O2 Then x variable is removed. Other than that, it should produce a program. By the way, a workaround on your subroutine code, place Code: DIM erg$EDIT: Fixed. I didn't forgot it. Just an extra tab mislead in a python sub.... and that was the bug!
Re: STR problem - LCD - 2009-05-11 boriel Wrote:LCD Wrote:???boriel Wrote:The 1st problem seems a critical bug, so I'm going to fix it right now! (The function parameter STR(X) bug). Scary, I know... If I write Code: Dim daytime$ as string"warning: Variable 'daytime' is never used Errors occured, compilation failed". the same with other variables: Code: Dim a as ubyteWill check again which code resulted in "x definded as float", maybe the break was caused by something different (I often forgot to write "THEN" after IF and ELSEIF) :oops: Thanks for fixing the other bug .
Re: STR problem - boriel - 2009-05-12 LCD Wrote:Scary, I know... If I writeWell, catching ELSEIF and others missing syntax error is something I will try to improve soon. Can you paste some code where this happens? (I need more code context). Re: STR problem - LCD - 2009-05-12 boriel Wrote:LCD Wrote:Scary, I know... If I writeWell, catching ELSEIF and others missing syntax error is something I will try to improve soon. Code: dim a as ubyte
dim b as uinteger
a=20
print a"temp.bas:2: warning: Variable 'b' is never used Errors occured, compilation failed" It occurs only with optimisation levels 1-3, but not if no optimisation is selected. Re: STR problem - boriel - 2009-05-12 LCD Wrote: This is what I get: Quote:zxb temp.bas -O2 -T -B -a I also see something strange in this error message: Quote:temp.bas:2: warning: Variable 'b' is never used Errors occured, compilation failedthe bold letters are not part of the compiler message! :?: I also get the warning, but the program gets compiled, and temp.tzx file is created. Perhaps you're using an external IDE / script to compile? Notice that warnings are also send to stderr output (like error messages), because many programs expect them this way. Re: STR problem - LCD - 2009-05-12 boriel Wrote:Yes, I'm a donkey, that's the reason... It works if I compile first and then start the emulator, not if I start the batch operation (compile and then start the emulator automaticaly).LCD Wrote: I'm using a IDE which does not start the emulator after compilation if something was sent over the stderr channel (because it supposes to be a error which aborts the compilation). Could you please change the output to send such messages to the normal std program output, like the other compiler (optimisations) warnings? Re: STR problem - boriel - 2009-05-17 LCD Wrote:boriel Wrote:Yes, I'm a donkey, that's the reason... It works if I compile first and then start the emulator, not if I start the batch operation (compile and then start the emulator automaticaly).LCD Wrote: Sorry for the delay. You might guess I've been really busy these days. Back to the topic: zxb.exe already returns an errorlevel <> 0 if there were an error (this is the standard behavior). You can however tell the compiler to use a different file (--stderr), but it will not separate warnings from errors. I suppose I will have to add a flag for that. Re: STR problem - LCD - 2009-05-18 boriel Wrote:zxb.exe already returns an errorlevel <> 0 if there were an error (this is the standard behavior). You can however tell the compiler to use a different file (--stderr), but it will not separate warnings from errors. I suppose I will have to add a flag for that.No chance to read the error level because error level cannot be readed out, but you send the usual compiler warning (INFO) like these: Code: INFO: COPY_ATTR is not defined. No optimization is done.
INFO: BORDER is not defined. No optimization is done.
INFO: CLS is not defined. No optimization is done.
INFO: BRIGHT_TMP is not defined. No optimization is done.
INFO: PRINT_STR is not defined. No optimization is done.
INFO: PRINT_EOL_ATTR is not defined. No optimization is done.
INFO: PRINT_EOL is not defined. No optimization is done.
INFO: FLASH_TMP is not defined. No optimization is done.
INFO: __STREQ is not defined. No optimization is done.
INFO: CHR is not defined. No optimization is done.
INFO: PRINT_STR_FREE is not defined. No optimization is done.Edit: I solved if presently by filtering returned error string, so if the word "warning" is present, it does not count as critical error, so the emulator can start. Re: STR problem - boriel - 2009-05-18 LCD Wrote:Yes you can! Try this:boriel Wrote:zxb.exe already returns an errorlevel <> 0 if there were an error (this is the standard behavior). You can however tell the compiler to use a different file (--stderr), but it will not separate warnings from errors. I suppose I will have to add a flag for that.No chance to read the error level because error level cannot be readed out, Quote:C:\>zxb.exeThe environment variable %errorlevel% only returns 0 on successful compilations. This value is also returned in most APIs when executing a external program as "return code" or "exit value" or similar. Quote: but you send the usual compiler warning (INFO) like these:This will be transformed into :remark: or :info: codes (like warnings, but less important) and also output to stderr in the next version (I've been so busy fixing bugs I couldn't do this before). Anyway, I will add a flags for warnings and infos like '--warnings-file' and '--info-file' so you can isolate warnings from error msgs, etc. Re: STR problem - LCD - 2009-05-18 boriel Wrote:The environment variable %errorlevel% only returns 0 on successful compilations. This value is also returned in most APIs when executing a external program as "return code" or "exit value" or similar.Oh, so it was the return/exit value. Okay, now it works, thank you! Quote:This will be transformed into :remark: or :info: codes (like warnings, but less important) and also output to stderr in the next version (I've been so busy fixing bugs I couldn't do this before).Okay, I changed it to use exit value, now it works fine. Fixing bugs is more important :mrgreen:. Anyway, thank you for the help. |