diff --git a/API/emulation/CPU/Z80.h b/API/emulation/CPU/Z80.h index 371a102..8880672 100644 --- a/API/emulation/CPU/Z80.h +++ b/API/emulation/CPU/Z80.h @@ -175,7 +175,7 @@ CPU_Z80_API void z80_int(Z80 *object, zboolean state); Z_C_SYMBOLS_END -#ifdef CPU_Z80_USE_ABI +#ifdef CPU_Z80_WITH_ABI # ifndef CPU_Z80_DEPENDENCIES_H # include diff --git a/README b/README index d9af886..911511a 100644 --- a/README +++ b/README @@ -52,16 +52,6 @@ Code configuration want to use Z, you can provide your own header with the types and macros used by the emulator. - CPU_Z80_BUILD_ABI - Builds the generic CPU emulator ABI. - - CPU_Z80_BUILD_MODULE_ABI - Builds the generic module ABI. This macro also enables CPU_Z80_BUILD_ABI, so - the generic CPU emulator ABI will be built too. This option is intended to - be used when building a true module loadable at runtime with dlopen(), - LoadLibrary() or similar. The ABI module can be accessed via the weak symbol - __module_abi__. - CPU_Z80_HIDE_ABI Makes the generic CPU emulator ABI private. @@ -72,13 +62,20 @@ Code configuration You need to define this to compile or use the emulator as a static library or if you have added Z80.h and Z80.c to your project. - CPU_Z80_USE_ABI - Tells Z80.h to declare the prototype of the generic CPU emulator ABI. - CPU_Z80_USE_LOCAL_HEADER Use this if you have imported Z80.h and Z80.c to your project. Z80.c will #include "Z80.h" instead of . + CPU_Z80_WITH_ABI + Builds the generic CPU emulator ABI and declares its prototype in Z80.h. + + CPU_Z80_WITH_MODULE_ABI + Builds the generic module ABI. This macro also enables CPU_Z80_WITH_ABI, so + the generic CPU emulator ABI will be built too. This option is intended to + be used when building a true module loadable at runtime with dlopen(), + LoadLibrary() or similar. The ABI module can be accessed via the weak symbol + __module_abi__. + Use in Proprietary Software =========================== diff --git a/README.md b/README.md index 687f79f..02d43bb 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,12 @@ There are some predefined macros that control the compilation: Name | Description --- | --- `CPU_Z80_DEPENDENCIES_H` | If defined, `Z80.h` will `#include` only this header as dependency. If you don't want to use Z, you can provide your own header with the types and macros used by the emulator. -`CPU_Z80_BUILD_ABI` | Builds the generic CPU emulator ABI. -`CPU_Z80_BUILD_MODULE_ABI` | Builds the generic module ABI. This macro also enables CPU_Z80_BUILD_ABI, so the generic CPU emulator ABI will be built too. This option is intended to be used when building a true module loadable at runtime with `dlopen()`, `LoadLibrary()` or similar. The ABI module can be accessed via the [weak symbol](https://en.wikipedia.org/wiki/Weak_symbol) `__module_abi__`. `CPU_Z80_HIDE_ABI` | Makes the generic CPU emulator ABI private. `CPU_Z80_HIDE_API` | Makes the public functions private. `CPU_Z80_STATIC` | You need to define this to compile or use the emulator as a static library or if you have added `Z80.h` and `Z80.c` to your project. -`CPU_Z80_USE_ABI` | Tells `Z80.h` to declare the prototype of the generic CPU emulator ABI. `CPU_Z80_USE_LOCAL_HEADER` | Use this if you have imported `Z80.h` and `Z80.c` to your project. `Z80.c` will `#include "Z80.h"` instead of ``. +`CPU_Z80_WITH_ABI` | Builds the generic CPU emulator ABI and declares its prototype in `Z80.h`. +`CPU_Z80_WITH_MODULE_ABI` | Builds the generic module ABI. This macro also enables CPU_Z80_BUILD_ABI, so the generic CPU emulator ABI will be built too. This option is intended to be used when building a true module loadable at runtime with `dlopen()`, `LoadLibrary()` or similar. The ABI module can be accessed via the [weak symbol](https://en.wikipedia.org/wiki/Weak_symbol) `__module_abi__`.
diff --git a/building/premake4.lua b/building/premake4.lua index abad0f4..bdf799f 100644 --- a/building/premake4.lua +++ b/building/premake4.lua @@ -23,11 +23,11 @@ solution "Z80" kind "SharedLib" configuration "*dynamic-module" - defines {"CPU_Z80_BUILD_MODULE_ABI"} + defines {"CPU_Z80_WITH_MODULE_ABI"} configuration "*static*" kind "StaticLib" defines {"CPU_Z80_STATIC"} configuration "*static-module" - defines {"CPU_Z80_BUILD_ABI"} + defines {"CPU_Z80_WITH_ABI"} diff --git a/sources/Z80.c b/sources/Z80.c index b1a570d..0cef8af 100644 --- a/sources/Z80.c +++ b/sources/Z80.c @@ -28,11 +28,11 @@ this library. If not, see . */ # define CPU_Z80_API Z_API_EXPORT #endif -#if defined(CPU_Z80_BUILD_ABI) || defined(CPU_Z80_BUILD_MODULE_ABI) -# ifndef CPU_Z80_USE_ABI -# define CPU_Z80_USE_ABI -# endif +#if defined(CPU_Z80_WITH_MODULE_ABI) && !defined(CPU_Z80_WITH_ABI) +# define CPU_Z80_WITH_ABI +#endif +#ifdef CPU_Z80_WITH_ABI # if defined(CPU_Z80_HIDE_ABI) # define CPU_Z80_ABI static # elif defined(CPU_Z80_STATIC) @@ -1603,7 +1603,7 @@ CPU_Z80_API void z80_int(Z80 *object, zboolean state) {INT = state;} /* MARK: - ABI */ -#if defined(CPU_Z80_BUILD_ABI) || defined(CPU_Z80_BUILD_MODULE_ABI) +#ifdef CPU_Z80_WITH_ABI static void will_read_state(Z80 *object) {R = R_ALL;} static void did_write_state(Z80 *object) {R7 = R; } @@ -1641,7 +1641,7 @@ CPU_Z80_API void z80_int(Z80 *object, zboolean state) {INT = state;} #endif -#if defined(CPU_Z80_BUILD_MODULE_ABI) +#ifdef CPU_Z80_WITH_MODULE_ABI # include