Introduce VA_CDECL: only Turbo C 2.01 needs an explicit cdecl for printf,

all other compilers can use it with pascal or "register" calling conventions.
Saves ~50 bytes for the init code.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@845 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-07 16:13:23 +00:00
parent e56f81d6a9
commit 7ae98cee2a
6 changed files with 19 additions and 11 deletions

View File

@ -63,6 +63,12 @@ static char *portab_hRcsId =
#define I86
#define CDECL cdecl
#if __TURBOC__ > 0x202
/* printf callers do the right thing for tc++ 1.01 but not tc 2.01 */
#define VA_CDECL
#else
#define VA_CDECL cdecl
#endif
#define PASCAL pascal
void __int__(int);
@ -73,6 +79,7 @@ void __int__(int);
#pragma warning(disable: 4761) /* "integral size mismatch in argument;
conversion supplied" */
#define CDECL _cdecl
#define VA_CDECL
#define PASCAL pascal
#define __int__(intno) asm int intno;
#define _SS SS()
@ -88,6 +95,7 @@ static unsigned short __inline SS(void)
#define asm __asm
#define far __far
#define CDECL __cdecl
#define VA_CDECL
#define PASCAL pascal
#define _SS SS()
unsigned short SS(void);

View File

@ -179,8 +179,8 @@ BOOL init_device(struct dhdr FAR * dhp, char * cmdLine,
VOID init_fatal(BYTE * err_msg);
/* prf.c */
WORD CDECL init_printf(CONST BYTE * fmt, ...);
WORD CDECL init_sprintf(BYTE * buff, CONST BYTE * fmt, ...);
int VA_CDECL init_printf(const char * fmt, ...);
int VA_CDECL init_sprintf(char * buff, const char * fmt, ...);
/* procsupt.asm */
VOID ASMCFUNC FAR got_cbreak(void);

View File

@ -144,7 +144,7 @@ static BYTE *charp = 0;
STATIC VOID handle_char(COUNT);
STATIC void ltob(LONG, BYTE *, COUNT);
STATIC void do_printf(const char *, REG va_list);
int CDECL printf(CONST BYTE * fmt, ...);
int VA_CDECL printf(const char * fmt, ...);
/* special handler to switch between sprintf and printf */
STATIC VOID handle_char(COUNT c)
@ -196,7 +196,7 @@ STATIC void ltob(LONG n, BYTE * s, COUNT base)
#define LONGARG 4
/* printf -- short version of printf to conserve space */
int CDECL printf(CONST BYTE * fmt, ...)
int VA_CDECL printf(const char *fmt, ...)
{
va_list arg;
va_start(arg, fmt);
@ -205,7 +205,7 @@ int CDECL printf(CONST BYTE * fmt, ...)
return 0;
}
int CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...)
int VA_CDECL sprintf(char * buff, const char * fmt, ...)
{
va_list arg;

View File

@ -281,8 +281,8 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
/* prf.c */
#ifdef DEBUG
int CDECL printf(CONST BYTE * fmt, ...);
int CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
int VA_CDECL printf(const char * fmt, ...);
int VA_CDECL sprintf(char * buff, const char * fmt, ...);
#endif
VOID hexd(char *title, VOID FAR * p, COUNT numBytes);
void put_unsigned(unsigned n, int base, int width);

View File

@ -24,8 +24,8 @@ char KERNEL[] = "KERNEL.SYS";
#include <fcntl.h>
#include "portab.h"
extern int CDECL printf(CONST BYTE * fmt, ...);
extern int CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
extern int VA_CDECL printf(const char * fmt, ...);
extern int VA_CDECL sprintf(char * buff, const char * fmt, ...);
#ifdef __WATCOMC__
unsigned _dos_close(int handle);

View File

@ -59,8 +59,8 @@
* #including <stdio.h> to make executable MUCH smaller
* using [s]printf from prf.c!
*/
extern WORD CDECL printf(CONST BYTE * fmt, ...);
extern WORD CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
extern int VA_CDECL printf(const char * fmt, ...);
extern int VA_CDECL sprintf(char * buff, const char * fmt, ...);
#include "fat12com.h"
#include "fat16com.h"