From 1c3b7e89e18a1c8ed325fb4c465e06b2d26bb222 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 12 Jun 1996 05:32:06 +0000 Subject: [PATCH] com_err.h: error_table.h: Add Windows-32 ifdefs. Change use of INTERFACE to KRB5_CALLCONV and KRB5_DLLIMP. See ChangeLog entries for src/include/krb5.hin for more information. vfprintf.c, internal.h, compile_et.c, et_c.awk, com_err.c: Change _WINDOWS to _MSDOS, and add check for _WIN32. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8319 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/et/ChangeLog | 12 ++++++++ src/util/et/com_err.c | 18 ++++++------ src/util/et/com_err.h | 55 ++++++++++++++++++++++++++++++------- src/util/et/compile_et.c | 2 +- src/util/et/error_message.c | 8 ++++-- src/util/et/error_table.h | 49 +++++++++++++++++++++++++++++---- src/util/et/et_c.awk | 2 +- src/util/et/internal.h | 2 +- src/util/et/vfprintf.c | 2 +- 9 files changed, 120 insertions(+), 30 deletions(-) diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog index 052c4de15..8b4f900e5 100644 --- a/src/util/et/ChangeLog +++ b/src/util/et/ChangeLog @@ -1,3 +1,15 @@ +Mon Jun 10 21:54:09 1996 Theodore Ts'o + + * com_err.h: + * error_table.h: Add Windows-32 ifdefs. Change use of + INTERFACE to KRB5_CALLCONV and KRB5_DLLIMP. See + ChangeLog entries for src/include/krb5.hin for more + information. + + + * vfprintf.c, internal.h, compile_et.c, et_c.awk, com_err.c: + Change _WINDOWS to _MSDOS, and add check for _WIN32. + Wed Mar 20 00:19:08 1996 Theodore Y. Ts'o * Makefile.in (SRCS): Fix SRCS definition so that it doesn't fool diff --git a/src/util/et/com_err.c b/src/util/et/com_err.c index 8990e770f..e0e5baf89 100644 --- a/src/util/et/com_err.c +++ b/src/util/et/com_err.c @@ -8,7 +8,7 @@ #include #include "mit-sipb-copyright.h" -#if defined(HAVE_STDARG_H) || defined(_WINDOWS) || defined (_MACINTOSH) +#if defined(HAVE_STDARG_H) || defined(_MSDOS) || defined(_WIN32) || defined (_MACINTOSH) #include #else #include @@ -39,14 +39,14 @@ * should fix up com_err.h so that it's safe to #include here * directly. */ -#if defined(__STDC__) || defined(_WINDOWS) -extern char const * INTERFACE error_message (long); +#if defined(__STDC__) || defined(_MSDOS) || defined(_WIN32) +KRB5_DLLIMP extern char const FAR * KRB5_CALLCONV error_message (long); #else -extern char * INTERFACE error_message (); +extern char * error_message (); #endif static void -#if defined(__STDC__) || defined(_WINDOWS) +#if defined(__STDC__) || defined(_MSDOS) || defined(_WIN32) default_com_err_proc (const char *whoami, long code, const char *fmt, va_list args) #else default_com_err_proc (whoami, code, fmt, args) @@ -70,7 +70,7 @@ static void if (fmt) { vsprintf (errbuf + strlen (errbuf), fmt, args); } -#ifdef _WINDOWS +#if defined(_MSDOS) || defined(_WIN32) MessageBox (NULL, errbuf, "Kerboros", MB_ICONEXCLAMATION); #else #ifdef _MACINTOSH @@ -155,7 +155,7 @@ Boolean done; #endif } -#if defined(__STDC__) || defined(_WINDOWS) +#if defined(__STDC__) || defined(_MSDOS) || defined(_WIN32) typedef void (*errf) (const char *, long, const char *, va_list); #else typedef void (*errf) (); @@ -173,12 +173,12 @@ void com_err_va (whoami, code, fmt, args) } #ifndef VARARGS -void INTERFACE_C com_err (const char *whoami, +KRB5_DLLIMP void KRB5_CALLCONV_C com_err (const char *whoami, long code, const char *fmt, ...) { #else -void INTERFACE_C com_err (va_alist) +KRB5_DLLIMP void KRB5_CALLCONV_C com_err (va_alist) va_dcl { const char *whoami, *fmt; diff --git a/src/util/et/com_err.h b/src/util/et/com_err.h index 31a5f9027..5d6db0725 100644 --- a/src/util/et/com_err.h +++ b/src/util/et/com_err.h @@ -29,31 +29,66 @@ * programs are not including that file. We probably want to * come up with a better way of handling this problem. */ -#ifndef INTERFACE -#ifdef _WINDOWS -#define INTERFACE __far __export __pascal -#define INTERFACE_C __far __export __cdecl +#if defined(_MSDOS) || defined (_WIN32) +#ifdef _MSDOS + /* Windows 16 specific */ +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV __far __export __pascal +#define KRB5_CALLCONV_C __far __export __cdecl +#define KRB5_DLLIMP +#define INTERFACE KRB5_CALLCONV +#define INTERFACE_C KRB5_CALLCONV_C +#endif /* !KRB5_CALLCONV */ +#ifndef FAR +#define FAR __far +#define NEAR __near +#endif #else + /* Windows 32 specific */ +#ifndef KRB5_CALLCONV +#ifdef KRB5_DLL_FILE +#define KRB5_DECLSPEC dllexport +#else +#define KRB5_DECLSPEC dllimport +#endif +#define KRB5_DLLIMP __declspec(KRB5_DECLSPEC) +#define KRB5_CALLCONV __stdcall +#define KRB5_CALLCONV_C __cdecl +#define INTERFACE KRB5_DLLIMP KRB5_CALLCONV +#define INTERFACE_C KRB5_DLLIMP KRB5_CALLCONV_C +#endif /* !KRB5_CALLCONV */ + +#include + +#endif /* Win 16 vs Win 32 */ +#else /* Windows stuff */ +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#define KRB5_DLLIMP #define INTERFACE #define INTERFACE_C #endif -#endif +#endif /* Windows stuff */ + #ifndef FAR #define FAR +#define NEAR #endif -#if defined(__STDC__) || defined(_WINDOWS) +#if defined(__STDC__) || defined(_MSDOS) || defined(_WIN32) /* ANSI C -- use prototypes etc */ -extern void INTERFACE_C com_err (const char FAR *, long, const char FAR *, ...); -extern const char FAR * INTERFACE error_message (long); +KRB5_DLLIMP extern void KRB5_CALLCONV_C com_err + (const char FAR *, long, const char FAR *, ...); +KRB5_DLLIMP extern const char FAR * KRB5_CALLCONV error_message (long); extern void (*com_err_hook) (const char *, long, const char *, va_list); extern void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list))) (const char *, long, const char *, va_list); extern void (*reset_com_err_hook ()) (const char *, long, const char *, va_list); #else /* no prototypes */ -extern void INTERFACE_C com_err (); -extern const char * INTERFACE error_message (); +extern void com_err (); +extern const char * error_message (); extern void (*com_err_hook) (); extern void (*set_com_err_hook ()) (); extern void (*reset_com_err_hook ()) (); diff --git a/src/util/et/compile_et.c b/src/util/et/compile_et.c index 921aad240..d42c27433 100644 --- a/src/util/et/compile_et.c +++ b/src/util/et/compile_et.c @@ -76,7 +76,7 @@ static const char * const c_src_prolog[] = { }; static const char * const krc_src_prolog[] = { - "#if defined(__STDC__) || defined(_WINDOWS)\n", + "#if defined(__STDC__) || defined(_MSDOS) || defined(_WIN32)\n", "#define NOARGS void\n", "#else\n", "#define NOARGS\n", diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index 906b935c5..88997b91a 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -28,7 +28,7 @@ static char buffer[25]; struct et_list * _et_list = (struct et_list *) NULL; -const char * INTERFACE error_message (code) +KRB5_DLLIMP const char * KRB5_CALLCONV error_message (code) long code; { int offset; @@ -38,13 +38,17 @@ long code; int started = 0; char *cp; -#ifdef _WINDOWS +#if defined(_MSDOS) || defined(_WIN32) #define HAS_STRERROR 1 /* ** Winsock defines errors in the range 10000-10100. These are equivalent ** to 10000 plus the Berkeley error numbers. * * (Does windows strerror() work right here?) +* +* XXX NO. We need to do our own table lookup for Winsock error +* messages!!! --- TYT +* */ if (code >= 10000 && code <= 10100) /* Is it Winsock error? */ code -= 10000; /* Turn into Berkeley errno */ diff --git a/src/util/et/error_table.h b/src/util/et/error_table.h index a82b39c1f..d61791244 100644 --- a/src/util/et/error_table.h +++ b/src/util/et/error_table.h @@ -12,19 +12,58 @@ place here what is needed from that file. Later we may decide to do it differently. */ -#ifdef _WINDOWS -#define INTERFACE __far __export __pascal -#define INTERFACE_C __far __export __cdecl +#if defined(_MSDOS) || defined(_WIN32) +#ifdef _MSDOS + /* Windows 16 specific */ +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV __far __export __pascal +#define KRB5_CALLCONV_C __far __export __cdecl +#define KRB5_DLLIMP +#define INTERFACE KRB5_CALLCONV +#define INTERFACE_C KRB5_CALLCONV_C +#endif + +#ifndef FAR +#define FAR __far +#define NEAR __near +#endif +#else + /* Windows 32 specific */ +#ifdef KRB5_DLL_FILE +#define KRB5_DECLSPEC dllexport +#else +#define KRB5_DECLSPEC dllimport +#endif + +#define KRB5_DLLIMP __declspec(KRB5_DECLSPEC) +#define KRB5_CALLCONV __stdcall +#define KRB5_CALLCONV_C __cdecl +#define INTERFACE KRB5_DLLIMP KRB5_CALLCONV +#define INTERFACE_C KRB5_DLLIMP KRB5_CALLCONV_C + +#endif /* Win16 vs Win32 */ + #define sys_nerr _sys_nerr #define sys_errlist _sys_errlist -int __far __pascal MessageBox (void __far *, const char __far*, const char __far*, unsigned int); +int FAR KRB5_CALLCONV MessageBox (void FAR *, const char FAR*, const char FAR*, unsigned int); #define MB_ICONEXCLAMATION 0x0030 #else +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#define KRB5_DLLIMP #define INTERFACE #define INTERFACE_C -extern int errno; +#endif /* KRB5_CALLCONV */ #endif +#ifndef FAR +#define FAR +#define NEAR +#endif + +#include + struct error_table { char const * const * msgs; long base; diff --git a/src/util/et/et_c.awk b/src/util/et/et_c.awk index 376a8d653..8067e7190 100644 --- a/src/util/et/et_c.awk +++ b/src/util/et/et_c.awk @@ -109,7 +109,7 @@ c2n["_"]=63 print " * This file is automatically generated; please do not edit it." > outfile print " */" > outfile - print "#if defined(__STDC__) || defined(_WINDOWS)" > outfile + print "#if defined(__STDC__) || defined(_MSDOS) || defined(_WIN32)" > outfile print "#define NOARGS void" > outfile print "#else" > outfile print "#define NOARGS" > outfile diff --git a/src/util/et/internal.h b/src/util/et/internal.h index 9cf55c8d4..f0c0e5723 100644 --- a/src/util/et/internal.h +++ b/src/util/et/internal.h @@ -10,6 +10,6 @@ extern char const * const sys_errlist[]; extern const int sys_nerr; #endif -#if defined(__STDC__) && !defined(HDR_HAS_PERROR) && !defined(_WINDOWS) +#if defined(__STDC__) && !defined(HDR_HAS_PERROR) && !defined(_MSDOS) && !defined(WIN32) void perror (const char *); #endif diff --git a/src/util/et/vfprintf.c b/src/util/et/vfprintf.c index 328d882a0..48b3a40c0 100644 --- a/src/util/et/vfprintf.c +++ b/src/util/et/vfprintf.c @@ -19,7 +19,7 @@ #include #if !defined(_MACINTOSH) -#if defined(HAVE_STDARG_H) || defined(_WINDOWS) || defined (_MACINTOSH) +#if defined(HAVE_STDARG_H) || defined(_MSDOS) || defined(_WIN32) #include #else #include -- 2.26.2