2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Added support for Win32

This commit is contained in:
Danny Mayer
2001-07-16 05:10:30 +00:00
parent 5deaff6621
commit f621719829
17 changed files with 1741 additions and 68 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gen.c,v 1.63 2001/07/16 03:05:56 marka Exp $ */
/* $Id: gen.c,v 1.64 2001/07/16 05:10:20 mayer Exp $ */
#include <config.h>
@@ -621,11 +621,11 @@ main(int argc, char **argv) {
insert_into_typenames(254, "maila", METAQUESTIONONLY);
insert_into_typenames(255, "any", METAQUESTIONONLY);
fprintf(stdout,"\ntypedef struct {\n");
fprintf(stdout,"\tconst char *name;\n");
fprintf(stdout,"\tunsigned int flags;\n");
fprintf(stdout,"} typeattr_t;\n");
fprintf(stdout,"static typeattr_t typeattr[] = {\n");
fprintf(stdout, "\ntypedef struct {\n");
fprintf(stdout, "\tconst char *name;\n");
fprintf(stdout, "\tunsigned int flags;\n");
fprintf(stdout, "} typeattr_t;\n");
fprintf(stdout, "static typeattr_t typeattr[] = {\n");
for (i = 0 ; i <= 255 ; i++) {
ttn = &typenames[i];
if (ttn->typename[0] == 0) {
@@ -635,16 +635,16 @@ main(int argc, char **argv) {
"DNS_RDATATYPEATTR_META";
else
attrs = "DNS_RDATATYPEATTR_UNKNOWN";
fprintf(stdout,"\t{ \"TYPE%d\", %s}%s\n",
fprintf(stdout, "\t{ \"TYPE%d\", %s}%s\n",
i, attrs, PRINT_COMMA(i));
} else {
fprintf(stdout,"\t{ \"%s\", %s }%s\n",
fprintf(stdout, "\t{ \"%s\", %s }%s\n",
upper(ttn->typename),
upper(ttn->attr),
PRINT_COMMA(i));
}
}
fprintf(stdout,"};\n");
fprintf(stdout, "};\n");
/*
* Run through the list of types and pre-mark the unused
@@ -666,20 +666,20 @@ main(int argc, char **argv) {
* Here, walk the list from top to bottom, calculating
* the hash (mod 256) for each name.
*/
fprintf(stdout,"#define RDATATYPE_COMPARE(_s, _d, _tn, _tp) \\\n");
fprintf(stdout,"\tdo { \\\n");
fprintf(stdout,"\t\tif (strcasecmp(_s,(_tn)) == 0) { \\\n");
fprintf(stdout,"\t\t\tif ((typeattr[_d].flags & "
fprintf(stdout, "#define RDATATYPE_COMPARE(_s, _d, _tn, _tp) \\\n");
fprintf(stdout, "\tdo { \\\n");
fprintf(stdout, "\t\tif (strcasecmp(_s,(_tn)) == 0) { \\\n");
fprintf(stdout, "\t\t\tif ((typeattr[_d].flags & "
"DNS_RDATATYPEATTR_RESERVED) != 0) \\\n");
fprintf(stdout,"\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n");
fprintf(stdout,"\t\t\t*(_tp) = _d; \\\n");
fprintf(stdout,"\t\t\treturn (ISC_R_SUCCESS); \\\n");
fprintf(stdout,"\t\t} \\\n");
fprintf(stdout,"\t} while (0)\n\n");
fprintf(stdout, "\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n");
fprintf(stdout, "\t\t\t*(_tp) = _d; \\\n");
fprintf(stdout, "\t\t\treturn (ISC_R_SUCCESS); \\\n");
fprintf(stdout, "\t\t} \\\n");
fprintf(stdout, "\t} while (0)\n\n");
fprintf(stdout,"#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) "
fprintf(stdout, "#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) "
"\\\n");
fprintf(stdout,"\tswitch (_hash) { \\\n");
fprintf(stdout, "\tswitch (_hash) { \\\n");
for (i = 0 ; i <= 255 ; i++) {
ttn = &typenames[i];
@@ -690,7 +690,7 @@ main(int argc, char **argv) {
continue;
hash = HASH(ttn->typename);
fprintf(stdout,"\t\tcase %u: \\\n", hash);
fprintf(stdout, "\t\tcase %u: \\\n", hash);
/*
* Find all other entries that happen to match
@@ -701,16 +701,16 @@ main(int argc, char **argv) {
if (ttn2->sorted != 0)
continue;
if (hash == HASH(ttn2->typename)) {
fprintf(stdout,"\t\t\tRDATATYPE_COMPARE"
fprintf(stdout, "\t\t\tRDATATYPE_COMPARE"
"(\"%s\", %u, "
"_typename, _typep); \\\n",
ttn2->typename, j);
ttn2->sorted = 1;
}
}
fprintf(stdout,"\t\t\tbreak; \\\n");
fprintf(stdout, "\t\t\tbreak; \\\n");
}
fprintf(stdout,"\t}\n");
fprintf(stdout, "\t}\n");
fputs("#endif /* DNS_CODE_H */\n", stdout);
} else if (type_enum) {
@@ -769,22 +769,22 @@ main(int argc, char **argv) {
char *s;
int classnum;
fprintf(stdout,"#ifndef DNS_ENUMCLASS_H\n");
fprintf(stdout,"#define DNS_ENUMCLASS_H 1\n\n");
fprintf(stdout, "#ifndef DNS_ENUMCLASS_H\n");
fprintf(stdout, "#define DNS_ENUMCLASS_H 1\n\n");
fprintf(stdout,"enum {\n");
fprintf(stdout, "enum {\n");
fprintf(stdout,"\tdns_rdataclass_reserved0 = 0,\n");
fprintf(stdout,"#define dns_rdataclass_reserved0 \\\n\t\t\t\t"
fprintf(stdout, "\tdns_rdataclass_reserved0 = 0,\n");
fprintf(stdout, "#define dns_rdataclass_reserved0 \\\n\t\t\t\t"
"((dns_rdataclass_t)dns_rdataclass_reserved0)\n");
#define PRINTCLASS(name, num) \
do { \
s = funname(name, buf1); \
classnum = num; \
fprintf(stdout,"\tdns_rdataclass_%s = %d%s\n", s, classnum, \
fprintf(stdout, "\tdns_rdataclass_%s = %d%s\n", s, classnum, \
classnum != 255 ? "," : ""); \
fprintf(stdout,"#define dns_rdataclass_%s\t" \
fprintf(stdout, "#define dns_rdataclass_%s\t" \
"((dns_rdataclass_t)dns_rdataclass_%s)\n", s, s); \
} while (0)
@@ -801,8 +801,8 @@ main(int argc, char **argv) {
#undef PRINTCLASS
fprintf(stdout,"};\n\n");
fprintf(stdout,"#endif /* DNS_ENUMCLASS_H */\n");
fprintf(stdout, "};\n\n");
fprintf(stdout, "#endif /* DNS_ENUMCLASS_H */\n");
} else if (structs) {
if (prefix != NULL) {
if ((fd = fopen(prefix,"r")) != NULL) {