#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 ! File of externals followed by a main program.
// 2
// 3 %recordformat rf ( %integer i, %real r, %integer rf) ;! Are record format vars in a sub-scope? Or is it just that formats are in a different name space?
struct RF {
union {
struct {
int I;
float R;
int RF;
};
};
};
// 4
// 5 ! owns and externals are simpler declarations
// 6 %externalinteger xi1
int XI1;
// 7 %externalintegername xin1
int *XIN1;
// 8 %externalreal xr1
float XR1;
// 9 %externalinteger xi2,xi3
int XI2;
int XI3;
// 10 %externalreal xcr1 = 3.1415
float XCR1 = 3.1415;
// 11 %externalrealarray xra1(0:9)
float XRA1[10];
struct _imp_dv XRA1_dv = {XRA1, sizeof(float) /*, dims, <bounds> */};
// 12 %externalrealarrayname xran1
float *XRAN1;
struct _imp_dv XRAN1_dv = {0}; // assignment of an array to an arrayname must copy bounds info too...
// 13 %externallongreal xclr1 = 3.1415
double XCLR1 = 3.1415;
// 14 %externallongrealarray xlra1(0:9)
double XLRA1[10];
struct _imp_dv XLRA1_dv = {XLRA1, sizeof(double) /*, dims, <bounds> */};
// 15 %externallongrealarrayname xlran1
double *XLRAN1;
struct _imp_dv XLRAN1_dv = {0}; // assignment of an array to an arrayname must copy bounds info too...
// 16 %externalintegernamearray xina1(0:9)
int *XINA1[10];
struct _imp_dv XINA1_dv = {XINA1, sizeof(int *) /*, dims, <bounds> */};
// 17 %externalintegernamearrayname xinan1
int **XINAN1;
struct _imp_dv XINAN1_dv = {0}; // assignment of an array to an arrayname must copy bounds info too...
// 18
// 19 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// 20
// 21 %begin
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 22 %integer %array ia3, ia4(1:10), ia5(2:11,0:1,0:2)
int IA3[10];
struct _imp_dv IA3_dv = {IA3, sizeof(int) /*, dims, <bounds> */};
int IA4[10];
struct _imp_dv IA4_dv = {IA4, sizeof(int) /*, dims, <bounds> */};
int IA5[10][2][3];
struct _imp_dv IA5_dv = {IA5, sizeof(int) /*, dims, <bounds> */};
// 23 %integernamearray in3a1(2:11,0:1,0:2)
int *IN3A1[10][2][3];
struct _imp_dv IN3A1_dv = {IN3A1, sizeof(int *) /*, dims, <bounds> */};
// 24
// 25 xi1 = 123
XI1 = 123;
// 26 xin1 == xi1
XIN1 = (int *)/*?*/ &XI1;
// 27 xin1 = xi1
*XIN1 = XI1;
// 28
// 29 xr1 = 1.23
XR1 = 1.23;
// 30 xr1 = xra1(4)
XR1 = XRA1[4];
// 31 xra1(4) = xr1
XRA1[4] = XR1;
// 32 xclr1 = 3.1415
XCLR1 = 3.1415;
// 33 xlra1(4) = xclr1
XLRA1[4] = XCLR1;
// 34 xclr1 = xlra1(4)
XCLR1 = XLRA1[4];
// 35 xina1(4) == xi1
XINA1[4] = (int *)/*?*/ &XI1;
// 36 xina1(4) = xi1
*XINA1[4] = XI1;
// 37 xinan1 == xina1
XINAN1 = (int *)XINA1;
// 38 xinan1(4) == xi1
XINAN1[/*BUG*/ 4] = (int *)/*?*/ &XI1;
// 39 xinan1(4) == xin1
XINAN1[/*BUG*/ 4] = (int *)XIN1;
// 40
// 41
// 42 ia3(4) = xi1
IA3[3] = XI1;
// 43 ia4(4) = xi1
IA4[3] = XI1;
// 44 ia5(5,0,2) = xi1
IA5[3][0][2] = XI1;
// 45 xi1 = ia5(5,0,2)
XI1 = IA5[3][0][2];
// 46 in3a1(6,1,1) == xi1
IN3A1[4][1][1] = (int *)/*?*/ &XI1;
// 47 xi1 = in3a1(6,1,1)
XI1 = *IN3A1[4][1][1];
// 48
// 49 %endofprogram
_imp_stop(0);
return 0;
end_0:;
}