~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Source/Swig/naming.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-11-10 16:29:56 UTC
  • mfrom: (1.2.8 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20081110162956-xue6itkuqhbza87s
Tags: 1.3.36-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop pike and libchicken-dev from the build-depends 
    (both are universe)
  - Use python2.5 instead of python2.4.
  - use php5
  - Clean Runtime/ as well.
  - debian/Rules (clean): Remove Lib/ocaml/swigp4.ml.
  - drop "--without-mzscheme", we don't have it in our build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * Functions for generating various kinds of names during code generation.
8
8
 * ----------------------------------------------------------------------------- */
9
9
 
10
 
char cvsroot_naming_c[] = "$Id: naming.c 10297 2008-03-04 21:37:25Z wsfulton $";
 
10
char cvsroot_naming_c[] = "$Id: naming.c 10540 2008-06-21 15:23:02Z wsfulton $";
11
11
 
12
12
#include "swig.h"
13
13
#include "cparse.h"
482
482
        Delete(t_name);
483
483
      }
484
484
      /* A template-based class lookup */
485
 
      if (0 && !rn && SwigType_istemplate(prefix)) {
 
485
      /*
 
486
      if (!rn && SwigType_istemplate(prefix)) {
486
487
        String *t_prefix = SwigType_templateprefix(prefix);
487
488
        if (Strcmp(t_prefix, prefix) != 0) {
488
489
          String *t_name = SwigType_templateprefix(name);
491
492
        }
492
493
        Delete(t_prefix);
493
494
      }
 
495
      */
494
496
    }
495
497
    /* A wildcard-based class lookup */
496
498
    if (!rn) {
966
968
 * int Swig_need_protected(Node* n)
967
969
 *
968
970
 * Detects when we need to fully register the protected member.
 
971
 * This is basically any protected members when the allprotected mode is set.
 
972
 * Otherwise we take just the protected virtual methods and non-static methods 
 
973
 * (potentially virtual methods) as well as constructors/destructors.
969
974
 * 
970
975
 * ----------------------------------------------------------------------------- */
971
976
 
972
977
int Swig_need_protected(Node *n) {
973
 
  /* First, 'n' looks like a function */
974
 
  /* if (!Swig_director_mode()) return 0; */
975
978
  String *nodetype = nodeType(n);
976
 
  if ((Equal(nodetype, "cdecl")) && SwigType_isfunction(Getattr(n, "decl"))) {
977
 
    String *storage = Getattr(n, "storage");
978
 
    /* and the function is declared like virtual, or it has no
979
 
       storage. This eliminates typedef, static and so on. */
980
 
    return !storage || Equal(storage, "virtual");
981
 
  } else if (Equal(nodetype, "constructor") || Equal(nodetype, "destructor")) {
982
 
    return 1;
 
979
  if (checkAttribute(n, "access", "protected")) {
 
980
    if ((Equal(nodetype, "cdecl"))) {
 
981
      if (Swig_director_mode() && Swig_director_protected_mode() && Swig_all_protected_mode()) {
 
982
        return 1;
 
983
      }
 
984
      if (SwigType_isfunction(Getattr(n, "decl"))) {
 
985
        String *storage = Getattr(n, "storage");
 
986
        /* The function is declared virtual, or it has no storage. This eliminates typedef, static etc. */
 
987
        return !storage || Equal(storage, "virtual");
 
988
      }
 
989
    } else if (Equal(nodetype, "constructor") || Equal(nodetype, "destructor")) {
 
990
      return 1;
 
991
    }
983
992
  }
984
 
 
985
993
  return 0;
986
994
}
987
995
 
1471
1479
  }
1472
1480
 
1473
1481
 
1474
 
  if (rename_hash || rename_list) {
 
1482
  if (rename_hash || rename_list || namewarn_hash || namewarn_list) {
1475
1483
    Hash *rn = Swig_name_object_get(Swig_name_rename_hash(), prefix, name, decl);
1476
1484
    if (!rn || !Swig_name_match_nameobj(rn, n)) {
1477
1485
      rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl);