From: cuz Date: Sat, 8 Sep 2001 14:39:01 +0000 (+0000) Subject: Use && and || in preprocessor #if statements. Other minor changes. X-Git-Tag: V2.12.0~2713 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6e29f555d2ac8ba46edebe2acdf87811036df3e2;p=cc65 Use && and || in preprocessor #if statements. Other minor changes. git-svn-id: svn://svn.cc65.org/cc65/trunk@866 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/include/cbm.h b/include/cbm.h index e80145efe..8156806c1 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -39,34 +39,16 @@ /* Load the system specific files here, if needed */ -#ifdef __C64__ -#ifndef _C64_H -#include -#endif -#endif - -#ifdef __C128__ -#ifndef _C128_H -#include -#endif -#endif - -#ifdef __PLUS4__ -#ifndef _PLUS4_H -#include -#endif -#endif - -#ifdef __CBM610__ -#ifndef _CBM610_H -#include -#endif -#endif - -#ifdef __PET__ -#ifndef _PET_H -#include -#endif +#if defined(__C64__) && !defined(_C64_H) +# include +#elif defined(__C128__) && !defined(_C128_H) +# include +#elif defined(__PLUS4__) && !defined(_PLUS4_H) +# include +#elif defined(__CBM610__) && !defined(_CBM610_H) +# include +#elif defined(__PET__) && !defined(_PET_H) +# include #endif @@ -109,11 +91,16 @@ unsigned char __fastcall__ cbm_k_basin (void); void __fastcall__ cbm_k_bsout (unsigned char C); void __fastcall__ cbm_k_clrch (void); -/* BASIC-like functions + + +/* BASIC-like file I/O functions * - * All cbm_* IO functions set extern unsigned char _oserror in case - * of an error. For the meaning of the errorcode see the table below. + * All cbm_* IO functions set _oserror (see errno.h) in case of an + * error. For the meaning of the errorcode see the table below. */ + + + unsigned char cbm_load(const char* name, unsigned char device, unsigned int addr); /* Loads file "name" from given device to given address or to the load @@ -166,5 +153,9 @@ int cbm_write(unsigned char lfn, void* buffer, unsigned int size); * 9 = illegal device number */ + + /* End of cbm.h */ #endif + + diff --git a/include/conio.h b/include/conio.h index d97496371..71bd74023 100644 --- a/include/conio.h +++ b/include/conio.h @@ -54,27 +54,17 @@ -#ifndef _STDARG_H +#if !defined(_STDARG_H) # include #endif -/* Read the CBM file if we're compiling for a CBM machine */ -#ifdef __CBM__ -# ifndef _CBM_H -# include -# endif -#endif - -#ifdef __APPLE2__ -# ifndef _APPLE2_H -# include -# endif -#endif - -#ifdef __ATARI__ -# ifndef _ATARI_H -# include -# endif +/* Include the correct machine specific file */ +#if defined(__CBM__) && !defined(_CBM_H) +# include +#elif defined(__APPLE2__) && !defined(_APPLE2_H) +# include +#elif defined(__ATARI__) && !defined(_ATARI_H) +# include #endif diff --git a/include/ctype.h b/include/ctype.h index 692f0b945..f1b5a8d51 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -67,18 +67,18 @@ int __fastcall__ tolower (int c); /* Always external */ extern unsigned char _ctype[256]; -#define isalnum(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$07"), __AX__) -#define isalpha(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$03"), __AX__) -#define isblank(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$80"), __AX__) -#define iscntrl(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$10"), __AX__) -#define isdigit(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$04"), __AX__) -#define isgraph(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$30\n\tand\t#$30"), __AX__) -#define islower(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$01"), __AX__) -#define isprint(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$10\n\tand\t#$10"), __AX__) -#define ispunct(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$37\n\tand\t#$37"), __AX__) -#define isspace(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$60"), __AX__) -#define isupper(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$02"), __AX__) -#define isxdigit(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$08"), __AX__) +#define isalnum(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$07"), __AX__) +#define isalpha(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$03"), __AX__) +#define isblank(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$80"), __AX__) +#define iscntrl(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$10"), __AX__) +#define isdigit(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$04"), __AX__) +#define isgraph(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n eor #$30\n and #$30"), __AX__) +#define islower(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$01"), __AX__) +#define isprint(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n eor #$10\n and #$10"), __AX__) +#define ispunct(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n eor #$37\n and #$37"), __AX__) +#define isspace(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$60"), __AX__) +#define isupper(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$02"), __AX__) +#define isxdigit(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$08"), __AX__) diff --git a/include/joystick.h b/include/joystick.h index 8bf59f31d..56fa729d2 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -39,16 +39,7 @@ /* Define __JOYSTICK__ for systems that support a joystick */ -#ifdef __ATARI__ -# define __JOYSTICK__ -#endif -#ifdef __C64__ -# define __JOYSTICK__ -#endif -#ifdef __C128__ -# define __JOYSTICK__ -#endif -#ifdef __PLUS4__ +#if defined(__ATARI__) || defined(__C64__) || defined(__C128__) || defined(__PLUS4__) # define __JOYSTICK__ #endif diff --git a/include/mouse.h b/include/mouse.h index 53deb5252..fb9293257 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -39,13 +39,7 @@ /* Define __MOUSE__ for systems that support a mouse */ -#ifdef __C64__ -# define __MOUSE__ -#endif -#ifdef __C128__ -# define __MOUSE__ -#endif -#ifdef __ATARI__ +#if defined(__ATARI__) || defined(__C64__) || defined(__C128__) # define __MOUSE__ #endif @@ -74,8 +68,8 @@ -unsigned char __fastcall__ mouse_init (unsigned char port, - unsigned char sprite, +unsigned char __fastcall__ mouse_init (unsigned char port, + unsigned char sprite, unsigned char type); /* Setup the mouse interrupt handler. If the sprite value is != zero, the * mouse routines will manage the sprite with this number. That means, it