we can also print compound types

mprokop/packaging
Richard Fuchs 13 years ago
parent 2d72da18a9
commit bf45158e89

@ -102,7 +102,7 @@ static inline int next_token_2(const char **token, const char **c) {
return 0;
}
int cb(const void *buf, size_t s, void *app_key) {
static int cb(const void *buf, size_t s, void *app_key) {
struct output_buffer *out = app_key;
if (out->buf_size - out->used < s)
@ -189,13 +189,9 @@ found_element:
break;
}
/* found our target value, check for primitive types */
if (type->elements_count)
goto out;
type->print_struct(type, element, 0, cb, out);
if (type->print_struct && out)
type->print_struct(type, element, 0, cb, out);
out:
return 0;
error:

@ -18,15 +18,17 @@ int main() {
i = tcap_extract(tcap, tcap_len, "end.components.1.invoke.opCode.localValue", &out);
printf("tcap_extract opcode: returned %i, value %.*s\n", i, (int) out.used, out.buf);
i = inap_extract(tcap, tcap_len, "ConnectArg", NULL);
printf("inap_extract ConnectArg: returned %i\n", i);
OUTPUT_BUFFER_INIT(&out, buf);
i = inap_extract(tcap, tcap_len, "ConnectArg", &out);
printf("inap_extract ConnectArg: returned %i, value %.*s\n", i, (int) out.used, out.buf);
OUTPUT_BUFFER_INIT(&out, buf);
i = inap_extract(tcap, tcap_len, "ConnectArg.cutAndPaste", &out);
printf("inap_extract ConnectArg: returned %i, value %.*s\n", i, (int) out.used, out.buf);
printf("inap_extract ConnectArg.cutAndPaste: returned %i, value %.*s\n", i, (int) out.used, out.buf);
i = inap_extract(tcap, tcap_len, "ConnectArg.destinationRoutingAddress", NULL);
printf("inap_extract ConnectArg.destinationRoutingAddress: returned %i\n", i);
OUTPUT_BUFFER_INIT(&out, buf);
i = inap_extract(tcap, tcap_len, "ConnectArg.destinationRoutingAddress", &out);
printf("inap_extract ConnectArg.destinationRoutingAddress: returned %i, value %.*s\n", i, (int) out.used, out.buf);
OUTPUT_BUFFER_INIT(&out, buf);
i = inap_extract(tcap, tcap_len, "ConnectArg.destinationRoutingAddress.0", &out);

Loading…
Cancel
Save