//----------------------------------------------------------------------------- // Example of setting the size of an enumeration, and of using the // enumeration //----------------------------------------------------------------------------- main module bitenum use TEXTIO declare colors is [red, green, blue, orange, yellow, magenta, black, white, cyan, tan, pink, violet] large_colors is 5 bit colors // SET SIZE OF ENUMERATION color_array: static packed array[1..10] of large_colors color: static colors large_color: static large_colors enddeclare for i := 1 to 10 do color_array[i] := colors(i) out_integer (tty, integer(color_array[i]), " ") endfor out_record (tty) large_color := pink out_integer (tty, integer(large_color), " ") color := large_colors(magenta) // CONVERTER out_integer (tty, integer(color), " ") color := color_array[4] out_integer (tty, integer(color), " ") color := large_color out_integer (tty, integer(color), " ") color := pred(large_color) out_integer (tty, integer(color), " ") large_color := color out_integer (tty, integer(large_color), " ") large_color := succ(color) out_integer (tty, integer(large_color), " ") large_color := pred(color) out_integer (tty, integer(large_color), " ") out_record (tty) endmodule