The data manipulation instructions perform arithmetic data functions and also change the contents of memory. Following the list of the instructions and descriptions of each are two sample scripts which illustrate how the instructions might be used in an application. For additional information about each of these instructions, see TAS script instructions.
and(type.dst,type.src)
The and instruction implements bitwise AND operations on the type.dst and type.src arguments, allowing scripts to decode or encode bit flags stored in a single integer. The result is stored in type.dst.
atoi(type.dst,ctype.src)
The atoi instruction converts a null terminated character string at the source to an integer value and stores that value at the destination. If an error occurs, a 0 is returned at the destination.
decr(type.dst,type.src)
The decr instruction decrements the destination value by the source value.
div(type.dst,type.src)
The div instruction divides the destination value by the source value. The integer quotient is stored in type.dst. The remainder is discarded. The div instruction returns a value of 0 in r.0 if no error occurred. If division by 0 is done and a -1 value is returned in r.0, the result is set to the largest positive or negative integer, depending on whether type.dst is positive or negative originally.
dtitos(type.src,type.dst)
The dtitos instruction converts date and time data from internal system form to tm structure form. The type.src argument should contain a number representing the system internal representation of time (number of seconds since 00:00:00 GMT January 1, 1970). It is recommended that the integer type be used for this argument. The resulting tm structure is put in type.dst (that is, type.dst defines a starting address for the result).
The dtitos instruction returns 0 in script r.0 if the conversion is successful. A -2 is returned in r.0 if TSM could not allocate enough space in script memory to store the result.
dtstoi(type.src,type.dst)
The dtstoi instruction converts date and time data from tm structure to internal system form. The tm structure is specified by the type.src argument. The result is placed in type.dst. It is recommended that the type.dst argument use type integer to guarantee that the correct value is received. This instruction is the complement to the dtitos() instruction.
The dtstoi() instruction returns 0 in script r.0 if the conversion is successful. A value of -1 is returned in r.0 if the tm structure indicated by type.src contains incorrect values or is at a location outside the script data area.
incr(type.dst,type.src)
The incr instruction increments the destination value by the source value.
itoa(ctype.dst,type.src)
The itoa instruction converts a numeric source value into a null terminated character string stored starting at the destination address.
load(type.dst,type.src)
load(ctype.dst,ctype.src)
The load instruction converts the source value to the data type of the destination and stores it at the destination.
mul(type.dst,type.src)
The mul instruction multiplies the destination value by the source value. The product is stored in type.dst. Overflow is not checked. Multiplying large values may result in a negative number.
not(type.dst)
The not instruction performs a 1's complement operation on the type.dst argument, allowing scripts to decode or encode bit flags stored in a single integer.
or(type.dst,type.src)
The or instruction implements bitwise OR operations on the type.dst and type.src arguments, allowing scripts to decode or encode bit flags stored in a single integer. The result is stored in type.dst.