Skip to content

Commit 7ba0652

Browse files
committed
Create director_common.swg for language-indep code
Move -DSWIG_DIRECTOR_STATIC handling there, so this is now supported for all languages with director support, not just Python and PHP.
1 parent c4268c3 commit 7ba0652

File tree

13 files changed

+30
-20
lines changed

13 files changed

+30
-20
lines changed

CHANGES.current

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
55
Version 3.0.6 (in progress)
66
===========================
77

8+
2015-03-12: olly
9+
-DSWIG_DIRECTOR_STATIC is now supported for all languages with
10+
director support, not only Python and PHP.
11+
812
2015-03-02: ianlancetaylor
913
[Go] Add -cgo option, required for Go versions 1.5 and
1014
later.

Lib/director_common.swg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* -----------------------------------------------------------------------------
2+
* director_common.swg
3+
*
4+
* This file contains support for director classes which is common between
5+
* languages.
6+
* ----------------------------------------------------------------------------- */
7+
8+
/*
9+
Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
10+
'Swig' namespace. This could be useful for multi-modules projects.
11+
*/
12+
#ifdef SWIG_DIRECTOR_STATIC
13+
/* Force anonymous (static) namespace */
14+
#define Swig
15+
#endif

Lib/php/director.swg

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212
#include <exception>
1313
#include <map>
1414

15-
/*
16-
Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
17-
'Swig' namespace. This could be useful for multi-modules projects.
18-
*/
19-
#ifdef SWIG_DIRECTOR_STATIC
20-
/* Force anonymous (static) namespace */
21-
#define Swig
22-
#endif
23-
2415
namespace Swig {
2516

2617
/* memory handler */

Lib/python/director.swg

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@
4040
#endif
4141

4242

43-
/*
44-
Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
45-
'Swig' namespace. This could be useful for multi-modules projects.
46-
*/
47-
#ifdef SWIG_DIRECTOR_STATIC
48-
/* Force anonymous (static) namespace */
49-
#define Swig
50-
#endif
51-
52-
5343
/*
5444
Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the
5545
native C++ RTTI and dynamic_cast<>. But be aware that directors

Source/Modules/csharp.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ class CSHARP:public Language {
418418

419419
if (directorsEnabled()) {
420420
// Insert director runtime into the f_runtime file (make it occur before %header section)
421+
Swig_insert_file("director_common.swg", f_runtime);
421422
Swig_insert_file("director.swg", f_runtime);
422423
}
423424
// Generate the intermediary class

Source/Modules/d.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ class D : public Language {
508508

509509
if (directorsEnabled()) {
510510
// Insert director runtime into the f_runtime file (before %header section).
511+
Swig_insert_file("director_common.swg", f_runtime);
511512
Swig_insert_file("director.swg", f_runtime);
512513
}
513514

Source/Modules/java.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ class JAVA:public Language {
481481

482482
if (directorsEnabled()) {
483483
// Insert director runtime into the f_runtime file (make it occur before %header section)
484+
Swig_insert_file("director_common.swg", f_runtime);
484485
Swig_insert_file("director.swg", f_runtime);
485486
}
486487
// Generate the intermediary class

Source/Modules/ocaml.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ class OCAML:public Language {
325325

326326
if (directorsEnabled()) {
327327
// Insert director runtime into the f_runtime file (make it occur before %header section)
328+
Swig_insert_file("director_common.swg", f_runtime);
328329
Swig_insert_file("director.swg", f_runtime);
329330
}
330331

Source/Modules/octave.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ class OCTAVE:public Language {
228228
if (Len(docs))
229229
emit_doc_texinfo();
230230

231-
if (directorsEnabled())
231+
if (directorsEnabled()) {
232+
Swig_insert_file("director_common.swg", f_runtime);
232233
Swig_insert_file("director.swg", f_runtime);
234+
}
233235

234236
Printf(f_init, "return true;\n}\n");
235237
Printf(s_global_tab, "{0,0,0,0,0}\n};\n");

Source/Modules/perl5.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ class PERL5:public Language {
470470

471471
if (directorsEnabled()) {
472472
// Insert director runtime into the f_runtime file (make it occur before %header section)
473+
Swig_insert_file("director_common.swg", f_runtime);
473474
Swig_insert_file("director.swg", f_runtime);
474475
}
475476

0 commit comments

Comments
 (0)