POSXML - Variables and memory

  1. Variable Types
  2. Limitations
  3. Parameter passing

The CloudWalk Framework is responsible for running compiled POSXML applications, and when installed on the device, the POSXML application assumes all responsibility for memory management and devices. Therefore, to run an application on the device, just write a file in POSXML, compile it and send it to the device.

Variable Types

The POSXML language uses the concept of variable types. It offers two types by which you can store values and manipulate them across your entire application. These are string or integer. Several POSXML commands require a variable type, which is described in the explanation of each POSXML command operation.

You can convert variables of type integer to string and vice versa, by using the commands inttostring and stringtoint.

Variables of type double (decimal floating point) can also be used by using string variables with decimal point separated by . (point), and not by , (comma).

Limitations

There is a limit of 511 variables per POSXML application,

  • 256 of type string with maximum size of 1K (1023 characters, of which one is used automatically by the platform to allocate the \0),
  • and 255 of type integer.

When you declare a variable with the commands integervariable or stringvariable, it will be in memory until the device is disconnected. For this reason, you must be careful to declare at the beginning of the application all of the variables that will be used and clean them later, to prevent any errors from occurring during the execution of the application.

Currently there is a limit of 32K memory for loading compiled POSXML pages.

Parameter passing

Every POSXML command owning a parameter whose name contains the word variable, for example, variablereturn, is required to have a parameter assigned.

The assignment of variables is made with the nomenclature $(VariableName), as can be seen below:

<stringvariable value="" variable="strBuffer" />
<display line="0" column="0" message="$(strBuffer)" />

When the name of the parameter does not have the word variable, you can pass either a constant or a variable. The assignment is taken as constant in every programming language:

<display line="0" column="0" message="Hello World" />

In string variables, it is still possible to pass to the command just a snippet of the indexed variable, as in other programming languages, using pointers to variables.

In the example below, the following string would be displayed: H

<stringvariable value="Hello World" variable="strBuffer" />
<integervariable value="0" variable="intIndex" />

<display line="0" column="0" message="$(strBuffer[$(intIndex)])" />

In the example below, the following string would be displayed: e

<stringvariable value="Hello World" variable="strBuffer" />
<integervariable value="1" variable="intIndex" />

<display line="0" column="0" message="$(strBuffer[$(intIndex)])" />

In the example below, the following string would be displayed: ello World

<stringvariable value="Hello World" variable="strBuffer" />
<integervariable value="1" variable="intIndex" />

<display line="0" column="0" message="$(!strBuffer[$(intIndex)])" />

In this last example ! symbol was specified so that it will display the characters from the position defined in intIndex until the end of the string. When the symbol ! is omitted, only the character set in position intIndex is displayed on the device display.