#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %BEGIN
int main(int argc, char **argv) { /*%begin*/
_imp_enter(main);
_imp_initialise(argc, argv);
// 2 %RECORDFORMAT F(%INTEGER I,J,K,%INTEGERARRAY A(1:5))
struct F {
union {
struct {
int I;
int J;
int K;
int A[5];
};
};
};
// 3 %RECORD(F) R
struct F R;
// 4 %INTEGERARRAYNAME B
int *B;
struct _imp_dv B_dv = {
0}; // assignment of an array to an arrayname must copy bounds info too... (This was a 1-dimension array)
// 5
// 6 ! Bug in AST_SELECT:
// 7
// 8 B==R_A
// B_dv = (_imp_dv) { R.A, <size>, <bound pairs> }; // TO DO: construct a dopevector on the fly for this array (or arrayname) which is a record field.
// 9
// 10 %ENDOFPROGRAM
_imp_stop(0);
end_0:;
_imp_begin_backtrace(main);
_imp_diagf("\n\nArguments:\n\n");
_imp_diagf("ARGC = %d\n", argc);
_imp_diagf("ARGV @[%p]\n", argv);
for (int i = 0; i < argc; i++) {
_imp_diagf(" ARGV(%d) = \"%s\"\n", i, argv[i]);
}
if (argv[argc] == 0) {
_imp_diagf(" ARGV(%d) = NULL\n", argc);
} else {
_imp_diagf(" ARGV(%d) = \"%s\"\n", argc, argv[argc]);
}
_imp_diagf("\nLocal Variables:\n\n");
_imp_diagf("R = \"<RECORD>\"\n");
_imp_end_backtrace();
_imp_stop(0);
}