> -----Original Message-----

> From: Atari Ace [mailto:atari_ace@verizon.net]
> Sent: Sunday, September 27, 2009 7:58 AM
> To: submit@mamedev.org
> Cc: atariace@hotmail.com
> Subject: [patch] More _NAME macros
> 
> Hi mamedev,
> 
> MAME's idiom for function/data macros is to first implement
> <name>_NAME, then implement the other macros in terms of the _NAME
> macro.  Then in principle only a single line needs editing to change
> the naming convention.
> 
> This patchset implements this idiom more completely.  The first patch
> adds some missing _NAME macros and fixes cases in source files that
> should be using the macros.  The second patch then changes header
> files where the macros should have been used, but weren't.  This
> required changing the idiom for removing a machine driver function
> pointer from MDRV_<FUNCTION>(NULL) to MDRV_<FUNCTION>(0), to avoid
> problems with NULL being macro expanded.  This actually unifies the
> handling of all such cases, as we already had ipt_0 and driver_init_0.
> It also required reworking the devtempl.h implementation in a way that
> triggered a warning on MSVC about using empty macros, so vconv.c
> needed to be updated.  The third patch then renames all the _NAME and
> _0 macros to verify that all the cases have been covered, so it isn't
> intended to be applied.
> 
> ~aa
This commit is contained in:
Aaron Giles 2009-10-01 17:27:29 +00:00
parent 61eb812096
commit fe289e67f5
27 changed files with 154 additions and 129 deletions

View File

@ -141,7 +141,7 @@ static void set_irq_line(dsp56k_core* cpustate, int irqline, int state)
{
/* If it changes state from asserted to cleared. Call the reset function. */
if (cpustate->reset_state == TRUE)
cpu_reset_dsp56k(cpustate->device);
CPU_RESET_NAME(dsp56k)(cpustate->device);
cpustate->reset_state = FALSE;
}

View File

@ -653,7 +653,7 @@ CPU_GET_INFO( h8_3007 )
{
switch (state)
{
case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = address_map_h8_3007_internal_map; break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3007_internal_map); break;
case CPUINFO_FCT_INIT: info->init = CPU_INIT_NAME(h8_3007); break;
case DEVINFO_STR_NAME: strcpy(info->s, "H8/3007"); break;
default:

View File

@ -747,7 +747,7 @@ CPU_GET_INFO( h8_3334 )
case CPUINFO_INT_ADDRBUS_SHIFT_IO: info->i = 0; break;
// Internal maps
case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = address_map_h8_3334_internal_map; break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(h8_3334_internal_map); break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map8 = NULL; break;
case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO: info->internal_map16 = NULL; break;

View File

@ -64,6 +64,9 @@ static const char DEVTEMPLATE_SOURCE[] = __FILE__;
***************************************************************************/
#define DEVTEMPLATE_ID1(x) DEVTEMPLATE_ID(x,)
#define DEVTEMPLATE_DERIVED_ID1(x) DEVTEMPLATE_DERIVED_ID(x,)
/* flag bits for DEVTEMPLATE_FEATURES */
#define DT_HAS_START 0x0001
#define DT_HAS_RESET 0x0002
@ -164,36 +167,36 @@ DEVICE_GET_INFO( DEVTEMPLATE_ID(,) )
/* --- the following bits of info are returned as pointers --- */
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_ROM_REGION)
case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_ID(rom_,); break;
case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_ID1(ROM_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_MACHINE_CONFIG)
case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_ID(machine_config_,); break;
case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_ID1(MACHINE_DRIVER_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_CONTRACT_LIST)
case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_ID(device_contract_list_,); break;
case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_ID1(DEVICE_CONTRACT_LIST_NAME()); break;
#endif
/* --- the following bits of info are returned as pointers to data or functions --- */
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_START)
case DEVINFO_FCT_START: info->start = DEVTEMPLATE_ID(device_start_,); break;
case DEVINFO_FCT_START: info->start = DEVTEMPLATE_ID1(DEVICE_START_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_RESET)
case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_ID(device_reset_,); break;
case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_ID1(DEVICE_RESET_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_STOP)
case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_ID(device_stop_,); break;
case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_ID1(DEVICE_STOP_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_EXECUTE)
case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_ID(device_execute_,); break;
case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_ID1(DEVICE_EXECUTE_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_NVRAM)
case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_ID(device_nvram_,); break;
case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_ID1(DEVICE_NVRAM_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_VALIDITY_CHECK)
case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_ID(device_validity_check_,); break;
case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_ID1(DEVICE_VALIDITY_CHECK_NAME()); break;
#endif
#if ((DEVTEMPLATE_FEATURES) & DT_HAS_CUSTOM_CONFIG)
case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_ID(device_custom_config_,); break;
case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_ID1(DEVICE_CUSTOM_CONFIG_NAME()); break;
#endif
/* --- the following bits of info are returned as NULL-terminated strings --- */
@ -239,36 +242,36 @@ DEVICE_GET_INFO( DEVTEMPLATE_DERIVED_ID(,) )
{
/* --- the following bits of info are returned as pointers --- */
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_ROM_REGION)
case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_DERIVED_ID(rom_,); break;
case DEVINFO_PTR_ROM_REGION: info->romregion = DEVTEMPLATE_DERIVED_ID1(ROM_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_MACHINE_CONFIG)
case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_DERIVED_ID(machine_config_,); break;
case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = DEVTEMPLATE_DERIVED_ID1(MACHINE_DRIVER_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CONTRACT_LIST)
case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_DERIVED_ID(contract_list_,); break;
case DEVINFO_PTR_CONTRACT_LIST: info->contract_list = DEVTEMPLATE_DERIVED_ID1(DEVICE_CONTRACT_LIST_NAME()); break;
#endif
/* --- the following bits of info are returned as pointers to data or functions --- */
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_START)
case DEVINFO_FCT_START: info->start = DEVTEMPLATE_DERIVED_ID(device_start_,); break;
case DEVINFO_FCT_START: info->start = DEVTEMPLATE_DERIVED_ID1(DEVICE_START_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_RESET)
case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_DERIVED_ID(device_reset_,); break;
case DEVINFO_FCT_RESET: info->reset = DEVTEMPLATE_DERIVED_ID1(DEVICE_RESET_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_STOP)
case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_DERIVED_ID(device_stop_,); break;
case DEVINFO_FCT_STOP: info->stop = DEVTEMPLATE_DERIVED_ID1(DEVICE_STORE_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_EXECUTE)
case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_DERIVED_ID(device_execute_,); break;
case DEVINFO_FCT_EXECUTE: info->execute = DEVTEMPLATE_DERIVED_ID1(DEVICE_EXECUTE_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_NVRAM)
case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_DERIVED_ID(device_nvram_,); break;
case DEVINFO_FCT_NVRAM: info->nvram = DEVTEMPLATE_DERIVED_ID1(DEVICE_NVRAM_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_VALIDITY_CHECK)
case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_DERIVED_ID(device_validity_check_,); break;
case DEVINFO_FCT_VALIDITY_CHECK: info->validity_check = DEVTEMPLATE_DERIVED_ID1(DEVICE_VALIDITY_CHECK_NAME()); break;
#endif
#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CUSTOM_CONFIG)
case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_DERIVED_ID(device_custom_config_,); break;
case DEVINFO_FCT_CUSTOM_CONFIG: info->custom_config = DEVTEMPLATE_DERIVED_ID1(DEVICE_CUSTOM_CONFIG_NAME()); break;
#endif
/* --- the following bits of info are returned as NULL-terminated strings --- */

View File

@ -82,8 +82,9 @@ enum
/* these macros are used for declaring gfx_decode_entry_entry info arrays. */
#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry gfxdecodeinfo_##name[]
#define GFXDECODE_START( name ) const gfx_decode_entry gfxdecodeinfo_##name[] = {
#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
#define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0, 0 },
#define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale },
#define GFXDECODE_END { 0 } };

View File

@ -21,55 +21,68 @@
#include "devintrf.h"
#define DRIVER_INIT(name) void driver_init_##name(running_machine *machine)
#define DRIVER_INIT_CALL(name) driver_init_##name(machine)
#define DRIVER_INIT_NAME(name) driver_init_##name
#define DRIVER_INIT(name) void DRIVER_INIT_NAME(name)(running_machine *machine)
#define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)(machine)
#define NVRAM_HANDLER(name) void nvram_handler_##name(running_machine *machine, mame_file *file, int read_or_write)
#define NVRAM_HANDLER_CALL(name) nvram_handler_##name(machine, file, read_or_write)
#define NVRAM_HANDLER_NAME(name) nvram_handler_##name
#define NVRAM_HANDLER(name) void NVRAM_HANDLER_NAME(name)(running_machine *machine, mame_file *file, int read_or_write)
#define NVRAM_HANDLER_CALL(name) NVRAM_HANDLER_NAME(name)(machine, file, read_or_write)
#define MEMCARD_HANDLER(name) void memcard_handler_##name(running_machine *machine, mame_file *file, int action)
#define MEMCARD_HANDLER_CALL(name) memcard_handler_##name(machine, file, action)
#define MEMCARD_HANDLER_NAME(name) memcard_handler_##name
#define MEMCARD_HANDLER(name) void MEMCARD_HANDLER_NAME(name)(running_machine *machine, mame_file *file, int action)
#define MEMCARD_HANDLER_CALL(name) MEMCARD_HANDLER_NAME(name)(machine, file, action)
#define MACHINE_START(name) void machine_start_##name(running_machine *machine)
#define MACHINE_START_CALL(name) machine_start_##name(machine)
#define MACHINE_START_NAME(name) machine_start_##name
#define MACHINE_START(name) void MACHINE_START_NAME(name)(running_machine *machine)
#define MACHINE_START_CALL(name) MACHINE_START_NAME(name)(machine)
#define MACHINE_RESET(name) void machine_reset_##name(running_machine *machine)
#define MACHINE_RESET_CALL(name) machine_reset_##name(machine)
#define MACHINE_RESET_NAME(name) machine_reset_##name
#define MACHINE_RESET(name) void MACHINE_RESET_NAME(name)(running_machine *machine)
#define MACHINE_RESET_CALL(name) MACHINE_RESET_NAME(name)(machine)
#define SOUND_START(name) void sound_start_##name(running_machine *machine)
#define SOUND_START_CALL(name) sound_start_##name(machine)
#define SOUND_START_NAME(name) sound_start_##name
#define SOUND_START(name) void SOUND_START_NAME(name)(running_machine *machine)
#define SOUND_START_CALL(name) SOUND_START_NAME(name)(machine)
#define SOUND_RESET(name) void sound_reset_##name(running_machine *machine)
#define SOUND_RESET_CALL(name) sound_reset_##name(machine)
#define SOUND_RESET_NAME(name) sound_reset_##name
#define SOUND_RESET(name) void SOUND_RESET_NAME(name)(running_machine *machine)
#define SOUND_RESET_CALL(name) SOUND_RESET_NAME(name)(machine)
#define VIDEO_START(name) void video_start_##name(running_machine *machine)
#define VIDEO_START_CALL(name) video_start_##name(machine)
#define VIDEO_START_NAME(name) video_start_##name
#define VIDEO_START(name) void VIDEO_START_NAME(name)(running_machine *machine)
#define VIDEO_START_CALL(name) VIDEO_START_NAME(name)(machine)
#define VIDEO_RESET(name) void video_reset_##name(running_machine *machine)
#define VIDEO_RESET_CALL(name) video_reset_##name(machine)
#define VIDEO_RESET_NAME(name) video_reset_##name
#define VIDEO_RESET(name) void VIDEO_RESET_NAME(name)(running_machine *machine)
#define VIDEO_RESET_CALL(name) VIDEO_RESET_NAME(name)(machine)
#define PALETTE_INIT(name) void palette_init_##name(running_machine *machine, const UINT8 *color_prom)
#define PALETTE_INIT_CALL(name) palette_init_##name(machine, color_prom)
#define PALETTE_INIT_NAME(name) palette_init_##name
#define PALETTE_INIT(name) void PALETTE_INIT_NAME(name)(running_machine *machine, const UINT8 *color_prom)
#define PALETTE_INIT_CALL(name) PALETTE_INIT_NAME(name)(machine, color_prom)
#define VIDEO_EOF(name) void video_eof_##name(running_machine *machine)
#define VIDEO_EOF_CALL(name) video_eof_##name(machine)
#define VIDEO_EOF_NAME(name) video_eof_##name
#define VIDEO_EOF(name) void VIDEO_EOF_NAME(name)(running_machine *machine)
#define VIDEO_EOF_CALL(name) VIDEO_EOF_NAME(name)(machine)
#define VIDEO_UPDATE(name) UINT32 video_update_##name(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect)
#define VIDEO_UPDATE_CALL(name) video_update_##name(screen, bitmap, cliprect)
#define VIDEO_UPDATE_NAME(name) video_update_##name
#define VIDEO_UPDATE(name) UINT32 VIDEO_UPDATE_NAME(name)(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect)
#define VIDEO_UPDATE_CALL(name) VIDEO_UPDATE_NAME(name)(screen, bitmap, cliprect)
/* NULL versions */
#define nvram_handler_NULL NULL
#define memcard_handler_NULL NULL
#define machine_start_NULL NULL
#define machine_reset_NULL NULL
#define sound_start_NULL NULL
#define sound_reset_NULL NULL
#define video_start_NULL NULL
#define video_reset_NULL NULL
#define palette_init_NULL NULL
#define video_eof_NULL NULL
#define video_update_NULL NULL
#define driver_init_0 NULL
#define nvram_handler_0 NULL
#define memcard_handler_0 NULL
#define machine_start_0 NULL
#define machine_reset_0 NULL
#define sound_start_0 NULL
#define sound_reset_0 NULL
#define video_start_0 NULL
#define video_reset_0 NULL
#define palette_init_0 NULL
#define video_eof_0 NULL
#define video_update_0 NULL
typedef void (*driver_init_func)(running_machine *machine);
@ -185,12 +198,14 @@ struct _game_driver
MACROS FOR BUILDING GAME DRIVERS
***************************************************************************/
#define GAME_NAME(name) driver_##name
#define GAME_EXTERN(name) extern const game_driver GAME_NAME(name)
#define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \
GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0))
#define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \
extern const game_driver driver_##NAME; \
const game_driver driver_##NAME = \
const game_driver GAME_NAME(NAME) = \
{ \
__FILE__, \
#PARENT, \
@ -198,18 +213,14 @@ const game_driver driver_##NAME = \
FULLNAME, \
#YEAR, \
COMPANY, \
machine_config_##MACHINE, \
ipt_##INPUT, \
driver_init_##INIT, \
rom_##NAME, \
MACHINE_DRIVER_NAME(MACHINE), \
INPUT_PORTS_NAME(INPUT), \
DRIVER_INIT_NAME(INIT), \
ROM_NAME(NAME), \
(MONITOR)|(FLAGS), \
&LAYOUT[0] \
};
/* this allows to leave the INIT field empty in the GAME() macro call */
#define driver_init_0 0
#define ipt_0 0
/***************************************************************************
@ -218,7 +229,7 @@ const game_driver driver_##NAME = \
extern const game_driver * const drivers[];
extern const game_driver driver_empty;
GAME_EXTERN(empty);

View File

@ -744,9 +744,15 @@ struct _inp_header
MACROS FOR BUILDING INPUT PORTS
***************************************************************************/
/* so that "0" can be used for unneeded input ports */
#define ipt_0 NULL
/* name of table */
#define INPUT_PORTS_NAME(_name) ipt_##_name
/* start of table */
#define INPUT_PORTS_START(_name) \
const input_port_token ipt_##_name[] = {
const input_port_token INPUT_PORTS_NAME(_name)[] = {
/* end of table */
#define INPUT_PORTS_END \
@ -754,12 +760,12 @@ struct _inp_header
/* aliasing */
#define INPUT_PORTS_EXTERN(_name) \
extern const input_port_token ipt_##_name[]
extern const input_port_token INPUT_PORTS_NAME(_name)[]
/* including */
#define PORT_INCLUDE(_name) \
TOKEN_UINT32_PACK1(INPUT_TOKEN_INCLUDE, 8), \
TOKEN_PTR(tokenptr, &ipt_##_name[0]),
TOKEN_PTR(tokenptr, &INPUT_PORTS_NAME(_name)[0]),
/* start of a new input port (with included tag) */
#define PORT_START(_tag) \

View File

@ -103,7 +103,7 @@ struct _laserdisc_config
MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, audio, _func)
#define MDRV_LASERDISC_OVERLAY(_update, _width, _height, _format) \
MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, overupdate, video_update_##_update) \
MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, overupdate, VIDEO_UPDATE_NAME(_update)) \
MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overwidth, _width) \
MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overheight, _height) \
MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, overformat, _format)

View File

@ -273,7 +273,7 @@ int mame_execute(core_options *options)
/* if no driver, use the internal empty driver */
if (driver == NULL)
{
driver = &driver_empty;
driver = &GAME_NAME(empty);
if (firstgame)
started_empty = TRUE;
}

View File

@ -191,13 +191,13 @@ union _machine_config_token
/* use this to declare external references to a machine driver */
#define MACHINE_DRIVER_EXTERN(_name) \
extern const machine_config_token machine_config_##_name[]
extern const machine_config_token MACHINE_DRIVER_NAME(_name)[]
/* importing data from other machine drivers */
#define MDRV_IMPORT_FROM(_name) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \
TOKEN_PTR(tokenptr, machine_config_##_name),
TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)),
/* core parameters */
@ -223,19 +223,19 @@ union _machine_config_token
/* core functions */
#define MDRV_MACHINE_START(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \
TOKEN_PTR(machine_start, machine_start_##_func),
TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)),
#define MDRV_MACHINE_RESET(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_RESET, 8), \
TOKEN_PTR(machine_reset, machine_reset_##_func),
TOKEN_PTR(machine_reset, MACHINE_RESET_NAME(_func)),
#define MDRV_NVRAM_HANDLER(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_NVRAM_HANDLER, 8), \
TOKEN_PTR(nvram_handler, nvram_handler_##_func),
TOKEN_PTR(nvram_handler, NVRAM_HANDLER_NAME(_func)),
#define MDRV_MEMCARD_HANDLER(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MEMCARD_HANDLER, 8), \
TOKEN_PTR(memcard_handler, memcard_handler_##_func),
TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)),
/* core video parameters */
@ -244,7 +244,7 @@ union _machine_config_token
#define MDRV_GFXDECODE(_gfx) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_GFXDECODE, 8), \
TOKEN_PTR(gfxdecode, gfxdecodeinfo_##_gfx),
TOKEN_PTR(gfxdecode, GFXDECODE_NAME(_gfx)),
#define MDRV_PALETTE_LENGTH(_length) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_PALETTE_LENGTH, 8, _length, 24),
@ -257,33 +257,33 @@ union _machine_config_token
/* core video functions */
#define MDRV_PALETTE_INIT(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \
TOKEN_PTR(palette_init, palette_init_##_func),
TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)),
#define MDRV_VIDEO_START(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_START, 8), \
TOKEN_PTR(video_start, video_start_##_func),
TOKEN_PTR(video_start, VIDEO_START_NAME(_func)),
#define MDRV_VIDEO_RESET(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_RESET, 8), \
TOKEN_PTR(video_reset, video_reset_##_func),
TOKEN_PTR(video_reset, VIDEO_RESET_NAME(_func)),
#define MDRV_VIDEO_EOF(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_EOF, 8), \
TOKEN_PTR(video_eof, video_eof_##_func),
TOKEN_PTR(video_eof, VIDEO_EOF_NAME(_func)),
#define MDRV_VIDEO_UPDATE(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_VIDEO_UPDATE, 8), \
TOKEN_PTR(video_update, video_update_##_func),
TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)),
/* core sound functions */
#define MDRV_SOUND_START(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \
TOKEN_PTR(sound_start, sound_start_##_func),
TOKEN_PTR(sound_start, SOUND_START_NAME(_func)),
#define MDRV_SOUND_RESET(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_RESET, 8), \
TOKEN_PTR(sound_start, sound_reset_##_func),
TOKEN_PTR(sound_start, SOUND_RESET_NAME(_func)),
/* add/remove devices */

View File

@ -248,7 +248,7 @@ int ui_display_startup_screens(running_machine *machine, int first_time, int sho
/* disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver,
or if we are debugging */
if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &driver_empty || (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &GAME_NAME(empty) || (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
show_gameinfo = show_warnings = show_disclaimer = FALSE;
/* initialize the on-screen display system */

View File

@ -2252,7 +2252,7 @@ static MACHINE_DRIVER_START( ozon1 )
MDRV_CPU_IO_MAP(ozon1_io_map)
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
MDRV_MACHINE_RESET(NULL)
MDRV_MACHINE_RESET(0)
MDRV_PALETTE_INIT(rockclim)
MDRV_PALETTE_LENGTH(32)
@ -2344,7 +2344,7 @@ static MACHINE_DRIVER_START( harem )
MDRV_CPU_PROGRAM_MAP(harem_cpu2)
MDRV_CPU_IO_MAP(harem_cpu2_io)
MDRV_MACHINE_RESET(NULL)
MDRV_MACHINE_RESET(0)
MDRV_PALETTE_INIT(rockclim)
MDRV_PALETTE_LENGTH(32)

View File

@ -919,7 +919,7 @@ static MACHINE_DRIVER_START( comad )
/* video hardware */
MDRV_VIDEO_UPDATE(comad)
MDRV_VIDEO_EOF(NULL)
MDRV_VIDEO_EOF(0)
MACHINE_DRIVER_END
static MACHINE_DRIVER_START( supmodel )
@ -932,7 +932,7 @@ static MACHINE_DRIVER_START( supmodel )
/* video hardware */
MDRV_VIDEO_UPDATE(comad)
MDRV_VIDEO_EOF(NULL)
MDRV_VIDEO_EOF(0)
/* sound hardware */
MDRV_SOUND_REPLACE("oki", OKIM6295, 1584000)
@ -950,7 +950,7 @@ static MACHINE_DRIVER_START( fantsia2 )
/* video hardware */
MDRV_VIDEO_UPDATE(comad)
MDRV_VIDEO_EOF(NULL)
MDRV_VIDEO_EOF(0)
MACHINE_DRIVER_END
static MACHINE_DRIVER_START( galhustl )
@ -963,7 +963,7 @@ static MACHINE_DRIVER_START( galhustl )
/* video hardware */
MDRV_VIDEO_UPDATE(comad)
MDRV_VIDEO_EOF(NULL)
MDRV_VIDEO_EOF(0)
/* sound hardware */
MDRV_SOUND_REPLACE("oki", OKIM6295, 1056000)

View File

@ -1987,7 +1987,7 @@ static MACHINE_DRIVER_START( reactor )
MDRV_CPU_MODIFY("maincpu")
MDRV_CPU_PROGRAM_MAP(reactor_map)
MDRV_NVRAM_HANDLER(NULL)
MDRV_NVRAM_HANDLER(0)
/* sound hardware */
MDRV_SOUND_ADD("samples", SAMPLES, 0)

View File

@ -811,7 +811,7 @@ static MACHINE_DRIVER_START( jngolady )
MDRV_CPU_PROGRAM_MAP(nsc_map)
/* sound hardware */
MDRV_SOUND_START(NULL)
MDRV_SOUND_START(0)
MDRV_DEVICE_REMOVE("cvsd")
MDRV_SOUND_ADD("msm", MSM5205, XTAL_400kHz)
@ -830,7 +830,7 @@ static MACHINE_DRIVER_START( cntrygrl )
MDRV_DEVICE_REMOVE("cpu1")
/* sound hardware */
MDRV_SOUND_START(NULL)
MDRV_SOUND_START(0)
MDRV_DEVICE_REMOVE("cvsd")
MACHINE_DRIVER_END

View File

@ -1523,10 +1523,10 @@ static void security_cart_init( running_machine *machine, int cart, const char *
switch( cart )
{
case 0:
nvram_handler_security_cart_0 = nvram_handler_x76f041_0;
nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f041_0);
break;
case 1:
nvram_handler_security_cart_1 = nvram_handler_x76f041_1;
nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f041_1);
break;
}
@ -1539,10 +1539,10 @@ static void security_cart_init( running_machine *machine, int cart, const char *
switch( cart )
{
case 0:
nvram_handler_security_cart_0 = nvram_handler_x76f100_0;
nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(x76f100_0);
break;
case 1:
nvram_handler_security_cart_1 = nvram_handler_x76f100_1;
nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(x76f100_1);
break;
}
@ -1555,10 +1555,10 @@ static void security_cart_init( running_machine *machine, int cart, const char *
switch( cart )
{
case 0:
nvram_handler_security_cart_0 = nvram_handler_zs01_0;
nvram_handler_security_cart_0 = NVRAM_HANDLER_NAME(zs01_0);
break;
case 1:
nvram_handler_security_cart_1 = nvram_handler_zs01_1;
nvram_handler_security_cart_1 = NVRAM_HANDLER_NAME(zs01_1);
break;
}

View File

@ -1654,6 +1654,8 @@ static UINT8 megadrive_io_tx_regs[3];
static void megadrive_init_io(running_machine *machine)
{
const input_port_token *ipt = machine->gamedrv->ipt;
megadrive_io_data_regs[0] = 0x7f;
megadrive_io_data_regs[1] = 0x7f;
megadrive_io_data_regs[2] = 0x7f;
@ -1664,10 +1666,10 @@ static void megadrive_init_io(running_machine *machine)
megadrive_io_tx_regs[1] = 0xff;
megadrive_io_tx_regs[2] = 0xff;
if (machine->gamedrv->ipt == ipt_megadri6)
if (ipt == INPUT_PORTS_NAME(megadri6))
init_megadri6_io(machine);
if (machine->gamedrv->ipt == ipt_ssf2ghw)
if (ipt == INPUT_PORTS_NAME(ssf2ghw))
init_megadri6_io(machine);
}
@ -6212,6 +6214,8 @@ static int megadriv_tas_callback(const device_config *device)
static void megadriv_init_common(running_machine *machine)
{
const input_port_token *ipt = machine->gamedrv->ipt;
/* Look to see if this system has the standard Sound Z80 */
_genesis_snd_z80_cpu = cputag_get_cpu(machine, "genesis_snd_z80");
if (_genesis_snd_z80_cpu != NULL)
@ -6266,7 +6270,7 @@ static void megadriv_init_common(running_machine *machine)
m68k_set_tas_callback(cputag_get_cpu(machine, "maincpu"), megadriv_tas_callback);
if ((machine->gamedrv->ipt==ipt_megadri6) || (machine->gamedrv->ipt==ipt_ssf2ghw))
if ((ipt == INPUT_PORTS_NAME(megadri6)) || (ipt == INPUT_PORTS_NAME(ssf2ghw)))
{
megadrive_io_read_data_port_ptr = megadrive_io_read_data_port_6button;
megadrive_io_write_data_port_ptr = megadrive_io_write_data_port_6button;

View File

@ -48,7 +48,7 @@ static int ay_select=0;
static int ack_data=0;
static UINT8 n7751_command;
static UINT32 n7751_rom_address;
//static UINT32 n7751_rom_address;
static int tile_bank=0;

View File

@ -447,7 +447,7 @@ static MACHINE_DRIVER_START( no_nvram )
MDRV_CPU_MODIFY("mcu")
MDRV_CPU_PROGRAM_MAP(mcu_no_nvram_map)
MDRV_NVRAM_HANDLER(NULL)
MDRV_NVRAM_HANDLER(0)
MACHINE_DRIVER_END

View File

@ -691,6 +691,7 @@ static VIDEO_UPDATE(sfbonus)
int globalyscroll = (sfbonus_vregs[2] | sfbonus_vregs[3]<<8);
int globalxscroll = (sfbonus_vregs[0] | sfbonus_vregs[1]<<8);
UINT8* front_rowscroll = &sfbonus_videoram[0x200];
const input_port_token *ipt;
int i;
// align to 0
@ -744,7 +745,7 @@ static VIDEO_UPDATE(sfbonus)
}
}
}
/*
#if 0
popmessage("%02x %02x %02x %02x %02x %02x %02x %02x -- %02x -- %02x %02x -- %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
sfbonus_3800_regs[0],
sfbonus_3800_regs[1],
@ -782,9 +783,7 @@ static VIDEO_UPDATE(sfbonus)
sfbonus_vregs[30],
sfbonus_vregs[31]
);
*/
/*
popmessage("-- %02x %02x %02x %02x %02x %02x %02x %02x",
sfbonus_1800_regs[0],
sfbonus_1800_regs[1],
@ -794,10 +793,11 @@ static VIDEO_UPDATE(sfbonus)
sfbonus_1800_regs[5],
sfbonus_1800_regs[6],
sfbonus_1800_regs[7]);
*/
#endif
if ((screen->machine->gamedrv->ipt == ipt_amcoe2_reels3) || (screen->machine->gamedrv->ipt == ipt_amcoe2_reels4)
|| (screen->machine->gamedrv->ipt == ipt_amcoe2_poker))
ipt = screen->machine->gamedrv->ipt;
if ((ipt == INPUT_PORTS_NAME(amcoe2_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe2_reels4))
|| (ipt == INPUT_PORTS_NAME(amcoe2_poker)))
{
// based on pirpok2
output_set_lamp_value(0, (sfbonus_1800_regs[6] & 0x1) >> 0);
@ -807,8 +807,8 @@ static VIDEO_UPDATE(sfbonus)
output_set_lamp_value(4, (sfbonus_1800_regs[4] & 0x4) >> 2);
output_set_lamp_value(5, (sfbonus_1800_regs[4] & 0x1) >> 0);
}
else if ((screen->machine->gamedrv->ipt == ipt_amcoe1_reels3) || (screen->machine->gamedrv->ipt == ipt_amcoe1_reels4)
|| (screen->machine->gamedrv->ipt == ipt_amcoe1_poker))
else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4))
|| (ipt == INPUT_PORTS_NAME(amcoe1_poker)))
{
output_set_lamp_value(0, (sfbonus_1800_regs[0] & 0x2) >> 1);
output_set_lamp_value(1, (sfbonus_1800_regs[4] & 0x2) >> 1);

View File

@ -1558,7 +1558,7 @@ static MACHINE_DRIVER_START( wintbob )
/* video hardware */
MDRV_GFXDECODE(wb)
MDRV_VIDEO_UPDATE(wintbob)
MDRV_VIDEO_EOF(NULL)
MDRV_VIDEO_EOF(0)
MACHINE_DRIVER_END

View File

@ -345,7 +345,7 @@ static MACHINE_DRIVER_START( psurge )
MDRV_CPU_PROGRAM_MAP(psurge_main_map)
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
MDRV_MACHINE_START(NULL)
MDRV_MACHINE_START(0)
MACHINE_DRIVER_END

View File

@ -257,7 +257,7 @@ static NVRAM_HANDLER(twinkle)
}
}
nvram_handler_i2cmem_0( machine, file, read_or_write );
NVRAM_HANDLER_CALL(i2cmem_0);
}
static UINT32 twinkle_unknown;

View File

@ -256,7 +256,7 @@ static WRITE8_DEVICE_HANDLER( mc1408_data_w )
}
extern const game_driver driver_monymony;
GAME_EXTERN(monymony);
static READ8_HANDLER( zaccaria_prot1_r )
{
@ -269,7 +269,7 @@ static READ8_HANDLER( zaccaria_prot1_r )
return 0x40; /* Jack Rabbit */
case 6:
if (space->machine->gamedrv == &driver_monymony)
if (space->machine->gamedrv == &GAME_NAME(monymony))
return 0x70; /* Money Money */
return 0xa0; /* Jack Rabbit */

View File

@ -22,12 +22,12 @@
#define DRIVER_RECURSIVE
/* step 1: declare all external references */
#define DRIVER(NAME) extern game_driver driver_##NAME;
#define DRIVER(NAME) GAME_EXTERN(NAME);
#include "mamedriv.c"
/* step 2: define the drivers[] array */
#undef DRIVER
#define DRIVER(NAME) &driver_##NAME,
#define DRIVER(NAME) &GAME_NAME(NAME),
const game_driver * const drivers[] =
{
#include "mamedriv.c"

View File

@ -24,12 +24,12 @@
#define DRIVER_RECURSIVE
/* step 1: declare all external references */
#define DRIVER(NAME) extern game_driver driver_##NAME;
#define DRIVER(NAME) GAME_EXTERN(NAME);
#include "tiny.c"
/* step 2: define the drivers[] array */
#undef DRIVER
#define DRIVER(NAME) &driver_##NAME,
#define DRIVER(NAME) &GAME_NAME(NAME),
const game_driver * const drivers[] =
{
#include "tiny.c"

View File

@ -68,7 +68,7 @@ static const translation_info gcc_translate[] =
{ 0, "-fno-strict-aliasing", "/Oa" },
{ 0, "-fno-omit-frame-pointer", "" },
{ 0, "-Werror", "/WX" },
{ VS7, "-Wall", "/Wall /W3 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
{ VS7, "-Wall", "/Wall /W3 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
{ 0, "-Wall", "/W0" },
{ VS7, "-Wno-unused", "/wd4100 /wd4101 /wd4102" },
{ 0, "-W*", "" },