13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The SCAN FunctionThis function scans a limited range of memory, backward or forward,looking for a one-byte target. The target may either be a specified byte, orany byte different from a specified byte. SCAN returns an integer valuerepresenting the number of bytes from the starting point to the target. Thisfunction can be written two ways:SCAN CLIMIT, =TARGET, START>orSCAN The parameters you give to SCAN must follow these rules:o LIMIT stands for an expression with an integer value, representing themaximum number of bytes to scan. If it is negative, SCAN will scanbackwards. If SCAN fails to find the target, it will return the value of theLIMIT expression.o TARGET stands for an expression of type CHAR. Target values of othertypes can be converted into CHAR values by the CHR function describedabove under "Scalar Operations." If it is preceded by the= symbol, SCANlooks for a byte with the target value; if it is preceded by < >, SCANlooks for the first byte that is not the target value.o START stands for a variable reference, referring to a variable of anytype except a file type. The first byte of the variable is the starting pointof the scan.o When scanning a string or an array, the START reference may be to anindexed element. Thus SCAN can start searching at any place in a stringor array, backward or forward. You can add the number it returns to theindex value where it started, using the result as an index value to definethe starting point for procedures such as FILLCHAR.If SCAN finds the target at the first byte, it returns a value of 0. If it does notfind the target it returns the value of LIMIT. If LIMIT is negative, it scansbackward and returns 0 or a negative value.The FILlCHAR ProcedureThis procedure fills a specified range of memory with the same byte value.It is written like this:FILLCHAR

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!