Minor changes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@638 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-08-10 00:12:49 +00:00
commit 9b62acf02c
3 changed files with 22 additions and 9 deletions

View file

@ -68,7 +68,7 @@ Swig_map_add_parmrule(DOHHash *ruleset, DOHHash *parms, DOH *obj)
/* Create a hash table key */
key = NewStringf("%s-%s",name,ty);
key = NewStringf("*map:%s-%s",name,ty);
/* See if there is already a entry with this type in the table */
nn = Getattr(n,key);
@ -124,6 +124,10 @@ static MatchObject *matchstack = 0;
* Perform a longest map match for a list of parameters and a set of mapping rules.
* Returns the corresponding rule object and the number of parameters that were
* matched.
*
* Note: If the ruleset has a 'parent' attribute, this function will walk its
* way up and try to find a match. This can be used to implement scoped
* mappings.
* ----------------------------------------------------------------------------- */
DOH *
@ -184,7 +188,7 @@ Swig_map_match_parms(DOHHash *ruleset, DOHHash *parms, int *nmatch)
if (!SwigType_isarray(ty)) {
key = NewStringf("-%s",ty);
key = NewStringf("*map:-%s",ty);
/* See if there is a generic name match for this type */
nm = Getattr(rs,key);
if (nm) {
@ -198,7 +202,7 @@ Swig_map_match_parms(DOHHash *ruleset, DOHHash *parms, int *nmatch)
/* See if there is a specific name match for this type */
Clear(key);
Printf(key,"%s-%s",name,ty);
Printf(key,"*map:%s-%s",name,ty);
nm = Getattr(rs,key);
if (nm) {
if (!mo) {
@ -244,7 +248,7 @@ Swig_map_match_parms(DOHHash *ruleset, DOHHash *parms, int *nmatch)
}
}
Clear(key);
Printf(key,"-%s",ntype);
Printf(key,"*map:-%s",ntype);
Printf(stdout,"matcharray : %s\n", key);
nm = Getattr(rs,key);
if (nm) {
@ -273,7 +277,7 @@ Swig_map_match_parms(DOHHash *ruleset, DOHHash *parms, int *nmatch)
}
}
Clear(key);
Printf(key,"%s-%s",name,ntype);
Printf(key,"*map:%s-%s",name,ntype);
Printf(stdout,"matcharray : %s\n", key);
nm = Getattr(rs,key);
if (nm) {
@ -302,7 +306,7 @@ Swig_map_match_parms(DOHHash *ruleset, DOHHash *parms, int *nmatch)
DOH *rs;
DOHString *key;
DOHString *dty = SwigType_default(Getattr(parms,"type"));
key = NewStringf("-%s",dty);
key = NewStringf("*map:-%s",dty);
rs = Getattr(ruleset,key);
if (rs) {
@ -312,6 +316,12 @@ Swig_map_match_parms(DOHHash *ruleset, DOHHash *parms, int *nmatch)
Delete(key);
Delete(dty);
}
if (!bestobj) {
DOH *prules = Getattr(ruleset,"parent");
if (prules) {
bestobj = Swig_map_match_parms(prules,parms,nmatch);
}
}
return bestobj;
}

View file

@ -379,7 +379,7 @@ int SwigType_isqualifier(DOHString_or_char *t) {
/* -----------------------------------------------------------------------------
* SwigType_base()
*
* Returns the base of a datatype.
* Returns the base name of a datatype.
* ----------------------------------------------------------------------------- */
DOHString *SwigType_base(DOHString *t) {

View file

@ -130,8 +130,8 @@ extern Parm *CopyParm(Parm *p);
typedef DOH ParmList;
extern ParmList *NewParmList();
extern ParmList *CopyParmList(ParmList *);
extern ParmList *NewParmList();
extern ParmList *CopyParmList(ParmList *);
extern int ParmList_numarg(ParmList *);
extern char *ParmList_str(ParmList *);
@ -401,6 +401,9 @@ extern Wrapper *Swig_cvarget_wrapper(DOHString_or_char *varname,
#define Setvalue(x,v) SetChar(x,"value", Char(v))
#define Setignore(x,v) SetInt(x,"ignore",v)
#define Getnext(x) Getattr(x,"next")
#define Setnext(x,n) Setattr(x,"next",n)
#endif