accept unix directory separators on windows for input file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11001 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9a94969fdd
commit
da0b517a7f
8 changed files with 32 additions and 22 deletions
|
|
@ -61,7 +61,7 @@ static String *AttributeFunctionGet = 0;
|
|||
static String *AttributeFunctionSet = 0;
|
||||
static Node *CurrentClass = 0;
|
||||
int line_number = 0;
|
||||
char *input_file = 0;
|
||||
String *input_file = 0;
|
||||
int SmartPointer = 0;
|
||||
static Hash *classhash;
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ int Language::emit_one(Node *n) {
|
|||
Extend = 1;
|
||||
|
||||
line_number = Getline(n);
|
||||
input_file = Char(Getfile(n));
|
||||
input_file = Getfile(n);
|
||||
|
||||
/*
|
||||
symtab = Getattr(n,"symtab");
|
||||
|
|
|
|||
|
|
@ -185,12 +185,13 @@ enum { STAGE1=1, STAGE2=2, STAGE3=4, STAGE4=8, STAGEOVERFLOW=16 };
|
|||
static List *all_output_files = 0;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// check_suffix(char *name)
|
||||
// check_suffix()
|
||||
//
|
||||
// Checks the suffix of a file to see if we should emit extern declarations.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int check_suffix(const char *name) {
|
||||
static int check_suffix(String *filename) {
|
||||
const char *name = Char(filename);
|
||||
const char *c;
|
||||
if (!name)
|
||||
return 0;
|
||||
|
|
@ -936,12 +937,13 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
|
||||
// If we made it this far, looks good. go for it....
|
||||
|
||||
input_file = argv[argc - 1];
|
||||
input_file = NewString(argv[argc - 1]);
|
||||
Swig_filename_correct(input_file);
|
||||
|
||||
// If the user has requested to check out a file, handle that
|
||||
if (checkout) {
|
||||
DOH *s;
|
||||
char *outfile = input_file;
|
||||
String *outfile = Char(input_file);
|
||||
if (outfile_name)
|
||||
outfile = outfile_name;
|
||||
|
||||
|
|
@ -1002,7 +1004,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
if (lang_config) {
|
||||
Printf(fs, "\n%%include <%s>\n", lang_config);
|
||||
}
|
||||
Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(NewString(input_file)), Swig_last_file());
|
||||
Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(input_file), Swig_last_file());
|
||||
for (i = 0; i < Len(libfiles); i++) {
|
||||
Printf(fs, "\n%%include \"%s\"\n", Getitem(libfiles, i));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3174,8 +3174,7 @@ MODULA3():
|
|||
Clear(result_m3wraptype);
|
||||
Printv(result_m3wraptype, tm, NIL);
|
||||
} else {
|
||||
Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN,
|
||||
input_file, line_number,
|
||||
Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN, input_file, line_number,
|
||||
"Typemap m3wrapargdir set to 'out' for %s implies a RETURN value, but the routine %s has already one.\nUse %%multiretval feature.\n",
|
||||
SwigType_str(Getattr(p, "type"), 0), raw_name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1489,8 +1489,7 @@ public:
|
|||
Replaceall(tm, "$symname", iname);
|
||||
Printf(f_c->code, "%s\n", tm);
|
||||
} else {
|
||||
Printf(stderr,"%s: Line %d, Unable to link with type %s\n",
|
||||
input_file, line_number, SwigType_str(t, 0));
|
||||
Printf(stderr,"%s: Line %d, Unable to link with type %s\n", input_file, line_number, SwigType_str(t, 0));
|
||||
}
|
||||
*/
|
||||
/* Now generate C -> PHP sync blocks */
|
||||
|
|
@ -1502,8 +1501,7 @@ public:
|
|||
Replaceall(tm, "$symname", iname);
|
||||
Printf(f_php->code, "%s\n", tm);
|
||||
} else {
|
||||
Printf(stderr,"%s: Line %d, Unable to link with type %s\n",
|
||||
input_file, line_number, SwigType_str(t, 0));
|
||||
Printf(stderr,"%s: Line %d, Unable to link with type %s\n", input_file, line_number, SwigType_str(t, 0));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ typedef int bool;
|
|||
#define PLAIN_VIRTUAL 1
|
||||
#define PURE_VIRTUAL 2
|
||||
|
||||
extern char *input_file;
|
||||
extern String *input_file;
|
||||
extern int line_number;
|
||||
extern int start_line;
|
||||
extern int CPlusPlus; // C++ mode
|
||||
|
|
|
|||
|
|
@ -650,14 +650,7 @@ static String *get_filename(String *str, int *sysfile) {
|
|||
if (isspace(c))
|
||||
Ungetc(c, str);
|
||||
}
|
||||
#if defined(_WIN32) || defined(MACSWIG)
|
||||
/* accept Unix path separator on non-Unix systems */
|
||||
Replaceall(fn, "/", SWIG_FILE_DELIMITER);
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
/* accept Windows path separator in addition to Unix path separator */
|
||||
Replaceall(fn, "\\", SWIG_FILE_DELIMITER);
|
||||
#endif
|
||||
Swig_filename_correct(fn);
|
||||
Seek(fn, 0, SEEK_SET);
|
||||
return fn;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,23 @@ String *Swig_strip_c_comments(const String *s) {
|
|||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_filename_correct()
|
||||
*
|
||||
* Corrects filenames on non-unix systems
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_filename_correct(String *filename) {
|
||||
#if defined(_WIN32) || defined(MACSWIG)
|
||||
/* accept Unix path separator on non-Unix systems */
|
||||
Replaceall(filename, "/", SWIG_FILE_DELIMITER);
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
/* accept Windows path separator in addition to Unix path separator */
|
||||
Replaceall(filename, "\\", SWIG_FILE_DELIMITER);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_filename_escape()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Swig_banner(File *f);
|
||||
extern String *Swig_strip_c_comments(const String *s);
|
||||
extern String *Swig_filename_escape(String *filename);
|
||||
extern void Swig_filename_correct(String *filename);
|
||||
extern String *Swig_string_escape(String *s);
|
||||
extern String *Swig_string_mangle(const String *s);
|
||||
extern void Swig_scopename_split(String *s, String **prefix, String **last);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue