Deleted Added
full compact
gen.c (102644) gen.c (103423)
1/*
2 * Copyright (c) 1997 - 2002 Kungliga Tekniska H�gskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "gen_locl.h"
35
1/*
2 * Copyright (c) 1997 - 2002 Kungliga Tekniska H�gskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "gen_locl.h"
35
36RCSID("$Id: gen.c,v 1.48 2002/08/26 13:27:20 assar Exp $");
36RCSID("$Id: gen.c,v 1.49 2002/09/04 15:06:18 joda Exp $");
37
38FILE *headerfile, *codefile, *logfile;
39
40#define STEM "asn1"
41
42static const char *orig_filename;
43static char header[1024];
44static char headerbase[1024] = STEM;

--- 52 unchanged lines hidden (view full) ---

97 "#ifndef __asn1_common_definitions__\n"
98 "#define __asn1_common_definitions__\n\n");
99 fprintf (headerfile,
100 "typedef struct octet_string {\n"
101 " size_t length;\n"
102 " void *data;\n"
103 "} octet_string;\n\n");
104 fprintf (headerfile,
37
38FILE *headerfile, *codefile, *logfile;
39
40#define STEM "asn1"
41
42static const char *orig_filename;
43static char header[1024];
44static char headerbase[1024] = STEM;

--- 52 unchanged lines hidden (view full) ---

97 "#ifndef __asn1_common_definitions__\n"
98 "#define __asn1_common_definitions__\n\n");
99 fprintf (headerfile,
100 "typedef struct octet_string {\n"
101 " size_t length;\n"
102 " void *data;\n"
103 "} octet_string;\n\n");
104 fprintf (headerfile,
105#if 0
106 "typedef struct general_string {\n"
107 " size_t length;\n"
108 " char *data;\n"
109 "} general_string;\n\n"
110#else
111 "typedef char *general_string;\n\n"
105 "typedef char *general_string;\n\n"
112#endif
113 );
114 fprintf (headerfile,
115 "typedef struct oid {\n"
116 " size_t length;\n"
117 " unsigned *components;\n"
118 "} oid;\n\n");
106 );
107 fprintf (headerfile,
108 "typedef struct oid {\n"
109 " size_t length;\n"
110 " unsigned *components;\n"
111 "} oid;\n\n");
112 fputs("#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \\\n"
113 " do { \\\n"
114 " (BL) = length_##T((S)); \\\n"
115 " (B) = malloc((BL)); \\\n"
116 " if((B) == NULL) { \\\n"
117 " (R) = ENOMEM; \\\n"
118 " } else { \\\n"
119 " (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n"
120 " (S), (L)); \\\n"
121 " if((R) != 0) { \\\n"
122 " free((B)); \\\n"
123 " (B) = NULL; \\\n"
124 " } \\\n"
125 " } \\\n"
126 " } while (0)\n\n",
127 headerfile);
119 fprintf (headerfile, "#endif\n\n");
120 logfile = fopen(STEM "_files", "w");
121 if (logfile == NULL)
122 err (1, "open " STEM "_files");
123}
124
125void
126close_generate (void)

--- 325 unchanged lines hidden ---
128 fprintf (headerfile, "#endif\n\n");
129 logfile = fopen(STEM "_files", "w");
130 if (logfile == NULL)
131 err (1, "open " STEM "_files");
132}
133
134void
135close_generate (void)

--- 325 unchanged lines hidden ---