1. Private constants in Eu 4.0

I would like to point to a problem using privat constants with Eu 4.0 (rev 1339)

when using Eu 4.0 almost no example of the EuGtk2 examples will run with Windows (Vista). As an example I use arrow.exw:

C:\EUPHORIA\include\gtk2/hbox.gtk:45 in function hbox()
A machine-level exception occurred during execution of this statement

... called from D:\Euphoria\gtk2Win\demos\arrow.exw:14

I changed the code of hbox.gtk a little bit and commented out the original code:

... 
 
constant new = define_c_func(GTK, "gtk_hbox_new", {B, I}, P) 
 
----------------------------- 
-- hbox() 
----------------------------- 
global function hbox(boolean homogeneous,  integer spacing) 
----------------------------- 
--	return newInstance(c_func(new, {homogeneous, spacing})) 
atom ret 
? new 
	ret = c_func(new, {homogeneous, spacing} ) 
? ret 
	ret = newInstance(ret) 
? ret 
	return ret 
 
end function -- hbox() 
 
... 

Now I got this error:

C:\EUPHORIA\include\gtk2/hbox.gtk:47 in function hbox()
A machine-level exception occurred during execution of this statement

... called from D:\Euphoria\gtk2Win\demos\arrow.exw:14

> See ex.err

Press Enter...

The error happens when new should be printed. Why does this not work? new had been already defined.

I think there are several places with IDE using the int type where the same problem happens. Although I changed almost all symbols int to integer I forgot some in FList.ew. Using this code in FList.ew:

... 
 
--	Flag set/clear/test routine 
--	This has not worked out as well as I'd have liked ... I like macro capability 
 
function TestFlag(integer var, integer bit) 
	return and_bits(var, bit)	 
end function 
 
function SetFlag(integer var, int bit) 
? var 
? bit 
	return or_bits(var, bit) 
end function 
 
function ClearFlag(integer var, integer bit) 
	return and_bits(var, not_bits(bit)) 
end function 
 
... 
 

will produce this error with me when running IDE:

1

D:\Euphoria\IDE105\FList.ew:269 in function SetFlag()
A machine-level exception occurred during execution of this statement

... called from D:\Euphoria\IDE105\FList.ew:1052 in function FList()
... called from D:\Euphoria\IDE105\includes\ide_code.ew:1670

> See ex.err

Press Enter...

line 1052 in function in my Flist.ew shows this:

Dummy[D_FLFlags] = SetFlag(Dummy[D_FLFlags], FL_Enable)

Dummy[D_FLFlags] = integer is printed (1), FL_Enable = int crashes
D_FLFlags and FL_Enable are declared as constants somewhere about line 175 in FList.ew.

What is the difference if I use constants with integer instead of type int?

Roland

new topic     » topic index » view message » categorize

2. Re: Private constants in Eu 4.0

Roland,

I installed a version of Eu 4 a few weeks back, and ran IDE. It crashed as you have shown. Since I wrote FList.ew for Judith to put into her IDE, i tried to crack why it was happening. I couldn't find any justification for it.

I can't try it again because I dropped my laptop over Christmas and not only wrecked the HDD but also the laptop itself, so I lost everything that was on it and have had to rely on backups. But the relevant thing is that I don't have Eu 4 any more and I can't find a nice easy was to install it again now. Someone had a simple installation file or bunch of files, but who, I don't know. It would be good if there as a simple way of installing the current version of Eu 4 and then I would look into this bug. I'm just a simpleton who writes Euphoria but I don't compile code for a PC - I write code for other devices as a job.

the bug appears to be a failing in the logical operators and_bits() and or_bits(), in which case there is nothing I CAN do! I left it on th egrounds that Eu 4 was in alpha and I guessed if there was such a bug it would be found.

Andy Drummond

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

3. Re: Private constants in Eu 4.0

RStowasser said...

I would like to point to a problem using privat constants with Eu 4.0 (rev

I think there are several places with IDE using the int type where the same problem happens. Although I changed almost all symbols int to integer I forgot some in FList.ew. Using this code in FList.ew:

[snip]

D:\Euphoria\IDE105\FList.ew:269 in function SetFlag()
A machine-level exception occurred during execution of this statement

... called from D:\Euphoria\IDE105\FList.ew:1052 in function FList()
... called from D:\Euphoria\IDE105\includes\ide_code.ew:1670

> See ex.err

Press Enter...

line 1052 in function in my Flist.ew shows this:

Dummy[D_FLFlags] = SetFlag(Dummy[D_FLFlags], FL_Enable)

Dummy[D_FLFlags] = integer is printed (1), FL_Enable = int crashes
D_FLFlags and FL_Enable are declared as constants somewhere about line 175 in FList.ew.

What is the difference if I use constants with integer instead of type int?

Interesting...do you happen to know the last version that worked? Most of the changes lately have been DEP related, so calling C-functions sets off a red flag for me (though as usual, it will probably turn out to be a red herring). I'll investigate deeper (though I'm not sure when, exactly, I'll be able to get to it). If possible, it would be a great help if you could reduce the failure to a minimal, independent test case.

Thanks again for the reports.

Matt

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

4. Re: Private constants in Eu 4.0

mattlewis said...
RStowasser said...

I would like to point to a problem using privat constants with Eu 4.0 (rev

[snip]

What is the difference if I use constants with integer instead of type int?

Interesting...do you happen to know the last version that worked? Most of the changes lately have been DEP related, so calling C-functions sets off a red flag for me (though as usual, it will probably turn out to be a red herring). I'll investigate deeper (though I'm not sure when, exactly, I'll be able to get to it). If possible, it would be a great help if you could reduce the failure to a minimal, independent test case.

Thanks again for the reports.

Matt

I was wrong with my assumption that the problem would be constants and global type. I think it is only a different behaviour of global type in Eu 3.1.1 and Eu 4.0

In the the gtk2 examples the code of hbox.gtk is:

... 
constant new = define_c_func(GTK, "gtk_hbox_new", {B, I}, P) 
 
----------------------------- 
-- hbox() 
----------------------------- 
global function hbox(boolean homogeneous, integer spacing) 
----------------------------- 
	return newInstance(c_func(new, {homogeneous, spacing})) 
end function -- hbox() 
... 

if I replace boolean with integer in hbox.gtk and vbox.gtk then arrows.exw of the EuGtk2 demos will run and some other demos also. boolean is the only global type in the Eugtk2 library and many examples break directly at this location. The code in globals.gtk is:

global type boolean(object x) 
-------------------------- 
	return atom(x) and ((x = 0) or (x = 1)) 
end type -- boolean() 

As this all works fine with Eu 3.1.1 I do not think that something is wrong with this. I suppose if I change the include statements of the Eugtk2 files to Eu 4.0 convention the remaining demos will run too. And I think that in win32lib this problem can occur in some special cases with type int also. But I am not convinced any more that it is because of using local constants.

Roland

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

5. Re: Private constants in Eu 4.0

RStowasser said...

I was wrong with my assumption that the problem would be constants and global type. I think it is only a different behaviour of global type in Eu 3.1.1 and Eu 4.0

Yes, it's a problem with how it deals with forward declared types (which is how an unincluded global is treated). I believe I've fixed the issue, and should push a commit tonight or tomorrow.

I'm also looking at callbacks in *nix, which are currently broken.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu