--- In [email protected], "swzoh" <[EMAIL PROTECTED]> wrote:
>
> While I was writing a script, I encountered a situation to have to
> set a 'literal' string as an element of struct:
> tLogFont=dll.create_struct("i i i i i uc uc uc uc uc uc uc uc s",;;+
> nHeight,0,0,0,400,0,0,0,1,0,0,0,0,sFaceName)
>
> However, tLogFont.get_size always returned 32 regardless of whatever
> name is setted to sFaceName like "Tahoma" or "Courier New". So, it
> seems to be treated always as a pointer. Is this a intended
> behavior?
> (:I tested also s- instead of mere s, but the same result)
>
> And, strangely, tLogFont[n] reported expected values until 5, but
> suddenly gave some large numbers (seeming address) after. Notice the
> type cahnges after 5.
>
> OTOH, with array,
> a=dll.create_array("s","This ","is an array")
> a[1], a[2] gave expected results, however, a.get_size gave 8. (This
> one could be a correct behaviour, but I'm not sure)
It seems that there is a problem with (u)char type, or I misunderstand it.
local _1_=esc(?"\x01",?"\")
local t=dll.create_struct("i o c c c c",1,1,1,1,1,1)
win.debug(t[1],t[2],t[3],t[4],t[5],t[6])
The results is:
1 0x31310001 0x31313131 0x313131 0x3131 0x31
If neglecting the stack alignment problem (:is it correct name?), 1/0
is correctly assigned, i.e., 0x01/0x00, for integer and short types,
whereas is incorrectly assigned, i.e., their ascii values 0x31/0x30,
for char types. So, have to use _1_/"" instead with char types.
And, I can't still find a way to assign a literal string in struct.
Sean
------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/JV_rlB/TM
--------------------------------------------------------------------~->
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/