1. routine_id question
Maybe this is something I missed in previous questions, but I can't quite =
get things working the way I want. Or maybe this is a Windows related =
problem. I have a main program with a global id atom and two included =
files. The first file needs to call a routine in the second file which =
also calls global routines in the first file. The first file includes =
win32lib. When an event is trapped, it calls the routine in the second =
include file, but Euphoria responds with an error that the id contains no =
value. Any help would be appreciated.
---- main file ------
global constant barID
include file1
include file2
------- file 1 -------
include win32lib.ew
global procedure onKeyPress(atom code, atom shift)=20
-- blah, blah, blah
call_proc(barID,{})
-- blah, blah, blah
end procedure
-------- file 2 --------
global procedure bar()
-- blah, blah, blah
end procedure
barID =3D routine_id("bar")
Michael J. Sabal
mjs at osa.att.ne.jp=20
2. Re: routine_id question
On Fri, 28 Jan 2000, you wrote:
> Maybe this is something I missed in previous questions, but I can't quite get
> things working the way I want.
Or maybe this is a Windows related problem. I have a main program with a
global id atom and two included files. The first file needs to call a routine
in the second file which also calls global routines in the first file. The
first file includes win32lib. When an event is trapped, it calls the routine
in the second include file, but Euphoria responds with an error that the id
contains no value. Any help would be appreciated. >
-- MAIN --
global atom BarProc -- this is visible to all following routines
BarProc = -1 -- invalid (for now) routine id
include file1.e
include file2.e
------- file 1 -------
global procedure onKeyPress(atom code, atom shift)
-- blah, blah, blah
call_proc(BarProc,{})
-- blah, blah, blah
end procedure
-------- file 2 --------
global procedure bar()
-- blah, blah, blah
end procedure
BarProc = routine_id("bar") -- assign a valid id once the routine is declared
Regards,
Irv
3. Re: routine_id question
>
> On Fri, 28 Jan 2000, you wrote:
> Maybe this is something I missed in previous questions, but
> I can't quite get things working the way I want.
> Or maybe this is a Windows related problem. I have a main
> program with a
> global id atom and two included files. The first file needs
> to call a routine
> in the second file which also calls global routines in the
> first file. The
> first file includes win32lib. When an event is trapped, it
> calls the routine
> in the second include file, but Euphoria responds with an
> error that the id
> contains no value. Any help would be appreciated.
>
I've had similar problems when using win32lib. My mistake was that I'd
called WinMain() before I included the file with the problem routine, and
the flow of the program was 'diverted' before it got to the point at which I
assigned the id. (I was using the IDE, but using the output as an include
file, so I had to comment out the automatic WinMain() inserted by the IDE).
Another note about using routine_id: you don't have to make the routines
global, just the variable that holds the id itself.
Matt Lewis