create a common banner header for all target language specific files
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11016 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
67e2785cb7
commit
cc522323d7
19 changed files with 82 additions and 80 deletions
|
|
@ -21,7 +21,7 @@ char cvsroot_allegrocl_cxx[] = "$Id$";
|
|||
static File *f_cl = 0;
|
||||
String *f_clhead = NewString("");
|
||||
String *f_clwrap = NewString("(swig-in-package ())\n\n");
|
||||
static File *f_cxx;
|
||||
static File *f_runtime;
|
||||
static File *f_cxx_header = 0;
|
||||
static File *f_cxx_wrapper = 0;
|
||||
|
||||
|
|
@ -1599,27 +1599,29 @@ int ALLEGROCL::top(Node *n) {
|
|||
Generate_Wrapper = CPlusPlus || CWrap;
|
||||
|
||||
if (Generate_Wrapper) {
|
||||
f_cxx = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_cxx) {
|
||||
f_runtime = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_runtime) {
|
||||
Close(f_cl);
|
||||
Delete(f_cl);
|
||||
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else
|
||||
f_cxx = NewString("");
|
||||
f_runtime = NewString("");
|
||||
|
||||
f_cxx_header = f_cxx;
|
||||
f_cxx_header = f_runtime;
|
||||
f_cxx_wrapper = NewString("");
|
||||
|
||||
Swig_register_filebyname("header", f_cxx_header);
|
||||
Swig_register_filebyname("wrapper", f_cxx_wrapper);
|
||||
Swig_register_filebyname("runtime", f_cxx);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("lisp", f_clwrap);
|
||||
Swig_register_filebyname("lisphead", f_cl);
|
||||
|
||||
Printf(f_cl, ";; This is an automatically generated file. Make changes in\n"
|
||||
";; the definition file, not here.\n\n"
|
||||
Swig_banner(f_runtime);
|
||||
Swig_banner_target_lang(f_cl, ";;");
|
||||
|
||||
Printf(f_cl, "\n"
|
||||
"(defpackage :%s\n"
|
||||
" (:use :common-lisp :ff :excl)\n"
|
||||
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
|
||||
|
|
@ -1636,7 +1638,7 @@ int ALLEGROCL::top(Node *n) {
|
|||
|
||||
Language::top(n);
|
||||
|
||||
// SwigType_emit_type_table(f_cxx,f_cxx_wrapper);
|
||||
// SwigType_emit_type_table(f_runtime,f_cxx_wrapper);
|
||||
|
||||
// Swig_print_tree(n);
|
||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||
|
|
@ -1659,10 +1661,10 @@ int ALLEGROCL::top(Node *n) {
|
|||
Delete(f_clhead);
|
||||
Delete(f_clwrap);
|
||||
|
||||
Printf(f_cxx, "%s\n", f_cxx_wrapper);
|
||||
Printf(f_runtime, "%s\n", f_cxx_wrapper);
|
||||
|
||||
Close(f_cxx);
|
||||
Delete(f_cxx);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_cxx_wrapper);
|
||||
|
||||
// Swig_print_tree(n);
|
||||
|
|
@ -2803,8 +2805,8 @@ int ALLEGROCL::constantWrapper(Node *n) {
|
|||
SwigType_add_qualifier(const_type, "static");
|
||||
|
||||
String *ppcname = NewStringf("ACLppc_%s", Getattr(n, "sym:name"));
|
||||
// Printf(f_cxx, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
Printf(f_cxx, "%s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
// Printf(f_runtime, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
Printf(f_runtime, "%s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
|
||||
|
||||
Setattr(n, "name", ppcname);
|
||||
SetFlag(n, "feature:immutable");
|
||||
|
|
@ -2861,7 +2863,7 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
|
|||
ctype = SwigType_str(type, 0);
|
||||
// EXPORT <SwigType_str> <mangled_name>;
|
||||
// <SwigType_str> <mangled_name> = <name>;
|
||||
// Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
|
||||
// Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
|
||||
// ctype, mangled_name, (pointer_added ? "&" : ""), name);
|
||||
|
||||
Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n",
|
||||
|
|
@ -2900,12 +2902,12 @@ int ALLEGROCL::variableWrapper(Node *n) {
|
|||
|
||||
// EXPORT <SwigType_str> <mangled_name>;
|
||||
// <SwigType_str> <mangled_name> = <name>;
|
||||
Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name);
|
||||
Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name);
|
||||
|
||||
Printf(f_cl, "(swig-defvar \"%s\" :type %s)\n", mangled_name, ((SwigType_isconst(type)) ? ":constant" : ":variable"));
|
||||
/*
|
||||
Printf(f_cxx, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type")));
|
||||
Printf(f_cxx, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype))));
|
||||
Printf(f_runtime, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type")));
|
||||
Printf(f_runtime, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype))));
|
||||
*/
|
||||
|
||||
Printf(stderr,"***\n");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
String *f_clhead;
|
||||
String *f_clwrap;
|
||||
bool CWrap; // generate wrapper file for C code?
|
||||
File *f_cxx;
|
||||
File *f_runtime;
|
||||
File *f_cxx_header;
|
||||
File *f_cxx_wrapper;
|
||||
File *f_clos;
|
||||
|
|
@ -126,8 +126,8 @@ int CFFI::top(Node *n) {
|
|||
}
|
||||
|
||||
if (CPlusPlus || CWrap) {
|
||||
f_cxx = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_cxx) {
|
||||
f_runtime = NewFile(cxx_filename, "w", SWIG_output_files());
|
||||
if (!f_runtime) {
|
||||
Close(f_lisp);
|
||||
Delete(f_lisp);
|
||||
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
|
||||
|
|
@ -144,22 +144,25 @@ int CFFI::top(Node *n) {
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
f_cxx = NewString("");
|
||||
f_runtime = NewString("");
|
||||
f_clos = NewString("");
|
||||
}
|
||||
|
||||
f_cxx_header = f_cxx;
|
||||
f_cxx_header = f_runtime;
|
||||
f_cxx_wrapper = NewString("");
|
||||
|
||||
Swig_register_filebyname("header", f_cxx_header);
|
||||
Swig_register_filebyname("wrapper", f_cxx_wrapper);
|
||||
Swig_register_filebyname("runtime", f_cxx);
|
||||
Swig_register_filebyname("runtime", f_runtime);
|
||||
Swig_register_filebyname("lisphead", f_clhead);
|
||||
if (!no_swig_lisp)
|
||||
Swig_register_filebyname("swiglisp", f_cl);
|
||||
else
|
||||
Swig_register_filebyname("swiglisp", f_null);
|
||||
|
||||
Swig_banner(f_runtime);
|
||||
Swig_banner_target_lang(f_lisp, ";;;");
|
||||
|
||||
Language::top(n);
|
||||
Printf(f_lisp, "%s\n", f_clhead);
|
||||
Printf(f_lisp, "%s\n", f_cl);
|
||||
|
|
@ -170,8 +173,8 @@ int CFFI::top(Node *n) {
|
|||
Delete(f_cl);
|
||||
Delete(f_clhead);
|
||||
Delete(f_clwrap);
|
||||
Close(f_cxx);
|
||||
Delete(f_cxx);
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
Delete(f_cxx_wrapper);
|
||||
Delete(f_null);
|
||||
|
||||
|
|
@ -454,7 +457,7 @@ int CFFI::functionWrapper(Node *n) {
|
|||
Printf(f->code, "}\n");
|
||||
|
||||
if (CPlusPlus)
|
||||
Wrapper_print(f, f_cxx);
|
||||
Wrapper_print(f, f_runtime);
|
||||
|
||||
if (CPlusPlus) {
|
||||
emit_defun(n, wname);
|
||||
|
|
|
|||
|
|
@ -215,7 +215,6 @@ int CHICKEN::top(Node *n) {
|
|||
clos_methods = NewString("");
|
||||
scm_const_defs = NewString("");
|
||||
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "/* Implementation : CHICKEN */\n\n");
|
||||
|
|
@ -256,9 +255,9 @@ int CHICKEN::top(Node *n) {
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Printv(f_scm,
|
||||
";; -*- buffer-read-only: t -*- vi: set ro:\n",
|
||||
";; This file was created automatically by SWIG.\n", ";; Don't modify this file, modify the SWIG interface instead.\n", NIL);
|
||||
Swig_banner_target_lang(f_scm, ";;");
|
||||
Printf(f_scm, "\n");
|
||||
|
||||
if (declare_unit)
|
||||
Printv(f_scm, "(declare (unit ", scmmodule, "))\n\n", NIL);
|
||||
Printv(f_scm, "(declare \n",
|
||||
|
|
|
|||
|
|
@ -89,10 +89,11 @@ int CLISP::top(Node *n) {
|
|||
Swig_register_filebyname("runtime", f_null);
|
||||
Swig_register_filebyname("wrapper", f_null);
|
||||
|
||||
String *header =
|
||||
NewStringf
|
||||
(";; This is an automatically generated file. \n;;Make changes as you feel are necessary (but remember if you try to regenerate this file, your changes will be lost). \n\n(defpackage :%s\n (:use :common-lisp :ffi)",
|
||||
module);
|
||||
String *header = NewString("");
|
||||
|
||||
Swig_banner_target_lang(header, ";;");
|
||||
|
||||
Printf(header, "\n(defpackage :%s\n (:use :common-lisp :ffi)", module);
|
||||
|
||||
Language::top(n);
|
||||
|
||||
|
|
|
|||
|
|
@ -601,11 +601,7 @@ public:
|
|||
|
||||
void emitBanner(File *f) {
|
||||
Printf(f, "/* ----------------------------------------------------------------------------\n");
|
||||
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f, " * Version %s\n", Swig_package_version());
|
||||
Printf(f, " *\n");
|
||||
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
|
||||
Printf(f, " * the SWIG interface file instead.\n");
|
||||
Swig_banner_target_lang(f, " *");
|
||||
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -322,7 +322,6 @@ public:
|
|||
goopscode = NewString("");
|
||||
goopsexport = NewString("");
|
||||
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "/* Implementation : GUILE */\n\n");
|
||||
|
|
@ -506,8 +505,8 @@ public:
|
|||
}
|
||||
Delete(fname);
|
||||
|
||||
Printf(scmstubfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Printf(scmstubfile, ";;; Automatically generated by SWIG; do not edit.\n\n");
|
||||
Swig_banner_target_lang(scmstubfile, ";;;");
|
||||
Printf(scmstubfile, "\n");
|
||||
if (linkage == GUILE_LSTYLE_SIMPLE || linkage == GUILE_LSTYLE_PASSIVE)
|
||||
Printf(scmstubfile, "(define-module (%s))\n\n", mod);
|
||||
Delete(mod);
|
||||
|
|
@ -536,8 +535,8 @@ public:
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Delete(fname);
|
||||
Printf(goopsfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Printf(goopsfile, ";;; Automatically generated by SWIG; do not edit.\n\n");
|
||||
Swig_banner_target_lang(goopsfile, ";;;");
|
||||
Printf(goopsfile, "\n");
|
||||
Printf(goopsfile, "(define-module (%s))\n", mod);
|
||||
Printf(goopsfile, "%s\n", goopstext);
|
||||
Printf(goopsfile, "(use-modules (oop goops) (Swig common))\n");
|
||||
|
|
|
|||
|
|
@ -673,11 +673,7 @@ public:
|
|||
|
||||
void emitBanner(File *f) {
|
||||
Printf(f, "/* ----------------------------------------------------------------------------\n");
|
||||
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f, " * Version %s\n", Swig_package_version());
|
||||
Printf(f, " *\n");
|
||||
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
|
||||
Printf(f, " * the SWIG interface file instead.\n");
|
||||
Swig_banner_target_lang(f, " *");
|
||||
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1159,14 +1159,9 @@ MODULA3():
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void emitBanner(File *f) {
|
||||
Printf(f, "\
|
||||
(*******************************************************************************\n\
|
||||
* This file was automatically generated by SWIG (http://www.swig.org/).\n\
|
||||
* Version %s\n\
|
||||
*\n\
|
||||
* Do not make changes to this file unless you know what you are doing --\n\
|
||||
* modify the SWIG interface file instead.\n\
|
||||
*******************************************************************************)\n\n", Swig_package_version());
|
||||
Printf(f, "(*******************************************************************************\n");
|
||||
Swig_banner_target_lang(f, " *");
|
||||
Printf(f, "*******************************************************************************)\n\n");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ public:
|
|||
init_func_def = NewString("");
|
||||
Swig_register_filebyname("init", init_func_def);
|
||||
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
module = Getattr(n, "name");
|
||||
|
|
|
|||
|
|
@ -262,7 +262,8 @@ public:
|
|||
Swig_name_register("get", "%v__get__");
|
||||
}
|
||||
|
||||
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "#define SWIG_MODULE \"%s\"\n", module);
|
||||
/* Module name */
|
||||
Printf(f_mlbody, "let module_name = \"%s\"\n", module);
|
||||
|
|
@ -276,8 +277,6 @@ public:
|
|||
|
||||
Printf(f_int_to_enum, "let int_to_enum x y =\n" " match (x : c_enum_type) with\n" " `unknown -> C_enum (`Int y)\n");
|
||||
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
if (directorsEnabled()) {
|
||||
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,9 @@ public:
|
|||
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
|
||||
Swig_register_filebyname("director", f_directors);
|
||||
Swig_register_filebyname("director_h", f_directors_h);
|
||||
|
||||
Swig_banner(f_runtime);
|
||||
|
||||
Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module);
|
||||
Printf(f_runtime, "#define SWIG_name %s\n", module);
|
||||
|
||||
|
|
|
|||
|
|
@ -332,10 +332,7 @@ public:
|
|||
Delete(boot_name);
|
||||
}
|
||||
|
||||
Printf(f_pm, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f_pm, "# Version %s\n", Swig_package_version());
|
||||
Printf(f_pm, "#\n");
|
||||
Printf(f_pm, "# Don't modify this file, modify the SWIG interface instead.\n");
|
||||
Swig_banner_target_lang(f_pm, "#");
|
||||
Printf(f_pm, "\n");
|
||||
|
||||
Printf(f_pm, "package %s;\n", module);
|
||||
|
|
|
|||
|
|
@ -676,10 +676,7 @@ public:
|
|||
Swig_register_filebyname("shadow", f_shadow);
|
||||
Swig_register_filebyname("python", f_shadow);
|
||||
|
||||
Printf(f_shadow, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f_shadow, "# Version %s\n", Swig_package_version());
|
||||
Printf(f_shadow, "#\n");
|
||||
Printf(f_shadow, "# Don't modify this file, modify the SWIG interface instead.\n");
|
||||
Swig_banner_target_lang(f_shadow, "#");
|
||||
|
||||
if (!modern) {
|
||||
Printv(f_shadow, "# This file is compatible with both classic and new-style classes.\n", NIL);
|
||||
|
|
|
|||
|
|
@ -819,8 +819,7 @@ int R::top(Node *n) {
|
|||
|
||||
Swig_register_filebyname("sclasses", s_classes);
|
||||
|
||||
|
||||
Printf(s_init, "# This is an automatically generated file by the R module for SWIG.\n\n");
|
||||
Swig_banner_target_lang(s_init, "#");
|
||||
outputCommandLineArguments(s_init);
|
||||
|
||||
Printf(f_wrapper, "#ifdef __cplusplus\n");
|
||||
|
|
@ -2659,7 +2658,7 @@ int R::outputCommandLineArguments(File *out)
|
|||
if(Argc < 1 || !Argv || !Argv[0])
|
||||
return(-1);
|
||||
|
||||
Printf(out, "## Generated via the command line invocation:\n##\t");
|
||||
Printf(out, "\n## Generated via the command line invocation:\n##\t");
|
||||
for(int i = 0; i < Argc ; i++) {
|
||||
Printf(out, " %s", Argv[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ public:
|
|||
Swig_register_filebyname("runtime", f_sink);
|
||||
Swig_register_filebyname("init", f_sink);
|
||||
|
||||
Swig_banner_target_lang(out, ";;;");
|
||||
|
||||
Language::top(n);
|
||||
Printf(out, "\n");
|
||||
Printf(out, ";;; Lisp parse tree produced by SWIG\n");
|
||||
print_circle_hash = DohNewHash();
|
||||
print_circle_count = 0;
|
||||
|
|
|
|||
|
|
@ -186,10 +186,7 @@ public:
|
|||
Swig_register_filebyname("shadow", f_shadow);
|
||||
Swig_register_filebyname("itcl", f_shadow);
|
||||
|
||||
Printf(f_shadow, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
|
||||
Printf(f_shadow, "# Version %s\n", Swig_package_version());
|
||||
Printf(f_shadow, "#\n");
|
||||
Printf(f_shadow, "# Don't modify this file, modify the SWIG interface instead.\n");
|
||||
Swig_banner_target_lang(f_shadow, "#");
|
||||
|
||||
Printv(f_shadow, "\npackage require Itcl\n\n", NIL);
|
||||
Delete(filen);
|
||||
|
|
|
|||
|
|
@ -239,8 +239,10 @@ int UFFI::top(Node *n) {
|
|||
Swig_register_filebyname("runtime", f_null);
|
||||
Swig_register_filebyname("wrapper", f_cl);
|
||||
|
||||
Printf(f_cl,
|
||||
";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n;; This is an automatically generated file. Make changes in\n;; the definition file, not here.\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n",
|
||||
Swig_banner_target_lang(f_cl, ";;");
|
||||
|
||||
Printf(f_cl, "\n"
|
||||
";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n",
|
||||
module, module, module);
|
||||
Printf(f_cl, "(eval-when (compile load eval)\n (defparameter *swig-identifier-converter* '%s))\n", identifier_converter);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue