--- In [email protected], "entropyreduction" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "swzoh" <seanzoh@> wrote:
> >
> > Hi Alan,
> >
> > 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)
>
> I looked up LOGFONT. No, I never anticipated that the api would
> include such craziness.
>
> > 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?
>
> Yes, "s" aka "string" is a pseudonym for char*. Every use I've ever
> seen for char*s in structs have been simply a pointer member, not
> actually chucking the string into what then becomes a variable-length
> struct.
>
> I'll try to think of a clever way of allowing such a thing, probably
> by adding yet another modifier for "s".
>
> In the meantime: how about making the last item a byteblock?
> byteblocks can contain whatever you want. Be sure to include the
> final \0.
>
> I'd also though of array of chars and for/endfor to fill the
> individual chars.
I was thinking of using array of chars, but, didn't tried as I
misunderstood the current behavior of char types.
> I'll have a go over the weekend with byteblock: want to post me the
> script you're using that requires LOGFONT?
>
> > (: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.
>
> Error, will fix.
Thanks.
> > 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)
>
> Two pointers of length 4 each, sounds okay.
Sean
------------------------ Yahoo! Groups Sponsor --------------------~-->
Something is new at Yahoo! Groups. Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/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/