(method, typelist) special variable macro fixed/enhanced and made official
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11470 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ae606df4df
commit
bf0ee4471c
17 changed files with 532 additions and 161 deletions
|
|
@ -2766,6 +2766,16 @@ public:
|
|||
Delete(func_name);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* replaceSpecialVariables()
|
||||
*--------------------------------------------------------------------*/
|
||||
|
||||
virtual void replaceSpecialVariables(String *method, String *tm, Parm *parm) {
|
||||
(void)method;
|
||||
SwigType *type = Getattr(parm, "type");
|
||||
substituteClassname(type, tm);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* decodeEnumFeature()
|
||||
* Decode the possible enum features, which are one of:
|
||||
|
|
@ -2859,15 +2869,15 @@ public:
|
|||
/* -----------------------------------------------------------------------------
|
||||
* substituteClassname()
|
||||
*
|
||||
* Substitute $csclassname with the proxy class name for classes/structs/unions that SWIG knows about.
|
||||
* Also substitutes enums with enum name.
|
||||
* Substitute the special variable $csclassname with the proxy class name for classes/structs/unions
|
||||
* that SWIG knows about. Also substitutes enums with enum name.
|
||||
* Otherwise use the $descriptor name for the C# class name. Note that the $&csclassname substitution
|
||||
* is the same as a $&descriptor substitution, ie one pointer added to descriptor name.
|
||||
* Inputs:
|
||||
* pt - parameter type
|
||||
* tm - cstype typemap
|
||||
* tm - typemap contents that might contain the special variable to be replaced
|
||||
* Outputs:
|
||||
* tm - cstype typemap with $csclassname substitution
|
||||
* tm - typemap contents complete with the special variable substitution
|
||||
* Return:
|
||||
* substitution_performed - flag indicating if a substitution was performed
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -2603,6 +2603,16 @@ public:
|
|||
Delete(func_name);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* replaceSpecialVariables()
|
||||
*--------------------------------------------------------------------*/
|
||||
|
||||
virtual void replaceSpecialVariables(String *method, String *tm, Parm *parm) {
|
||||
(void)method;
|
||||
SwigType *type = Getattr(parm, "type");
|
||||
substituteClassname(type, tm);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* decodeEnumFeature()
|
||||
* Decode the possible enum features, which are one of:
|
||||
|
|
@ -2700,16 +2710,16 @@ public:
|
|||
/* -----------------------------------------------------------------------------
|
||||
* substituteClassname()
|
||||
*
|
||||
* Substitute $javaclassname with the proxy class name for classes/structs/unions that SWIG knows about.
|
||||
* Also substitutes enums with enum name.
|
||||
* Substitute the special variable $javaclassname with the proxy class name for classes/structs/unions
|
||||
* that SWIG knows about. Also substitutes enums with enum name.
|
||||
* Otherwise use the $descriptor name for the Java class name. Note that the $&javaclassname substitution
|
||||
* is the same as a $&descriptor substitution, ie one pointer added to descriptor name.
|
||||
* Inputs:
|
||||
* pt - parameter type
|
||||
* tm - jstype typemap
|
||||
* tm - typemap contents that might contain the special variable to be replaced
|
||||
* jnidescriptor - if set, inner class names are separated with '$' otherwise a '.'
|
||||
* Outputs:
|
||||
* tm - jstype typemap with $javaclassname substitution
|
||||
* tm - typemap contents complete with the special variable substitution
|
||||
* Return:
|
||||
* substitution_performed - flag indicating if a substitution was performed
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ static int director_mode = 0;
|
|||
static int director_protected_mode = 1;
|
||||
static int all_protected_mode = 0;
|
||||
static int naturalvar_mode = 0;
|
||||
Language* Language::this_ = 0;
|
||||
|
||||
/* Set director_protected_mode */
|
||||
void Wrapper_director_mode_set(int flag) {
|
||||
|
|
@ -46,6 +47,9 @@ extern "C" {
|
|||
int Swig_all_protected_mode() {
|
||||
return all_protected_mode;
|
||||
}
|
||||
void Language_replace_special_variables(String *method, String *tm, Parm *parm) {
|
||||
Language::instance()->replaceSpecialVariables(method, tm, parm);
|
||||
}
|
||||
}
|
||||
|
||||
/* Some status variables used during parsing */
|
||||
|
|
@ -323,6 +327,8 @@ directors(0) {
|
|||
director_prot_ctor_code = 0;
|
||||
director_multiple_inheritance = 1;
|
||||
director_language = 0;
|
||||
assert(!this_);
|
||||
this_ = this;
|
||||
}
|
||||
|
||||
Language::~Language() {
|
||||
|
|
@ -331,6 +337,7 @@ Language::~Language() {
|
|||
Delete(enumtypes);
|
||||
Delete(director_ctor_code);
|
||||
Delete(none_comparison);
|
||||
this_ = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
@ -3423,6 +3430,24 @@ String *Language::defaultExternalRuntimeFilename() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Language::replaceSpecialVariables()
|
||||
* Language modules should implement this if special variables are to be handled
|
||||
* correctly in the $typemap(...) special variable macro.
|
||||
* method - typemap method name
|
||||
* tm - string containing typemap contents
|
||||
* parm - a parameter describing the typemap type to be handled
|
||||
* ----------------------------------------------------------------------------- */
|
||||
void Language::replaceSpecialVariables(String *method, String *tm, Parm *parm) {
|
||||
(void)method;
|
||||
(void)tm;
|
||||
(void)parm;
|
||||
}
|
||||
|
||||
Language *Language::instance() {
|
||||
return this_;
|
||||
}
|
||||
|
||||
Hash *Language::getClassHash() const {
|
||||
return classhash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3581,17 +3581,28 @@ MODULA3():
|
|||
Delete(throws_hash);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* replaceSpecialVariables()
|
||||
*--------------------------------------------------------------------*/
|
||||
|
||||
virtual void replaceSpecialVariables(String *method, String *tm, Parm *parm) {
|
||||
(void)method;
|
||||
SwigType *type = Getattr(parm, "type");
|
||||
substituteClassname(type, tm);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* substituteClassname()
|
||||
*
|
||||
* Substitute $m3classname with the proxy class name for classes/structs/unions that SWIG knows about.
|
||||
* Substitute the special variable $m3classname with the proxy class name for classes/structs/unions
|
||||
* that SWIG knows about.
|
||||
* Otherwise use the $descriptor name for the Modula 3 class name. Note that the $&m3classname substitution
|
||||
* is the same as a $&descriptor substitution, ie one pointer added to descriptor name.
|
||||
* Inputs:
|
||||
* pt - parameter type
|
||||
* tm - m3wraptype typemap
|
||||
* tm - typemap contents that might contain the special variable to be replaced
|
||||
* Outputs:
|
||||
* tm - m3wraptype typemap with $m3classname substitution
|
||||
* tm - typemap contents complete with the special variable substitution
|
||||
* Return:
|
||||
* substitution_performed - flag indicating if a substitution was performed
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ public:
|
|||
virtual int is_assignable(Node *n); /* Is variable assignable? */
|
||||
virtual String *runtimeCode(); /* returns the language specific runtime code */
|
||||
virtual String *defaultExternalRuntimeFilename(); /* the default filename for the external runtime */
|
||||
virtual void replaceSpecialVariables(String *method, String *tm, Parm *parm); /* Language specific special variable substitutions for $typemap() */
|
||||
|
||||
/* Runtime is C++ based, so extern "C" header section */
|
||||
void enable_cplus_runtime_mode();
|
||||
|
|
@ -250,6 +251,9 @@ public:
|
|||
/* Set overload variable templates argc and argv */
|
||||
void setOverloadResolutionTemplates(String *argc, String *argv);
|
||||
|
||||
/* Language instance is a singleton - get instance */
|
||||
static Language* instance();
|
||||
|
||||
protected:
|
||||
/* Allow multiple-input typemaps */
|
||||
void allow_multiple_input(int val = 1);
|
||||
|
|
@ -307,6 +311,7 @@ private:
|
|||
int multiinput;
|
||||
int cplus_runtime;
|
||||
int directors;
|
||||
static Language *this_;
|
||||
};
|
||||
|
||||
int SWIG_main(int, char **, Language *);
|
||||
|
|
@ -347,7 +352,9 @@ void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f);
|
|||
extern "C" {
|
||||
void SWIG_typemap_lang(const char *);
|
||||
typedef Language *(*ModuleFactory) (void);
|
||||
} void Swig_register_module(const char *name, ModuleFactory fac);
|
||||
}
|
||||
|
||||
void Swig_register_module(const char *name, ModuleFactory fac);
|
||||
ModuleFactory Swig_find_module(const char *name);
|
||||
|
||||
/* Utilities */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue