CHANGES.current

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6269 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-09-26 01:14:49 +00:00
commit 15a5e3976f
15 changed files with 113 additions and 35 deletions

View file

@ -1,6 +1,55 @@
Version 1.3.23 (in progress) Version 1.3.23 (in progress)
================================== ==================================
09/26/2004: mmatus
- add %feature("exceptionclass") to identify a class used
as exception. Before swig identified and marked a class
using the "cplus:exceptionclass" attribute. However, the
class needed to appear on an throw() statement. Now
swig keeps trying to identify the exception classes, as
before, but it also allows the user to mark a class by
using the %feature explicitly. (mostly relevant for
python and chicken)
[Python]
- fix -modern option + exceptions, which mix old class
style with the new one. So, we always need to emit
the "nonmodern" python code.
- add the "python:nondynamic" feature and its handler
now if you have
%pythonnondynamic(1) A;
struct A {
int a;
int b;
};
then, in the python side
aa = A()
aa.a = 1 # ok
aa.b = 2 # ok
aa.c = 3 # error, the class can not be extended dynamically.
Since this is a feature, you can use
%pythonnondynamic(1);
or
%pythondynamic(0);
to force all the wrapped classes to be "nondynamic" ones.
The default, as in regular python, is that all the wrapped
classes are dynamics. So, careful with your spelling.
09/14/2004: mmatus 09/14/2004: mmatus
- Support the -I- option. - Support the -I- option.

View file

@ -2,7 +2,7 @@
This test case tests that various types of arrays are working. This test case tests that various types of arrays are working.
*/ */
#pragma SWIG nowarn=451,462 %warnfilter(451,462);
%module arrays_global %module arrays_global

View file

@ -3,7 +3,7 @@
#include <istream> #include <istream>
%} %}
#pragma SWIG nowarn=-503 %warnfilter(503);
%inline %inline

View file

@ -10,7 +10,7 @@
*/ */
/* activate all the name warnings */ /* activate all the name warnings */
#pragma SWIG nowarn=+315,+321,-403 %warnfilter(+315,+321,-403);
%inline %inline
{ {

View file

@ -1,5 +1,8 @@
%module namespace_virtual_method %module namespace_virtual_method
%warnfilter(515);
%inline %{ %inline %{
namespace A { namespace A {

View file

@ -82,9 +82,9 @@
// Try your language module with and without // Try your language module with and without
// these nowarn flags. // these nowarn flags.
// //
#pragma SWIG nowarn=451 %warnfilter(451);
//#pragma SWIG nowarn=515 //%warnfilter(515);
//#pragma SWIG nowarn=509 //%warnfilter(509);
%{ %{
#include <stddef.h> #include <stddef.h>

View file

@ -3,7 +3,7 @@
%warnfilter(801) agua; %warnfilter(801) agua;
/* no redundant warnings */ /* no redundant warnings */
#pragma SWIG nowarn=-322 %warnfilter(322);
#if 1 #if 1
// //

View file

@ -1,6 +1,7 @@
%module refcount %module refcount
#pragma SWIG nowarn=362 #warnfilter(362);
%{ %{
#include <iostream> #include <iostream>
#include "refcount.h" #include "refcount.h"

View file

@ -2,7 +2,7 @@
%warnfilter(801) traits<double, double>; /* Ruby, wrong class name */ %warnfilter(801) traits<double, double>; /* Ruby, wrong class name */
#pragma SWIG nowarn=320 %warnfilter(320);
%inline %{ %inline %{
template <class ArgType, class ResType> template <class ArgType, class ResType>

View file

@ -4,7 +4,7 @@
%warnfilter(801) vector<int>; /* Ruby, wrong class name */ %warnfilter(801) vector<int>; /* Ruby, wrong class name */
%warnfilter(801) vector<double>; /* Ruby, wrong class name */ %warnfilter(801) vector<double>; /* Ruby, wrong class name */
%warnfilter(801) vector<int (*)[10]>; /* Ruby, wrong class name */ %warnfilter(801) vector<int (*)[10]>; /* Ruby, wrong class name */
#pragma SWIG nowarn=320 %warnfilter(320);
/* Let's just grab the original header file here */ /* Let's just grab the original header file here */

View file

@ -2,7 +2,7 @@
%warnfilter(801) traits<Double, Double>; /* Ruby, wrong class name */ %warnfilter(801) traits<Double, Double>; /* Ruby, wrong class name */
#pragma SWIG nowarn=320 %warnfilter(320);
%inline %{ %inline %{
typedef double Double; typedef double Double;

View file

@ -142,7 +142,9 @@ int
DohHashval(const DOH *obj) { DohHashval(const DOH *obj) {
DohBase *b = (DohBase *) obj; DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo; DohObjInfo *objinfo;
if (DohCheck(b)) { /* obj is already checked and/or converted into DohBase* */
/* if (DohCheck(b)) */
{
objinfo = b->type; objinfo = b->type;
if (objinfo->doh_hashval) { if (objinfo->doh_hashval) {
return (objinfo->doh_hashval)(b); return (objinfo->doh_hashval)(b);
@ -173,17 +175,33 @@ DohData(const DOH *obj) {
* DohCmp() * DohCmp()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#define RawData(b) ((b->type->doh_data) ? (b->type->doh_data)(b) : 0)
/*
static void *
RawData(DohBase *b) {
DohObjInfo *objinfo = b->type;
return (objinfo->doh_data) ? (objinfo->doh_data)(b) : 0;
}
*/
int int
DohCmp(const DOH *obj1, const DOH *obj2) { DohCmp(const DOH *obj1, const DOH *obj2) {
DohBase *b1, *b2; DohBase *b1, *b2;
DohObjInfo *b1info, *b2info; DohObjInfo *b1info, *b2info;
int c1, c2;
b1 = (DohBase *) obj1; b1 = (DohBase *) obj1;
b2 = (DohBase *) obj2; b2 = (DohBase *) obj2;
if ((!DohCheck(b1)) || (!DohCheck(b2))) { c1 = DohCheck(b1);
c2 = DohCheck(b2);
/* most of the times, obj2 is a plain c string */
if (!c1 || !c2) {
if ((b1 == 0) && (b2 == 0)) return 0; if ((b1 == 0) && (b2 == 0)) return 0;
if (b1 && !b2) return 1; if (b1 && !b2) return 1;
if (!b1 && b2) return -1; if (!b1 && b2) return -1;
return strcmp((char *) DohData(b1),(char *) DohData(b2)); return strcmp((char *) (c1 ? RawData(b1) : (void*) obj1),
(char *) (c2 ? RawData(b2) : (void*) obj2));
} }
b1info = b1->type; b1info = b1->type;
b2info = b2->type; b2info = b2->type;

View file

@ -249,13 +249,18 @@ static DOH *
Hash_getattr(DOH *ho, DOH *k) { Hash_getattr(DOH *ho, DOH *k) {
int hv; int hv;
HashNode *n; HashNode *n;
DohObjInfo *k_type;
DohBase *nk;
Hash *h = (Hash *) ObjData(ho); Hash *h = (Hash *) ObjData(ho);
if (!DohCheck(k)) k = find_key(k); if (!DohCheck(k)) k = find_key(k);
hv = Hashval(k) % h->hashsize; hv = Hashval(k) % h->hashsize;
n = h->hashtable[hv]; n = h->hashtable[hv];
k_type = ((DohBase*)k)->type;
while (n) { while (n) {
if (Cmp(n->key, k) == 0) return n->object; nk = n->key;
if ((k_type == nk->type) && ((k_type->doh_cmp)(k, nk) == 0)) return n->object;
n = n->next; n = n->next;
} }
return 0; return 0;

View file

@ -27,6 +27,8 @@ typedef struct pool {
int len; /* Length of pool */ int len; /* Length of pool */
int blen; /* Byte length of pool */ int blen; /* Byte length of pool */
int current; /* Current position for next allocation */ int current; /* Current position for next allocation */
char* pbeg; /* Beg of pool */
char* pend; /* End of pool */
struct pool *next; /* Next pool */ struct pool *next; /* Next pool */
} Pool; } Pool;
@ -49,6 +51,8 @@ CreatePool() {
p->len = PoolSize; p->len = PoolSize;
p->blen = PoolSize*sizeof(DohBase); p->blen = PoolSize*sizeof(DohBase);
p->current = 0; p->current = 0;
p->pbeg = ((char *)p->ptr);
p->pend = p->pbeg + p->blen;
p->next = Pools; p->next = Pools;
Pools = p; Pools = p;
} }
@ -74,12 +78,10 @@ InitPools() {
int int
DohCheck(const DOH *ptr) { DohCheck(const DOH *ptr) {
Pool *p = Pools; register Pool *p = Pools;
register char *cptr = (char *) ptr; register char *cptr = (char *) ptr;
register char *pptr;
while (p) { while (p) {
pptr = (char *) p->ptr; if ((cptr >= p->pbeg) && (cptr < p->pend)) return 1;
if ((cptr >= pptr) && (cptr < (pptr + p->blen))) return 1;
/* /*
pptr = (char *) p->ptr; pptr = (char *) p->ptr;
if ((cptr >= pptr) && (cptr < (pptr+(p->current*sizeof(DohBase))))) return 1; */ if ((cptr >= pptr) && (cptr < (pptr+(p->current*sizeof(DohBase))))) return 1; */

View file

@ -111,25 +111,25 @@ String_len(DOH *so) {
static int static int
String_cmp(DOH *so1, DOH *so2) String_cmp(DOH *so1, DOH *so2)
{ {
String *s1, *s2; String * s1 = (String *) ObjData(so1);
char *c1, *c2; String * s2 = (String *) ObjData(so2);
int maxlen,i; register char *c1;
s1 = (String *) ObjData(so1); register char *c2;
s2 = (String *) ObjData(so2); register int len = s1->len;
maxlen = s1->len; if (len != s2->len) return (len < s2->len ) ? -1 : 1;
if (s2->len < maxlen) maxlen = s2->len;
c1 = s1->str; c1 = s1->str;
c2 = s2->str; c2 = s2->str;
for (i = 0; i < maxlen; i++,c1++,c2++) { #if 1
if (*c1 != *c2) break; /* this is better, but it could be not present in all the
systems ? */
return memcmp(c1, c2, len);
#else
/* faster loop with nonzero predicates */
for (; len ; --len,++c1,++c2) {
if (*c1 != *c2) return ((*c1 < *c2) ? -1 : 1);
} }
if (i < maxlen) { return 0;
if (*c1 < *c2) return -1; #endif
else return 1;
}
if (s1->len == s2->len) return 0;
if (s1->len > s2->len) return 1;
return -1;
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------