S3 (programming language): Difference between revisions

Content deleted Content added
fix formatting
m Annotated Example: <source lang="algol68">
Line 59:
 
Next follow a number of "mode declarations". Mode is the Algol 68 term for a type.
<source lang="algol68">
 
MODE KMT_BUFFER IS (96)BYTE;
MODE KMT_STRING IS REF()BYTE;
Line 77:
(INT INPUT_TOTAL,
OUTPUT_TOTAL);
</source>
 
The first type is an array of 96 bytes; the next two are references (pointers) to arrays of bytes. KMT_MTM_VALUES is a union type allowing a variety of different types to appear. Note that WORD is a 32-bit unsigned integer, INT is a 32-bit signed integer; LONG makes it 64 bits. The last option in the union is marked REF()REF()BYTE, which means it is a pointer to an array whose members are pointers to arrays of bytes.
 
Line 83:
 
The program continues by declaring external procedures on which the module depends. RESPONSE indicates a return value containing error information:
<source lang="algol68">
 
EXT PROC (RESPONSE) KMT_UI;
Line 91:
PROC (INT,INT,BOOL,RESPONSE) KMT_PP_SEND_PACKET,
PROC (REF()BYTE,RESPONSE) KMT_PP_BUILD_STRING_PACKET_DATA;
</source>
and also some external variables:
<source lang="algol68">
 
EXT REF () BYTE KMT_VERSION;
Line 102:
EXT REF INT MTM_TEXT_LEN;
EXT REF ()REF ()BYTE MTM_RECALL_DATA;
</source>
The rest of the program consists of a number of procedure definitions. One of these, which actually defines the entry point to the program, is reproduced here:
<source lang="algol68">
 
GLOBAL STATIC (<STATUS 5;PSPACE 10001; TEMPLATE>) PROC KERMIT_THE_FROG IS
((<LIT "COMMAND">) REF()BYTE OPTION,
Line 155:
END
</source>
 
Features to note here include: