Merge branch 'master' into gsoc2009-matevz
Conflicts: Examples/Makefile.in Examples/guile/Makefile.in Lib/php/php.swg Makefile.in Source/CParse/parser.y configure.ac
This commit is contained in:
commit
bcb7aee022
585 changed files with 9528 additions and 12959 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "swig.h"
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Synopsis
|
||||
|
|
@ -464,61 +465,60 @@ int SwigType_isrvalue_reference(const SwigType *t) {
|
|||
* Repeated qualifications have no effect. Moreover, the order of qualifications
|
||||
* is alphabetical---meaning that "const volatile" and "volatile const" are
|
||||
* stored in exactly the same way as "q(const volatile)".
|
||||
* 'qual' can be a list of multiple qualifiers in any order, separated by spaces.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SwigType *SwigType_add_qualifier(SwigType *t, const_String_or_char_ptr qual) {
|
||||
String *newq;
|
||||
int sz, added = 0;
|
||||
char *q, *cqual;
|
||||
List *qlist;
|
||||
String *allq, *newq;
|
||||
int i, sz;
|
||||
const char *cqprev = 0;
|
||||
const char *c = Char(t);
|
||||
const char *cqual = Char(qual);
|
||||
|
||||
char *c = Char(t);
|
||||
cqual = Char(qual);
|
||||
|
||||
if (!(strncmp(c, "q(", 2) == 0)) {
|
||||
/* if 't' has no qualifiers and 'qual' is a single qualifier, simply add it */
|
||||
if ((strncmp(c, "q(", 2) != 0) && (strstr(cqual, " ") == 0)) {
|
||||
String *temp = NewStringf("q(%s).", cqual);
|
||||
Insert(t, 0, temp);
|
||||
Delete(temp);
|
||||
return t;
|
||||
}
|
||||
|
||||
/* The type already has a qualifier on it. In this case, we first check to
|
||||
see if the qualifier is already specified. In that case do nothing.
|
||||
If it is a new qualifier, we add it to the qualifier list in alphabetical
|
||||
order */
|
||||
|
||||
sz = element_size(c);
|
||||
|
||||
if (strstr(c, cqual)) {
|
||||
/* Qualifier already added */
|
||||
return t;
|
||||
/* create string of all qualifiers */
|
||||
if (strncmp(c, "q(", 2) == 0) {
|
||||
allq = SwigType_parm(t);
|
||||
Append(allq, " ");
|
||||
SwigType_del_element(t); /* delete old qualifier list from 't' */
|
||||
} else {
|
||||
allq = NewStringEmpty();
|
||||
}
|
||||
Append(allq, qual);
|
||||
|
||||
/* Add the qualifier to the existing list. */
|
||||
/* create list of all qualifiers from string */
|
||||
qlist = Split(allq, ' ', INT_MAX);
|
||||
Delete(allq);
|
||||
|
||||
/* sort in alphabetical order */
|
||||
SortList(qlist, Strcmp);
|
||||
|
||||
/* create new qualifier string from unique elements of list */
|
||||
sz = Len(qlist);
|
||||
newq = NewString("q(");
|
||||
q = c + 2;
|
||||
q = strtok(q, " ).");
|
||||
while (q) {
|
||||
if (strcmp(cqual, q) < 0) {
|
||||
/* New qualifier is less that current qualifier. We need to insert it */
|
||||
Append(newq, cqual);
|
||||
Append(newq, " ");
|
||||
Append(newq, q);
|
||||
added = 1;
|
||||
} else {
|
||||
for (i = 0; i < sz; ++i) {
|
||||
String *q = Getitem(qlist, i);
|
||||
const char *cq = Char(q);
|
||||
if (cqprev == 0 || strcmp(cqprev, cq) != 0) {
|
||||
if (i > 0) {
|
||||
Append(newq, " ");
|
||||
}
|
||||
Append(newq, q);
|
||||
cqprev = cq;
|
||||
}
|
||||
q = strtok(NULL, " ).");
|
||||
if (q) {
|
||||
Append(newq, " ");
|
||||
}
|
||||
}
|
||||
if (!added) {
|
||||
Append(newq, " ");
|
||||
Append(newq, cqual);
|
||||
}
|
||||
Append(newq, ").");
|
||||
Delslice(t, 0, sz);
|
||||
Delete(qlist);
|
||||
|
||||
/* replace qualifier string with new one */
|
||||
Insert(t, 0, newq);
|
||||
Delete(newq);
|
||||
return t;
|
||||
|
|
@ -785,7 +785,6 @@ SwigType *SwigType_add_function(SwigType *t, ParmList *parms) {
|
|||
|
||||
Insert(t, 0, ").");
|
||||
pstr = NewString("f(");
|
||||
p = parms;
|
||||
for (p = parms; p; p = nextSibling(p)) {
|
||||
if (p != parms)
|
||||
Putc(',', pstr);
|
||||
|
|
@ -883,7 +882,6 @@ SwigType *SwigType_add_template(SwigType *t, ParmList *parms) {
|
|||
Parm *p;
|
||||
|
||||
Append(t, "<(");
|
||||
p = parms;
|
||||
for (p = parms; p; p = nextSibling(p)) {
|
||||
String *v;
|
||||
if (Getattr(p, "default"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue