1. Is this a bug or a feature?

Trawling through the tickets has brought up some interesting, and likely long forgotten stuff, but I think I may have found another issue.

--minimal goto test 
include std/console.e  
include std/graphics.e  
  
clear_screen()  
 
goto "Current_test" 
 
puts(1, "Started.....\n") 
 
include std/os.e  
 
label "Current_test"          --label not found 
 
puts(1, "Ended.....\n") 
 
--minimal goto test 
include std/console.e  
include std/graphics.e  
  
clear_screen()  
 
goto "Current_test" 
 
puts(1, "Started.....\n") 
 
label "Current_test"            --this is ok 
 
include std/os.e  
 
puts(1, "Ended.....\n") 
 

The solution is to put all your includes at the beginnng of the program. Barely worth a ticket.

By the way, has anyone ever come up with this error?

D:\EuProgramming\Euphoria4_1\Programs\Tests\position_test.eui:23 
wtf 
display("Hello starts at line [], column []",p1) 
     ^ 

Which was one of the first errors when I started looking at this. In this context, what does wtf mean?

-)

Chris

new topic     » topic index » view message » categorize

2. Re: Is this a bug or a feature?

ChrisB said...

The solution is to put all your includes at the beginnng of the program. Barely worth a ticket.

No I think this is still a bug. The interpreter tracks goto in a "stack" that is pushed and popped as it encounters additional include files, and it seems to not be "popping" back correctly.

But ideally yes, you'd put all of your includes at the top, but we should account for edge cases because including from anywhere in the file should work the same for all code.

ChrisB said...

Which was one of the first errors when I started looking at this. In this context, what does wtf mean?

It literally means what it says on the tin: what the fuck. You can find that message here: source/parser.e:378.

Did you experience this in the same code that had an issue with post-include goto labels not working? The two could be related.

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: Is this a bug or a feature?

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 
*/ 
 
 
 
new topic     » goto parent     » topic index » view message » categorize

4. Re: Is this a bug or a feature?

ChrisB said...

BTW, knew what the acronym was, just wondered what it meant!

I have no idea why mattlewis left such an ambiguous error message there. I think that should be considered a bug to be fixed as well - the error message should tell us that popping the goto stack failed with leftovers on the stack.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu