Re: TIB: 92+ Picture to Matrix conversion...Test Var size, PassErr


[Prev][Next][Index][Thread]

Re: TIB: 92+ Picture to Matrix conversion...Test Var size, PassErr




1

If you have a 92+ then you can use a machine code program to do the work for
you in a lot less time; otherwise, you'll have to use the For...Endfor
statement.  Just remember, you could use pxltest with list arguments, like
pxltest({1,2,3},{1,1,1}) would return a list of true and false for the pixels
at 1,1; 2,1; and 3,1.

2

{{ Is there any way to test the size of a variable?  Like when you're on the
Var-Link screen and it shows you how many bytes the variable actually uses (I
don't mean like dim() or anything).  How does PassErr work?  If floor() is
identical to int(), then why did they put both of them in? }}

ASM can test the size of the variable, otherwise, you can manually test
variable size by formulas.  For example, Strings are consisted of the length
of the string plus 5, expressions change from 4 bytes for 0, 5 bytes for 1 to
255, 6 bytes for 256 to 65536, etc.

In a Try...EndTry statement, it is set up like the following:
Try
commands to try
Else
these commands are only used if an error occurs
EndTry
In the Else location, you would either place ClrErr to Clear the Error, or
PassErr which means that it tells the calculator to go ahead and tell the
person what error has occured.  You can actually cause a "fake" error to occur
by storing the error number found on pages 472 to 478 of the 92 Manual into
the "errornum" system variable and use "PassErr".  Try the following on the
homescreen:

10->errornum:PassErr

you should get a "A function did not return a value" error because that is the
error for error number 10.  The following are added errors that were found but
don't really do anything nor can be accidentally caused by a BASIC program:

1020=Internal Error
1030-4099=Protected memory violation
4100-32767=Unknown ERROR code

Here's an example of a Try...Endtry statement found in the book (revised--it
will draw a point plot of the equation y(x)=1/x and if it hits a non-real
result, it will clear the error and keep going.  PassErr on errornum of 0 will
do nothing, but if there is another error then it will be shown to the user
and program stop executing.):

ZoomStd
1/x->y1(x)
For x,-10,10,*delta*x
Try
 PtOn x,y1(x)
Else
 If errornum=800:ClrErr
 PassErr
EndTry

-Rob