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

« back to all changes in this revision

Viewing changes to Source/Swig/symbol.c

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This file implements the SWIG symbol table.  See details below.
8
8
 * ----------------------------------------------------------------------------- */
9
9
 
10
 
char cvsroot_symbol_c[] = "$Id: symbol.c 10195 2007-12-16 20:55:43Z wsfulton $";
 
10
char cvsroot_symbol_c[] = "$Id: symbol.c 11097 2009-01-30 10:27:37Z bhy $";
11
11
 
12
12
#include "swig.h"
13
13
#include "swigwarn.h"
220
220
 * Set the C scopename of the current symbol table.
221
221
 * ----------------------------------------------------------------------------- */
222
222
 
223
 
void Swig_symbol_setscopename(const String_or_char *name) {
 
223
void Swig_symbol_setscopename(const_String_or_char_ptr name) {
224
224
  String *qname;
225
225
  /* assert(!Getattr(current_symtab,"name")); */
226
226
  Setattr(current_symtab, "name", name);
250
250
 * Given a fully qualified C scopename, this function returns a symbol table
251
251
 * ----------------------------------------------------------------------------- */
252
252
 
253
 
Symtab *Swig_symbol_getscope(const String_or_char *name) {
 
253
Symtab *Swig_symbol_getscope(const_String_or_char_ptr name) {
254
254
  if (!symtabs)
255
255
    return 0;
256
 
  if (Equal("::", (String_or_char *) name))
 
256
  if (Equal("::", (const_String_or_char_ptr ) name))
257
257
    name = "";
258
258
  return Getattr(symtabs, name);
259
259
}
373
373
 * Makes an alias for a symbol in the global symbol table.
374
374
 * ----------------------------------------------------------------------------- */
375
375
 
376
 
void Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
 
376
void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *s) {
377
377
  String *qname = Swig_symbol_qualifiedscopename(current_symtab);
378
378
  if (qname) {
379
379
    Printf(qname, "::%s", aliasname);
421
421
 * Adds a node to the C symbol table only.
422
422
 * ----------------------------------------------------------------------------- */
423
423
 
424
 
void Swig_symbol_cadd(String_or_char *name, Node *n) {
 
424
void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
425
425
  Node *append = 0;
426
426
 
427
427
  Node *cn;
594
594
 * for namespace support, type resolution, and other issues.
595
595
 * ----------------------------------------------------------------------------- */
596
596
 
597
 
Node *Swig_symbol_add(String_or_char *symname, Node *n) {
 
597
Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
598
598
  Hash *c, *cn, *cl = 0;
599
599
  SwigType *decl, *ndecl;
600
600
  String *cstorage, *nstorage;
827
827
 * verifying that a class hierarchy implements all pure virtual methods.
828
828
 * ----------------------------------------------------------------------------- */
829
829
 
830
 
static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)) {
 
830
static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (Node *n)) {
831
831
  Node *n;
832
832
  List *inherit;
833
833
  Hash *sym = Getattr(symtab, "csymtab");
890
890
  return 0;
891
891
}
892
892
 
893
 
static Node *symbol_lookup(String_or_char *name, Symtab *symtab, int (*check) (Node *n)) {
 
893
static Node *symbol_lookup(const_String_or_char_ptr name, Symtab *symtab, int (*check) (Node *n)) {
894
894
  Node *n = 0;
895
895
  if (DohCheck(name)) {
896
896
    n = _symbol_lookup(name, symtab, check);
908
908
 * symbol_lookup_qualified()
909
909
 * ----------------------------------------------------------------------------- */
910
910
 
911
 
static Node *symbol_lookup_qualified(String_or_char *name, Symtab *symtab, String *prefix, int local, int (*checkfunc) (Node *n)) {
 
911
static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symtab, const String *prefix, int local, int (*checkfunc) (Node *n)) {
912
912
  /* This is a little funky, we search by fully qualified names */
913
913
 
914
914
  if (!symtab)
928
928
    /* Make qualified name of current scope */
929
929
    String *qalloc = 0;
930
930
    String *qname = Swig_symbol_qualifiedscopename(symtab);
 
931
    const String *cqname;
931
932
    if (qname) {
932
933
      if (Len(qname)) {
933
934
        if (prefix && Len(prefix)) {
937
938
        Append(qname, prefix);
938
939
      }
939
940
      qalloc = qname;
 
941
      cqname = qname;
940
942
    } else {
941
 
      qname = prefix;
 
943
      cqname = prefix;
942
944
    }
943
 
    st = Getattr(symtabs, qname);
 
945
    st = Getattr(symtabs, cqname);
944
946
    /* Found a scope match */
945
947
    if (st) {
946
948
      if (!name) {
974
976
 * to get the real node.
975
977
 * ----------------------------------------------------------------------------- */
976
978
 
977
 
Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
 
979
Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) {
978
980
  Hash *hsym = 0;
979
981
  Node *s = 0;
980
982
 
1046
1048
 * inheritance hierarchy. 
1047
1049
 * ----------------------------------------------------------------------------- */
1048
1050
 
1049
 
Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc) (Node *n)) {
 
1051
Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *n)) {
1050
1052
  Hash *hsym = 0;
1051
1053
  Node *s = 0;
1052
1054
 
1110
1112
 * Swig_symbol_clookup_local()
1111
1113
 * ----------------------------------------------------------------------------- */
1112
1114
 
1113
 
Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
 
1115
Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
1114
1116
  Hash *h, *hsym;
1115
1117
  Node *s = 0;
1116
1118
 
1158
1160
 * Swig_symbol_clookup_local_check()
1159
1161
 * ----------------------------------------------------------------------------- */
1160
1162
 
1161
 
Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc) (Node *)) {
 
1163
Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *)) {
1162
1164
  Hash *h, *hsym;
1163
1165
  Node *s = 0;
1164
1166
 
1209
1211
 * Look up a scope name.
1210
1212
 * ----------------------------------------------------------------------------- */
1211
1213
 
1212
 
Symtab *Swig_symbol_cscope(String_or_char *name, Symtab *symtab) {
 
1214
Symtab *Swig_symbol_cscope(const_String_or_char_ptr name, Symtab *symtab) {
1213
1215
  char *cname = Char(name);
1214
1216
  if (strncmp(cname, "::", 2) == 0)
1215
1217
    return symbol_lookup_qualified(0, global_scope, name, 0, 0);