45
45
printf("<!-- XML DTD generated by asn1c-" VERSION " -->\n\n");
47
47
TQ_FOR(mod, &(asn->modules), mod_next) {
48
if(mod->_tags & MT_STANDARD_MODULE)
49
return 0; /* Ignore modules imported from skeletons */
48
50
if(modno++) printf("\n");
49
51
asn1print_module(asn, mod, flags);
65
67
if(flags & APF_PRINT_XML_DTD)
66
68
printf("<!-- ASN.1 module\n");
68
printf("%s ", mod->Identifier);
70
printf("%s ", mod->ModuleName);
69
71
if(mod->module_oid) {
70
asn1print_oid(strlen(mod->Identifier), mod->module_oid, flags);
72
asn1print_oid(strlen(mod->ModuleName), mod->module_oid, flags);
105
107
TQ_FOR(tc, &(mod->members), next) {
106
108
asn1print_expr(asn, mod, tc, flags, 0);
107
if(flags & APF_DEBUG_CONSTRAINTS)
109
if(flags & APF_PRINT_CONSTRAINTS)
169
171
(void)flags; /* Unused argument */
171
if(tag->tag_class == TC_NOCLASS)
175
switch(tag->tag_class) {
177
assert(tag->tag_class != TC_NOCLASS);
179
case TC_UNIVERSAL: printf("UNIVERSAL "); break;
180
case TC_PRIVATE: printf("PRIVATE "); break;
181
case TC_APPLICATION: printf("APPLICATION "); break;
182
case TC_CONTEXT_SPECIFIC:
185
printf("%" PRIdASN "]", tag->tag_value);
187
switch(tag->tag_mode) {
188
case TM_DEFAULT: break;
189
case TM_IMPLICIT: printf(" IMPLICIT"); break;
190
case TM_EXPLICIT: printf(" EXPLICIT"); break;
173
printf("%s", asn1p_tag2string(tag, 0));
209
191
printf("%f", val->value.v_double);
194
asn1print_expr(val->value.v_type->module->asn1p,
195
val->value.v_type->module,
196
val->value.v_type, flags, 0);
211
198
case ATV_INTEGER:
212
199
printf("%" PRIdASN, val->value.v_integer);
278
265
case ATV_REFERENCED:
279
266
return asn1print_ref(val->value.reference, flags);
268
return asn1print_constraint(val->value.constraint, flags);
280
269
case ATV_CHOICE_IDENTIFIER:
281
270
printf("%s: ", val->value.choice_identifier.identifier);
282
271
return asn1print_value(val->value.choice_identifier.value, flags);
367
356
case ACT_CT_CTDBY:
368
printf("CONSTRAINED BY ");
357
printf("(CONSTRAINED BY ");
369
358
assert(ct->value->type == ATV_UNPARSED);
370
359
fwrite(ct->value->value.string.buf,
371
360
1, ct->value->value.string.size, stdout);
364
printf("(CONTAINING ");
365
asn1print_expr(ct->value->value.v_type->module->asn1p,
366
ct->value->value.v_type->module,
367
ct->value->value.v_type,
373
371
case ACT_CA_SET: symno++;
374
372
case ACT_CA_CRC: symno++;
380
378
char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",",
381
if(ct->type == ACT_CA_CRC) fputs("(", stdout);
383
382
for(i = 0; i < ct->el_count; i++) {
384
383
if(i) fputs(symtable[symno], stdout);
385
384
if(ct->type == ACT_CA_CRC) fputs("{", stdout);
430
430
asn1print_with_syntax(asn1p_wsyntx_t *wx, enum asn1print_flags flags) {
432
432
asn1p_wsyntx_chunk_t *wc;
433
printf(" WITH SYNTAX {");
434
433
TQ_FOR(wc, &(wx->chunks), next) {
436
asn1print_ref(wc->ref, flags);
438
fwrite(wc->buf, 1, wc->len, stdout);
438
printf("%s", wc->content.token);
440
case WC_OPTIONALGROUP:
442
asn1print_with_syntax(wc->content.syntax,flags);
465
470
int as_char = (type==ACT_CT_FROM);
468
range = asn1constraint_compute_PER_range(expr_type, ct, type,
469
0, 0, strict_PER_visible);
473
range = asn1constraint_compute_PER_range(expr_type, ct, type, 0, 0,
474
strict_PER_visible ? CPR_strict_PER_visibility : 0);
470
475
if(!range) return -1;
472
477
if(range->incompatible
529
534
if(flags & APF_LINE_COMMENTS && !(flags & APF_NOINDENT))
530
535
INDENT("-- #line %d\n", tc->_lineno);
537
/* Reconstruct compiler directive information */
538
if((tc->marker.flags & EM_INDIRECT)
539
&& (tc->marker.flags & EM_OMITABLE) != EM_OMITABLE) {
540
if((flags & APF_NOINDENT))
541
printf(" --<ASN1C.RepresentAsPointer>-- ");
543
INDENT("--<ASN1C.RepresentAsPointer>--\n");
547
&& (!(tc->meta_type == AMT_VALUE && tc->expr_type == A1TC_REFERENCE)
532
549
INDENT("%s", tc->Identifier);
535
asn1print_params(tc->params, flags);
552
asn1print_params(tc->lhs_params, flags);
538
555
if(tc->meta_type != AMT_VALUE
615
* Put the name of the referred type.
597
617
if(tc->reference) {
598
if(!(flags & APF_NOINDENT))
600
619
asn1print_ref(tc->reference, flags);
603
if(tc->meta_type == AMT_VALUESET)
622
if(tc->meta_type == AMT_VALUESET && level == 0)
609
628
if(TQ_FIRST(&(tc->members))
610
629
|| (tc->expr_type & ASN_CONSTR_MASK)
611
|| tc->meta_type == AMT_VALUESET
612
630
|| tc->meta_type == AMT_OBJECT
613
|| tc->meta_type == AMT_OBJECTSET
631
|| tc->meta_type == AMT_OBJECTCLASS
632
|| tc->meta_type == AMT_OBJECTFIELD
615
634
asn1p_expr_t *se; /* SubExpression */
616
int put_braces = !SEQ_OF; /* Don't need 'em, if SET OF... */
635
int put_braces = (!SEQ_OF) /* Don't need 'em, if SET OF... */
636
&& (tc->meta_type != AMT_OBJECTFIELD);
619
639
if(flags & APF_NOINDENT) {
678
if(tc->with_syntax) {
679
printf(" WITH SYNTAX {");
659
680
asn1print_with_syntax(tc->with_syntax, flags);
684
/* Right hand specialization */
688
TQ_FOR(se, &(tc->rhs_pspecs->members), next) {
689
asn1print_expr(asn, mod, se, flags, level + 1);
690
if(TQ_NEXT(se, next)) printf(", ");
661
695
if(!SEQ_OF && tc->constraints) {
697
if(tc->meta_type == AMT_VALUESET)
663
699
asn1print_constraint(tc->constraints, flags);
700
if(tc->meta_type == AMT_VALUESET)
685
723
* The following section exists entirely for debugging.
687
if(flags & APF_DEBUG_CONSTRAINTS
725
if(flags & APF_PRINT_CONSTRAINTS
688
726
&& tc->expr_type != A1TC_EXTENSIBLE) {
689
727
asn1p_expr_t *top_parent;
748
if(flags & APF_PRINT_CLASS_MATRIX
749
&& tc->expr_type == A1TC_CLASSDEF) do {
750
int r, col, maxidlen;
751
if(tc->object_class_matrix.rows == 0) {
752
printf("\n-- Class matrix is empty");
755
printf("\n-- Class matrix has %d entr%s:\n",
756
tc->object_class_matrix.rows,
757
tc->object_class_matrix.rows==1 ? "y" : "ies");
758
maxidlen = tc->object_class_matrix.max_identifier_length;
759
for(r = -1; r < tc->object_class_matrix.rows; r++) {
760
struct asn1p_ioc_row_s *row;
761
row = tc->object_class_matrix.row[r<0?0:r];
762
if(r < 0) printf("-- %s", r > 9 ? " " : "");
763
else printf("-- [%*d]", r > 9 ? 2 : 1, r+1);
764
for(col = 0; col < row->columns; col++) {
765
struct asn1p_ioc_cell_s *cell;
766
cell = &row->column[col];
768
printf("[%*s]", maxidlen,
769
cell->field->Identifier);
773
printf(" %*s ", maxidlen, "<no entry>");
776
printf(" %*s ", maxidlen,
777
cell->value->Identifier);
783
if(flags & APF_PRINT_CLASS_MATRIX
784
&& tc->lhs_params) do {
786
if(tc->specializations.pspecs_count == 0) {
787
printf("\n-- No specializations found\n");
790
printf("\n-- Specializations list has %d entr%s:\n",
791
tc->specializations.pspecs_count,
792
tc->specializations.pspecs_count == 1 ? "y" : "ies");
793
for(i = 0; i < tc->specializations.pspecs_count; i++) {
795
struct asn1p_pspec_s *pspec;
796
pspec = &tc->specializations.pspec[i];
798
TQ_FOR(se, &(pspec->rhs_pspecs->members), next) {
799
asn1print_expr(asn, mod, se, flags, level+1);