Minor code improvements
This commit is contained in:
parent
44a883a057
commit
b65ba2a8db
5 changed files with 13 additions and 18 deletions
|
|
@ -243,10 +243,10 @@ static void set_access_mode(Node *n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore_access_mode(Node *n) {
|
static void restore_access_mode(Node *n) {
|
||||||
char* mode = Char(Getattr(n, "access"));
|
String *mode = Getattr(n, "access");
|
||||||
if (strcmp(mode, "private") == 0)
|
if (Strcmp(mode, "private") == 0)
|
||||||
cplus_mode = CPLUS_PRIVATE;
|
cplus_mode = CPLUS_PRIVATE;
|
||||||
else if (strcmp(mode, "protected") == 0)
|
else if (Strcmp(mode, "protected") == 0)
|
||||||
cplus_mode = CPLUS_PROTECTED;
|
cplus_mode = CPLUS_PROTECTED;
|
||||||
else
|
else
|
||||||
cplus_mode = CPLUS_PUBLIC;
|
cplus_mode = CPLUS_PUBLIC;
|
||||||
|
|
@ -800,7 +800,7 @@ static String *make_class_name(String *name) {
|
||||||
|
|
||||||
/* Use typedef name as class name */
|
/* Use typedef name as class name */
|
||||||
|
|
||||||
void add_typedef_name(Node *n, Node *decl, String *oldName, Symtab *cscope, String *scpname) {
|
static void add_typedef_name(Node *n, Node *decl, String *oldName, Symtab *cscope, String *scpname) {
|
||||||
String *class_rename = 0;
|
String *class_rename = 0;
|
||||||
SwigType *decltype = Getattr(decl, "decl");
|
SwigType *decltype = Getattr(decl, "decl");
|
||||||
if (!decltype || !Len(decltype)) {
|
if (!decltype || !Len(decltype)) {
|
||||||
|
|
@ -1043,7 +1043,7 @@ static String *resolve_create_node_scope(String *cname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* look for simple typedef name in typedef list */
|
/* look for simple typedef name in typedef list */
|
||||||
String *try_to_find_a_name_for_unnamed_structure(char *storage, Node *decls) {
|
static String *try_to_find_a_name_for_unnamed_structure(const char *storage, Node *decls) {
|
||||||
String *name = 0;
|
String *name = 0;
|
||||||
Node *n = decls;
|
Node *n = decls;
|
||||||
if (storage && (strcmp(storage, "typedef") == 0)) {
|
if (storage && (strcmp(storage, "typedef") == 0)) {
|
||||||
|
|
@ -1058,7 +1058,7 @@ String *try_to_find_a_name_for_unnamed_structure(char *storage, Node *decls) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* traverse copied tree segment, and update outer class links*/
|
/* traverse copied tree segment, and update outer class links*/
|
||||||
void update_nested_classes(Node *n)
|
static void update_nested_classes(Node *n)
|
||||||
{
|
{
|
||||||
Node *c = firstChild(n);
|
Node *c = firstChild(n);
|
||||||
while (c) {
|
while (c) {
|
||||||
|
|
|
||||||
|
|
@ -2391,7 +2391,7 @@ int Language::classDeclaration(Node *n) {
|
||||||
}
|
}
|
||||||
AccessMode oldAccessMode = cplus_mode;
|
AccessMode oldAccessMode = cplus_mode;
|
||||||
Node *outerClass = Getattr(n, "nested:outer");
|
Node *outerClass = Getattr(n, "nested:outer");
|
||||||
if (outerClass && oldAccessMode != Dispatcher::PUBLIC)
|
if (outerClass && oldAccessMode != PUBLIC)
|
||||||
return SWIG_NOWRAP;
|
return SWIG_NOWRAP;
|
||||||
ClassName = Copy(name);
|
ClassName = Copy(name);
|
||||||
ClassPrefix = Copy(symname);
|
ClassPrefix = Copy(symname);
|
||||||
|
|
|
||||||
|
|
@ -862,13 +862,9 @@ void SWIG_getoptions(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Swig_flatten_nested() {
|
static void flatten_nested() {
|
||||||
String* name = NewString("");
|
String *val = NewString("1");
|
||||||
String* fname = NewString("feature:flatnested");
|
Swig_feature_set(Swig_cparse_features(), "", 0, "feature:flatnested", val, 0);
|
||||||
String* val = NewString("1");
|
|
||||||
Swig_feature_set(Swig_cparse_features(),name,0,fname, val, 0);
|
|
||||||
Delete(fname);
|
|
||||||
Delete(name);
|
|
||||||
Delete(val);
|
Delete(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1167,7 +1163,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
|
|
||||||
// add "ignore" directive if nested classes are not supported
|
// add "ignore" directive if nested classes are not supported
|
||||||
if (!lang->nestedClassesSupported())
|
if (!lang->nestedClassesSupported())
|
||||||
Swig_flatten_nested();
|
flatten_nested();
|
||||||
|
|
||||||
Node *top = Swig_cparse(cpps);
|
Node *top = Swig_cparse(cpps);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1683,11 +1683,10 @@ List *Swig_make_inherit_list(String *clsname, List *names, String *Namespacepref
|
||||||
|
|
||||||
ilen = Len(names);
|
ilen = Len(names);
|
||||||
for (i = 0; i < ilen; i++) {
|
for (i = 0; i < ilen; i++) {
|
||||||
Node *s;
|
|
||||||
String *base;
|
String *base;
|
||||||
String *n = Getitem(names, i);
|
String *n = Getitem(names, i);
|
||||||
/* Try to figure out where this symbol is */
|
/* Try to figure out where this symbol is */
|
||||||
s = Swig_symbol_clookup(n,0);
|
Node *s = Swig_symbol_clookup(n, 0);
|
||||||
if (s) {
|
if (s) {
|
||||||
while (s && (Strcmp(nodeType(s), "class") != 0)) {
|
while (s && (Strcmp(nodeType(s), "class") != 0)) {
|
||||||
/* Not a class. Could be a typedef though. */
|
/* Not a class. Could be a typedef though. */
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ extern void appendChild(Node *node, Node *child);
|
||||||
extern void prependChild(Node *node, Node *child);
|
extern void prependChild(Node *node, Node *child);
|
||||||
extern void removeNode(Node *node);
|
extern void removeNode(Node *node);
|
||||||
extern Node *copyNode(Node *node);
|
extern Node *copyNode(Node *node);
|
||||||
extern void appendSibling(Node *node, Node *chd);
|
extern void appendSibling(Node *node, Node *child);
|
||||||
|
|
||||||
/* Node restoration/restore functions */
|
/* Node restoration/restore functions */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue