POSXML

Last updated

POSXML (acronym for Point Of Sale eXtended Markup Language) is a programming language, based on XML, that is used to create applications for a POS terminal.

Contents

Normally the programming language used to develop such applications is C or C++. The main purpose of POSXML is to simplify the development of applications for POS terminals. It contains a set of instructions and pre-programmed commands, which allow direct interaction with the machine, resulting in a large reduction in application development time.

Language features

The structure of POSXML

POSXML is organized and structured in the form of tags, showing levels and subsets of a set of commands and instructions, that form the logical structure of a POSXML application.

Example:

<!-- Variables declaration --><stringvariablevalue=""variable="sTicketInfo"/><stringvariablevalue=""variable="sCityInfo"/><integervariablevalue="0"variable="iQtdTickets"/><integervariablevalue="0"variable="iInvalidInfo"/><!-- Function Display MAIN Menu --><functionname="fMainMenu"><integervariablevalue="0"variable="iOption"/><!-- Main Menu --><menuoptions="MAIN MENU:\\1.SALE OF TICKETS\2.REPORT\3.EXIT"variable="$(iOption)"/><!-- 1.SALE OF TICKETS --><ifoperator="equalto"value="1"variable="$(iOption)">        ...     </if>     ...    </function>

Compiled language

Similar to the vast majority of existing programming languages, POSXML is compiled in a specific format to reduce the file size which allows the application to be run on a POS terminal using a framework (virtual machine).

When compiled, a program written in POSXML, becomes a set of bytecodes that are interpreted by the virtual machine on the POS terminal which results in the implementation on the POS terminal.

Example:

<displayline="0"column="0"message="Example of Bytecode"/>

Compiled bytecode:

d0 \x0A 0 \x0A Bytecode example \x0A \x0D 

Syntax

The commands and instructions of POSXML, such as the compliance on the use of capital letters and lowercase letters (case sensitive), are acquired through training. Some commands that belong to the language do not require parameters, unlike other commands that need input to interact with the machine.

Examples:

Commands that do not require instructions or parameters.

<network.hostdisconect/><cleandisplay/><waitkey/>

Commands that require instructions and parameters to interact with the equipment.

<displayline="1"column="1"message="POSXML"/><menuvariable="$(var1)"options="MENU\1. first line\2. second line\3. third line"/><waitmiliseconds="1000"/>

The names given to functions, variables, and pages should also obey the rules written in capital letters and lowercase letters, so if a developer creates a function called "calcula_digito" he will not be able to call on the variable via "Calcula_Digito". The call of a function, or variable page must meet the exact name that was assigned by the programmer.

Commands and instructions

Because it is a structured language based on XML, POSXML is a language that is constantly evolving, new commands and instructions can be added to your library at any time. Initially, the language had only two dozen basic commands to create a functional application on a POS terminal, using few resources: only the basic display (LCD), keypad, magnetic card reader and printer.

With the evolution of language, there are now almost one hundred commands and instructions available to deal with files, pictures, mathematical operators, functions to manipulate variables of the String type, definition of variables, logical operators, classes for working with protocol ISO 8583 (Protocol standard for exchanging information in transactions with credit cards), among others.

Variables and data types

Variables in POSXML are typed; there are only two types, integer and string. POSXML limits the number of declared variables to 512.

These variables are declared global, i.e. They are shared throughout all the scheduled pages of the POSXML program in runtime process.

Examples:

String type variable:

<!-- Declaring a string type variable containing: "http://en.wikipedia.org/wiki/posxml" --><stringvariablevalue="http://en.wikipedia.org/wiki/posxml"variable="url"/><!-- Accessing the content of the declared variable --><displayline="0"column="0"message="$(url)"/>

Integer type variable:

<!-- Declaring an integer type variable containing: "0" --><integervariablevalue="0"variable="iValue"/><inputmoneycolumn="0"line="0"message="Enter the amount:"variable="$(iValue)"/>

A call to a variable that is declared in the memory, is made by $(name_of_the_variable), regardless of its type.

It is also possible to convert a variable of one type into the other type. In POSXML the commands inttostring and stringtoint are used for this.

Examples:

<integervariablevalue="1"variable="iOpcao_Tipo_Inteiro"/><stringvariablevalue=""variable="sOpcao_Tipo_String"/><inttostringintegervariable="$(iOpcao_Tipo_Inteiro)"stringvariable="$(sOpcao_Tipo_String)"/>

File system

When writing an application for a POS terminal, the developer is faced with the need to write to the specific file system of the equipment. The POSXML language works with files of type WALK dbFile (A file system defined by the framework that interprets a program compiled POSXML). This file system WALK dbFile uses the format: key = buffer\nkey = buffer\n, basically the format of text files in a Unix environment, where \n is used to wrap. There are 8 basic commands in the POSXML language to work with files in the POS terminal, they are.

  • editfile
  • readfile
  • readfilebyindex
  • deletefile
  • file.open
  • file.write
  • file.read
  • file.close

Examples:

<editfilefilename="test.txt"key="$(sChave)"value="$(sValor)"/><readfilefilename="test.txt"key="$(sChave)"variabledestination="$(sRetorno)"/><readfilebyindexfilename="test.db"index="0"variablekey="$(var1)"variablevalue="$(var2)"variablereturn="$(var3)"/><deletefilefilename="test.txt"/>

Code examples

The traditional "Hello World"

<!-- An example application that shows the phgrase "Hello World" on the display. --><!--  The command "display" shows a message in a row and column specific. --><displayline="3"column="0"message="Hello World"/><!--  The command "waitkey" waits till the operator press someone key for continue the execution. --><waitkey/>
<stringvariablevalue=""variable="stringName"/><stringvariablevalue=""variable="stringValue"/><integervariablevalue="0"variable="integerValue"/><integervariablevalue="0"variable="integerOption"/><!--  The command menu is used to show a menu in the terminal's display. The captured value is put in variable.  --><menuvariable="$(integerOption)"options="\Menu\ 1) Main Function\ 2) Print Function"/><ifvariable="$(integerOption)"operator="equalto"value="1"><!--  The command callfunction is used to call a function defined with the function instruction.  --><callfunctionname="Main"/></if><ifvariable="$(integerOption)"operator="equalto"value="2"><!--  The command callfunction is used to call a function defined with the function instruction.  --><callfunctionname="Print"/></if><!-- The command function is used to make functions in PosXml Application. --><functionname="Main"><!-- The command inputmoney is used to enter money values in the terminal.       The terminal shows a mask with comma and points, while pressing the digit keys.       The captured value is multiplied by 100 and put in variable without comma and points.   --><inputmoneyvariable="$(integerValue)"line="0"column="0"message="Input de Value:"/><cleandisplay/><!-- The command inttostring is used to convert an integer variable in a string variable. --><inttostringvariableinteger="$(integerValue)"variablestring="$(stringValue)"/><displayline="2"column="0"message="Value is:"/><displayline="3"column="0"message="$(stringValue)"/><waitkey/></function><functionname="Print"><!-- The command inputformat is used to enter a value in a specific format.        The format is specified in the format parameter. The value captured is put in variable.    --><inputformatvariable="$(stringName)"line="0"column="0"message="Enter your name:"format="AAAAAAAAAA"/ ><printmessage="$(stringName)"/><!-- The command paperfeed is used to advance paper of the terminal's printer. --><paperfeed/></function>

Dealing with the POS file

<stringvariablevalue=""variable="stringRet"/><stringvariablevalue=""variable="stringWriteKey"/><stringvariablevalue=""variable="stringWriteValue"/><inputformatvariable="$(stringWriteKey)"line="0"column="0"message="Input a key:"format="AAAAAAAAAA"/><inputformatvariable="$(stringWriteValue)"line="2"column="0"message="Input a value:"format="9999999999"/><!-- The command editfile is used to write or edit a file in 'Walk Db format'.     The format of the file in 'Walk Db format', is: ('key=value\nkey=value\n ... '). --><editfilefilename="test.txt"key="$(stringWriteKey)"value="$(stringWriteValue)"/><!-- The command readfile is used to read a file in 'Walk Db format'.     The format of the file in 'Walk Db format', is: ('key=value\nkey=value\n ... ').     If the file or key does exist, the value is a white space ' '. --><readfilefilename="test.txt"key="$(stringWriteKey)"variabledestination="$(stringRet)"/><!-- The command deletefile is used to remove a file from the terminal's memory. --><deletefilefilename="test.txt"/><!-- The command joinstring is used to join firstvalue and secondvalue in variabledestination. --><joinstringfirstvalue="Result:"secondvalue="$(stringRet)"variabledestination="$(stringRet)"/><cleandisplay/><displayline="4"column="0"message="$(stringRet)"/><waitkey/>

An example with while "While"

<!-- The command "stringvariable" creates in memory one variable of a type string, in this case the name is "sData". --><stringvariablevalue=""variable="stringData"/><stringvariablevalue="KEY_CANCEL"variable="stringKey"/><!-- The command "while" realizes a loop till the condition be satisfied in this case,     when the value of "sKey" be different of "KEY_CANCEL". --><whilevariable="$(stringKey)"operator="equalto"value="KEY_CANCEL"><!-- The command cleandisplay is used to clean the terminal's display. --><cleandisplay/><!-- The command "getdatetime" extract the date and the hour internal in format specified,     and save this value in "variabledestination".    --><getdatetimeformat="d/M/yy h:m:s"variabledestination="$(stringData)"/><!-- The command "display" shows a message in a row and column specific. --><displayline="2"column="0"message="$(stringData)"/><!-- The command "readkey" waits a specified time in miliseconds to save in a string on "variablereturn",        case not be tight anybody key, will be return the value "KEY_CANCEL".    --><readkeymiliseconds="800"variablereturn="$(stringKey)"/></while><displayline="2"column="0"message="$(stringKey)"/><waitkey/>

Related Research Articles

VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It allows Microsoft Windows system administrators to generate powerful tools for managing computers with error handling, subroutines, and other advanced programming constructs. It can give the user complete control over many aspects of their computing environment.

COMMAND.COM Default command-line interpreter for DOS, Windows 95, Windows 98 and Windows Me

COMMAND.COM is the default command-line interpreter for MS-DOS, Windows 95, Windows 98, Windows 98SE and Windows Me. In the case of DOS, it is the default user interface as well. It has an additional role as the usual first program run after boot, hence being responsible for setting up the system by running the AUTOEXEC.BAT configuration file, and being the ancestor of all processes.

HyperTalk is a discontinued high-level, procedural programming language created in 1987 by Dan Winkler and used in conjunction with Apple Computer's HyperCard hypermedia program by Bill Atkinson. Because the main target audience of HyperTalk was beginning programmers, HyperTalk programmers were usually called "authors" and the process of writing programs was known as "scripting". HyperTalk scripts resembled written English and used a logical structure similar to that of the Pascal programming language.

Atari BASIC

Atari BASIC is an interpreter for the BASIC programming language that shipped with the Atari 8-bit family of 6502-based home computers. Unlike most BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays, for example.

Visual Basic .NET Object-oriented computer programming language

Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with Visual C#, it is one of the two main languages targeting the .NET framework. As of March 11th, 2020, Microsoft announced that evolution of the VB.NET language has concluded.

In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and standard error (stderr). Originally I/O happened via a physically connected system console, but standard streams abstract this. When a command is executed via an interactive shell, the streams are typically connected to the text terminal on which the shell is running, but can be changed with redirection or a pipeline. More generally, a child process inherits the standard streams of its parent process.

Newline Special character in computing signifying the end of a line of text

Newline is a control character or sequence of control characters in a character encoding specification that is used to signify the end of a line of text and the start of a new one. Some text editors set this special character when pressing the ↵ Enter key.

Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET of 1977 to the C128 of 1985.

An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

A path, the general form of the name of a file or directory, specifies a unique location in a file system. A path points to a file system location by following the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/"), the backslash character ("\"), or colon (":"), though some operating systems may use a different delimiter. Paths are used extensively in computer science to represent the directory/file relationships common in modern operating systems, and are essential in the construction of Uniform Resource Locators (URLs). Resources can be represented by either absolute or relative paths.

Comparison of command shells

A command shell is a command-line interface computer program to an operating system.

Experix is an open-source command interpreter designed for operating laboratory equipment, especially data acquisition devices, and processing, displaying and storing the data from them. It is usable now, only under Linux on the x86 architecture, but still under development, and users are welcome to participate in extending and improving it.

more (command)

In computing, more is a command to view the contents of a text file one screen at a time. It is available on Unix and Unix-like systems, DOS, Digital Research FlexOS, IBM/Toshiba 4690 OS, IBM OS/2, Microsoft Windows and ReactOS. Programs of this sort are called pagers. more is a very basic pager, originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement.

test is a command-line utility found in Unix, Plan 9, and Unix-like operating systems that evaluates conditional expressions. test was turned into a shell builtin command in 1981 with UNIX System III and at the same time made available under the alternate name [.

IBM System/34 BASIC was an interpreter for the IBM System/34 midrange computer.

IBM System/36 BASIC was an interpreter for the IBM System/36 midrange computer.

A batch file is a script file in DOS, OS/2 and Microsoft Windows. It consists of a series of commands to be executed by the command-line interpreter, stored in a plain text file. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as IF, FOR, and GOTO labels. The term "batch" is from batch processing, meaning "non-interactive execution", though a batch file may not process a batch of multiple data.

Command-line interface Type of computer interface based on entering text commands and viewing text output

A command-line interface (CLI) processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor. Operating systems implement a command-line interface in a shell for interactive access to operating system functions or services. Such access was primarily provided to users by computer terminals starting in the mid-1960s, and continued to be used throughout the 1970s and 1980s on VAX/VMS, Unix systems and personal computer systems including DOS, CP/M and Apple DOS.

SUPER BASIC, sometimes SBASIC for short, is an advanced dialect of the BASIC programming language offered on Tymshare's SDS 940 systems starting in 1968 and available well into the 1970s.

Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s. When these machines were updated to the VP series in 1976, BASIC-2 was introduced and remained the pattern for future machines in the 2200 series. A planned BASIC-3 was never released.

References

    See also