wrap by contract work
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4809 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6cdd4ee644
commit
0ad9c70442
4 changed files with 90 additions and 97 deletions
|
|
@ -1,14 +1,14 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* contract.cxx
|
* contract.cxx
|
||||||
*
|
*
|
||||||
* Support for Design by Contract in SWIG
|
* Support for Wrap by Contract in SWIG
|
||||||
*
|
*
|
||||||
* Author(s) : Songyan Feng (Tiger) (songyanf@cs.uchicago.edu)
|
* Author(s) : Songyan Feng (Tiger) (songyanf@cs.uchicago.edu)
|
||||||
*
|
*
|
||||||
* Department of Computer Science
|
* Department of Computer Science
|
||||||
* University of Chicago
|
* University of Chicago
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2000. The University of Chicago
|
* Copyright (C) 1999-2003. The University of Chicago
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -16,17 +16,27 @@ char cvsroot_contract_cxx[] = "$Header$";
|
||||||
|
|
||||||
#include "swigmod.h"
|
#include "swigmod.h"
|
||||||
|
|
||||||
#define SWIG_PREASSERT "require:"
|
#define SWIG_PREASSERT "require:"
|
||||||
#define SWIG_POSTASSERT "ensure:"
|
#define SWIG_POSTASSERT "ensure:"
|
||||||
#define SWIG_INVARIANT "invariant:"
|
#define SWIG_INVARIANT "invariant:"
|
||||||
#define SWIG_BEFORE "swig_before("
|
#define SWIG_BEFORE "swig_before("
|
||||||
#define SWIG_AFTER "swig_after("
|
#define SWIG_AFTER "swig_after("
|
||||||
|
|
||||||
|
static int Contract_Mode = 0; /* contract option */
|
||||||
|
|
||||||
static int InClass = 0; /* Parsing C++ or not */
|
static int InClass = 0; /* Parsing C++ or not */
|
||||||
static Node *CurrentClass = 0;
|
static Node *CurrentClass = 0;
|
||||||
static int InConstructor = 0;
|
static int InConstructor = 0;
|
||||||
static int InDestructor = 0;
|
static int InDestructor = 0;
|
||||||
|
|
||||||
|
void Swig_contract_mode_set(int flag) {
|
||||||
|
Contract_Mode = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Swig_contract_mode_get() {
|
||||||
|
return Contract_Mode;
|
||||||
|
}
|
||||||
|
|
||||||
class Contracts : public Dispatcher {
|
class Contracts : public Dispatcher {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -45,24 +55,24 @@ public:
|
||||||
int len_post = Len(SWIG_POSTASSERT);
|
int len_post = Len(SWIG_POSTASSERT);
|
||||||
int len_invar = Len(SWIG_INVARIANT);
|
int len_invar = Len(SWIG_INVARIANT);
|
||||||
|
|
||||||
if (!mark_invar) { // No invar-
|
if (!mark_invar) { /* No invar- */
|
||||||
if (!mark_post) { // No post-
|
if (!mark_post) { /* No post- */
|
||||||
if ( !mark_pre ) { // No pre-, default is preassert
|
if ( !mark_pre ) { /* No pre-, default is preassert */
|
||||||
preassert = contract;
|
preassert = contract;
|
||||||
} else { // with pre- only
|
} else { /* with pre- only */
|
||||||
mark_pre[len_pre-1]='{';
|
mark_pre[len_pre-1]='{';
|
||||||
mark_pre[len_pre]='\n';
|
mark_pre[len_pre]='\n';
|
||||||
preassert = mark_pre+len_pre-1;
|
preassert = mark_pre+len_pre-1;
|
||||||
}
|
}
|
||||||
} else { // with post-
|
} else { /* with post- */
|
||||||
if (!mark_pre) { // with post- only, but maybe has preassert
|
if (!mark_pre) { /* with post- only, but maybe has preassert */
|
||||||
preassert = contract;
|
preassert = contract;
|
||||||
mark_post[0] = '}';
|
mark_post[0] = '}';
|
||||||
mark_post[1] = '\0';
|
mark_post[1] = '\0';
|
||||||
mark_post[len_post-2] = '{';
|
mark_post[len_post-2] = '{';
|
||||||
mark_post[len_post-1] = '\n';
|
mark_post[len_post-1] = '\n';
|
||||||
postassert = mark_post+len_post-2;
|
postassert = mark_post+len_post-2;
|
||||||
} else { //with both pre- & post- marks
|
} else { /* with both pre- & post- marks */
|
||||||
mark_pre[len_pre-1]='{';
|
mark_pre[len_pre-1]='{';
|
||||||
mark_pre[len_pre]='\n';
|
mark_pre[len_pre]='\n';
|
||||||
preassert = mark_pre+len_pre-1;
|
preassert = mark_pre+len_pre-1;
|
||||||
|
|
@ -73,16 +83,16 @@ public:
|
||||||
postassert = mark_post+len_post-2;
|
postassert = mark_post+len_post-2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { //with invar-mark
|
} else { /* with invar-mark */
|
||||||
if (!mark_post) { // No post- mark
|
if (!mark_post) { /* No post- mark */
|
||||||
if ( !mark_pre ) { // with invar- only, but maybe has pre-
|
if ( !mark_pre ) { /* with invar- only, but maybe has pre- */
|
||||||
preassert = contract;
|
preassert = contract;
|
||||||
mark_invar[0] = '}';
|
mark_invar[0] = '}';
|
||||||
mark_invar[1] = '\0';
|
mark_invar[1] = '\0';
|
||||||
mark_invar[len_invar-2] = '{';
|
mark_invar[len_invar-2] = '{';
|
||||||
mark_invar[len_invar-1] = '\n';
|
mark_invar[len_invar-1] = '\n';
|
||||||
invariant = mark_invar+len_invar-2;
|
invariant = mark_invar+len_invar-2;
|
||||||
} else { // with pre- & invar-, no postassert
|
} else { /* with pre- & invar-, no postassert */
|
||||||
mark_pre[len_pre-1]='{';
|
mark_pre[len_pre-1]='{';
|
||||||
mark_pre[len_pre]='\n';
|
mark_pre[len_pre]='\n';
|
||||||
preassert = mark_pre+len_pre-1;
|
preassert = mark_pre+len_pre-1;
|
||||||
|
|
@ -92,8 +102,8 @@ public:
|
||||||
mark_invar[len_invar-1] = '\n';
|
mark_invar[len_invar-1] = '\n';
|
||||||
invariant = mark_invar+len_invar-2;
|
invariant = mark_invar+len_invar-2;
|
||||||
}
|
}
|
||||||
} else { // with invar- & post-
|
} else { /* with invar- & post- */
|
||||||
if (!mark_pre) { // with post- & invar- only, but maybe has preassert
|
if (!mark_pre) { /* with post- & invar- only, but maybe has preassert */
|
||||||
preassert = contract;
|
preassert = contract;
|
||||||
mark_post[0] = '}';
|
mark_post[0] = '}';
|
||||||
mark_post[1] = '\0';
|
mark_post[1] = '\0';
|
||||||
|
|
@ -105,7 +115,7 @@ public:
|
||||||
mark_invar[len_invar-2] = '{';
|
mark_invar[len_invar-2] = '{';
|
||||||
mark_invar[len_invar-1] = '\n';
|
mark_invar[len_invar-1] = '\n';
|
||||||
invariant = mark_invar+len_invar-2;
|
invariant = mark_invar+len_invar-2;
|
||||||
} else { // with pre-, post- & invar-
|
} else { /* with pre-, post- & invar- */
|
||||||
mark_pre[len_pre-1]='{';
|
mark_pre[len_pre-1]='{';
|
||||||
mark_pre[len_pre]='\n';
|
mark_pre[len_pre]='\n';
|
||||||
preassert = mark_pre+len_pre-1;
|
preassert = mark_pre+len_pre-1;
|
||||||
|
|
@ -135,10 +145,10 @@ public:
|
||||||
List *list_assert;
|
List *list_assert;
|
||||||
ParmList *list_params;
|
ParmList *list_params;
|
||||||
|
|
||||||
if (flag == 1) { // preassert
|
if (flag == 1) { /* preassert */
|
||||||
str_assert = NewString(Getattr(n, "feature:preassert"));
|
str_assert = NewString(Getattr(n, "feature:preassert"));
|
||||||
tag = NewString(" SWIG_preassert(");
|
tag = NewString(" SWIG_preassert(");
|
||||||
} else if (flag == 2){ //postassert
|
} else if (flag == 2){ /* postassert */
|
||||||
str_assert = NewString(Getattr(n, "feature:postassert"));
|
str_assert = NewString(Getattr(n, "feature:postassert"));
|
||||||
tag = NewString(" SWIG_postassert(");
|
tag = NewString(" SWIG_postassert(");
|
||||||
} else if (flag == 3){
|
} else if (flag == 3){
|
||||||
|
|
@ -147,8 +157,8 @@ public:
|
||||||
} else
|
} else
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
|
||||||
// Modify format into { SWIG_xxxassert(...);\n ...}
|
/* Modify format into { SWIG_xxxassert(...);\n ...}
|
||||||
// Omit all unuseful characters and split by ;
|
Omit all unuseful characters and split by ; */
|
||||||
Replaceall(str_assert, "\n", "");
|
Replaceall(str_assert, "\n", "");
|
||||||
Replaceall(str_assert, "{", "");
|
Replaceall(str_assert, "{", "");
|
||||||
Replaceall(str_assert, "}", "");
|
Replaceall(str_assert, "}", "");
|
||||||
|
|
@ -156,12 +166,11 @@ public:
|
||||||
list_assert = Split(str_assert, ';', -1);
|
list_assert = Split(str_assert, ';', -1);
|
||||||
Delete(str_assert);
|
Delete(str_assert);
|
||||||
|
|
||||||
// build up new assertion
|
/* build up new assertion */
|
||||||
str_assert = NewString("{");
|
str_assert = NewString("{");
|
||||||
for (s = Firstitem(list_assert); s; s = Nextitem(list_assert)) {
|
for (s = Firstitem(list_assert); s; s = Nextitem(list_assert)) {
|
||||||
if (Len(s)) {
|
if (Len(s)) {
|
||||||
//Printf(stdout, "%s\n", s);
|
if (Strstr(s, SWIG_BEFORE)) { /* before sync assertion */
|
||||||
if (Strstr(s, SWIG_BEFORE)) { //before sync assertion
|
|
||||||
tag_sync = NewString(" SWIG_sync(");
|
tag_sync = NewString(" SWIG_sync(");
|
||||||
Append(tag_sync, Getattr(n, "name"));
|
Append(tag_sync, Getattr(n, "name"));
|
||||||
Append(tag_sync, ", ");
|
Append(tag_sync, ", ");
|
||||||
|
|
@ -169,7 +178,7 @@ public:
|
||||||
Append(str_assert, s);
|
Append(str_assert, s);
|
||||||
Append(str_assert, ";\n");
|
Append(str_assert, ";\n");
|
||||||
Delete(tag_sync);
|
Delete(tag_sync);
|
||||||
} else if (Strstr(s, SWIG_AFTER)) { //after sync assertion
|
} else if (Strstr(s, SWIG_AFTER)) { /* after sync assertion */
|
||||||
tag_sync = NewString(" SWIG_sync(");
|
tag_sync = NewString(" SWIG_sync(");
|
||||||
Replaceall(s, SWIG_AFTER, tag_sync);
|
Replaceall(s, SWIG_AFTER, tag_sync);
|
||||||
Replaceall(s, ")", ", ");
|
Replaceall(s, ")", ", ");
|
||||||
|
|
@ -177,7 +186,7 @@ public:
|
||||||
Append(str_assert, Getattr(n,"name"));
|
Append(str_assert, Getattr(n,"name"));
|
||||||
Append(str_assert, ");\n");
|
Append(str_assert, ");\n");
|
||||||
Delete(tag_sync);
|
Delete(tag_sync);
|
||||||
} else { // no sync assertion
|
} else { /* no sync assertion */
|
||||||
Append(str_assert, tag);
|
Append(str_assert, tag);
|
||||||
Append(str_assert, s);
|
Append(str_assert, s);
|
||||||
Append(str_assert, ");\n");
|
Append(str_assert, ");\n");
|
||||||
|
|
@ -186,10 +195,10 @@ public:
|
||||||
}
|
}
|
||||||
Append(str_assert, "}");
|
Append(str_assert, "}");
|
||||||
|
|
||||||
// Set the params in preassert & postassert
|
/* Set the params in preassert & postassert */
|
||||||
list_params = Getmeta(Getattr(n, "feature:contract"), "parms");
|
list_params = Getmeta(Getattr(n, "feature:contract"), "parms");
|
||||||
if ((InClass) && (!InConstructor) && (!InDestructor)){
|
if ((InClass) && (!InConstructor) && (!InDestructor)){
|
||||||
// Insert function name as parm for class member functions
|
/* Insert function name as parm for class member functions */
|
||||||
String *type = NewString(Getattr(n,"type"));
|
String *type = NewString(Getattr(n,"type"));
|
||||||
String *name = NewString("self");
|
String *name = NewString("self");
|
||||||
Parm *p = NewParm(type, name);
|
Parm *p = NewParm(type, name);
|
||||||
|
|
@ -219,44 +228,20 @@ public:
|
||||||
int ret = SWIG_OK;
|
int ret = SWIG_OK;
|
||||||
if (!Getattr(n, "feature:contract"))
|
if (!Getattr(n, "feature:contract"))
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
//Printf(stdout, "--------In emit_contract code:\nname is : %s\n",
|
/*Printf(stdout, "--------In emit_contract code:\nname is : %s\n",
|
||||||
// Getattr(n,"name"));
|
Getattr(n,"name")); */
|
||||||
// Split contract into preassert & postassert
|
|
||||||
|
/* Split contracqt into preassert & postassert */
|
||||||
if (!SliptContract(n))
|
if (!SliptContract(n))
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
|
||||||
// Modify pre- , post- * invar-
|
/* Modify pre- , post- * invar- */
|
||||||
ret = AssertModify(n, 1);
|
ret = AssertModify(n, 1);
|
||||||
ret = AssertModify(n, 2);
|
ret = AssertModify(n, 2);
|
||||||
ret = AssertModify(n, 3);
|
ret = AssertModify(n, 3);
|
||||||
/*
|
|
||||||
Printf(stdout, "preassert after Setmeta :\n%s\n",
|
|
||||||
Getattr(n, "feature:preassert"));
|
|
||||||
Printf(stdout, "postassert after Setmeta :\n%s\n",
|
|
||||||
Getattr(n, "feature:postassert"));
|
|
||||||
Printf(stdout, "invariant after Setmeta :\n%s\n",
|
|
||||||
Getattr(n, "feature:invariant"));
|
|
||||||
*/
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
virtual int emit_one(Node *n) {
|
|
||||||
int ret = SWIG_OK;
|
|
||||||
char *tag = Char(nodeType(n));
|
|
||||||
|
|
||||||
if (!n) return SWIG_OK;
|
|
||||||
|
|
||||||
if (strcmp(tag,"include") == 0)
|
|
||||||
ret = emit_children(n);
|
|
||||||
else if (strcmp(tag, "top") == 0)
|
|
||||||
ret = top(n);
|
|
||||||
else if (Getattr(n, "feature:contract")) {
|
|
||||||
ret = emit_contract(n);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
int cDeclaration(Node *n) {
|
int cDeclaration(Node *n) {
|
||||||
int ret = SWIG_OK;
|
int ret = SWIG_OK;
|
||||||
if (Getattr(n, "feature:contract"))
|
if (Getattr(n, "feature:contract"))
|
||||||
|
|
@ -286,6 +271,7 @@ public:
|
||||||
int extendDirective(Node *n) { return emit_children(n); }
|
int extendDirective(Node *n) { return emit_children(n); }
|
||||||
int importDirective(Node *n) { return emit_children(n); }
|
int importDirective(Node *n) { return emit_children(n); }
|
||||||
int includeDirective(Node *n) { return emit_children(n); }
|
int includeDirective(Node *n) { return emit_children(n); }
|
||||||
|
|
||||||
int classDeclaration(Node *n) {
|
int classDeclaration(Node *n) {
|
||||||
int ret = SWIG_OK;
|
int ret = SWIG_OK;
|
||||||
InClass = 1;
|
InClass = 1;
|
||||||
|
|
@ -295,6 +281,7 @@ public:
|
||||||
CurrentClass = 0;
|
CurrentClass = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int classHandler(Node *n) {
|
int classHandler(Node *n) {
|
||||||
emit_children(n);
|
emit_children(n);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,6 @@ void replace_args(Parm *p, String *s) {
|
||||||
/* replace_contract_args. This function replaces argument names in contract
|
/* replace_contract_args. This function replaces argument names in contract
|
||||||
specifications. Used in conjunction with the %contract directive. */
|
specifications. Used in conjunction with the %contract directive. */
|
||||||
|
|
||||||
//replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
|
||||||
static
|
static
|
||||||
void replace_contract_args(Parm *cp, Parm *rp, String *s) {
|
void replace_contract_args(Parm *cp, Parm *rp, String *s) {
|
||||||
while (cp && rp) {
|
while (cp && rp) {
|
||||||
|
|
@ -426,23 +425,25 @@ void emit_action(Node *n, Wrapper *f) {
|
||||||
|
|
||||||
rt = Getattr(n,"type");
|
rt = Getattr(n,"type");
|
||||||
|
|
||||||
/* Preassert -- EXPERIMENTAL */
|
/* Emit contract code (if any) */
|
||||||
tm = Getattr(n,"feature:preassert");
|
if (Swig_contract_mode_get()) {
|
||||||
if (tm) {
|
/* Preassertion */
|
||||||
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
tm = Getattr(n,"feature:preassert");
|
||||||
/* Printf(stdout, "name: %s, preassert: %s\n", Getattr(n,"name"), tm); */
|
if (tm) {
|
||||||
Printv(f->code,tm,"\n",NIL);
|
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
||||||
}
|
/* Printf(stdout, "name: %s, preassert: %s\n", Getattr(n,"name"), tm); */
|
||||||
|
Printv(f->code,tm,"\n",NIL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Invariant -- EXPERIMENTAL */
|
/* Invariant -- EXPERIMENTAL */
|
||||||
tm = Getattr(n,"feature:invariant");
|
tm = Getattr(n,"feature:invariant");
|
||||||
if (tm) {
|
if (tm) {
|
||||||
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
||||||
Replaceid(tm, "SWIG_invariant", "SWIG_invariant_begin");
|
Replaceid(tm, "SWIG_invariant", "SWIG_invariant_begin");
|
||||||
/* Printf(stdout, "name: %s, invarassert: %s\n", Getattr(n,"name"), tm); */
|
/* Printf(stdout, "name: %s, invarassert: %s\n", Getattr(n,"name"), tm); */
|
||||||
Printv(f->code,tm,"\n",NIL);
|
Printv(f->code,tm,"\n",NIL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exception handling code */
|
/* Exception handling code */
|
||||||
|
|
||||||
/* If we are in C++ mode and there is a throw specifier. We're going to
|
/* If we are in C++ mode and there is a throw specifier. We're going to
|
||||||
|
|
@ -487,21 +488,22 @@ void emit_action(Node *n, Wrapper *f) {
|
||||||
Printf(f->code,"catch(...) { throw; }\n");
|
Printf(f->code,"catch(...) { throw; }\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invariant -- EXPERIMENTAL */
|
/* Emit contract code (if any) */
|
||||||
tm = Getattr(n,"feature:invariant");
|
if (Swig_contract_mode_get()) {
|
||||||
if (tm) {
|
/* Invariant -- EXPERIMENTAL */
|
||||||
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
tm = Getattr(n,"feature:invariant");
|
||||||
Replaceid(tm, "SWIG_invariant", "SWIG_invariant_end");
|
if (tm) {
|
||||||
/* Printf(stdout, "name: %s, invarassert: %s\n", Getattr(n,"name"), tm); */
|
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
||||||
Printv(f->code,tm,"\n",NIL);
|
Replaceid(tm, "SWIG_invariant", "SWIG_invariant_end");
|
||||||
}
|
/* Printf(stdout, "name: %s, invarassert: %s\n", Getattr(n,"name"), tm); */
|
||||||
/* Postassert - EXPERIMENTAL */
|
Printv(f->code,tm,"\n",NIL);
|
||||||
tm = Getattr(n,"feature:postassert");
|
}
|
||||||
if (tm) {
|
/* Postassertion - EXPERIMENTAL */
|
||||||
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
tm = Getattr(n,"feature:postassert");
|
||||||
/* Printf(stdout, "name: %s, postassert: %s\n", Getattr(n,"name"), tm); */
|
if (tm) {
|
||||||
Printv(f->code,tm,"\n",NIL);
|
replace_contract_args(Getmeta(tm,"parms"), Getattr(n,"parms"),tm);
|
||||||
|
/* Printf(stdout, "name: %s, postassert: %s\n", Getattr(n,"name"), tm); */
|
||||||
|
Printv(f->code,tm,"\n",NIL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
extern int check_suffix(char *);
|
extern int check_suffix(char *);
|
||||||
int dump_tags = 0;
|
int dump_tags = 0;
|
||||||
int dump_tree = 0;
|
int dump_tree = 0;
|
||||||
int contracts = 0;
|
|
||||||
int browse = 0;
|
int browse = 0;
|
||||||
int dump_typedef = 0;
|
int dump_typedef = 0;
|
||||||
int dump_classes = 0;
|
int dump_classes = 0;
|
||||||
|
|
@ -194,6 +193,8 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
DOH *libfiles = 0;
|
DOH *libfiles = 0;
|
||||||
DOH *cpps = 0 ;
|
DOH *cpps = 0 ;
|
||||||
extern void Swig_contracts(Node *n);
|
extern void Swig_contracts(Node *n);
|
||||||
|
extern void Swig_contract_mode_set(int flag);
|
||||||
|
extern int Swig_contract_mode_get();
|
||||||
extern void Swig_browser(Node *n, int);
|
extern void Swig_browser(Node *n, int);
|
||||||
extern void Swig_default_allocators(Node *n);
|
extern void Swig_default_allocators(Node *n);
|
||||||
extern void Swig_process_types(Node *n);
|
extern void Swig_process_types(Node *n);
|
||||||
|
|
@ -418,7 +419,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
} else if (strcmp(argv[i],"-contracts") == 0) {
|
} else if (strcmp(argv[i],"-contracts") == 0) {
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
contracts = 1;
|
Swig_contract_mode_set(1);
|
||||||
} else if (strcmp(argv[i],"-browse") == 0) {
|
} else if (strcmp(argv[i],"-browse") == 0) {
|
||||||
browse = 1;
|
browse = 1;
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
|
|
@ -644,7 +645,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
Setattr(top,"outfile_h", NewStringf("%s.h", header));
|
Setattr(top,"outfile_h", NewStringf("%s.h", header));
|
||||||
free(header);
|
free(header);
|
||||||
}
|
}
|
||||||
if (contracts) {
|
if (Swig_contract_mode_get()) {
|
||||||
Swig_contracts(top);
|
Swig_contracts(top);
|
||||||
}
|
}
|
||||||
lang->top(top);
|
lang->top(top);
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,9 @@ 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 *);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue