#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 ! see if we can remove redundant *& in assignment of 'that == buff(0)'
// 3 %string (255) this, that
_imp_string255 THIS;
_imp_string255 THAT;
// 4
// 5 that = "hello world"
_imp_strcpy(&THAT, _imp_strp(_imp_str_literal("hello world")), /*max:*/ 255);
// 6 ! need to implement with memmove - data copy, not a pointer copy
// 7 this = that
_imp_strcpy(&THIS, _imp_strp(THAT), /*max:*/ 255);
// 8
// 9 %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("THIS = \"%.*s\"\n", THIS.cstr.len, THIS.cstr.s);
_imp_diagf("THAT = \"%.*s\"\n", THAT.cstr.len, THAT.cstr.s);
_imp_end_backtrace();
_imp_stop(0);
}