diff --git a/lib/asn1/der_locl.h b/lib/asn1/der_locl.h index 5b721ddc7..ad5787c88 100644 --- a/lib/asn1/der_locl.h +++ b/lib/asn1/der_locl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -49,6 +49,8 @@ #include #include -#include +#include +#include +#include #endif /* __DER_LOCL_H__ */ diff --git a/lib/asn1/gen.c b/lib/asn1/gen.c index 976d21604..f79a24969 100644 --- a/lib/asn1/gen.c +++ b/lib/asn1/gen.c @@ -43,6 +43,27 @@ static const char *orig_filename; static char header[1024]; static char headerbase[1024] = STEM; +/* + * list of all IMPORTs + */ + +struct import { + const char *module; + struct import *next; +}; + +static struct import *imports = NULL; + +void +add_import (const char *module) +{ + struct import *tmp = emalloc (sizeof(*tmp)); + + tmp->module = module; + tmp->next = imports; + imports = tmp; +} + const char * filename (void) { @@ -388,6 +409,7 @@ generate_type_header (const Symbol *s) void generate_type (const Symbol *s) { + struct import *i; char *filename; asprintf (&filename, "%s_%s.x", STEM, s->gen_name); @@ -399,16 +421,23 @@ generate_type (const Symbol *s) fprintf (codefile, "/* Generated from %s */\n" "/* Do not edit */\n\n" - "#include \"libasn1.h\"\n\n" -#if 0 "#include \n" "#include \n" "#include \n" - "#include <" STEM ".h>\n\n" + "#include \n", + orig_filename); + + for (i = imports; i != NULL; i = i->next) + fprintf (codefile, + "#include <%s_asn1.h>\n", + i->module); + fprintf (codefile, + "#include <%s.h>\n", + headerbase); + fprintf (codefile, "#include \n" "#include \n" -#endif - ,orig_filename); + "#include \n\n"); generate_type_header (s); generate_type_encode (s); generate_type_decode (s); diff --git a/lib/asn1/gen_locl.h b/lib/asn1/gen_locl.h index f0b0cf621..0c77888a3 100644 --- a/lib/asn1/gen_locl.h +++ b/lib/asn1/gen_locl.h @@ -66,6 +66,7 @@ void generate_glue (const Symbol *s); void init_generate (const char *filename, const char *basename); const char *filename (void); void close_generate(void); +void add_import(const char *module); int yyparse(void); extern FILE *headerfile, *codefile, *logfile; diff --git a/lib/asn1/libasn1.h b/lib/asn1/libasn1.h deleted file mode 100644 index 53155f2c6..000000000 --- a/lib/asn1/libasn1.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id$ */ - -#ifndef __LIBASN1_H__ -#define __LIBASN1_H__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include "krb5_asn1.h" -#include "der.h" -#include "asn1_err.h" -#include - -#endif /* __LIBASN1_H__ */ diff --git a/lib/asn1/parse.y b/lib/asn1/parse.y index 9c5344b7f..25bcde153 100644 --- a/lib/asn1/parse.y +++ b/lib/asn1/parse.y @@ -102,6 +102,7 @@ referencenames : IDENT ',' referencenames ; imports_decl : IMPORTS referencenames FROM IDENT ';' + { add_import($4); } ; type_decl : IDENT EEQUAL type diff --git a/lib/hdb/libasn1.h b/lib/hdb/libasn1.h deleted file mode 100644 index cf3673df5..000000000 --- a/lib/hdb/libasn1.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id$ */ - -#ifndef __LIBASN1_H__ -#define __LIBASN1_H__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include "hdb_asn1.h" -#include -#include - -#endif /* __LIBASN1_H__ */