Removed contract code from swigmod.h. Violates intended modularity of this file.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5186 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0959b6f153
commit
52fcd3df75
5 changed files with 47 additions and 38 deletions
|
|
@ -16,6 +16,41 @@ char cvsroot_contract_cxx[] = "$Header$";
|
||||||
|
|
||||||
#include "swigmod.h"
|
#include "swigmod.h"
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* class Contracts:
|
||||||
|
*
|
||||||
|
* This class defines the functions that need to be used in
|
||||||
|
* "wrap by contract" module.
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
class Contracts : public Dispatcher {
|
||||||
|
public:
|
||||||
|
int ContractSplit(Node *n);
|
||||||
|
int AssertModify(Node *n, int flag);
|
||||||
|
int InheritModify(Node *n);
|
||||||
|
int InheritAssertAppend(Node *n, Node *bases);
|
||||||
|
int AssertAddTag(Node *n);
|
||||||
|
int AssertAddErrorMsg(Node *n);
|
||||||
|
int AssertSetParms(Node *n);
|
||||||
|
|
||||||
|
int emit_contract(Node *n);
|
||||||
|
int cDeclaration(Node *n);
|
||||||
|
int constructorDeclaration(Node *n);
|
||||||
|
int destructorDeclaration(Node *n);
|
||||||
|
int externDeclaration(Node *n);
|
||||||
|
int extendDirective(Node *n);
|
||||||
|
int importDirective(Node *n);
|
||||||
|
int includeDirective(Node *n);
|
||||||
|
int classDeclaration(Node *n);
|
||||||
|
int classHandler(Node *n);
|
||||||
|
virtual int top(Node *n);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void Swig_contracts(Node *n);
|
||||||
|
extern void Swig_contract_mode_set(int flag);
|
||||||
|
extern int Swig_contract_mode_get();
|
||||||
|
|
||||||
#define SWIG_PREASSERT "require:"
|
#define SWIG_PREASSERT "require:"
|
||||||
#define SWIG_POSTASSERT "ensure:"
|
#define SWIG_POSTASSERT "ensure:"
|
||||||
#define SWIG_INVARIANT "invariant:"
|
#define SWIG_INVARIANT "invariant:"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
char cvsroot_emit_cxx[] = "$Header$";
|
char cvsroot_emit_cxx[] = "$Header$";
|
||||||
|
|
||||||
extern SwigType *cplus_value_type(SwigType *t);
|
extern SwigType *cplus_value_type(SwigType *t);
|
||||||
|
extern int Swig_contract_mode_get();
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* emit_args()
|
* emit_args()
|
||||||
|
|
@ -429,6 +430,8 @@ void emit_action(Node *n, Wrapper *f) {
|
||||||
/* Emit contract code (if any) */
|
/* Emit contract code (if any) */
|
||||||
if (Swig_contract_mode_get()) {
|
if (Swig_contract_mode_get()) {
|
||||||
/* Modify contracts */
|
/* Modify contracts */
|
||||||
|
|
||||||
|
/* This code is broken.
|
||||||
Contracts *a = new Contracts;
|
Contracts *a = new Contracts;
|
||||||
if (Getattr(n, "feature:contract")) {
|
if (Getattr(n, "feature:contract")) {
|
||||||
a->AssertAddTag(n);
|
a->AssertAddTag(n);
|
||||||
|
|
@ -436,7 +439,8 @@ void emit_action(Node *n, Wrapper *f) {
|
||||||
a->AssertSetParms(n);
|
a->AssertSetParms(n);
|
||||||
}
|
}
|
||||||
delete a;
|
delete a;
|
||||||
|
*/
|
||||||
|
|
||||||
/* Preassertion */
|
/* Preassertion */
|
||||||
tm = Getattr(n, "feature:preassert");
|
tm = Getattr(n, "feature:preassert");
|
||||||
if (Len(tm)) {
|
if (Len(tm)) {
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,11 @@ extern "C" void Swig_cparse_cplusplus(int);
|
||||||
extern "C" void Swig_cparse_debug_templates(int);
|
extern "C" void Swig_cparse_debug_templates(int);
|
||||||
extern void Wrapper_virtual_elimination_mode_set(int);
|
extern void Wrapper_virtual_elimination_mode_set(int);
|
||||||
|
|
||||||
|
|
||||||
|
extern void Swig_contracts(Node *n);
|
||||||
|
extern void Swig_contract_mode_set(int flag);
|
||||||
|
extern int Swig_contract_mode_get();
|
||||||
|
|
||||||
int SWIG_main(int argc, char *argv[], Language *l) {
|
int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
int i;
|
int i;
|
||||||
char *c;
|
char *c;
|
||||||
|
|
@ -633,7 +638,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
}
|
}
|
||||||
Swig_process_types(top);
|
Swig_process_types(top);
|
||||||
|
|
||||||
|
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
Printf(stdout,"C++ analysis...\n");
|
Printf(stdout,"C++ analysis...\n");
|
||||||
}
|
}
|
||||||
|
|
@ -658,6 +662,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
if (dump_typedef) {
|
if (dump_typedef) {
|
||||||
SwigType_print_scope(0);
|
SwigType_print_scope(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dump_tags) {
|
if (dump_tags) {
|
||||||
Swig_print_tags(top,0);
|
Swig_print_tags(top,0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -274,40 +274,6 @@ extern void emit_action(Node *n, Wrapper *f);
|
||||||
extern List *Swig_overload_rank(Node *n);
|
extern List *Swig_overload_rank(Node *n);
|
||||||
extern String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *);
|
extern String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *);
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* class Contracts:
|
|
||||||
*
|
|
||||||
* This class defines the functions that need to be used in
|
|
||||||
* "wrap by contract" module.
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
class Contracts : public Dispatcher {
|
|
||||||
public:
|
|
||||||
int ContractSplit(Node *n);
|
|
||||||
int AssertModify(Node *n, int flag);
|
|
||||||
int InheritModify(Node *n);
|
|
||||||
int InheritAssertAppend(Node *n, Node *bases);
|
|
||||||
int AssertAddTag(Node *n);
|
|
||||||
int AssertAddErrorMsg(Node *n);
|
|
||||||
int AssertSetParms(Node *n);
|
|
||||||
|
|
||||||
int emit_contract(Node *n);
|
|
||||||
int cDeclaration(Node *n);
|
|
||||||
int constructorDeclaration(Node *n);
|
|
||||||
int destructorDeclaration(Node *n);
|
|
||||||
int externDeclaration(Node *n);
|
|
||||||
int extendDirective(Node *n);
|
|
||||||
int importDirective(Node *n);
|
|
||||||
int includeDirective(Node *n);
|
|
||||||
int classDeclaration(Node *n);
|
|
||||||
int classHandler(Node *n);
|
|
||||||
virtual int top(Node *n);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void Swig_contracts(Node *n);
|
|
||||||
extern void Swig_contract_mode_set(int flag);
|
|
||||||
extern int Swig_contract_mode_get();
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
typedef Language *(*ModuleFactory)(void);
|
typedef Language *(*ModuleFactory)(void);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class TypePass : public Dispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
qty = SwigType_typedef_qualified(ty);
|
qty = SwigType_typedef_qualified(ty);
|
||||||
/* Printf(stdout,"%s --> %s\n", ty, qty);*/
|
/* Printf(stdout,"%s --> %s\n", ty, qty); */
|
||||||
Clear(ty);
|
Clear(ty);
|
||||||
Append(ty,qty);
|
Append(ty,qty);
|
||||||
Delete(qty);
|
Delete(qty);
|
||||||
|
|
@ -73,7 +73,6 @@ class TypePass : public Dispatcher {
|
||||||
while (p) {
|
while (p) {
|
||||||
SwigType *ty = Getattr(p,"type");
|
SwigType *ty = Getattr(p,"type");
|
||||||
normalize_type(ty);
|
normalize_type(ty);
|
||||||
|
|
||||||
/* This is a check for a function type */
|
/* This is a check for a function type */
|
||||||
{
|
{
|
||||||
SwigType *qty = SwigType_typedef_resolve_all(ty);
|
SwigType *qty = SwigType_typedef_resolve_all(ty);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue