Commit 2a744a74 authored by Lev Walkin's avatar Lev Walkin

Behavior of -fnative-types made default; old behavior saved under -fwide-types

parent 11c9a8c7
???:
* Made -fskeletons-copy a default one; removed cmdline option.
* Updated asn1c-usage.pdf.
* Made -fskeletons-copy a default option; removed cmdline option.
* Made -fnative-types a default options; removed cmdline option.
Added -fwide-types for backwards compatibility.
0.9.24: 2013-Mar-16
......
......@@ -23,5 +23,5 @@ noinst_HEADERS = sys-common.h
dist_man1_MANS = asn1c.1 unber.1 enber.1
dist_check_SCRIPTS = check-xxber.sh check-parsing.sh
TESTS = $(check_SCRIPTS)
TESTS = $(dist_check_SCRIPTS)
CLEANFILES = .check-xxber.*.tmp .check-parsing.*.tmp
......@@ -36,7 +36,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = asn1c$(EXEEXT) unber$(EXEEXT) enber$(EXEEXT)
TESTS =
subdir = asn1c
DIST_COMMON = README $(dist_check_SCRIPTS) $(dist_man1_MANS) \
$(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in
......@@ -282,6 +281,7 @@ asn1c_LDADD = \
noinst_HEADERS = sys-common.h
dist_man1_MANS = asn1c.1 unber.1 enber.1
dist_check_SCRIPTS = check-xxber.sh check-parsing.sh
TESTS = $(dist_check_SCRIPTS)
CLEANFILES = .check-xxber.*.tmp .check-parsing.*.tmp
all: all-recursive
......
......@@ -26,7 +26,7 @@ and other encoding rules.
.br
\fB\-fbless-SIZE \-fcompound-names \-findirect-choice
.BI "\-fknown-extern-type="<name>
\fB\-fnative-types \-fno-constraints \-fno-include-deps \-funnamed-unions
\fB\-fno-constraints \-fno-include-deps \-funnamed-unions \-fwide-types
.TP
\fICodecs Generation Options\fR
.br
......@@ -98,10 +98,6 @@ to prevent circular references.
Pretend the specified type is known. The compiler will assume the target
language source files for the given type have been provided manually.
.TP
.B \-fnative-types
Use the native machine's data types (int, double) whenever possible,
instead of the compound INTEGER_t, ENUMERATED_t and REAL_t types.
.TP
.B \-fno-constraints
Do not generate ASN.1 subtype constraint checking code. This may make a shorter executable.
.TP
......@@ -111,6 +107,10 @@ Helps prevent namespace collisions.
.TP
.B \-funnamed-unions
Enable unnamed unions in the definitions of target language's structures.
.TP
.B \-fwide-types
Use the unbounded size data types (INTEGER_t, ENUMERATED_t, REAL_t) by default,
instead of the native machine's data types (long, double).
.SH CODECS GENERATION OPTIONS
.TP
.B \-gen-PER
......
......@@ -92,7 +92,10 @@ main(int ac, char **av) {
ret = asn1f_make_known_external_type(known_type);
assert(ret == 0 || errno == EEXIST);
} else if(strcmp(optarg, "native-types") == 0) {
asn1_compiler_flags |= A1C_USE_NATIVE_TYPES;
fprintf(stderr, "-f%s: Deprecated option\n", optarg);
asn1_compiler_flags &= ~A1C_USE_WIDE_TYPES;
} else if(strcmp(optarg, "wide-types") == 0) {
asn1_compiler_flags |= A1C_USE_WIDE_TYPES;
} else if(strcmp(optarg, "no-constraints") == 0) {
asn1_compiler_flags |= A1C_NO_CONSTRAINTS;
} else if(strcmp(optarg, "no-include-deps") == 0) {
......@@ -103,6 +106,7 @@ main(int ac, char **av) {
asn1_compiler_flags |= A1C_UNNAMED_UNIONS;
} else if(strcmp(optarg, "skeletons-copy") == 0) {
fprintf(stderr, "-f%s: Deprecated option\n", optarg);
asn1_compiler_flags &= ~A1C_LINK_SKELETONS;
} else if(strcmp(optarg, "link-skeletons") == 0) {
asn1_compiler_flags |= A1C_LINK_SKELETONS;
} else {
......@@ -460,10 +464,10 @@ usage(const char *av0) {
" -findirect-choice Compile members of CHOICE as indirect pointers\n"
" -fincludes-quoted Generate #includes in \"double\" instead of <angle> quotes\n"
" -fknown-extern-type=<name> Pretend the specified type is known\n"
" -fnative-types Use \"long\" instead of INTEGER_t whenever possible, etc.\n"
" -fno-constraints Do not generate constraint checking code\n"
" -fno-include-deps Do not generate courtesy #includes for dependencies\n"
" -funnamed-unions Enable unnamed unions in structures\n"
" -fwide-types Use INTEGER_t instead of \"long\" by default, etc.\n"
"\n"
" -gen-PER Generate PER support code\n"
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* Mode of operation:
* Each of the *.in files is XER-decoded, then converted into DER,
* then decoded from DER and encoded into XER again. The resulting
* stream is compared with the corresponding .out file.
* stream is checked against rules specified in ../data-70/README file.
*/
#undef NDEBUG
#include <stdio.h>
......@@ -11,7 +11,6 @@
#include <unistd.h> /* for chdir(2) */
#include <string.h>
#include <dirent.h>
#include <ctype.h> /* for isspace(3) */
#include <assert.h>
#include <errno.h>
......@@ -19,6 +18,8 @@
enum expectation {
EXP_OK, /* Encoding/decoding must succeed */
EXP_CXER_EXACT, /* Encoding/decoding using CXER must be exact */
EXP_CXER_DIFF, /* Encoding/decoding using CXER must be different */
EXP_BROKEN, /* Decoding must fail */
EXP_DIFFERENT, /* Reconstruction will yield different encoding */
};
......@@ -35,8 +36,12 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
b = buf + buf_offset;
bend = b + size;
fprintf(stderr, "=> [");
for(; b < bend; b++)
for(; b < bend; b++) {
if(*b >= 32 && *b < 127 && *b != '%')
fprintf(stderr, "%c", *b);
else
fprintf(stderr, "%%%02x", *b);
}
fprintf(stderr, "]:%ld\n", (long)size);
buf_offset += size;
return 0;
......@@ -45,6 +50,7 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
enum der_or_xer {
AS_DER,
AS_XER,
AS_CXER,
};
static void
......@@ -65,6 +71,10 @@ save_object_as(PDU_t *st, enum der_or_xer how) {
rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC,
_buf_writer, 0);
break;
case AS_CXER:
rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL,
_buf_writer, 0);
break;
}
if (rval.encoded == -1) {
fprintf(stderr,
......@@ -188,6 +198,7 @@ xer_encoding_equal(char *obuf, size_t osize, char *nbuf, size_t nsize) {
static void
process_XER_data(enum expectation expectation, char *fbuf, int size) {
PDU_t *st;
int ret;
st = load_object_from(expectation, fbuf, size, AS_XER);
if(!st) return;
......@@ -197,7 +208,10 @@ process_XER_data(enum expectation expectation, char *fbuf, int size) {
st = load_object_from(expectation, buf, buf_offset, AS_DER);
assert(st);
save_object_as(st, AS_XER);
save_object_as(st,
(expectation == EXP_CXER_EXACT
|| expectation == EXP_CXER_DIFF)
? AS_CXER : AS_XER);
fprintf(stderr, "=== original ===\n");
fwrite(fbuf, 1, size, stderr);
fprintf(stderr, "=== re-encoded ===\n");
......@@ -211,6 +225,16 @@ process_XER_data(enum expectation expectation, char *fbuf, int size) {
case EXP_BROKEN:
assert(!xer_encoding_equal(fbuf, size, buf, buf_offset));
break;
case EXP_CXER_EXACT:
buf[buf_offset++] = '\n';
assert(size == buf_offset);
assert(memcmp(fbuf, buf, size) == 0);
break;
case EXP_CXER_DIFF:
buf[buf_offset++] = '\n';
assert(size != buf_offset
|| memcmp(fbuf, buf, size));
break;
case EXP_OK:
assert(xer_encoding_equal(fbuf, size, buf, buf_offset));
break;
......@@ -237,10 +261,12 @@ process(const char *fname) {
switch(ext[-1]) {
case 'B': /* The file is intentionally broken */
expectation = EXP_BROKEN; break;
case 'X':
case 'D': /* Reconstructing should yield different data */
expectation = EXP_DIFFERENT; break;
case 'E':
case 'E': /* Byte to byte exact reconstruction */
expectation = EXP_CXER_EXACT; break;
case 'X': /* Should fail byte-to-byte comparison */
expectation = EXP_CXER_DIFF; break;
default:
expectation = EXP_OK; break;
}
......@@ -250,7 +276,7 @@ process(const char *fname) {
ret = chdir("../data-70");
assert(ret == 0);
fp = fopen(fname, "r");
ret = chdir("../test-check-70.-fnative-types");
ret = chdir("../test-check-70.-fwide-types");
assert(ret == 0);
assert(fp);
......@@ -273,8 +299,10 @@ main() {
/* Process a specific test file */
str = getenv("DATA_70_FILE");
if(str && strncmp(str, "data-70-", 8) == 0)
if(str && strncmp(str, "data-70-", 8) == 0) {
process(str);
return 0;
}
dir = opendir("../data-70");
assert(dir);
......
......@@ -2,7 +2,7 @@
* Mode of operation:
* Each of the *.in files is XER-decoded, then converted into DER,
* then decoded from DER and encoded into XER again. The resulting
* stream is checked against rules specified in ../data-70/README file.
* stream is compared with the corresponding .out file.
*/
#undef NDEBUG
#include <stdio.h>
......@@ -11,6 +11,7 @@
#include <unistd.h> /* for chdir(2) */
#include <string.h>
#include <dirent.h>
#include <ctype.h> /* for isspace(3) */
#include <assert.h>
#include <errno.h>
......@@ -18,8 +19,6 @@
enum expectation {
EXP_OK, /* Encoding/decoding must succeed */
EXP_CXER_EXACT, /* Encoding/decoding using CXER must be exact */
EXP_CXER_DIFF, /* Encoding/decoding using CXER must be different */
EXP_BROKEN, /* Decoding must fail */
EXP_DIFFERENT, /* Reconstruction will yield different encoding */
};
......@@ -36,12 +35,8 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
b = buf + buf_offset;
bend = b + size;
fprintf(stderr, "=> [");
for(; b < bend; b++) {
if(*b >= 32 && *b < 127 && *b != '%')
for(; b < bend; b++)
fprintf(stderr, "%c", *b);
else
fprintf(stderr, "%%%02x", *b);
}
fprintf(stderr, "]:%ld\n", (long)size);
buf_offset += size;
return 0;
......@@ -50,7 +45,6 @@ _buf_writer(const void *buffer, size_t size, void *app_key) {
enum der_or_xer {
AS_DER,
AS_XER,
AS_CXER,
};
static void
......@@ -71,10 +65,6 @@ save_object_as(PDU_t *st, enum der_or_xer how) {
rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC,
_buf_writer, 0);
break;
case AS_CXER:
rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL,
_buf_writer, 0);
break;
}
if (rval.encoded == -1) {
fprintf(stderr,
......@@ -198,7 +188,6 @@ xer_encoding_equal(char *obuf, size_t osize, char *nbuf, size_t nsize) {
static void
process_XER_data(enum expectation expectation, char *fbuf, int size) {
PDU_t *st;
int ret;
st = load_object_from(expectation, fbuf, size, AS_XER);
if(!st) return;
......@@ -208,10 +197,7 @@ process_XER_data(enum expectation expectation, char *fbuf, int size) {
st = load_object_from(expectation, buf, buf_offset, AS_DER);
assert(st);
save_object_as(st,
(expectation == EXP_CXER_EXACT
|| expectation == EXP_CXER_DIFF)
? AS_CXER : AS_XER);
save_object_as(st, AS_XER);
fprintf(stderr, "=== original ===\n");
fwrite(fbuf, 1, size, stderr);
fprintf(stderr, "=== re-encoded ===\n");
......@@ -225,16 +211,6 @@ process_XER_data(enum expectation expectation, char *fbuf, int size) {
case EXP_BROKEN:
assert(!xer_encoding_equal(fbuf, size, buf, buf_offset));
break;
case EXP_CXER_EXACT:
buf[buf_offset++] = '\n';
assert(size == buf_offset);
assert(memcmp(fbuf, buf, size) == 0);
break;
case EXP_CXER_DIFF:
buf[buf_offset++] = '\n';
assert(size != buf_offset
|| memcmp(fbuf, buf, size));
break;
case EXP_OK:
assert(xer_encoding_equal(fbuf, size, buf, buf_offset));
break;
......@@ -261,12 +237,10 @@ process(const char *fname) {
switch(ext[-1]) {
case 'B': /* The file is intentionally broken */
expectation = EXP_BROKEN; break;
case 'X':
case 'D': /* Reconstructing should yield different data */
expectation = EXP_DIFFERENT; break;
case 'E': /* Byte to byte exact reconstruction */
expectation = EXP_CXER_EXACT; break;
case 'X': /* Should fail byte-to-byte comparison */
expectation = EXP_CXER_DIFF; break;
case 'E':
default:
expectation = EXP_OK; break;
}
......@@ -299,10 +273,8 @@ main() {
/* Process a specific test file */
str = getenv("DATA_70_FILE");
if(str && strncmp(str, "data-70-", 8) == 0) {
if(str && strncmp(str, "data-70-", 8) == 0)
process(str);
return 0;
}
dir = opendir("../data-70");
assert(dir);
......
No preview for this file type
......@@ -64,7 +64,7 @@
}
\lstnewenvironment{codesample}[1][]{\lstset{style=listingStyle,language=C,#1}}{}
\lstnewenvironment{bash}[1][]{\lstset{style=listingStyle,morekeywords={-fnative-types},language=bash,#1}}{}
\lstnewenvironment{bash}[1][]{\lstset{style=listingStyle,language=bash,#1}}{}
\lstnewenvironment{asn}[1][]{\lstset{style=listingStyle,language=asn1,#1}}{}
\def\code{lstinline}
......@@ -155,12 +155,6 @@ to find out about \textbf{-P} and \textbf{-R} options.%
\begin{bash}
asn1c %\emph{<modules.asn1>}%
\end{bash}
The asn1c takes a number of command line options,
such as an option to produce native long types
for integers instead of infinite width INTEGER\_t structures:
\begin{bash}
asn1c %\textbf{-fnative-types} \emph{<modules.asn1>}%
\end{bash}
If several ASN.1 modules contain interdependencies, all of the files
must be specified altogether:
\begin{bash}
......@@ -169,7 +163,7 @@ asn1c %\emph{<module1.asn1> <module2.asn1> ...}%
The compiler \textbf{-E} and \textbf{-EF} options are used for testing
the parser and the semantic fixer, respectively. These options will
instruct the compiler to dump out the parsed (and fixed, if \textbf{-F}
is involved) ASN.1 specification as it was ``understood''
is involved) ASN.1 specification as it was understood
by the compiler. It might be useful to check whether a particular
syntactic construct is properly supported by the compiler.
\begin{bash}
......@@ -188,6 +182,7 @@ Print the compiled output instead of creating multiple source files:
asn1c %\textbf{-P} \emph{<module-to-compile-and-print.asn1>}%
\end{bash}
\clearpage{}
\section{Recognizing compiler output}
The asn1c compiler produces a number of files:
......@@ -207,12 +202,12 @@ or the plain `make` utility. Just rename it into \emph{Makefile}.
\end{itemize}
It is possible to compile everything with just a couple of instructions:
\begin{bash}
asn1c -fnative-types -pdu=%\emph{Rectangle}% *.asn1
asn1c -pdu=%\emph{Rectangle}% *.asn1
make -f Makefile.am.sample # If you use `make`
\end{bash}
or
\begin{bash}
asn1c -fnative-types *.asn1
asn1c *.asn1
cc -I. -DPDU=%\emph{Rectangle}% -o rectangle.exe *.c # ... or like this
\end{bash}
Refer to the Chapter \vref{cha:Step-by-step-examples} for a sample
......@@ -261,15 +256,12 @@ to prevent circular references. }\\
{-fknown-extern-type=}\emph{<name>} & {\small Pretend the specified type is known. The compiler will assume
the target language source files for the given type have been provided
manually. }\\
{-fnative-types} & {\small Use the native machine's data types (long, double) whenever
possible, instead of the compound INTEGER\_t, ENUMERATED\_t and REAL\_t
types. }\\
{-fno-constraints} & {\small Do not generate ASN.1 subtype constraint checking code. This
may produce a shorter executable.}\\
{-fno-include-deps} & {\small Do not generate courtesy \#include lines for non-critical
dependencies.}\\
{-funnamed-unions} & {\small Enable unnamed unions in the definitions of target language's
structures.}\\\\
{-funnamed-unions} & {\small Enable unnamed unions in the definitions of target language's structures.}\\
{-fwide-types} & {\small Use the wide integer types (INTEGER\_t, REAL\_t) instead of machine's native data types (long, double). }\\\\
\textbf{Codecs Generation Options} & \textbf{Description}\\
\midrule
{-gen-PER} & {\small Generate Packed Encoding Rules (PER) support code.}\\
......@@ -702,7 +694,7 @@ END
\item Compile it into the set of .c and .h files using asn1c compiler \cite{ASN1C}:
\begin{bash}
asn1c -fnative-types %\textbf{rectangle.asn1}%
asn1c %\textbf{rectangle.asn1}%
\end{bash}
\item Alternatively, use the Online ASN.1 compiler \cite{AONL} by uploading
the \textbf{rectangle.asn1} file into the Web form and unpacking the
......@@ -799,7 +791,7 @@ END
\item Compile it into the set of .c and .h files using asn1c compiler \cite{ASN1C}:
\begin{bash}
asn1c -fnative-types %\textbf{rectangle.asn1}%
asn1c %\textbf{rectangle.asn1}%
\end{bash}
\item Alternatively, use the Online ASN.1 compiler \cite{AONL} by uploading
the \textbf{rectangle.asn1} file into the Web form and unpacking the
......
......@@ -78,7 +78,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
produce_st = 1;
break;
case ASN_BASIC_REAL:
if(!(arg->flags & A1C_USE_NATIVE_TYPES))
if((arg->flags & A1C_USE_WIDE_TYPES))
produce_st = 1;
break;
case ASN_BASIC_BIT_STRING:
......@@ -656,9 +656,7 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang
}
break;
case ASN_BASIC_REAL:
if(arg->flags & A1C_USE_NATIVE_TYPES) {
OUT("value = *(const double *)sptr;\n");
} else {
if(arg->flags & A1C_USE_WIDE_TYPES) {
OUT("if(asn_REAL2double(st, &value)) {\n");
INDENT(+1);
OUT("_ASN_CTFAIL(app_key, td, sptr,\n");
......@@ -667,6 +665,8 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang
OUT("return -1;\n");
INDENT(-1);
OUT("}\n");
} else {
OUT("value = *(const double *)sptr;\n");
}
break;
case ASN_BASIC_BOOLEAN:
......
......@@ -16,7 +16,7 @@ static char *res_kwd[] = {
"union", "unsigned", "void", "volatile", "while",
"_Bool", "_Complex", "_Imaginary",
/* C++ */
"explicit", "bool", "mutable",
"class", "explicit", "bool", "mutable",
"template", "typeid", "typename", "and", "and_eq",
"or", "or_eq", "xor", "xor_eq", "not", "not_eq",
"bitor", "compl", "bitand",
......@@ -214,7 +214,7 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
case ASN_BASIC_ENUMERATED:
case ASN_BASIC_REAL:
if((expr->expr_type == ASN_BASIC_REAL
&& (arg->flags & A1C_USE_NATIVE_TYPES))
&& !(arg->flags & A1C_USE_WIDE_TYPES))
|| asn1c_type_fits_long(arg, expr)) {
switch(_format) {
case TNF_CTYPE:
......@@ -333,8 +333,8 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
}
if(!expr->combined_constraints)
return (arg->flags & A1C_USE_NATIVE_TYPES)
? FL_FORCED : FL_NOTFIT;
return (arg->flags & A1C_USE_WIDE_TYPES)
? FL_NOTFIT : FL_PRESUMED;
/*
* Second, if -fbless-SIZE is given, the (SIZE()) constraint may be
......@@ -366,8 +366,8 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
|| range->not_PER_visible
) {
asn1constraint_range_free(range);
return (arg->flags & A1C_USE_NATIVE_TYPES)
? FL_FORCED : FL_NOTFIT;
return (arg->flags & A1C_USE_WIDE_TYPES)
? FL_NOTFIT : FL_PRESUMED;
}
left = range->left;
......@@ -391,10 +391,10 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
&& (right.value > RIGHTMAX || right.value < LEFTMIN))
return FL_NOTFIT;
/* If the range is open, fits only if -fnative-types is given */
/* If the range is open, fits only unless -fwide-types is given */
if(left.type != ARE_VALUE || right.type != ARE_VALUE) {
return (arg->flags & A1C_USE_NATIVE_TYPES)
? FL_FORCED : FL_NOTFIT;
return (arg->flags & A1C_USE_WIDE_TYPES)
? FL_NOTFIT : FL_PRESUMED;
}
return FL_FITS_SIGNED;
......
......@@ -32,13 +32,13 @@ char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format);
* FL_NOTFIT: No, it cannot be represented using long.
* FL_FITS_SIGNED: It can be represented using signed long.
* FL_FITS_UNSIGN: It can be represented using unsigned long.
* FL_FORCED: Probably can't, but -fnative-types is in force.
* FL_PRESUMED: Probably can't, but -fwide-types is not in effect.
*/
enum asn1c_fitslong_e {
FL_NOTFIT,
FL_FITS_SIGNED,
FL_FITS_UNSIGN,
FL_FORCED,
FL_PRESUMED,
};
enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr);
......
......@@ -20,9 +20,9 @@ enum asn1c_flags {
*/
A1C_OMIT_SUPPORT_CODE = 0x0004,
/*
* Use native data types instead of INTEGER_t et al.
* Use wide types by default (INTEGER_t etc) instead of native/long.
*/
A1C_USE_NATIVE_TYPES = 0x0008,
A1C_USE_WIDE_TYPES = 0x0008,
/*
* Do not use C99 extensions.
*/
......
......@@ -8,7 +8,7 @@
#include <UTF8String.h>
#include <BMPString.h>
#include <UniversalString.h>
#include <REAL.h>
#include <NativeReal.h>
#include <OBJECT_IDENTIFIER.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
......@@ -55,7 +55,7 @@ typedef struct PDU {
UniversalString_t *us_cs /* OPTIONAL */;
UniversalString_t *us_ce /* OPTIONAL */;
UniversalString_t *us_ir /* OPTIONAL */;
REAL_t *real /* OPTIONAL */;
double *real /* OPTIONAL */;
OBJECT_IDENTIFIER_t *oid /* OPTIONAL */;
/* Context for parsing across buffer boundaries */
......@@ -1492,7 +1492,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
{ ATF_POINTER, 2, offsetof(struct PDU, real),
.tag = (ASN_TAG_CLASS_CONTEXT | (29 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_REAL,
.type = &asn_DEF_NativeReal,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
......
<!-- XML DTD generated by asn1c-0.9.22 -->
<!-- XML DTD generated by asn1c-0.9.24 -->
<!-- ASN.1 module
ModuleBitStringConstraint { iso org(3) dod(6) internet(1) private(4)
......
......@@ -222,7 +222,7 @@ asn_TYPE_descriptor_t asn_DEF_Singleton = {
/*** <<< INCLUDES [PDU-2] >>> ***/
#include <INTEGER.h>
#include <NativeInteger.h>
#include <constr_CHOICE.h>
/*** <<< DEPS [PDU-2] >>> ***/
......@@ -240,13 +240,13 @@ typedef enum PDU_2_PR {
typedef struct PDU_2 {
PDU_2_PR present;
union PDU_2_u {
INTEGER_t main;
long main;
/*
* This type is extensible,
* possible extensions are below.
*/
INTEGER_t ext1;
INTEGER_t ext0;
long ext1;
long ext0;
} choice;
/* Context for parsing across buffer boundaries */
......@@ -271,7 +271,7 @@ static asn_TYPE_member_t asn_MBR_PDU_2_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.main),
.tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
......@@ -280,7 +280,7 @@ static asn_TYPE_member_t asn_MBR_PDU_2_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext1),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
......@@ -289,7 +289,7 @@ static asn_TYPE_member_t asn_MBR_PDU_2_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext0),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
......
......@@ -27,7 +27,6 @@ extern asn_TYPE_descriptor_t asn_DEF_T;
static int
unsigned32_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
unsigned long value;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
......@@ -36,7 +35,6 @@ unsigned32_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
value = *(const unsigned long *)sptr;
/* Constraint check succeeded */
return 0;
......@@ -280,7 +278,6 @@ memb_full32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int
memb_unsigned32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
unsigned long value;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
......@@ -289,7 +286,6 @@ memb_unsigned32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
value = *(const unsigned long *)sptr;
/* Constraint check succeeded */
return 0;
......
......@@ -589,7 +589,7 @@ asn_TYPE_descriptor_t asn_DEF_VariablePart = {
/*** <<< INCLUDES [ActionItem] >>> ***/
#include <ENUMERATED.h>
#include <NativeEnumerated.h>
#include <BOOLEAN.h>
#include <VisibleString.h>
#include <asn_SET_OF.h>
......@@ -610,7 +610,7 @@ typedef enum accept_as {
/*** <<< TYPE-DECLS [ActionItem] >>> ***/
typedef struct ActionItem {
ENUMERATED_t accept_as;
long accept_as;
struct notify {
BOOLEAN_t critical;
struct email {
......@@ -647,29 +647,29 @@ static int
accept_as_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
/* Replace with underlying type checker */
td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
td->check_constraints = asn_DEF_NativeEnumerated.check_constraints;
return td->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
* This type is implemented using ENUMERATED,
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static void
accept_as_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_ENUMERATED.free_struct;
td->print_struct = asn_DEF_ENUMERATED.print_struct;
td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
td->free_struct = asn_DEF_NativeEnumerated.free_struct;
td->print_struct = asn_DEF_NativeEnumerated.print_struct;
td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder;
td->der_encoder = asn_DEF_NativeEnumerated.der_encoder;
td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder;
td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder;
td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder;
td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder;
if(!td->per_constraints)
td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
td->elements = asn_DEF_ENUMERATED.elements;
td->elements_count = asn_DEF_ENUMERATED.elements_count;
/* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
td->per_constraints = asn_DEF_NativeEnumerated.per_constraints;
td->elements = asn_DEF_NativeEnumerated.elements;
td->elements_count = asn_DEF_NativeEnumerated.elements_count;
/* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */
}
static void
......
......@@ -239,14 +239,14 @@ struct Choice_1;
typedef struct Choice_1 {
Choice_1_PR present;
union Choice_1_u {
struct Choice_1 *and;
struct or {
struct Choice_1 *And;
struct Or {
A_SET_OF(struct Choice_1) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} or;
struct Choice_1 *not;
} Or;
struct Choice_1 *Not;
INTEGER_t other;
} choice;
......@@ -280,8 +280,8 @@ static ber_tlv_tag_t asn_DEF_or_tags_3[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_SET_OF_specifics_t asn_SPC_or_specs_3 = {
sizeof(struct or),
offsetof(struct or, _asn_ctx),
sizeof(struct Or),
offsetof(struct Or, _asn_ctx),
2, /* XER encoding is XMLValueList */
};
static /* Use -fall-defs-global to expose */
......@@ -310,7 +310,7 @@ asn_TYPE_descriptor_t asn_DEF_or_3 = {
};
static asn_TYPE_member_t asn_MBR_Choice_1_1[] = {
{ ATF_POINTER, 0, offsetof(struct Choice_1, choice.and),
{ ATF_POINTER, 0, offsetof(struct Choice_1, choice.And),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = +1, /* EXPLICIT tag at current level */
.type = &asn_DEF_Choice_1,
......@@ -319,7 +319,7 @@ static asn_TYPE_member_t asn_MBR_Choice_1_1[] = {
.default_value = 0,
.name = "and"
},
{ ATF_NOFLAGS, 0, offsetof(struct Choice_1, choice.or),
{ ATF_NOFLAGS, 0, offsetof(struct Choice_1, choice.Or),
.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
.tag_mode = 0,
.type = &asn_DEF_or_3,
......@@ -328,7 +328,7 @@ static asn_TYPE_member_t asn_MBR_Choice_1_1[] = {
.default_value = 0,
.name = "or"
},
{ ATF_POINTER, 0, offsetof(struct Choice_1, choice.not),
{ ATF_POINTER, 0, offsetof(struct Choice_1, choice.Not),
.tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
.tag_mode = +1, /* EXPLICIT tag at current level */
.type = &asn_DEF_Choice_1,
......
......@@ -3515,7 +3515,7 @@ typedef struct Sequence {
Int1_t *int1_c /* DEFAULT 3 */;
Int4_t int4;
Int4_t int4_c;
BOOLEAN_t *bool /* DEFAULT 1 */;
BOOLEAN_t *Bool /* DEFAULT 1 */;
ENUMERATED_t enum_c;
NULL_t *null /* OPTIONAL */;
/*
......@@ -3818,7 +3818,7 @@ static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
.default_value = 0,
.name = "int4-c"
},
{ ATF_POINTER, 1, offsetof(struct Sequence, bool),
{ ATF_POINTER, 1, offsetof(struct Sequence, Bool),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
.tag_mode = 0,
.type = &asn_DEF_BOOLEAN,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -549,11 +549,11 @@ asn_TYPE_descriptor_t asn_DEF_OK_Integer4 = {
/*** <<< INCLUDES [NO-Integer5] >>> ***/
#include <INTEGER.h>
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [NO-Integer5] >>> ***/
typedef INTEGER_t NO_Integer5_t;
typedef long NO_Integer5_t;
/*** <<< FUNC-DECLS [NO-Integer5] >>> ***/
......@@ -571,7 +571,6 @@ xer_type_encoder_f NO_Integer5_encode_xer;
int
NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const INTEGER_t *st = (const INTEGER_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
......@@ -586,29 +585,29 @@ NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
}
/* Replace with underlying type checker */
td->check_constraints = asn_DEF_INTEGER.check_constraints;
td->check_constraints = asn_DEF_NativeInteger.check_constraints;
return td->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
* This type is implemented using INTEGER,
* This type is implemented using NativeInteger,
* so here we adjust the DEF accordingly.
*/
static void
NO_Integer5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_INTEGER.free_struct;
td->print_struct = asn_DEF_INTEGER.print_struct;
td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
td->der_encoder = asn_DEF_INTEGER.der_encoder;
td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
td->free_struct = asn_DEF_NativeInteger.free_struct;
td->print_struct = asn_DEF_NativeInteger.print_struct;
td->ber_decoder = asn_DEF_NativeInteger.ber_decoder;
td->der_encoder = asn_DEF_NativeInteger.der_encoder;
td->xer_decoder = asn_DEF_NativeInteger.xer_decoder;
td->xer_encoder = asn_DEF_NativeInteger.xer_encoder;
td->uper_decoder = asn_DEF_NativeInteger.uper_decoder;
td->uper_encoder = asn_DEF_NativeInteger.uper_encoder;
if(!td->per_constraints)
td->per_constraints = asn_DEF_INTEGER.per_constraints;
td->elements = asn_DEF_INTEGER.elements;
td->elements_count = asn_DEF_INTEGER.elements_count;
td->specifics = asn_DEF_INTEGER.specifics;
td->per_constraints = asn_DEF_NativeInteger.per_constraints;
td->elements = asn_DEF_NativeInteger.elements;
td->elements_count = asn_DEF_NativeInteger.elements_count;
td->specifics = asn_DEF_NativeInteger.specifics;
}
void
......
......@@ -614,7 +614,7 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = {
/*** <<< INCLUDES [Set] >>> ***/
#include <asn_SET_OF.h>
#include <INTEGER.h>
#include <NativeInteger.h>
#include <constr_SEQUENCE.h>
#include <constr_SET_OF.h>
......@@ -627,7 +627,7 @@ struct Sequence;
typedef struct Set {
A_SET_OF(struct Member {
INTEGER_t Int;
long Int;
struct Set *set;
struct Sequence *seq;
struct Set *set2 /* OPTIONAL */;
......@@ -660,7 +660,7 @@ static asn_TYPE_member_t asn_MBR_Member_2[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Member, Int),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = 0,
......@@ -793,7 +793,7 @@ asn_TYPE_descriptor_t asn_DEF_Set = {
/*** <<< INCLUDES [Sequence] >>> ***/
#include <INTEGER.h>
#include <NativeInteger.h>
#include <constr_SEQUENCE.h>
/*** <<< FWD-DECLS [Sequence] >>> ***/
......@@ -804,13 +804,13 @@ struct Set;
/*** <<< TYPE-DECLS [Sequence] >>> ***/
typedef struct Sequence {
INTEGER_t a;
long a;
struct Sequence *seq /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
INTEGER_t *b;
long *b;
struct Set *set /* OPTIONAL */;
/* Context for parsing across buffer boundaries */
......@@ -832,7 +832,7 @@ static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Sequence, a),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = 0,
......@@ -850,7 +850,7 @@ static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
{ ATF_POINTER, 2, offsetof(struct Sequence, b),
.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = 0,
......
......@@ -45,7 +45,7 @@ typedef struct Choice {
* This type is extensible,
* possible extensions are below.
*/
BOOLEAN_t bool;
BOOLEAN_t Bool;
} choice;
/* Context for parsing across buffer boundaries */
......@@ -143,7 +143,7 @@ static asn_TYPE_member_t asn_MBR_Choice_1[] = {
.default_value = 0,
.name = "ch"
},
{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bool),
{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
.tag_mode = 0,
.type = &asn_DEF_BOOLEAN,
......
......@@ -5,7 +5,7 @@
#include <BIT_STRING.h>
#include <BOOLEAN.h>
#include <NULL.h>
#include <INTEGER.h>
#include <NativeInteger.h>
#include <constr_CHOICE.h>
/*** <<< DEPS [Choice] >>> ***/
......@@ -35,7 +35,7 @@ typedef struct Choice {
ch_PR present;
union Choice__ch_u {
NULL_t null;
INTEGER_t Int;
long Int;
} choice;
/* Context for parsing across buffer boundaries */
......@@ -45,7 +45,7 @@ typedef struct Choice {
* This type is extensible,
* possible extensions are below.
*/
BOOLEAN_t bool;
BOOLEAN_t Bool;
} choice;
/* Context for parsing across buffer boundaries */
......@@ -84,7 +84,7 @@ static asn_TYPE_member_t asn_MBR_ch_4[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ch, choice.Int),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
.tag_mode = 0,
.type = &asn_DEF_INTEGER,
.type = &asn_DEF_NativeInteger,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
......@@ -158,7 +158,7 @@ static asn_TYPE_member_t asn_MBR_Choice_1[] = {
.default_value = 0,
.name = "ch"
},
{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bool),
{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
.tag_mode = 0,
.type = &asn_DEF_BOOLEAN,
......
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