Commit 7d5d9303 authored by Lev Walkin's avatar Lev Walkin

more precise OER and PER code bundling

parent 30566d13
#include "asn1c_internal.h"
#include "asn1c_compat.h"
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
/* Normally file permissions are (DEFFILEMODE & ~umask(2)) */
#ifndef DEFFILEMODE /* Normally in <sys/stat.h> */
......
#include "asn1c_internal.h"
#include "asn1c_fdeps.h"
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
static asn1c_fdeps_t *asn1c_new_dep(const char *filename);
static int asn1c_dep_add(asn1c_fdeps_t *deps, asn1c_fdeps_t *d);
static asn1c_dep_filename *asn1c_new_dep_filename(const char *filename);
static void asn1c_dep_add(asn1c_dep_chain *dlist, const char *filename,
int lineno, int column);
static asn1c_dep_chain *asn1c_new_dep_chain();
static asn1c_dep_chain *
asn1c_dep_chains_add_new(asn1c_dep_chainset *deps,
enum asn1c_dep_section section, int active) {
asn1c_dep_chain *dc = asn1c_new_dep_chain();
asn1c_tagged_dep_chain *tc = calloc(1, sizeof(*tc));
tc->chain = dc;
tc->section = section;
tc->activated.active = active;
deps->chains = realloc(deps->chains,
sizeof(deps->chains[0]) * (deps->chains_count + 1));
assert(deps->chains);
deps->chains[deps->chains_count] = tc;
deps->chains_count++;
return dc;
}
int
asn1c_activate_dependency(asn1c_fdeps_t *deps, asn1c_fdeps_t *cur, const char *data) {
void
asn1c_activate_dependency(asn1c_dep_chainset *deps, const char *data,
const char *by) {
char fname_scratch[PATH_MAX];
const char *fname;
int i;
if(!deps || !data || !*data)
return 0;
if(!cur) cur = deps;
if(!deps || !data || !*data) {
return;
}
if(cur->usage > FDEP_NOTUSED)
return 1; /* Already activated */
assert(deps->chains_count);
fname = data;
const char *fname = data;
if(*data == '#') {
const char *start = data;
const char *end = 0;
......@@ -40,43 +54,31 @@ asn1c_activate_dependency(asn1c_fdeps_t *deps, asn1c_fdeps_t *cur, const char *d
fname_scratch[end-start] = '\0';
fname = fname_scratch;
} else {
return 0;
return;
}
}
if(cur->filename && strcmp(cur->filename, fname) == 0) {
cur->usage = FDEP_REFERRED;
for(size_t i = 0; i < deps->chains_count; i++) {
asn1c_tagged_dep_chain *ch = deps->chains[i];
if(!ch->activated.active && ch->chain->deps_count > 0
&& strcmp(ch->chain->deps[0]->filename, fname) == 0) {
ch->activated.by = strdup(by);
ch->activated.active = 1;
/* Activate subdependencies */
for(i = 0; i < cur->el_count; i++) {
asn1c_activate_dependency(deps,
cur->elements[i],
cur->elements[i]->filename);
for(size_t j = 0; j < ch->chain->deps_count; j++) {
asn1c_activate_dependency(deps, ch->chain->deps[j]->filename,
by);
}
/*
* This might be a link to someplace else.
*/
return asn1c_activate_dependency(deps, NULL, fname);
} else {
for(i = 0; i < cur->el_count; i++) {
asn1c_activate_dependency(deps,
cur->elements[i], fname);
}
}
return 0;
}
asn1c_fdeps_t *
asn1c_dep_chainset *
asn1c_read_file_dependencies(arg_t *arg, const char *datadir) {
char buf[4096];
asn1c_fdeps_t *deps;
asn1c_fdeps_t *cur;
asn1c_dep_chainset *deps;
FILE *f;
enum fdep_usage special_section = FDEP_NOTUSED;
(void)arg;
int lineno = 0;
if(!datadir || strlen(datadir) > sizeof(buf) / 2) {
errno = EINVAL;
......@@ -88,146 +90,162 @@ asn1c_read_file_dependencies(arg_t *arg, const char *datadir) {
f = fopen(buf, "r");
if(!f) return NULL;
deps = asn1c_new_dep(0);
deps = calloc(1, sizeof(*deps));
assert(deps);
enum asn1c_dep_section section = FDEP_COMMON_FILES;
int activate = 0;
while(fgets(buf, sizeof(buf), f)) {
char *p = strchr(buf, '#');
if(p) *p = '\0'; /* Remove comments */
cur = deps;
lineno++;
asn1c_dep_chain *dc = asn1c_dep_chains_add_new(deps, section, activate);
for(p = strtok(buf, " \t\r\n"); p;
p = strtok(NULL, " \t\r\n")) {
asn1c_fdeps_t *d;
/*
* Special "prefix" section.
*/
if(strchr(p, ':')) {
special_section = FDEP_IGNORE;
if(strcmp(p, "COMMON-FILES:") == 0) {
special_section = FDEP_COMMON_FILES;
section = FDEP_COMMON_FILES;
activate = 1;
} else if(strcmp(p, "CONVERTER:") == 0) {
special_section = FDEP_CONVERTER;
activate = 1;
section = FDEP_CONVERTER;
} else if((arg->flags & A1C_GEN_OER)
&& strcmp(p, "CODEC-OER:") == 0) {
special_section = FDEP_CODEC_OER;
activate = 0;
section = FDEP_CODEC_OER;
} else if((arg->flags & A1C_GEN_PER)
&& strcmp(p, "CODEC-PER:") == 0) {
special_section = FDEP_CODEC_PER;
activate = 0;
section = FDEP_CODEC_PER;
} else {
section = FDEP_IGNORE;
activate = 0;
}
break;
}
if(special_section == FDEP_IGNORE)
continue;
d = asn1c_new_dep(p);
d->usage = special_section;
if(asn1c_dep_add(cur, d) == 1)
cur = d;
asn1c_dep_add(dc, p, lineno, p - buf);
}
}
fclose(f);
/* A single filename by itself means that we should include that */
for(size_t i = 0; i < deps->chains_count; i++) {
asn1c_tagged_dep_chain *ch = deps->chains[i];
if(!ch->activated.active && ch->chain->deps_count == 1) {
asn1c_activate_dependency(deps, ch->chain->deps[0]->filename,
"implicit");
}
}
return deps;
}
static asn1c_fdeps_t *
asn1c_new_dep(const char *filename) {
asn1c_fdeps_t *d;
static asn1c_dep_filename *
asn1c_new_dep_filename(const char *filename) {
asn1c_dep_filename *d;
assert(filename);
d = calloc(1, sizeof(*d));
if(filename) {
assert(d);
d->filename = strdup(filename);
if(!d->filename) return NULL;
}
assert(d->filename);
return d;
}
static void
asn1c_free_dep(asn1c_fdeps_t *d) {
static asn1c_dep_chain *
asn1c_new_dep_chain() {
return calloc(1, sizeof(asn1c_dep_chain));
}
if(d) {
if(d->filename) free(d->filename);
d->filename = 0;
free(d);
}
static void
asn1c_dep_add(asn1c_dep_chain *dlist, const char *filename, int lineno, int column) {
asn1c_dep_filename *df = asn1c_new_dep_filename(filename);
df->lineno = lineno;
df->column = column;
dlist->deps =
realloc(dlist->deps, (dlist->deps_count + 1) * sizeof(dlist->deps[0]));
assert(dlist->deps);
dlist->deps[dlist->deps_count] = df;
dlist->deps_count += 1;
}
static int
asn1c_dep_add(asn1c_fdeps_t *deps, asn1c_fdeps_t *d) {
int n;
/* Check for duplicates */
for(n = 0; n < deps->el_count; n++) {
if(strcmp(deps->elements[n]->filename, d->filename) == 0)
return 0;
asn1c_dep_has_filename(const asn1c_dep_chain *dlist, const char *filename) {
for(size_t i = 0; i < dlist->deps_count; i++) {
if(strcmp(dlist->deps[i]->filename, filename) == 0) {
return 1;
}
if(deps->el_count == deps->el_size) {
void *p;
n = deps->el_size?deps->el_size << 2:16;
p = realloc(deps->elements,
n * sizeof(deps->elements[0]));
assert(p);
deps->elements = p;
deps->el_size = n;
}
deps->elements[deps->el_count++] = d;
return 1;
return 0;
}
asn1c_fdeps_t *
asn1c_deps_flatten(const asn1c_fdeps_t *deps) {
asn1c_fdeps_t *dlist;
asn1c_fdeps_t *d;
asn1c_dep_chain *
asn1c_deps_flatten(const asn1c_dep_chainset *deps,
enum asn1c_dep_section include_section) {
asn1c_dep_chain *dlist;
if(!deps) {
errno = EINVAL;
return 0;
}
dlist = asn1c_new_dep(0);
dlist = asn1c_new_dep_chain();
for(size_t i = 0; i < deps->chains_count; i++) {
asn1c_tagged_dep_chain *tc = deps->chains[i];
asn1c_dep_chain *dc = tc->chain;
if(deps->filename && deps->usage != FDEP_NOTUSED) {
d = asn1c_new_dep(deps->filename);
d->usage = deps->usage;
if(!asn1c_dep_add(dlist, d)) {
asn1c_free_dep(d);
if(!tc->activated.active) {
continue;
}
if((tc->section & include_section) == 0) {
continue;
}
for(int i = 0; i < deps->el_count; i++) {
d = asn1c_deps_flatten(deps->elements[i]);
assert(!d->filename);
for(int j = 0; j < d->el_count; j++) {
if(asn1c_dep_add(dlist, d->elements[j])) {
d->elements[j] = 0;
for(size_t j = 0; j < dc->deps_count; j++) {
if(!asn1c_dep_has_filename(dlist, dc->deps[j]->filename)) {
asn1c_dep_add(dlist, dc->deps[j]->filename, dc->deps[j]->lineno,
dc->deps[j]->column);
}
}
asn1c_deps_freelist(d);
}
return dlist;
}
void
asn1c_deps_freelist(asn1c_fdeps_t *deps) {
if(deps) {
int i;
if(deps->elements) {
for(i = 0; i < deps->el_count; i++) {
asn1c_deps_freelist(deps->elements[i]);
deps->elements[i] = 0;
asn1c_dep_chain_free(asn1c_dep_chain *dc) {
if(dc) {
for(size_t i = 0; i < dc->deps_count; i++) {
asn1c_dep_filename *df = dc->deps[i];
free(df->filename);
free(df);
}
free(deps->elements);
deps->elements = 0;
free(dc->deps);
}
}
void
asn1c_dep_chainset_free(asn1c_dep_chainset *deps) {
if(deps) {
for(size_t i = 0; i < deps->chains_count; i++) {
asn1c_dep_chain_free(deps->chains[i]->chain);
free(deps->chains[i]->activated.by);
free(deps->chains[i]);
}
asn1c_free_dep(deps);
free(deps->chains);
free(deps);
}
}
#ifndef ASN1C_FDEPS_H
#define ASN1C_FDEPS_H
typedef struct asn1c_fdeps_s {
char *filename; /* Or 0, if root. */
enum fdep_usage {
FDEP_IGNORE = -1, /* Ignore contents of the section */
FDEP_NOTUSED = 0,
FDEP_REFERRED = 1, /* Dynamic list of dependencies */
FDEP_CONVERTER = 2, /* Name of the int main() file */
FDEP_COMMON_FILES = 3, /* Section for mandatory dependencies */
FDEP_CODEC_OER = 4, /* Use contents only if -gen-OER */
FDEP_CODEC_PER = 8, /* Use contents only if -gen-PER */
} usage; /* Some file refers to it */
struct asn1c_fdeps_s **elements;
int el_size;
int el_count;
} asn1c_fdeps_t;
asn1c_fdeps_t *asn1c_read_file_dependencies(arg_t *arg, const char *datadir);
typedef struct {
char *filename;
int lineno;
int column;
} asn1c_dep_filename;
/*
* Format:
* <observed-name> [<dependent-name> ...]
*/
typedef struct {
asn1c_dep_filename **deps;
size_t deps_count;
} asn1c_dep_chain;
/*
* A single dependency chain, marked with the usage tag and activation tag.
*/
typedef struct {
enum asn1c_dep_section {
FDEP_IGNORE = 0, /* Section is not used */
FDEP_DEFAULT = (1 << 1), /* Default dependency list */
FDEP_REFERRED = (1 << 2), /* Dynamic list of dependencies */
FDEP_CONVERTER = (1 << 3), /* Name of the file with int main() */
FDEP_COMMON_FILES = (1 << 4), /* Section for mandatory dependencies */
FDEP_CODEC_OER = (1 << 5), /* Use contents only if -gen-OER */
FDEP_CODEC_PER = (1 << 6), /* Use contents only if -gen-PER */
} section; /* Some file refers to it */
/* Whether this chain is alive and has to be present in the output */
struct {
int active;
char *by;
} activated;
asn1c_dep_chain *chain;
} asn1c_tagged_dep_chain;
typedef struct {
asn1c_tagged_dep_chain **chains;
size_t chains_count;
} asn1c_dep_chainset;
asn1c_dep_chainset *asn1c_read_file_dependencies(arg_t *arg,
const char *datadir);
/* Data may be a filename or an "#include <>" string. */
int asn1c_activate_dependency(asn1c_fdeps_t *deps, asn1c_fdeps_t *cur,
const char *data);
void asn1c_activate_dependency(asn1c_dep_chainset *deps, const char *data,
const char *by);
asn1c_dep_chain *asn1c_deps_flatten(const asn1c_dep_chainset *deps,
enum asn1c_dep_section);
asn1c_fdeps_t *asn1c_deps_flatten(const asn1c_fdeps_t *deps);
void asn1c_deps_freelist(asn1c_fdeps_t *deps);
void asn1c_dep_chain_free(asn1c_dep_chain *);
void asn1c_dep_chainset_free(asn1c_dep_chainset *);
#endif /* ASN1C_FDEPS_H */
......@@ -10,6 +10,7 @@
#include <string.h> /* for strlen(3) and memset(3) */
#include <ctype.h> /* for isalnum(3) */
#include <sys/types.h> /* for fstat(2) */
#include <limits.h> /* for PATH_MAX */
#include <stdarg.h>
#include <errno.h>
#include <assert.h>
......@@ -22,6 +23,10 @@
#include <unistd.h> /* for unlink(2) */
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#ifdef _WIN32
#include <io.h>
#include <malloc.h>
......
......@@ -38,10 +38,10 @@ enum include_type_result {
TI_INCLUDED_FROM_CMDLINE
};
static int asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *, int, char **);
static int asn1c_dump_streams(arg_t *arg, asn1c_dep_chainset *, int, char **);
static int asn1c_print_streams(arg_t *arg);
static int asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *, int, char **);
static int asn1c_copy_over(arg_t *arg, char *path);
static int asn1c_save_streams(arg_t *arg, asn1c_dep_chainset *, int, char **);
static int asn1c_copy_over(arg_t *arg, const char *path, const char *msg);
static int identical_files(const char *fname1, const char *fname2);
static int need_to_generate_pdu_collection(arg_t *arg);
static abuf *generate_pdu_collection(arg_t *arg);
......@@ -54,8 +54,8 @@ static void asn1c__cleanup_pdu_type(void);
static int asn1c__pdu_type_lookup(const char *typename);
static int
asn1c__save_library_makefile(arg_t *arg, const asn1c_fdeps_t *deps, const char *datadir, const char *makefile_name) {
asn1c_fdeps_t *dlist;
asn1c__save_library_makefile(arg_t *arg, const asn1c_dep_chainset *deps,
const char *datadir, const char *makefile_name) {
asn1p_module_t *mod;
FILE *mkf;
......@@ -90,49 +90,51 @@ asn1c__save_library_makefile(arg_t *arg, const asn1c_fdeps_t *deps, const char *
/*
* Move necessary skeleton files and add them to Makefile.am.targets.
*/
dlist = asn1c_deps_flatten(deps);
asn1c_dep_chain *dlist = asn1c_deps_flatten(deps, ~FDEP_CONVERTER);
if(dlist) {
char buf[8129];
char dstpath[PATH_MAX];
char *dir_end;
size_t dlen = strlen(datadir);
assert(dlen < (sizeof(buf) / 2 - 2));
memcpy(buf, datadir, dlen);
dir_end = buf + dlen;
assert(dlen < (sizeof(dstpath) / 2 - 2));
memcpy(dstpath, datadir, dlen);
dir_end = dstpath + dlen;
*dir_end++ = '/';
for(int i = 0; i < dlist->el_count; i++) {
for(size_t i = 0; i < dlist->deps_count; i++) {
char where[32]; /* Location of the */
char *what_kind; /* HEADERS or SOURCES */
char *fname = dlist->elements[i]->filename;
const asn1c_dep_filename *dep_file = dlist->deps[i];
char *fname = dep_file->filename;
char *dotH;
assert(strlen(fname) < (sizeof(buf) / 2));
assert(strlen(fname) < (sizeof(dstpath) / 2));
strcpy(dir_end, fname);
if(dlist->elements[i]->usage == FDEP_CONVERTER
&& !(arg->flags & A1C_GEN_EXAMPLE))
continue;
if(arg->flags & A1C_DEBUG) {
snprintf(where, sizeof(where), "(line %d col %d)",
dep_file->lineno, dep_file->column);
} else {
where[0] = '\0';
}
if(asn1c_copy_over(arg, buf) == -1) {
if(asn1c_copy_over(arg, dstpath, where) == -1) {
safe_fprintf(mkf, ">>>ABORTED<<<");
fclose(mkf);
return -1;
}
/* no CONVERTER data in Makefile.am.targets */
if(dlist->elements[i]->usage != FDEP_CONVERTER) {
/* HEADERS versus SOURCES */
dotH = strrchr(fname, 'h');
if(dotH && fname<dotH && dotH[-1] == '.' && !dotH[1])
if(dotH && fname < dotH && dotH[-1] == '.' && !dotH[1]) {
what_kind = "HEADERS";
else
} else {
what_kind = "SOURCES";
safe_fprintf(mkf, "ASN_MODULE_%s+=%s\n",
what_kind, fname);
}
safe_fprintf(mkf, "ASN_MODULE_%s+=%s\n", what_kind, fname);
}
asn1c_deps_freelist(dlist);
asn1c_dep_chain_free(dlist);
}
safe_fprintf(
......@@ -156,8 +158,8 @@ asn1c__save_library_makefile(arg_t *arg, const asn1c_fdeps_t *deps, const char *
}
static int
asn1c__save_example_makefile(arg_t *arg, const asn1c_fdeps_t *deps,
const char *makefile_name,
asn1c__save_example_makefile(arg_t *arg, const asn1c_dep_chainset *deps,
const char *datadir, const char *makefile_name,
const char *library_makefile_name, int argc,
char **argv) {
FILE *mkf;
......@@ -180,15 +182,21 @@ asn1c__save_example_makefile(arg_t *arg, const asn1c_fdeps_t *deps,
need_to_generate_pdu_collection(arg) ? "-DASN_PDU_COLLECTION " : "");
if(arg->flags & A1C_GEN_EXAMPLE) {
asn1c_fdeps_t *dlist = asn1c_deps_flatten(deps);
asn1c_dep_chain *dlist = asn1c_deps_flatten(deps, FDEP_CONVERTER);
if(dlist) {
/* only CONVERTER data in the makefile */
for(int i = 0; i < dlist->el_count; i++) {
if(dlist->elements[i]->usage == FDEP_CONVERTER) {
safe_fprintf(mkf, "\\\n\t%s", dlist->elements[i]->filename);
for(size_t i = 0; i < dlist->deps_count; i++) {
char dstpath[PATH_MAX];
int ret = snprintf(dstpath, sizeof(dstpath), "%s/%s", datadir,
dlist->deps[i]->filename);
assert(ret > 0 && (size_t)ret < sizeof(dstpath));
if(asn1c_copy_over(arg, dstpath, "implicit") == -1) {
safe_fprintf(mkf, ">>>ABORTED<<<");
fclose(mkf);
return -1;
}
safe_fprintf(mkf, "\\\n\t%s", dlist->deps[i]->filename);
}
asn1c_deps_freelist(dlist);
asn1c_dep_chain_free(dlist);
}
}
......@@ -237,7 +245,6 @@ can_generate_pdu_collection(arg_t *arg) {
int
asn1c_save_compiled_output(arg_t *arg, const char *datadir,
int argc, int optc, char **argv) {
asn1c_fdeps_t *deps = 0;
int ret = -1;
/*
......@@ -247,6 +254,7 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir,
return -1;
}
asn1c_dep_chainset *deps;
do {
asn1p_module_t *mod;
......@@ -281,14 +289,14 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir,
if(ret) break;
if(arg->flags & A1C_GEN_EXAMPLE) {
ret = asn1c__save_example_makefile(arg, deps, "Makefile.am.example",
"Makefile.am.libasncodec", argc,
argv);
ret = asn1c__save_example_makefile(
arg, deps, datadir, "Makefile.am.example",
"Makefile.am.libasncodec", argc, argv);
if(ret) break;
}
} while(0);
asn1c_deps_freelist(deps);
asn1c_dep_chainset_free(deps);
asn1c__cleanup_pdu_type();
return ret;
......@@ -298,7 +306,8 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir,
* Dump the streams.
*/
static int
asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
asn1c_dump_streams(arg_t *arg, asn1c_dep_chainset *deps, int optc,
char **argv) {
if(arg->flags & A1C_PRINT_COMPILED) {
return asn1c_print_streams(arg);
} else {
......@@ -330,7 +339,8 @@ asn1c_print_streams(arg_t *arg) {
}
static int
asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
asn1c_save_streams(arg_t *arg, asn1c_dep_chainset *deps, int optc,
char **argv) {
asn1p_expr_t *expr = arg->expr;
compiler_streams_t *cs = expr->data;
out_chunk_t *ot;
......@@ -373,7 +383,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
if(TQ_FIRST(&(cs->destination[idx].chunks)) && *msg) \
safe_fprintf(fp, "\n/* %s */\n", msg); \
TQ_FOR(ot, &(cs->destination[idx].chunks), next) { \
if(actdep) asn1c_activate_dependency(deps, 0, ot->buf); \
if(actdep) asn1c_activate_dependency(deps, ot->buf, header_id); \
safe_fwrite(ot->buf, ot->len, 1, fp); \
} \
} while(0)
......@@ -554,7 +564,7 @@ real_copy(const char *src, const char *dst) {
}
static int
asn1c_copy_over(arg_t *arg, char *path) {
asn1c_copy_over(arg_t *arg, const char *path, const char *msg) {
#ifdef _WIN32
int use_real_copy = 1;
#else
......@@ -595,8 +605,10 @@ asn1c_copy_over(arg_t *arg, char *path) {
}
}
safe_fprintf(stderr, "%s %s\t-> %s\n",
use_real_copy ? "Copied" : "Symlinked", path, fname);
const int has_msg = msg && *msg;
safe_fprintf(stderr, "%s %s\t-> %s%s%s\n",
use_real_copy ? "Copied" : "Symlinked", path, fname,
has_msg ? " " : "", has_msg ? msg : "");
return 1;
}
......
......@@ -7,7 +7,6 @@
#include <asn_application.h>
#include <asn_codecs_prim.h>
#include <NativeInteger.h>
#ifdef __cplusplus
extern "C" {
......
......@@ -69,17 +69,19 @@ CONVERTER: # THIS IS A SPECIAL SECTION
converter-example.c # A default name for the example transcoder
CODEC-OER: # THIS IS A SPECIAL SECTION
oer_decoder.h oer_decoder.c OPEN_TYPE.h # OER decoding support
oer_encoder.h oer_encoder.c # OER encoding support
oer_support.h oer_support.c # OER support
oer_decoder.h
oer_encoder.h
oer_support.h
oer_decoder.h oer_decoder.c OPEN_TYPE.h
oer_encoder.h oer_encoder.c
oer_support.h oer_support.c
OPEN_TYPE.h OPEN_TYPE_oer.c constr_CHOICE.h
INTEGER_oer.c INTEGER.h
OCTET_STRING_oer.c
NativeInteger_oer.c NativeInteger.h
NativeEnumerated_oer.c NativeEnumerated.h
constr_SEQUENCE_oer.c constr_SEQUENCE.h
constr_CHOICE_oer.c
constr_SET_OF_oer.c constr_SET_OF.h asn_SET_OF.h asn_SET_OF.c
BIT_STRING_oer.c
INTEGER.h INTEGER_oer.c
BIT_STRING.h BIT_STRING_oer.c OCTET_STRING_oer.c
NativeInteger.h NativeInteger_oer.c
NativeEnumerated.h NativeEnumerated_oer.c
constr_CHOICE.h constr_CHOICE_oer.c
constr_SEQUENCE.h constr_SEQUENCE_oer.c
constr_SET_OF.h constr_SET_OF_oer.c
CODEC-PER: # THIS IS A SPECIAL SECTION
......@@ -30,7 +30,7 @@ verify() {
cleanup
asncmd="${top_builddir}/asn1c/asn1c -flink-skeletons -S ${top_srcdir}/skeletons $flags test.asn"
asncmd="${top_builddir}/asn1c/asn1c -Wdebug-compiler -flink-skeletons -S ${top_srcdir}/skeletons $flags test.asn"
{
echo "$asncmd"
......@@ -52,9 +52,12 @@ verify_type_with_variants() {
}
verify_compile_and_link_variants() {
for type in INTEGER "ENUMERATED{foo}" NULL BOOLEAN "BIT STRING" \
"OBJECT IDENTIFIER" "RELATIVE-OID" "SEQUENCE{f INTEGER}" \
"CHOICE{f INTEGER}" "OCTET STRING" IA5String UTF8String \
for type in INTEGER "INTEGER(0..1)" "ENUMERATED{foo}" NULL BOOLEAN \
"BIT STRING" \
"OBJECT IDENTIFIER" "RELATIVE-OID" \
"SEQUENCE{f INTEGER}" \
"CHOICE{f INTEGER}" \
"OCTET STRING" IA5String "IA5String(SIZE(1))" UTF8String \
REAL "SET OF INTEGER" "SEQUENCE OF INTEGER"; do
verify_type_with_variants "$type"
......@@ -69,6 +72,8 @@ else
verify_type_with_variants "$type"
done
fi
set +x
trap '' EXIT ERR
cleanup
echo "OK"
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