mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-25 06:45:10 +02:00
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:
parent
e56f81d6a9
commit
7ae98cee2a
@ -63,6 +63,12 @@ static char *portab_hRcsId =
|
|||||||
|
|
||||||
#define I86
|
#define I86
|
||||||
#define CDECL cdecl
|
#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
|
#define PASCAL pascal
|
||||||
void __int__(int);
|
void __int__(int);
|
||||||
|
|
||||||
@ -73,6 +79,7 @@ void __int__(int);
|
|||||||
#pragma warning(disable: 4761) /* "integral size mismatch in argument;
|
#pragma warning(disable: 4761) /* "integral size mismatch in argument;
|
||||||
conversion supplied" */
|
conversion supplied" */
|
||||||
#define CDECL _cdecl
|
#define CDECL _cdecl
|
||||||
|
#define VA_CDECL
|
||||||
#define PASCAL pascal
|
#define PASCAL pascal
|
||||||
#define __int__(intno) asm int intno;
|
#define __int__(intno) asm int intno;
|
||||||
#define _SS SS()
|
#define _SS SS()
|
||||||
@ -88,6 +95,7 @@ static unsigned short __inline SS(void)
|
|||||||
#define asm __asm
|
#define asm __asm
|
||||||
#define far __far
|
#define far __far
|
||||||
#define CDECL __cdecl
|
#define CDECL __cdecl
|
||||||
|
#define VA_CDECL
|
||||||
#define PASCAL pascal
|
#define PASCAL pascal
|
||||||
#define _SS SS()
|
#define _SS SS()
|
||||||
unsigned short SS(void);
|
unsigned short SS(void);
|
||||||
|
@ -179,8 +179,8 @@ BOOL init_device(struct dhdr FAR * dhp, char * cmdLine,
|
|||||||
VOID init_fatal(BYTE * err_msg);
|
VOID init_fatal(BYTE * err_msg);
|
||||||
|
|
||||||
/* prf.c */
|
/* prf.c */
|
||||||
WORD CDECL init_printf(CONST BYTE * fmt, ...);
|
int VA_CDECL init_printf(const char * fmt, ...);
|
||||||
WORD CDECL init_sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
int VA_CDECL init_sprintf(char * buff, const char * fmt, ...);
|
||||||
|
|
||||||
/* procsupt.asm */
|
/* procsupt.asm */
|
||||||
VOID ASMCFUNC FAR got_cbreak(void);
|
VOID ASMCFUNC FAR got_cbreak(void);
|
||||||
|
@ -144,7 +144,7 @@ static BYTE *charp = 0;
|
|||||||
STATIC VOID handle_char(COUNT);
|
STATIC VOID handle_char(COUNT);
|
||||||
STATIC void ltob(LONG, BYTE *, COUNT);
|
STATIC void ltob(LONG, BYTE *, COUNT);
|
||||||
STATIC void do_printf(const char *, REG va_list);
|
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 */
|
/* special handler to switch between sprintf and printf */
|
||||||
STATIC VOID handle_char(COUNT c)
|
STATIC VOID handle_char(COUNT c)
|
||||||
@ -196,7 +196,7 @@ STATIC void ltob(LONG n, BYTE * s, COUNT base)
|
|||||||
#define LONGARG 4
|
#define LONGARG 4
|
||||||
|
|
||||||
/* printf -- short version of printf to conserve space */
|
/* 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_list arg;
|
||||||
va_start(arg, fmt);
|
va_start(arg, fmt);
|
||||||
@ -205,7 +205,7 @@ int CDECL printf(CONST BYTE * fmt, ...)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
int VA_CDECL sprintf(char * buff, const char * fmt, ...)
|
||||||
{
|
{
|
||||||
va_list arg;
|
va_list arg;
|
||||||
|
|
||||||
|
@ -281,8 +281,8 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
|
|||||||
|
|
||||||
/* prf.c */
|
/* prf.c */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int CDECL printf(CONST BYTE * fmt, ...);
|
int VA_CDECL printf(const char * fmt, ...);
|
||||||
int CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
int VA_CDECL sprintf(char * buff, const char * fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
VOID hexd(char *title, VOID FAR * p, COUNT numBytes);
|
VOID hexd(char *title, VOID FAR * p, COUNT numBytes);
|
||||||
void put_unsigned(unsigned n, int base, int width);
|
void put_unsigned(unsigned n, int base, int width);
|
||||||
|
@ -24,8 +24,8 @@ char KERNEL[] = "KERNEL.SYS";
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
extern int CDECL printf(CONST BYTE * fmt, ...);
|
extern int VA_CDECL printf(const char * fmt, ...);
|
||||||
extern int CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
extern int VA_CDECL sprintf(char * buff, const char * fmt, ...);
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
#ifdef __WATCOMC__
|
||||||
unsigned _dos_close(int handle);
|
unsigned _dos_close(int handle);
|
||||||
|
@ -59,8 +59,8 @@
|
|||||||
* #including <stdio.h> to make executable MUCH smaller
|
* #including <stdio.h> to make executable MUCH smaller
|
||||||
* using [s]printf from prf.c!
|
* using [s]printf from prf.c!
|
||||||
*/
|
*/
|
||||||
extern WORD CDECL printf(CONST BYTE * fmt, ...);
|
extern int VA_CDECL printf(const char * fmt, ...);
|
||||||
extern WORD CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
extern int VA_CDECL sprintf(char * buff, const char * fmt, ...);
|
||||||
|
|
||||||
#include "fat12com.h"
|
#include "fat12com.h"
|
||||||
#include "fat16com.h"
|
#include "fat16com.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user