C# -outfile cosmetic code fixes

This commit is contained in:
William S Fulton 2015-06-11 07:42:50 +01:00
commit 2b9b007027

View file

@ -248,16 +248,16 @@ public:
} else if (strcmp(argv[i], "-oldvarnames") == 0) { } else if (strcmp(argv[i], "-oldvarnames") == 0) {
Swig_mark_arg(i); Swig_mark_arg(i);
old_variable_names = true; old_variable_names = true;
} else if (strcmp(argv[i], "-outfile") == 0) { } else if (strcmp(argv[i], "-outfile") == 0) {
if (argv[i + 1]) { if (argv[i + 1]) {
output_file = NewString(""); output_file = NewString("");
Printf(output_file, argv[i + 1]); Printf(output_file, argv[i + 1]);
Swig_mark_arg(i); Swig_mark_arg(i);
Swig_mark_arg(i + 1); Swig_mark_arg(i + 1);
i++; i++;
} else { } else {
Swig_arg_error(); Swig_arg_error();
} }
} else if (strcmp(argv[i], "-help") == 0) { } else if (strcmp(argv[i], "-help") == 0) {
Printf(stdout, "%s\n", usage); Printf(stdout, "%s\n", usage);
} }
@ -465,7 +465,7 @@ public:
Printf(f_im, "}\n"); Printf(f_im, "}\n");
addCloseNamespace(0, f_im); addCloseNamespace(0, f_im);
if(f_im != f_single_out) if (f_im != f_single_out)
Delete(f_im); Delete(f_im);
f_im = NULL; f_im = NULL;
} }
@ -508,7 +508,7 @@ public:
Printf(f_module, "}\n"); Printf(f_module, "}\n");
addCloseNamespace(0, f_module); addCloseNamespace(0, f_module);
if(f_module != f_single_out) if (f_module != f_single_out)
Delete(f_module); Delete(f_module);
f_module = NULL; f_module = NULL;
} }
@ -609,7 +609,7 @@ public:
f_directors_h = NULL; f_directors_h = NULL;
} }
if(f_single_out) { if (f_single_out) {
Dump(f_single_out, f_begin); Dump(f_single_out, f_begin);
Delete(f_single_out); Delete(f_single_out);
f_single_out = NULL; f_single_out = NULL;
@ -649,12 +649,12 @@ public:
* <dir>/<name>.cs * <dir>/<name>.cs
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
File *getOutputFile(const String* dir, String* name) { File *getOutputFile(const String *dir, const String *name) {
if(output_file) { if (output_file) {
if(!f_single_out) { if (!f_single_out) {
String *filen = NewStringf("%s%s", SWIG_output_directory(), output_file); String *filen = NewStringf("%s%s", SWIG_output_directory(), output_file);
f_single_out = NewFile(filen, "w", SWIG_output_files()); f_single_out = NewFile(filen, "w", SWIG_output_files());
if(!f_single_out) { if (!f_single_out) {
FileErrorDisplay(filen); FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
} }
@ -668,7 +668,7 @@ public:
} else { } else {
String *filen = NewStringf("%s%s.cs", dir, name); String *filen = NewStringf("%s%s.cs", dir, name);
File *f = NewFile(filen, "w", SWIG_output_files()); File *f = NewFile(filen, "w", SWIG_output_files());
if(!f) { if (!f) {
FileErrorDisplay(f); FileErrorDisplay(f);
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
} }
@ -1132,7 +1132,7 @@ public:
scope = NewString(""); scope = NewString("");
if (nspace) if (nspace)
Printf(scope, "%s", nspace); Printf(scope, "%s", nspace);
if (Node* cls = getCurrentClass()) { if (Node *cls = getCurrentClass()) {
if (Node *outer = Getattr(cls, "nested:outer")) { if (Node *outer = Getattr(cls, "nested:outer")) {
String *outerClassesPrefix = Copy(Getattr(outer, "sym:name")); String *outerClassesPrefix = Copy(Getattr(outer, "sym:name"));
for (outer = Getattr(outer, "nested:outer"); outer != 0; outer = Getattr(outer, "nested:outer")) { for (outer = Getattr(outer, "nested:outer"); outer != 0; outer = Getattr(outer, "nested:outer")) {
@ -1252,7 +1252,7 @@ public:
"\n", enum_code, "\n", NIL); "\n", enum_code, "\n", NIL);
addCloseNamespace(nspace, f_enum); addCloseNamespace(nspace, f_enum);
if(f_enum != f_single_out) if (f_enum != f_single_out)
Delete(f_enum); Delete(f_enum);
f_enum = NULL; f_enum = NULL;
Delete(output_directory); Delete(output_directory);
@ -1954,7 +1954,6 @@ public:
} }
} }
// Each outer proxy class goes into a separate file
if (!has_outerclass) { if (!has_outerclass) {
String *output_directory = outputDirectory(nspace); String *output_directory = outputDirectory(nspace);
f_proxy = getOutputFile(output_directory, proxy_class_name); f_proxy = getOutputFile(output_directory, proxy_class_name);
@ -2017,7 +2016,7 @@ public:
if (!has_outerclass) { if (!has_outerclass) {
Printf(f_proxy, "}\n"); Printf(f_proxy, "}\n");
addCloseNamespace(nspace, f_proxy); addCloseNamespace(nspace, f_proxy);
if(f_proxy != f_single_out) if (f_proxy != f_single_out)
Delete(f_proxy); Delete(f_proxy);
f_proxy = NULL; f_proxy = NULL;
} else { } else {
@ -3278,7 +3277,7 @@ public:
Printv(f_swigtype, swigtype, NIL); Printv(f_swigtype, swigtype, NIL);
addCloseNamespace(0, f_swigtype); addCloseNamespace(0, f_swigtype);
if(f_swigtype != f_single_out) if (f_swigtype != f_single_out)
Delete(f_swigtype); Delete(f_swigtype);
f_swigtype = NULL; f_swigtype = NULL;
Delete(swigtype); Delete(swigtype);
@ -4297,10 +4296,10 @@ extern "C" Language *swig_csharp(void) {
const char *CSHARP::usage = "\ const char *CSHARP::usage = "\
C# Options (available with -csharp)\n\ C# Options (available with -csharp)\n\
-dllimport <dl> - Override DllImport attribute name to <dl>\n\ -dllimport <dl> - Override DllImport attribute name to <dl>\n\
-namespace <nm> - Generate wrappers into C# namespace <nm>\n\ -namespace <nm> - Generate wrappers into C# namespace <nm>\n\
-noproxy - Generate the low-level functional interface instead\n\ -noproxy - Generate the low-level functional interface instead\n\
of proxy classes\n\ of proxy classes\n\
-oldvarnames - Old intermediary method names for variable wrappers\n\ -oldvarnames - Old intermediary method names for variable wrappers\n\
-outfile <filename> - Write all C# to a single file <filename> located in the output directory\n\ -outfile <file> - Write all C# into a single <file> located in the output directory\n\
\n"; \n";