Re: Win32lib and handles
- Posted by Derek Parnell <ddparnell at bigpond.com> Dec 04, 2002
- 559 views
On Tue, 3 Dec 2002 16:13:15 -0600, Kat <kat at kogeijin.com> wrote: > On 4 Dec 2002, at 7:47, Derek Parnell wrote: > >> >> Thanks for the additional trace info. However this only further confuses >> me. >> There are a number of Very Weird Things in this trace. >> >> > C:\EUPHORIA\include\win32lib.ew:1089 in function w32Func() >> > type_check failure, grabbedHDC is 11824360 >> >> In the library file there are three places that assign grabbedHDC (a >> sequence BTW). They are ... >> >> grabbedHDC = prepend( grabbedHDC, {pID, lhDC, lSavedDC, lOrigResource} ) >> >> grabbedHDC = removeIndex(lPos, grabbedHDC) >> >> grabbedHDC = prepend( grabbedHDC, {id,hdc, 0, {}} ) >> >> The two using 'prepend' obviously result in a sequence, so no type-check >> error there. The one using removeIndex resolves to this statement ... >> >> return list[1 .. index-1] & list[index+1 .. length(list)] >> >> which because of the concatenation operation also results in a sequence. >> Yet the >> trace seems to crash 'cos an atom is being assigned to it. Very Weird! > > I found a case where strtok is complaining of the results of a parse. If > a subseq is one character, it seems to be getting retyped to an atom, > which crashes the next function to use it. All i can do is test lengths > and use a {} if it's a single character, i spose. If i get time to do > anything about it... Kat, are you suggesting that the problem might lie inside Euphoria? That under some conditions that either a concatenation returns an atom or something like that? > Oh, and i have been having troubles using &= to append things, more than once > i have had nests built where none was intended, and vice versa. For the benefit of Eu new comers, here's how I remember when and how to use &= '&' appends every element and 'append' only every appends one element. In other words... '&' treats the new object a list of elements to be appended, and 'append' treats the new object as a single element. a ={1} a &= "abc" -- this adds 3 elements, namely 'a', 'b' and 'c' ==> {1,'a', 'b','c'} -- length of a is increased by 3 a= {1} a = append(a, "abc") -- this adds one element, namely {'a','b','c'} ==> {1,{'a','b','c'}} -- length of a is increased by 1. Thus a = append(a,x) is equivelent to a &= {x} Robert Craig: Can you confirm that Euphoria will always return a sequence for a concatenation operation? -- cheers, Derek Parnell