#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %begin
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 2
// 3 ! Interestingly enough you *can* initialise records in Imp77, but
// 4 ! although it *looks* like an integer is being assigned to the first
// 5 ! field, I believe it is actually assigning an address and may be
// 6 ! related to the special case of assigning 0 to a record.
// 7
// 8 ! It would be really interesting to see what happens on a traditional
// 9 ! imp77 compiler implementation. I may try this in the Vax emulator.
// 10
// 11 %recordformat same(%integer i, j)
struct SAME {
union {
struct {
int I;
int J;
};
};
};
// 12 %ownrecord(same)%array or(0:3) = 42, 3, 17, 11
static struct SAME OR[4] = {42, 3, 17, 11};
struct _imp_dv OR_dv = {OR, sizeof(struct SAME) /*, dims, <bounds> */};
// 13 %constrecord(same)%array cr(0:3) = 142, 13, 117, 111
const struct SAME CR[4] = {142, 13, 117, 111};
struct _imp_dv CR_dv = {CR, sizeof(struct SAME) /*, dims, <bounds> */};
// 14
// 15 %recordformat mixed(%real r, %integer i)
struct MIXED {
union {
struct {
float R;
int I;
};
};
};
// 16 ! %ownrecord(mixed)%array orm(0:3) = 42, 3.1415, 17, 2.123
// 17 ! ^ causes an error. This is a significant clue.
// 18 %ownrecord(same)%array orm2(0:3) = 42, 3, 17, 11
static struct SAME ORM2[4] = {42, 3, 17, 11};
struct _imp_dv ORM2_dv = {ORM2, sizeof(struct SAME) /*, dims, <bounds> */};
// 19 %constrecord(same)%array cr2(0:3) = 142, 13, 117, 111
const struct SAME CR2[4] = {142, 13, 117, 111};
struct _imp_dv CR2_dv = {CR2, sizeof(struct SAME) /*, dims, <bounds> */};
// 20
// 21 %endofprogram
_imp_stop(0);
return 0;
end_0:;
}