|
|
On 5/28/21 3:48 AM, jr wrote:
> hi,
>
...
>> ...
>>> supported by a similar function which returns an 'array mixed' with the various
>>> "properties"/categories broken out?
>>
>> What I've not done for arrays vs mixed arrays as yet is look for a
>> method 'like' that employed to break out a few of the object types like
>> light sources(1). The object flags popped into my head on Tor Olav's
>> question.
>
> I put this badly. meant that 'is_type()' probably "will do" for most use cases,
> and so perhaps a complementary function (eg) 'is_type_details()' which returns
> an array mixed, where the various flags are used to distinguish one ("390")
> object from another.
>
Yes, is_type_details(), a possibility, but it would be work creeping
well past "easy."
Aside: For the details which could be provided as strings of text as to
type, my thought was this work would be pushed onto users - or some
include file maintainer - in the form of a macro containing a big switch
kicking out text or setting up an array with, say, response strings:
"The is type passed to MagicMacro24 is a light_source."
>
>> Even without getting different type ids for arrays vs mixed arrays today
>> from id_type, you can walk a mixed array asking about the types for each
>> element and in that way via SDL looping (or your foreach work) build up
>> what types in total are seen for any given the mixed array.
>
> not sure I really understand. if some macro expects an array mixed parameter,
> say {3-vect, string, bool}, I do not know of a "safe" way to check all three.
> for instance, whether I use 'strlen(string)' or similar, if it's not a string,
> POV-Ray will "intervene". (did I misread?)
>
> (and the (snipped) macro examples too, while safe to use, would not allow me to
> catch (as in handle with own error message) the eventual "odd" value, I think)
>
You understood. What I coded up there is checking on the cheap; POV-Ray
does it and the result is an internal parser error. What I had in mind
for what I think you want to do - using id_type() - is something like
the attached test case. Yes/No?
Bill P.
Post a reply to this message
Attachments:
Download 'utf-8' (3 KB)
|
|