Commit a2abcaab authored by Lev Walkin's avatar Lev Walkin

add OER to -print-constraints

parent 4a06e6a8
...@@ -483,17 +483,22 @@ asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) { ...@@ -483,17 +483,22 @@ asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) {
} }
static int 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; asn1cnst_range_t *range;
int as_char = (type==ACT_CT_FROM); int as_char = (type==ACT_CT_FROM);
int i; int i;
range = asn1constraint_compute_PER_range(expr_type, ct, type, 0, 0, range = asn1constraint_compute_constraint_range(expr_type, ct, type, 0, 0, cpr);
strict_PER_visible ? CPR_strict_PER_visibility : 0);
if(!range) return -1; if(!range) return -1;
if(range->incompatible if(range->incompatible) return 0;
|| (strict_PER_visible && range->not_PER_visible)) {
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); asn1constraint_range_free(range);
return 0; return 0;
} }
...@@ -534,13 +539,13 @@ asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_ ...@@ -534,13 +539,13 @@ asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_
static int static int
asn1print_constraint_explain(asn1p_expr_type_e expr_type, 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(" "); 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(" "); 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; return 0;
} }
...@@ -755,10 +760,14 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri ...@@ -755,10 +760,14 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
top_parent->Identifier); top_parent->Identifier);
asn1print_constraint_explain(top_parent->expr_type, asn1print_constraint_explain(top_parent->expr_type,
tc->combined_constraints, 0); 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): ", safe_printf("\n-- PER-visible constraints (%s): ",
top_parent->Identifier); top_parent->Identifier);
asn1print_constraint_explain(top_parent->expr_type, asn1print_constraint_explain(top_parent->expr_type,
tc->combined_constraints, 1); tc->combined_constraints, CPR_strict_PER_visibility);
} }
safe_printf("\n"); safe_printf("\n");
} }
......
...@@ -9,22 +9,25 @@ ...@@ -9,22 +9,25 @@
ModuleOERLong ModuleOERLong
{ iso org(3) dod(6) internet (1) private(4) enterprise(1) { iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 135 } spelio(9363) software(1) asn1c(5) test(1) 135 }
DEFINITIONS AUTOMATIC TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
-- Supported only on 64-bit platforms. -- Supported only on 64-bit platforms.
T ::= SEQUENCE { T ::= SEQUENCE {
unsigned8 INTEGER (0..255), -- OER 1 byte unsigned8 [0] INTEGER (0..255), -- OER 1 byte
unsigned16 INTEGER (0..65535), -- OER 2 bytes unsigned16 [1] INTEGER (0..65535), -- OER 2 bytes
unsigned16stack INTEGER (0..32767)(0..255), -- OER 1 byte unsigned16stack [2] INTEGER (0..32767)(0..255), -- OER 1 byte
unsigned16stack-ext INTEGER (0..32767)(0..255,...), -- OER 2 bytes unsigned16stack-ext [15] INTEGER (0..32767)(0..255,...), -- OER 2 bytes
unsigned33 INTEGER (0..5000000000), -- OER 8 bytes unsigned33 [3] INTEGER (0..5000000000), -- OER 8 bytes
signed8 INTEGER (-128..127), -- OER 1 byte ...,
signed16 INTEGER (-32768..32767), -- OER 2 bytes signed8 [10] INTEGER (-128..127), -- OER 1 byte
signed16stack INTEGER (-32768..32767)(-128..127), -- OER 1 byte signed16 [11] INTEGER (-32768..32767), -- OER 2 bytes
signed16stack-ext INTEGER (-32768..32767)(-128..127,...), -- OER 2 b signed16stack [12] INTEGER (-32768..32767)(-128..127), -- OER 1 byte
signed32 INTEGER (-2000000000..2000000000), -- OER 4 bytes signed16stack-ext [5] INTEGER (-32768..32767)(-128..127,...), -- OER 2 b
signed33ext INTEGER (-4000000000..4000000000,...) -- OER vrble signed32 [7] INTEGER (-2000000000..2000000000), -- OER 4 bytes
signed33ext [8] INTEGER (-4000000000..4000000000,...),-- OER vrble
...,
minmax [6] INTEGER (MIN..MAX)
} }
END END
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment