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

« back to all changes in this revision

Viewing changes to Source/Swig/stype.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 * See the file LICENSE for information on usage and redistribution.
11
11
 * ----------------------------------------------------------------------------- */
12
12
 
13
 
char cvsroot_stype_c[] = "$Header: /cvsroot/swig/SWIG/Source/Swig/stype.c,v 1.54 2004/12/05 10:15:25 marcelomatus Exp $";
 
13
char cvsroot_stype_c[] = "$Header: /cvsroot/swig/SWIG/Source/Swig/stype.c,v 1.59 2005/10/13 09:26:50 marcelomatus Exp $";
14
14
 
15
15
#include "swig.h"
16
16
#include "cparse.h"
144
144
    return NewString("void");
145
145
    break;
146
146
  default :
147
 
    return NewString("");
148
147
    break;
149
148
  }
 
149
  return NewString("");
150
150
}
151
151
 
152
152
/* -----------------------------------------------------------------------------
386
386
      def = r;
387
387
      return def;
388
388
    }
 
389
    Delete(q);
389
390
  }
390
391
  if (Strcmp(r,"p.SWIGTYPE") == 0) {
391
392
    def = NewString("SWIGTYPE");
393
394
#ifdef SWIG_NEW_TYPE_DEFAULT
394
395
    SwigType *nr = Copy(r);
395
396
    SwigType_del_pointer(nr);
396
 
    def = NewStringf("p.");
 
397
    def = SwigType_isfunction(nr) ? 
 
398
      NewStringf("") : NewStringf("p.");
397
399
    SwigType_add_default(def, nr);
398
400
    Delete(nr);
399
401
#else
453
455
    } else {
454
456
      def = NewString("enum SWIGTYPE");
455
457
    }
 
458
  } else if (SwigType_isfunction(r)) {
 
459
    if (Strcmp(r,"f(ANY).SWIGTYPE") == 0) {
 
460
      def = NewString("p.SWIGTYPE");
 
461
    } else {
 
462
      def = NewString("p.f(ANY).SWIGTYPE");
 
463
    }
456
464
  } else {
457
465
    def = NewString("SWIGTYPE");
458
466
  }
502
510
  p = SwigType_parmlist(t);
503
511
  sz = Len(p);
504
512
  for (i = 0; i < sz; i++) {
505
 
    Append(r,SwigType_str(Getitem(p,i),0));
 
513
    String *str = SwigType_str(Getitem(p,i),0);
 
514
    Append(r,str);
506
515
    if ((i+1) < sz) Putc(',',r);
 
516
    Delete(str);
507
517
  }
508
518
  Putc(' ',r);
509
519
  Putc('>',r);
510
520
  suffix = SwigType_templatesuffix(t);
511
521
  Append(r,suffix);
512
522
  Delete(suffix);
 
523
  Delete(p);
513
524
#if 0
514
525
  if (SwigType_istemplate(r)) {
515
526
    SwigType *rr = SwigType_namestr(r);
759
770
  if (td) {
760
771
    if ((SwigType_isconst(td) || SwigType_isarray(td) || SwigType_isreference(td))) {
761
772
      elements = SwigType_split(td);
762
 
    } else if (SwigType_isenum(td)) {
763
 
      elements = SwigType_split(rs);
764
 
      clear = 0;
765
773
    } else {
766
774
      elements = SwigType_split(rs);
767
775
    } 
835
843
      for (j = 0; j < plen; j++) {
836
844
        p = SwigType_str(Getitem(parms,j),0);
837
845
        Append(result,p);
 
846
        Delete(p);
838
847
        if (j < (plen-1)) Append(result,",");
839
848
      }
840
849
      Append(result,")");
841
850
      Delete(parms);
842
 
    } else if (SwigType_isenum(element)) {
843
 
      String *bs = SwigType_namestr(element);
844
 
      Insert(result,0," ");
845
 
      Insert(result,0,bs);
846
 
      Delete(bs);
847
 
      clear = 0;
848
851
    } else {
849
852
      String *bs = SwigType_namestr(element);
850
853
      Insert(result,0," ");
886
889
  if (SwigType_isarray(s)) {
887
890
    Printf(result,"(%s)%s", SwigType_lstr(s,0),name);
888
891
  } else if (SwigType_isreference(s)) {
889
 
    Printf(result,"(%s)", SwigType_str(s,0));
 
892
    String *str = SwigType_str(s,0);
 
893
    Printf(result,"(%s)", str);
 
894
    Delete(str);
890
895
    if (name) 
891
896
      Printv(result,name,NIL);
892
897
  } else if (SwigType_isqualifier(s)) {
898
903
  return result;
899
904
}
900
905
 
 
906
 
901
907
/* keep old mangling since Java codes need it */
902
908
String *SwigType_manglestr_default(SwigType *s) {
903
909
  char *c;
904
910
  String *result,*base;
905
911
  SwigType *lt;
906
 
  SwigType *ss = SwigType_typedef_resolve_all(s);
 
912
  SwigType *sr = SwigType_typedef_qualified(s);
 
913
  SwigType *ss = SwigType_typedef_resolve_all(sr);
 
914
  
907
915
  s = ss;
908
916
 
909
 
  if (SwigType_istemplate(s)) {
910
 
    String *st = ss;
911
 
    ss = Swig_cparse_template_deftype(st, 0);
 
917
  if (SwigType_istemplate(ss)) {
 
918
    SwigType *ty = Swig_symbol_template_deftype(ss,0);
 
919
    Delete(ss);
 
920
    ss = ty;
912
921
    s = ss;
913
 
    Delete(st);
914
922
  }
 
923
  Delete(sr);
 
924
 
915
925
  lt = SwigType_ltype(s);
916
926
  result = SwigType_prefix(lt);
917
927
  base = SwigType_base(lt);
1039
1049
  }
1040
1050
  Clear(t);
1041
1051
  Append(t,nt);
 
1052
  Delete(elem);
1042
1053
}
1043
1054
 
1044
1055
/* -----------------------------------------------------------------------------