
Using Buffers
74
Axcess Programming Language
If the buffer is full when a character needs to be inserted into it, Axcess drops the first character and
shifts the contents of the buffer to the left, and inserts the new character at the end of the buffer, as
shown in FIG. 24.
Retrieving characters
Use the keyword GET_BUFFER_CHAR to retrieve characters. This keyword has a two-part
operation:
!
First, it retrieves the first character in the buffer for your own utilization. This creates the
same effect as if you retrieved the first storage location of a normal string array.
!
Second, it removes that character from the buffer, causing all the other characters to shift
up one place. The second character is now the first, the third is now the second, and so on.
Here is the syntax:
string = GET_BUFFER_CHAR (array)
The parameter passed to GET_BUFFER_CHAR must be an array, but does not need to be a buffer.
Remember that all buffers are arrays, but not all arrays are buffers. The statement will operate
identically in either case. The result must be a simple variable (not an array), because only one
character will be returned.
These examples show how to create an array called SWT_BUFFER with a capacity of a hundred
characters, and how to make it a buffer associated with a device named SWT.
DEFINE_DEVICE
SWT = 1 (* AXC-232: AUTOPATCH 4YDM *)
DEFINE_VARIABLE
SWT_BUFFER[1ØØ] (* BUFFER FOR SWITCHER *)
TEMP_CHAR (* FOR PARSING ABOVE *)
DEFINE_START
CREATE_BUFFER SWT,SWT_BUFFER
Now all string data sent to the Central Controller from the device SWT will go into the array
SWT_BUFFER.
FIG. 24
Inserting a character into a full buffer causes the first character to be dropped.
Содержание Axcess
Страница 1: ...instruction manual Software Axcess Programming Language ...
Страница 8: ...vi Axcess Programming Language Table of Contents ...
Страница 12: ...Introduction 4 Axcess Programming Language ...
Страница 22: ...Axcess Basics 14 Axcess Programming Language ...
Страница 38: ...Channel Characteristics 30 Axcess Programming Language ...
Страница 54: ...Levels 46 Axcess Programming Language ...
Страница 62: ...Operators 54 Axcess Programming Language ...
Страница 66: ...Variable Types and Conversions 58 Axcess Programming Language ...
Страница 70: ...Two Dimensional Arrays 62 Axcess Programming Language ...
Страница 80: ...While Keywords 72 Axcess Programming Language ...
Страница 86: ...Using Buffers 78 Axcess Programming Language ...
Страница 94: ...Waits and Timer Keywords 86 Axcess Programming Language ...
Страница 102: ...Using Subroutines 94 Axcess Programming Language ...
Страница 108: ...Include Files and System_Calls 100 Axcess Programming Language ...
Страница 120: ...Compiler Error Messages 112 Axcess Programming Language ...
Страница 124: ...The External_Control Protocol 116 Axcess Programming Language ...
Страница 143: ...Index 135 Axcess Programming Language ...