Changed string output of hash tables.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@653 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
10b7f501d6
commit
b3c17a0a3d
1 changed files with 8 additions and 3 deletions
|
|
@ -356,9 +356,10 @@ Hash_nextkey(DOH *ho) {
|
||||||
|
|
||||||
static DOH *
|
static DOH *
|
||||||
Hash_str(DOH *ho) {
|
Hash_str(DOH *ho) {
|
||||||
int i;
|
int i,j;
|
||||||
HashNode *n;
|
HashNode *n;
|
||||||
DOH *s;
|
DOH *s;
|
||||||
|
static int indent = 4;
|
||||||
Hash *h = (Hash *) ObjData(ho);
|
Hash *h = (Hash *) ObjData(ho);
|
||||||
|
|
||||||
s = NewString("");
|
s = NewString("");
|
||||||
|
|
@ -371,10 +372,14 @@ Hash_str(DOH *ho) {
|
||||||
for (i = 0; i < h->hashsize; i++) {
|
for (i = 0; i < h->hashsize; i++) {
|
||||||
n = h->hashtable[i];
|
n = h->hashtable[i];
|
||||||
while (n) {
|
while (n) {
|
||||||
Printf(s," '%s' : %s, \n", n->key, n->object);
|
for (j = 0; j < indent; j++) Putc(' ',s);
|
||||||
n = n->next;
|
indent+=4;
|
||||||
|
Printf(s,"'%s' : %s, \n", n->key, n->object);
|
||||||
|
indent-=4;
|
||||||
|
n = n->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < (indent-4); j++) Putc(' ',s);
|
||||||
Printf(s,"}\n");
|
Printf(s,"}\n");
|
||||||
ObjSetMark(ho,0);
|
ObjSetMark(ho,0);
|
||||||
return s;
|
return s;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue