Misc Notes
Misc Notes
Hi Don,
Two comments:
(1)
"ExitTask" is not syntax-highlighted, though it should be.
(2)
Do Until <variable = TRUE> does not seem to function.
However, Do Loop, and Do Loop Until <Exp> do work fine.
Two comments:
(1)
"ExitTask" is not syntax-highlighted, though it should be.
(2)
Do Until <variable = TRUE> does not seem to function.
However, Do Loop, and Do Loop Until <Exp> do work fine.
I am sure you already did this.... but is the variable Boolean?
I find this one item in BASIC a little annoying. In C, which I use more often, anything other than zero is "TRUE". I end up checking if a variable is <> 0 instead of converting to a boolean and then checking against TRUE.
I am not sure which technique is faster to execute, but it can not be too different given the type conversion.
-Tony
I find this one item in BASIC a little annoying. In C, which I use more often, anything other than zero is "TRUE". I end up checking if a variable is <> 0 instead of converting to a boolean and then checking against TRUE.
I am not sure which technique is faster to execute, but it can not be too different given the type conversion.
-Tony
ExistTask is not a ZBasic keyword. It is a system library function and is therefore not highlighted.
Mike
http://home.austin.rr.com/perks/micros/
Mike
http://home.austin.rr.com/perks/micros/
Last edited by mikep on 04 December 2005, 14:33 PM, edited 1 time in total.
Thanks for the thought. Yes, it is boolean.spamiam wrote:I am sure you already did this.... but is the variable Boolean?
I find this one item in BASIC a little annoying. In C, which I use more often, anything other than zero is "TRUE". I end up checking if a variable is <> 0 instead of converting to a boolean and then checking against TRUE.
I am not sure which technique is faster to execute, but it can not be too different given the type conversion.
-Tony
Do until <.. = TRUE>
Loop
does not work, but
Do
Loop until <.. = TRUE>
does work, with the same expression in both. There can be no change jumping from the "Loop" back up to the "Do", so both should exit at some point, except that one runs for an extra cycle. Yet the top one never exits, the bottom works fine. I can debug the state of the expression from inside the loop, and it eventually shows TRUE in both cases; one goes on indefinitely.
I'm checking the timeout variable of GetQueue inside the loop: I pull in data until there is none left, in which case TimeOut= TRUE.
No one else has had issues with this? I guess it's just me
This is really a message for Don.
In the Language Reference Manual, CallTask is referred to as a statement. In the System Library Reference Manual it is referred to as special purpose along with Debug.Print. Also Console.Write and Console.WriteLine are referred to as methods. However there is some inconsistent formatting in the IDE:
In the Language Reference Manual, CallTask is referred to as a statement. In the System Library Reference Manual it is referred to as special purpose along with Debug.Print. Also Console.Write and Console.WriteLine are referred to as methods. However there is some inconsistent formatting in the IDE:
- CallTask - not a keyword but listed as a keyword in Appendix A.
- Console.Read - Read is a keyword. Console is not a keyword and is not listed in Appendix A
- Console.ReadLine - ReadLine is not a keyword
- Console.Write - Write is a keyword and listed as a keyword in Appendix A
- Console.WriteLine - WriteLine is not a keyword
- Debug.Print - Debug and Print are both keywords but only Print listed in Appendix A
- Register by itself is a keyword, listed in Appendix A
- Register.ACSR - neither are keywords and ACSR is not listed in Appendix A
Mike Perks
Note that these two constructions are equivalent:I end up checking if a variable is <> 0 instead of converting to a boolean and then checking against TRUE
Code: Select all
Dim b as Byte
If (CBool(b)) Then
End If
If (CBool(b) = true) Then
End If
Similarly, these are equivalent:
Code: Select all
Dim b as Byte
If (Not CBool(b)) Then
End If
If (CBool(b) <> true) Then
End If
Currently, this source code results in more code generated for the same result.
Code: Select all
Dim b as Byte
If (b <> 0) Then
End If
If you want the compiler to generate a listing that has mixed source and object code, add this line to your .pjt file:
Code: Select all
--list=filename.lst
Also, the problem with the Do Until has been confirmed, identified and resolved. As a side note, that would have been better as a separate post since it has to do with the compiler not the IDE.
- Don Kinzer
You may have noticed that CallTask is syntactically different from Call. I don't know why NetMedia chose the syntax that they did. It seems to me that the syntax ought to be similar, e.g.So CallTask is a keyword, ExitTask is not. Aren't both system library functions?
Code: Select all
CallTask taskName(taskStack)
The System Library comprises a set of procedures invoked in a fashion similar to the way that user procedures are invoked. The biggest difference between System Library procedures and user-written procedures is the polymorphic characteristics of some of the System Library procedures with respect to parameter types.
Mike has pointed out some inconsistencies in the documentation with regard to nomenclature. These issues will be addressed. One thing to note is that Debug.Print is actually one keyword, not two. It is not listed in Appendix A because there is no possibility of conflict with user's identifiers since you can't create an identifier with a period in it. Print is in the reserved word list (I assume) because it has historically been a keyword in Basic dialects.
The same is true for Read and Write, their presence is not due to the existence of the difficult-to-classify Console.Read and Console.Write. These "methods" were introduced in Visual Basic along with some object oriented features. Of course, ZBasic doesn't have any object oriented features but the syntax of Debug.Print, Console.Read, and Register.PortC suggests that it does.
The reserved word list contains words that have historically been part of Basic (perhaps as early as Dartmouth Basic) even though they might not be keywords in Visual Basic, BasicX or ZBasic.
- Don Kinzer
Well, I'd not expect it is just you with such a simple statement as do...loop stuff.No one else has had issues with this? I guess it's just me
I have used it both ways (I think) with no specific problems, It all depends on whether I want the loop executed at least once or not.
Usually I use "while" instead of "until". I think you would just invert the logic, no?
If you are having trouble with the "until", try it with "while" using just the minimal code to show the error, and then show how it works with "until", then give it to Don, he can then analyse it. He is really fast in showing me the holes in my logic.
Those whiles and untils are particularly prone to infinite loops when I have a brain freeze about the truth tables of the logic.
-Tony
Actually, the compiler handles Do Until exactly like Do While except that the sense of the test is inverted. Consequently, coding it the other way produces exactly the same result.If you are having trouble with the "until", try it with "while"...
The correction for the error was fairly simple. We just need to confirm it through the test suite to make sure no regression errors were introduced.
- Don Kinzer
Yes. It is the last item listed in the change notes in the update announcement.... has the do..loop issue been corrected?
- Don Kinzer