#include <perms.h>

                                                                //      1  ! I have found some bugs with the TOSTRING and SUBSTRING functions in
                                                                //      2  ! imp23b. When used in an IF statement they evaluate incorrectly, as
                                                                //      3  ! the program below shows, though they evaluate correctly if you write
                                                                //      4  ! them out. (the IF bug mentioned in the last mail message also occurs
                                                                //      5  ! with UNLESS)
                                                                //      6  
                                                                //      7  %begin
int main(int argc, char **argv) {
  _imp_initialise(argc, argv);
                                                                //      8     %constant %string (9)    ten      = "123456789"
const _imp_string /*%string(9)*/ TEN = _imp_str_literal("123456789");
                                                                //      9     %String(255)  Beta
_imp_string /*%string(255)*/ BETA;
                                                                //     10  
                                                                //     11     %if tostring('a') = "a" %then printstring("pass") %and newline
if ((_imp_strcmp(_imp_TOSTRING(97), _imp_str_literal("a")) != 0)) goto L_0002;
_imp_PRINTSTRING(_imp_str_literal("pass"));
_imp_NEWLINE();
L_0002:;
                                                                //     12  
                                                                //     13     Beta = Ten
BETA = TEN;
                                                                //     14     %if substring(beta,4,7)="4567" %then printstring ("pass") %and newline
if ((_imp_strcmp(_imp_SUBSTRING(&BETA, 4, 7), _imp_str_literal("4567")) != 0)) goto L_0003;
_imp_PRINTSTRING(_imp_str_literal("pass"));
_imp_NEWLINE();
L_0003:;
                                                                //     15  
                                                                //     16  %End %of %Program
/* Remove %on %event handler here if present for this block */
return 0;
} // End of block _imp_main at level 1
// End of file
