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

« back to all changes in this revision

Viewing changes to Source/Preprocessor/cpp.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:
13
13
 * - Lines beginning with %# are stripped down to #... and passed through.
14
14
 * ----------------------------------------------------------------------------- */
15
15
 
16
 
char cvsroot_cpp_c[] = "$Id: cpp.c 10540 2008-06-21 15:23:02Z wsfulton $";
 
16
char cvsroot_cpp_c[] = "$Id: cpp.c 11098 2009-01-30 10:32:59Z bhy $";
17
17
 
18
18
#include "swig.h"
19
19
#include "preprocessor.h"
74
74
  Setline(s2, Getline((DOH *) s1));
75
75
}
76
76
 
77
 
static String *cpp_include(String_or_char *fn, int sysfile) {
 
77
static String *cpp_include(const_String_or_char_ptr fn, int sysfile) {
78
78
  String *s = sysfile ? Swig_include_sys(fn) : Swig_include(fn);
79
79
  if (s && single_include) {
80
80
    String *file = Getfile(s);
85
85
    Setattr(included_files, file, file);
86
86
  }
87
87
  if (!s) {
88
 
    Seek(fn, 0, SEEK_SET);
 
88
    /* XXX(bhy) may not need the seek */
 
89
    /* Seek(fn, 0, SEEK_SET); */
89
90
    if (ignore_missing) {
90
91
      Swig_warning(WARN_PP_MISSING_FILE, Getfile(fn), Getline(fn), "Unable to find '%s'\n", fn);
91
92
    } else {
261
262
 * ----------------------------------------------------------------------------- */
262
263
 
263
264
 
264
 
String_or_char *Macro_vararg_name(String_or_char *str, String_or_char *line) {
265
 
  String_or_char *argname, *varargname;
 
265
String *Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr line) {
 
266
  String *argname;
 
267
  String *varargname;
266
268
  char *s, *dots;
267
269
 
268
270
  argname = Copy(str);
288
290
  return varargname;
289
291
}
290
292
 
291
 
Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
 
293
Hash *Preprocessor_define(const_String_or_char_ptr _str, int swigmacro) {
292
294
  String *macroname = 0, *argstr = 0, *macrovalue = 0, *file = 0, *s = 0;
293
295
  Hash *macro = 0, *symbols = 0, *m1;
294
296
  List *arglist = 0;
295
297
  int c, line;
296
298
  int varargs = 0;
297
 
  String_or_char *str = (String_or_char *) _str;
 
299
  String *str;
298
300
 
299
301
  assert(cpp);
300
 
  assert(str);
 
302
  assert(_str);
301
303
 
302
304
  /* First make sure that string is actually a string */
303
 
  if (DohCheck(str)) {
304
 
    s = Copy(str);
305
 
    copy_location(str, s);
 
305
  if (DohCheck(_str)) {
 
306
    s = Copy(_str);
 
307
    copy_location(_str, s);
306
308
    str = s;
307
309
  } else {
308
 
    str = NewString((char *) str);
 
310
    str = NewString((char *) _str);
309
311
  }
310
312
  Seek(str, 0, SEEK_SET);
311
313
  line = Getline(str);
532
534
 *
533
535
 * Undefines a macro.
534
536
 * ----------------------------------------------------------------------------- */
535
 
void Preprocessor_undef(const String_or_char *str) {
 
537
void Preprocessor_undef(const_String_or_char_ptr str) {
536
538
  Hash *symbols;
537
539
  assert(cpp);
538
540
  symbols = Getattr(cpp, kpp_symbols);
650
652
    if (isspace(c))
651
653
      Ungetc(c, str);
652
654
  }
653
 
#if defined(_WIN32) || defined(MACSWIG)
654
 
  /* accept Unix path separator on non-Unix systems */
655
 
  Replaceall(fn, "/", SWIG_FILE_DELIMITER);
656
 
#endif
657
 
#if defined(__CYGWIN__)
658
 
  /* accept Windows path separator in addition to Unix path separator */
659
 
  Replaceall(fn, "\\", SWIG_FILE_DELIMITER);
660
 
#endif
 
655
  Swig_filename_correct(fn);
661
656
  Seek(fn, 0, SEEK_SET);
662
657
  return fn;
663
658
}