summaryrefslogtreecommitdiff
path: root/Source/Modules
diff options
context:
space:
mode:
authorDave Beazley <dave-swig@dabeaz.com>2003-10-09 15:57:54 +0000
committerDave Beazley <dave-swig@dabeaz.com>2003-10-09 15:57:54 +0000
commit62c35e3579372e9a98ee54452958c13f2464d006 (patch)
tree1e78ac966b62b8f3b7321fccb6645476369d30c2 /Source/Modules
parent0acef2ac836edf8003bbf0b00b1f63f2a808df5c (diff)
downloadswig-62c35e3579372e9a98ee54452958c13f2464d006.tar.gz
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
Diffstat (limited to 'Source/Modules')
-rw-r--r--Source/Modules/contract.cxx35
-rw-r--r--Source/Modules/emit.cxx6
-rw-r--r--Source/Modules/main.cxx7
-rw-r--r--Source/Modules/swigmod.h34
-rw-r--r--Source/Modules/typepass.cxx3
5 files changed, 47 insertions, 38 deletions
diff --git a/Source/Modules/contract.cxx b/Source/Modules/contract.cxx
index afb60e448..9a2ae8c85 100644
--- a/Source/Modules/contract.cxx
+++ b/Source/Modules/contract.cxx
@@ -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:"
diff --git a/Source/Modules/emit.cxx b/Source/Modules/emit.cxx
index 26c2ffab5..854d6e90f 100644
--- a/Source/Modules/emit.cxx
+++ b/Source/Modules/emit.cxx
@@ -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)) {
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index d1e75667d..fe720f09b 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -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);
}
diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h
index aa7e505b9..6aba6a529 100644
--- a/Source/Modules/swigmod.h
+++ b/Source/Modules/swigmod.h
@@ -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);
}
diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx
index f76cb0858..3c142bc80 100644
--- a/Source/Modules/typepass.cxx
+++ b/Source/Modules/typepass.cxx
@@ -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);