#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %BEGIN
int main(int argc, char **argv) { /*%begin*/
_imp_initialise(argc, argv);
// 2 %STRING(5) %ARRAY a(1:10)
_imp_string5 A[10];
// 3 %STRING(5) %NAME ap
_imp_string5 *AP;
// 4 %INTEGER i
int I;
// 5 %ROUTINE conc(%STRING(5) %NAME x)
void CONC(_imp_string5 * X) {
// 6 x=x."a"
*X = *
*({
_imp_string255 tmp = _imp_join(({
__typeof__(_imp_string5) tmp; /*D*/
tmp = *X;
(void *)&tmp;
}),
(_imp_string *)/*?*/ _imp_str_literal_ptr("a"));
(_imp_string255 *)&tmp;
})
;
// 7 %END
return;
} /* end of CONC */
// 8 a(i)=tostring(i+'0') %FOR i=1,1,1
// %for I = 1, 1, 1 %cycle
{
if (invalid_for_loop(1, 1, 1)) _imp_signal(5, 1, 0, "Illegal cycle I = 1, 1, 1");
I = 0;
L_0001:
if (I == 1) goto L_0002;
I += 1;
_imp_strncpy(/*?*/ &A[I - 1], ({
__typeof__(_imp_string1) tmp; /*B*/
tmp = _imp_TOSTRING(I + 48);
(void *)&tmp;
}),
/*max:*/ 5);
goto L_0001;
}
L_0002:;
// 9 printstring("before conc "); printstring(a(1)); newline
_imp_PRINTSTRING(_imp_str_literal("before conc "));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string5) tmp = A[0] /*q*/;
(_imp_string255 *)&tmp;
})
);
_imp_NEWLINE();
// 10 conc(a(i)) %FOR i=1,1,1
// %for I = 1, 1, 1 %cycle
{
if (invalid_for_loop(1, 1, 1)) _imp_signal(5, 1, 0, "Illegal cycle I = 1, 1, 1");
I = 0;
L_0004:
if (I == 1) goto L_0005;
I += 1;
CONC((_imp_string5 *)/*p*/ /*?*/ &A[I - 1]);
goto L_0004;
}
L_0005:;
// 11 printstring("afeter conc "); printstring(a(1)); newline
_imp_PRINTSTRING(_imp_str_literal("afeter conc "));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string5) tmp = A[0] /*q*/;
(_imp_string255 *)&tmp;
})
);
_imp_NEWLINE();
// 12 %FOR i=1,1,1 %CYCLE
// %for I = 1, 1, 1 %cycle
{
if (invalid_for_loop(1, 1, 1)) _imp_signal(5, 1, 0, "Illegal cycle I = 1, 1, 1");
I = 0;
L_0006:
if (I == 1) goto L_0007;
I += 1;
// 13 ap==a(i)
AP = (_imp_string5 *)/*?*/ &A[I - 1];
// 14 ap=ap."b"
*AP = *
*({
_imp_string255 tmp = _imp_join(({
__typeof__(_imp_string5) tmp; /*D*/
tmp = *AP;
(void *)&tmp;
}),
(_imp_string *)/*?*/ _imp_str_literal_ptr("b"));
(_imp_string255 *)&tmp;
})
;
// 15 printstring("after 2nd conc "); printstring(a(1)); newline
_imp_PRINTSTRING(_imp_str_literal("after 2nd conc "));
_imp_PRINTSTRING(
*({
__typeof__(_imp_string5) tmp = A[0] /*q*/;
(_imp_string255 *)&tmp;
})
);
_imp_NEWLINE();
// 16 printstring(a(i)) %UNLESS a(i)=tostring(i+'0')."ab"
if (_imp_strcmp((_imp_string *)/*?*/ &A[I - 1], (_imp_string *)/*?*/ &*({
_imp_string255 tmp = _imp_join(({
__typeof__(_imp_string1) tmp; /*D*/
tmp = _imp_TOSTRING(I + 48);
(void *)&tmp;
}),
(_imp_string *)/*?*/ _imp_str_literal_ptr("ab"));
(_imp_string255 *)&tmp;
})) == 0)
goto L_0008;
_imp_PRINTSTRING(
*({
__typeof__(_imp_string5) tmp = A[I - 1] /*q*/;
(_imp_string255 *)&tmp;
})
);
L_0008:;
// 17 %REPEAT
goto L_0006;
}
L_0007:;
// 18 %ENDOFPROGRAM
_imp_stop(0);
return 0;
end_0:;
}