From: Oliver Schmidt Date: Fri, 2 Feb 2018 11:59:05 +0000 (+0100) Subject: Factored out target specific inclusion of target header. X-Git-Tag: V2.17~28 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d7afadb2fe62a2154ad5bcb949644da17e4ac7c6;p=cc65 Factored out target specific inclusion of target header. So far conio.h included the target header to get the CH_... and COLOR_... macros. However tgi.h never did the same to get the TGI_COLOR_... macros. And some time ago the JOY_..._MASK macros moved from joystick.h into the target header yet joystick.h didn't include the target header. Why wasn't that issue detected so far? Because about every program using TGI and/or the joystick uses CONIO too and therefore includes the target header that way. However, conceptually it's clean to factor out the target header inclusion and have tgi.h and joystick.h do it like conio.h. Apart from that user code may make direct use of target.h too. --- diff --git a/include/conio.h b/include/conio.h index 9cd505766..72421af86 100644 --- a/include/conio.h +++ b/include/conio.h @@ -54,40 +54,8 @@ -#if !defined(_STDARG_H) -# include -#endif - -/* Include the correct machine-specific file */ -#if defined(__APPLE2ENH__) -# include -#elif defined(__APPLE2__) -# include -#elif defined(__ATARI5200__) -# include -#elif defined(__ATARI__) -# include -#elif defined(__ATMOS__) -# include -#elif defined(__CBM__) -# include -#elif defined(__CREATIVISION__) -# include -#elif defined(__GAMATE__) -# include -#elif defined(__GEOS__) -# include -#elif defined(__LUNIX__) -# include -#elif defined(__LYNX__) -# include -#elif defined(__NES__) -# include -#elif defined(__OSIC1P__) -# include -#elif defined(__PCE__) -# include -#endif +#include +#include @@ -232,16 +200,16 @@ void __fastcall__ cputhex16 (unsigned val); ** the macro will give access to the actual function. */ -#if defined(_textcolor) +#ifdef _textcolor # define textcolor(x) _textcolor(x) #endif -#if defined(_bgcolor) +#ifdef _bgcolor # define bgcolor(x) _bgcolor(x) #endif -#if defined(_bordercolor) +#ifdef _bordercolor # define bordercolor(x) _bordercolor(x) #endif -#if defined(_cpeekcolor) +#ifdef _cpeekcolor # define cpeekcolor(x) _cpeekcolor(x) #endif diff --git a/include/joystick.h b/include/joystick.h index 26f339fe4..b6771c381 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -38,6 +38,10 @@ +#include + + + /*****************************************************************************/ /* Definitions */ /*****************************************************************************/ @@ -103,6 +107,3 @@ unsigned char __fastcall__ joy_read (unsigned char joystick); /* End of joystick.h */ #endif - - - diff --git a/include/target.h b/include/target.h new file mode 100644 index 000000000..af401ec35 --- /dev/null +++ b/include/target.h @@ -0,0 +1,73 @@ +/*****************************************************************************/ +/* */ +/* target.h */ +/* */ +/* Target specific definitions */ +/* */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#ifndef _TARGET_H +#define _TARGET_H + + + +/* Include the correct target specific file */ +#if defined(__APPLE2ENH__) +# include +#elif defined(__APPLE2__) +# include +#elif defined(__ATARI__) +# include +#elif defined(__ATARI2600__) +# include +#elif defined(__ATARI5200__) +# include +#elif defined(__ATMOS__) +# include +#elif defined(__CBM__) +# include +#elif defined(__CREATIVISION__) +# include +#elif defined(__GAMATE__) +# include +#elif defined(__GEOS__) +# include +#elif defined(__LYNX__) +# include +#elif defined(__NES__) +# include +#elif defined(__OSIC1P__) +# include +#elif defined(__PCE__) +# include +#elif defined(__SUPERVISION__) +# include +#elif defined(__TELESTRAT__) +# include +#endif + + + +/* End of target.h */ +#endif diff --git a/include/tgi.h b/include/tgi.h index 02dff8868..f458180c5 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -38,9 +38,8 @@ -#ifndef _TGI_ERROR_H #include -#endif +#include @@ -284,6 +283,3 @@ int __fastcall__ tgi_imulround (int rhs, int lhs); /* End of tgi.h */ #endif - - -