! ! ! ***** DISPLAY_CHARACTER ***** ! ! This procedure writes a one line message describing the current character ! in terms of Octal, Decimal, Hexadecimal and (sometimes ) '^' notation. ! PROCEDURE decus$display_character LOCAL i,cc; ! Handle end-of-buffer condition if MARK( NONE ) = END_OF( CURRENT_BUFFER ) then MESSAGE( 'At end of buffer, no current character.' ); RETURN; endif; ! Convert the character to an integer the hard way (no builtin yet) i := 0; loop exitif i > 255; exitif CURRENT_CHARACTER = ASCII(i); i := i + 1; endloop; if i > 255 then i := 0; endif; ! On overflow, reset to NULL ! Provide ^ notation for ASCII control characters if i < 32 then cc := ', ^' + ASCII(i+64); else cc := ''; endif; ! Format and output the results MESSAGE( FAO( "Current Character is '!AS', Octal=!OB, Decimal=!-!UB, " + "Hex=!-!XB!AS", CURRENT_CHARACTER, i, cc ) ); ENDPROCEDURE;