mirror of https://gerrit.osmocom.org/asn1c
add OER to -print-constraints
This commit is contained in:
parent
4a06e6a8eb
commit
a2abcaab2e
|
@ -483,17 +483,22 @@ asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) {
|
|||
}
|
||||
|
||||
static int
|
||||
asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, int strict_PER_visible) {
|
||||
asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, enum cpr_flags cpr) {
|
||||
asn1cnst_range_t *range;
|
||||
int as_char = (type==ACT_CT_FROM);
|
||||
int i;
|
||||
|
||||
range = asn1constraint_compute_PER_range(expr_type, ct, type, 0, 0,
|
||||
strict_PER_visible ? CPR_strict_PER_visibility : 0);
|
||||
range = asn1constraint_compute_constraint_range(expr_type, ct, type, 0, 0, cpr);
|
||||
if(!range) return -1;
|
||||
|
||||
if(range->incompatible
|
||||
|| (strict_PER_visible && range->not_PER_visible)) {
|
||||
if(range->incompatible) return 0;
|
||||
|
||||
if((cpr & CPR_strict_OER_visibility) && range->not_OER_visible) {
|
||||
asn1constraint_range_free(range);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((cpr & CPR_strict_PER_visibility) && range->not_PER_visible) {
|
||||
asn1constraint_range_free(range);
|
||||
return 0;
|
||||
}
|
||||
|
@ -534,13 +539,13 @@ asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_
|
|||
|
||||
static int
|
||||
asn1print_constraint_explain(asn1p_expr_type_e expr_type,
|
||||
asn1p_constraint_t *ct, int s_PV) {
|
||||
asn1p_constraint_t *ct, enum cpr_flags cpr) {
|
||||
|
||||
asn1print_constraint_explain_type(expr_type, ct, ACT_EL_RANGE, s_PV);
|
||||
asn1print_constraint_explain_type(expr_type, ct, ACT_EL_RANGE, cpr);
|
||||
safe_printf(" ");
|
||||
asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE, s_PV);
|
||||
asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE, cpr);
|
||||
safe_printf(" ");
|
||||
asn1print_constraint_explain_type(expr_type, ct, ACT_CT_FROM, s_PV);
|
||||
asn1print_constraint_explain_type(expr_type, ct, ACT_CT_FROM, cpr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -755,10 +760,14 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
|
|||
top_parent->Identifier);
|
||||
asn1print_constraint_explain(top_parent->expr_type,
|
||||
tc->combined_constraints, 0);
|
||||
safe_printf("\n-- OER-visible constraints (%s): ",
|
||||
top_parent->Identifier);
|
||||
asn1print_constraint_explain(top_parent->expr_type,
|
||||
tc->combined_constraints, CPR_strict_OER_visibility);
|
||||
safe_printf("\n-- PER-visible constraints (%s): ",
|
||||
top_parent->Identifier);
|
||||
asn1print_constraint_explain(top_parent->expr_type,
|
||||
tc->combined_constraints, 1);
|
||||
tc->combined_constraints, CPR_strict_PER_visibility);
|
||||
}
|
||||
safe_printf("\n");
|
||||
}
|
||||
|
|
|
@ -9,22 +9,25 @@
|
|||
ModuleOERLong
|
||||
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
|
||||
spelio(9363) software(1) asn1c(5) test(1) 135 }
|
||||
DEFINITIONS AUTOMATIC TAGS ::=
|
||||
DEFINITIONS IMPLICIT TAGS ::=
|
||||
BEGIN
|
||||
|
||||
-- Supported only on 64-bit platforms.
|
||||
T ::= SEQUENCE {
|
||||
unsigned8 INTEGER (0..255), -- OER 1 byte
|
||||
unsigned16 INTEGER (0..65535), -- OER 2 bytes
|
||||
unsigned16stack INTEGER (0..32767)(0..255), -- OER 1 byte
|
||||
unsigned16stack-ext INTEGER (0..32767)(0..255,...), -- OER 2 bytes
|
||||
unsigned33 INTEGER (0..5000000000), -- OER 8 bytes
|
||||
signed8 INTEGER (-128..127), -- OER 1 byte
|
||||
signed16 INTEGER (-32768..32767), -- OER 2 bytes
|
||||
signed16stack INTEGER (-32768..32767)(-128..127), -- OER 1 byte
|
||||
signed16stack-ext INTEGER (-32768..32767)(-128..127,...), -- OER 2 b
|
||||
signed32 INTEGER (-2000000000..2000000000), -- OER 4 bytes
|
||||
signed33ext INTEGER (-4000000000..4000000000,...) -- OER vrble
|
||||
unsigned8 [0] INTEGER (0..255), -- OER 1 byte
|
||||
unsigned16 [1] INTEGER (0..65535), -- OER 2 bytes
|
||||
unsigned16stack [2] INTEGER (0..32767)(0..255), -- OER 1 byte
|
||||
unsigned16stack-ext [15] INTEGER (0..32767)(0..255,...), -- OER 2 bytes
|
||||
unsigned33 [3] INTEGER (0..5000000000), -- OER 8 bytes
|
||||
...,
|
||||
signed8 [10] INTEGER (-128..127), -- OER 1 byte
|
||||
signed16 [11] INTEGER (-32768..32767), -- OER 2 bytes
|
||||
signed16stack [12] INTEGER (-32768..32767)(-128..127), -- OER 1 byte
|
||||
signed16stack-ext [5] INTEGER (-32768..32767)(-128..127,...), -- OER 2 b
|
||||
signed32 [7] INTEGER (-2000000000..2000000000), -- OER 4 bytes
|
||||
signed33ext [8] INTEGER (-4000000000..4000000000,...),-- OER vrble
|
||||
...,
|
||||
minmax [6] INTEGER (MIN..MAX)
|
||||
}
|
||||
|
||||
END
|
||||
|
|
Loading…
Reference in New Issue