Removed contract code from swigmod.h. Violates intended modularity of this file.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5186 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2003-10-09 15:57:54 +00:00
commit 62c35e3579
5 changed files with 47 additions and 38 deletions

View file

@ -16,6 +16,41 @@ char cvsroot_contract_cxx[] = "$Header$";
#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_POSTASSERT "ensure:"
#define SWIG_INVARIANT "invariant:"

View file

@ -17,6 +17,7 @@
char cvsroot_emit_cxx[] = "$Header$";
extern SwigType *cplus_value_type(SwigType *t);
extern int Swig_contract_mode_get();
/* -----------------------------------------------------------------------------
* emit_args()
@ -429,6 +430,8 @@ void emit_action(Node *n, Wrapper *f) {
/* Emit contract code (if any) */
if (Swig_contract_mode_get()) {
/* Modify contracts */
/* This code is broken.
Contracts *a = new Contracts;
if (Getattr(n, "feature:contract")) {
a->AssertAddTag(n);
@ -436,7 +439,8 @@ void emit_action(Node *n, Wrapper *f) {
a->AssertSetParms(n);
}
delete a;
*/
/* Preassertion */
tm = Getattr(n, "feature:preassert");
if (Len(tm)) {

View file

@ -200,6 +200,11 @@ extern "C" void Swig_cparse_cplusplus(int);
extern "C" void Swig_cparse_debug_templates(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 i;
char *c;
@ -633,7 +638,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
}
Swig_process_types(top);
if (Verbose) {
Printf(stdout,"C++ analysis...\n");
}
@ -658,6 +662,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
if (dump_typedef) {
SwigType_print_scope(0);
}
if (dump_tags) {
Swig_print_tags(top,0);
}

View file

@ -274,40 +274,6 @@ extern void emit_action(Node *n, Wrapper *f);
extern List *Swig_overload_rank(Node *n);
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" {
typedef Language *(*ModuleFactory)(void);
}

View file

@ -61,7 +61,7 @@ class TypePass : public Dispatcher {
}
qty = SwigType_typedef_qualified(ty);
/* Printf(stdout,"%s --> %s\n", ty, qty);*/
/* Printf(stdout,"%s --> %s\n", ty, qty); */
Clear(ty);
Append(ty,qty);
Delete(qty);
@ -73,7 +73,6 @@ class TypePass : public Dispatcher {
while (p) {
SwigType *ty = Getattr(p,"type");
normalize_type(ty);
/* This is a check for a function type */
{
SwigType *qty = SwigType_typedef_resolve_all(ty);