Download BL600 smartBASIC Module
Transcript
smart BASIC User Manual PRINT “\n”;”[“;T$;”]” ‘output will be [] TABLEINIT is a core function. TABLEADD TABLEADD adds the token specified to the lookup table in the string variable and associates the index specified with it. There is no validation to check if nIndex has been duplicated as it is entirely valid that more than one token generate the same ID value TABLEADD (string, strtok, nID) Function Returns INTEGER Indicates success of command: 0 Signifies that the token was successfully added 1 Indicates an error if nID > 255 or < 0 2 Indicates no memory is available to store token 3 Indicates that the token is too large 4 Indicates the token is empty Exceptions Local Stack Frame Underflow Local Stack Frame Overflow Arguments string byRef string AS STRING A string variable that has been initialised as a table using TABLEINIT. strtok byVal strtok AS STRING The string token to be added to the table. nID byVal nID AS INTEGER The identifier number that is associated with the token and should be in the range 0 to 255. Note: string cannot be a string constant, e.g. “the cat”, but must be a string variable and so if you must use a const string then first save it to a temp string variable and then pass it to the function Interactive Command: NO Associated Commands: TABLEINIT, TABLELOOKUP DIM T$ DIM resCode resCode = TABLEINIT(T$) PRINT TABLEADD(T$,”Hello”,1) PRINT TABLEADD(T$,”world”,2) PRINT TABLEADD(T$,”to”,300) PRINT TABLEADD(T$,””,3) ‘outputs ‘outputs ‘outputs ‘outputs www.lairdtech.com 96 0 0 1 4 Laird Technologies