2 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
4 * Redistribution and modifications are permitted subject to BSD license.
6 #include <asn_internal.h>
7 #include <constr_SEQUENCE.h>
10 SEQUENCE_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
11 asn_app_consume_bytes_f *cb, void *app_key) {
15 if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
18 if(cb(td->name, strlen(td->name), app_key) < 0
19 || cb(" ::= {", 6, app_key) < 0)
22 for(edx = 0; edx < td->elements_count; edx++) {
23 asn_TYPE_member_t *elm = &td->elements[edx];
26 if(elm->flags & ATF_POINTER) {
27 memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
29 if(elm->optional) continue;
30 /* Print <absent> line */
34 memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
40 /* Print the member's name and stuff */
41 if(cb(elm->name, strlen(elm->name), app_key) < 0
42 || cb(": ", 2, app_key) < 0)
45 /* Print the member itself */
46 ret = elm->type->op->print_struct(elm->type, memb_ptr, ilevel + 1,
54 return (cb("}", 1, app_key) < 0) ? -1 : 0;