updated parsing bnf
diff --git a/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1 b/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1
index ce868b5..486cbc0 100644
--- a/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1
+++ b/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1
@@ -20,13 +20,16 @@
G-3-3 ::= INTEGER (0..10,...)(2..5,...)(3) -- OER-visible constraint 3
-- X.696 #8.2.4 Not OER-visible parts of INTERSECTION are ignored
H-4-5 ::= INTEGER ((0..5) ^ (4..9)) -- OER-visible constraint 4..5
- I-0-5 ::= INTEGER ((0..5) ^ (4..12,...)) -- OER-visible constraint 0..5
- J-4-9 ::= INTEGER ((0..5,...) ^ (4..9)) -- OER-visible constraint 4..9
- K-inv ::= INTEGER ((0..5,...) ^ (4..9,...)) -- Not OER-visible
+ I-1-5 ::= INTEGER ((0..5) ^ (EConstr)) -- OER-visible constraint 1..5
+ J-4-5 ::= INTEGER ((EConstr) ^ (4..9)) -- OER-visible constraint 4..5
+ K-1-4 ::= INTEGER ((FConstr) ^ (EConstr)) -- OER-visible constraint 1..4
-- X.696 #8.2.5 UNION with exeptions are ignored
L-0-5 ::= INTEGER ((0) | (5)) -- OER-visible constraint 0..5
- M-inv ::= INTEGER ((0) | (5,...)) -- Not OER-visible
- N-inv ::= INTEGER ((0..4,...) | (5)) -- Not OER-visible
- O-inv ::= INTEGER ((0..4,...) | (5,...)) -- Not OER-visible
+ M-inv ::= INTEGER ((0) | (EConstr),...) -- Not OER-visible
+ N-0-5 ::= INTEGER ((FConstr) | (5)) -- OER-visible constraint 0..5
+ O-inv ::= INTEGER ((FConstr) | (5), ...) -- Not OER-visible
+
+ EConstr ::= INTEGER (1..5,...)
+ FConstr ::= INTEGER (0..4)
END
diff --git a/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER b/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
index 3dd913e..0cea1a6 100644
--- a/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
+++ b/tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
@@ -624,31 +624,31 @@
};
-/*** <<< INCLUDES [I-0-5] >>> ***/
+/*** <<< INCLUDES [I-1-5] >>> ***/
#include <NativeInteger.h>
-/*** <<< TYPE-DECLS [I-0-5] >>> ***/
+/*** <<< TYPE-DECLS [I-1-5] >>> ***/
-typedef long I_0_5_t;
+typedef long I_1_5_t;
-/*** <<< FUNC-DECLS [I-0-5] >>> ***/
+/*** <<< FUNC-DECLS [I-1-5] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_I_0_5;
-asn_struct_free_f I_0_5_free;
-asn_struct_print_f I_0_5_print;
-asn_constr_check_f I_0_5_constraint;
-ber_type_decoder_f I_0_5_decode_ber;
-der_type_encoder_f I_0_5_encode_der;
-xer_type_decoder_f I_0_5_decode_xer;
-xer_type_encoder_f I_0_5_encode_xer;
-oer_type_decoder_f I_0_5_decode_oer;
-oer_type_encoder_f I_0_5_encode_oer;
+extern asn_TYPE_descriptor_t asn_DEF_I_1_5;
+asn_struct_free_f I_1_5_free;
+asn_struct_print_f I_1_5_print;
+asn_constr_check_f I_1_5_constraint;
+ber_type_decoder_f I_1_5_decode_ber;
+der_type_encoder_f I_1_5_encode_der;
+xer_type_decoder_f I_1_5_decode_xer;
+xer_type_encoder_f I_1_5_encode_xer;
+oer_type_decoder_f I_1_5_decode_oer;
+oer_type_encoder_f I_1_5_encode_oer;
-/*** <<< CODE [I-0-5] >>> ***/
+/*** <<< CODE [I-1-5] >>> ***/
int
-I_0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+I_1_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
@@ -661,7 +661,7 @@
value = *(const long *)sptr;
- if((value >= 4 && value <= 5)) {
+ if((value >= 1 && value <= 5)) {
/* Constraint check succeeded */
return 0;
} else {
@@ -677,60 +677,60 @@
* so here we adjust the DEF accordingly.
*/
-/*** <<< CTDEFS [I-0-5] >>> ***/
+/*** <<< CTDEFS [I-1-5] >>> ***/
-static asn_oer_constraints_t asn_OER_type_I_0_5_constr_1 GCC_NOTUSED = {
- { 1, 1 } /* (0..5) */,
+static asn_oer_constraints_t asn_OER_type_I_1_5_constr_1 GCC_NOTUSED = {
+ { 1, 1 } /* (1..5) */,
-1};
-/*** <<< STAT-DEFS [I-0-5] >>> ***/
+/*** <<< STAT-DEFS [I-1-5] >>> ***/
-static const ber_tlv_tag_t asn_DEF_I_0_5_tags_1[] = {
+static const ber_tlv_tag_t asn_DEF_I_1_5_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
-asn_TYPE_descriptor_t asn_DEF_I_0_5 = {
- "I-0-5",
- "I-0-5",
+asn_TYPE_descriptor_t asn_DEF_I_1_5 = {
+ "I-1-5",
+ "I-1-5",
&asn_OP_NativeInteger,
- I_0_5_constraint,
- asn_DEF_I_0_5_tags_1,
- sizeof(asn_DEF_I_0_5_tags_1)
- /sizeof(asn_DEF_I_0_5_tags_1[0]), /* 1 */
- asn_DEF_I_0_5_tags_1, /* Same as above */
- sizeof(asn_DEF_I_0_5_tags_1)
- /sizeof(asn_DEF_I_0_5_tags_1[0]), /* 1 */
- &asn_OER_type_I_0_5_constr_1,
+ I_1_5_constraint,
+ asn_DEF_I_1_5_tags_1,
+ sizeof(asn_DEF_I_1_5_tags_1)
+ /sizeof(asn_DEF_I_1_5_tags_1[0]), /* 1 */
+ asn_DEF_I_1_5_tags_1, /* Same as above */
+ sizeof(asn_DEF_I_1_5_tags_1)
+ /sizeof(asn_DEF_I_1_5_tags_1[0]), /* 1 */
+ &asn_OER_type_I_1_5_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
-/*** <<< INCLUDES [J-4-9] >>> ***/
+/*** <<< INCLUDES [J-4-5] >>> ***/
#include <NativeInteger.h>
-/*** <<< TYPE-DECLS [J-4-9] >>> ***/
+/*** <<< TYPE-DECLS [J-4-5] >>> ***/
-typedef long J_4_9_t;
+typedef long J_4_5_t;
-/*** <<< FUNC-DECLS [J-4-9] >>> ***/
+/*** <<< FUNC-DECLS [J-4-5] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_J_4_9;
-asn_struct_free_f J_4_9_free;
-asn_struct_print_f J_4_9_print;
-asn_constr_check_f J_4_9_constraint;
-ber_type_decoder_f J_4_9_decode_ber;
-der_type_encoder_f J_4_9_encode_der;
-xer_type_decoder_f J_4_9_decode_xer;
-xer_type_encoder_f J_4_9_encode_xer;
-oer_type_decoder_f J_4_9_decode_oer;
-oer_type_encoder_f J_4_9_encode_oer;
+extern asn_TYPE_descriptor_t asn_DEF_J_4_5;
+asn_struct_free_f J_4_5_free;
+asn_struct_print_f J_4_5_print;
+asn_constr_check_f J_4_5_constraint;
+ber_type_decoder_f J_4_5_decode_ber;
+der_type_encoder_f J_4_5_encode_der;
+xer_type_decoder_f J_4_5_decode_xer;
+xer_type_encoder_f J_4_5_encode_xer;
+oer_type_decoder_f J_4_5_decode_oer;
+oer_type_encoder_f J_4_5_encode_oer;
-/*** <<< CODE [J-4-9] >>> ***/
+/*** <<< CODE [J-4-5] >>> ***/
int
-J_4_9_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+J_4_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
@@ -759,60 +759,60 @@
* so here we adjust the DEF accordingly.
*/
-/*** <<< CTDEFS [J-4-9] >>> ***/
+/*** <<< CTDEFS [J-4-5] >>> ***/
-static asn_oer_constraints_t asn_OER_type_J_4_9_constr_1 GCC_NOTUSED = {
- { 1, 1 } /* (4..9) */,
+static asn_oer_constraints_t asn_OER_type_J_4_5_constr_1 GCC_NOTUSED = {
+ { 1, 1 } /* (4..5) */,
-1};
-/*** <<< STAT-DEFS [J-4-9] >>> ***/
+/*** <<< STAT-DEFS [J-4-5] >>> ***/
-static const ber_tlv_tag_t asn_DEF_J_4_9_tags_1[] = {
+static const ber_tlv_tag_t asn_DEF_J_4_5_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
-asn_TYPE_descriptor_t asn_DEF_J_4_9 = {
- "J-4-9",
- "J-4-9",
+asn_TYPE_descriptor_t asn_DEF_J_4_5 = {
+ "J-4-5",
+ "J-4-5",
&asn_OP_NativeInteger,
- J_4_9_constraint,
- asn_DEF_J_4_9_tags_1,
- sizeof(asn_DEF_J_4_9_tags_1)
- /sizeof(asn_DEF_J_4_9_tags_1[0]), /* 1 */
- asn_DEF_J_4_9_tags_1, /* Same as above */
- sizeof(asn_DEF_J_4_9_tags_1)
- /sizeof(asn_DEF_J_4_9_tags_1[0]), /* 1 */
- &asn_OER_type_J_4_9_constr_1,
+ J_4_5_constraint,
+ asn_DEF_J_4_5_tags_1,
+ sizeof(asn_DEF_J_4_5_tags_1)
+ /sizeof(asn_DEF_J_4_5_tags_1[0]), /* 1 */
+ asn_DEF_J_4_5_tags_1, /* Same as above */
+ sizeof(asn_DEF_J_4_5_tags_1)
+ /sizeof(asn_DEF_J_4_5_tags_1[0]), /* 1 */
+ &asn_OER_type_J_4_5_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
-/*** <<< INCLUDES [K-inv] >>> ***/
+/*** <<< INCLUDES [K-1-4] >>> ***/
#include <NativeInteger.h>
-/*** <<< TYPE-DECLS [K-inv] >>> ***/
+/*** <<< TYPE-DECLS [K-1-4] >>> ***/
-typedef long K_inv_t;
+typedef long K_1_4_t;
-/*** <<< FUNC-DECLS [K-inv] >>> ***/
+/*** <<< FUNC-DECLS [K-1-4] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_K_inv;
-asn_struct_free_f K_inv_free;
-asn_struct_print_f K_inv_print;
-asn_constr_check_f K_inv_constraint;
-ber_type_decoder_f K_inv_decode_ber;
-der_type_encoder_f K_inv_encode_der;
-xer_type_decoder_f K_inv_decode_xer;
-xer_type_encoder_f K_inv_encode_xer;
-oer_type_decoder_f K_inv_decode_oer;
-oer_type_encoder_f K_inv_encode_oer;
+extern asn_TYPE_descriptor_t asn_DEF_K_1_4;
+asn_struct_free_f K_1_4_free;
+asn_struct_print_f K_1_4_print;
+asn_constr_check_f K_1_4_constraint;
+ber_type_decoder_f K_1_4_decode_ber;
+der_type_encoder_f K_1_4_encode_der;
+xer_type_decoder_f K_1_4_decode_xer;
+xer_type_encoder_f K_1_4_encode_xer;
+oer_type_decoder_f K_1_4_decode_oer;
+oer_type_encoder_f K_1_4_encode_oer;
-/*** <<< CODE [K-inv] >>> ***/
+/*** <<< CODE [K-1-4] >>> ***/
int
-K_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+K_1_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
@@ -825,7 +825,7 @@
value = *(const long *)sptr;
- if((value >= 4 && value <= 5)) {
+ if((value >= 1 && value <= 4)) {
/* Constraint check succeeded */
return 0;
} else {
@@ -841,29 +841,29 @@
* so here we adjust the DEF accordingly.
*/
-/*** <<< CTDEFS [K-inv] >>> ***/
+/*** <<< CTDEFS [K-1-4] >>> ***/
-static asn_oer_constraints_t asn_OER_type_K_inv_constr_1 GCC_NOTUSED = {
- { 0, 0 },
+static asn_oer_constraints_t asn_OER_type_K_1_4_constr_1 GCC_NOTUSED = {
+ { 1, 1 } /* (1..4) */,
-1};
-/*** <<< STAT-DEFS [K-inv] >>> ***/
+/*** <<< STAT-DEFS [K-1-4] >>> ***/
-static const ber_tlv_tag_t asn_DEF_K_inv_tags_1[] = {
+static const ber_tlv_tag_t asn_DEF_K_1_4_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
-asn_TYPE_descriptor_t asn_DEF_K_inv = {
- "K-inv",
- "K-inv",
+asn_TYPE_descriptor_t asn_DEF_K_1_4 = {
+ "K-1-4",
+ "K-1-4",
&asn_OP_NativeInteger,
- K_inv_constraint,
- asn_DEF_K_inv_tags_1,
- sizeof(asn_DEF_K_inv_tags_1)
- /sizeof(asn_DEF_K_inv_tags_1[0]), /* 1 */
- asn_DEF_K_inv_tags_1, /* Same as above */
- sizeof(asn_DEF_K_inv_tags_1)
- /sizeof(asn_DEF_K_inv_tags_1[0]), /* 1 */
- &asn_OER_type_K_inv_constr_1,
+ K_1_4_constraint,
+ asn_DEF_K_1_4_tags_1,
+ sizeof(asn_DEF_K_1_4_tags_1)
+ /sizeof(asn_DEF_K_1_4_tags_1[0]), /* 1 */
+ asn_DEF_K_1_4_tags_1, /* Same as above */
+ sizeof(asn_DEF_K_1_4_tags_1)
+ /sizeof(asn_DEF_K_1_4_tags_1[0]), /* 1 */
+ &asn_OER_type_K_1_4_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
@@ -989,7 +989,7 @@
value = *(const long *)sptr;
- if(((value == 0) || (value == 5))) {
+ if((value >= 0 && value <= 5)) {
/* Constraint check succeeded */
return 0;
} else {
@@ -1034,31 +1034,31 @@
};
-/*** <<< INCLUDES [N-inv] >>> ***/
+/*** <<< INCLUDES [N-0-5] >>> ***/
#include <NativeInteger.h>
-/*** <<< TYPE-DECLS [N-inv] >>> ***/
+/*** <<< TYPE-DECLS [N-0-5] >>> ***/
-typedef long N_inv_t;
+typedef long N_0_5_t;
-/*** <<< FUNC-DECLS [N-inv] >>> ***/
+/*** <<< FUNC-DECLS [N-0-5] >>> ***/
-extern asn_TYPE_descriptor_t asn_DEF_N_inv;
-asn_struct_free_f N_inv_free;
-asn_struct_print_f N_inv_print;
-asn_constr_check_f N_inv_constraint;
-ber_type_decoder_f N_inv_decode_ber;
-der_type_encoder_f N_inv_encode_der;
-xer_type_decoder_f N_inv_decode_xer;
-xer_type_encoder_f N_inv_encode_xer;
-oer_type_decoder_f N_inv_decode_oer;
-oer_type_encoder_f N_inv_encode_oer;
+extern asn_TYPE_descriptor_t asn_DEF_N_0_5;
+asn_struct_free_f N_0_5_free;
+asn_struct_print_f N_0_5_print;
+asn_constr_check_f N_0_5_constraint;
+ber_type_decoder_f N_0_5_decode_ber;
+der_type_encoder_f N_0_5_encode_der;
+xer_type_decoder_f N_0_5_decode_xer;
+xer_type_encoder_f N_0_5_encode_xer;
+oer_type_decoder_f N_0_5_decode_oer;
+oer_type_encoder_f N_0_5_encode_oer;
-/*** <<< CODE [N-inv] >>> ***/
+/*** <<< CODE [N-0-5] >>> ***/
int
-N_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+N_0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
@@ -1087,29 +1087,29 @@
* so here we adjust the DEF accordingly.
*/
-/*** <<< CTDEFS [N-inv] >>> ***/
+/*** <<< CTDEFS [N-0-5] >>> ***/
-static asn_oer_constraints_t asn_OER_type_N_inv_constr_1 GCC_NOTUSED = {
- { 0, 0 },
+static asn_oer_constraints_t asn_OER_type_N_0_5_constr_1 GCC_NOTUSED = {
+ { 1, 1 } /* (0..5) */,
-1};
-/*** <<< STAT-DEFS [N-inv] >>> ***/
+/*** <<< STAT-DEFS [N-0-5] >>> ***/
-static const ber_tlv_tag_t asn_DEF_N_inv_tags_1[] = {
+static const ber_tlv_tag_t asn_DEF_N_0_5_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
-asn_TYPE_descriptor_t asn_DEF_N_inv = {
- "N-inv",
- "N-inv",
+asn_TYPE_descriptor_t asn_DEF_N_0_5 = {
+ "N-0-5",
+ "N-0-5",
&asn_OP_NativeInteger,
- N_inv_constraint,
- asn_DEF_N_inv_tags_1,
- sizeof(asn_DEF_N_inv_tags_1)
- /sizeof(asn_DEF_N_inv_tags_1[0]), /* 1 */
- asn_DEF_N_inv_tags_1, /* Same as above */
- sizeof(asn_DEF_N_inv_tags_1)
- /sizeof(asn_DEF_N_inv_tags_1[0]), /* 1 */
- &asn_OER_type_N_inv_constr_1,
+ N_0_5_constraint,
+ asn_DEF_N_0_5_tags_1,
+ sizeof(asn_DEF_N_0_5_tags_1)
+ /sizeof(asn_DEF_N_0_5_tags_1[0]), /* 1 */
+ asn_DEF_N_0_5_tags_1, /* Same as above */
+ sizeof(asn_DEF_N_0_5_tags_1)
+ /sizeof(asn_DEF_N_0_5_tags_1[0]), /* 1 */
+ &asn_OER_type_N_0_5_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
@@ -1197,3 +1197,167 @@
0 /* No specifics */
};
+
+/*** <<< INCLUDES [EConstr] >>> ***/
+
+#include <NativeInteger.h>
+
+/*** <<< TYPE-DECLS [EConstr] >>> ***/
+
+typedef long EConstr_t;
+
+/*** <<< FUNC-DECLS [EConstr] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_EConstr;
+asn_struct_free_f EConstr_free;
+asn_struct_print_f EConstr_print;
+asn_constr_check_f EConstr_constraint;
+ber_type_decoder_f EConstr_decode_ber;
+der_type_encoder_f EConstr_encode_der;
+xer_type_decoder_f EConstr_decode_xer;
+xer_type_encoder_f EConstr_encode_xer;
+oer_type_decoder_f EConstr_decode_oer;
+oer_type_encoder_f EConstr_encode_oer;
+
+/*** <<< CODE [EConstr] >>> ***/
+
+int
+EConstr_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+ long value;
+
+ if(!sptr) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: value not given (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ value = *(const long *)sptr;
+
+ if((value >= 1 && value <= 5)) {
+ /* Constraint check succeeded */
+ return 0;
+ } else {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: constraint failed (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+}
+
+/*
+ * This type is implemented using NativeInteger,
+ * so here we adjust the DEF accordingly.
+ */
+
+/*** <<< CTDEFS [EConstr] >>> ***/
+
+static asn_oer_constraints_t asn_OER_type_EConstr_constr_1 GCC_NOTUSED = {
+ { 0, 0 },
+ -1};
+
+/*** <<< STAT-DEFS [EConstr] >>> ***/
+
+static const ber_tlv_tag_t asn_DEF_EConstr_tags_1[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
+};
+asn_TYPE_descriptor_t asn_DEF_EConstr = {
+ "EConstr",
+ "EConstr",
+ &asn_OP_NativeInteger,
+ EConstr_constraint,
+ asn_DEF_EConstr_tags_1,
+ sizeof(asn_DEF_EConstr_tags_1)
+ /sizeof(asn_DEF_EConstr_tags_1[0]), /* 1 */
+ asn_DEF_EConstr_tags_1, /* Same as above */
+ sizeof(asn_DEF_EConstr_tags_1)
+ /sizeof(asn_DEF_EConstr_tags_1[0]), /* 1 */
+ &asn_OER_type_EConstr_constr_1,
+ 0, /* No PER visible constraints */
+ 0, 0, /* No members */
+ 0 /* No specifics */
+};
+
+
+/*** <<< INCLUDES [FConstr] >>> ***/
+
+#include <NativeInteger.h>
+
+/*** <<< TYPE-DECLS [FConstr] >>> ***/
+
+typedef long FConstr_t;
+
+/*** <<< FUNC-DECLS [FConstr] >>> ***/
+
+extern asn_TYPE_descriptor_t asn_DEF_FConstr;
+asn_struct_free_f FConstr_free;
+asn_struct_print_f FConstr_print;
+asn_constr_check_f FConstr_constraint;
+ber_type_decoder_f FConstr_decode_ber;
+der_type_encoder_f FConstr_encode_der;
+xer_type_decoder_f FConstr_decode_xer;
+xer_type_encoder_f FConstr_encode_xer;
+oer_type_decoder_f FConstr_decode_oer;
+oer_type_encoder_f FConstr_encode_oer;
+
+/*** <<< CODE [FConstr] >>> ***/
+
+int
+FConstr_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+ long value;
+
+ if(!sptr) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: value not given (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ value = *(const long *)sptr;
+
+ if((value >= 0 && value <= 4)) {
+ /* Constraint check succeeded */
+ return 0;
+ } else {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: constraint failed (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+}
+
+/*
+ * This type is implemented using NativeInteger,
+ * so here we adjust the DEF accordingly.
+ */
+
+/*** <<< CTDEFS [FConstr] >>> ***/
+
+static asn_oer_constraints_t asn_OER_type_FConstr_constr_1 GCC_NOTUSED = {
+ { 1, 1 } /* (0..4) */,
+ -1};
+
+/*** <<< STAT-DEFS [FConstr] >>> ***/
+
+static const ber_tlv_tag_t asn_DEF_FConstr_tags_1[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
+};
+asn_TYPE_descriptor_t asn_DEF_FConstr = {
+ "FConstr",
+ "FConstr",
+ &asn_OP_NativeInteger,
+ FConstr_constraint,
+ asn_DEF_FConstr_tags_1,
+ sizeof(asn_DEF_FConstr_tags_1)
+ /sizeof(asn_DEF_FConstr_tags_1[0]), /* 1 */
+ asn_DEF_FConstr_tags_1, /* Same as above */
+ sizeof(asn_DEF_FConstr_tags_1)
+ /sizeof(asn_DEF_FConstr_tags_1[0]), /* 1 */
+ &asn_OER_type_FConstr_constr_1,
+ 0, /* No PER visible constraints */
+ 0, 0, /* No members */
+ 0 /* No specifics */
+};
+
diff --git a/tests/tests-asn1c-compiler/50-constraint-OK.asn1 b/tests/tests-asn1c-compiler/50-constraint-OK.asn1
index 62c4fdf..43c9ba4 100644
--- a/tests/tests-asn1c-compiler/50-constraint-OK.asn1
+++ b/tests/tests-asn1c-compiler/50-constraint-OK.asn1
@@ -24,7 +24,7 @@
other-ten Int2 ::= 10
-- G.4.3.4
- ExtensibleExtensions ::= INTEGER ((1..256,...) INTERSECTION (1..256))
+ ExtensibleExtensions ::= INTEGER (1..256) (1..255,...)
Str1 ::= IA5String
Str2 ::= Str1 (SIZE(MIN..20 | 25..30))
diff --git a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints
index aa51aa8..d77822b 100644
--- a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints
+++ b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints
Binary files differ
diff --git a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
index f18a21b..420e914 100644
--- a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
+++ b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
@@ -405,7 +405,7 @@
return -1;
}
- if((value >= 1 && value <= 256)) {
+ if((value >= 1 && value <= 255)) {
/* Constraint check succeeded */
return 0;
} else {
diff --git a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
index 6499e91..f198842 100644
--- a/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
+++ b/tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
@@ -427,7 +427,7 @@
value = *(const long *)sptr;
- if((value >= 1 && value <= 256)) {
+ if((value >= 1 && value <= 255)) {
/* Constraint check succeeded */
return 0;
} else {
@@ -446,7 +446,7 @@
/*** <<< CTDEFS [ExtensibleExtensions] >>> ***/
static asn_per_constraints_t asn_PER_type_ExtensibleExtensions_constr_1 GCC_NOTUSED = {
- { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 256 } /* (1..256,...) */,
+ { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 255 } /* (1..255,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};