A String Variable is described by a Copy Descriptor to an Ebcdic Array containing the String Data and above it, a Single Precision Operand which contains the current logical length of the String Data.
002C (02,0016) 0 000000 000000
002B (02,0015) C F20000 001DF9 HEXSTRING (Hex variable) Absent-copy,
ASD=00EFCF, Hex, Length=264 (Unreferenced olay space)
002A (02,0014) 0 000000 000000
0029 (02,0013) C D40000 001D6D ASCIISTRING (ASCII variable) Absent-copy,
ASD=00EB6E, EBCDIC, Length=132 (Unreferenced olay space)
0028 (02,0012) 0 000000 000000
0027 (02,0011) C B40000 001E27 EBCDICSTRING (EBCDIC variable) Absent-copy,
ASD=00F13D, EBCDIC, Length=132 (Unreferenced olay space)
String Variables are managed by the GetStringArea, GetStringPoolSize ResetStringPoolSize Intrinsic functions.
A maximum of 500 String variables can be allocated using these String Intrinsics. (Note: This limit applies only to String Variables, and does not include Strings in String Arrays which are created using ArrayDec).
Although the Algol Compiler differentiates between ASCII and EBCDIC Strings, the architecture does not.
The declaration of GetStringArea is in the MCP at 10810000,
WORD PROCEDURE GETSTRINGAREA;
It returns an Untouched Copy Descriptor to an element in the String Pool of the current Stack.
This is an example of a call to GetStringArea to declare a String Variable.
CodeSegment.MKSN; CodeSegment.NMC1(D1_Stack.MCPIntrinsicSDI(GetStringAreaV)); CodeSegment.ENTR; CodeSegment.ZERO;
The Compiler creates a Hex String by setting the Character Size of the Untouched Descriptor to HexV.
CodeSegment.MKSN; CodeSegment.NMC1(D1_Stack.MCPIntrinsicSDI(GetStringAreaV)); CodeSegment.ENTR; CodeSegment.SE4C; CodeSegment.ZERO;
Since a String Variable is represented by a Copy Descriptor, there is no BlockExit action required.
However, if String Variables are not returned to the String Pool upon exiting a procedure, then they can no longer be reused and eventually the String Pool will be exceeded.
The GetStringPoolSize and ResetStringPoolSize Intrinsics are provided to manage the String Pool as a Stack.
In a Block which declares a String Variable, the Compiler allocates a variable called a 'String Pool Size Location', and calls GetStringPoolSize to initialize it to the current String Pool Top.
The Compiler then allocates String Variables by calling GetStringArea.
The Compiler generates an Epilog Procedure for the Block, and calls ResetStringPoolSize with the previously saved String Pool Top, thereby releasing any String variables declared in the Block.
The declaration of GetStringPoolSize is in the MCP at 10820000,
REAL PROCEDURE GETSTRINGPOOLSIZE;
The declaration of ResetStringPoolSize is in the MCP at 10830000,
PROCEDURE RESETSTRINGPOOLSIZE(S); VALUE S; REAL S;