Predefined macros.

This commit is contained in:
redcode
2018-11-04 23:48:42 +01:00
parent 5e6162cfb6
commit e5bced063f
5 changed files with 21 additions and 25 deletions

View File

@@ -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 <Z/ABIs/generic/emulation.h>

23
README
View File

@@ -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 <emulation/CPU/Z80.h>.
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
===========================

View File

@@ -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 `<emulation/CPU/Z80.h>`.
`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__`.
<br>

View File

@@ -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"}

View File

@@ -28,11 +28,11 @@ this library. If not, see <http://www.gnu.org/licenses/>. */
# 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 <Z/ABIs/generic/module.h>