pike.git/
src/
mapping.c
Branch:
Tag:
Non-build tags
All tags
No tags
2000-01-14
2000-01-14 15:36:04 by Fredrik Noring <noring@nocrew.org>
674fae2957e77e1b88a76412f40ce8f2342f8514 (
38
lines) (+
24
/-
14
)
[
Show
|
Annotate
]
Branch:
7.9
Mappings are now sorted with %O in sprintf.
Rev: src/mapping.c:1.48
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: mapping.c,v 1.
47
1999
/
11
/
23
10
:
38
:
16
mast
Exp $");
+
RCSID("$Id: mapping.c,v 1.
48
2000
/
01
/
14
15
:
36
:
04
noring
Exp $");
#include "main.h" #include "object.h" #include "mapping.h"
816:
void describe_mapping(struct mapping *m,struct processing *p,int indent) { struct processing doing;
-
INT32 e,d
,q
;
+
struct array *a;
+
JMP_BUF catch;
+
ONERROR err;
+
INT32 e,d;
struct keypair *k; char buf[40];
843:
(long)m->size); my_strcat(buf);
-
q
=
0
;
+
a
=
mapping_indices(m)
;
+
SET_ONERROR(err, do_free_array, a);
-
MAPPING
_
LOOP
(
m
)
+
if(!SETJMP(catch))
+
sort
_
array_destructively
(
a
)
;
+
UNSETJMP(catch);
+
+
for(e = 0; e < a->size; e++)
{
-
if(
q
)
-
{
-
my_
putchar
(
'
,
');
-
my_putchar('
\n
'
);
-
} else {
-
q=1;
-
}
-
for(d=0; d<indent; d++) my_putchar(' ');
-
describe_svalue(
& k->ind
, indent+2, &doing);
+
if(
e
)
+
my_
strcat
(
"
,\n
"
);
+
+
for(d
=
0; d
<
indent; d++)
+
my_putchar(' ');
+
+
describe_svalue(
ITEM(a)+e
, indent+2, &doing);
my_putchar(':');
-
describe_svalue(
&
k->val
, indent+2, &doing);
+
describe_svalue(
low_mapping_lookup(m,
ITEM(a)+e)
, indent+2, &doing);
}
-
+
UNSET_ONERROR(err);
+
free_array(a);
+
my_putchar('\n'); for(e=2; e<indent; e++) my_putchar(' '); my_strcat("])");