BackbuttonStructure Block Item Reference

 

A Structure Block Instance is implemented as Array described by a Data Descriptor. An item in the Structure Block Instance can be referenced as an item in the Array by using it's Index.

A Structure Block Instance is also an MCP Pseudo Stack, and items in it can be referenced using an SIRW.

A Structure Block Type Descriptor is created by calling the MCP Intrinsic Structure_Freezer.  The Structure Block Type Descriptor is used as a Template for a Structure Block Instance. When Structure_Freezer is called, the SIRW_DISP parameter can be used to indicate the Pseudo Stack Cell into which the MCP should store an SIRW to the Structure Block Pseudo Stack.

    SIRW_DISP                                                         
                                                                      
    This is the displacement of a cell the compiler has allocated to  
    contain a pseudo-SIRW to the activation.  Note that this is a     
    displacement value, not a lex offset.  If this value is valid,    
    that is, it is positive and less than the area length, the MCP    
    will generate such a pseudo-SIRW and store it into the word at    
    the word at that displacement from the base of the area.          

At the base of a Structure Block Stack is an MSCW. The Algol Compiler specifies a value of 1 for SIRW_DISP, which results in an SIRW above the MSCW at stack address (LL,1), as shown below.

001A (02,0004)  C E00000 001F97  T1   (Structure block)  Present-mom, 
                                                ASD=00FCBF, Length=26
  0(0000) 3 08CD00 160000 1 80FCBF 000000 

Since the SIRW addresses the base of the Structure Block, any item in the Structure Block can be referenced by copying the SIRW  and modifying the Index Field.

The following Code samples were produced by the Algol Compiler to access the variables in this Structure Block.

Type Structure Block T_T1;                                           
                  Begin                                                                     
 (03,0002) = T_T1 SELF DESCRIPTOR    
                    Boolean B;                                           
 (03,0003) = B     
                    Integer I;                                             
 (03,0004) = I     
                    Double D;                                     
 (03,0005) = D     
                    Pointer P;                                           
 (03,0007) = P     
                    String S;                                                  
 (03,0008) = STRING MARKER     
 (03,0009) = S     
 (03,000A) = S.LENGTH    
 (01,0004) = ARRAYDEC    
                    Array A[0:10];                                        
 (03,000B) = A     
                    Procedure F;begin end;          
 (03,000C) = F     
T_T1
  T1;                                                          
 (02,0004) = T1    

Single Precision Operands

T1.B:=TRUE;                                                                 
   0003:0010:0  NAMC  (02,0004)    5004     
   0003:0010:2  LT8   3            B203     
   0003:0010:4  INDX               A6 
   0003:0010:5  ONE                B1 
   0003:0011:0  STOD               B8 
T1.I:=1;                                                              
   0003:0011:1  NAMC  (02,0004)    5004     
   0003:0011:3  LT8   4            B204     
   0003:0011:5  INDX               A6 
   0003:0012:0  ONE                B1 
   0003:0012:1  STOD               B8 
T1.I:=T1.I + 2;                                                 
   0003:0011:1  NAMC  (02,0004)    5004     
   0003:0011:3  LT8   4            B204     
   0003:0011:5  INDX               A6 
   0003:0012:0  NAMC  (02,0004)    5004     
   0003:0012:2  LT8   4            B204     
   0003:0012:4  INDX               A6 
   0003:0012:5  LOAD               BD 
   0003:0013:0  LT8   2            B202     
   0003:0013:2  ADD                80 
   0003:0013:3  NTGR               87 
   0003:0013:4  STOD               B8 

Double Precision Operands

    T1.D:=DOUBLE(1,1);                                              
       0003:0012:2  NAMC  (02,0004)    5004     
       0003:0012:4  LT8   5            B205     
       0003:0013:0  INDX               A6 
       0003:0013:1  XTND               CE 
       0003:0013:2  ONE                B1 
       0003:0013:3  ONE                B1 
       0003:0013:4  JOIN               9542     
       0003:0014:0  STOD               B8 

Pointers

Access from outside the Structure Block is not permitted in Algol 5.0

Strings

Access from outside the Structure Block is not permitted in Algol 5.0

Arrays

T1.A[1]:=0;                                                                 
   0003:0014:1  NAMC  (02,0004)    5004     
   0003:0014:3  LT8   11           B20B     
   0003:0014:5  NXLN               A5 
   0003:0015:0  ONE                B1 
   0003:0015:1  INDX               A6 
   0003:0015:2  ZERO               B0 
   0003:0015:3  STOD               B8 

Procedures

T1.F;                                                             
   0003:0015:4  NAMC  (02,0004)    5004    % <initial reference> 
   0003:0016:0  ONE                B1 
   0003:0016:1  INDX               A6 
   0003:0016:2  LOAD               BD      % <target SIRW> 
   0003:0016:3  LT8   12           B20C    % <delta> 
   0003:0016:5  IMKS               CF 
   0003:0017:0  LOR                91 
   0003:0017:1  ENTR               AB