gen.c revision 3761c433912beabe43abeed2c3513b6201c59f64
/*
* Copyright (C) 1998 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/* $Id: gen.c,v 1.6 1999/01/19 05:38:31 marka Exp $ */
#include <ctype.h>
#include <dirent.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define FROMTEXTDECL "dns_rdataclass_t class, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, isc_boolean_t downcase, isc_buffer_t *target"
#define FROMTEXTARGS "class, type, lexer, origin, downcase, target"
#define FROMTEXTCLASS "class"
#define FROMTEXTTYPE "type"
#define FROMTEXTDEF "DNS_R_DEFAULT"
#define TOTEXTDECL "dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target"
#define TOTEXTARGS "rdata, origin, target"
#define TOTEXTCLASS "rdata->class"
#define TOTEXTTYPE "rdata->type"
#define TOTEXTDEF "DNS_R_DEFAULT"
#define FROMWIREDECL "dns_rdataclass_t class, dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, isc_boolean_t downcase, isc_buffer_t *target"
#define FROMWIREARGS "class, type, source, dctx, downcase, target"
#define FROMWIRECLASS "class"
#define FROMWIRETYPE "type"
#define FROMWIREDEF "DNS_R_DEFAULT"
#define TOWIREDECL "dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target"
#define TOWIREARGS "rdata, cctx, target"
#define TOWIRECLASS "rdata->class"
#define TOWIRETYPE "rdata->type"
#define TOWIREDEF "DNS_R_DEFAULT"
#define FROMSTRUCTDECL "dns_rdataclass_t class, dns_rdatatype_t type, void *source, isc_buffer_t *target"
#define FROMSTRUCTARGS "class, type, source, target"
#define FROMSTRUCTCLASS "class"
#define FROMSTRUCTTYPE "type"
#define FROMSTRUCTDEF "DNS_R_DEFAULT"
#define TOSTRUCTDECL "dns_rdata_t *rdata, void *target"
#define TOSTRUCTARGS "rdata, target"
#define TOSTRUCTCLASS "rdata->class"
#define TOSTRUCTTYPE "rdata->type"
#define TOSTRUCTDEF "DNS_R_DEFAULT"
#define COMPAREDECL "dns_rdata_t *rdata1, dns_rdata_t *rdata2"
#define COMPAREARGS "rdata1, rdata2"
#define COMPARECLASS "rdata1->class"
#define COMPARETYPE "rdata1->type"
#define COMPAREDEF "-2"
char copyright[] =
"/*\n\
* Copyright (C) 1998%s Internet Software Consortium.\n\
*\n\
* Permission to use, copy, modify, and distribute this software for any\n\
* purpose with or without fee is hereby granted, provided that the above\n\
* copyright notice and this permission notice appear in all copies.\n\
*\n\
* THE SOFTWARE IS PROVIDED \"AS IS\" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS\n\
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES\n\
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE\n\
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\n\
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\n\
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n\
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n\
* SOFTWARE.\n\
*/\n\
\n\
/* THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT */\n\
\n";
struct cc {
int type;
} *classes;
struct tt {
int class;
int type;
char classname[11];
char typename[11];
char dirname[sizeof "rdata/0123456789_65535" ];
} *types;
char * upper(char *);
void doswitch(char *, char *, char *, char *, char *, char *);
void dodecl(char *, char *, char *);
void add(int, char *, int, char *, char *);
void sd(int, char *, char *);
char *
upper(char *s) {
static char buf[11];
char *b = buf;
char c;
while ((c = *s++)) {
}
*b = '\0';
return (buf);
}
void
{
int first = 1;
int lasttype = 0;
int subswitch = 0;
if (first) {
first = 0;
}
res);
subswitch = 0;
}
subswitch = 1;
}
"\tcase %d: result = %s_%s(%s); break;",
else
"\t\tcase %d: result = %s_%s_%s(%s); break;",
}
if (subswitch) {
}
if (first)
else {
}
}
void
"static %s %s_%s_%s(%s);\n",
else
"static %s %s_%s(%s);\n",
}
void
exit(1);
}
exit(1);
}
exit(1);
if (oldtt)
else
/* do a class switch for this type */
if (class == 0)
return;
}
return;
}
if (oldcc)
else
}
void
char buf[sizeof "0123456789_65535.h"];
DIR *d;
int type;
char typename[11];
return;
continue;
continue;
continue;
}
closedir(d);
}
int
DIR *d;
char buf[sizeof "rdata/0123456789_65535" ];
int class;
char classname[11];
char year[11];
int lasttype;
exit(1);
continue;
continue;
continue;
}
closedir(d);
else
year[0] = 0;
} else
year[0] = 0;
lasttype = 0;
"\t{ %d, \"%s\" },%s\n",
exit(1);
exit(0);
}