443
462
if (Len(prefix)) {
444
463
tname = NewStringf("%s::%s",prefix,name);
445
n = Getattr(namehash,tname);
446
rn = get_object(n,decl);
447
if ((!rn) && ncdecl) rn = get_object(n,ncdecl);
448
if (!rn) rn = get_object(n,0);
464
rn = name_object_get(namehash, tname, decl, ncdecl);
466
/* A template-based class lookup */
467
if (!rn && SwigType_istemplate(prefix)) {
468
String *tprefix = SwigType_templateprefix(prefix);
469
tname = NewStringf("%s::%s",tprefix,name);
470
rn = name_object_get(namehash, tname, decl, ncdecl);
451
475
/* A wildcard-based class lookup */
453
477
tname = NewStringf("*::%s",name);
454
n = Getattr(namehash,tname);
455
rn = get_object(n,decl);
456
if ((!rn) && ncdecl) rn = get_object(n,ncdecl);
457
if (!rn) rn = get_object(n,0);
478
rn = name_object_get(namehash, tname, decl, ncdecl);
461
482
/* Lookup in the global namespace only */
462
483
tname = NewStringf("::%s",name);
463
n = Getattr(namehash,tname);
464
rn = get_object(n,decl);
465
if ((!rn) && ncdecl) rn = get_object(n,ncdecl);
466
if (!rn) rn = get_object(n,0);
484
rn = name_object_get(namehash, tname, decl, ncdecl);
471
n = Getattr(namehash,name);
472
rn = get_object(n,decl);
473
if ((!rn) && ncdecl) rn = get_object(n,ncdecl);
474
if (!rn) rn = get_object(n,0);
489
rn = name_object_get(namehash, name, decl, ncdecl);
544
556
* the declaration, decl.
545
557
* ----------------------------------------------------------------------------- */
560
void features_get(Hash *features, String *tname, SwigType *decl, SwigType *ncdecl, Node *node)
562
Node *n = Getattr(features,tname);
564
Printf(stdout," feature_get: %s\n", tname);
567
merge_features(get_object(n,0),node);
568
if (ncdecl) merge_features(get_object(n,ncdecl),node);
569
merge_features(get_object(n,decl),node);
548
574
Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl, Node *node) {
552
576
char *ncdecl = 0;
553
578
SwigType *rname = 0;
554
579
if (!features) return;
581
/* MM: This removed to more tightly control feature/name matching */
556
583
if ((decl) && (SwigType_isqualifier(decl))) {
557
584
ncdecl = strchr(Char(decl),'.');
561
589
/* very specific hack for template constructors/destructors */
562
590
if (name && SwigType_istemplate(name) &&
563
591
((Strcmp(nodeType(node),"constructor") == 0)
564
592
|| (Strcmp(nodeType(node),"destructor") == 0))) {
565
593
rname = SwigType_templateprefix(name);
595
Replaceall(rdecl,name,rname);
601
Printf(stdout,"feature_get: %s %s %s\n", prefix, name, decl);
604
/* Global features */
605
features_get(features, "", 0, 0, node);
608
features_get(features, name, decl, ncdecl, node);
570
609
/* Perform a class-based lookup (if class prefix supplied) */
573
tname = NewStringf("%s::%s",prefix,name);
574
n = Getattr(features,tname);
575
rn = get_object(n,decl);
576
merge_features(rn,node);
578
rn = get_object(n,ncdecl);
579
merge_features(rn,node);
581
rn = get_object(n,0);
582
merge_features(rn,node);
585
/* A wildcard-based class lookup */
586
tname = NewStringf("*::%s",name);
587
n = Getattr(features,tname);
588
rn = get_object(n,decl);
589
merge_features(rn,node);
591
rn = get_object(n,ncdecl);
592
merge_features(rn,node);
594
rn = get_object(n,0);
595
merge_features(rn,node);
598
611
/* A class-generic feature */
599
612
if (Len(prefix)) {
600
613
tname = NewStringf("%s::",prefix);
601
n = Getattr(features,tname);
602
rn = get_object(n,0);
603
merge_features(rn,node);
614
features_get(features, tname, decl, ncdecl, node);
617
/* A wildcard-based class lookup */
618
tname = NewStringf("*::%s",name);
619
features_get(features, tname, decl, ncdecl, node);
621
/* A specific class lookup */
623
/* A template-based class lookup */
624
if (SwigType_istemplate(prefix)) {
625
String *tprefix = SwigType_templateprefix(prefix);
626
tname = NewStringf("%s::%s",tprefix,name);
627
features_get(features, tname, decl, ncdecl, node);
631
tname = NewStringf("%s::%s",prefix,name);
632
features_get(features, tname, decl, ncdecl, node);
608
636
/* Lookup in the global namespace only */
609
637
tname = NewStringf("::%s",name);
610
n = Getattr(features,tname);
611
rn = get_object(n,decl);
612
merge_features(rn,node);
614
rn = get_object(n,ncdecl);
615
merge_features(rn,node);
617
rn = get_object(n,0);
618
merge_features(rn,node);
638
features_get(features, tname, decl, ncdecl, node);
622
n = Getattr(features,name);
623
rn = get_object(n,decl);
624
merge_features(rn,node);
626
rn = get_object(n,ncdecl);
627
merge_features(rn,node);
629
rn = get_object(n,0);
630
merge_features(rn,node);
632
/* Global features */
633
n = Getattr(features,"");
634
rn = get_object(n,0);
635
merge_features(rn,node);