1. BUG #1 2.3 alpha
- Posted by euman at bellsouth.net Dec 04, 2001
- 450 views
You can not have a variable in your main program that gets its value from an external include file? Take this for instance "txtbuf" will cause a crash in euphoria because it has not been assigned a value...WM_NOTIFY may have been called but Im very sure TVN_ITEMEXPANDING has not. include file treeview.ew global function filltvitem(atom Item, atom mask, atom state) mypoke4(tvitem + tvitem_hItem,Item) mypoke4(tvitem + tvitem_mask,mask) mypoke4(tvitem + tvitem_stateMask, state) txtbuff = myalloc(256) mypoke4(tvitem + tvitem_pszText,txtbuff) mypoke4(tvitem + tvitem_cchTextMax,256) return txtbuff end function main program atom txtbuf elsif iMsg = WM_NOTIFY then elsif id = TreeView1 then iMsg = mypeek4s(lParam + NMHDR_code) if iMsg = TVN_ITEMEXPANDING then hItem = mypeek4u(lParam + NMTVHDR_itemNew) if mypeek4s(lParam + NMTVHDR_action) = TVE_EXPAND then itxtbuff = filltvitem(hItem, TVIF_TEXT, 0) item = SendMessage(id, TVM_GETITEM, 0, tvitem) path = {peek_zstring(txtbuff)} CRASH * CRASH * CRASH Euman
2. Re: BUG #1 2.3 alpha
- Posted by euman at bellsouth.net Dec 04, 2001
- 411 views
> You can not have a variable in your main program that gets its value from > an external include file? > > Take this for instance "txtbuf" will cause a crash in euphoria because it has > not > been assigned a value...WM_NOTIFY may have been called but Im very sure > TVN_ITEMEXPANDING has not. > > include file treeview.ew > > global function filltvitem(atom Item, atom mask, atom state) > mypoke4(tvitem + tvitem_hItem,Item) > mypoke4(tvitem + tvitem_mask,mask) > mypoke4(tvitem + tvitem_stateMask, state) > txtbuff = myalloc(256) > mypoke4(tvitem + tvitem_pszText,txtbuff) > mypoke4(tvitem + tvitem_cchTextMax,256) > return txtbuff > end function > > > main program > > atom txtbuf Sorry, left out this very important part! after I declare txtbuf as an atom and before the code below I do have include treeview.ew > > elsif iMsg = WM_NOTIFY then > > elsif id = TreeView1 then > > iMsg = mypeek4s(lParam + NMHDR_code) > > if iMsg = TVN_ITEMEXPANDING then > > hItem = mypeek4u(lParam + NMTVHDR_itemNew) > > if mypeek4s(lParam + NMTVHDR_action) = TVE_EXPAND then > > itxtbuff = filltvitem(hItem, TVIF_TEXT, 0) > item = SendMessage(id, TVM_GETITEM, 0, tvitem) > path = {peek_zstring(txtbuff)} > > CRASH * CRASH * CRASH > > > Euman Looking at the scope rules page I found this "In Euphoria, every symbol must be declared before it is used" which it is!!! Doesnt say anything about assigning a value before it's actually needed...< Euman
3. Re: BUG #1 2.3 alpha
- Posted by rforno at tutopia.com Dec 04, 2001
- 422 views
Rob: It seems I missed the announcement of 2.3. No message telling this came to me. Please repeat it. ----- Original Message ----- From: <euman at bellsouth.net> To: "EUforum" <EUforum at topica.com> Subject: BUG #1 2.3 alpha > > > You can not have a variable in your main program that gets its value from > an external include file? > > Take this for instance "txtbuf" will cause a crash in euphoria because it has not > been assigned a value...WM_NOTIFY may have been called but Im very sure > TVN_ITEMEXPANDING has not. > > include file treeview.ew > > global function filltvitem(atom Item, atom mask, atom state) > mypoke4(tvitem + tvitem_hItem,Item) > mypoke4(tvitem + tvitem_mask,mask) > mypoke4(tvitem + tvitem_stateMask, state) > txtbuff = myalloc(256) > mypoke4(tvitem + tvitem_pszText,txtbuff) > mypoke4(tvitem + tvitem_cchTextMax,256) > return txtbuff > end function > > > main program > > atom txtbuf > > elsif iMsg = WM_NOTIFY then > > elsif id = TreeView1 then > > iMsg = mypeek4s(lParam + NMHDR_code) > > if iMsg = TVN_ITEMEXPANDING then > > hItem = mypeek4u(lParam + NMTVHDR_itemNew) > > if mypeek4s(lParam + NMTVHDR_action) = TVE_EXPAND then > > itxtbuff = filltvitem(hItem, TVIF_TEXT, 0) > item = SendMessage(id, TVM_GETITEM, 0, tvitem) > path = {peek_zstring(txtbuff)} > > CRASH * CRASH * CRASH > > > Euman > > > >
4. Re: BUG #1 2.3 alpha
- Posted by euman at bellsouth.net Dec 04, 2001
- 451 views
Alright, this is the solution to why my program crashes I have multiple instance of txtbuff atom txtbuff declared in the main program file and, global atom txtbuff declared in treeview.ew version 2.2 never picked up on this and didnt complain 2.3 is fixed up abit ! I formally appologise to Robert Im Sorry Robert Euman
5. Re: BUG #1 2.3 alpha
- Posted by munchr at mac.com Dec 04, 2001
- 429 views
At 12:42 AM 12/5/2001 -0500, Euman wrote: >Alright, this is the solution to why my program crashes > >I have multiple instance of txtbuff > >atom txtbuff declared in the main program file and, >global atom txtbuff declared in treeview.ew > >version 2.2 never picked up on this and didnt complain > >2.3 is fixed up abit ! > >I formally appologise to Robert > >Im Sorry Robert > >Euman Are you sure that's it? It looks like the code you posted is referencing two different variables (if you just cut and pasted, that is.) According to your earlier post: include file treeview.ew global function filltvitem(atom Item, atom mask, atom state) .....<del code>..... txtbuff = myalloc(256) .....<del code>..... return txtbuff end function And then you have: [ main program ] global atom txtbuf include treeview.ew .....<del code>..... itxtbuff = filltvitem(hItem, TVIF_TEXT, 0) item = SendMessage(id, TVM_GETITEM, 0, tvitem) path = {peek_zstring(txtbuff)} Note that in treeview.ew, you reference atom <txtbuff>, and in your main program you declare atom <txtbuf>. You then attempt to use atom <txtbuff> in your main code, but it has not been declared yet, only atom <txtbuf> has. It appears that you are using two different atoms here, one with two trailing f's, and one with only a single trailing f. If this is the case, version 2.2, 2.1, 1.5a etc will fail with an error as well.
6. Re: BUG #1 2.3 alpha
- Posted by euman at bellsouth.net Dec 05, 2001
- 420 views
I copied and pasted some of the code but when I have several thousand lines of code I tend to miss one occasionally. It was txtbuff > two trailing f's in both instances atom txtbuff in [Main] global atom txtbuff in [treeview.ew] declared above (filltvitem) This would make for a hard to find bug for a newby Im sure. it took me a while to figure out why the program that runs perfectly in 2.2 suddenly crashes when I use 2.3 telling me that variable txtbuff <2 f's> has not been assigned a value. Just means Euphoria is a whole lot more strict and I guess, I can live with that. Euman ----- Original Message ----- From: <munchr at mac.com> > At 12:42 AM 12/5/2001 -0500, Euman wrote: > >Alright, this is the solution to why my program crashes > > > >I have multiple instance of txtbuff > > > >atom txtbuff declared in the main program file and, > >global atom txtbuff declared in treeview.ew > > > >version 2.2 never picked up on this and didnt complain > > > >2.3 is fixed up abit ! > > > >I formally appologise to Robert > > > >Im Sorry Robert > > > >Euman > > Are you sure that's it? It looks like the code you posted is > referencing two different variables (if you just cut and pasted, > that is.) > > According to your earlier post: > > include file treeview.ew > global function filltvitem(atom Item, atom mask, atom state) > .....<del code>..... > txtbuff = myalloc(256) > .....<del code>..... > return txtbuff > end function > > And then you have: > > [ main program ] > global atom txtbuf > include treeview.ew > .....<del code>..... > itxtbuff = filltvitem(hItem, TVIF_TEXT, 0) > item = SendMessage(id, TVM_GETITEM, 0, tvitem) > path = {peek_zstring(txtbuff)} > > Note that in treeview.ew, you reference atom <txtbuff>, and in > your main program you declare atom <txtbuf>. You then attempt > to use atom <txtbuff> in your main code, but it has not been declared > yet, only atom <txtbuf> has. It appears that you are using two different > atoms here, one with two trailing f's, and one with only a single trailing f. > If this is the case, version 2.2, 2.1, 1.5a etc will fail with an error as > well.
7. Re: BUG #1 2.3 alpha
- Posted by euman at bellsouth.net Dec 05, 2001
- 414 views
But, isnt this supposed to be a part of the new namespace feature to pick up on things like this? What Im saying is, if you were to use my treeview.ew as an include, You had written the Main program file and you also had declared an atom txtbuff, then you would recieve the same error I did... You would probably become frustrated trying to find the fix... Anyone care to comment on this? Euman ----- Original Message ----- From: <euman at bellsouth.net> > I copied and pasted some of the code but when I have > several thousand lines of code I tend to miss one occasionally. > > It was txtbuff > two trailing f's in both instances > > atom txtbuff in [Main] > global atom txtbuff in [treeview.ew] declared above (filltvitem) > > This would make for a hard to find bug for a newby Im sure. > it took me a while to figure out why the program that runs > perfectly in 2.2 suddenly crashes when I use 2.3 > telling me that variable txtbuff <2 f's> has not been assigned > a value. > > Just means Euphoria is a whole lot more strict and I guess, I can live > with that. > > > Euman
8. Re: BUG #1 2.3 alpha
- Posted by Robert Craig <rds at RapidEuphoria.com> Dec 05, 2001
- 428 views
Euman writes: > atom txtbuff in [Main] > global atom txtbuff in [treeview.ew] declared above (filltvitem) I think what has happened here is that you've encountered a situation where the 2.3 namespace solution is incompatible with the previous 2.2 system. I mentioned this situation a long time ago in the namespace discussions. Under 2.2 and earlier, when you declare a variable and then later include a file that has the same variable as a global, the global will be in effect for the rest of the program, even in the last part of the original file. Under 2.3, the rule is simpler, and I think more sane: you always look in the current file first for a symbol, then you look at globals in other files. I'm still assuming that this will be a rare situation, and that few people will be counting on the 2.2 behavior. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com