|Bray Script: The Basics|
|Home Barcode Mill Barcode Fonts How to order Email us|
For 30 years I have been helping organisations and individuals with their Barcode and Auto ID issues but now I have decided it is time to move on and retire from being the Barcode Man.
I will continue to respond to emails from existing customers about their earlier purchases, their special programming configurations and warranty issues but I regret I cannot help with new purchases or issues nor recommend alternative products or sources.
Lee Allen, The Barcode Man. February 2010
The Mule is a trademark of Altek Instruments Ltd
Comments, Blanks, White-Space and Capitalisation
Comments in a Bray script
Comments are used in a script to aid human understanding and to provide other identifying content. Comments are ignored by the Bray Interpreter.
Comments are defined as any printed content on a line following a hash character (#) providing the hash character is not in an ASCII string (see Strings: later)
If the hash character is the first character on a line the whole line is comment. Alternatively comments can follow any active script content on the same line. The hash and anything following is ignored by the Bray interpreter.
Blank Lines and Spaces
The Bray interpreter ignores blank lines. Blank lines can be used to space out the script making it easier to read.
Bray defines any character with an ASCII value of 32 or less as White-Space. Note that 'White-Space' is different from 'Space'. White-Space includes the Space character PLUS all the other ASCII characters often used to space out text. The most useful White-Space characters are the 'Space' and the 'Tab', either of these can be used to format and space out components of Bray script making it easier to read and understand.
White-Space characters are generally ignored in a Bray Script unless they have significance for example in quoted strings. White-Space can be used to make the code more readable by spacing out some sections of code. For example spaces between keyword parameters or concatenated strings will be ignored by Bray.
You are encouraged to use comments, blank lines and White-Space to format and annotate the script making it easier to understand.
Components of the Bray Language are not case sensitive. Capitals or lower case letters can be used for Keywords and Braced Packet Keys. For example the DEFINE keyword can equally well be written into the script as DEFINE Define or define. To aid clarity we use the capital letter form in the documentation. For working scripts professional programmers often prefer to use the lower case form. The capitalisation of quoted literal ASCII strings is respected and maintained.
Channels and Streams
To manage the flow of data Bray uses the concept of Channels and Streams. Bray can be thought of as a black-box. All the data leaving the Bray black-box is conveyed through a channel. Before Bray sends data to a channel it divides it into individual streams. Each stream consists of a particular category of data.
Bray has 2 channels and 4 streams. The default settings for Channels and Streams are good for most purposes. Special configurations can be set up using the SWITCH keyword.
Data leaving the Bray interpreter is divided into four streams. Each stream is identified by the first initial letter followed by a colon and a space (except the Action stream when sent to Channel 0)
Strings and Braced Packets
The main objective of Bray is to emulate specific keystroke sequences. For this reason strings are of primary importance. There two types of string in Bray: ASCII strings and scancode strings.
In Bray a Braced Packet is just a wrapper for a Scancode String with a mnemonic label. A Braced Packet can be used anywhere a Scancode string could be used. In addition Braced Packets can be embedded in ASCII strings (this would be invalid for single quoted Scancode Strings). A Braced Packet is always expanded into its Scancode Components before being used.
A Braced Packet consists of a 'Key' surrounded by the Curly Brace characters. The Key can contain any alphanumeric characters as well as dot(period) hyphen and underscore. Bray ignores the capitalisation of the Key. There must not be any White-Space between the Braces. (The maximum length for a Key is not currently defined but may be limited to around 30 characters in the future).
New Packets can be created and existing packets redefined by using the DEFINE keyword. Bray has predefined a number of Braced Packets shown the table.
Pre defined Scancode Packet Entities
In Bray wherever a string is valid, a list of String Entities is equally valid. The list is automatically concatenated (strung together) and used as a single string. There is no special concatenation operator. The String Entity components are just listed on the line adjacent to each other. Here is the List of valid String Entity Components.
This syntax definition provides that Braced Packets can be used inside either type of string or can stand alone outside a string.
White-Space may be used between the components to make the whole easier to read. The White-Space is ignored by Bray and not included in the final string. If you need Space to be included it must be surrounded by Double Quote characters just like an ASCII string.
Notice that Bray takes care of all the issues resulting from the mixing of ASCII and Scancode string types. You do not need to consider when to shift the Mule in and out of scancode mode. Bray takes care of it all automatically.
Example of a list of String Entities
Automatic Sending of strings
In Bray a 'non-attached' String Entity is automatically processed and sent to the Action Stream (The Action stream is usually directed to the Mule). 'Non-attached' means the string is standing alone on a line and is not a parameter of a Keyword.
If more than one String Entity are found together they will be concatenated before processing. This is important because the intelligent algorithm which controls switching in and out of scancode mode is applied to the whole resultant string rather than to the individual components resulting in greater efficiency
|Top Home||© Lee Allen, 2017|