No subject (original) (raw)

Jacek Caban jacek at codeweavers.com
Tue Dec 10 11:57:21 CST 2019


Hi Gabriel,

On 12/10/19 6:17 PM, Gabriel Ivăncescu wrote:

On 12/10/19 5:35 PM, Jacek Caban wrote:

On 12/9/19 4:29 PM, Gabriel Ivăncescu wrote:

+enum memidtype { +    memidinvalid, +    memidinherited, +    memidfunc, +    memidvar +}; + +static inline enum memidtype getmemidtype(const ScriptTypeInfo *typeinfo, MEMBERID memid) +{ +    if (memid <= 0) return memidinvalid;_ _+    if (memid & DISPIDFUNCTIONMASK)_ _+    {_ _+        memid &= ~DISPIDFUNCTIONMASK;_ _+        if (memid >= typeinfo->funcmemidmapcnt) +            return memidinherited; +        if (typeinfo->funcmemidmap[memid] == ~0) +            return memidinvalid; +        return memidfunc; +    } +    if (memid > typeinfo->numvars) +        return memidinherited; +    return memidvar; +}

It seems that could let default ITypeInfo handle invalid IDs and you could just forward all calls to unknown IDs to it. You don't need a new map for that, you could just use a binary search on funcs. Thanks, Jacek Sure, that sounds like a good approach as well. I'll look into it tomorrow. I have a question, though, about jscript (similar patch for jscript, not sent yet to mailing list). In jscript, variables and functions can be deleted, and so currently I have a map of memids for both vars and functions (just one map for both). Should I also use a binary search there (needed for both variables and functions), or rather keep the single map for both, which I think is slightly simpler code? Currently I identify whether an element in the map is a variable or a function by looking at where it points to: if it points within the bounds of the function array, then it's a function. So no extra fields needed, other than the map itself. This is all for jscript of course (not vbscript or this patch, but related).

I'm not sure without looking at the code, but two binary searches seem fine.

Thanks,

Jacek



More information about the wine-devel mailing list