Re: Is this a bug or a feature?
- Posted by ChrisB (moderator) Nov 29, 2022
- 1590 views
His, this is the full code that produced the error - copying some of the test examples, I think the bottom line is that switch needs some work.
BTW, knew what the acronym was, just wondered what it meant!
include std/console.e include std/graphics.e clear_screen() position(1,1) text_color(YELLOW) puts(1, "Hello") object p1 = get_position() text_color(BRIGHT_GREEN) puts(1,"World") object p2 = get_position() position (10,30) text_color(RED) puts(1, "Mars") object p3 = get_position() display("Hello starts at line [], column []",p1) display("World starts at line [], column []",p2) display("World starts at line [], column []",p3) goto "Current_test" if wait_key() then end if clear_screen() display_text_image({1,1}, {{'A', WHITE, 'B', GREEN}, {'C', RED+16*WHITE}, {'D', CYAN}}) position(20,1) -- displays: -- AB -- C -- D -- at the top left corner of the screen. -- 'A' will be white with black (0) background color, -- 'B' will be green on black, -- 'C' will be red on white, and -- 'D' will be blue on black. label "Current_test" text_color(WHITE) include std/os.e enum KEYBOARD = 0, SCREEN procedure bad_cleanup_routine(object x) puts(SCREEN, "cleanup\n") end procedure function new_object_with_cleanup() return delete_routine(1, routine_id("bad_cleanup_routine")) end function integer x = new_object_with_cleanup() x = 4 while x do new_object_with_cleanup() puts(SCREEN, "It's working.\n") x = x - 1 sleep(0.2) end while ------------------------------- --uncomment the following to get wtf - errors out on line 25 /* procedure delete_proc(object xx) puts(1, "deleting ") ? xx end procedure integer op = 1 op = delete_routine(1, routine_id("delete_proc")) switch op do case 1 then puts(1, "in first case...\n") end switch */