From 79246ab9172f61178139b4b7974debba8fb7c5f8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 22 Jul 2014 06:21:54 +0000 Subject: [PATCH] More cleanups, there is issue with srcclean that needs to be taken care as well, just doing now what we can --- hash/abc80.xml | 2 +- hash/cc40_cart.xml | 16 +- hash/hp9835a_rom.xml | 8 +- hash/hp9845a_rom.xml | 16 +- hash/hp9845b_rom.xml | 42 +- hash/msx1_cart.xml | 38 +- hash/msx2_cart.xml | 6 +- hash/msx2_flop.xml | 20 +- hash/neogeo.xml | 1818 ++++++++-------- hash/nes.xml | 6 +- hash/sc3000_cass.xml | 2 +- hash/snes.xml | 2 +- hash/tandy2k.xml | 4 +- src/emu/addrmap.h | 2 +- src/emu/bus/a1bus/a1bus.h | 4 +- src/emu/bus/a2bus/a2bus.h | 6 +- src/emu/bus/a2bus/a2eauxslot.h | 8 +- src/emu/bus/a2bus/a2mcms.h | 2 +- src/emu/bus/amiga/zorro/a2052.h | 4 +- src/emu/bus/amiga/zorro/a2232.h | 6 +- src/emu/bus/amiga/zorro/a590.h | 4 +- src/emu/bus/amiga/zorro/action_replay.h | 4 +- src/emu/bus/amiga/zorro/buddha.h | 4 +- src/emu/bus/amiga/zorro/cards.h | 26 +- src/emu/bus/amiga/zorro/zorro.h | 240 +-- src/emu/bus/bml3/bml3bus.h | 4 +- src/emu/bus/centronics/epson_ex800.h | 2 +- src/emu/bus/centronics/epson_lx800.h | 2 +- src/emu/bus/coco/cococart.h | 18 +- src/emu/bus/cpc/cpc_rs232.h | 2 +- src/emu/bus/cpc/cpcexp.h | 2 +- src/emu/bus/gameboy/mbc.h | 2 +- src/emu/bus/iq151/iq151.h | 2 +- src/emu/bus/isa/aga.h | 2 +- src/emu/bus/isa/gus.h | 10 +- src/emu/bus/isa/isa.h | 6 +- src/emu/bus/kc/kc.h | 14 +- src/emu/bus/msx_cart/ascii.h | 1 - src/emu/bus/msx_cart/konami.h | 16 +- src/emu/bus/msx_cart/yamaha.h | 1 - src/emu/bus/msx_slot/bunsetsu.h | 4 +- src/emu/bus/msx_slot/cartridge.h | 1 - src/emu/bus/msx_slot/disk.h | 7 +- src/emu/bus/msx_slot/music.h | 4 +- src/emu/bus/msx_slot/ram.h | 3 +- src/emu/bus/msx_slot/ram_mm.h | 1 - src/emu/bus/neogeo/banked_cart.h | 3 - src/emu/bus/neogeo/bootleg_prot.h | 5 +- src/emu/bus/neogeo/cmc_prot.h | 3 - src/emu/bus/neogeo/fatfury2_prot.h | 5 - src/emu/bus/neogeo/kof2002_prot.h | 3 - src/emu/bus/neogeo/kof98_prot.h | 6 +- src/emu/bus/neogeo/mslugx_prot.h | 3 - src/emu/bus/neogeo/neogeo_intf.h | 3 +- src/emu/bus/neogeo/pcm2_prot.h | 5 +- src/emu/bus/neogeo/pvc_prot.h | 3 - src/emu/bus/neogeo/sbp_prot.h | 6 +- src/emu/bus/neogeo/sma_prot.h | 3 - src/emu/bus/nes/mmc5.h | 2 +- src/emu/bus/nubus/nubus.h | 4 +- src/emu/bus/oricext/jasmin.h | 2 +- src/emu/bus/oricext/microdisc.h | 2 +- src/emu/bus/oricext/oricext.h | 6 +- src/emu/bus/pc_kbd/pc_kbdc.h | 4 +- src/emu/bus/pet/diag.h | 2 +- src/emu/bus/ql/cst_q_plus4.h | 2 +- src/emu/bus/ql/cst_qdisc.h | 2 +- src/emu/bus/ql/cumana_fdi.h | 4 +- src/emu/bus/ql/exp.h | 44 +- src/emu/bus/ql/kempston_di.h | 2 +- src/emu/bus/ql/miracle_gold_card.h | 2 +- src/emu/bus/ql/miracle_hd.h | 2 +- src/emu/bus/ql/mp_fdi.h | 2 +- src/emu/bus/ql/opd_basic_master.h | 2 +- src/emu/bus/ql/pcml_qdisk.h | 2 +- src/emu/bus/ql/qubide.h | 2 +- src/emu/bus/ql/rom.h | 8 +- src/emu/bus/ql/sandy_superdisk.h | 2 +- src/emu/bus/ql/sandy_superqboard.h | 2 +- src/emu/bus/ql/trumpcard.h | 2 +- src/emu/bus/scsi/scsihle.h | 3 +- src/emu/bus/tvc/tvc.h | 4 +- src/emu/bus/vtech/ioexp/carts.h | 2 +- src/emu/bus/vtech/ioexp/ioexp.h | 34 +- src/emu/bus/vtech/ioexp/joystick.h | 2 +- src/emu/bus/vtech/ioexp/printer.h | 2 +- src/emu/bus/vtech/memexp/carts.h | 2 +- src/emu/bus/vtech/memexp/floppy.h | 4 +- src/emu/bus/vtech/memexp/memexp.h | 48 +- src/emu/bus/vtech/memexp/memory.h | 2 +- src/emu/bus/vtech/memexp/rs232.h | 2 +- src/emu/bus/vtech/memexp/wordpro.h | 2 +- src/emu/bus/x68k/x68kexp.h | 4 +- src/emu/bus/z88/z88.h | 4 +- src/emu/cpu/adsp2100/adsp2100.h | 6 +- src/emu/cpu/cpu.mak | 2 +- src/emu/cpu/g65816/g65816op.h | 10 +- src/emu/cpu/m68000/m68000.h | 16 +- src/emu/cpu/m68000/m68kmmu.h | 6 +- src/emu/cpu/mb86233/mb86233.h | 2 +- src/emu/cpu/minx/minxfunc.h | 1 - src/emu/cpu/minx/minxops.h | 1 - src/emu/cpu/mips/mips3.h | 4 +- src/emu/cpu/powerpc/ppc.h | 8 +- src/emu/cpu/rsp/rsp.h | 12 +- src/emu/cpu/scudsp/scudsp.h | 6 +- src/emu/cpu/sh2/sh2.h | 18 +- src/emu/cpu/sharc/sharcops.inc | 2 +- src/emu/cpu/tms7000/tms7000.h | 16 +- src/emu/cpu/tms7000/tms70op.inc | 8 +- src/emu/cpu/upd7725/upd7725.h | 4 +- src/emu/cpu/z80/tmpz84c011.h | 2 +- src/emu/cpu/z80/tmpz84c015.h | 18 +- src/emu/digfx.h | 2 - src/emu/imagedev/cartslot.h | 6 +- src/emu/imagedev/cassette.h | 12 +- src/emu/imagedev/diablo.h | 4 +- src/emu/imagedev/flopdrv.h | 2 +- src/emu/imagedev/harddriv.h | 4 +- src/emu/imagedev/midiin.h | 2 +- src/emu/luaengine.h | 8 +- src/emu/machine/53c810.h | 2 +- src/emu/machine/6525tpi.h | 2 +- src/emu/machine/6532riot.h | 8 +- src/emu/machine/68307.h | 6 +- src/emu/machine/6840ptm.h | 4 +- src/emu/machine/74123.h | 8 +- src/emu/machine/8042kbdc.h | 6 +- src/emu/machine/aakart.h | 14 +- src/emu/machine/adc0808.h | 20 +- src/emu/machine/adc1038.h | 2 +- src/emu/machine/akiko.h | 12 +- src/emu/machine/am9517a.h | 2 +- src/emu/machine/at_keybc.h | 4 +- src/emu/machine/autoconfig.h | 2 +- src/emu/machine/ay31015.h | 12 +- src/emu/machine/corvushd.h | 14 +- src/emu/machine/cr511b.h | 49 +- src/emu/machine/dmac.h | 39 +- src/emu/machine/dp8390.h | 4 +- src/emu/machine/eepromser.h | 10 +- src/emu/machine/gayle.h | 12 +- src/emu/machine/hd63450.h | 4 +- src/emu/machine/i8255.h | 4 +- src/emu/machine/i8271.h | 4 +- src/emu/machine/i8279.h | 4 +- src/emu/machine/ins8250.h | 4 +- src/emu/machine/kb3600.h | 2 +- src/emu/machine/keyboard.h | 4 +- src/emu/machine/mb89352.h | 4 +- src/emu/machine/mb89363b.h | 4 +- src/emu/machine/mc6854.h | 12 +- src/emu/machine/mos6530.h | 4 +- src/emu/machine/ncr539x.h | 6 +- src/emu/machine/roc10937.h | 16 +- src/emu/machine/s2636.h | 4 +- src/emu/machine/s3c2400.h | 10 +- src/emu/machine/s3c2410.h | 12 +- src/emu/machine/s3c2440.h | 10 +- src/emu/machine/s3c44b0.h | 2 +- src/emu/machine/terminal.h | 6 +- src/emu/machine/tms9902.h | 4 +- src/emu/machine/upd71071.h | 4 +- src/emu/machine/wd11c00_17.h | 2 +- src/emu/machine/wd17xx.h | 8 +- src/emu/machine/wd2010.h | 2 +- src/emu/machine/ym2148.h | 1 - src/emu/machine/z80ctc.h | 4 +- src/emu/machine/z80dart.h | 14 +- src/emu/machine/z80dma.h | 2 +- src/emu/machine/z80pio.h | 4 +- src/emu/machine/z80sti.h | 20 +- src/emu/mame.h | 22 +- src/emu/memory.h | 2 +- src/emu/netlist/analog/nld_bjt.h | 6 +- src/emu/netlist/analog/nld_fourterm.h | 20 +- src/emu/netlist/analog/nld_ms_direct.h | 609 +++--- src/emu/netlist/analog/nld_ms_direct1.h | 41 +- src/emu/netlist/analog/nld_ms_direct2.h | 53 +- src/emu/netlist/analog/nld_ms_gauss_seidel.h | 506 ++--- src/emu/netlist/analog/nld_opamps.h | 2 +- src/emu/netlist/analog/nld_solver.h | 310 +-- src/emu/netlist/analog/nld_twoterm.h | 14 +- src/emu/netlist/devices/nld_4020.h | 14 +- src/emu/netlist/devices/nld_4066.h | 4 +- src/emu/netlist/devices/nld_74123.h | 18 +- src/emu/netlist/devices/nld_7474.h | 2 +- src/emu/netlist/devices/nld_7490.h | 4 +- src/emu/netlist/devices/nld_74ls629.h | 2 +- src/emu/netlist/devices/nld_cmos.h | 24 +- src/emu/netlist/devices/nld_log.h | 2 +- src/emu/netlist/devices/nld_r2r_dac.h | 14 +- src/emu/netlist/devices/nld_system.h | 44 +- src/emu/netlist/devices/nld_truthtable.h | 366 ++-- src/emu/netlist/nl_base.h | 308 +-- src/emu/netlist/nl_dice_compat.h | 8 +- src/emu/netlist/nl_lists.h | 30 +- src/emu/netlist/nl_setup.h | 2 +- src/emu/netlist/nl_time.h | 4 +- src/emu/netlist/plists.h | 160 +- src/emu/netlist/pstate.h | 20 +- src/emu/sound.h | 2 +- src/emu/sound/amiga.h | 2 +- src/emu/sound/ay8910.h | 24 +- src/emu/sound/discrete.h | 2 +- src/emu/sound/es5506.h | 22 +- src/emu/sound/gaelco.h | 2 +- src/emu/sound/namco.h | 2 +- src/emu/sound/nes_apu.h | 2 +- src/emu/sound/okim6258.h | 4 +- src/emu/sound/pokey.h | 2 +- src/emu/sound/rf5c68.h | 2 +- src/emu/sound/segapcm.h | 6 +- src/emu/sound/tms36xx.h | 12 +- src/emu/sound/tms5110.h | 20 +- src/emu/sound/vrender0.h | 2 +- src/emu/video.h | 2 +- src/emu/video/crtc_ega.h | 16 +- src/emu/video/huc6202.h | 6 +- src/emu/video/mc6845.h | 28 +- src/emu/video/mc6847.h | 14 +- src/emu/video/ramdac.h | 2 +- src/emu/video/snes_ppu.h | 52 +- src/emu/video/t6a04.h | 2 +- src/emu/video/tms3556.h | 10 +- src/emu/video/tms9928a.h | 8 +- src/emu/video/vic4567.h | 8 +- src/emu/video/vooddefs.h | 4 +- src/emu/video/voodoo.h | 18 +- src/lib/lua/bridge/LuaBridge.h | 51 +- src/lib/lua/bridge/detail/CFunctions.h | 734 +++---- src/lib/lua/bridge/detail/ClassInfo.h | 59 +- src/lib/lua/bridge/detail/Constructor.h | 222 +- src/lib/lua/bridge/detail/FuncTraits.h | 1016 ++++----- src/lib/lua/bridge/detail/Iterator.h | 137 +- src/lib/lua/bridge/detail/LuaException.h | 134 +- src/lib/lua/bridge/detail/LuaHelpers.h | 92 +- src/lib/lua/bridge/detail/LuaRef.h | 2036 +++++++++--------- src/lib/lua/bridge/detail/Namespace.h | 1894 ++++++++-------- src/lib/lua/bridge/detail/Stack.h | 486 ++--- src/lib/lua/bridge/detail/TypeList.h | 126 +- src/lib/lua/bridge/detail/TypeTraits.h | 98 +- src/lib/lua/bridge/detail/Userdata.h | 1046 ++++----- src/lib/lua/bridge/detail/dump.h | 2 +- src/lib/lua/lapi.h | 6 +- src/lib/lua/lauxlib.h | 86 +- src/lib/lua/lcode.h | 22 +- src/lib/lua/lctype.h | 53 +- src/lib/lua/ldebug.h | 14 +- src/lib/lua/ldo.h | 15 +- src/lib/lua/lfunc.h | 10 +- src/lib/lua/lgc.h | 80 +- src/lib/lua/llex.h | 56 +- src/lib/lua/llimits.h | 124 +- src/lib/lua/lmem.h | 29 +- src/lib/lua/lobject.h | 427 ++-- src/lib/lua/lopcodes.h | 202 +- src/lib/lua/lparser.h | 118 +- src/lib/lua/lstate.h | 223 +- src/lib/lua/lstring.h | 14 +- src/lib/lua/ltable.h | 12 +- src/lib/lua/ltm.h | 46 +- src/lib/lua/lua.h | 212 +- src/lib/lua/luaconf.h | 215 +- src/lib/lua/lualib.h | 20 +- src/lib/lua/lundump.h | 4 +- src/lib/lua/lvm.h | 10 +- src/lib/lua/lzio.h | 30 +- src/lib/sqlite3/shell.c | 2 +- src/lib/sqlite3/sqlite3.h | 1183 +++++----- src/lib/sqlite3/sqlite3ext.h | 448 ++-- src/lib/util/cdrom.h | 2 +- src/lib/web/mongoose.h | 92 +- src/mame/audio/cage.h | 18 +- src/mame/audio/cps3.h | 2 +- src/mame/audio/dcs.h | 44 +- src/mame/audio/taitosnd.h | 4 +- src/mame/drivers/bfm_sc45_helper.h | 1 - src/mame/includes/amiga.h | 30 +- src/mame/includes/armedf.h | 2 +- src/mame/includes/atari.h | 4 +- src/mame/includes/atarigt.h | 4 +- src/mame/includes/bfm_sc45.h | 6 +- src/mame/includes/boogwing.h | 2 +- src/mame/includes/chqflag.h | 2 +- src/mame/includes/darkseal.h | 2 +- src/mame/includes/deco32.h | 2 +- src/mame/includes/esd16.h | 2 +- src/mame/includes/gaelco3d.h | 2 +- src/mame/includes/gstriker.h | 2 +- src/mame/includes/harddriv.h | 2 +- src/mame/includes/kaneko16.h | 2 +- src/mame/includes/konamigx.h | 7 +- src/mame/includes/megadriv.h | 2 +- src/mame/includes/midtunit.h | 2 +- src/mame/includes/midzeus.h | 6 +- src/mame/includes/model3.h | 2 +- src/mame/includes/mystwarr.h | 2 +- src/mame/includes/neogeo.h | 6 +- src/mame/includes/niyanpai.h | 2 +- src/mame/includes/plygonet.h | 2 +- src/mame/includes/rpunch.h | 6 +- src/mame/includes/spbactn.h | 2 +- src/mame/includes/taito_z.h | 2 +- src/mame/includes/toaplan2.h | 2 +- src/mame/includes/unico.h | 2 +- src/mame/includes/wc90.h | 2 +- src/mame/includes/wpc_pin.h | 4 +- src/mame/layout/fireball.lay | 48 +- src/mame/layout/kenseim.lay | 38 +- src/mame/machine/c117.h | 4 +- src/mame/machine/konppc.h | 24 +- src/mame/machine/midwayic.h | 42 +- src/mame/machine/ng_memcard.h | 10 +- src/mame/machine/nmk112.h | 2 +- src/mame/machine/wpc_out.h | 4 +- src/mame/mame.lst | 71 +- src/mame/mame.mak | 4 +- src/mame/video/deco16ic.h | 4 +- src/mame/video/deco_zoomspr.h | 1 - src/mame/video/excellent_spr.h | 4 +- src/mame/video/k001005.h | 2 +- src/mame/video/k001604.h | 2 +- src/mame/video/k051316.h | 2 +- src/mame/video/k051960.h | 10 +- src/mame/video/k052109.h | 2 +- src/mame/video/k053244_k053245.h | 2 +- src/mame/video/k053246_k053247_k055673.h | 2 +- src/mame/video/k053936.h | 2 +- src/mame/video/k054156_k054157_k056832.h | 6 +- src/mame/video/kan_pand.h | 2 +- src/mame/video/mb60553.h | 2 +- src/mame/video/neogeo_spr.h | 10 +- src/mame/video/pc080sn.h | 4 +- src/mame/video/pc090oj.h | 2 +- src/mame/video/tc0080vco.h | 4 +- src/mame/video/tc0100scn.h | 4 +- src/mame/video/tc0480scp.h | 6 +- src/mame/video/tecmo_mix.h | 4 +- src/mame/video/tecmo_spr.h | 5 +- src/mame/video/vs920a.h | 3 - src/mess/includes/apollo.h | 4 +- src/mess/includes/apple2.h | 4 +- src/mess/includes/bebox.h | 2 +- src/mess/includes/coco.h | 2 +- src/mess/includes/cybiko.h | 2 +- src/mess/includes/dgnalpha.h | 2 +- src/mess/includes/hec2hrp.h | 2 +- src/mess/includes/hp48.h | 4 +- src/mess/includes/msx.h | 4 +- src/mess/includes/newbrain.h | 2 +- src/mess/includes/p2000t.h | 2 +- src/mess/includes/ql.h | 2 +- src/mess/includes/thomson.h | 2 +- src/mess/includes/x68k.h | 4 +- src/mess/layout/fb01.lay | 8 +- src/mess/machine/ie15_kbd.h | 2 +- src/mess/machine/mega32x.h | 2 +- src/mess/machine/micropolis.h | 2 +- src/mess/machine/msx_matsushita.h | 1 - src/mess/machine/msx_s1985.h | 1 - src/mess/machine/msx_systemflags.h | 1 - src/mess/machine/smartmed.h | 14 +- src/mess/machine/ti99/videowrp.h | 4 +- src/mess/mess.lst | 28 +- src/mess/video/crt.h | 4 +- src/mess/video/gime.h | 2 +- src/mess/video/vtvideo.h | 2 +- src/osd/modules/debugger/debugint.h | 2 +- src/osd/modules/debugger/debugosx.h | 2 +- src/osd/modules/debugger/debugqt.h | 2 +- src/osd/modules/debugger/debugwin.h | 2 +- src/osd/modules/debugger/none.h | 2 +- src/osd/modules/sound/direct_sound.h | 6 +- src/osd/modules/sound/js_sound.h | 2 +- src/osd/modules/sound/none.h | 2 +- src/osd/modules/sound/sdl_sound.h | 2 +- src/osd/osdcomm.h | 2 +- src/osd/osdepend.h | 46 +- src/osd/sdl/osdsdl.h | 2 +- src/osd/sdl/window.h | 4 +- src/osd/windows/winmain.h | 4 +- 382 files changed, 9321 insertions(+), 9413 deletions(-) diff --git a/hash/abc80.xml b/hash/abc80.xml index 87aba03a328..df6571b5c07 100644 --- a/hash/abc80.xml +++ b/hash/abc80.xml @@ -63,7 +63,7 @@ Kundregister 19?? <unknown> - + diff --git a/hash/cc40_cart.xml b/hash/cc40_cart.xml index 7b0e21e87e2..81d33db2096 100644 --- a/hash/cc40_cart.xml +++ b/hash/cc40_cart.xml @@ -5,14 +5,14 @@ diff --git a/hash/hp9835a_rom.xml b/hash/hp9835a_rom.xml index e9ea0ec80c8..b945a47399f 100644 --- a/hash/hp9835a_rom.xml +++ b/hash/hp9835a_rom.xml @@ -2,7 +2,7 @@ - + Mass Storage 198? @@ -16,7 +16,7 @@ - + I/O 198? @@ -32,7 +32,7 @@ - + Assembly Execution 198? @@ -45,7 +45,7 @@ - + Assembly Language Development & Execution 198? diff --git a/hash/hp9845a_rom.xml b/hash/hp9845a_rom.xml index eec567be03c..d50c187e136 100644 --- a/hash/hp9845a_rom.xml +++ b/hash/hp9845a_rom.xml @@ -2,7 +2,7 @@ - + Mass Storage 198? @@ -15,7 +15,7 @@ - + I/O LPU 198? @@ -28,7 +28,7 @@ - + I/O PPU 198? @@ -41,7 +41,7 @@ - + Graphics 198? @@ -54,7 +54,7 @@ - + PDR-45 198? @@ -68,7 +68,7 @@ - + Programmer's Toolkit 198? @@ -82,7 +82,7 @@ - + HP 9845B Command File/Memory Mass Storage ROM (Rev A) 198? @@ -95,7 +95,7 @@ - + HP 9845B Command File/Memory Mass Storage ROM (Rev B) 198? diff --git a/hash/hp9845b_rom.xml b/hash/hp9845b_rom.xml index 81862fca6ea..f5586960f2e 100644 --- a/hash/hp9845b_rom.xml +++ b/hash/hp9845b_rom.xml @@ -2,7 +2,7 @@ - + Mass Storage (Rev B) 198? @@ -16,7 +16,7 @@ - + Mass Storage (Rev C) 198? @@ -30,7 +30,7 @@ - + Mass Storage (Rev D) 198? @@ -45,7 +45,7 @@ - + Graphics 198? @@ -59,7 +59,7 @@ - + I/O LPU (Rev A) 198? @@ -73,7 +73,7 @@ - + I/O LPU (Rev B) 198? @@ -87,7 +87,7 @@ - + I/O PPU (Rev B) 198? @@ -101,7 +101,7 @@ - + I/O PPU (Rev C) 198? @@ -115,7 +115,7 @@ - + Advanced Programming 198? @@ -128,7 +128,7 @@ - + Assembly Execution 198? @@ -142,7 +142,7 @@ - + Assembly Development & Execution 198? @@ -158,7 +158,7 @@ - + IMAGE/45 Database Manager (Rev B) 198? @@ -178,7 +178,7 @@ - + IMAGE/45 Database Manager (Rev C) 198? @@ -198,7 +198,7 @@ - + Structured Programming 198? @@ -211,7 +211,7 @@ - + Resource Management 198? @@ -229,7 +229,7 @@ - + Test ROM 198? @@ -243,7 +243,7 @@ - + BASIC Datacomm 198? @@ -259,7 +259,7 @@ - + RJE Bisync 198? @@ -273,7 +273,7 @@ - + Color Graphics 198? @@ -289,7 +289,7 @@ - + Enhanced Graphics (Rev A) 198? @@ -306,7 +306,7 @@ - + Enhanced Graphics (Rev B) 198? diff --git a/hash/msx1_cart.xml b/hash/msx1_cart.xml index 1ebde1cfae8..827d91e77e4 100644 --- a/hash/msx1_cart.xml +++ b/hash/msx1_cart.xml @@ -1038,7 +1038,7 @@ kept for now until finding out what those bytes affect... - + @@ -1071,7 +1071,7 @@ kept for now until finding out what those bytes affect... - + @@ -1088,7 +1088,7 @@ kept for now until finding out what those bytes affect... - + @@ -14568,31 +14568,31 @@ kept for now until finding out what those bytes affect... diff --git a/hash/msx2_cart.xml b/hash/msx2_cart.xml index 2f36fecb77f..70292364138 100644 --- a/hash/msx2_cart.xml +++ b/hash/msx2_cart.xml @@ -836,7 +836,7 @@ LZ93A13 (32 pin) - 8KB banks - + @@ -3167,7 +3167,7 @@ LZ93A13 (32 pin) - 8KB banks - @@ -3177,7 +3177,7 @@ LZ93A13 (32 pin) - 8KB banks Konami - + diff --git a/hash/msx2_flop.xml b/hash/msx2_flop.xml index 6f8093e1c12..f6803cca0dc 100644 --- a/hash/msx2_flop.xml +++ b/hash/msx2_flop.xml @@ -297,16 +297,16 @@ The following floppies came with the machines. diff --git a/hash/neogeo.xml b/hash/neogeo.xml index 74f0e965ae3..947a8ec4b15 100644 --- a/hash/neogeo.xml +++ b/hash/neogeo.xml @@ -21,13 +21,13 @@ - + @@ -80,12 +80,12 @@ - @@ -191,12 +191,12 @@ - @@ -258,12 +258,12 @@ - @@ -313,12 +313,12 @@ - @@ -415,12 +415,12 @@ - @@ -528,12 +528,12 @@ - @@ -616,17 +616,17 @@ - - @@ -727,11 +727,11 @@ - @@ -785,12 +785,12 @@ - @@ -838,22 +838,22 @@ - - - @@ -895,18 +895,18 @@ - - @@ -991,12 +991,12 @@ - @@ -1081,14 +1081,14 @@ - @@ -1208,12 +1208,12 @@ - @@ -1259,12 +1259,12 @@ - @@ -1357,12 +1357,12 @@ - @@ -1402,12 +1402,12 @@ - @@ -1449,12 +1449,12 @@ - @@ -1518,11 +1518,11 @@ - @@ -1563,12 +1563,12 @@ - @@ -1610,17 +1610,17 @@ - - @@ -1664,16 +1664,16 @@ - - @@ -1712,12 +1712,12 @@ - @@ -1835,12 +1835,12 @@ - @@ -1921,12 +1921,12 @@ - @@ -1968,12 +1968,12 @@ - @@ -2019,12 +2019,12 @@ - @@ -2066,17 +2066,17 @@ - - @@ -2118,12 +2118,12 @@ - @@ -2163,12 +2163,12 @@ - @@ -2216,12 +2216,12 @@ - @@ -2309,11 +2309,11 @@ - @@ -2348,11 +2348,11 @@ - @@ -2395,12 +2395,12 @@ - @@ -2442,12 +2442,12 @@ - @@ -2494,12 +2494,12 @@ - @@ -2545,12 +2545,12 @@ - @@ -2643,12 +2643,12 @@ - @@ -2757,12 +2757,12 @@ - @@ -2810,10 +2810,10 @@ - @@ -2849,12 +2849,12 @@ - @@ -2892,11 +2892,11 @@ - @@ -2937,11 +2937,11 @@ - @@ -2981,11 +2981,11 @@ - @@ -3023,12 +3023,12 @@ - @@ -3159,17 +3159,17 @@ - - @@ -3222,12 +3222,12 @@ - @@ -3333,12 +3333,12 @@ - @@ -3385,12 +3385,12 @@ - @@ -3491,11 +3491,11 @@ - @@ -3547,10 +3547,10 @@ - @@ -3634,12 +3634,12 @@ - @@ -3682,11 +3682,11 @@ - @@ -3735,12 +3735,12 @@ - @@ -3851,12 +3851,12 @@ - @@ -3907,11 +3907,11 @@ - @@ -3956,11 +3956,11 @@ - @@ -4003,10 +4003,10 @@ - @@ -4042,10 +4042,10 @@ - @@ -4093,12 +4093,12 @@ - @@ -4148,10 +4148,10 @@ - @@ -4191,29 +4191,29 @@ - + Reported UNIVERSE BIOS CRC32: + ROM EC861CAF + BANK 0 NOT USED + BANK 1 NOT USED + BANK 2 NOT USED + BANK 3 NOT USED + ***************************************--> - + - @@ -4251,12 +4251,12 @@ - @@ -4307,11 +4307,11 @@ - @@ -4353,10 +4353,10 @@ - @@ -4400,16 +4400,16 @@ - - @@ -4461,12 +4461,12 @@ - @@ -4509,12 +4509,12 @@ - @@ -4593,12 +4593,12 @@ - @@ -4646,13 +4646,13 @@ - @@ -4702,10 +4702,10 @@ - @@ -4716,7 +4716,7 @@ - @@ -4763,13 +4763,13 @@ - @@ -4877,15 +4877,15 @@ - - @@ -4927,12 +4927,12 @@ - @@ -5089,11 +5089,11 @@ - @@ -5133,11 +5133,11 @@ - @@ -5188,11 +5188,11 @@ - @@ -5246,16 +5246,16 @@ - - @@ -5301,10 +5301,10 @@ - @@ -5346,11 +5346,11 @@ - @@ -5402,12 +5402,12 @@ - @@ -5518,11 +5518,11 @@ - @@ -5626,11 +5626,11 @@ - @@ -5672,20 +5672,20 @@ - - - - @@ -5746,11 +5746,11 @@ - @@ -5792,10 +5792,10 @@ - @@ -5831,11 +5831,11 @@ - @@ -5870,21 +5870,21 @@ - - - @@ -5925,10 +5925,10 @@ - @@ -5964,10 +5964,10 @@ - @@ -6008,10 +6008,10 @@ - @@ -6052,21 +6052,21 @@ - - - @@ -6110,10 +6110,10 @@ - @@ -6152,11 +6152,11 @@ - @@ -6259,11 +6259,11 @@ - @@ -6309,11 +6309,11 @@ - @@ -6369,11 +6369,11 @@ - @@ -6424,11 +6424,11 @@ - @@ -6478,10 +6478,10 @@ - @@ -6522,9 +6522,9 @@ - @@ -6587,11 +6587,11 @@ - @@ -6626,12 +6626,12 @@ - @@ -6735,11 +6735,11 @@ - @@ -6844,11 +6844,11 @@ - @@ -6890,11 +6890,11 @@ - @@ -6941,16 +6941,16 @@ - - @@ -6992,9 +6992,9 @@ - @@ -7024,20 +7024,20 @@ - - @@ -7079,10 +7079,10 @@ - @@ -7122,12 +7122,12 @@ - @@ -7271,11 +7271,11 @@ - @@ -7316,12 +7316,12 @@ - @@ -7472,10 +7472,10 @@ - @@ -7509,18 +7509,18 @@ - - @@ -7556,10 +7556,10 @@ - @@ -7659,11 +7659,11 @@ - @@ -7714,12 +7714,12 @@ - @@ -7870,12 +7870,12 @@ - @@ -7918,13 +7918,13 @@ - @@ -8149,12 +8149,12 @@ - @@ -8207,11 +8207,11 @@ - @@ -8249,10 +8249,10 @@ - @@ -8300,11 +8300,11 @@ - @@ -8353,10 +8353,10 @@ - @@ -8392,10 +8392,10 @@ - @@ -8492,11 +8492,11 @@ - @@ -8535,12 +8535,12 @@ - @@ -8590,15 +8590,15 @@ - @@ -8875,10 +8875,10 @@ - @@ -8913,12 +8913,12 @@ - @@ -9078,10 +9078,10 @@ - @@ -9124,10 +9124,10 @@ - @@ -9167,14 +9167,14 @@ - @@ -9292,15 +9292,15 @@ - @@ -9416,15 +9416,15 @@ - - @@ -9461,10 +9461,10 @@ - @@ -9498,11 +9498,11 @@ - @@ -9550,13 +9550,13 @@ - @@ -9673,12 +9673,12 @@ - @@ -9782,13 +9782,13 @@ - @@ -9843,12 +9843,12 @@ - @@ -9905,12 +9905,12 @@ - @@ -9967,10 +9967,10 @@ - @@ -10011,11 +10011,11 @@ - @@ -10124,12 +10124,12 @@ - @@ -10186,12 +10186,12 @@ - @@ -10303,12 +10303,12 @@ - @@ -10424,11 +10424,11 @@ - @@ -10562,18 +10562,18 @@ - - @@ -10582,34 +10582,34 @@ - - - - @@ -10619,7 +10619,7 @@ - - + - - + + diff --git a/hash/sc3000_cass.xml b/hash/sc3000_cass.xml index 48bc158ee4e..42697ad5784 100644 --- a/hash/sc3000_cass.xml +++ b/hash/sc3000_cass.xml @@ -13,5 +13,5 @@ - + diff --git a/hash/snes.xml b/hash/snes.xml index cde5c447598..61d94cdec84 100644 --- a/hash/snes.xml +++ b/hash/snes.xml @@ -3262,7 +3262,7 @@ Beyond that last category are the roms waiting to be classified. - Contra IV - The Alien Wars (USA, Prototype) 1992 diff --git a/hash/tandy2k.xml b/hash/tandy2k.xml index ac38d5d3166..0e7dcda8392 100644 --- a/hash/tandy2k.xml +++ b/hash/tandy2k.xml @@ -4,9 +4,9 @@ diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h index 96e5d6a0da9..f5b34456698 100644 --- a/src/emu/addrmap.h +++ b/src/emu/addrmap.h @@ -130,7 +130,7 @@ public: write16_delegate m_wproto16; // 16-bit write proto-delegate write32_delegate m_wproto32; // 32-bit write proto-delegate write64_delegate m_wproto64; // 64-bit write proto-delegate - + setoffset_delegate m_soproto; // set offset proto-delegate address_map_delegate m_submap_delegate; int m_submap_bits; diff --git a/src/emu/bus/a1bus/a1bus.h b/src/emu/bus/a1bus/a1bus.h index ef748915607..ec98eccbb4f 100644 --- a/src/emu/bus/a1bus/a1bus.h +++ b/src/emu/bus/a1bus/a1bus.h @@ -75,7 +75,7 @@ public: // construction/destruction a1bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); a1bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - + // inline configuration static void static_set_cputag(device_t &device, const char *tag); template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } @@ -97,7 +97,7 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - + // internal state cpu_device *m_maincpu; diff --git a/src/emu/bus/a2bus/a2bus.h b/src/emu/bus/a2bus/a2bus.h index 87d3410383a..db227f00e9d 100644 --- a/src/emu/bus/a2bus/a2bus.h +++ b/src/emu/bus/a2bus/a2bus.h @@ -32,7 +32,7 @@ #define MCFG_A2BUS_OUT_INH_CB(_devcb) \ devcb = &a2bus_device::set_out_inh_callback(*device, DEVCB_##_devcb); - + #define MCFG_A2BUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \ MCFG_DEVICE_ADD(_tag, A2BUS_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ @@ -83,7 +83,7 @@ public: // construction/destruction a2bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); a2bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - + // inline configuration static void static_set_cputag(device_t &device, const char *tag); template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } @@ -104,7 +104,7 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - + // internal state cpu_device *m_maincpu; diff --git a/src/emu/bus/a2bus/a2eauxslot.h b/src/emu/bus/a2bus/a2eauxslot.h index 7e7d110c484..ba289849afe 100644 --- a/src/emu/bus/a2bus/a2eauxslot.h +++ b/src/emu/bus/a2bus/a2eauxslot.h @@ -20,13 +20,13 @@ #define MCFG_A2EAUXSLOT_CPU(_cputag) \ a2eauxslot_device::static_set_cputag(*device, _cputag); - + #define MCFG_A2EAUXSLOT_OUT_IRQ_CB(_devcb) \ devcb = &a2eauxslot_device::set_out_irq_callback(*device, DEVCB_##_devcb); #define MCFG_A2EAUXSLOT_OUT_NMI_CB(_devcb) \ devcb = &a2eauxslot_device::set_out_nmi_callback(*device, DEVCB_##_devcb); - + #define MCFG_A2EAUXSLOT_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \ MCFG_DEVICE_ADD(_tag, A2EAUXSLOT_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ @@ -71,12 +71,12 @@ public: // construction/destruction a2eauxslot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); a2eauxslot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - + // inline configuration static void static_set_cputag(device_t &device, const char *tag); template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_cb.set_callback(object); } - + void add_a2eauxslot_card(device_a2eauxslot_card_interface *card); device_a2eauxslot_card_interface *get_a2eauxslot_card(); diff --git a/src/emu/bus/a2bus/a2mcms.h b/src/emu/bus/a2bus/a2mcms.h index f896e1b4aea..c4d5e3dd730 100644 --- a/src/emu/bus/a2bus/a2mcms.h +++ b/src/emu/bus/a2bus/a2mcms.h @@ -106,7 +106,7 @@ protected: virtual bool take_c800() { return false; } private: - a2bus_mcms1_device *m_card1; // card 1 for passthrough + a2bus_mcms1_device *m_card1; // card 1 for passthrough mcms_device *m_engine; }; diff --git a/src/emu/bus/amiga/zorro/a2052.h b/src/emu/bus/amiga/zorro/a2052.h index 4ba55e94342..18f7fcd43e6 100644 --- a/src/emu/bus/amiga/zorro/a2052.h +++ b/src/emu/bus/amiga/zorro/a2052.h @@ -1,11 +1,11 @@ /*************************************************************************** - Commodore A2052 + Commodore A2052 license: MAME, GPL-2.0+ copyright-holders: Dirk Best - Zorro-II RAM Expansion (0.5, 1 or 2 MB) + Zorro-II RAM Expansion (0.5, 1 or 2 MB) ***************************************************************************/ diff --git a/src/emu/bus/amiga/zorro/a2232.h b/src/emu/bus/amiga/zorro/a2232.h index 862893e2b0a..29e1b685992 100644 --- a/src/emu/bus/amiga/zorro/a2232.h +++ b/src/emu/bus/amiga/zorro/a2232.h @@ -1,13 +1,13 @@ /*************************************************************************** - Commodore A2232 + Commodore A2232 license: MAME, GPL-2.0+ copyright-holders: Dirk Best - Zorro-II Serial Card + Zorro-II Serial Card - Provides the Amiga with 7 additional RS232 ports. + Provides the Amiga with 7 additional RS232 ports. ***************************************************************************/ diff --git a/src/emu/bus/amiga/zorro/a590.h b/src/emu/bus/amiga/zorro/a590.h index 4682c72903f..3665ff514c6 100644 --- a/src/emu/bus/amiga/zorro/a590.h +++ b/src/emu/bus/amiga/zorro/a590.h @@ -1,11 +1,11 @@ /*************************************************************************** - Commodore A590 / A2091 + Commodore A590 / A2091 license: MAME, GPL-2.0+ copyright-holders: Dirk Best - DMAC based SCSI controller for the Amiga 500 and Zorro-II + DMAC based SCSI controller for the Amiga 500 and Zorro-II ***************************************************************************/ diff --git a/src/emu/bus/amiga/zorro/action_replay.h b/src/emu/bus/amiga/zorro/action_replay.h index f2520575fb7..5ae6844daa3 100644 --- a/src/emu/bus/amiga/zorro/action_replay.h +++ b/src/emu/bus/amiga/zorro/action_replay.h @@ -1,11 +1,11 @@ /*************************************************************************** - Datel Action Replay + Datel Action Replay license: MAME, GPL-2.0+ copyright-holders: Dirk Best - Freezer cartridge for Amiga 500 and Amiga 2000 + Freezer cartridge for Amiga 500 and Amiga 2000 ***************************************************************************/ diff --git a/src/emu/bus/amiga/zorro/buddha.h b/src/emu/bus/amiga/zorro/buddha.h index 9cc2a479e55..5c7b31f7ffc 100644 --- a/src/emu/bus/amiga/zorro/buddha.h +++ b/src/emu/bus/amiga/zorro/buddha.h @@ -1,11 +1,11 @@ /*************************************************************************** - Buddha + Buddha license: MAME, GPL-2.0+ copyright-holders: Dirk Best - Zorro-II IDE controller + Zorro-II IDE controller ***************************************************************************/ diff --git a/src/emu/bus/amiga/zorro/cards.h b/src/emu/bus/amiga/zorro/cards.h index 57c98f01053..fbbd2b17b29 100644 --- a/src/emu/bus/amiga/zorro/cards.h +++ b/src/emu/bus/amiga/zorro/cards.h @@ -1,21 +1,21 @@ /*************************************************************************** - Amiga Zorro Cards + Amiga Zorro Cards - There are different card types and layouts: + There are different card types and layouts: - * 86-pin expansion slot - - A1000 - - A500 (rotated slot) - - A2000/B2000 (internal slot) - * Zorro-II - - A2000 - - B2000 - * Zorro-III - - A3000, A4000 + * 86-pin expansion slot + - A1000 + - A500 (rotated slot) + - A2000/B2000 (internal slot) + * Zorro-II + - A2000 + - B2000 + * Zorro-III + - A3000, A4000 - For details see zorro.h. Zorro-II cards can be inserted into - Zorro-III slots. + For details see zorro.h. Zorro-II cards can be inserted into + Zorro-III slots. ***************************************************************************/ diff --git a/src/emu/bus/amiga/zorro/zorro.h b/src/emu/bus/amiga/zorro/zorro.h index 7c6d593f6d5..c5dbbb0286b 100644 --- a/src/emu/bus/amiga/zorro/zorro.h +++ b/src/emu/bus/amiga/zorro/zorro.h @@ -1,140 +1,140 @@ /*************************************************************************** - Amiga Zorro Slots + Amiga Zorro Slots license: MAME, GPL-2.0+ copyright-holders: Dirk Best - 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III + 86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III - 86-pin Expansion Slot + 86-pin Expansion Slot - 2 Ground 1 Ground - 4 Ground 3 Ground - 6 +5VDC 5 +5VDC - 8 -5VDC 7 N/C - 10 +12VDC 9 N/C *1 - 12 CFGIN 11 N/C *2 - 14 /C3 Clock 13 Ground - 16 /C1 Clock 15 CDAC - 18 XRDY 17 /OVR - 20 N/C *3 19 /INT2 - 22 /INT6 21 A5 - 24 A4 23 A6 - 26 A3 25 Ground - 28 A7 27 A2 - 30 A8 29 A1 - 32 A9 31 FC0 - 34 A10 33 FC1 - 36 A11 35 FC2 - 38 A12 37 Ground - 40 /IPL0 39 A13 - 42 /IPL1 41 A14 - 44 /IPL2 43 A15 - 46 /BEER 45 A16 - 48 /VPA 47 A17 - 50 E Clock 49 Ground - 52 A18 51 /VMA - 54 A19 53 /RST - 56 A20 55 /HLT - 58 A21 57 A22 - 60 /BR *4 59 A23 - 62 /BGACK 61 Ground - 64 /BG *5 63 D15 - 66 /DTACK 65 D14 - 68 R/W 67 D13 - 70 /LDS 69 D12 - 72 /UDS 71 D11 - 74 /AS 73 Ground - 76 D10 75 D0 - 78 D9 77 D1 - 80 D8 79 D2 - 82 D7 81 D3 - 84 D6 83 D4 - 86 D5 85 Ground + 2 Ground 1 Ground + 4 Ground 3 Ground + 6 +5VDC 5 +5VDC + 8 -5VDC 7 N/C + 10 +12VDC 9 N/C *1 + 12 CFGIN 11 N/C *2 + 14 /C3 Clock 13 Ground + 16 /C1 Clock 15 CDAC + 18 XRDY 17 /OVR + 20 N/C *3 19 /INT2 + 22 /INT6 21 A5 + 24 A4 23 A6 + 26 A3 25 Ground + 28 A7 27 A2 + 30 A8 29 A1 + 32 A9 31 FC0 + 34 A10 33 FC1 + 36 A11 35 FC2 + 38 A12 37 Ground + 40 /IPL0 39 A13 + 42 /IPL1 41 A14 + 44 /IPL2 43 A15 + 46 /BEER 45 A16 + 48 /VPA 47 A17 + 50 E Clock 49 Ground + 52 A18 51 /VMA + 54 A19 53 /RST + 56 A20 55 /HLT + 58 A21 57 A22 + 60 /BR *4 59 A23 + 62 /BGACK 61 Ground + 64 /BG *5 63 D15 + 66 /DTACK 65 D14 + 68 R/W 67 D13 + 70 /LDS 69 D12 + 72 /UDS 71 D11 + 74 /AS 73 Ground + 76 D10 75 D0 + 78 D9 77 D1 + 80 D8 79 D2 + 82 D7 81 D3 + 84 D6 83 D4 + 86 D5 85 Ground - *1 28 MHz Clock on A2000 and B2000 - *2 /COPCFG on B2000 - *3 /PALOPE on A1000, /BOSS on B2000 - *4 /CBR on B2000 - *5 /CBG on B2000 + *1 28 MHz Clock on A2000 and B2000 + *2 /COPCFG on B2000 + *3 /PALOPE on A1000, /BOSS on B2000 + *4 /CBR on B2000 + *5 /CBG on B2000 - Zorro-II (differences only) + Zorro-II (differences only) - 7 /OWN - 9 /SLAVEn - 11 /CFGOUTn - 12 /CFGINn - 20 -12VDC - 40 /EINT7 - 42 /EINT5 - 44 /EINT4 - 60 /BRn - 64 /BGn + 7 /OWN + 9 /SLAVEn + 11 /CFGOUTn + 12 /CFGINn + 20 -12VDC + 40 /EINT7 + 42 /EINT5 + 44 /EINT4 + 60 /BRn + 64 /BGn - 88 Ground 87 Ground - 90 Ground 89 Ground - 92 7 MHz 91 Ground - 94 /BURST 93 DOE - 96 /EINT1 95 /BG *5 - 98 N/C 97 N/C + 88 Ground 87 Ground + 90 Ground 89 Ground + 92 7 MHz 91 Ground + 94 /BURST 93 DOE + 96 /EINT1 95 /BG *5 + 98 N/C 97 N/C 100 Ground 99 Ground - *6 /GBG on B2000 + *6 /GBG on B2000 - Zorro-III + Zorro-III - The Zorro-III is a multiplexed Zorro-II bus with address- and - data phases. Signals changes as follows: + The Zorro-III is a multiplexed Zorro-II bus with address- and + data phases. Signals changes as follows: - 17 /CINH - 18 /MTCR - 29 /LOCK - 30 AD8 (D0) - 32 AD9 (D1) - 34 AD10 (D2) - 36 AD11 (D3) - 38 AD12 (D4) - 39 AD13 (D5) - 40 Reserved - 41 AD14 (D6) - 42 Reserved - 43 AD15 (D7) - 44 Reserved - 45 AD16 (D8) - 47 AD17 (D9) - 48 /MTACK - 51 /DS0 - 52 AD18 (D10) - 54 AD19 (D11) - 56 AD20 (D12) - 57 AD22 (D14) - 58 AD21 (D13) - 59 AD23 (D15) - 63 AD31 - 65 AD30 - 67 AD29 - 69 AD28 - 70 /DS2 - 71 AD27 - 72 /DS3 - 74 /CCS - 75 SD0 (D16) - 76 AD26 - 77 SD1 (D17) - 78 AD25 - 79 SD2 (D18) - 80 AD24 - 81 SD3 (D19) - 82 SD7 (D23) - 83 SD4 (D20) - 84 SD6 (D22) - 86 SD5 (D21) - 91 Sense Z3 - 94 /IORST - 95 /BCLR - 97 /FCS - 98 /DS1 + 17 /CINH + 18 /MTCR + 29 /LOCK + 30 AD8 (D0) + 32 AD9 (D1) + 34 AD10 (D2) + 36 AD11 (D3) + 38 AD12 (D4) + 39 AD13 (D5) + 40 Reserved + 41 AD14 (D6) + 42 Reserved + 43 AD15 (D7) + 44 Reserved + 45 AD16 (D8) + 47 AD17 (D9) + 48 /MTACK + 51 /DS0 + 52 AD18 (D10) + 54 AD19 (D11) + 56 AD20 (D12) + 57 AD22 (D14) + 58 AD21 (D13) + 59 AD23 (D15) + 63 AD31 + 65 AD30 + 67 AD29 + 69 AD28 + 70 /DS2 + 71 AD27 + 72 /DS3 + 74 /CCS + 75 SD0 (D16) + 76 AD26 + 77 SD1 (D17) + 78 AD25 + 79 SD2 (D18) + 80 AD24 + 81 SD3 (D19) + 82 SD7 (D23) + 83 SD4 (D20) + 84 SD6 (D22) + 86 SD5 (D21) + 91 Sense Z3 + 94 /IORST + 95 /BCLR + 97 /FCS + 98 /DS1 ***************************************************************************/ diff --git a/src/emu/bus/bml3/bml3bus.h b/src/emu/bus/bml3/bml3bus.h index 969fbcf7656..cb6be92cf5a 100644 --- a/src/emu/bus/bml3/bml3bus.h +++ b/src/emu/bus/bml3/bml3bus.h @@ -21,7 +21,7 @@ #define MCFG_BML3BUS_CPU(_cputag) \ bml3bus_device::static_set_cputag(*device, _cputag); - + #define MCFG_BML3BUS_OUT_NMI_CB(_devcb) \ devcb = &bml3bus_device::set_out_nmi_callback(*device, DEVCB_##_devcb); @@ -79,7 +79,7 @@ public: // construction/destruction bml3bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); bml3bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - + // inline configuration static void static_set_cputag(device_t &device, const char *tag); template static devcb_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_cb.set_callback(object); } diff --git a/src/emu/bus/centronics/epson_ex800.h b/src/emu/bus/centronics/epson_ex800.h index 24048e047ed..c64ca3b2e6e 100644 --- a/src/emu/bus/centronics/epson_ex800.h +++ b/src/emu/bus/centronics/epson_ex800.h @@ -28,7 +28,7 @@ // ======================> epson_ex800_t class epson_ex800_t : public device_t, - public device_centronics_peripheral_interface + public device_centronics_peripheral_interface { public: // construction/destruction diff --git a/src/emu/bus/centronics/epson_lx800.h b/src/emu/bus/centronics/epson_lx800.h index 7bf62fa7b05..258aeb3230d 100644 --- a/src/emu/bus/centronics/epson_lx800.h +++ b/src/emu/bus/centronics/epson_lx800.h @@ -29,7 +29,7 @@ // ======================> epson_lx800_t class epson_lx800_t : public device_t, - public device_centronics_peripheral_interface + public device_centronics_peripheral_interface { public: // construction/destruction diff --git a/src/emu/bus/coco/cococart.h b/src/emu/bus/coco/cococart.h index 07171b03426..128cdea8e48 100644 --- a/src/emu/bus/coco/cococart.h +++ b/src/emu/bus/coco/cococart.h @@ -46,7 +46,7 @@ struct coco_cartridge_line cococart_line_value value; int line; int q_count; - devcb_write_line *callback; + devcb_write_line *callback; }; // ======================> cococart_base_update_delegate @@ -56,13 +56,13 @@ typedef delegate cococart_base_update_delegate; #define MCFG_COCO_CARTRIDGE_CART_CB(_devcb) \ devcb = &cococart_slot_device::static_set_cart_callback(*device, DEVCB_##_devcb); - + #define MCFG_COCO_CARTRIDGE_NMI_CB(_devcb) \ devcb = &cococart_slot_device::static_set_nmi_callback(*device, DEVCB_##_devcb); - + #define MCFG_COCO_CARTRIDGE_HALT_CB(_devcb) \ devcb = &cococart_slot_device::static_set_halt_callback(*device, DEVCB_##_devcb); - + // ======================> cococart_slot_device class device_cococart_interface; @@ -78,7 +78,7 @@ public: template static devcb_base &static_set_cart_callback(device_t &device, _Object object) { return downcast(device).m_cart_callback.set_callback(object); } template static devcb_base &static_set_nmi_callback(device_t &device, _Object object) { return downcast(device).m_nmi_callback.set_callback(object); } template static devcb_base &static_set_halt_callback(device_t &device, _Object object) { return downcast(device).m_halt_callback.set_callback(object); } - + // device-level overrides virtual void device_start(); virtual void device_config_complete(); @@ -128,10 +128,10 @@ private: coco_cartridge_line m_cart_line; coco_cartridge_line m_nmi_line; coco_cartridge_line m_halt_line; -public: - devcb_write_line m_cart_callback; - devcb_write_line m_nmi_callback; - devcb_write_line m_halt_callback; +public: + devcb_write_line m_cart_callback; + devcb_write_line m_nmi_callback; + devcb_write_line m_halt_callback; private: // cartridge device_cococart_interface *m_cart; diff --git a/src/emu/bus/cpc/cpc_rs232.h b/src/emu/bus/cpc/cpc_rs232.h index 0e44e41d6a9..fe1a716a1fb 100644 --- a/src/emu/bus/cpc/cpc_rs232.h +++ b/src/emu/bus/cpc/cpc_rs232.h @@ -14,7 +14,7 @@ #include "cpcexp.h" class cpc_rs232_device : public device_t, - public device_cpc_expansion_card_interface + public device_cpc_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/cpc/cpcexp.h b/src/emu/bus/cpc/cpcexp.h index b5ab0247331..943396b1eef 100644 --- a/src/emu/bus/cpc/cpcexp.h +++ b/src/emu/bus/cpc/cpcexp.h @@ -93,7 +93,7 @@ public: // construction/destruction cpc_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~cpc_expansion_slot_device(); - + template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_cb.set_callback(object); } template static devcb_base &set_out_reset_callback(device_t &device, _Object object) { return downcast(device).m_out_reset_cb.set_callback(object); } diff --git a/src/emu/bus/gameboy/mbc.h b/src/emu/bus/gameboy/mbc.h index ef261a44503..46e23c3984d 100644 --- a/src/emu/bus/gameboy/mbc.h +++ b/src/emu/bus/gameboy/mbc.h @@ -221,7 +221,7 @@ class gb_rom_licheng_device : public gb_rom_mbc5_device public: // construction/destruction gb_rom_licheng_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + virtual DECLARE_WRITE8_MEMBER(write_bank); }; diff --git a/src/emu/bus/iq151/iq151.h b/src/emu/bus/iq151/iq151.h index e7fe12e8b4b..9b85ee9d3a2 100644 --- a/src/emu/bus/iq151/iq151.h +++ b/src/emu/bus/iq151/iq151.h @@ -79,7 +79,7 @@ public: // construction/destruction iq151cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~iq151cart_slot_device(); - + template static devcb_base &set_out_irq0_callback(device_t &device, _Object object) { return downcast(device).m_out_irq0_cb.set_callback(object); } template static devcb_base &set_out_irq1_callback(device_t &device, _Object object) { return downcast(device).m_out_irq1_cb.set_callback(object); } template static devcb_base &set_out_irq2_callback(device_t &device, _Object object) { return downcast(device).m_out_irq2_cb.set_callback(object); } diff --git a/src/emu/bus/isa/aga.h b/src/emu/bus/isa/aga.h index e764458a087..cfe867ec258 100644 --- a/src/emu/bus/isa/aga.h +++ b/src/emu/bus/isa/aga.h @@ -57,7 +57,7 @@ public: DECLARE_READ8_MEMBER( pc_aga_videoram_r ); MC6845_UPDATE_ROW( aga_update_row ); - MC6845_UPDATE_ROW( mda_text_inten_update_row ); + MC6845_UPDATE_ROW( mda_text_inten_update_row ); MC6845_UPDATE_ROW( mda_text_blink_update_row ); MC6845_UPDATE_ROW( cga_text_inten_update_row ); MC6845_UPDATE_ROW( cga_text_inten_alt_update_row ); diff --git a/src/emu/bus/isa/gus.h b/src/emu/bus/isa/gus.h index 06451a0ac56..969643d427a 100644 --- a/src/emu/bus/isa/gus.h +++ b/src/emu/bus/isa/gus.h @@ -61,22 +61,22 @@ #define MCFG_GF1_TIMER2_IRQ_HANDLER(_devcb) \ devcb = &gf1_device::set_timer2_irq_handler(*device, DEVCB_##_devcb); - + #define MCFG_GF1_SB_IRQ_HANDLER(_devcb) \ devcb = &gf1_device::set_sb_irq_handler(*device, DEVCB_##_devcb); #define MCFG_GF1_DMA_IRQ_HANDLER(_devcb) \ devcb = &gf1_device::set_dma_irq_handler(*device, DEVCB_##_devcb); - + #define MCFG_GF1_DRQ1_HANDLER(_devcb) \ devcb = &gf1_device::set_drq1_handler(*device, DEVCB_##_devcb); - + #define MCFG_GF1_DRQ2_HANDLER(_devcb) \ devcb = &gf1_device::set_drq2_handler(*device, DEVCB_##_devcb); - + #define MCFG_GF1_NMI_HANDLER(_devcb) \ devcb = &gf1_device::set_nmi_handler(*device, DEVCB_##_devcb); - + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** diff --git a/src/emu/bus/isa/isa.h b/src/emu/bus/isa/isa.h index f4640af9a98..83953700d59 100644 --- a/src/emu/bus/isa/isa.h +++ b/src/emu/bus/isa/isa.h @@ -92,7 +92,7 @@ #define MCFG_ISA_BUS_IOCHCK(_iochck) \ downcast(device)->set_iochck_callback(DEVCB_##_iochck); - + #define MCFG_ISA_OUT_IRQ2_CB(_devcb) \ devcb = &isa8_device::set_out_irq2_callback(*device, DEVCB_##_devcb); @@ -119,7 +119,7 @@ #define MCFG_ISA_OUT_DRQ3_CB(_devcb) \ devcb = &isa8_device::set_out_drq3_callback(*device, DEVCB_##_devcb); - + #define MCFG_ISA_OUT_IRQ10_CB(_devcb) \ devcb = &isa16_device::set_out_irq10_callback(*device, DEVCB_##_devcb); @@ -354,7 +354,7 @@ public: template static devcb_base &set_out_drq5_callback(device_t &device, _Object object) { return downcast(device).m_out_drq5_cb.set_callback(object); } template static devcb_base &set_out_drq6_callback(device_t &device, _Object object) { return downcast(device).m_out_drq6_cb.set_callback(object); } template static devcb_base &set_out_drq7_callback(device_t &device, _Object object) { return downcast(device).m_out_drq7_cb.set_callback(object); } - + void install16_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_delegate rhandler, write16_delegate whandler); // for ISA16, put the 16-bit configs in the primary slots and the 8-bit configs in the secondary diff --git a/src/emu/bus/kc/kc.h b/src/emu/bus/kc/kc.h index 8970e957530..1b9b4c7f5d5 100644 --- a/src/emu/bus/kc/kc.h +++ b/src/emu/bus/kc/kc.h @@ -49,7 +49,7 @@ public: template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_cb.set_callback(object); } template static devcb_base &set_out_halt_callback(device_t &device, _Object object) { return downcast(device).m_out_halt_cb.set_callback(object); } - + // device-level overrides virtual void device_start(); @@ -127,7 +127,7 @@ extern const device_type KCCART_SLOT; #define MCFG_KCEXP_SLOT_NEXT_SLOT(_next_slot_tag) \ kcexp_slot_device::static_set_next_slot(*device, _next_slot_tag); - + #define MCFG_KCCART_SLOT_OUT_IRQ_CB(_devcb) \ devcb = &kccart_slot_device::set_out_irq_callback(*device, DEVCB_##_devcb); @@ -141,12 +141,12 @@ extern const device_type KCCART_SLOT; #define MCFG_KCCART_SLOT_NEXT_SLOT(_next_slot_tag) \ kccart_slot_device::static_set_next_slot(*device, _next_slot_tag); -// #define MCFG_KC85_EXPANSION_ADD(_tag,_next_slot_tag,_config,_slot_intf,_def_slot) -// MCFG_DEVICE_ADD(_tag, KCEXP_SLOT, 0) -// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) +// #define MCFG_KC85_EXPANSION_ADD(_tag,_next_slot_tag,_config,_slot_intf,_def_slot) +// MCFG_DEVICE_ADD(_tag, KCEXP_SLOT, 0) +// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) // #define MCFG_KC85_CARTRIDGE_ADD(_tag,_next_slot_tag,_config,_slot_intf,_def_slot) -// MCFG_DEVICE_ADD(_tag, KCCART_SLOT, 0) -// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) +// MCFG_DEVICE_ADD(_tag, KCCART_SLOT, 0) +// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) #endif /* __KCEXP_H__ */ diff --git a/src/emu/bus/msx_cart/ascii.h b/src/emu/bus/msx_cart/ascii.h index 24ad955e32f..39a01074af6 100644 --- a/src/emu/bus/msx_cart/ascii.h +++ b/src/emu/bus/msx_cart/ascii.h @@ -113,4 +113,3 @@ private: #endif - diff --git a/src/emu/bus/msx_cart/konami.h b/src/emu/bus/msx_cart/konami.h index 6f9b10bdf94..c85fcd5fbe6 100644 --- a/src/emu/bus/msx_cart/konami.h +++ b/src/emu/bus/msx_cart/konami.h @@ -94,22 +94,22 @@ private: class msx_cart_synthesizer : public device_t - , public msx_cart_interface + , public msx_cart_interface { public: - msx_cart_synthesizer(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + msx_cart_synthesizer(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - // device-level overrides - virtual void device_start(); + // device-level overrides + virtual void device_start(); virtual machine_config_constructor device_mconfig_additions() const; - virtual void initialize_cartridge(); + virtual void initialize_cartridge(); - virtual DECLARE_READ8_MEMBER(read_cart); - virtual DECLARE_WRITE8_MEMBER(write_cart); + virtual DECLARE_READ8_MEMBER(read_cart); + virtual DECLARE_WRITE8_MEMBER(write_cart); private: - UINT8 *m_bank_base; + UINT8 *m_bank_base; required_device m_dac; }; diff --git a/src/emu/bus/msx_cart/yamaha.h b/src/emu/bus/msx_cart/yamaha.h index 337eabd8f60..e1f6fc489ff 100644 --- a/src/emu/bus/msx_cart/yamaha.h +++ b/src/emu/bus/msx_cart/yamaha.h @@ -60,4 +60,3 @@ public: }; #endif - diff --git a/src/emu/bus/msx_slot/bunsetsu.h b/src/emu/bus/msx_slot/bunsetsu.h index d798cc52b34..de41015932c 100644 --- a/src/emu/bus/msx_slot/bunsetsu.h +++ b/src/emu/bus/msx_slot/bunsetsu.h @@ -11,8 +11,7 @@ extern const device_type MSX_SLOT_BUNSETSU; #define MCFG_MSX_SLOT_BUNSETSU_ADD(_tag, _startpage, _numpages, _region, _offset, _bunsetsu_region_tag) \ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_BUNSETSU, _startpage, _numpages) \ msx_slot_rom_device::set_rom_start(*device, _region, _offset); \ - msx_slot_bunsetsu_device::set_bunsetsu_region_tag(*device, _bunsetsu_region_tag); \ - + msx_slot_bunsetsu_device::set_bunsetsu_region_tag(*device, _bunsetsu_region_tag); class msx_slot_bunsetsu_device : public msx_slot_rom_device { public: @@ -35,4 +34,3 @@ private: #endif - diff --git a/src/emu/bus/msx_slot/cartridge.h b/src/emu/bus/msx_slot/cartridge.h index fef197fdbd5..ec09924f295 100644 --- a/src/emu/bus/msx_slot/cartridge.h +++ b/src/emu/bus/msx_slot/cartridge.h @@ -80,4 +80,3 @@ public: #endif - diff --git a/src/emu/bus/msx_slot/disk.h b/src/emu/bus/msx_slot/disk.h index ad734b7fde7..7816dd28bdc 100644 --- a/src/emu/bus/msx_slot/disk.h +++ b/src/emu/bus/msx_slot/disk.h @@ -103,9 +103,9 @@ protected: class msx_slot_tc8566_disk_device : public msx_slot_disk_device { public: - msx_slot_tc8566_disk_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + msx_slot_tc8566_disk_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - virtual void device_start(); + virtual void device_start(); protected: tc8566af_device *m_fdc; @@ -185,7 +185,7 @@ public: DECLARE_READ8_MEMBER(io_read); DECLARE_WRITE8_MEMBER(io_write); - void post_load(); + void post_load(); private: UINT8 m_control; @@ -195,4 +195,3 @@ private: #endif - diff --git a/src/emu/bus/msx_slot/music.h b/src/emu/bus/msx_slot/music.h index 10e07ae47e6..c21ca3b84fc 100644 --- a/src/emu/bus/msx_slot/music.h +++ b/src/emu/bus/msx_slot/music.h @@ -13,8 +13,7 @@ extern const device_type MSX_SLOT_MUSIC; #define MCFG_MSX_SLOT_MUSIC_ADD(_tag, _startpage, _numpages, _region, _offset, _ym2413_tag) \ MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_MUSIC, _startpage, _numpages) \ msx_slot_rom_device::set_rom_start(*device, _region, _offset); \ - msx_slot_music_device::set_ym2413_tag(*device, _ym2413_tag); \ - + msx_slot_music_device::set_ym2413_tag(*device, _ym2413_tag); class msx_slot_music_device : public msx_slot_rom_device { public: @@ -36,4 +35,3 @@ private: #endif - diff --git a/src/emu/bus/msx_slot/ram.h b/src/emu/bus/msx_slot/ram.h index 9f66808b234..3a2b0a936f9 100644 --- a/src/emu/bus/msx_slot/ram.h +++ b/src/emu/bus/msx_slot/ram.h @@ -4,8 +4,7 @@ #include "slot.h" #define MCFG_MSX_SLOT_RAM_ADD(_tag, _startpage, _numpages) \ - MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_RAM, _startpage, _numpages) \ - + MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_RAM, _startpage, _numpages) class msx_slot_ram_device : public device_t, public msx_internal_slot_interface { diff --git a/src/emu/bus/msx_slot/ram_mm.h b/src/emu/bus/msx_slot/ram_mm.h index 5027fa428e1..89399bc2608 100644 --- a/src/emu/bus/msx_slot/ram_mm.h +++ b/src/emu/bus/msx_slot/ram_mm.h @@ -41,4 +41,3 @@ private: extern const device_type MSX_SLOT_RAM_MM; #endif - diff --git a/src/emu/bus/neogeo/banked_cart.h b/src/emu/bus/neogeo/banked_cart.h index 60e2ad0cc05..d0921b72c33 100644 --- a/src/emu/bus/neogeo/banked_cart.h +++ b/src/emu/bus/neogeo/banked_cart.h @@ -42,6 +42,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/bootleg_prot.h b/src/emu/bus/neogeo/bootleg_prot.h index bcd2b3f3172..685c315dc33 100644 --- a/src/emu/bus/neogeo/bootleg_prot.h +++ b/src/emu/bus/neogeo/bootleg_prot.h @@ -22,7 +22,7 @@ public: void neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed_size, int value); void kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size); void kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size); - void kof10thBankswitch(address_space &space, UINT16 nBank); + void kof10thBankswitch(address_space &space, UINT16 nBank); DECLARE_READ16_MEMBER(kof10th_RAM2_r); DECLARE_READ16_MEMBER(kof10th_RAMB_r); DECLARE_WRITE16_MEMBER(kof10th_custom_w); @@ -95,6 +95,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/cmc_prot.h b/src/emu/bus/neogeo/cmc_prot.h index 3d12a159aa7..5c535b09f37 100644 --- a/src/emu/bus/neogeo/cmc_prot.h +++ b/src/emu/bus/neogeo/cmc_prot.h @@ -83,6 +83,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/fatfury2_prot.h b/src/emu/bus/neogeo/fatfury2_prot.h index 4ba37427531..d359f616136 100644 --- a/src/emu/bus/neogeo/fatfury2_prot.h +++ b/src/emu/bus/neogeo/fatfury2_prot.h @@ -38,8 +38,3 @@ private: }; #endif - - - - - diff --git a/src/emu/bus/neogeo/kof2002_prot.h b/src/emu/bus/neogeo/kof2002_prot.h index 2cad2d846e7..6e9074c157e 100644 --- a/src/emu/bus/neogeo/kof2002_prot.h +++ b/src/emu/bus/neogeo/kof2002_prot.h @@ -34,6 +34,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/kof98_prot.h b/src/emu/bus/neogeo/kof98_prot.h index 7f6e08c1cd1..dfd587c418a 100644 --- a/src/emu/bus/neogeo/kof98_prot.h +++ b/src/emu/bus/neogeo/kof98_prot.h @@ -16,7 +16,7 @@ class kof98_prot_device : public device_t public: // construction/destruction kof98_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + void kof98_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size); void install_kof98_protection(cpu_device* maincpu); DECLARE_WRITE16_MEMBER(kof98_prot_w); @@ -36,7 +36,3 @@ private: }; #endif - - - - diff --git a/src/emu/bus/neogeo/mslugx_prot.h b/src/emu/bus/neogeo/mslugx_prot.h index 4a6bb284f9b..cb95da812ac 100644 --- a/src/emu/bus/neogeo/mslugx_prot.h +++ b/src/emu/bus/neogeo/mslugx_prot.h @@ -37,6 +37,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/neogeo_intf.h b/src/emu/bus/neogeo/neogeo_intf.h index cba60338833..07c60c12c54 100644 --- a/src/emu/bus/neogeo/neogeo_intf.h +++ b/src/emu/bus/neogeo/neogeo_intf.h @@ -49,7 +49,7 @@ public: void ym_alloc(UINT32 size) { if (m_ym == NULL) m_ym.resize(size/sizeof(UINT8)); } UINT8* get_ym_base() { return m_ym; } UINT32 get_ym_size() { return m_ym.bytes(); } - + void ymdelta_alloc(UINT32 size) { if (m_ymdelta == NULL) m_ymdelta.resize(size/sizeof(UINT8)); } UINT8* get_ymdelta_base() { return m_ymdelta; } UINT32 get_ymdelta_size() { return m_ymdelta.bytes(); } @@ -74,4 +74,3 @@ protected: }; #endif - diff --git a/src/emu/bus/neogeo/pcm2_prot.h b/src/emu/bus/neogeo/pcm2_prot.h index ff3aa862e2c..09b0e8a1f21 100644 --- a/src/emu/bus/neogeo/pcm2_prot.h +++ b/src/emu/bus/neogeo/pcm2_prot.h @@ -16,7 +16,7 @@ class pcm2_prot_device : public device_t public: // construction/destruction pcm2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + void neo_pcm2_snk_1999(UINT8* ymrom, UINT32 ymsize, int value); void neo_pcm2_swap(UINT8* ymrom, UINT32 ymsize, int value); @@ -32,6 +32,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/pvc_prot.h b/src/emu/bus/neogeo/pvc_prot.h index 408fbfc8176..fde58cbb8f6 100644 --- a/src/emu/bus/neogeo/pvc_prot.h +++ b/src/emu/bus/neogeo/pvc_prot.h @@ -46,6 +46,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/neogeo/sbp_prot.h b/src/emu/bus/neogeo/sbp_prot.h index 12f483b8866..6fd99d03f58 100644 --- a/src/emu/bus/neogeo/sbp_prot.h +++ b/src/emu/bus/neogeo/sbp_prot.h @@ -16,7 +16,7 @@ class sbp_prot_device : public device_t public: // construction/destruction sbp_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + UINT8* m_mainrom; @@ -36,7 +36,3 @@ private: }; #endif - - - - diff --git a/src/emu/bus/neogeo/sma_prot.h b/src/emu/bus/neogeo/sma_prot.h index 049eeb2a774..814b52625aa 100644 --- a/src/emu/bus/neogeo/sma_prot.h +++ b/src/emu/bus/neogeo/sma_prot.h @@ -54,6 +54,3 @@ private: }; #endif - - - diff --git a/src/emu/bus/nes/mmc5.h b/src/emu/bus/nes/mmc5.h index d507429b58a..e764f9bcc95 100644 --- a/src/emu/bus/nes/mmc5.h +++ b/src/emu/bus/nes/mmc5.h @@ -78,7 +78,7 @@ protected: // MMC-5 contains 1K of internal ram UINT8 m_exram[0x400]; - + UINT8 m_ram_hi_banks[4]; // int m_nes_vram_sprite[8]; diff --git a/src/emu/bus/nubus/nubus.h b/src/emu/bus/nubus/nubus.h index eb79dbc8b83..e494df7ac0a 100644 --- a/src/emu/bus/nubus/nubus.h +++ b/src/emu/bus/nubus/nubus.h @@ -38,7 +38,7 @@ #define MCFG_NUBUS_OUT_IRQE_CB(_devcb) \ devcb = &nubus_device::set_out_irqe_callback(*device, DEVCB_##_devcb); - + #define MCFG_NUBUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \ MCFG_DEVICE_ADD(_tag, NUBUS_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ @@ -88,7 +88,7 @@ public: nubus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); nubus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); ~nubus_device() { m_device_list.detach_all(); } - + // inline configuration static void static_set_cputag(device_t &device, const char *tag); template static devcb_base &set_out_irq9_callback(device_t &device, _Object object) { return downcast(device).m_out_irq9_cb.set_callback(object); } diff --git a/src/emu/bus/oricext/jasmin.h b/src/emu/bus/oricext/jasmin.h index 6815d652daf..4fe40da89fc 100644 --- a/src/emu/bus/oricext/jasmin.h +++ b/src/emu/bus/oricext/jasmin.h @@ -28,7 +28,7 @@ protected: bool side_sel, fdc_reset, ram_access, rom_access, select[4]; UINT8 *jasmin_rom; floppy_image_device *cur_floppy, *floppies[4]; - + virtual void device_start(); virtual void device_reset(); const rom_entry *device_rom_region() const; diff --git a/src/emu/bus/oricext/microdisc.h b/src/emu/bus/oricext/microdisc.h index fb7a6fd68b5..3ea5e8f9545 100644 --- a/src/emu/bus/oricext/microdisc.h +++ b/src/emu/bus/oricext/microdisc.h @@ -40,7 +40,7 @@ protected: floppy_image_device *floppies[4]; UINT8 port_314; bool intrq_state, drq_state, hld_state; - + virtual void device_start(); virtual void device_reset(); const rom_entry *device_rom_region() const; diff --git a/src/emu/bus/oricext/oricext.h b/src/emu/bus/oricext/oricext.h index 1d2cb6e2a65..5308ca36da8 100644 --- a/src/emu/bus/oricext/oricext.h +++ b/src/emu/bus/oricext/oricext.h @@ -10,7 +10,7 @@ #include "emu.h" #include "cpu/m6502/m6502.h" -#define MCFG_ORICEXT_ADD(_tag, _slot_intf, _def_slot, _cputag, _irq) \ +#define MCFG_ORICEXT_ADD(_tag, _slot_intf, _def_slot, _cputag, _irq) \ MCFG_DEVICE_ADD(_tag, ORICEXT_CONNECTOR, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ downcast(device)->set_cputag(_cputag); \ @@ -20,7 +20,7 @@ class oricext_device; class oricext_connector: public device_t, - public device_slot_interface + public device_slot_interface { public: oricext_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -38,7 +38,7 @@ protected: }; class oricext_device : public device_t, - public device_slot_card_interface + public device_slot_card_interface { public: oricext_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); diff --git a/src/emu/bus/pc_kbd/pc_kbdc.h b/src/emu/bus/pc_kbd/pc_kbdc.h index d391486e5e5..679870c5b93 100644 --- a/src/emu/bus/pc_kbd/pc_kbdc.h +++ b/src/emu/bus/pc_kbd/pc_kbdc.h @@ -24,7 +24,7 @@ set the data line and then set the clock line. #define MCFG_PC_KBDC_OUT_DATA_CB(_devcb) \ devcb = &pc_kbdc_device::set_out_data_callback(*device, DEVCB_##_devcb); - + #define MCFG_PC_KBDC_SLOT_ADD(_kbdc_tag, _tag, _slot_intf, _def_slot) \ MCFG_DEVICE_ADD(_tag, PC_KBDC_SLOT, 0 ) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ @@ -67,7 +67,7 @@ public: template static devcb_base &set_out_clock_callback(device_t &device, _Object object) { return downcast(device).m_out_clock_cb.set_callback(object); } template static devcb_base &set_out_data_callback(device_t &device, _Object object) { return downcast(device).m_out_data_cb.set_callback(object); } - + void set_keyboard(device_pc_kbd_interface *keyboard); int clock_signal() { return m_clock_state; } diff --git a/src/emu/bus/pet/diag.h b/src/emu/bus/pet/diag.h index 7a5752bdc86..fec6dcae5a8 100644 --- a/src/emu/bus/pet/diag.h +++ b/src/emu/bus/pet/diag.h @@ -46,7 +46,7 @@ public: virtual DECLARE_WRITE_LINE_MEMBER( input_d ) { output_4(state); } virtual DECLARE_WRITE_LINE_MEMBER( input_k ) { output_9(state); } virtual DECLARE_WRITE_LINE_MEMBER( input_l ) { output_10(state); } - + protected: // device-level overrides virtual void device_start(); diff --git a/src/emu/bus/ql/cst_q_plus4.h b/src/emu/bus/ql/cst_q_plus4.h index ad6b385782a..6dc315ccaa9 100644 --- a/src/emu/bus/ql/cst_q_plus4.h +++ b/src/emu/bus/ql/cst_q_plus4.h @@ -26,7 +26,7 @@ // ======================> cst_q_plus4_t class cst_q_plus4_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/cst_qdisc.h b/src/emu/bus/ql/cst_qdisc.h index e422dcf10ab..545b825744c 100644 --- a/src/emu/bus/ql/cst_qdisc.h +++ b/src/emu/bus/ql/cst_qdisc.h @@ -25,7 +25,7 @@ // ======================> cst_ql_disc_interface_t class cst_ql_disc_interface_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/cumana_fdi.h b/src/emu/bus/ql/cumana_fdi.h index fac6a1b0bc4..4be8652ca2b 100644 --- a/src/emu/bus/ql/cumana_fdi.h +++ b/src/emu/bus/ql/cumana_fdi.h @@ -2,7 +2,7 @@ // copyright-holders:Curt Coder /********************************************************************** - Cumana Floppy Disk Interface emulation + Cumana Floppy Disk Interface emulation Copyright MESS Team. Visit http://mamedev.org for licensing and usage restrictions. @@ -25,7 +25,7 @@ // ======================> cumana_floppy_disk_interface_t class cumana_floppy_disk_interface_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/exp.h b/src/emu/bus/ql/exp.h index d77433c398b..045812c2a32 100644 --- a/src/emu/bus/ql/exp.h +++ b/src/emu/bus/ql/exp.h @@ -64,13 +64,13 @@ #define MCFG_QL_EXPANSION_SLOT_IPL0L_CALLBACK(_write) \ - devcb = &ql_expansion_slot_t::set_ipl0l_wr_callback(*device, DEVCB_##_write); + devcb = &ql_expansion_slot_t::set_ipl0l_wr_callback(*device, DEVCB_##_write); #define MCFG_QL_EXPANSION_SLOT_IPL1L_CALLBACK(_write) \ - devcb = &ql_expansion_slot_t::set_ipl1l_wr_callback(*device, DEVCB_##_write); + devcb = &ql_expansion_slot_t::set_ipl1l_wr_callback(*device, DEVCB_##_write); #define MCFG_QL_EXPANSION_SLOT_BERRL_CALLBACK(_write) \ - devcb = &ql_expansion_slot_t::set_berrl_wr_callback(*device, DEVCB_##_write); + devcb = &ql_expansion_slot_t::set_berrl_wr_callback(*device, DEVCB_##_write); #define MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(_write) \ devcb = &ql_expansion_slot_t::set_extintl_wr_callback(*device, DEVCB_##_write); @@ -93,14 +93,14 @@ public: // construction/destruction device_ql_expansion_card_interface(const machine_config &mconfig, device_t &device); - virtual void romoeh_w(int state) { m_romoeh = state; } - virtual UINT8 read(address_space &space, offs_t offset, UINT8 data) { return data; } - virtual void write(address_space &space, offs_t offset, UINT8 data) { } + virtual void romoeh_w(int state) { m_romoeh = state; } + virtual UINT8 read(address_space &space, offs_t offset, UINT8 data) { return data; } + virtual void write(address_space &space, offs_t offset, UINT8 data) { } protected: ql_expansion_slot_t *m_slot; - int m_romoeh; + int m_romoeh; }; @@ -113,31 +113,31 @@ public: // construction/destruction ql_expansion_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - template static devcb_base &set_ipl0l_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ipl0l.set_callback(object); } - template static devcb_base &set_ipl1l_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ipl1l.set_callback(object); } - template static devcb_base &set_berrl_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_berrl.set_callback(object); } + template static devcb_base &set_ipl0l_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ipl0l.set_callback(object); } + template static devcb_base &set_ipl1l_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ipl1l.set_callback(object); } + template static devcb_base &set_berrl_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_berrl.set_callback(object); } template static devcb_base &set_extintl_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_extintl.set_callback(object); } - // computer interface - UINT8 read(address_space &space, offs_t offset, UINT8 data) { if (m_card) data = m_card->read(space, offset, data); return data; } - void write(address_space &space, offs_t offset, UINT8 data) { if (m_card) m_card->write(space, offset, data); } - DECLARE_WRITE_LINE_MEMBER( romoeh_w ) { if (m_card) m_card->romoeh_w(state); } + // computer interface + UINT8 read(address_space &space, offs_t offset, UINT8 data) { if (m_card) data = m_card->read(space, offset, data); return data; } + void write(address_space &space, offs_t offset, UINT8 data) { if (m_card) m_card->write(space, offset, data); } + DECLARE_WRITE_LINE_MEMBER( romoeh_w ) { if (m_card) m_card->romoeh_w(state); } - // card interface - DECLARE_WRITE_LINE_MEMBER( ipl0l_w ) { m_write_ipl0l(state); } - DECLARE_WRITE_LINE_MEMBER( ipl1l_w ) { m_write_ipl1l(state); } - DECLARE_WRITE_LINE_MEMBER( berrl_w ) { m_write_berrl(state); } + // card interface + DECLARE_WRITE_LINE_MEMBER( ipl0l_w ) { m_write_ipl0l(state); } + DECLARE_WRITE_LINE_MEMBER( ipl1l_w ) { m_write_ipl1l(state); } + DECLARE_WRITE_LINE_MEMBER( berrl_w ) { m_write_berrl(state); } DECLARE_WRITE_LINE_MEMBER( extintl_w ) { m_write_extintl(state); } protected: // device-level overrides virtual void device_start(); - virtual void device_reset() { if (get_card_device()) get_card_device()->reset(); } + virtual void device_reset() { if (get_card_device()) get_card_device()->reset(); } devcb_write_line m_write_ipl0l; - devcb_write_line m_write_ipl1l; - devcb_write_line m_write_berrl; - devcb_write_line m_write_extintl; + devcb_write_line m_write_ipl1l; + devcb_write_line m_write_berrl; + devcb_write_line m_write_extintl; device_ql_expansion_card_interface *m_card; }; diff --git a/src/emu/bus/ql/kempston_di.h b/src/emu/bus/ql/kempston_di.h index 2bde84e00be..1ca3a14e1f2 100644 --- a/src/emu/bus/ql/kempston_di.h +++ b/src/emu/bus/ql/kempston_di.h @@ -25,7 +25,7 @@ // ======================> kempston_disk_interface_t class kempston_disk_interface_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/miracle_gold_card.h b/src/emu/bus/ql/miracle_gold_card.h index 8decf3157ca..721ae564e46 100644 --- a/src/emu/bus/ql/miracle_gold_card.h +++ b/src/emu/bus/ql/miracle_gold_card.h @@ -25,7 +25,7 @@ // ======================> miracle_gold_card_t class miracle_gold_card_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/miracle_hd.h b/src/emu/bus/ql/miracle_hd.h index 4d7503128a5..7df72866a8f 100644 --- a/src/emu/bus/ql/miracle_hd.h +++ b/src/emu/bus/ql/miracle_hd.h @@ -25,7 +25,7 @@ // ======================> miracle_hard_disk_t class miracle_hard_disk_t : public device_t, - public device_ql_rom_cartridge_card_interface + public device_ql_rom_cartridge_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/mp_fdi.h b/src/emu/bus/ql/mp_fdi.h index 7e6280e2b6b..7934cf0731a 100644 --- a/src/emu/bus/ql/mp_fdi.h +++ b/src/emu/bus/ql/mp_fdi.h @@ -25,7 +25,7 @@ // ======================> micro_peripherals_floppy_disk_interface_t class micro_peripherals_floppy_disk_interface_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/opd_basic_master.h b/src/emu/bus/ql/opd_basic_master.h index 8d262b8e493..261ce258980 100644 --- a/src/emu/bus/ql/opd_basic_master.h +++ b/src/emu/bus/ql/opd_basic_master.h @@ -25,7 +25,7 @@ // ======================> opd_basic_master_t class opd_basic_master_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/pcml_qdisk.h b/src/emu/bus/ql/pcml_qdisk.h index 46e15d67036..1c6f33df282 100644 --- a/src/emu/bus/ql/pcml_qdisk.h +++ b/src/emu/bus/ql/pcml_qdisk.h @@ -25,7 +25,7 @@ // ======================> pcml_q_disk_interface_t class pcml_q_disk_interface_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/qubide.h b/src/emu/bus/ql/qubide.h index a8334729b46..6b5ef287c5f 100644 --- a/src/emu/bus/ql/qubide.h +++ b/src/emu/bus/ql/qubide.h @@ -26,7 +26,7 @@ // ======================> qubide_t class qubide_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/rom.h b/src/emu/bus/ql/rom.h index 74a655dba15..02e79f8f2d8 100644 --- a/src/emu/bus/ql/rom.h +++ b/src/emu/bus/ql/rom.h @@ -64,16 +64,16 @@ public: device_ql_rom_cartridge_card_interface(const machine_config &mconfig, device_t &device); virtual ~device_ql_rom_cartridge_card_interface(); - virtual void romoeh_w(int state) { m_romoeh = state; } - virtual UINT8 read(address_space &space, offs_t offset, UINT8 data) { return data; } - virtual void write(address_space &space, offs_t offset, UINT8 data) { } + virtual void romoeh_w(int state) { m_romoeh = state; } + virtual UINT8 read(address_space &space, offs_t offset, UINT8 data) { return data; } + virtual void write(address_space &space, offs_t offset, UINT8 data) { } protected: ql_rom_cartridge_slot_t *m_slot; optional_shared_ptr m_rom; - int m_romoeh; + int m_romoeh; }; diff --git a/src/emu/bus/ql/sandy_superdisk.h b/src/emu/bus/ql/sandy_superdisk.h index 2ebf422e95b..0ab375aea7f 100644 --- a/src/emu/bus/ql/sandy_superdisk.h +++ b/src/emu/bus/ql/sandy_superdisk.h @@ -28,7 +28,7 @@ // ======================> sandy_super_disk_device class sandy_super_disk_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/sandy_superqboard.h b/src/emu/bus/ql/sandy_superqboard.h index 8a34e2bf305..535f9b0dd26 100644 --- a/src/emu/bus/ql/sandy_superqboard.h +++ b/src/emu/bus/ql/sandy_superqboard.h @@ -28,7 +28,7 @@ // ======================> sandy_superqboard_t class sandy_superqboard_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/ql/trumpcard.h b/src/emu/bus/ql/trumpcard.h index a0bd1bb7713..ecae4d0e88c 100644 --- a/src/emu/bus/ql/trumpcard.h +++ b/src/emu/bus/ql/trumpcard.h @@ -27,7 +27,7 @@ // ======================> ql_trump_card_t class ql_trump_card_t : public device_t, - public device_ql_expansion_card_interface + public device_ql_expansion_card_interface { public: // construction/destruction diff --git a/src/emu/bus/scsi/scsihle.h b/src/emu/bus/scsi/scsihle.h index 071748f8aeb..50feb6ff45f 100644 --- a/src/emu/bus/scsi/scsihle.h +++ b/src/emu/bus/scsi/scsihle.h @@ -88,6 +88,5 @@ extern const input_device_default DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_7)[]; MCFG_DEVICE_MODIFY(_tag ) \ MCFG_SLOT_OPTION_ADD( _option, _type ) \ MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS( _option, _id ) \ - MCFG_SLOT_DEFAULT_OPTION( _option ) \ - + MCFG_SLOT_DEFAULT_OPTION( _option ) #endif diff --git a/src/emu/bus/tvc/tvc.h b/src/emu/bus/tvc/tvc.h index e02922218b5..181806f8195 100644 --- a/src/emu/bus/tvc/tvc.h +++ b/src/emu/bus/tvc/tvc.h @@ -89,7 +89,7 @@ public: // construction/destruction tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~tvcexp_slot_device(); - + template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_cb.set_callback(object); } @@ -124,5 +124,5 @@ extern const device_type TVCEXP_SLOT; #define MCFG_TVCEXP_SLOT_OUT_NMI_CB(_devcb) \ devcb = &tvcexp_slot_device::set_out_nmi_callback(*device, DEVCB_##_devcb); - + #endif /* __TVCEXP_H__ */ diff --git a/src/emu/bus/vtech/ioexp/carts.h b/src/emu/bus/vtech/ioexp/carts.h index afca300774f..fb7cf41cd9f 100644 --- a/src/emu/bus/vtech/ioexp/carts.h +++ b/src/emu/bus/vtech/ioexp/carts.h @@ -1,6 +1,6 @@ /*************************************************************************** - VTech Laser/VZ I/O Expansion Slot Devices + VTech Laser/VZ I/O Expansion Slot Devices ***************************************************************************/ diff --git a/src/emu/bus/vtech/ioexp/ioexp.h b/src/emu/bus/vtech/ioexp/ioexp.h index 782cd8a229a..b82962ee0ee 100644 --- a/src/emu/bus/vtech/ioexp/ioexp.h +++ b/src/emu/bus/vtech/ioexp/ioexp.h @@ -1,27 +1,27 @@ /*************************************************************************** - VTech Laser/VZ I/O Expansion Slot + VTech Laser/VZ I/O Expansion Slot license: MAME, GPL-2.0+ copyright-holders: Dirk Best - 30-pin slot + 30-pin slot - 15 GND 16 NC - 14 /WR 17 NC - 13 A3 18 NC - 12 A6 19 +5VDC - 11 A2 20 NC - 10 A5 21 D4 - 9 D0 22 D5 - 8 D2 23 D7 - 7 D6 24 D1 - 6 D3 25 /RD - 5 /IORQ 26 A1 - 4 +5VDC 27 A4 - 3 NC 28 A0 - 2 NC 29 A7 - 1 NC 30 NC + 15 GND 16 NC + 14 /WR 17 NC + 13 A3 18 NC + 12 A6 19 +5VDC + 11 A2 20 NC + 10 A5 21 D4 + 9 D0 22 D5 + 8 D2 23 D7 + 7 D6 24 D1 + 6 D3 25 /RD + 5 /IORQ 26 A1 + 4 +5VDC 27 A4 + 3 NC 28 A0 + 2 NC 29 A7 + 1 NC 30 NC ***************************************************************************/ diff --git a/src/emu/bus/vtech/ioexp/joystick.h b/src/emu/bus/vtech/ioexp/joystick.h index 8344ce43d40..0226f517393 100644 --- a/src/emu/bus/vtech/ioexp/joystick.h +++ b/src/emu/bus/vtech/ioexp/joystick.h @@ -1,6 +1,6 @@ /*************************************************************************** - VTech Laser Joystick Interface + VTech Laser Joystick Interface license: MAME, GPL-2.0+ copyright-holders: Dirk Best diff --git a/src/emu/bus/vtech/ioexp/printer.h b/src/emu/bus/vtech/ioexp/printer.h index 0229b9051e7..ed3010c5f73 100644 --- a/src/emu/bus/vtech/ioexp/printer.h +++ b/src/emu/bus/vtech/ioexp/printer.h @@ -1,6 +1,6 @@ /*************************************************************************** - VTech Laser/VZ Printer Interface + VTech Laser/VZ Printer Interface license: MAME, GPL-2.0+ copyright-holders: Dirk Best diff --git a/src/emu/bus/vtech/memexp/carts.h b/src/emu/bus/vtech/memexp/carts.h index 30663b75ed0..c00f069f79d 100644 --- a/src/emu/bus/vtech/memexp/carts.h +++ b/src/emu/bus/vtech/memexp/carts.h @@ -1,6 +1,6 @@ /*************************************************************************** - VTech Laser/VZ Memory Expansion Slot Devices + VTech Laser/VZ Memory Expansion Slot Devices ***************************************************************************/ diff --git a/src/emu/bus/vtech/memexp/floppy.h b/src/emu/bus/vtech/memexp/floppy.h index 08dbc70987e..a5d0aa12757 100644 --- a/src/emu/bus/vtech/memexp/floppy.h +++ b/src/emu/bus/vtech/memexp/floppy.h @@ -1,11 +1,11 @@ /*************************************************************************** - VTech Laser/VZ Floppy Controller Cartridge + VTech Laser/VZ Floppy Controller Cartridge license: MAME, GPL-2.0+ copyright-holders: Dirk Best - Laser DD 20 + Laser DD 20 Dick Smith Electronics X-7304 ***************************************************************************/ diff --git a/src/emu/bus/vtech/memexp/memexp.h b/src/emu/bus/vtech/memexp/memexp.h index 60940df14b5..38aceb2835c 100644 --- a/src/emu/bus/vtech/memexp/memexp.h +++ b/src/emu/bus/vtech/memexp/memexp.h @@ -1,34 +1,34 @@ /*************************************************************************** - VTech Laser/VZ Memory Expansion Slot + VTech Laser/VZ Memory Expansion Slot license: MAME, GPL-2.0+ copyright-holders: Dirk Best - 44-pin slot + 44-pin slot - 22 GND 23 NC - 21 +5VDC 24 A11 - 20 /IORQ 25 A12 - 19 /RD 26 A13 - 18 /NMI 27 A14 - 17 /WAIT 28 A15 - 16 /MI 29 CLK - 15 /RFSH 30 D4 - 14 D7 31 D3 - 13 D2 32 D5 - 12 A1 33 D6 - 11 A2 34 NC - 10 A3 35 A0 - 9 A4 36 D0 - 8 A5 37 D1 - 7 A6 38 /INT - 6 A7 39 /HALT - 5 A8 40 /MERQ - 4 A9 41 /WR - 3 A10 42 /NC - 2 /RESET 43 +9VDC - 1 GND 44 NC + 22 GND 23 NC + 21 +5VDC 24 A11 + 20 /IORQ 25 A12 + 19 /RD 26 A13 + 18 /NMI 27 A14 + 17 /WAIT 28 A15 + 16 /MI 29 CLK + 15 /RFSH 30 D4 + 14 D7 31 D3 + 13 D2 32 D5 + 12 A1 33 D6 + 11 A2 34 NC + 10 A3 35 A0 + 9 A4 36 D0 + 8 A5 37 D1 + 7 A6 38 /INT + 6 A7 39 /HALT + 5 A8 40 /MERQ + 4 A9 41 /WR + 3 A10 42 /NC + 2 /RESET 43 +9VDC + 1 GND 44 NC ***************************************************************************/ diff --git a/src/emu/bus/vtech/memexp/memory.h b/src/emu/bus/vtech/memexp/memory.h index 99f3b9fd3ce..37b77126e1a 100644 --- a/src/emu/bus/vtech/memexp/memory.h +++ b/src/emu/bus/vtech/memexp/memory.h @@ -1,6 +1,6 @@ /*************************************************************************** - VTech Laser/VZ Memory Expansions + VTech Laser/VZ Memory Expansions license: MAME, GPL-2.0+ copyright-holders: Dirk Best diff --git a/src/emu/bus/vtech/memexp/rs232.h b/src/emu/bus/vtech/memexp/rs232.h index 0d631875bad..9314b6c6721 100644 --- a/src/emu/bus/vtech/memexp/rs232.h +++ b/src/emu/bus/vtech/memexp/rs232.h @@ -1,6 +1,6 @@ /*************************************************************************** - Dick Smith VZ-200/300 RS-232 Cartridge + Dick Smith VZ-200/300 RS-232 Cartridge license: MAME, GPL-2.0+ copyright-holders: Dirk Best diff --git a/src/emu/bus/vtech/memexp/wordpro.h b/src/emu/bus/vtech/memexp/wordpro.h index b6b10226b41..58caa365251 100644 --- a/src/emu/bus/vtech/memexp/wordpro.h +++ b/src/emu/bus/vtech/memexp/wordpro.h @@ -1,6 +1,6 @@ /*************************************************************************** - Dick Smith VZ-300 WordPro Cartridge + Dick Smith VZ-300 WordPro Cartridge license: MAME, GPL-2.0+ copyright-holders: Dirk Best diff --git a/src/emu/bus/x68k/x68kexp.h b/src/emu/bus/x68k/x68kexp.h index 74da5ef89b8..cabca04e8f0 100644 --- a/src/emu/bus/x68k/x68kexp.h +++ b/src/emu/bus/x68k/x68kexp.h @@ -85,7 +85,7 @@ #define MCFG_X68K_EXPANSION_SLOT_OUT_RESET_CB(_devcb) \ devcb = &x68k_expansion_slot_device::set_out_reset_callback(*device, DEVCB_##_devcb); - + //************************************************************************** // TYPE DEFINITIONS @@ -115,7 +115,7 @@ public: // construction/destruction x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~x68k_expansion_slot_device(); - + template static devcb_base &set_out_irq2_callback(device_t &device, _Object object) { return downcast(device).m_out_irq2_cb.set_callback(object); } template static devcb_base &set_out_irq4_callback(device_t &device, _Object object) { return downcast(device).m_out_irq4_cb.set_callback(object); } template static devcb_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast(device).m_out_nmi_cb.set_callback(object); } diff --git a/src/emu/bus/z88/z88.h b/src/emu/bus/z88/z88.h index edeae5e6624..d899c69fe9a 100644 --- a/src/emu/bus/z88/z88.h +++ b/src/emu/bus/z88/z88.h @@ -85,7 +85,7 @@ public: // construction/destruction z88cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~z88cart_slot_device(); - + template static devcb_base &set_out_flp_callback(device_t &device, _Object object) { return downcast(device).m_out_flp_cb.set_callback(object); } // device-level overrides @@ -134,5 +134,5 @@ extern const device_type Z88CART_SLOT; #define MCFG_Z88CART_SLOT_OUT_FLP_CB(_devcb) \ devcb = &z88cart_slot_device::set_out_flp_callback(*device, DEVCB_##_devcb); - + #endif /* __Z88CART_H__ */ diff --git a/src/emu/cpu/adsp2100/adsp2100.h b/src/emu/cpu/adsp2100/adsp2100.h index 460ddd6ce98..580c98c4552 100644 --- a/src/emu/cpu/adsp2100/adsp2100.h +++ b/src/emu/cpu/adsp2100/adsp2100.h @@ -456,9 +456,9 @@ protected: UINT16 m_mask_table[0x4000]; UINT16 m_reverse_table[0x4000]; - devcb_read32 m_sport_rx_cb; // callback for serial receive - devcb_write32 m_sport_tx_cb; // callback for serial transmit - devcb_write_line m_timer_fired_cb; // callback for timer fired + devcb_read32 m_sport_rx_cb; // callback for serial receive + devcb_write32 m_sport_tx_cb; // callback for serial transmit + devcb_write_line m_timer_fired_cb; // callback for timer fired // debugging #if ADSP_TRACK_HOTSPOTS diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak index c70b60ee51a..d72872fd573 100644 --- a/src/emu/cpu/cpu.mak +++ b/src/emu/cpu/cpu.mak @@ -1780,7 +1780,7 @@ DASMOBJS += $(CPUOBJ)/upd7810/upd7810_dasm.o endif $(CPUOBJ)/upd7810/upd7810_opcodes.o: $(CPUSRC)/upd7810/upd7810_opcodes.c \ - $(CPUSRC)/upd7810/upd7810_macros.h + $(CPUSRC)/upd7810/upd7810_macros.h $(CPUOBJ)/upd7810/upd7810.o: $(CPUSRC)/upd7810/upd7810.c \ $(CPUSRC)/upd7810/upd7810.h \ diff --git a/src/emu/cpu/g65816/g65816op.h b/src/emu/cpu/g65816/g65816op.h index 03bc4c52203..2efcbac5208 100644 --- a/src/emu/cpu/g65816/g65816op.h +++ b/src/emu/cpu/g65816/g65816op.h @@ -1915,15 +1915,15 @@ TABLE_FUNCTION(void, set_reg, (int regnum, uint val)) #if EXECUTION_MODE == EXECUTION_MODE_E -#define g65816i_correct_mode() (FLAG_E == EFLAG_SET) +#define g65816i_correct_mode() (FLAG_E == EFLAG_SET) #elif EXECUTION_MODE == EXECUTION_MODE_M0X0 -#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_CLEAR) && (FLAG_X == XFLAG_CLEAR)) +#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_CLEAR) && (FLAG_X == XFLAG_CLEAR)) #elif EXECUTION_MODE == EXECUTION_MODE_M0X1 -#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_CLEAR) && (FLAG_X == XFLAG_SET)) +#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_CLEAR) && (FLAG_X == XFLAG_SET)) #elif EXECUTION_MODE == EXECUTION_MODE_M1X0 -#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_SET) && (FLAG_X == XFLAG_CLEAR)) +#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_SET) && (FLAG_X == XFLAG_CLEAR)) #elif EXECUTION_MODE == EXECUTION_MODE_M1X1 -#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_SET) && (FLAG_X == XFLAG_SET)) +#define g65816i_correct_mode() ((FLAG_E == EFLAG_CLEAR) && (FLAG_M == MFLAG_SET) && (FLAG_X == XFLAG_SET)) #else #error Invalid EXECUTION_MODE #endif diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h index b6979d0942d..06b34680507 100644 --- a/src/emu/cpu/m68000/m68000.h +++ b/src/emu/cpu/m68000/m68000.h @@ -252,14 +252,14 @@ public: const UINT8* cyc_exception; /* Callbacks to host */ - device_irq_acknowledge_delegate int_ack_callback; /* Interrupt Acknowledge */ - write32_delegate bkpt_ack_callback; /* Breakpoint Acknowledge */ - write_line_delegate reset_instr_callback; /* Called when a RESET instruction is encountered */ - write32_delegate cmpild_instr_callback; /* Called when a CMPI.L #v, Dn instruction is encountered */ - write_line_delegate rte_instr_callback; /* Called when a RTE instruction is encountered */ - write8_delegate tas_write_callback; /* Called instead of normal write8 by the TAS instruction, - allowing writeback to be disabled globally or selectively - or other side effects to be implemented */ + device_irq_acknowledge_delegate int_ack_callback; /* Interrupt Acknowledge */ + write32_delegate bkpt_ack_callback; /* Breakpoint Acknowledge */ + write_line_delegate reset_instr_callback; /* Called when a RESET instruction is encountered */ + write32_delegate cmpild_instr_callback; /* Called when a CMPI.L #v, Dn instruction is encountered */ + write_line_delegate rte_instr_callback; /* Called when a RTE instruction is encountered */ + write8_delegate tas_write_callback; /* Called instead of normal write8 by the TAS instruction, + allowing writeback to be disabled globally or selectively + or other side effects to be implemented */ address_space *program; diff --git a/src/emu/cpu/m68000/m68kmmu.h b/src/emu/cpu/m68000/m68kmmu.h index 90ae7ea713c..ea4cb3dc7ce 100644 --- a/src/emu/cpu/m68000/m68kmmu.h +++ b/src/emu/cpu/m68000/m68kmmu.h @@ -774,12 +774,12 @@ INLINE UINT32 get_dt3_table_entry(m68000_base_device *m68k, UINT32 tptr, UINT8 f if (!(ptest)) { - page_entry |= 0x8; // always set the U bit + page_entry |= 0x8; // always set the U bit // if we're writing, the M bit comes into play if (!m68k->mmu_tmp_rw) { - page_entry |= 0x10; // set Modified + page_entry |= 0x10; // set Modified } // if these updates resulted in a change, write the entry back where we found it @@ -795,7 +795,7 @@ INLINE UINT32 get_dt3_table_entry(m68000_base_device *m68k, UINT32 tptr, UINT8 f // SR: B G U1 U0 S CM CM M 0 W T R m68k->mmu_tmp_sr |= ((addr_out & ~0xfff) || (page_entry & 0x7f4)); } - break; + break; case 2: // shouldn't happen fatalerror("68040: got indirect final page pointer, shouldn't be possible\n"); diff --git a/src/emu/cpu/mb86233/mb86233.h b/src/emu/cpu/mb86233/mb86233.h index 68ca986f45c..2f28d29fd5a 100644 --- a/src/emu/cpu/mb86233/mb86233.h +++ b/src/emu/cpu/mb86233/mb86233.h @@ -103,7 +103,7 @@ private: UINT32 m_shift; UINT32 m_repcnt; UINT16 m_sr; - UINT8 m_fpucontrol; + UINT8 m_fpucontrol; UINT32 m_gpr[16]; UINT32 m_extport[0x30]; diff --git a/src/emu/cpu/minx/minxfunc.h b/src/emu/cpu/minx/minxfunc.h index 119af87dbf3..312071d3d7b 100644 --- a/src/emu/cpu/minx/minxfunc.h +++ b/src/emu/cpu/minx/minxfunc.h @@ -360,4 +360,3 @@ void minx_cpu_device::CALL( UINT16 arg ) #define AD2_Y8 UINT32 addr2 = ( m_YI << 16 ) | ( m_Y + rdop() ) #define AD2_XL UINT32 addr2 = ( m_XI << 16 ) | ( m_X + ( m_HL & 0x00FF ) ) #define AD2_YL UINT32 addr2 = ( m_YI << 16 ) | ( m_Y + ( m_HL & 0x00FF ) ) - diff --git a/src/emu/cpu/minx/minxops.h b/src/emu/cpu/minx/minxops.h index 5466b93bb2a..ca11a3258dc 100644 --- a/src/emu/cpu/minx/minxops.h +++ b/src/emu/cpu/minx/minxops.h @@ -559,4 +559,3 @@ const int minx_cpu_device::insnminx_cycles[256] = { 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 20, 8, 24, 12, 8, 1, 8, 12, 8, 8, 8, 20, 20, 1, 1, 8 }; - diff --git a/src/emu/cpu/mips/mips3.h b/src/emu/cpu/mips/mips3.h index 3f4826ef54c..2d2fce7ed03 100644 --- a/src/emu/cpu/mips/mips3.h +++ b/src/emu/cpu/mips/mips3.h @@ -359,7 +359,7 @@ private: /* core state */ internal_mips3_state *m_core; - /* internal stuff */ + /* internal stuff */ UINT32 m_ppc; UINT32 m_nextpc; UINT32 m_pcbase; @@ -444,7 +444,7 @@ private: /* fast RAM */ UINT32 m_fastram_select; - struct + struct { offs_t start; /* start of the RAM block */ offs_t end; /* end of the RAM block */ diff --git a/src/emu/cpu/powerpc/ppc.h b/src/emu/cpu/powerpc/ppc.h index dbdf6131903..009e2118e20 100644 --- a/src/emu/cpu/powerpc/ppc.h +++ b/src/emu/cpu/powerpc/ppc.h @@ -695,20 +695,20 @@ protected: //class ppc403_device : public ppc_device //{ //public: -// ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +// ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // //protected: -// virtual UINT32 execute_input_lines() const { return 8; } +// virtual UINT32 execute_input_lines() const { return 8; } //}; // // //class ppc405_device : public ppc_device //{ //public: -// ppc405_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +// ppc405_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // //protected: -// virtual UINT32 execute_input_lines() const { return 8; } +// virtual UINT32 execute_input_lines() const { return 8; } //}; diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h index e2812609e59..f0706d6dcf1 100644 --- a/src/emu/cpu/rsp/rsp.h +++ b/src/emu/cpu/rsp/rsp.h @@ -145,13 +145,13 @@ union ACCUMULATOR_REG #define MCFG_RSP_DP_REG_R_CB(_devcb) \ devcb = &rsp_cpu_device::static_set_dp_reg_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_RSP_DP_REG_W_CB(_devcb) \ devcb = &rsp_cpu_device::static_set_dp_reg_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_RSP_SP_REG_R_CB(_devcb) \ devcb = &rsp_cpu_device::static_set_sp_reg_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_RSP_SP_REG_W_CB(_devcb) \ devcb = &rsp_cpu_device::static_set_sp_reg_w_callback(*device, DEVCB_##_devcb); @@ -163,7 +163,7 @@ class rsp_cpu_device : public legacy_cpu_device protected: // construction/destruction rsp_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func info); - + public: void resolve_cb(); template static devcb_base &static_set_dp_reg_r_callback(device_t &device, _Object object) { return downcast(device).dp_reg_r_func.set_callback(object); } @@ -171,13 +171,13 @@ public: template static devcb_base &static_set_sp_reg_r_callback(device_t &device, _Object object) { return downcast(device).sp_reg_r_func.set_callback(object); } template static devcb_base &static_set_sp_reg_w_callback(device_t &device, _Object object) { return downcast(device).sp_reg_w_func.set_callback(object); } template static devcb_base &static_set_status_callback(device_t &device, _Object object) { return downcast(device).sp_set_status_func.set_callback(object); } - + devcb_read32 dp_reg_r_func; devcb_write32 dp_reg_w_func; devcb_read32 sp_reg_r_func; devcb_write32 sp_reg_w_func; - devcb_write32 sp_set_status_func; + devcb_write32 sp_set_status_func; }; diff --git a/src/emu/cpu/scudsp/scudsp.h b/src/emu/cpu/scudsp/scudsp.h index 9d460b58ee0..9406a7e1917 100644 --- a/src/emu/cpu/scudsp/scudsp.h +++ b/src/emu/cpu/scudsp/scudsp.h @@ -61,11 +61,11 @@ class scudsp_cpu_device : public cpu_device public: // construction/destruction scudsp_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock); - + template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_in_dma_callback(device_t &device, _Object object) { return downcast(device).m_in_dma_cb.set_callback(object); } template static devcb_base &set_out_dma_callback(device_t &device, _Object object) { return downcast(device).m_out_dma_cb.set_callback(object); } - + /* port 0 */ DECLARE_READ32_MEMBER( program_control_r ); DECLARE_WRITE32_MEMBER( program_control_w ); @@ -104,7 +104,7 @@ protected: devcb_write_line m_out_irq_cb; devcb_read16 m_in_dma_cb; devcb_write16 m_out_dma_cb; - + private: address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/emu/cpu/sh2/sh2.h b/src/emu/cpu/sh2/sh2.h index 21e53f19a4c..d8e7401053c 100644 --- a/src/emu/cpu/sh2/sh2.h +++ b/src/emu/cpu/sh2/sh2.h @@ -519,19 +519,19 @@ public: class sh2_frontend : public drc_frontend { public: - sh2_frontend(sh2_device *device, UINT32 window_start, UINT32 window_end, UINT32 max_sequence); + sh2_frontend(sh2_device *device, UINT32 window_start, UINT32 window_end, UINT32 max_sequence); protected: - virtual bool describe(opcode_desc &desc, const opcode_desc *prev); + virtual bool describe(opcode_desc &desc, const opcode_desc *prev); private: - bool describe_group_0(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); - bool describe_group_2(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); - bool describe_group_3(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); - bool describe_group_4(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); - bool describe_group_6(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); - bool describe_group_8(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); - bool describe_group_12(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_0(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_2(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_3(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_4(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_6(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_8(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); + bool describe_group_12(opcode_desc &desc, const opcode_desc *prev, UINT16 opcode); sh2_device *m_sh2; }; diff --git a/src/emu/cpu/sharc/sharcops.inc b/src/emu/cpu/sharc/sharcops.inc index e1140c9885b..95c86cfa140 100644 --- a/src/emu/cpu/sharc/sharcops.inc +++ b/src/emu/cpu/sharc/sharcops.inc @@ -823,7 +823,7 @@ void adsp21062_device::COMPUTE(UINT32 opcode) case 0x62: compute_max(rn, rx, ry); break; case 0x81: compute_fadd(rn, rx, ry); break; case 0x82: compute_fsub(rn, rx, ry); break; - case 0x89: compute_favg(rn, rx, ry); break; + case 0x89: compute_favg(rn, rx, ry); break; case 0x8a: compute_fcomp(rx, ry); break; case 0x91: compute_fabs_plus(rn, rx, ry); break; case 0xa1: compute_fpass(rn, rx); break; diff --git a/src/emu/cpu/tms7000/tms7000.h b/src/emu/cpu/tms7000/tms7000.h index 35f733d115a..1a66c79b9cf 100644 --- a/src/emu/cpu/tms7000/tms7000.h +++ b/src/emu/cpu/tms7000/tms7000.h @@ -65,7 +65,7 @@ public: DECLARE_WRITE8_MEMBER(tms7000_pf_w); DECLARE_READ8_MEMBER(tms7002_pf_r) { return tms7000_pf_r(space, offset + 0x10); } DECLARE_WRITE8_MEMBER(tms7002_pf_w) { tms7000_pf_w(space, offset + 0x10, data); } - + bool chip_is_cmos() { return (m_info_flags & TMS7000_CHIP_IS_CMOS) ? true : false; } UINT32 chip_get_family() { return m_info_flags & TMS7000_CHIP_FAMILY_MASK; } bool chip_is_family_70x0() { return chip_get_family() == TMS7000_CHIP_FAMILY_70X0; } @@ -128,17 +128,17 @@ protected: UINT8 m_port_latch[4]; UINT8 m_port_ddr[4]; - + void flag_ext_interrupt(int extline); void check_interrupts(); void do_interrupt(int irqline); - + TIMER_CALLBACK_MEMBER(simple_timer_cb); void timer_run(int tmr); void timer_reload(int tmr); void timer_tick_pre(int tmr); void timer_tick_low(int tmr); - + // internal read/write inline UINT8 read_r8(UINT8 address) { return m_program->read_byte(address); } inline void write_r8(UINT8 address, UINT8 data) { m_program->write_byte(address, data); } @@ -160,7 +160,7 @@ protected: inline void push8(UINT8 data) { m_program->write_byte(++m_sp, data); } inline UINT16 pull16() { UINT16 ret = m_program->read_byte(m_sp--); return ret | m_program->read_byte(m_sp--) << 8; } inline void push16(UINT16 data) { m_program->write_byte(++m_sp, data >> 8 & 0xff); m_program->write_byte(++m_sp, data & 0xff); } - + // opcode handlers void br_dir(); void br_inx(); @@ -202,7 +202,7 @@ protected: void stsp(); void trap(UINT8 address); void illegal(UINT8 op); - + typedef int (tms7000_device::*op_func)(UINT8, UINT8); int op_clr(UINT8 param1, UINT8 param2); int op_dec(UINT8 param1, UINT8 param2); @@ -214,7 +214,7 @@ protected: int op_rrc(UINT8 param1, UINT8 param2); int op_swap(UINT8 param1, UINT8 param2); int op_xchb(UINT8 param1, UINT8 param2); - + int op_adc(UINT8 param1, UINT8 param2); int op_add(UINT8 param1, UINT8 param2); int op_and(UINT8 param1, UINT8 param2); @@ -227,7 +227,7 @@ protected: int op_sbb(UINT8 param1, UINT8 param2); int op_sub(UINT8 param1, UINT8 param2); int op_xor(UINT8 param1, UINT8 param2); - + inline void shortbranch(bool check); inline void jmp(bool check); int op_djnz(UINT8 param1, UINT8 param2); diff --git a/src/emu/cpu/tms7000/tms70op.inc b/src/emu/cpu/tms7000/tms70op.inc index 8b81a7e8721..904e5d713cb 100644 --- a/src/emu/cpu/tms7000/tms70op.inc +++ b/src/emu/cpu/tms7000/tms70op.inc @@ -307,19 +307,19 @@ int tms7000_device::op_dac(UINT8 param1, UINT8 param2) UINT8 l1 = param1 >> 0 & 0xf; UINT8 h2 = param2 >> 4 & 0xf; UINT8 l2 = param2 >> 0 & 0xf; - + // compute bcd constant UINT8 d = ((l1 + l2 + c) < 10) ? 0 : 1; if ((h1 + h2) == 9) d |= 2; else if ((h1 + h2) > 9) d |= 4; - + UINT8 t = param1 + param2 + c + lut_bcd_out[d]; SET_CNZ(t); if (d > 2) m_sr |= SR_C; - + return t; } @@ -344,7 +344,7 @@ int tms7000_device::op_dsb(UINT8 param1, UINT8 param2) SET_CNZ(t); if (d <= 2) m_sr |= SR_C; - + return t; } diff --git a/src/emu/cpu/upd7725/upd7725.h b/src/emu/cpu/upd7725/upd7725.h index aeb9097e11b..4e4d9ed6c5d 100644 --- a/src/emu/cpu/upd7725/upd7725.h +++ b/src/emu/cpu/upd7725/upd7725.h @@ -63,7 +63,7 @@ class upd96050_device; #define MCFG_NECDSP_OUT_DRQ_CB(_devcb) \ devcb = &necdsp_device::set_out_drq_callback(*device, DEVCB_##_devcb); - + // ======================> necdsp_device @@ -86,7 +86,7 @@ public: //template static devcb_base &set_out_so_callback(device_t &device, _Object object) { return downcast(device).m_out_so_cb.set_callback(object); } //template static devcb_base &set_out_sorq_callback(device_t &device, _Object object) { return downcast(device).m_out_sorq_cb.set_callback(object); } //template static devcb_base &set_out_drq_callback(device_t &device, _Object object) { return downcast(device).m_out_drq_cb.set_callback(object); } - + UINT8 snesdsp_read(bool mode); void snesdsp_write(bool mode, UINT8 data); diff --git a/src/emu/cpu/z80/tmpz84c011.h b/src/emu/cpu/z80/tmpz84c011.h index 973d9efb2d7..553a24d8fda 100644 --- a/src/emu/cpu/z80/tmpz84c011.h +++ b/src/emu/cpu/z80/tmpz84c011.h @@ -97,7 +97,7 @@ public: DECLARE_WRITE_LINE_MEMBER( trg1 ) { m_ctc->trg1(state); } DECLARE_WRITE_LINE_MEMBER( trg2 ) { m_ctc->trg2(state); } DECLARE_WRITE_LINE_MEMBER( trg3 ) { m_ctc->trg3(state); } - + ///////////////////////////////////////////////////////// DECLARE_READ8_MEMBER( tmpz84c011_pa_r ); diff --git a/src/emu/cpu/z80/tmpz84c015.h b/src/emu/cpu/z80/tmpz84c015.h index 05c20a46c89..412f47556c9 100644 --- a/src/emu/cpu/z80/tmpz84c015.h +++ b/src/emu/cpu/z80/tmpz84c015.h @@ -122,10 +122,10 @@ public: template static devcb_base &set_out_syncb_callback(device_t &device, _Object object) { return downcast(device).m_out_syncb_cb.set_callback(object); } template static devcb_base &set_out_rxdrqa_callback(device_t &device, _Object object) { return downcast(device).m_out_rxdrqa_cb.set_callback(object); } - template static devcb_base &set_out_txdrqa_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqa_cb.set_callback(object); } + template static devcb_base &set_out_txdrqa_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqa_cb.set_callback(object); } template static devcb_base &set_out_rxdrqb_callback(device_t &device, _Object object) { return downcast(device).m_out_rxdrqb_cb.set_callback(object); } - template static devcb_base &set_out_txdrqb_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqb_cb.set_callback(object); } - + template static devcb_base &set_out_txdrqb_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqb_cb.set_callback(object); } + template static devcb_base &set_zc0_callback(device_t &device, _Object object) { return downcast(device).m_zc0_cb.set_callback(object); } template static devcb_base &set_zc1_callback(device_t &device, _Object object) { return downcast(device).m_zc1_cb.set_callback(object); } template static devcb_base &set_zc2_callback(device_t &device, _Object object) { return downcast(device).m_zc2_cb.set_callback(object); } @@ -171,7 +171,7 @@ public: DECLARE_READ8_MEMBER( pa_r ) { return m_pio->pa_r(space, offset, mem_mask); } DECLARE_WRITE8_MEMBER( pb_w ) { m_pio->pb_w(space, offset, data, mem_mask); } DECLARE_READ8_MEMBER( pb_r ) { return m_pio->pb_r(space, offset, mem_mask); } - + ///////////////////////////////////////////////////////// DECLARE_WRITE8_MEMBER( irq_priority_w ); @@ -204,7 +204,7 @@ public: DECLARE_READ8_MEMBER( in_pb_cb_trampoline_r ) { return m_in_pb_cb(); } DECLARE_WRITE8_MEMBER( out_pb_cb_trampoline_w ) { m_out_pb_cb(data); } DECLARE_WRITE_LINE_MEMBER( out_brdy_cb_trampoline_w ) { m_out_brdy_cb(state); } - + protected: // device-level overrides virtual machine_config_constructor device_mconfig_additions() const; @@ -231,20 +231,20 @@ private: // internal state UINT8 m_irq_priority; - + // callbacks devcb_write_line m_out_txda_cb; devcb_write_line m_out_dtra_cb; devcb_write_line m_out_rtsa_cb; devcb_write_line m_out_wrdya_cb; devcb_write_line m_out_synca_cb; - + devcb_write_line m_out_txdb_cb; devcb_write_line m_out_dtrb_cb; devcb_write_line m_out_rtsb_cb; devcb_write_line m_out_wrdyb_cb; devcb_write_line m_out_syncb_cb; - + devcb_write_line m_out_rxdrqa_cb; devcb_write_line m_out_txdrqa_cb; devcb_write_line m_out_rxdrqb_cb; @@ -257,7 +257,7 @@ private: devcb_read8 m_in_pa_cb; devcb_write8 m_out_pa_cb; devcb_write_line m_out_ardy_cb; - + devcb_read8 m_in_pb_cb; devcb_write8 m_out_pb_cb; devcb_write_line m_out_brdy_cb; diff --git a/src/emu/digfx.h b/src/emu/digfx.h index 86ff9ffd859..aff3a1a2cc1 100644 --- a/src/emu/digfx.h +++ b/src/emu/digfx.h @@ -107,8 +107,6 @@ const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { // use these to declare a gfx_decode_entry array as a member of a device class #define DECLARE_GFXDECODE_MEMBER( name ) static const gfx_decode_entry name[] #define GFXDECODE_MEMBER( name ) const gfx_decode_entry name[] = { - - // common gfx_decode_entry macros #define GFXDECODE_ENTRYX(region,offset,layout,start,colors,flags) { region, offset, &layout, start, colors, flags }, #define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0 }, diff --git a/src/emu/imagedev/cartslot.h b/src/emu/imagedev/cartslot.h index f30e590f45b..d4b5b0322d1 100644 --- a/src/emu/imagedev/cartslot.h +++ b/src/emu/imagedev/cartslot.h @@ -42,7 +42,7 @@ public: static void static_set_extensions(device_t &device, const char *_extensions) { downcast(device).m_extensions = _extensions; } static void static_set_interface(device_t &device, const char *_interface) { downcast(device).m_interface = _interface; } static void static_set_must_be_loaded(device_t &device, bool _must_be_loaded) { downcast(device).m_must_be_loaded = _must_be_loaded; } - + // image-level overrides virtual bool call_load(); virtual void call_unload(); @@ -102,10 +102,10 @@ extern const device_type CARTSLOT; cartslot_image_device::static_set_must_be_loaded(*device, TRUE); #define MCFG_CARTSLOT_LOAD(_class,_method) \ - cartslot_image_device::static_set_device_load(*device, device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), #_class "::device_image_load_" #_method, downcast<_class *>(owner))); + cartslot_image_device::static_set_device_load(*device, device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), #_class "::device_image_load_" #_method, downcast<_class *>(owner))); #define MCFG_CARTSLOT_UNLOAD(_class,_method) \ - cartslot_image_device::static_set_device_unload(*device, device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), #_class "::device_image_unload_" #_method, downcast<_class *>(owner))); + cartslot_image_device::static_set_device_unload(*device, device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), #_class "::device_image_unload_" #_method, downcast<_class *>(owner))); #define MCFG_CARTSLOT_PARTIALHASH(_partialhash) \ cartslot_image_device::static_set_partialhash(*device, _partialhash); diff --git a/src/emu/imagedev/cassette.h b/src/emu/imagedev/cassette.h index 66de5f12c5a..ac6842aadf8 100644 --- a/src/emu/imagedev/cassette.h +++ b/src/emu/imagedev/cassette.h @@ -107,7 +107,7 @@ private: const struct CassetteFormat* const *m_formats; const struct CassetteOptions *m_create_opts; cassette_state m_default_state; - const char * m_interface; + const char * m_interface; }; // device type definition @@ -124,17 +124,17 @@ typedef device_type_iterator<&device_creator, cassette_im #define MCFG_CASSETTE_MODIFY(_tag) \ MCFG_DEVICE_MODIFY(_tag) - -#define MCFG_CASSETTE_FORMATS(_formats) \ + +#define MCFG_CASSETTE_FORMATS(_formats) \ cassette_image_device::static_set_formats(*device, _formats); -#define MCFG_CASSETTE_CREATE_OPTS(_create_opts) \ +#define MCFG_CASSETTE_CREATE_OPTS(_create_opts) \ cassette_image_device::static_set_create_opts(*device, _create_opts); -#define MCFG_CASSETTE_DEFAULT_STATE(_state) \ +#define MCFG_CASSETTE_DEFAULT_STATE(_state) \ cassette_image_device::static_set_default_state(*device, (cassette_state) (_state)); -#define MCFG_CASSETTE_INTERFACE(_interface) \ +#define MCFG_CASSETTE_INTERFACE(_interface) \ cassette_image_device::static_set_interface(*device, _interface); #endif /* CASSETTE_H */ diff --git a/src/emu/imagedev/diablo.h b/src/emu/imagedev/diablo.h index 44601b4f9ec..58e7ce16697 100644 --- a/src/emu/imagedev/diablo.h +++ b/src/emu/imagedev/diablo.h @@ -84,10 +84,10 @@ extern const device_type DIABLO; MCFG_DEVICE_CONFIG(_config) #define MCFG_DIABLO_LOAD(_class,_method) \ - diablo_image_device::static_set_device_load(*device, device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), #_class "::device_image_load_" #_method, downcast<_class *>(owner))); + diablo_image_device::static_set_device_load(*device, device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), #_class "::device_image_load_" #_method, downcast<_class *>(owner))); #define MCFG_DIABLO_UNLOAD(_class,_method) \ - diablo_image_device::static_set_device_unload(*device, device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), #_class "::device_image_unload_" #_method, downcast<_class *>(owner))); + diablo_image_device::static_set_device_unload(*device, device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), #_class "::device_image_unload_" #_method, downcast<_class *>(owner))); #define MCFG_DIABLO_INTERFACE(_interface) \ diablo_image_device::static_set_interface(*device, _interface); diff --git a/src/emu/imagedev/flopdrv.h b/src/emu/imagedev/flopdrv.h index 462e7d8bf29..dc80796f550 100644 --- a/src/emu/imagedev/flopdrv.h +++ b/src/emu/imagedev/flopdrv.h @@ -95,7 +95,7 @@ public: ~legacy_floppy_image_device(); template static devcb_base &set_out_idx_func(device_t &device, _Object object) { return downcast(device).m_out_idx_func.set_callback(object); } - + virtual bool call_load(); virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } virtual bool call_create(int format_type, option_resolution *format_options); diff --git a/src/emu/imagedev/harddriv.h b/src/emu/imagedev/harddriv.h index f808dc7e3ea..6ec48d327fb 100644 --- a/src/emu/imagedev/harddriv.h +++ b/src/emu/imagedev/harddriv.h @@ -79,10 +79,10 @@ extern const device_type HARDDISK; MCFG_DEVICE_ADD(_tag, HARDDISK, 0) #define MCFG_HARDDISK_LOAD(_class,_method) \ - harddisk_image_device::static_set_device_load(*device, device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), #_class "::device_image_load_" #_method, downcast<_class *>(owner))); + harddisk_image_device::static_set_device_load(*device, device_image_load_delegate(&DEVICE_IMAGE_LOAD_NAME(_class,_method), #_class "::device_image_load_" #_method, downcast<_class *>(owner))); #define MCFG_HARDDISK_UNLOAD(_class,_method) \ - harddisk_image_device::static_set_device_unload(*device, device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), #_class "::device_image_unload_" #_method, downcast<_class *>(owner))); + harddisk_image_device::static_set_device_unload(*device, device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_method), #_class "::device_image_unload_" #_method, downcast<_class *>(owner))); #define MCFG_HARDDISK_INTERFACE(_interface) \ harddisk_image_device::static_set_interface(*device, _interface); diff --git a/src/emu/imagedev/midiin.h b/src/emu/imagedev/midiin.h index 93dadab5a39..5d3a864e60a 100644 --- a/src/emu/imagedev/midiin.h +++ b/src/emu/imagedev/midiin.h @@ -27,7 +27,7 @@ public: midiin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); template static devcb_base &set_input_callback(device_t &device, _Object object) { return downcast(device).m_input_cb.set_callback(object); } - + // image-level overrides virtual bool call_load(); virtual void call_unload(); diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index fadeed55bb8..ad4712d262f 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -44,12 +44,12 @@ private: int cb; hook(); - void set(lua_State *L, int idx); + void set(lua_State *L, int idx); lua_State *precall(); void call(lua_engine *engine, lua_State *T, int nparam); bool active() const { return L != NULL; } }; - + static const char *const tname_ioport; // internal state @@ -58,7 +58,7 @@ private: hook hook_output_cb; bool output_notifier_set; - + static lua_engine* luaThis; std::map > thread_registry; @@ -93,7 +93,7 @@ private: static void *checkparam(lua_State *L, int idx, const char *tname); static void *getparam(lua_State *L, int idx, const char *tname); static void push(lua_State *L, void *p, const char *tname); - + int report(int status); int docall(int narg, int nres); int incomplete(int status) ; diff --git a/src/emu/machine/53c810.h b/src/emu/machine/53c810.h index a5f3d86acae..c8ee4f80dce 100644 --- a/src/emu/machine/53c810.h +++ b/src/emu/machine/53c810.h @@ -22,7 +22,7 @@ public: static void set_irq_callback(device_t &device, lsi53c810_irq_delegate callback) { downcast(device).m_irq_cb = callback; } static void set_dma_callback(device_t &device, lsi53c810_dma_delegate callback) { downcast(device).m_dma_cb = callback; } static void set_fetch_callback(device_t &device, lsi53c810_fetch_delegate callback) { downcast(device).m_fetch_cb = callback; } - + void lsi53c810_read_data(int bytes, UINT8 *pData); void lsi53c810_write_data(int bytes, UINT8 *pData); diff --git a/src/emu/machine/6525tpi.h b/src/emu/machine/6525tpi.h index 87deba13e7d..40dadbd4ee9 100644 --- a/src/emu/machine/6525tpi.h +++ b/src/emu/machine/6525tpi.h @@ -49,7 +49,7 @@ public: template static devcb_base &set_out_pc_callback(device_t &device, _Object object) { return downcast(device).m_out_pc_cb.set_callback(object); } template static devcb_base &set_out_ca_callback(device_t &device, _Object object) { return downcast(device).m_out_ca_cb.set_callback(object); } template static devcb_base &set_out_cb_callback(device_t &device, _Object object) { return downcast(device).m_out_cb_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); diff --git a/src/emu/machine/6532riot.h b/src/emu/machine/6532riot.h index a2b2ce715f3..49dc2bfc000 100644 --- a/src/emu/machine/6532riot.h +++ b/src/emu/machine/6532riot.h @@ -50,7 +50,7 @@ public: template static devcb_base &set_in_pb_callback(device_t &device, _Object object) { return downcast(device).m_in_pb_cb.set_callback(object); } template static devcb_base &set_out_pb_callback(device_t &device, _Object object) { return downcast(device).m_out_pb_cb.set_callback(object); } template static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -75,8 +75,8 @@ protected: UINT8 m_in; UINT8 m_out; UINT8 m_ddr; - devcb_read8 *m_in_cb; - devcb_write8 *m_out_cb; + devcb_read8 *m_in_cb; + devcb_write8 *m_out_cb; }; // device-level overrides @@ -100,7 +100,7 @@ private: devcb_read8 m_in_pb_cb; devcb_write8 m_out_pb_cb; devcb_write_line m_irq_cb; - + UINT8 m_irqstate; UINT8 m_irqenable; int m_irq; diff --git a/src/emu/machine/68307.h b/src/emu/machine/68307.h index 82f5ea25169..35cf8fc4362 100644 --- a/src/emu/machine/68307.h +++ b/src/emu/machine/68307.h @@ -45,7 +45,7 @@ public: template static devcb_base &set_b_tx_cb(device_t &device, _Object object) { return downcast(device).write_b_tx.set_callback(object); } template static devcb_base &set_inport_cb(device_t &device, _Object object) { return downcast(device).read_inport.set_callback(object); } template static devcb_base &set_outport_cb(device_t &device, _Object object) { return downcast(device).write_outport.set_callback(object); } - + DECLARE_WRITE_LINE_MEMBER(m68307_duart_irq_handler); DECLARE_WRITE_LINE_MEMBER(m68307_duart_txa){ write_a_tx(state); } DECLARE_WRITE_LINE_MEMBER(m68307_duart_txb){ write_b_tx(state); } @@ -69,7 +69,7 @@ public: /* 68307 peripheral modules */ m68307_sim* m68307SIM; m68307_mbus* m68307MBUS; -// m68307_serial* m68307SERIAL; +// m68307_serial* m68307SERIAL; m68307_timer* m68307TIMER; UINT16 m68307_base; @@ -94,7 +94,7 @@ public: /* callbacks for internal ports */ void set_port_callbacks(m68307_porta_read_delegate porta_r, m68307_porta_write_delegate porta_w, m68307_portb_read_delegate portb_r, m68307_portb_write_delegate portb_w); void set_interrupt(int level, int vector); - UINT16 get_cs(offs_t address); + UINT16 get_cs(offs_t address); void timer0_interrupt(); void timer1_interrupt(); void serial_interrupt(int vector); diff --git a/src/emu/machine/6840ptm.h b/src/emu/machine/6840ptm.h index c5075a24144..d5e8851fae4 100644 --- a/src/emu/machine/6840ptm.h +++ b/src/emu/machine/6840ptm.h @@ -49,13 +49,13 @@ public: // construction/destruction ptm6840_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - static void set_internal_clock(device_t &device, double clock) { downcast(device).m_internal_clock = clock; } + static void set_internal_clock(device_t &device, double clock) { downcast(device).m_internal_clock = clock; } static void set_external_clocks(device_t &device, double clock0, double clock1, double clock2) { downcast(device).m_external_clock[0] = clock0; downcast(device).m_external_clock[1] = clock1; downcast(device).m_external_clock[2] = clock2; } template static devcb_base &set_out0_callback(device_t &device, _Object object) { return downcast(device).m_out0_cb.set_callback(object); } template static devcb_base &set_out1_callback(device_t &device, _Object object) { return downcast(device).m_out1_cb.set_callback(object); } template static devcb_base &set_out2_callback(device_t &device, _Object object) { return downcast(device).m_out2_cb.set_callback(object); } template static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } - + int status(int clock) const { return m_enabled[clock]; } // get whether timer is enabled int irq_state() const { return m_IRQ; } // get IRQ state UINT16 count(int counter) const { return compute_counter(counter); } // get counter value diff --git a/src/emu/machine/74123.h b/src/emu/machine/74123.h index c051c3ce4e5..8b9391988a2 100644 --- a/src/emu/machine/74123.h +++ b/src/emu/machine/74123.h @@ -61,13 +61,13 @@ #define MCFG_TTL74123_RESISTOR_VALUE(_value) \ ttl74123_device::set_resistor_value(*device, _value); - + #define MCFG_TTL74123_CAPACITOR_VALUE(_value) \ ttl74123_device::set_capacitor_value(*device, _value); #define MCFG_TTL74123_A_PIN_VALUE(_value) \ ttl74123_device::set_a_pin_value(*device, _value); - + #define MCFG_TTL74123_B_PIN_VALUE(_value) \ ttl74123_device::set_b_pin_value(*device, _value); @@ -75,7 +75,7 @@ ttl74123_device::set_clear_pin_value(*device, _value); #define MCFG_TTL74123_OUTPUT_CHANGED_CB(_devcb) \ - devcb = &ttl74123_device::set_output_changed_callback(*device, DEVCB_##_devcb); + devcb = &ttl74123_device::set_output_changed_callback(*device, DEVCB_##_devcb); /* constants for the different ways the cap/res can be connected. This determines the formula for calculating the pulse width */ @@ -103,7 +103,7 @@ public: static void set_b_pin_value(device_t &device, int value) { downcast(device).m_b = value; } static void set_clear_pin_value(device_t &device, int value) { downcast(device).m_clear = value; } template static devcb_base &set_output_changed_callback(device_t &device, _Object object) { return downcast(device).m_output_changed_cb.set_callback(object); } - + DECLARE_WRITE8_MEMBER(a_w); DECLARE_WRITE8_MEMBER(b_w); DECLARE_WRITE8_MEMBER(clear_w); diff --git a/src/emu/machine/8042kbdc.h b/src/emu/machine/8042kbdc.h index ec0180833d1..a2311e1924d 100644 --- a/src/emu/machine/8042kbdc.h +++ b/src/emu/machine/8042kbdc.h @@ -40,7 +40,7 @@ enum kbdc8042_type_t devcb = &kbdc8042_device::set_output_buffer_empty_callback(*device, DEVCB_##_devcb); #define MCFG_KBDC8042_SPEAKER_CB(_devcb) \ - devcb = &kbdc8042_device::set_speaker_callback(*device, DEVCB_##_devcb); + devcb = &kbdc8042_device::set_speaker_callback(*device, DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS @@ -55,7 +55,7 @@ public: kbdc8042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual machine_config_constructor device_mconfig_additions() const; - + static void set_keyboard_type(device_t &device, kbdc8042_type_t keybtype) { downcast(device).m_keybtype = keybtype; } template static devcb_base &set_system_reset_callback(device_t &device, _Object object) { return downcast(device).m_system_reset_cb.set_callback(object); } template static devcb_base &set_gate_a20_callback(device_t &device, _Object object) { return downcast(device).m_gate_a20_cb.set_callback(object); } @@ -109,7 +109,7 @@ protected: required_device m_keyboard_dev; kbdc8042_type_t m_keybtype; - + devcb_write_line m_system_reset_cb; devcb_write_line m_gate_a20_cb; devcb_write_line m_input_buffer_full_cb; diff --git a/src/emu/machine/aakart.h b/src/emu/machine/aakart.h index 35d27f5bf41..97b2c1b4727 100644 --- a/src/emu/machine/aakart.h +++ b/src/emu/machine/aakart.h @@ -20,7 +20,7 @@ Acorn Archimedes KART interface #define MCFG_AAKART_OUT_RX_CB(_devcb) \ devcb = &aakart_device::set_out_rx_callback(*device, DEVCB_##_devcb); - + enum{ STATUS_NORMAL = 0, @@ -42,15 +42,15 @@ class aakart_device : public device_t public: // construction/destruction aakart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_out_tx_callback(device_t &device, _Object object) { return downcast(device).m_out_tx_cb.set_callback(object); } template static devcb_base &set_out_rx_callback(device_t &device, _Object object) { return downcast(device).m_out_rx_cb.set_callback(object); } // I/O operations DECLARE_WRITE8_MEMBER( write ); DECLARE_READ8_MEMBER( read ); - void send_keycode_down(UINT8 row, UINT8 col); - void send_keycode_up(UINT8 row, UINT8 col); + void send_keycode_down(UINT8 row, UINT8 col); + void send_keycode_up(UINT8 row, UINT8 col); protected: // device-level overrides virtual void device_validity_check(validity_checker &valid) const; @@ -77,9 +77,9 @@ private: UINT8 m_status; UINT8 m_mouse_enable; UINT8 m_keyb_enable; - UINT8 m_keyb_row; - UINT8 m_keyb_col; - UINT8 m_keyb_state; + UINT8 m_keyb_row; + UINT8 m_keyb_col; + UINT8 m_keyb_state; }; diff --git a/src/emu/machine/adc0808.h b/src/emu/machine/adc0808.h index 1ba210ffdc0..cd0247b8c44 100644 --- a/src/emu/machine/adc0808.h +++ b/src/emu/machine/adc0808.h @@ -49,34 +49,34 @@ typedef device_delegate adc0808_analog_read_delegate; #define MCFG_ADC0808_IN_VREF_POS_CB(_class, _method) \ adc0808_device::set_in_vref_pos_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_VREF_NEG_CB(_class, _method) \ adc0808_device::set_in_vref_neg_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_0_CB(_class, _method) \ adc0808_device::set_in_in_0_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_1_CB(_class, _method) \ adc0808_device::set_in_in_1_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_2_CB(_class, _method) \ adc0808_device::set_in_in_2_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_3_CB(_class, _method) \ adc0808_device::set_in_in_3_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_4_CB(_class, _method) \ adc0808_device::set_in_in_4_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_5_CB(_class, _method) \ adc0808_device::set_in_in_5_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); #define MCFG_ADC0808_IN_IN_6_CB(_class, _method) \ adc0808_device::set_in_in_6_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + #define MCFG_ADC0808_IN_IN_7_CB(_class, _method) \ adc0808_device::set_in_in_7_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - + // ======================> adc0808_device class adc0808_device : public device_t @@ -84,7 +84,7 @@ class adc0808_device : public device_t public: // construction/destruction adc0808_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_out_eoc_callback(device_t &device, _Object object) { return downcast(device).m_out_eoc_cb.set_callback(object); } static void set_in_vref_pos_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast(device).m_in_vref_pos_cb = callback; } static void set_in_vref_neg_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast(device).m_in_vref_neg_cb = callback; } diff --git a/src/emu/machine/adc1038.h b/src/emu/machine/adc1038.h index 45a134e04ab..8e22fd6face 100644 --- a/src/emu/machine/adc1038.h +++ b/src/emu/machine/adc1038.h @@ -49,7 +49,7 @@ private: int m_data_out; int m_adc_data; int m_sars; - + int m_gticlub_hack; adc1038_input_delegate m_input_cb; }; diff --git a/src/emu/machine/akiko.h b/src/emu/machine/akiko.h index e3657d9d815..1fa5e46f6ef 100644 --- a/src/emu/machine/akiko.h +++ b/src/emu/machine/akiko.h @@ -1,12 +1,12 @@ /*************************************************************************** - Akiko + Akiko - Used in the Amiga CD32 + Used in the Amiga CD32 - - CD-ROM controller - - Builtin 1KB NVRAM - - Chunky to planar converter + - CD-ROM controller + - Builtin 1KB NVRAM + - Chunky to planar converter ***************************************************************************/ @@ -74,7 +74,7 @@ protected: virtual machine_config_constructor device_mconfig_additions() const; private: - // 1X CDROM sector time in msec (300KBps) + // 1X CDROM sector time in msec (300KBps) static const int CD_SECTOR_TIME = (1000/((150*1024)/2048)); // internal state diff --git a/src/emu/machine/am9517a.h b/src/emu/machine/am9517a.h index c4aa7383039..ab2cdd3d60c 100644 --- a/src/emu/machine/am9517a.h +++ b/src/emu/machine/am9517a.h @@ -73,7 +73,7 @@ public: template static devcb_base &set_out_dack_1_callback(device_t &device, _Object object) { return downcast(device).m_out_dack_1_cb.set_callback(object); } template static devcb_base &set_out_dack_2_callback(device_t &device, _Object object) { return downcast(device).m_out_dack_2_cb.set_callback(object); } template static devcb_base &set_out_dack_3_callback(device_t &device, _Object object) { return downcast(device).m_out_dack_3_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); diff --git a/src/emu/machine/at_keybc.h b/src/emu/machine/at_keybc.h index 5ce533cc9f7..65ef24e2d1b 100644 --- a/src/emu/machine/at_keybc.h +++ b/src/emu/machine/at_keybc.h @@ -53,7 +53,7 @@ public: template static devcb_base &set_output_buffer_empty_callback(device_t &device, _Object object) { return downcast(device).m_output_buffer_empty_cb.set_callback(object); } template static devcb_base &set_keyboard_clock_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_clock_cb.set_callback(object); } template static devcb_base &set_keyboard_data_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_data_cb.set_callback(object); } - + // internal 8042 interface DECLARE_READ8_MEMBER( t0_r ); DECLARE_READ8_MEMBER( t1_r ); @@ -78,7 +78,7 @@ protected: virtual const rom_entry *device_rom_region() const; virtual machine_config_constructor device_mconfig_additions() const; - + private: // internal state upi41_cpu_device *m_cpu; diff --git a/src/emu/machine/autoconfig.h b/src/emu/machine/autoconfig.h index 5183f474af9..f86e7577c7a 100644 --- a/src/emu/machine/autoconfig.h +++ b/src/emu/machine/autoconfig.h @@ -1,6 +1,6 @@ /*************************************************************************** - Amiga Autoconfig + Amiga Autoconfig ***************************************************************************/ diff --git a/src/emu/machine/ay31015.h b/src/emu/machine/ay31015.h index 3745cc7deac..2f46e925fda 100644 --- a/src/emu/machine/ay31015.h +++ b/src/emu/machine/ay31015.h @@ -68,7 +68,7 @@ public: template static devcb_base &set_read_si_callback(device_t &device, _Object object) { return downcast(device).m_read_si_cb.set_callback(object); } template static devcb_base &set_write_so_callback(device_t &device, _Object object) { return downcast(device).m_write_so_cb.set_callback(object); } template static devcb_base &set_status_changed_callback(device_t &device, _Object object) { return downcast(device).m_status_changed_cb.set_callback(object); } - + /* Set an input pin */ void set_input_pin( ay31015_input_pin_t pin, int data ); @@ -164,7 +164,7 @@ extern const device_type AY51013; // For AY-3-1014, AY-5-1013 and AY-6-1013 va #define MCFG_AY31015_TX_CLOCK(_txclk) \ ay31015_device::set_tx_clock(*device, _txclk); - + #define MCFG_AY31015_RX_CLOCK(_rxclk) \ ay31015_device::set_rx_clock(*device, _rxclk); @@ -175,12 +175,12 @@ extern const device_type AY51013; // For AY-3-1014, AY-5-1013 and AY-6-1013 va devcb = &ay31015_device::set_write_so_callback(*device, DEVCB_##_devcb); #define MCFG_AY31015_STATUS_CHANGED_CB(_devcb) \ - devcb = &ay31015_device::set_status_changed_callback(*device, DEVCB_##_devcb); - + devcb = &ay31015_device::set_status_changed_callback(*device, DEVCB_##_devcb); + #define MCFG_AY51013_TX_CLOCK(_txclk) \ ay51013_device::set_tx_clock(*device, _txclk); - + #define MCFG_AY51013_RX_CLOCK(_rxclk) \ ay51013_device::set_rx_clock(*device, _rxclk); @@ -191,6 +191,6 @@ extern const device_type AY51013; // For AY-3-1014, AY-5-1013 and AY-6-1013 va devcb = &ay51013_device::set_write_so_callback(*device, DEVCB_##_devcb); #define MCFG_AY51013_STATUS_CHANGED_CB(_devcb) \ - devcb = &ay51013_device::set_status_changed_callback(*device, DEVCB_##_devcb); + devcb = &ay51013_device::set_status_changed_callback(*device, DEVCB_##_devcb); #endif diff --git a/src/emu/machine/corvushd.h b/src/emu/machine/corvushd.h index 7b51be5fa68..56bf0cf45b8 100644 --- a/src/emu/machine/corvushd.h +++ b/src/emu/machine/corvushd.h @@ -405,9 +405,9 @@ private: // Put drive into prep mode command (0x11) // struct { - UINT8 code; // Command code - UINT8 drive; // Drive number (starts at 1) - UINT8 prep_block[512]; // Machine code payload + UINT8 code; // Command code + UINT8 drive; // Drive number (starts at 1) + UINT8 prep_block[512]; // Machine code payload } prep_mode_command; // // Read Firmware command (Prep Mode 0x32) @@ -439,15 +439,15 @@ private: // // Verify Drive command (Prep Mode 0x07) // - // On the real Corvus controller, this is a variable length response. If the - // number of bad sectors is greater than zero, an additional four bytes will - // follow for each bad sector. We don't emulate bad sectors, so we always + // On the real Corvus controller, this is a variable length response. If the + // number of bad sectors is greater than zero, an additional four bytes will + // follow for each bad sector. We don't emulate bad sectors, so we always // return a count of 0. That makes this a fixed length response of 2 bytes. // struct { UINT8 status; // Disk access status UINT8 bad_sectors; // Number of bad sectors (always zero) - } verify_drive_response; + } verify_drive_response; } m_buffer; // Structure of Block #1, the Disk Parameter Block diff --git a/src/emu/machine/cr511b.h b/src/emu/machine/cr511b.h index 98380826de7..08ee9056901 100644 --- a/src/emu/machine/cr511b.h +++ b/src/emu/machine/cr511b.h @@ -1,33 +1,33 @@ /*************************************************************************** - CR-511-B CD-ROM drive + CR-511-B CD-ROM drive license: MAME, GPL-2.0+ copyright-holders: Dirk Best - CD-ROM drive with a custom MKE/Panasonic interface as used in the - Commodore CDTV and early SoundBlaster cards. + CD-ROM drive with a custom MKE/Panasonic interface as used in the + Commodore CDTV and early SoundBlaster cards. - 1 _RESET 2 GND - 3 EFFK 4 SCCK - 5 SBCP 6 SCOR - 7 GND 8 GND - 9 C16M 10 GND - 11 _XAEN 12 GND - 13 EMPASIS 14 D0 - 15 LRCK 16 DSCK - 17 _MUTE 18 GND - 19 _BUSY 20 _STCH - 21 _ENABLE 22 DRQ - 23 _HWR 24 GND - 25 _DTEN 26 _HRD - 27 _STEN 28 _CMD - 29 _EOP 30 GND - 31 DB7 32 GND - 33 DB6 34 DB5 - 35 DB4 36 GND - 37 DB3 38 DB2 - 39 DB1 40 DB0 + 1 _RESET 2 GND + 3 EFFK 4 SCCK + 5 SBCP 6 SCOR + 7 GND 8 GND + 9 C16M 10 GND + 11 _XAEN 12 GND + 13 EMPASIS 14 D0 + 15 LRCK 16 DSCK + 17 _MUTE 18 GND + 19 _BUSY 20 _STCH + 21 _ENABLE 22 DRQ + 23 _HWR 24 GND + 25 _DTEN 26 _HRD + 27 _STEN 28 _CMD + 29 _EOP 30 GND + 31 DB7 32 GND + 33 DB6 34 DB5 + 35 DB4 36 GND + 37 DB3 38 DB2 + 39 DB1 40 DB0 ***************************************************************************/ @@ -46,8 +46,7 @@ //************************************************************************** #define MCFG_CR511B_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, CR511B, 0) \ - + MCFG_DEVICE_ADD(_tag, CR511B, 0) #define MCFG_CR511B_STCH_HANDLER(_devcb) \ devcb = &cr511b_device::set_stch_handler(*device, DEVCB_##_devcb); diff --git a/src/emu/machine/dmac.h b/src/emu/machine/dmac.h index aff36e3f0c3..e87930ad7df 100644 --- a/src/emu/machine/dmac.h +++ b/src/emu/machine/dmac.h @@ -23,8 +23,7 @@ //************************************************************************** #define MCFG_DMAC_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, DMAC, _clock) \ - + MCFG_DEVICE_ADD(_tag, DMAC, _clock) #define MCFG_DMAC_CFGOUT_HANDLER(_devcb) \ devcb = &dmac_device::set_cfgout_handler(*device, DEVCB_##_devcb); @@ -109,25 +108,25 @@ private: // control register flags enum { - CNTR_TCEN = 0x80, // terminal count enable - CNTR_PREST = 0x40, // peripheral reset - CNTR_PDMD = 0x20, // peripheral device mode select (1=scsi, 0=xt) - CNTR_INTEN = 0x10, // interrupt enable - CNTR_DDIR = 0x08 // device direction (1=rd host, wr to peripheral) + CNTR_TCEN = 0x80, // terminal count enable + CNTR_PREST = 0x40, // peripheral reset + CNTR_PDMD = 0x20, // peripheral device mode select (1=scsi, 0=xt) + CNTR_INTEN = 0x10, // interrupt enable + CNTR_DDIR = 0x08 // device direction (1=rd host, wr to peripheral) }; // interrupt status register enum { - ISTR_INTX = 0x100, // xt interrupt pending - ISTR_INT_F = 0x080, // interrupt follow - ISTR_INTS = 0x040, // scsi peripheral interrupt - ISTR_E_INT = 0x020, // end-of-process interrupt - ISTR_INT_P = 0x010, // interrupt pending - ISTR_UE_INT = 0x008, // under-run fifo error interrupt - ISTR_OE_INT = 0x004, // over-run fifo error interrupt - ISTR_FF_FLG = 0x002, // fifo-full flag - ISTR_FE_FLG = 0x001 // fifo-empty flag + ISTR_INTX = 0x100, // xt interrupt pending + ISTR_INT_F = 0x080, // interrupt follow + ISTR_INTS = 0x040, // scsi peripheral interrupt + ISTR_E_INT = 0x020, // end-of-process interrupt + ISTR_INT_P = 0x010, // interrupt pending + ISTR_UE_INT = 0x008, // under-run fifo error interrupt + ISTR_OE_INT = 0x004, // over-run fifo error interrupt + ISTR_FF_FLG = 0x002, // fifo-full flag + ISTR_FE_FLG = 0x001 // fifo-empty flag }; static const int ISTR_INT_MASK = 0x1fc; @@ -153,10 +152,10 @@ private: int m_rst; // register - UINT16 m_cntr; // control register - UINT16 m_istr; // interrupt status register - UINT32 m_wtc; // word transfer count - UINT32 m_acr; // address control register + UINT16 m_cntr; // control register + UINT16 m_istr; // interrupt status register + UINT32 m_wtc; // word transfer count + UINT32 m_acr; // address control register bool m_dma_active; diff --git a/src/emu/machine/dp8390.h b/src/emu/machine/dp8390.h index 8a3fe0d7441..c4699ff7aab 100644 --- a/src/emu/machine/dp8390.h +++ b/src/emu/machine/dp8390.h @@ -17,7 +17,7 @@ #define MCFG_DP8390D_MEM_WRITE_CB(_devcb) \ devcb = &dp8390d_device::set_mem_write_callback(*device, DEVCB_##_devcb); - + #define MCFG_RTL8019A_IRQ_CB(_devcb) \ devcb = &rtl8019a_device::set_irq_callback(*device, DEVCB_##_devcb); @@ -37,7 +37,7 @@ class dp8390_device : public device_t, public: // construction/destruction dp8390_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, float bandwidth, const char *shortname, const char *source); - + template static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } template static devcb_base &set_breq_callback(device_t &device, _Object object) { return downcast(device).m_breq_cb.set_callback(object); } template static devcb_base &set_mem_read_callback(device_t &device, _Object object) { return downcast(device).m_mem_read_cb.set_callback(object); } diff --git a/src/emu/machine/eepromser.h b/src/emu/machine/eepromser.h index e3683ee34ef..ace9f253f1b 100644 --- a/src/emu/machine/eepromser.h +++ b/src/emu/machine/eepromser.h @@ -59,7 +59,7 @@ // X24c44 16 bit ram/eeprom combo #define MCFG_EEPROM_SERIAL_X24C44_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, EEPROM_SERIAL_X24C44_16BIT, 0) - + // optional enable for streaming reads #define MCFG_EEPROM_SERIAL_ENABLE_STREAMING() \ eeprom_serial_base_device::static_enable_streaming(*device); @@ -144,7 +144,7 @@ protected: virtual void handle_event(eeprom_event event); virtual void parse_command_and_address() = 0; virtual void execute_command(); - + // configuration state UINT8 m_command_address_bits; // number of address bits in a command @@ -219,7 +219,7 @@ protected: class eeprom_serial_x24c44_device : public eeprom_serial_base_device { //async recall not implemented - //async store not implemented + //async store not implemented protected: // construction/destruction eeprom_serial_x24c44_device(const machine_config &mconfig, device_type devtype, const char *name, const char *tag, device_t *owner, const char *shortname, const char *file); @@ -227,7 +227,7 @@ protected: public: // read handlers DECLARE_READ_LINE_MEMBER(do_read); // DO - + // write handlers DECLARE_WRITE_LINE_MEMBER(cs_write); // CS signal (active high) DECLARE_WRITE_LINE_MEMBER(clk_write); // CLK signal (active high) @@ -283,6 +283,6 @@ DECLARE_SERIAL_EEPROM_DEVICE(93cxx, 93c86, 93C86, 8) DECLARE_SERIAL_EEPROM_DEVICE(er5911, er5911, ER5911, 8) DECLARE_SERIAL_EEPROM_DEVICE(er5911, er5911, ER5911, 16) -// X24c44 8 bit 32byte ram/eeprom combo +// X24c44 8 bit 32byte ram/eeprom combo DECLARE_SERIAL_EEPROM_DEVICE(x24c44, x24c44, X24C44, 16) #endif diff --git a/src/emu/machine/gayle.h b/src/emu/machine/gayle.h index d125cec0720..df9a0e043d4 100644 --- a/src/emu/machine/gayle.h +++ b/src/emu/machine/gayle.h @@ -1,11 +1,11 @@ /*************************************************************************** - GAYLE + GAYLE license: MAME, GPL-2.0+ copyright-holders: Dirk Best - Gate array used in the Amiga 600 and Amiga 1200 computers. + Gate array used in the Amiga 600 and Amiga 1200 computers. ***************************************************************************/ @@ -87,10 +87,10 @@ protected: private: enum { - GAYLE_CS = 0, // interrupt status - GAYLE_IRQ, // interrupt change - GAYLE_INTEN, // interrupt enable register - GAYLE_CFG // config register + GAYLE_CS = 0, // interrupt status + GAYLE_IRQ, // interrupt change + GAYLE_INTEN, // interrupt enable register + GAYLE_CFG // config register }; devcb_write_line m_int2_w; diff --git a/src/emu/machine/hd63450.h b/src/emu/machine/hd63450.h index 227c970c259..dd4c96d7cda 100644 --- a/src/emu/machine/hd63450.h +++ b/src/emu/machine/hd63450.h @@ -100,7 +100,7 @@ public: dev.m_burst_clock[2] = clk3; dev.m_burst_clock[3] = clk4; } - + DECLARE_READ16_MEMBER( read ); DECLARE_WRITE16_MEMBER( write ); DECLARE_WRITE_LINE_MEMBER(drq0_w); @@ -133,7 +133,7 @@ private: const char *m_cpu_tag; attotime m_our_clock[4]; attotime m_burst_clock[4]; - + // internal state hd63450_regs m_reg[4]; emu_timer* m_timer[4]; // for timing data reading/writing each channel diff --git a/src/emu/machine/i8255.h b/src/emu/machine/i8255.h index 2b6c3aedf12..ed4b2f39ad2 100644 --- a/src/emu/machine/i8255.h +++ b/src/emu/machine/i8255.h @@ -79,7 +79,7 @@ public: template static devcb_base &set_out_pa_callback(device_t &device, _Object object) { return downcast(device).m_out_pa_cb.set_callback(object); } template static devcb_base &set_out_pb_callback(device_t &device, _Object object) { return downcast(device).m_out_pb_cb.set_callback(object); } template static devcb_base &set_out_pc_callback(device_t &device, _Object object) { return downcast(device).m_out_pc_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -125,7 +125,7 @@ private: devcb_read8 m_in_pa_cb; devcb_read8 m_in_pb_cb; devcb_read8 m_in_pc_cb; - + devcb_write8 m_out_pa_cb; devcb_write8 m_out_pb_cb; devcb_write8 m_out_pc_cb; diff --git a/src/emu/machine/i8271.h b/src/emu/machine/i8271.h index 97712511d8a..e69baee004f 100644 --- a/src/emu/machine/i8271.h +++ b/src/emu/machine/i8271.h @@ -31,8 +31,8 @@ public: template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } template static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_drq.set_callback(object); } - static void set_floppy_tags(device_t &device, const char *tag1, const char *tag2) - { + static void set_floppy_tags(device_t &device, const char *tag1, const char *tag2) + { i8271_device &dev = downcast(device); dev.m_floppy_tag1 = tag1; dev.m_floppy_tag2 = tag2; diff --git a/src/emu/machine/i8279.h b/src/emu/machine/i8279.h index 162e50585d5..0f0cbccbd8a 100644 --- a/src/emu/machine/i8279.h +++ b/src/emu/machine/i8279.h @@ -84,7 +84,7 @@ public: template static devcb_base &set_in_rl_callback(device_t &device, _Object object) { return downcast(device).m_in_rl_cb.set_callback(object); } template static devcb_base &set_in_shift_callback(device_t &device, _Object object) { return downcast(device).m_in_shift_cb.set_callback(object); } template static devcb_base &set_in_ctrl_callback(device_t &device, _Object object) { return downcast(device).m_in_ctrl_cb.set_callback(object); } - + // read & write handlers DECLARE_READ8_MEMBER(status_r); DECLARE_READ8_MEMBER(data_r); @@ -115,7 +115,7 @@ private: devcb_write8 m_out_sl_cb; // Scanlines SL0-3 devcb_write8 m_out_disp_cb; // B0-3,A0-3 devcb_write_line m_out_bd_cb; // BD - devcb_read8 m_in_rl_cb; // kbd readlines RL0-7 + devcb_read8 m_in_rl_cb; // kbd readlines RL0-7 devcb_read_line m_in_shift_cb; // Shift key devcb_read_line m_in_ctrl_cb; // Ctrl-Strobe line diff --git a/src/emu/machine/ins8250.h b/src/emu/machine/ins8250.h index 1b80ddf646d..cc32242d60c 100644 --- a/src/emu/machine/ins8250.h +++ b/src/emu/machine/ins8250.h @@ -18,14 +18,14 @@ class ins8250_uart_device : public device_t, { public: ins8250_uart_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); - + template static devcb_base &set_out_tx_callback(device_t &device, _Object object) { return downcast(device).m_out_tx_cb.set_callback(object); } template static devcb_base &set_out_dtr_callback(device_t &device, _Object object) { return downcast(device).m_out_dtr_cb.set_callback(object); } template static devcb_base &set_out_rts_callback(device_t &device, _Object object) { return downcast(device).m_out_rts_cb.set_callback(object); } template static devcb_base &set_out_int_callback(device_t &device, _Object object) { return downcast(device).m_out_int_cb.set_callback(object); } template static devcb_base &set_out_out1_callback(device_t &device, _Object object) { return downcast(device).m_out_out1_cb.set_callback(object); } template static devcb_base &set_out_out2_callback(device_t &device, _Object object) { return downcast(device).m_out_out2_cb.set_callback(object); } - + DECLARE_WRITE8_MEMBER( ins8250_w ); DECLARE_READ8_MEMBER( ins8250_r ); DECLARE_WRITE_LINE_MEMBER( dcd_w ); diff --git a/src/emu/machine/kb3600.h b/src/emu/machine/kb3600.h index b9f7c02624d..5775508d3cc 100644 --- a/src/emu/machine/kb3600.h +++ b/src/emu/machine/kb3600.h @@ -137,7 +137,7 @@ private: int m_b; // output buffer int m_ako; // any key down - int m_x_mask[9]; // mask of what keys are down + int m_x_mask[9]; // mask of what keys are down // timers emu_timer *m_scan_timer; // keyboard scan timer diff --git a/src/emu/machine/keyboard.h b/src/emu/machine/keyboard.h index 9c5091b5fc3..73eaf160f2a 100644 --- a/src/emu/machine/keyboard.h +++ b/src/emu/machine/keyboard.h @@ -16,12 +16,12 @@ INPUT_PORTS_EXTERN( generic_keyboard ); -class generic_keyboard_device : public device_t +class generic_keyboard_device : public device_t { public: generic_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); generic_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_keyboard_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_cb.set_callback(object); } virtual ioport_constructor device_input_ports() const; diff --git a/src/emu/machine/mb89352.h b/src/emu/machine/mb89352.h index 1e76def92e4..3c4952b2b2e 100644 --- a/src/emu/machine/mb89352.h +++ b/src/emu/machine/mb89352.h @@ -50,7 +50,7 @@ #define MCFG_MB89352A_IRQ_CB(_devcb) \ devcb = &mb89352_device::set_irq_callback(*device, DEVCB_##_devcb); - + #define MCFG_MB89352A_DRQ_CB(_devcb) \ devcb = &mb89352_device::set_drq_callback(*device, DEVCB_##_devcb); @@ -62,7 +62,7 @@ public: template static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } template static devcb_base &set_drq_callback(device_t &device, _Object object) { return downcast(device).m_drq_cb.set_callback(object); } - + // any publically accessible interfaces needed for runtime DECLARE_READ8_MEMBER( mb89352_r ); DECLARE_WRITE8_MEMBER( mb89352_w ); diff --git a/src/emu/machine/mb89363b.h b/src/emu/machine/mb89363b.h index 43aa03e1e60..0b2f32a304a 100644 --- a/src/emu/machine/mb89363b.h +++ b/src/emu/machine/mb89363b.h @@ -113,7 +113,7 @@ private: devcb_read8 m_in_a_pa_cb; devcb_read8 m_in_a_pb_cb; devcb_read8 m_in_a_pc_cb; - + devcb_write8 m_out_a_pa_cb; devcb_write8 m_out_a_pb_cb; devcb_write8 m_out_a_pc_cb; @@ -121,7 +121,7 @@ private: devcb_read8 m_in_b_pa_cb; devcb_read8 m_in_b_pb_cb; devcb_read8 m_in_b_pc_cb; - + devcb_write8 m_out_b_pa_cb; devcb_write8 m_out_b_pb_cb; devcb_write8 m_out_b_pc_cb; diff --git a/src/emu/machine/mc6854.h b/src/emu/machine/mc6854.h index 40a7c694232..baa16636cc4 100644 --- a/src/emu/machine/mc6854.h +++ b/src/emu/machine/mc6854.h @@ -47,7 +47,7 @@ public: static void set_out_frame_callback(device_t &device, mc6854_out_frame_delegate callback) { downcast(device).m_out_frame_cb = callback; } template static devcb_base &set_out_rts_callback(device_t &device, _Object object) { return downcast(device).m_out_rts_cb.set_callback(object); } template static devcb_base &set_out_dtr_callback(device_t &device, _Object object) { return downcast(device).m_out_dtr_cb.set_callback(object); } - + /* interface to CPU via address/data bus*/ DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -74,13 +74,13 @@ protected: private: // internal state devcb_write_line m_out_irq_cb; /* interrupt request */ - + /* low-level, bit-based interface */ devcb_write_line m_out_txd_cb; /* transmit bit */ - - /* high-level, frame-based interface */ - mc6854_out_frame_delegate m_out_frame_cb; - + + /* high-level, frame-based interface */ + mc6854_out_frame_delegate m_out_frame_cb; + /* control lines */ devcb_write_line m_out_rts_cb; /* 1 = transmitting, 0 = idle */ devcb_write_line m_out_dtr_cb; /* 1 = data transmit ready, 0 = busy */ diff --git a/src/emu/machine/mos6530.h b/src/emu/machine/mos6530.h index a9753235772..33af24cf993 100644 --- a/src/emu/machine/mos6530.h +++ b/src/emu/machine/mos6530.h @@ -79,10 +79,10 @@ private: // internal state devcb_read8 m_in_pa_cb; devcb_write8 m_out_pa_cb; - + devcb_read8 m_in_pb_cb; devcb_write8 m_out_pb_cb; - + mos6530_port m_port[2]; UINT8 m_irqstate; diff --git a/src/emu/machine/ncr539x.h b/src/emu/machine/ncr539x.h index ec8eb1112f3..76f081c8c28 100644 --- a/src/emu/machine/ncr539x.h +++ b/src/emu/machine/ncr539x.h @@ -17,16 +17,16 @@ #define MCFG_NCR539X_OUT_IRQ_CB(_devcb) \ devcb = &ncr539x_device::set_out_irq_callback(*device, DEVCB_##_devcb); - + #define MCFG_NCR539X_OUT_DRQ_CB(_devcb) \ devcb = &ncr539x_device::set_out_drq_callback(*device, DEVCB_##_devcb); - + class ncr539x_device : public legacy_scsi_host_adapter { public: // construction/destruction ncr539x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_out_drq_callback(device_t &device, _Object object) { return downcast(device).m_out_drq_cb.set_callback(object); } diff --git a/src/emu/machine/roc10937.h b/src/emu/machine/roc10937.h index 120cd33bddb..a8c5130b75a 100644 --- a/src/emu/machine/roc10937.h +++ b/src/emu/machine/roc10937.h @@ -1,7 +1,7 @@ /********************************************************************** - Rockwell 10937/10957 interface and simlar chips - Emulation by J.Wallace + Rockwell 10937/10957 interface and simlar chips + Emulation by J.Wallace OKI MSC1937 is a clone of this chip, with many others. **********************************************************************/ @@ -12,7 +12,7 @@ #define MCFG_ROC10937_ADD(_tag,_val) \ MCFG_DEVICE_ADD(_tag, ROC10937,60)\ - MCFG_ROC10937_PORT(_val) + MCFG_ROC10937_PORT(_val) #define MCFG_ROC10937_PORT(_val) \ roc10937_t::static_set_value(*device, _val); @@ -21,8 +21,8 @@ #define MCFG_ROC10957_ADD(_tag,_val) \ MCFG_DEVICE_ADD(_tag, ROC10957,60)\ - MCFG_ROC10957_PORT(_val) - + MCFG_ROC10957_PORT(_val) + #define MCFG_ROC10957_PORT(_val) \ roc10957_t::static_set_value(*device, _val); #define MCFG_ROC10957_REMOVE(_tag) \ @@ -30,8 +30,8 @@ #define MCFG_MSC1937_ADD(_tag,_val) \ MCFG_DEVICE_ADD(_tag, ROC10937,60)\ - MCFG_MSC1937_PORT(_val) - + MCFG_MSC1937_PORT(_val) + #define MCFG_MSC1937_PORT(_val) \ MCFG_ROC10937_PORT(_val) @@ -40,7 +40,7 @@ #define MCFG_S16LF01_ADD(_tag,_val) \ MCFG_DEVICE_ADD(_tag, S16LF01,60)\ - MCFG_S16LF01_PORT(_val) + MCFG_S16LF01_PORT(_val) #define MCFG_S16LF01_PORT(_val) \ MCFG_ROC10937_PORT(_val) diff --git a/src/emu/machine/s2636.h b/src/emu/machine/s2636.h index 53688f6bcd2..3be2d6e8093 100644 --- a/src/emu/machine/s2636.h +++ b/src/emu/machine/s2636.h @@ -32,7 +32,7 @@ public: dev.m_x_offset = x_offset; dev.m_y_offset = y_offset; } - + // returns a BITMAP_FORMAT_IND16 bitmap the size of the screen // D0-D2 of each pixel is the pixel color // D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn @@ -65,7 +65,7 @@ private: int m_work_ram_size; int m_y_offset; int m_x_offset; - + int check_collision( int spriteno1, int spriteno2, const rectangle &cliprect ); }; diff --git a/src/emu/machine/s3c2400.h b/src/emu/machine/s3c2400.h index b456b080095..db4bc567392 100644 --- a/src/emu/machine/s3c2400.h +++ b/src/emu/machine/s3c2400.h @@ -19,16 +19,16 @@ #define MCFG_S3C2400_CORE_PIN_R_CB(_devcb) \ devcb = &s3c2400_device::set_core_pin_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2400_CORE_PIN_W_CB(_devcb) \ devcb = &s3c2400_device::set_core_pin_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2400_GPIO_PORT_R_CB(_devcb) \ devcb = &s3c2400_device::set_gpio_port_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2400_GPIO_PORT_W_CB(_devcb) \ devcb = &s3c2400_device::set_gpio_port_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2400_I2C_SCL_W_CB(_devcb) \ devcb = &s3c2400_device::set_i2c_scl_w_callback(*device, DEVCB_##_devcb); @@ -43,7 +43,7 @@ #define MCFG_S3C2400_I2S_DATA_W_CB(_devcb) \ devcb = &s3c2400_device::set_i2s_data_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2400_LCD_FLAGS(_flags) \ s3c2400_device::set_lcd_flags(*device, _flags); diff --git a/src/emu/machine/s3c2410.h b/src/emu/machine/s3c2410.h index da42c393ae7..802eb1cc52a 100644 --- a/src/emu/machine/s3c2410.h +++ b/src/emu/machine/s3c2410.h @@ -19,16 +19,16 @@ #define MCFG_S3C2410_CORE_PIN_R_CB(_devcb) \ devcb = &s3c2410_device::set_core_pin_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2410_CORE_PIN_W_CB(_devcb) \ devcb = &s3c2410_device::set_core_pin_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2410_GPIO_PORT_R_CB(_devcb) \ devcb = &s3c2410_device::set_gpio_port_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2410_GPIO_PORT_W_CB(_devcb) \ devcb = &s3c2410_device::set_gpio_port_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2410_I2C_SCL_W_CB(_devcb) \ devcb = &s3c2410_device::set_i2c_scl_w_callback(*device, DEVCB_##_devcb); @@ -43,7 +43,7 @@ #define MCFG_S3C2410_I2S_DATA_W_CB(_devcb) \ devcb = &s3c2410_device::set_i2s_data_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2410_NAND_COMMAND_W_CB(_devcb) \ devcb = &s3c2410_device::set_nand_command_w_callback(*device, DEVCB_##_devcb); @@ -55,7 +55,7 @@ #define MCFG_S3C2410_NAND_DATA_W_CB(_devcb) \ devcb = &s3c2410_device::set_nand_data_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2410_LCD_FLAGS(_flags) \ s3c2410_device::set_lcd_flags(*device, _flags); diff --git a/src/emu/machine/s3c2440.h b/src/emu/machine/s3c2440.h index b4a737b3776..4c333de06f7 100644 --- a/src/emu/machine/s3c2440.h +++ b/src/emu/machine/s3c2440.h @@ -18,16 +18,16 @@ #define MCFG_S3C2440_CORE_PIN_R_CB(_devcb) \ devcb = &s3c2440_device::set_core_pin_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2440_CORE_PIN_W_CB(_devcb) \ devcb = &s3c2440_device::set_core_pin_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2440_GPIO_PORT_R_CB(_devcb) \ devcb = &s3c2440_device::set_gpio_port_r_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2440_GPIO_PORT_W_CB(_devcb) \ devcb = &s3c2440_device::set_gpio_port_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2440_I2C_SCL_W_CB(_devcb) \ devcb = &s3c2440_device::set_i2c_scl_w_callback(*device, DEVCB_##_devcb); @@ -54,7 +54,7 @@ #define MCFG_S3C2440_NAND_DATA_W_CB(_devcb) \ devcb = &s3c2440_device::set_nand_data_w_callback(*device, DEVCB_##_devcb); - + #define MCFG_S3C2440_LCD_FLAGS(_flags) \ s3c2440_device::set_lcd_flags(*device, _flags); diff --git a/src/emu/machine/s3c44b0.h b/src/emu/machine/s3c44b0.h index 96b86240160..dc13e086f77 100644 --- a/src/emu/machine/s3c44b0.h +++ b/src/emu/machine/s3c44b0.h @@ -600,7 +600,7 @@ class s3c44b0_device : public device_t public: s3c44b0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~s3c44b0_device() {} - + template static devcb_base &set_gpio_port_r_callback(device_t &device, _Object object) { return downcast(device).m_port_r_cb.set_callback(object); } template static devcb_base &set_gpio_port_w_callback(device_t &device, _Object object) { return downcast(device).m_port_w_cb.set_callback(object); } template static devcb_base &set_i2c_scl_w_callback(device_t &device, _Object object) { return downcast(device).m_scl_w_cb.set_callback(object); } diff --git a/src/emu/machine/terminal.h b/src/emu/machine/terminal.h index 9684cb691db..9e2944e8806 100644 --- a/src/emu/machine/terminal.h +++ b/src/emu/machine/terminal.h @@ -21,14 +21,14 @@ INPUT_PORTS_EXTERN( generic_terminal ); -class generic_terminal_device : public device_t +class generic_terminal_device : public device_t { public: generic_terminal_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); generic_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_keyboard_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_cb.set_callback(object); } - + DECLARE_WRITE8_MEMBER(write) { term_write(data); } DECLARE_WRITE8_MEMBER(kbd_put); UINT32 update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect); diff --git a/src/emu/machine/tms9902.h b/src/emu/machine/tms9902.h index 9d34a48a240..ba775d3caa1 100644 --- a/src/emu/machine/tms9902.h +++ b/src/emu/machine/tms9902.h @@ -48,12 +48,12 @@ class tms9902_device : public device_t { public: tms9902_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_int_callback(device_t &device, _Object object) { return downcast(device).m_int_cb.set_callback(object); } template static devcb_base &set_rcv_callback(device_t &device, _Object object) { return downcast(device).m_rcv_cb.set_callback(object); } template static devcb_base &set_xmit_callback(device_t &device, _Object object) { return downcast(device).m_xmit_cb.set_callback(object); } template static devcb_base &set_ctrl_callback(device_t &device, _Object object) { return downcast(device).m_ctrl_cb.set_callback(object); } - + void set_clock(bool state); void rcv_cts(line_state state); diff --git a/src/emu/machine/upd71071.h b/src/emu/machine/upd71071.h index 3f8f11bb3ed..61e254b3e7e 100644 --- a/src/emu/machine/upd71071.h +++ b/src/emu/machine/upd71071.h @@ -26,7 +26,7 @@ class upd71071_device : public device_t public: upd71071_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~upd71071_device() {} - + static void static_set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu.set_tag(tag); } static void set_clock(device_t &device, int clock) { downcast(device).m_upd_clock = clock; } template static devcb_base &set_out_hreq_callback(device_t &device, _Object object) { return downcast(device).m_out_hreq_cb.set_callback(object); } @@ -98,7 +98,7 @@ extern const device_type UPD71071; #define MCFG_UPD71071_CLOCK(_clk) \ upd71071_device::set_clock(*device, _clk); - + #define MCFG_UPD71071_OUT_HREQ_CB(_devcb) \ devcb = &upd71071_device::set_out_hreq_callback(*device, DEVCB_##_devcb); diff --git a/src/emu/machine/wd11c00_17.h b/src/emu/machine/wd11c00_17.h index fb6f702b0b4..9a49f252563 100644 --- a/src/emu/machine/wd11c00_17.h +++ b/src/emu/machine/wd11c00_17.h @@ -79,7 +79,7 @@ public: template static devcb_base &set_out_ramwr_callback(device_t &device, _Object object) { return downcast(device).m_out_ramwr_cb.set_callback(object); } template static devcb_base &set_in_cs1010_callback(device_t &device, _Object object) { return downcast(device).m_in_cs1010_cb.set_callback(object); } template static devcb_base &set_out_cs1010_callback(device_t &device, _Object object) { return downcast(device).m_out_cs1010_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( io_r ); DECLARE_WRITE8_MEMBER( io_w ); diff --git a/src/emu/machine/wd17xx.h b/src/emu/machine/wd17xx.h index 2aa7e39cb28..ac5844fb49a 100644 --- a/src/emu/machine/wd17xx.h +++ b/src/emu/machine/wd17xx.h @@ -1,6 +1,6 @@ /********************************************************************* - !!! DEPRECATED, USE src/emu/wd_fdc.h FOR NEW DRIVERS !!! + !!! DEPRECATED, USE src/emu/wd_fdc.h FOR NEW DRIVERS !!! wd17xx.h @@ -54,7 +54,7 @@ public: template static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast(device).m_out_intrq_func.set_callback(object); } template static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast(device).m_out_drq_func.set_callback(object); } template static devcb_base &set_dden_rd_callback(device_t &device, _Object object) { return downcast(device).m_in_dden_func.set_callback(object); } - + static void set_drive_tags(device_t &device, const char *tag1, const char *tag2, const char *tag3, const char *tag4) { wd1770_device &dev = downcast(device); @@ -63,7 +63,7 @@ public: dev.m_floppy_drive_tags[2] = tag3; dev.m_floppy_drive_tags[3] = tag4; } - + /* the following are not strictly part of the wd179x hardware/emulation but will be put here for now until the flopdrv code has been finalised more */ void set_drive(UINT8); /* set drive wd179x is accessing */ @@ -130,7 +130,7 @@ protected: devcb_write_line m_out_intrq_func; devcb_write_line m_out_drq_func; devcb_read_line m_in_dden_func; - + const char *m_floppy_drive_tags[4]; /* input lines */ diff --git a/src/emu/machine/wd2010.h b/src/emu/machine/wd2010.h index 8e18254f30b..61f6b23497e 100644 --- a/src/emu/machine/wd2010.h +++ b/src/emu/machine/wd2010.h @@ -87,7 +87,7 @@ public: template static devcb_base &set_in_wf_callback(device_t &device, _Object object) { return downcast(device).m_in_wf_cb.set_callback(object); } template static devcb_base &set_in_tk000_callback(device_t &device, _Object object) { return downcast(device).m_in_tk000_cb.set_callback(object); } template static devcb_base &set_in_sc_callback(device_t &device, _Object object) { return downcast(device).m_in_sc_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); diff --git a/src/emu/machine/ym2148.h b/src/emu/machine/ym2148.h index 3757d75c75a..e92b0c6738a 100644 --- a/src/emu/machine/ym2148.h +++ b/src/emu/machine/ym2148.h @@ -89,4 +89,3 @@ extern const device_type YM2148; #endif - diff --git a/src/emu/machine/z80ctc.h b/src/emu/machine/z80ctc.h index d8ead13548f..4e395517092 100644 --- a/src/emu/machine/z80ctc.h +++ b/src/emu/machine/z80ctc.h @@ -65,7 +65,7 @@ public: template static devcb_base &set_zc0_callback(device_t &device, _Object object) { return downcast(device).m_zc0_cb.set_callback(object); } template static devcb_base &set_zc1_callback(device_t &device, _Object object) { return downcast(device).m_zc1_cb.set_callback(object); } template static devcb_base &set_zc2_callback(device_t &device, _Object object) { return downcast(device).m_zc2_cb.set_callback(object); } - + // read/write handlers DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -124,7 +124,7 @@ private: devcb_write_line m_zc1_cb; // channel 1 zero crossing callbacks devcb_write_line m_zc2_cb; // channel 2 zero crossing callbacks devcb_write_line m_zc3_cb; // channel 3 zero crossing callbacks = NULL ? - + UINT8 m_vector; // interrupt vector attotime m_period16; // 16/system clock attotime m_period256; // 256/system clock diff --git a/src/emu/machine/z80dart.h b/src/emu/machine/z80dart.h index 1e0114c120c..27376cddde0 100644 --- a/src/emu/machine/z80dart.h +++ b/src/emu/machine/z80dart.h @@ -485,10 +485,10 @@ public: template static devcb_base &set_out_syncb_callback(device_t &device, _Object object) { return downcast(device).m_out_syncb_cb.set_callback(object); } template static devcb_base &set_out_int_callback(device_t &device, _Object object) { return downcast(device).m_out_int_cb.set_callback(object); } template static devcb_base &set_out_rxdrqa_callback(device_t &device, _Object object) { return downcast(device).m_out_rxdrqa_cb.set_callback(object); } - template static devcb_base &set_out_txdrqa_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqa_cb.set_callback(object); } + template static devcb_base &set_out_txdrqa_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqa_cb.set_callback(object); } template static devcb_base &set_out_rxdrqb_callback(device_t &device, _Object object) { return downcast(device).m_out_rxdrqb_cb.set_callback(object); } - template static devcb_base &set_out_txdrqb_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqb_cb.set_callback(object); } - + template static devcb_base &set_out_txdrqb_callback(device_t &device, _Object object) { return downcast(device).m_out_txdrqb_cb.set_callback(object); } + static void configure_channels(device_t &device, int rxa, int txa, int rxb, int txb) { z80dart_device &dev = downcast(device); @@ -497,7 +497,7 @@ public: dev.m_rxcb = rxb; dev.m_txcb = txb; } - + DECLARE_READ8_MEMBER( cd_ba_r ); DECLARE_WRITE8_MEMBER( cd_ba_w ); DECLARE_READ8_MEMBER( ba_cd_r ); @@ -565,19 +565,19 @@ protected: int m_txca; int m_rxcb; int m_txcb; - + devcb_write_line m_out_txda_cb; devcb_write_line m_out_dtra_cb; devcb_write_line m_out_rtsa_cb; devcb_write_line m_out_wrdya_cb; devcb_write_line m_out_synca_cb; - + devcb_write_line m_out_txdb_cb; devcb_write_line m_out_dtrb_cb; devcb_write_line m_out_rtsb_cb; devcb_write_line m_out_wrdyb_cb; devcb_write_line m_out_syncb_cb; - + devcb_write_line m_out_int_cb; devcb_write_line m_out_rxdrqa_cb; devcb_write_line m_out_txdrqa_cb; diff --git a/src/emu/machine/z80dma.h b/src/emu/machine/z80dma.h index 93641ff17c5..f16812ef07b 100644 --- a/src/emu/machine/z80dma.h +++ b/src/emu/machine/z80dma.h @@ -83,7 +83,7 @@ public: template static devcb_base &set_out_mreq_callback(device_t &device, _Object object) { return downcast(device).m_out_mreq_cb.set_callback(object); } template static devcb_base &set_in_iorq_callback(device_t &device, _Object object) { return downcast(device).m_in_iorq_cb.set_callback(object); } template static devcb_base &set_out_iorq_callback(device_t &device, _Object object) { return downcast(device).m_out_iorq_cb.set_callback(object); } - + UINT8 read(); void write(UINT8 data); DECLARE_READ8_MEMBER( read ) { return read(); } diff --git a/src/emu/machine/z80pio.h b/src/emu/machine/z80pio.h index 3dc71316126..91285fbc73a 100644 --- a/src/emu/machine/z80pio.h +++ b/src/emu/machine/z80pio.h @@ -92,7 +92,7 @@ public: template static devcb_base &set_in_pb_callback(device_t &device, _Object object) { return downcast(device).m_in_pb_cb.set_callback(object); } template static devcb_base &set_out_pb_callback(device_t &device, _Object object) { return downcast(device).m_out_pb_cb.set_callback(object); } template static devcb_base &set_out_brdy_callback(device_t &device, _Object object) { return downcast(device).m_out_brdy_cb.set_callback(object); } - + // I/O line access int rdy(int which) { return m_port[which].rdy(); } void strobe(int which, bool state) { m_port[which].strobe(state); } @@ -206,7 +206,7 @@ private: devcb_read8 m_in_pa_cb; devcb_write8 m_out_pa_cb; devcb_write_line m_out_ardy_cb; - + devcb_read8 m_in_pb_cb; devcb_write8 m_out_pb_cb; devcb_write_line m_out_brdy_cb; diff --git a/src/emu/machine/z80sti.h b/src/emu/machine/z80sti.h index 2d156706c69..4065bf6bdcb 100644 --- a/src/emu/machine/z80sti.h +++ b/src/emu/machine/z80sti.h @@ -94,7 +94,7 @@ public: template static devcb_base &set_out_tbo_callback(device_t &device, _Object object) { return downcast(device).m_out_tbo_cb.set_callback(object); } template static devcb_base &set_out_tco_callback(device_t &device, _Object object) { return downcast(device).m_out_tco_cb.set_callback(object); } template static devcb_base &set_out_tdo_callback(device_t &device, _Object object) { return downcast(device).m_out_tdo_cb.set_callback(object); } - + static void set_rx_clock(device_t &device, int clock) { downcast(device).m_rx_clock = clock; } static void set_tx_clock(device_t &device, int clock) { downcast(device).m_tx_clock = clock; } @@ -201,15 +201,15 @@ private: void gpip_input(int bit, int state); // device callbacks - devcb_write_line m_out_int_cb; // this gets called on each change of the _INT pin (pin 17) - devcb_read8 m_in_gpio_cb; // this is called on each read of the GPIO pins - devcb_write8 m_out_gpio_cb; // this is called on each write of the GPIO pins - devcb_write_line m_out_so_cb; // this gets called for each change of the SO pin (pin 37) - devcb_write_line m_out_tao_cb; // this gets called for each change of the TAO pin (pin 1) - devcb_write_line m_out_tbo_cb; // this gets called for each change of the TBO pin (pin 2) - devcb_write_line m_out_tco_cb; // this gets called for each change of the TCO pin (pin 3) - devcb_write_line m_out_tdo_cb; // this gets called for each change of the TDO pin (pin 4) - + devcb_write_line m_out_int_cb; // this gets called on each change of the _INT pin (pin 17) + devcb_read8 m_in_gpio_cb; // this is called on each read of the GPIO pins + devcb_write8 m_out_gpio_cb; // this is called on each write of the GPIO pins + devcb_write_line m_out_so_cb; // this gets called for each change of the SO pin (pin 37) + devcb_write_line m_out_tao_cb; // this gets called for each change of the TAO pin (pin 1) + devcb_write_line m_out_tbo_cb; // this gets called for each change of the TBO pin (pin 2) + devcb_write_line m_out_tco_cb; // this gets called for each change of the TCO pin (pin 3) + devcb_write_line m_out_tdo_cb; // this gets called for each change of the TDO pin (pin 4) + int m_rx_clock; // serial receive clock int m_tx_clock; // serial transmit clock diff --git a/src/emu/mame.h b/src/emu/mame.h index a1da76b4325..457b13f39f6 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -92,27 +92,27 @@ public: emu_options &options() const { return m_options; } web_engine *web() { return &m_web; } lua_engine *lua() { return &m_lua; } - + running_machine *machine() { return m_machine; } void set_machine(running_machine *machine) { m_machine = machine; } - + void update_machine(); - + /* execute as configured by the OPTION_SYSTEMNAME option on the specified options */ int execute(); void schedule_new_driver(const game_driver &driver); private: osd_interface & m_osd; // reference to OSD system emu_options & m_options; // reference to options - - web_engine m_web; - lua_engine m_lua; - - const game_driver * m_new_driver_pending; // pointer to the next pending driver - - running_machine *m_machine; - static machine_manager* m_manager; + + web_engine m_web; + lua_engine m_lua; + + const game_driver * m_new_driver_pending; // pointer to the next pending driver + + running_machine *m_machine; + static machine_manager* m_manager; }; //************************************************************************** diff --git a/src/emu/memory.h b/src/emu/memory.h index 4b88936a4b8..765c00bd086 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -439,7 +439,7 @@ public: UINT64 *install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, UINT64 unitmask = 0); UINT64 *install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write64_delegate whandler, UINT64 unitmask = 0); UINT64 *install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask = 0); - + // setup void prepare_map(); void populate_from_map(address_map *map = NULL); diff --git a/src/emu/netlist/analog/nld_bjt.h b/src/emu/netlist/analog/nld_bjt.h index 082f70d9b17..f1d980c1428 100644 --- a/src/emu/netlist/analog/nld_bjt.h +++ b/src/emu/netlist/analog/nld_bjt.h @@ -98,7 +98,7 @@ public: NETLIB_UPDATE_TERMINALS() { - const double m = (is_qtype( BJT_NPN) ? 1 : -1); + const double m = (is_qtype( BJT_NPN) ? 1 : -1); const int new_state = (m_RB.deltaV() * m > m_V ) ? 1 : 0; if (m_state_on ^ new_state) @@ -122,7 +122,7 @@ public: m_RB.set(gb, v, 0.0); m_RC.set(gc, 0.0, 0.0); //m_RB.update_dev(); - //m_RC.update_dev(); + //m_RC.update_dev(); m_state_on = new_state; } } @@ -164,7 +164,7 @@ public: m_D_EB(netlist_object_t::ANALOG), m_D_EC(netlist_object_t::ANALOG), m_alpha_f(0), - m_alpha_r(0) + m_alpha_r(0) { } NETLIB_UPDATE_TERMINALS() diff --git a/src/emu/netlist/analog/nld_fourterm.h b/src/emu/netlist/analog/nld_fourterm.h index 63efb89b449..5c729f6ca65 100644 --- a/src/emu/netlist/analog/nld_fourterm.h +++ b/src/emu/netlist/analog/nld_fourterm.h @@ -18,7 +18,7 @@ NET_REGISTER_DEV(VCCS, _name) #define CCCS(_name) \ - NET_REGISTER_DEV(CCCS, _name) + NET_REGISTER_DEV(CCCS, _name) #define VCVS(_name) \ NET_REGISTER_DEV(VCVS, _name) @@ -104,18 +104,18 @@ protected: class NETLIB_NAME(CCCS) : public NETLIB_NAME(VCCS) { public: - ATTR_COLD NETLIB_NAME(CCCS)() - : NETLIB_NAME(VCCS)(CCCS), m_gfac(1.0) { } - //ATTR_COLD NETLIB_NAME(CCCS)(const family_t afamily) - //: netlist_device_t(afamily), m_gfac(1.0) { } + ATTR_COLD NETLIB_NAME(CCCS)() + : NETLIB_NAME(VCCS)(CCCS), m_gfac(1.0) { } + //ATTR_COLD NETLIB_NAME(CCCS)(const family_t afamily) + //: netlist_device_t(afamily), m_gfac(1.0) { } protected: - ATTR_COLD virtual void start(); - ATTR_COLD virtual void reset(); - ATTR_COLD virtual void update_param(); - ATTR_HOT ATTR_ALIGN void update(); + ATTR_COLD virtual void start(); + ATTR_COLD virtual void reset(); + ATTR_COLD virtual void update_param(); + ATTR_HOT ATTR_ALIGN void update(); - double m_gfac; + double m_gfac; }; diff --git a/src/emu/netlist/analog/nld_ms_direct.h b/src/emu/netlist/analog/nld_ms_direct.h index 1d1089f054c..e067a476989 100644 --- a/src/emu/netlist/analog/nld_ms_direct.h +++ b/src/emu/netlist/analog/nld_ms_direct.h @@ -13,48 +13,48 @@ class netlist_matrix_solver_direct_t: public netlist_matrix_solver_t { public: - netlist_matrix_solver_direct_t(const netlist_solver_parameters_t ¶ms, int size); + netlist_matrix_solver_direct_t(const netlist_solver_parameters_t ¶ms, int size); - virtual ~netlist_matrix_solver_direct_t(); + virtual ~netlist_matrix_solver_direct_t(); - ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets); - ATTR_COLD virtual void reset() { netlist_matrix_solver_t::reset(); } + ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets); + ATTR_COLD virtual void reset() { netlist_matrix_solver_t::reset(); } - ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } + ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } - ATTR_HOT inline int vsolve_non_dynamic(); + ATTR_HOT inline int vsolve_non_dynamic(); protected: - ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term); + ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term); - ATTR_HOT virtual double vsolve(); + ATTR_HOT virtual double vsolve(); - ATTR_HOT int solve_non_dynamic(); - ATTR_HOT void build_LE(); - ATTR_HOT void gauss_LE(double (* RESTRICT x)); - ATTR_HOT double delta(const double (* RESTRICT V)); - ATTR_HOT void store(const double (* RESTRICT V), const bool store_RHS); + ATTR_HOT int solve_non_dynamic(); + ATTR_HOT void build_LE(); + ATTR_HOT void gauss_LE(double (* RESTRICT x)); + ATTR_HOT double delta(const double (* RESTRICT V)); + ATTR_HOT void store(const double (* RESTRICT V), const bool store_RHS); - /* bring the whole system to the current time - * Don't schedule a new calculation time. The recalculation has to be - * triggered by the caller after the netlist element was changed. - */ - ATTR_HOT double compute_next_timestep(); + /* bring the whole system to the current time + * Don't schedule a new calculation time. The recalculation has to be + * triggered by the caller after the netlist element was changed. + */ + ATTR_HOT double compute_next_timestep(); - double m_A[_storage_N][((_storage_N + 7) / 8) * 8]; - double m_RHS[_storage_N]; - double m_last_RHS[_storage_N]; // right hand side - contains currents - double m_Vdelta[_storage_N]; - double m_last_V[_storage_N]; + double m_A[_storage_N][((_storage_N + 7) / 8) * 8]; + double m_RHS[_storage_N]; + double m_last_RHS[_storage_N]; // right hand side - contains currents + double m_Vdelta[_storage_N]; + double m_last_V[_storage_N]; - terms_t **m_terms; - terms_t *m_rails_temp; + terms_t **m_terms; + terms_t *m_rails_temp; private: - vector_ops_t *m_row_ops[_storage_N + 1]; + vector_ops_t *m_row_ops[_storage_N + 1]; - int m_dim; - double m_lp_fact; + int m_dim; + double m_lp_fact; }; // ---------------------------------------------------------------------------------------- @@ -64,149 +64,148 @@ private: template netlist_matrix_solver_direct_t::~netlist_matrix_solver_direct_t() { - for (int k=0; k<_storage_N; k++) - { - //delete[] m_A[k]; - } - //delete[] m_last_RHS; - //delete[] m_RHS; - delete[] m_terms; - delete[] m_rails_temp; - //delete[] m_row_ops; + for (int k=0; k<_storage_N; k++) + { + //delete[] m_A[k]; + } + //delete[] m_last_RHS; + //delete[] m_RHS; + delete[] m_terms; + delete[] m_rails_temp; + //delete[] m_row_ops; } template ATTR_HOT double netlist_matrix_solver_direct_t::compute_next_timestep() { - double new_solver_timestep = m_params.m_max_timestep; + double new_solver_timestep = m_params.m_max_timestep; - if (m_params.m_dynamic) - { - /* - * FIXME: We should extend the logic to use either all nets or - * only output nets. - */ + if (m_params.m_dynamic) + { + /* + * FIXME: We should extend the logic to use either all nets or + * only output nets. + */ #if 0 - for (netlist_analog_output_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p)) - { - netlist_analog_net_t *n = (*p)->m_proxied_net; + for (netlist_analog_output_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p)) + { + netlist_analog_net_t *n = (*p)->m_proxied_net; #else - for (int k = 0; k < N(); k++) - { - netlist_analog_net_t *n = m_nets[k]; + for (int k = 0; k < N(); k++) + { + netlist_analog_net_t *n = m_nets[k]; #endif - const double DD_n = (n->m_cur_Analog - m_last_V[k]); - const double hn = current_timestep(); + const double DD_n = (n->m_cur_Analog - m_last_V[k]); + const double hn = current_timestep(); - double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1); - double new_net_timestep; + double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1); + double new_net_timestep; - n->m_h_n_m_1 = hn; - n->m_DD_n_m_1 = DD_n; - if (fabs(DD2) > 1e-50) // avoid div-by-zero - new_net_timestep = sqrt(m_params.m_lte / fabs(0.5*DD2)); - else - new_net_timestep = m_params.m_max_timestep; + n->m_h_n_m_1 = hn; + n->m_DD_n_m_1 = DD_n; + if (fabs(DD2) > 1e-50) // avoid div-by-zero + new_net_timestep = sqrt(m_params.m_lte / fabs(0.5*DD2)); + else + new_net_timestep = m_params.m_max_timestep; - if (new_net_timestep < new_solver_timestep) - new_solver_timestep = new_net_timestep; - } - if (new_solver_timestep < m_params.m_min_timestep) - new_solver_timestep = m_params.m_min_timestep; - } - //if (new_solver_timestep > 10.0 * hn) - // new_solver_timestep = 10.0 * hn; - return new_solver_timestep; + if (new_net_timestep < new_solver_timestep) + new_solver_timestep = new_net_timestep; + } + if (new_solver_timestep < m_params.m_min_timestep) + new_solver_timestep = m_params.m_min_timestep; + } + //if (new_solver_timestep > 10.0 * hn) + // new_solver_timestep = 10.0 * hn; + return new_solver_timestep; } template ATTR_COLD void netlist_matrix_solver_direct_t::add_term(int k, netlist_terminal_t *term) { - if (term->m_otherterm->net().isRailNet()) - { - m_rails_temp[k].add(term, -1); - } - else - { - int ot = get_net_idx(&term->m_otherterm->net()); - if (ot>=0) - { - m_terms[k]->add(term, ot); - SOLVER_VERBOSE_OUT(("Net %d Term %s %f %f\n", k, terms[i]->name().cstr(), terms[i]->m_gt, terms[i]->m_go)); - } - /* Should this be allowed ? */ - else // if (ot<0) - { - m_rails_temp[k].add(term, ot); - netlist().error("found term with missing othernet %s\n", term->name().cstr()); - } - } + if (term->m_otherterm->net().isRailNet()) + { + m_rails_temp[k].add(term, -1); + } + else + { + int ot = get_net_idx(&term->m_otherterm->net()); + if (ot>=0) + { + m_terms[k]->add(term, ot); + SOLVER_VERBOSE_OUT(("Net %d Term %s %f %f\n", k, terms[i]->name().cstr(), terms[i]->m_gt, terms[i]->m_go)); + } + /* Should this be allowed ? */ + else // if (ot<0) + { + m_rails_temp[k].add(term, ot); + netlist().error("found term with missing othernet %s\n", term->name().cstr()); + } + } } template ATTR_COLD void netlist_matrix_solver_direct_t::vsetup(netlist_analog_net_t::list_t &nets) { + if (m_dim < nets.count()) + netlist().error("Dimension %d less than %d", m_dim, nets.count()); - if (m_dim < nets.count()) - netlist().error("Dimension %d less than %d", m_dim, nets.count()); + for (int k = 0; k < N(); k++) + { + m_terms[k]->clear(); + m_rails_temp[k].clear(); + } - for (int k = 0; k < N(); k++) - { - m_terms[k]->clear(); - m_rails_temp[k].clear(); - } + netlist_matrix_solver_t::setup(nets); - netlist_matrix_solver_t::setup(nets); + for (int k = 0; k < N(); k++) + { + m_terms[k]->m_railstart = m_terms[k]->count(); + for (int i = 0; i < m_rails_temp[k].count(); i++) + this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i]); - for (int k = 0; k < N(); k++) - { - m_terms[k]->m_railstart = m_terms[k]->count(); - for (int i = 0; i < m_rails_temp[k].count(); i++) - this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i]); - - m_rails_temp[k].clear(); // no longer needed - m_terms[k]->set_pointers(); - } + m_rails_temp[k].clear(); // no longer needed + m_terms[k]->set_pointers(); + } #if 1 - /* Sort in descending order by number of connected matrix voltages. - * The idea is, that for Gauss-Seidel algo the first voltage computed - * depends on the greatest number of previous voltages thus taking into - * account the maximum amout of information. - * - * This actually improves performance on popeye slightly. Average - * GS computations reduce from 2.509 to 2.370 - * - * Smallest to largest : 2.613 - * Unsorted : 2.509 - * Largest to smallest : 2.370 - * - * Sorting as a general matrix pre-conditioning is mentioned in - * literature but I have found no articles about Gauss Seidel. - * - */ + /* Sort in descending order by number of connected matrix voltages. + * The idea is, that for Gauss-Seidel algo the first voltage computed + * depends on the greatest number of previous voltages thus taking into + * account the maximum amout of information. + * + * This actually improves performance on popeye slightly. Average + * GS computations reduce from 2.509 to 2.370 + * + * Smallest to largest : 2.613 + * Unsorted : 2.509 + * Largest to smallest : 2.370 + * + * Sorting as a general matrix pre-conditioning is mentioned in + * literature but I have found no articles about Gauss Seidel. + * + */ - for (int k = 0; k < N() / 2; k++) - for (int i = 0; i < N() - 1; i++) - { - if (m_terms[i]->m_railstart < m_terms[i+1]->m_railstart) - { - std::swap(m_terms[i],m_terms[i+1]); - m_nets.swap(i, i+1); - } - } + for (int k = 0; k < N() / 2; k++) + for (int i = 0; i < N() - 1; i++) + { + if (m_terms[i]->m_railstart < m_terms[i+1]->m_railstart) + { + std::swap(m_terms[i],m_terms[i+1]); + m_nets.swap(i, i+1); + } + } - for (int k = 0; k < N(); k++) - { - int *other = m_terms[k]->net_other(); - for (int i = 0; i < m_terms[k]->count(); i++) - if (other[i] != -1) - other[i] = get_net_idx(&m_terms[k]->terms()[i]->m_otherterm->net()); - } + for (int k = 0; k < N(); k++) + { + int *other = m_terms[k]->net_other(); + for (int i = 0; i < m_terms[k]->count(); i++) + if (other[i] != -1) + other[i] = get_net_idx(&m_terms[k]->terms()[i]->m_otherterm->net()); + } #endif @@ -216,230 +215,230 @@ template ATTR_HOT void netlist_matrix_solver_direct_t::build_LE() { #if 0 - for (int k=0; k < N(); k++) - for (int i=0; i < N(); i++) - m_A[k][i] = 0.0; + for (int k=0; k < N(); k++) + for (int i=0; i < N(); i++) + m_A[k][i] = 0.0; #endif - for (int k = 0; k < N(); k++) - { - for (int i=0; i < N(); i++) - m_A[k][i] = 0.0; + for (int k = 0; k < N(); k++) + { + for (int i=0; i < N(); i++) + m_A[k][i] = 0.0; - double rhsk = 0.0; - double akk = 0.0; - { - const int terms_count = m_terms[k]->count(); - const double * RESTRICT gt = m_terms[k]->gt(); - const double * RESTRICT go = m_terms[k]->go(); - const double * RESTRICT Idr = m_terms[k]->Idr(); + double rhsk = 0.0; + double akk = 0.0; + { + const int terms_count = m_terms[k]->count(); + const double * RESTRICT gt = m_terms[k]->gt(); + const double * RESTRICT go = m_terms[k]->go(); + const double * RESTRICT Idr = m_terms[k]->Idr(); #if VECTALT - for (int i = 0; i < terms_count; i++) - { - rhsk = rhsk + Idr[i]; - akk = akk + gt[i]; - } + for (int i = 0; i < terms_count; i++) + { + rhsk = rhsk + Idr[i]; + akk = akk + gt[i]; + } #else - m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk); + m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk); #endif - double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); - for (int i = m_terms[k]->m_railstart; i < terms_count; i++) - { - //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog(); - rhsk = rhsk + go[i] * *other_cur_analog[i]; - } - } + double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); + for (int i = m_terms[k]->m_railstart; i < terms_count; i++) + { + //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog(); + rhsk = rhsk + go[i] * *other_cur_analog[i]; + } + } #if 0 - /* - * Matrix preconditioning with 1.0 / Akk - * - * will save a number of calculations during elimination - * - */ - akk = 1.0 / akk; - m_RHS[k] = rhsk * akk; - m_A[k][k] += 1.0; - { - const int *net_other = m_terms[k]->net_other(); - const double *go = m_terms[k]->go(); - const int railstart = m_terms[k]->m_railstart; + /* + * Matrix preconditioning with 1.0 / Akk + * + * will save a number of calculations during elimination + * + */ + akk = 1.0 / akk; + m_RHS[k] = rhsk * akk; + m_A[k][k] += 1.0; + { + const int *net_other = m_terms[k]->net_other(); + const double *go = m_terms[k]->go(); + const int railstart = m_terms[k]->m_railstart; - for (int i = 0; i < railstart; i++) - { - m_A[k][net_other[i]] += -go[i] * akk; - } - } + for (int i = 0; i < railstart; i++) + { + m_A[k][net_other[i]] += -go[i] * akk; + } + } #else - m_RHS[k] = rhsk; - m_A[k][k] += akk; - { - const int * RESTRICT net_other = m_terms[k]->net_other(); - const double * RESTRICT go = m_terms[k]->go(); - const int railstart = m_terms[k]->m_railstart; + m_RHS[k] = rhsk; + m_A[k][k] += akk; + { + const int * RESTRICT net_other = m_terms[k]->net_other(); + const double * RESTRICT go = m_terms[k]->go(); + const int railstart = m_terms[k]->m_railstart; - for (int i = 0; i < railstart; i++) - { - m_A[k][net_other[i]] += -go[i]; - } - } + for (int i = 0; i < railstart; i++) + { + m_A[k][net_other[i]] += -go[i]; + } + } #endif - } + } } template ATTR_HOT void netlist_matrix_solver_direct_t::gauss_LE( - double (* RESTRICT x)) + double (* RESTRICT x)) { #if 0 - for (int i = 0; i < N(); i++) - { - for (int k = 0; k < N(); k++) - printf("%f ", m_A[i][k]); - printf("| %f = %f \n", x[i], m_RHS[i]); - } - printf("\n"); + for (int i = 0; i < N(); i++) + { + for (int k = 0; k < N(); k++) + printf("%f ", m_A[i][k]); + printf("| %f = %f \n", x[i], m_RHS[i]); + } + printf("\n"); #endif - const int kN = N(); + const int kN = N(); - for (int i = 0; i < kN; i++) { - // FIXME: use a parameter to enable pivoting? - if (USE_PIVOT_SEARCH) - { - /* Find the row with the largest first value */ - int maxrow = i; - for (int j = i + 1; j < kN; j++) - { - if (fabs(m_A[j][i]) > fabs(m_A[maxrow][i])) - maxrow = j; - } + for (int i = 0; i < kN; i++) { + // FIXME: use a parameter to enable pivoting? + if (USE_PIVOT_SEARCH) + { + /* Find the row with the largest first value */ + int maxrow = i; + for (int j = i + 1; j < kN; j++) + { + if (fabs(m_A[j][i]) > fabs(m_A[maxrow][i])) + maxrow = j; + } - if (maxrow != i) - { - /* Swap the maxrow and ith row */ - for (int k = i; k < kN; k++) { - std::swap(m_A[i][k], m_A[maxrow][k]); - } - std::swap(m_RHS[i], m_RHS[maxrow]); - } - } + if (maxrow != i) + { + /* Swap the maxrow and ith row */ + for (int k = i; k < kN; k++) { + std::swap(m_A[i][k], m_A[maxrow][k]); + } + std::swap(m_RHS[i], m_RHS[maxrow]); + } + } - /* FIXME: Singular matrix? */ - const double f = 1.0 / m_A[i][i]; + /* FIXME: Singular matrix? */ + const double f = 1.0 / m_A[i][i]; - /* Eliminate column i from row j */ + /* Eliminate column i from row j */ - for (int j = i + 1; j < kN; j++) - { - const double f1 = - m_A[j][i] * f; - if (f1 != 0.0) - { + for (int j = i + 1; j < kN; j++) + { + const double f1 = - m_A[j][i] * f; + if (f1 != 0.0) + { #if 0 && VECTALT - for (int k = i + 1; k < kN; k++) - m_A[j][k] += m_A[i][k] * f1; + for (int k = i + 1; k < kN; k++) + m_A[j][k] += m_A[i][k] * f1; #else - // addmult gives some performance increase here... - m_row_ops[kN - (i + 1)]->addmult(&m_A[j][i+1], &m_A[i][i+1], f1) ; + // addmult gives some performance increase here... + m_row_ops[kN - (i + 1)]->addmult(&m_A[j][i+1], &m_A[i][i+1], f1) ; #endif - m_RHS[j] += m_RHS[i] * f1; - } - } - } - /* back substitution */ - for (int j = kN - 1; j >= 0; j--) - { - double tmp = 0; + m_RHS[j] += m_RHS[i] * f1; + } + } + } + /* back substitution */ + for (int j = kN - 1; j >= 0; j--) + { + double tmp = 0; - for (int k = j + 1; k < kN; k++) - tmp += m_A[j][k] * x[k]; + for (int k = j + 1; k < kN; k++) + tmp += m_A[j][k] * x[k]; - x[j] = (m_RHS[j] - tmp) / m_A[j][j]; - } + x[j] = (m_RHS[j] - tmp) / m_A[j][j]; + } #if 0 - printf("Solution:\n"); - for (int i = 0; i < N(); i++) - { - for (int k = 0; k < N(); k++) - printf("%f ", m_A[i][k]); - printf("| %f = %f \n", x[i], m_RHS[i]); - } - printf("\n"); + printf("Solution:\n"); + for (int i = 0; i < N(); i++) + { + for (int k = 0; k < N(); k++) + printf("%f ", m_A[i][k]); + printf("| %f = %f \n", x[i], m_RHS[i]); + } + printf("\n"); #endif } template ATTR_HOT double netlist_matrix_solver_direct_t::delta( - const double (* RESTRICT V)) + const double (* RESTRICT V)) { - double cerr = 0; - double cerr2 = 0; - for (int i = 0; i < this->N(); i++) - { - const double e = (V[i] - this->m_nets[i]->m_cur_Analog); - const double e2 = (m_RHS[i] - this->m_last_RHS[i]); - cerr = (fabs(e) > cerr ? fabs(e) : cerr); - cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2); - } - // FIXME: Review - return cerr + cerr2*100000.0; + double cerr = 0; + double cerr2 = 0; + for (int i = 0; i < this->N(); i++) + { + const double e = (V[i] - this->m_nets[i]->m_cur_Analog); + const double e2 = (m_RHS[i] - this->m_last_RHS[i]); + cerr = (fabs(e) > cerr ? fabs(e) : cerr); + cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2); + } + // FIXME: Review + return cerr + cerr2*100000.0; } template ATTR_HOT void netlist_matrix_solver_direct_t::store( - const double (* RESTRICT V), const bool store_RHS) + const double (* RESTRICT V), const bool store_RHS) { - for (int i = 0; i < this->N(); i++) - { - this->m_nets[i]->m_cur_Analog = V[i]; - } - if (store_RHS) - { - for (int i = 0; i < this->N(); i++) - { - this->m_last_RHS[i] = m_RHS[i]; - } - } + for (int i = 0; i < this->N(); i++) + { + this->m_nets[i]->m_cur_Analog = V[i]; + } + if (store_RHS) + { + for (int i = 0; i < this->N(); i++) + { + this->m_last_RHS[i] = m_RHS[i]; + } + } } template ATTR_HOT double netlist_matrix_solver_direct_t::vsolve() { - solve_base(this); - return this->compute_next_timestep(); + solve_base(this); + return this->compute_next_timestep(); } template ATTR_HOT int netlist_matrix_solver_direct_t::solve_non_dynamic() { - double new_v[_storage_N] = { 0.0 }; + double new_v[_storage_N] = { 0.0 }; - this->gauss_LE(new_v); + this->gauss_LE(new_v); - if (this->is_dynamic()) - { - double err = delta(new_v); + if (this->is_dynamic()) + { + double err = delta(new_v); - store(new_v, true); + store(new_v, true); - if (err > this->m_params.m_accuracy) - { - return 2; - } - return 1; - } - store(new_v, false); // ==> No need to store RHS - return 1; + if (err > this->m_params.m_accuracy) + { + return 2; + } + return 1; + } + store(new_v, false); // ==> No need to store RHS + return 1; } template ATTR_HOT inline int netlist_matrix_solver_direct_t::vsolve_non_dynamic() { - this->build_LE(); + this->build_LE(); - return this->solve_non_dynamic(); + return this->solve_non_dynamic(); } template @@ -448,15 +447,15 @@ netlist_matrix_solver_direct_t::netlist_matrix_solver_direct_t( , m_dim(size) , m_lp_fact(0) { - m_terms = new terms_t *[N()]; - m_rails_temp = new terms_t[N()]; + m_terms = new terms_t *[N()]; + m_rails_temp = new terms_t[N()]; - for (int k = 0; k < N(); k++) - { - m_terms[k] = new terms_t; - m_row_ops[k] = vector_ops_t::create_ops(k); - } - m_row_ops[N()] = vector_ops_t::create_ops(N()); + for (int k = 0; k < N(); k++) + { + m_terms[k] = new terms_t; + m_row_ops[k] = vector_ops_t::create_ops(k); + } + m_row_ops[N()] = vector_ops_t::create_ops(N()); } diff --git a/src/emu/netlist/analog/nld_ms_direct1.h b/src/emu/netlist/analog/nld_ms_direct1.h index f562ea93dff..57c66daf82b 100644 --- a/src/emu/netlist/analog/nld_ms_direct1.h +++ b/src/emu/netlist/analog/nld_ms_direct1.h @@ -13,12 +13,12 @@ class ATTR_ALIGNED(64) netlist_matrix_solver_direct1_t: public netlist_matrix_so { public: - netlist_matrix_solver_direct1_t(const netlist_solver_parameters_t ¶ms) - : netlist_matrix_solver_direct_t<1, 1>(params, 1) - {} - ATTR_HOT inline int vsolve_non_dynamic(); + netlist_matrix_solver_direct1_t(const netlist_solver_parameters_t ¶ms) + : netlist_matrix_solver_direct_t<1, 1>(params, 1) + {} + ATTR_HOT inline int vsolve_non_dynamic(); protected: - ATTR_HOT virtual double vsolve(); + ATTR_HOT virtual double vsolve(); private: }; @@ -28,30 +28,29 @@ private: ATTR_HOT double netlist_matrix_solver_direct1_t::vsolve() { - solve_base(this); - return this->compute_next_timestep(); + solve_base(this); + return this->compute_next_timestep(); } ATTR_HOT inline int netlist_matrix_solver_direct1_t::vsolve_non_dynamic() { + netlist_analog_net_t *net = m_nets[0]; + this->build_LE(); + //NL_VERBOSE_OUT(("%f %f\n", new_val, m_RHS[0] / m_A[0][0]); - netlist_analog_net_t *net = m_nets[0]; - this->build_LE(); - //NL_VERBOSE_OUT(("%f %f\n", new_val, m_RHS[0] / m_A[0][0]); + double new_val = m_RHS[0] / m_A[0][0]; - double new_val = m_RHS[0] / m_A[0][0]; + double e = (new_val - net->m_cur_Analog); + double cerr = fabs(e); - double e = (new_val - net->m_cur_Analog); - double cerr = fabs(e); + net->m_cur_Analog = new_val; - net->m_cur_Analog = new_val; - - if (is_dynamic() && (cerr > m_params.m_accuracy)) - { - return 2; - } - else - return 1; + if (is_dynamic() && (cerr > m_params.m_accuracy)) + { + return 2; + } + else + return 1; } diff --git a/src/emu/netlist/analog/nld_ms_direct2.h b/src/emu/netlist/analog/nld_ms_direct2.h index 03bfc2b7429..9d7074b4d02 100644 --- a/src/emu/netlist/analog/nld_ms_direct2.h +++ b/src/emu/netlist/analog/nld_ms_direct2.h @@ -15,12 +15,12 @@ class ATTR_ALIGNED(64) netlist_matrix_solver_direct2_t: public netlist_matrix_so { public: - netlist_matrix_solver_direct2_t(const netlist_solver_parameters_t ¶ms) - : netlist_matrix_solver_direct_t<2, 2>(params, 2) - {} - ATTR_HOT inline int vsolve_non_dynamic(); + netlist_matrix_solver_direct2_t(const netlist_solver_parameters_t ¶ms) + : netlist_matrix_solver_direct_t<2, 2>(params, 2) + {} + ATTR_HOT inline int vsolve_non_dynamic(); protected: - ATTR_HOT virtual double vsolve(); + ATTR_HOT virtual double vsolve(); private: }; @@ -30,35 +30,34 @@ private: ATTR_HOT double netlist_matrix_solver_direct2_t::vsolve() { - solve_base(this); - return this->compute_next_timestep(); + solve_base(this); + return this->compute_next_timestep(); } ATTR_HOT inline int netlist_matrix_solver_direct2_t::vsolve_non_dynamic() { + build_LE(); - build_LE(); + const double a = m_A[0][0]; + const double b = m_A[0][1]; + const double c = m_A[1][0]; + const double d = m_A[1][1]; - const double a = m_A[0][0]; - const double b = m_A[0][1]; - const double c = m_A[1][0]; - const double d = m_A[1][1]; + double new_val[2]; + new_val[1] = (a * m_RHS[1] - c * m_RHS[0]) / (a * d - b * c); + new_val[0] = (m_RHS[0] - b * new_val[1]) / a; - double new_val[2]; - new_val[1] = (a * m_RHS[1] - c * m_RHS[0]) / (a * d - b * c); - new_val[0] = (m_RHS[0] - b * new_val[1]) / a; - - if (is_dynamic()) - { - double err = this->delta(new_val); - store(new_val, true); - if (err > m_params.m_accuracy ) - return 2; - else - return 1; - } - store(new_val, false); - return 1; + if (is_dynamic()) + { + double err = this->delta(new_val); + store(new_val, true); + if (err > m_params.m_accuracy ) + return 2; + else + return 1; + } + store(new_val, false); + return 1; } diff --git a/src/emu/netlist/analog/nld_ms_gauss_seidel.h b/src/emu/netlist/analog/nld_ms_gauss_seidel.h index ba4a23eb622..270aaf227a3 100644 --- a/src/emu/netlist/analog/nld_ms_gauss_seidel.h +++ b/src/emu/netlist/analog/nld_ms_gauss_seidel.h @@ -16,25 +16,25 @@ class ATTR_ALIGNED(64) netlist_matrix_solver_gauss_seidel_t: public netlist_matr { public: - netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t ¶ms, int size) - : netlist_matrix_solver_direct_t(params, size) - , m_lp_fact(0) - , m_gs_fail(0) - , m_gs_total(0) - {} + netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t ¶ms, int size) + : netlist_matrix_solver_direct_t(params, size) + , m_lp_fact(0) + , m_gs_fail(0) + , m_gs_total(0) + {} - virtual ~netlist_matrix_solver_gauss_seidel_t() {} + virtual ~netlist_matrix_solver_gauss_seidel_t() {} - ATTR_COLD virtual void log_stats(); + ATTR_COLD virtual void log_stats(); - ATTR_HOT inline int vsolve_non_dynamic(); + ATTR_HOT inline int vsolve_non_dynamic(); protected: - ATTR_HOT virtual double vsolve(); + ATTR_HOT virtual double vsolve(); private: - double m_lp_fact; - int m_gs_fail; - int m_gs_total; + double m_lp_fact; + int m_gs_fail; + int m_gs_total; }; @@ -46,307 +46,307 @@ template void netlist_matrix_solver_gauss_seidel_t::log_stats() { #if 0 - if (this->m_calculations == 0) - return; - printf("==============================================\n"); - printf("Solver %s\n", this->name().cstr()); - printf(" ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); - printf(" has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic"); - printf(" has %s elements\n", this->is_timestep() ? "timestep" : "no timestep"); - printf(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n", - this->m_calculations, - this->m_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), - this->m_gs_fail, - 100.0 * (double) this->m_gs_fail / (double) this->m_calculations, - (double) this->m_gs_total / (double) this->m_calculations); + if (this->m_calculations == 0) + return; + printf("==============================================\n"); + printf("Solver %s\n", this->name().cstr()); + printf(" ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); + printf(" has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic"); + printf(" has %s elements\n", this->is_timestep() ? "timestep" : "no timestep"); + printf(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n", + this->m_calculations, + this->m_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), + this->m_gs_fail, + 100.0 * (double) this->m_gs_fail / (double) this->m_calculations, + (double) this->m_gs_total / (double) this->m_calculations); #endif } template ATTR_HOT double netlist_matrix_solver_gauss_seidel_t::vsolve() { - /* - * enable linear prediction on first newton pass - */ + /* + * enable linear prediction on first newton pass + */ - if (USE_LINEAR_PREDICTION) - for (int k = 0; k < this->N(); k++) - { - this->m_last_V[k] = this->m_nets[k]->m_cur_Analog; - this->m_nets[k]->m_cur_Analog = this->m_nets[k]->m_cur_Analog + this->m_Vdelta[k] * this->current_timestep() * m_lp_fact; - } - else - for (int k = 0; k < this->N(); k++) - { - this->m_last_V[k] = this->m_nets[k]->m_cur_Analog; - } + if (USE_LINEAR_PREDICTION) + for (int k = 0; k < this->N(); k++) + { + this->m_last_V[k] = this->m_nets[k]->m_cur_Analog; + this->m_nets[k]->m_cur_Analog = this->m_nets[k]->m_cur_Analog + this->m_Vdelta[k] * this->current_timestep() * m_lp_fact; + } + else + for (int k = 0; k < this->N(); k++) + { + this->m_last_V[k] = this->m_nets[k]->m_cur_Analog; + } - this->solve_base(this); + this->solve_base(this); - if (USE_LINEAR_PREDICTION) - { - double sq = 0; - double sqo = 0; - const double rez_cts = 1.0 / this->current_timestep(); - for (int k = 0; k < this->N(); k++) - { - const netlist_analog_net_t *n = this->m_nets[k]; - const double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ; - sq += nv * nv; - sqo += this->m_Vdelta[k] * this->m_Vdelta[k]; - this->m_Vdelta[k] = nv; - } - if (sqo > 1e-90) - m_lp_fact = std::min(sqrt(sq/sqo), 2.0); - else - m_lp_fact = 0.0; - } + if (USE_LINEAR_PREDICTION) + { + double sq = 0; + double sqo = 0; + const double rez_cts = 1.0 / this->current_timestep(); + for (int k = 0; k < this->N(); k++) + { + const netlist_analog_net_t *n = this->m_nets[k]; + const double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ; + sq += nv * nv; + sqo += this->m_Vdelta[k] * this->m_Vdelta[k]; + this->m_Vdelta[k] = nv; + } + if (sqo > 1e-90) + m_lp_fact = std::min(sqrt(sq/sqo), 2.0); + else + m_lp_fact = 0.0; + } - return this->compute_next_timestep(); + return this->compute_next_timestep(); } template ATTR_HOT inline int netlist_matrix_solver_gauss_seidel_t::vsolve_non_dynamic() { - /* The matrix based code looks a lot nicer but actually is 30% slower than - * the optimized code which works directly on the data structures. - * Need something like that for gaussian elimination as well. - */ + /* The matrix based code looks a lot nicer but actually is 30% slower than + * the optimized code which works directly on the data structures. + * Need something like that for gaussian elimination as well. + */ #if 0 || USE_MATRIX_GS - static double ws = 1.0; - ATTR_ALIGN double new_v[_storage_N] = { 0.0 }; - const int iN = this->N(); + static double ws = 1.0; + ATTR_ALIGN double new_v[_storage_N] = { 0.0 }; + const int iN = this->N(); - bool resched = false; + bool resched = false; - int resched_cnt = 0; + int resched_cnt = 0; - this->build_LE(); + this->build_LE(); - { - double frob; - frob = 0; - double rmin = 1e99, rmax = -1e99; - for (int k = 0; k < iN; k++) - { - new_v[k] = this->m_nets[k]->m_cur_Analog; - double s=0.0; - for (int i = 0; i < iN; i++) - { - frob += this->m_A[k][i] * this->m_A[k][i]; - s = s + fabs(this->m_A[k][i]); - } + { + double frob; + frob = 0; + double rmin = 1e99, rmax = -1e99; + for (int k = 0; k < iN; k++) + { + new_v[k] = this->m_nets[k]->m_cur_Analog; + double s=0.0; + for (int i = 0; i < iN; i++) + { + frob += this->m_A[k][i] * this->m_A[k][i]; + s = s + fabs(this->m_A[k][i]); + } - if (srmax) - rmax = s; - } + if (srmax) + rmax = s; + } #if 0 - double frobA = sqrt(frob /(iN)); - if (1 &&frobA < 1.0) - //ws = 2.0 / (1.0 + sqrt(1.0-frobA)); - ws = 2.0 / (2.0 - frobA); - else - ws = 1.0; - ws = 0.9; + double frobA = sqrt(frob /(iN)); + if (1 &&frobA < 1.0) + //ws = 2.0 / (1.0 + sqrt(1.0-frobA)); + ws = 2.0 / (2.0 - frobA); + else + ws = 1.0; + ws = 0.9; #else - // calculate an estimate for rho. - // This is based on the Perron–Frobenius theorem for positive matrices. - // No mathematical proof here. The following estimates the - // optimal relaxation parameter pretty well. Unfortunately, the - // overhead is bigger than the gain. Consequently the fast GS below - // uses a fixed GS. One can however use this here to determine a - // suitable parameter. - double rm = (rmax + rmin) * 0.5; - if (rm < 1.0) - ws = 2.0 / (1.0 + sqrt(1.0-rm)); - else - ws = 1.0; - if (ws > 1.02 && rmax > 1.001) - printf("rmin %f rmax %f ws %f\n", rmin, rmax, ws); + // calculate an estimate for rho. + // This is based on the Perron???Frobenius theorem for positive matrices. + // No mathematical proof here. The following estimates the + // optimal relaxation parameter pretty well. Unfortunately, the + // overhead is bigger than the gain. Consequently the fast GS below + // uses a fixed GS. One can however use this here to determine a + // suitable parameter. + double rm = (rmax + rmin) * 0.5; + if (rm < 1.0) + ws = 2.0 / (1.0 + sqrt(1.0-rm)); + else + ws = 1.0; + if (ws > 1.02 && rmax > 1.001) + printf("rmin %f rmax %f ws %f\n", rmin, rmax, ws); #endif - } + } - // Frobenius norm for (D-L)^(-1)U - //double frobU; - //double frobL; - //double norm; - do { - resched = false; - double cerr = 0.0; - //frobU = 0; - //frobL = 0; - //norm = 0; + // Frobenius norm for (D-L)^(-1)U + //double frobU; + //double frobL; + //double norm; + do { + resched = false; + double cerr = 0.0; + //frobU = 0; + //frobL = 0; + //norm = 0; - for (int k = 0; k < iN; k++) - { - double Idrive = 0; - //double norm_t = 0; - // Reduction loops need -ffast-math - for (int i = 0; i < iN; i++) - Idrive += this->m_A[k][i] * new_v[i]; + for (int k = 0; k < iN; k++) + { + double Idrive = 0; + //double norm_t = 0; + // Reduction loops need -ffast-math + for (int i = 0; i < iN; i++) + Idrive += this->m_A[k][i] * new_v[i]; - for (int i = 0; i < iN; i++) - { - //if (i < k) frobL += this->m_A[k][i] * this->m_A[k][i] / this->m_A[k][k] /this-> m_A[k][k]; - //if (i > k) frobU += this->m_A[k][i] * this->m_A[k][i] / this->m_A[k][k] / this->m_A[k][k]; - //norm_t += fabs(this->m_A[k][i]); - } + for (int i = 0; i < iN; i++) + { + //if (i < k) frobL += this->m_A[k][i] * this->m_A[k][i] / this->m_A[k][k] /this-> m_A[k][k]; + //if (i > k) frobU += this->m_A[k][i] * this->m_A[k][i] / this->m_A[k][k] / this->m_A[k][k]; + //norm_t += fabs(this->m_A[k][i]); + } - //if (norm_t > norm) norm = norm_t; - const double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k]; + //if (norm_t > norm) norm = norm_t; + const double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k]; - const double e = fabs(new_val - new_v[k]); - cerr = (e > cerr ? e : cerr); - new_v[k] = new_val; - } + const double e = fabs(new_val - new_v[k]); + cerr = (e > cerr ? e : cerr); + new_v[k] = new_val; + } - if (cerr > this->m_params.m_accuracy) - { - resched = true; - } - resched_cnt++; - //ATTR_UNUSED double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN)); - } while (resched && (resched_cnt < this->m_params.m_gs_loops)); - //printf("Frobenius %f %f %f %f %f\n", sqrt(frobU), sqrt(frobL), frobUL, frobA, norm); - //printf("Omega Estimate1 %f %f\n", 2.0 / (1.0 + sqrt(1-frobUL)), 2.0 / (1.0 + sqrt(1-frobA)) ); // printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) )); - //printf("Omega Estimate2 %f %f\n", 2.0 / (2.0 - frobUL), 2.0 / (2.0 - frobA) ); // printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) )); + if (cerr > this->m_params.m_accuracy) + { + resched = true; + } + resched_cnt++; + //ATTR_UNUSED double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN)); + } while (resched && (resched_cnt < this->m_params.m_gs_loops)); + //printf("Frobenius %f %f %f %f %f\n", sqrt(frobU), sqrt(frobL), frobUL, frobA, norm); + //printf("Omega Estimate1 %f %f\n", 2.0 / (1.0 + sqrt(1-frobUL)), 2.0 / (1.0 + sqrt(1-frobA)) ); // printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) )); + //printf("Omega Estimate2 %f %f\n", 2.0 / (2.0 - frobUL), 2.0 / (2.0 - frobA) ); // printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) )); - this->store(new_v, false); + this->store(new_v, false); - this->m_gs_total += resched_cnt; - if (resched) - { - //this->netlist().warning("Falling back to direct solver .. Consider increasing RESCHED_LOOPS"); - this->m_gs_fail++; - int tmp = netlist_matrix_solver_direct_t::solve_non_dynamic(); - this->m_calculations++; - return tmp; - } - else { - this->m_calculations++; + this->m_gs_total += resched_cnt; + if (resched) + { + //this->netlist().warning("Falling back to direct solver .. Consider increasing RESCHED_LOOPS"); + this->m_gs_fail++; + int tmp = netlist_matrix_solver_direct_t::solve_non_dynamic(); + this->m_calculations++; + return tmp; + } + else { + this->m_calculations++; - return resched_cnt; - } + return resched_cnt; + } #else - const int iN = this->N(); - bool resched = false; - int resched_cnt = 0; + const int iN = this->N(); + bool resched = false; + int resched_cnt = 0; - /* ideally, we could get an estimate for the spectral radius of - * Inv(D - L) * U - * - * and estimate using - * - * omega = 2.0 / (1.0 + sqrt(1-rho)) - */ + /* ideally, we could get an estimate for the spectral radius of + * Inv(D - L) * U + * + * and estimate using + * + * omega = 2.0 / (1.0 + sqrt(1-rho)) + */ - const double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1))); - //const double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N()))); + const double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1))); + //const double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N()))); - ATTR_ALIGN double w[_storage_N]; - ATTR_ALIGN double one_m_w[_storage_N]; - ATTR_ALIGN double RHS[_storage_N]; - ATTR_ALIGN double new_V[_storage_N]; + ATTR_ALIGN double w[_storage_N]; + ATTR_ALIGN double one_m_w[_storage_N]; + ATTR_ALIGN double RHS[_storage_N]; + ATTR_ALIGN double new_V[_storage_N]; - for (int k = 0; k < iN; k++) - { - double gtot_t = 0.0; - double gabs_t = 0.0; - double RHS_t = 0.0; + for (int k = 0; k < iN; k++) + { + double gtot_t = 0.0; + double gabs_t = 0.0; + double RHS_t = 0.0; - new_V[k] = this->m_nets[k]->m_cur_Analog; + new_V[k] = this->m_nets[k]->m_cur_Analog; - { - const int term_count = this->m_terms[k]->count(); - const double * const RESTRICT gt = this->m_terms[k]->gt(); - const double * const RESTRICT go = this->m_terms[k]->go(); - const double * const RESTRICT Idr = this->m_terms[k]->Idr(); - const double * const *other_cur_analog = this->m_terms[k]->other_curanalog(); + { + const int term_count = this->m_terms[k]->count(); + const double * const RESTRICT gt = this->m_terms[k]->gt(); + const double * const RESTRICT go = this->m_terms[k]->go(); + const double * const RESTRICT Idr = this->m_terms[k]->Idr(); + const double * const *other_cur_analog = this->m_terms[k]->other_curanalog(); #if VECTALT - for (int i = 0; i < term_count; i++) - { - gtot_t = gtot_t + gt[i]; - RHS_t = RHS_t + Idr[i]; - } - if (USE_GABS) - for (int i = 0; i < term_count; i++) - gabs_t = gabs_t + fabs(go[i]); + for (int i = 0; i < term_count; i++) + { + gtot_t = gtot_t + gt[i]; + RHS_t = RHS_t + Idr[i]; + } + if (USE_GABS) + for (int i = 0; i < term_count; i++) + gabs_t = gabs_t + fabs(go[i]); #else - if (USE_GABS) - this->m_terms[k]->ops()->sum2a(gt, Idr, go, gtot_t, RHS_t, gabs_t); - else - this->m_terms[k]->ops()->sum2(gt, Idr, gtot_t, RHS_t); + if (USE_GABS) + this->m_terms[k]->ops()->sum2a(gt, Idr, go, gtot_t, RHS_t, gabs_t); + else + this->m_terms[k]->ops()->sum2(gt, Idr, gtot_t, RHS_t); #endif - for (int i = this->m_terms[k]->m_railstart; i < term_count; i++) - RHS_t = RHS_t + go[i] * *other_cur_analog[i]; - } + for (int i = this->m_terms[k]->m_railstart; i < term_count; i++) + RHS_t = RHS_t + go[i] * *other_cur_analog[i]; + } - RHS[k] = RHS_t; + RHS[k] = RHS_t; - //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20) - // printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t); + //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20) + // printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t); - gabs_t *= 0.5; // avoid rounding issues - if (!USE_GABS || gabs_t <= gtot_t) - { - w[k] = ws / gtot_t; - one_m_w[k] = 1.0 - ws; - } - else - { - //printf("abs: %f tot: %f\n", gabs_t, gtot_t); - w[k] = 1.0 / (gtot_t + gabs_t); - one_m_w[k] = 1.0 - 1.0 * gtot_t / (gtot_t + gabs_t); - } + gabs_t *= 0.5; // avoid rounding issues + if (!USE_GABS || gabs_t <= gtot_t) + { + w[k] = ws / gtot_t; + one_m_w[k] = 1.0 - ws; + } + else + { + //printf("abs: %f tot: %f\n", gabs_t, gtot_t); + w[k] = 1.0 / (gtot_t + gabs_t); + one_m_w[k] = 1.0 - 1.0 * gtot_t / (gtot_t + gabs_t); + } - } + } - const double accuracy = this->m_params.m_accuracy; + const double accuracy = this->m_params.m_accuracy; - do { - resched = false; + do { + resched = false; - for (int k = 0; k < iN; k++) - { - const int * RESTRICT net_other = this->m_terms[k]->net_other(); - const int railstart = this->m_terms[k]->m_railstart; - const double * RESTRICT go = this->m_terms[k]->go(); + for (int k = 0; k < iN; k++) + { + const int * RESTRICT net_other = this->m_terms[k]->net_other(); + const int railstart = this->m_terms[k]->m_railstart; + const double * RESTRICT go = this->m_terms[k]->go(); - double Idrive = 0.0; - for (int i = 0; i < railstart; i++) - Idrive = Idrive + go[i] * new_V[net_other[i]]; + double Idrive = 0.0; + for (int i = 0; i < railstart; i++) + Idrive = Idrive + go[i] * new_V[net_other[i]]; - //double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]); - const double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k]; + //double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]); + const double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k]; - resched = resched || (std::abs(new_val - new_V[k]) > accuracy); - new_V[k] = new_val; - } + resched = resched || (std::abs(new_val - new_V[k]) > accuracy); + new_V[k] = new_val; + } - resched_cnt++; - } while (resched && (resched_cnt < this->m_params.m_gs_loops)); + resched_cnt++; + } while (resched && (resched_cnt < this->m_params.m_gs_loops)); - for (int k = 0; k < iN; k++) - this->m_nets[k]->m_cur_Analog = new_V[k]; + for (int k = 0; k < iN; k++) + this->m_nets[k]->m_cur_Analog = new_V[k]; - this->m_gs_total += resched_cnt; - this->m_calculations++; + this->m_gs_total += resched_cnt; + this->m_calculations++; - if (resched) - { - //this->netlist().warning("Falling back to direct solver .. Consider increasing RESCHED_LOOPS"); - this->m_gs_fail++; - return netlist_matrix_solver_direct_t::vsolve_non_dynamic(); - } - else { - return resched_cnt; - } + if (resched) + { + //this->netlist().warning("Falling back to direct solver .. Consider increasing RESCHED_LOOPS"); + this->m_gs_fail++; + return netlist_matrix_solver_direct_t::vsolve_non_dynamic(); + } + else { + return resched_cnt; + } #endif } diff --git a/src/emu/netlist/analog/nld_opamps.h b/src/emu/netlist/analog/nld_opamps.h index d0d9a89d6b7..4433114a18c 100644 --- a/src/emu/netlist/analog/nld_opamps.h +++ b/src/emu/netlist/analog/nld_opamps.h @@ -19,7 +19,7 @@ // ---------------------------------------------------------------------------------------- #define LM3900(_name) \ - SUBMODEL(_name, opamp_lm3900) + SUBMODEL(_name, opamp_lm3900) // ---------------------------------------------------------------------------------------- // Devices ... diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index 52f15cee8f8..a0f6ea470f9 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -45,31 +45,31 @@ struct netlist_solver_parameters_t bool m_dynamic; int m_gs_loops; int m_nr_loops; - netlist_time m_nt_sync_delay; + netlist_time m_nt_sync_delay; }; class vector_ops_t { public: - vector_ops_t(int size) - : m_dim(size) - { - } + vector_ops_t(int size) + : m_dim(size) + { + } - virtual ~vector_ops_t() {} + virtual ~vector_ops_t() {} - virtual const double sum(const double * v) = 0; - virtual void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2) = 0; - virtual void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) = 0; - virtual void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) = 0; + virtual const double sum(const double * v) = 0; + virtual void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2) = 0; + virtual void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) = 0; + virtual void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) = 0; - virtual const double sumabs(const double * v) = 0; + virtual const double sumabs(const double * v) = 0; - static vector_ops_t *create_ops(const int size); + static vector_ops_t *create_ops(const int size); protected: - int m_dim; + int m_dim; private: @@ -80,115 +80,115 @@ class vector_ops_impl_t : public vector_ops_t { public: - vector_ops_impl_t() - : vector_ops_t(m_N) - { - } + vector_ops_impl_t() + : vector_ops_t(m_N) + { + } - vector_ops_impl_t(int size) - : vector_ops_t(size) - { - assert(m_N == 0); - } + vector_ops_impl_t(int size) + : vector_ops_t(size) + { + assert(m_N == 0); + } - virtual ~vector_ops_impl_t() {} + virtual ~vector_ops_impl_t() {} - ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } + ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } - const double sum(const double * v) - { - const double * RESTRICT vl = v; - double tmp = 0.0; - for (int i=0; i < N(); i++) - tmp += vl[i]; - return tmp; - } + const double sum(const double * v) + { + const double * RESTRICT vl = v; + double tmp = 0.0; + for (int i=0; i < N(); i++) + tmp += vl[i]; + return tmp; + } - void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2) - { - const double * RESTRICT v1l = v1; - const double * RESTRICT v2l = v2; - for (int i=0; i < N(); i++) - { - s1 += v1l[i]; - s2 += v2l[i]; - } - } + void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2) + { + const double * RESTRICT v1l = v1; + const double * RESTRICT v2l = v2; + for (int i=0; i < N(); i++) + { + s1 += v1l[i]; + s2 += v2l[i]; + } + } - void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) - { - double * RESTRICT v1l = v1; - const double * RESTRICT v2l = v2; - for (int i=0; i < N(); i++) - { - v1l[i] += v2l[i] * mult; - } - } + void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) + { + double * RESTRICT v1l = v1; + const double * RESTRICT v2l = v2; + for (int i=0; i < N(); i++) + { + v1l[i] += v2l[i] * mult; + } + } - void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) - { - const double * RESTRICT v1l = v1; - const double * RESTRICT v2l = v2; - const double * RESTRICT v3l = v3abs; - for (int i=0; i < N(); i++) - { - s1 += v1l[i]; - s2 += v2l[i]; - s3abs += fabs(v3l[i]); - } - } + void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) + { + const double * RESTRICT v1l = v1; + const double * RESTRICT v2l = v2; + const double * RESTRICT v3l = v3abs; + for (int i=0; i < N(); i++) + { + s1 += v1l[i]; + s2 += v2l[i]; + s3abs += fabs(v3l[i]); + } + } - const double sumabs(const double * v) - { - const double * RESTRICT vl = v; - double tmp = 0.0; - for (int i=0; i < N(); i++) - tmp += fabs(vl[i]); - return tmp; - } + const double sumabs(const double * v) + { + const double * RESTRICT vl = v; + double tmp = 0.0; + for (int i=0; i < N(); i++) + tmp += fabs(vl[i]); + return tmp; + } private: }; class ATTR_ALIGNED(64) terms_t { - NETLIST_PREVENT_COPYING(terms_t) + NETLIST_PREVENT_COPYING(terms_t) - public: - ATTR_COLD terms_t() : m_railstart(0), m_ops(NULL) - {} + public: + ATTR_COLD terms_t() : m_railstart(0), m_ops(NULL) + {} - ATTR_COLD void clear() - { - m_term.clear(); - m_net_other.clear(); - m_gt.clear(); - } + ATTR_COLD void clear() + { + m_term.clear(); + m_net_other.clear(); + m_gt.clear(); + } - ATTR_COLD void add(netlist_terminal_t *term, int net_other); + ATTR_COLD void add(netlist_terminal_t *term, int net_other); - ATTR_HOT inline int count() { return m_term.count(); } + ATTR_HOT inline int count() { return m_term.count(); } - ATTR_HOT inline netlist_terminal_t **terms() { return m_term; } - ATTR_HOT inline int *net_other() { return m_net_other; } - ATTR_HOT inline double *gt() { return m_gt; } - ATTR_HOT inline double *go() { return m_go; } - ATTR_HOT inline double *Idr() { return m_Idr; } - ATTR_HOT inline double **other_curanalog() { return m_other_curanalog; } - ATTR_HOT vector_ops_t *ops() { return m_ops; } + ATTR_HOT inline netlist_terminal_t **terms() { return m_term; } + ATTR_HOT inline int *net_other() { return m_net_other; } + ATTR_HOT inline double *gt() { return m_gt; } + ATTR_HOT inline double *go() { return m_go; } + ATTR_HOT inline double *Idr() { return m_Idr; } + ATTR_HOT inline double **other_curanalog() { return m_other_curanalog; } + ATTR_HOT vector_ops_t *ops() { return m_ops; } - ATTR_COLD void set_pointers(); + ATTR_COLD void set_pointers(); - int m_railstart; + int m_railstart; private: - plinearlist_t m_term; - plinearlist_t m_net_other; - plinearlist_t m_go; - plinearlist_t m_gt; - plinearlist_t m_Idr; - plinearlist_t m_other_curanalog; - vector_ops_t * m_ops; + plinearlist_t m_term; + plinearlist_t m_net_other; + plinearlist_t m_go; + plinearlist_t m_gt; + plinearlist_t m_Idr; + plinearlist_t m_other_curanalog; + vector_ops_t * m_ops; }; class netlist_matrix_solver_t : public netlist_device_t @@ -200,60 +200,60 @@ public: ATTR_COLD netlist_matrix_solver_t(const netlist_solver_parameters_t ¶ms); ATTR_COLD virtual ~netlist_matrix_solver_t(); - ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets) = 0; + ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets) = 0; - template - void solve_base(C *p); + template + void solve_base(C *p); ATTR_HOT double solve(); ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; } ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; } - ATTR_HOT void update_forced(); - ATTR_HOT inline void update_after(const netlist_time after) - { - m_Q_sync.net().reschedule_in_queue(after); - } + ATTR_HOT void update_forced(); + ATTR_HOT inline void update_after(const netlist_time after) + { + m_Q_sync.net().reschedule_in_queue(after); + } /* netdevice functions */ ATTR_HOT virtual void update(); - ATTR_COLD virtual void start(); - ATTR_COLD virtual void reset(); + ATTR_COLD virtual void start(); + ATTR_COLD virtual void reset(); - ATTR_COLD int get_net_idx(netlist_net_t *net); + ATTR_COLD int get_net_idx(netlist_net_t *net); ATTR_COLD virtual void log_stats() {}; protected: - ATTR_COLD void setup(netlist_analog_net_t::list_t &nets); - ATTR_HOT void update_dynamic(); + ATTR_COLD void setup(netlist_analog_net_t::list_t &nets); + ATTR_HOT void update_dynamic(); - // should return next time step - ATTR_HOT virtual double vsolve() = 0; + // should return next time step + ATTR_HOT virtual double vsolve() = 0; - ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term) = 0; + ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term) = 0; - plinearlist_t m_nets; - plinearlist_t m_inps; + plinearlist_t m_nets; + plinearlist_t m_inps; - int m_calculations; - const netlist_solver_parameters_t &m_params; + int m_calculations; + const netlist_solver_parameters_t &m_params; - ATTR_HOT inline const double current_timestep() { return m_cur_ts; } + ATTR_HOT inline const double current_timestep() { return m_cur_ts; } private: - netlist_time m_last_step; - double m_cur_ts; - dev_list_t m_step_devices; - dev_list_t m_dynamic_devices; + netlist_time m_last_step; + double m_cur_ts; + dev_list_t m_step_devices; + dev_list_t m_dynamic_devices; - netlist_ttl_input_t m_fb_sync; - netlist_ttl_output_t m_Q_sync; + netlist_ttl_input_t m_fb_sync; + netlist_ttl_output_t m_Q_sync; - ATTR_HOT void step(const netlist_time delta); + ATTR_HOT void step(const netlist_time delta); - ATTR_HOT void update_inputs(); + ATTR_HOT void update_inputs(); }; @@ -262,45 +262,45 @@ private: class ATTR_ALIGNED(64) NETLIB_NAME(solver) : public netlist_device_t { public: - NETLIB_NAME(solver)() - : netlist_device_t() { } + NETLIB_NAME(solver)() + : netlist_device_t() { } - ATTR_COLD virtual ~NETLIB_NAME(solver)(); + ATTR_COLD virtual ~NETLIB_NAME(solver)(); - ATTR_COLD void post_start(); + ATTR_COLD void post_start(); - ATTR_HOT inline double gmin() { return m_gmin.Value(); } + ATTR_HOT inline double gmin() { return m_gmin.Value(); } protected: - ATTR_HOT void update(); - ATTR_HOT void start(); - ATTR_HOT void reset(); - ATTR_HOT void update_param(); + ATTR_HOT void update(); + ATTR_HOT void start(); + ATTR_HOT void reset(); + ATTR_HOT void update_param(); - netlist_ttl_input_t m_fb_step; - netlist_ttl_output_t m_Q_step; + netlist_ttl_input_t m_fb_step; + netlist_ttl_output_t m_Q_step; - netlist_param_double_t m_freq; - netlist_param_double_t m_sync_delay; - netlist_param_double_t m_accuracy; - netlist_param_double_t m_gmin; - netlist_param_double_t m_lte; - netlist_param_double_t m_sor; - netlist_param_logic_t m_dynamic; - netlist_param_double_t m_min_timestep; + netlist_param_double_t m_freq; + netlist_param_double_t m_sync_delay; + netlist_param_double_t m_accuracy; + netlist_param_double_t m_gmin; + netlist_param_double_t m_lte; + netlist_param_double_t m_sor; + netlist_param_logic_t m_dynamic; + netlist_param_double_t m_min_timestep; - netlist_param_int_t m_nr_loops; - netlist_param_int_t m_gs_loops; - netlist_param_int_t m_gs_threshold; - netlist_param_int_t m_parallel; + netlist_param_int_t m_nr_loops; + netlist_param_int_t m_gs_loops; + netlist_param_int_t m_gs_threshold; + netlist_param_int_t m_parallel; - netlist_matrix_solver_t::list_t m_mat_solvers; + netlist_matrix_solver_t::list_t m_mat_solvers; private: - netlist_solver_parameters_t m_params; + netlist_solver_parameters_t m_params; - template - netlist_matrix_solver_t *create_solver(int size, int gs_threshold, bool use_specific); + template + netlist_matrix_solver_t *create_solver(int size, int gs_threshold, bool use_specific); }; diff --git a/src/emu/netlist/analog/nld_twoterm.h b/src/emu/netlist/analog/nld_twoterm.h index 49cdfefb1bf..1e5d35353e0 100644 --- a/src/emu/netlist/analog/nld_twoterm.h +++ b/src/emu/netlist/analog/nld_twoterm.h @@ -88,7 +88,7 @@ class NETLIB_NAME(twoterm) : public netlist_device_t { public: ATTR_COLD NETLIB_NAME(twoterm)(const family_t afamily); - ATTR_COLD NETLIB_NAME(twoterm)(); + ATTR_COLD NETLIB_NAME(twoterm)(); netlist_terminal_t m_P; netlist_terminal_t m_N; @@ -99,21 +99,21 @@ public: ATTR_HOT inline void set(const double G, const double V, const double I) { - /* GO, GT, I */ + /* GO, GT, I */ m_P.set( G, G, ( V) * G - I); m_N.set( G, G, ( -V) * G + I); } ATTR_HOT inline double deltaV() const { - return m_P.net().as_analog().Q_Analog() - m_N.net().as_analog().Q_Analog(); + return m_P.net().as_analog().Q_Analog() - m_N.net().as_analog().Q_Analog(); } ATTR_HOT void set_mat(double a11, double a12, double a21, double a22, double r1, double r2) { - /* GO, GT, I */ - m_P.set(-a12, a11, -r1); - m_N.set(-a21, a22, -r2); + /* GO, GT, I */ + m_P.set(-a12, a11, -r1); + m_N.set(-a21, a22, -r2); } protected: @@ -135,7 +135,7 @@ public: inline void set_R(const double R) { - set(1.0 / R, 0.0, 0.0); + set(1.0 / R, 0.0, 0.0); } protected: diff --git a/src/emu/netlist/devices/nld_4020.h b/src/emu/netlist/devices/nld_4020.h index 3215a33d415..3ecf7923a38 100644 --- a/src/emu/netlist/devices/nld_4020.h +++ b/src/emu/netlist/devices/nld_4020.h @@ -34,16 +34,16 @@ NET_REGISTER_DEV(4020, _name) \ NET_CONNECT(_name, IP, _IP) \ NET_CONNECT(_name, RESET, _RESET) \ - NET_CONNECT(_name, VDD, _VDD) \ - NET_CONNECT(_name, VSS, _VSS) + NET_CONNECT(_name, VDD, _VDD) \ + NET_CONNECT(_name, VSS, _VSS) #define CD_4020_DIP(_name) \ NET_REGISTER_DEV(4020_dip, _name) NETLIB_SUBDEVICE(4020_sub, - NETLIB_LOGIC_FAMILY(CD4000) - ATTR_HOT void update_outputs(const UINT16 cnt); + NETLIB_LOGIC_FAMILY(CD4000) + ATTR_HOT void update_outputs(const UINT16 cnt); netlist_ttl_input_t m_IP; @@ -53,10 +53,10 @@ NETLIB_SUBDEVICE(4020_sub, ); NETLIB_DEVICE(4020, - NETLIB_LOGIC_FAMILY(CD4000) + NETLIB_LOGIC_FAMILY(CD4000) NETLIB_NAME(4020_sub) sub; - NETLIB_NAME(vdd_vss) m_supply; - netlist_ttl_input_t m_RESET; + NETLIB_NAME(vdd_vss) m_supply; + netlist_ttl_input_t m_RESET; ); NETLIB_DEVICE_DERIVED(4020_dip, 4020, diff --git a/src/emu/netlist/devices/nld_4066.h b/src/emu/netlist/devices/nld_4066.h index 93abf613b39..23e9afdd5b2 100644 --- a/src/emu/netlist/devices/nld_4066.h +++ b/src/emu/netlist/devices/nld_4066.h @@ -31,7 +31,7 @@ NET_REGISTER_DEV(4066_dip, _name) NETLIB_SUBDEVICE(4066, - NETLIB_LOGIC_FAMILY(CD4000) + NETLIB_LOGIC_FAMILY(CD4000) public: netlist_analog_input_t m_control; @@ -41,7 +41,7 @@ public: ); NETLIB_DEVICE(4066_dip, - NETLIB_LOGIC_FAMILY(CD4000) + NETLIB_LOGIC_FAMILY(CD4000) NETLIB_NAME(4066) m_A; NETLIB_NAME(4066) m_B; diff --git a/src/emu/netlist/devices/nld_74123.h b/src/emu/netlist/devices/nld_74123.h index 80ed26ba832..25704e96211 100644 --- a/src/emu/netlist/devices/nld_74123.h +++ b/src/emu/netlist/devices/nld_74123.h @@ -39,16 +39,16 @@ public: netlist_ttl_input_t m_B; netlist_ttl_input_t m_CLRQ; netlist_ttl_output_t m_Q; - netlist_ttl_output_t m_QQ; + netlist_ttl_output_t m_QQ; - netlist_analog_input_t m_CV; + netlist_analog_input_t m_CV; - netlist_state_t m_last_trig; - netlist_state_t m_state; - netlist_state_t m_KP; + netlist_state_t m_last_trig; + netlist_state_t m_state; + netlist_state_t m_KP; - netlist_param_double_t m_K; - netlist_param_double_t m_RI; + netlist_param_double_t m_K; + netlist_param_double_t m_RI; ); @@ -57,8 +57,8 @@ public: NETLIB_DEVICE(74123_dip, - NETLIB_NAME(74123) m_1; - NETLIB_NAME(74123) m_2; + NETLIB_NAME(74123) m_1; + NETLIB_NAME(74123) m_2; ); diff --git a/src/emu/netlist/devices/nld_7474.h b/src/emu/netlist/devices/nld_7474.h index 1629026f43e..1c209d3a4e0 100644 --- a/src/emu/netlist/devices/nld_7474.h +++ b/src/emu/netlist/devices/nld_7474.h @@ -57,7 +57,7 @@ NETLIB_SUBDEVICE(7474sub, netlist_ttl_input_t m_CLK; - netlist_state_t m_nextD; + netlist_state_t m_nextD; netlist_ttl_output_t m_Q; netlist_ttl_output_t m_QQ; diff --git a/src/emu/netlist/devices/nld_7490.h b/src/emu/netlist/devices/nld_7490.h index 6029b9837cf..1a83dbaa711 100644 --- a/src/emu/netlist/devices/nld_7490.h +++ b/src/emu/netlist/devices/nld_7490.h @@ -81,8 +81,8 @@ NETLIB_DEVICE(7490, netlist_ttl_input_t m_B; netlist_state_t m_cnt; - netlist_state_t m_last_A; - netlist_state_t m_last_B; + netlist_state_t m_last_A; + netlist_state_t m_last_B; netlist_ttl_output_t m_Q[4]; ); diff --git a/src/emu/netlist/devices/nld_74ls629.h b/src/emu/netlist/devices/nld_74ls629.h index a3a7b8230e9..c32c0c283ad 100644 --- a/src/emu/netlist/devices/nld_74ls629.h +++ b/src/emu/netlist/devices/nld_74ls629.h @@ -41,7 +41,7 @@ NETLIB_SUBDEVICE(SN74LS629clk, netlist_time m_inc; netlist_state_t m_enableq; - netlist_state_t m_out; + netlist_state_t m_out; ); NETLIB_DEVICE_WITH_PARAMS(SN74LS629, diff --git a/src/emu/netlist/devices/nld_cmos.h b/src/emu/netlist/devices/nld_cmos.h index b78d9dd090c..4d450c2003e 100644 --- a/src/emu/netlist/devices/nld_cmos.h +++ b/src/emu/netlist/devices/nld_cmos.h @@ -11,22 +11,22 @@ class nld_vdd_vss : public netlist_device_t { - public: - nld_vdd_vss () - : netlist_device_t() - { } + public: + nld_vdd_vss () + : netlist_device_t() + { } - netlist_analog_input_t m_vdd; - netlist_analog_input_t m_vss; + netlist_analog_input_t m_vdd; + netlist_analog_input_t m_vss; - protected: - ATTR_HOT void update() {}; - ATTR_HOT void start() {}; - ATTR_HOT void reset() {}; + protected: + ATTR_HOT void update() {}; + ATTR_HOT void start() {}; + ATTR_HOT void reset() {}; public: - ATTR_HOT inline double vdd() { return INPANALOG(m_vdd); } - ATTR_HOT inline double vss() { return INPANALOG(m_vss); } + ATTR_HOT inline double vdd() { return INPANALOG(m_vdd); } + ATTR_HOT inline double vss() { return INPANALOG(m_vss); } }; #endif /* NLD_CMOS_H_ */ diff --git a/src/emu/netlist/devices/nld_log.h b/src/emu/netlist/devices/nld_log.h index b227a4e6e91..700e38d22ec 100644 --- a/src/emu/netlist/devices/nld_log.h +++ b/src/emu/netlist/devices/nld_log.h @@ -28,7 +28,7 @@ NETLIB_DEVICE(log, ~NETLIB_NAME(log)(); netlist_analog_input_t m_I; protected: - netlist_state_t m_file; + netlist_state_t m_file; ); #define LOGD(_name, _I, _I2) \ diff --git a/src/emu/netlist/devices/nld_r2r_dac.h b/src/emu/netlist/devices/nld_r2r_dac.h index 300ca8de81f..619fad90539 100644 --- a/src/emu/netlist/devices/nld_r2r_dac.h +++ b/src/emu/netlist/devices/nld_r2r_dac.h @@ -51,15 +51,15 @@ #define R2R_DAC(_name, _VIN, _R, _N) \ NET_REGISTER_DEV(r2r_dac, _name) \ - NETDEV_PARAMI(_name, VIN, _VIN) \ - NETDEV_PARAMI(_name, R, _R) \ - NETDEV_PARAMI(_name, N, _N) + NETDEV_PARAMI(_name, VIN, _VIN) \ + NETDEV_PARAMI(_name, R, _R) \ + NETDEV_PARAMI(_name, N, _N) NETLIB_DEVICE_WITH_PARAMS_DERIVED(r2r_dac, twoterm, - netlist_param_double_t m_VIN; - netlist_param_double_t m_R; - netlist_param_int_t m_num; - netlist_param_int_t m_val; + netlist_param_double_t m_VIN; + netlist_param_double_t m_R; + netlist_param_int_t m_num; + netlist_param_int_t m_val; ); diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h index a57f6d64bfc..f1397e4365a 100644 --- a/src/emu/netlist/devices/nld_system.h +++ b/src/emu/netlist/devices/nld_system.h @@ -37,7 +37,7 @@ NET_REGISTER_DEV(gnd, GND) #define DUMMY_INPUT(_name) \ - NET_REGISTER_DEV(dummy_input, _name) + NET_REGISTER_DEV(dummy_input, _name) // ----------------------------------------------------------------------------- // mainclock @@ -122,28 +122,28 @@ private: class NETLIB_NAME(dummy_input) : public netlist_device_t { public: - ATTR_COLD NETLIB_NAME(dummy_input)() - : netlist_device_t(DUMMY) { } + ATTR_COLD NETLIB_NAME(dummy_input)() + : netlist_device_t(DUMMY) { } - ATTR_COLD virtual ~NETLIB_NAME(dummy_input)() {} + ATTR_COLD virtual ~NETLIB_NAME(dummy_input)() {} protected: - ATTR_COLD void start() - { - register_input("I", m_I); - } + ATTR_COLD void start() + { + register_input("I", m_I); + } - ATTR_COLD void reset() - { - } + ATTR_COLD void reset() + { + } - ATTR_HOT ATTR_ALIGN void update() - { - } + ATTR_HOT ATTR_ALIGN void update() + { + } private: - netlist_analog_input_t m_I; + netlist_analog_input_t m_I; }; @@ -216,12 +216,12 @@ protected: register_input("I", m_I); } - ATTR_COLD virtual const netlist_logic_family_desc_t *logic_family() - { - return m_logic_family; - } + ATTR_COLD virtual const netlist_logic_family_desc_t *logic_family() + { + return m_logic_family; + } - const netlist_logic_family_desc_t *m_logic_family; + const netlist_logic_family_desc_t *m_logic_family; private: }; @@ -266,8 +266,8 @@ class nld_d_to_a_proxy : public nld_base_d_to_a_proxy { public: ATTR_COLD nld_d_to_a_proxy(netlist_output_t &out_proxied) - : nld_base_d_to_a_proxy(out_proxied) - , m_RV(TWOTERM) + : nld_base_d_to_a_proxy(out_proxied) + , m_RV(TWOTERM) , m_last_state(-1) { } diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index f5904f0dfc2..2f9e5ed1dbe 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -11,15 +11,15 @@ #include "../nl_base.h" #define NETLIB_TRUTHTABLE(_name, _nIN, _nOUT, _state) \ - class NETLIB_NAME(_name) : public nld_truthtable_t<_nIN, _nOUT, _state> \ - { \ - public: \ - NETLIB_NAME(_name)() \ - : nld_truthtable_t<_nIN, _nOUT, _state>(&m_ttbl, m_desc) { } \ - private: \ - static truthtable_t m_ttbl; \ - static const char *m_desc[]; \ - } + class NETLIB_NAME(_name) : public nld_truthtable_t<_nIN, _nOUT, _state> \ + { \ + public: \ + NETLIB_NAME(_name)() \ + : nld_truthtable_t<_nIN, _nOUT, _state>(&m_ttbl, m_desc) { } \ + private: \ + static truthtable_t m_ttbl; \ + static const char *m_desc[]; \ + } template @@ -27,215 +27,215 @@ class nld_truthtable_t : public netlist_device_t { public: - static const int m_num_bits = m_NI + has_state * (m_NI + m_NO); - static const int m_size = (1 << (m_num_bits)); + static const int m_num_bits = m_NI + has_state * (m_NI + m_NO); + static const int m_size = (1 << (m_num_bits)); - struct truthtable_t - { - truthtable_t() : m_initialized(false) {} - UINT32 m_outs[m_size]; - UINT8 m_timing[m_size][m_NO]; - netlist_time m_timing_nt[16]; - bool m_initialized; - }; + struct truthtable_t + { + truthtable_t() : m_initialized(false) {} + UINT32 m_outs[m_size]; + UINT8 m_timing[m_size][m_NO]; + netlist_time m_timing_nt[16]; + bool m_initialized; + }; - nld_truthtable_t(truthtable_t *ttbl, const char *desc[]) - : netlist_device_t(), m_last_state(0), m_active(1), m_ttp(ttbl), m_desc(desc) - { - } + nld_truthtable_t(truthtable_t *ttbl, const char *desc[]) + : netlist_device_t(), m_last_state(0), m_active(1), m_ttp(ttbl), m_desc(desc) + { + } - ATTR_COLD virtual void start() - { - pstring ttline = pstring(m_desc[0]); - { - nl_util::pstring_list io = nl_util::split(ttline,"|"); - // checks - assert(io.count() == 2); - nl_util::pstring_list inout = nl_util::split(io[0], ","); - assert(inout.count() == m_num_bits); - nl_util::pstring_list out = nl_util::split(io[1], ","); - assert(out.count() == m_NO); + ATTR_COLD virtual void start() + { + pstring ttline = pstring(m_desc[0]); + { + nl_util::pstring_list io = nl_util::split(ttline,"|"); + // checks + assert(io.count() == 2); + nl_util::pstring_list inout = nl_util::split(io[0], ","); + assert(inout.count() == m_num_bits); + nl_util::pstring_list out = nl_util::split(io[1], ","); + assert(out.count() == m_NO); - for (int i=0; i < m_NI; i++) - { - register_input(inout[i], m_i[i]); - } - for (int i=0; i < m_NO; i++) - { - register_output(out[i], m_Q[i]); - } - } - setup_tt(); - // FIXME: save state - } + for (int i=0; i < m_NI; i++) + { + register_input(inout[i], m_i[i]); + } + for (int i=0; i < m_NO; i++) + { + register_output(out[i], m_Q[i]); + } + } + setup_tt(); + // FIXME: save state + } - ATTR_COLD void help(int cur, nl_util::pstring_list list, - UINT64 state, UINT64 ignore, UINT16 val, UINT8 timing_index[m_NO]) - { - pstring elem = list[cur]; - int start = 0; - int end = 0; - int ign = 0; + ATTR_COLD void help(int cur, nl_util::pstring_list list, + UINT64 state, UINT64 ignore, UINT16 val, UINT8 timing_index[m_NO]) + { + pstring elem = list[cur]; + int start = 0; + int end = 0; + int ign = 0; - if (elem.equals("0")) - { - start = 0; - end = 0; - } - else if (elem.equals("1")) - { - start = 1; - end = 1; - } - else if (elem.equals("X")) - { - start = 0; - end = 1; - ign = 1; - } - for (int i = start; i <= end; i++) - { - const UINT64 nstate = state | (i << cur); - const UINT64 nignore = ignore | (ign << cur); + if (elem.equals("0")) + { + start = 0; + end = 0; + } + else if (elem.equals("1")) + { + start = 1; + end = 1; + } + else if (elem.equals("X")) + { + start = 0; + end = 1; + ign = 1; + } + for (int i = start; i <= end; i++) + { + const UINT64 nstate = state | (i << cur); + const UINT64 nignore = ignore | (ign << cur); - if (cur < m_num_bits - 1) - { - help(cur + 1, list, nstate, nignore, val, timing_index); - } - else - { - // cutoff previous inputs and outputs for ignore - m_ttp->m_outs[nstate] = val | ((nignore & ((1 << m_NI)-1)) << m_NO); - for (int j=0; jm_timing[nstate][j] = timing_index[j]; - } - } - } + if (cur < m_num_bits - 1) + { + help(cur + 1, list, nstate, nignore, val, timing_index); + } + else + { + // cutoff previous inputs and outputs for ignore + m_ttp->m_outs[nstate] = val | ((nignore & ((1 << m_NI)-1)) << m_NO); + for (int j=0; jm_timing[nstate][j] = timing_index[j]; + } + } + } - ATTR_COLD void setup_tt() - { - if (m_ttp->m_initialized) - return; + ATTR_COLD void setup_tt() + { + if (m_ttp->m_initialized) + return; - const char **truthtable = m_desc; - pstring ttline = pstring(truthtable[0]); - truthtable++; - ttline = pstring(truthtable[0]); - truthtable++; + const char **truthtable = m_desc; + pstring ttline = pstring(truthtable[0]); + truthtable++; + ttline = pstring(truthtable[0]); + truthtable++; - for (int j=0; j < m_size; j++) - m_ttp->m_outs[j] = -1; + for (int j=0; j < m_size; j++) + m_ttp->m_outs[j] = -1; - for (int j=0; j < 16; j++) - m_ttp->m_timing_nt[j] = netlist_time::zero; + for (int j=0; j < 16; j++) + m_ttp->m_timing_nt[j] = netlist_time::zero; - while (!ttline.equals("")) - { - nl_util::pstring_list io = nl_util::split(ttline,"|"); - // checks - assert(io.count() == 3); - nl_util::pstring_list inout = nl_util::split(io[0], ","); - assert(inout.count() == m_num_bits); - nl_util::pstring_list out = nl_util::split(io[1], ","); - assert(out.count() == m_NO); - nl_util::pstring_list times = nl_util::split(io[2], ","); - assert(times.count() == m_NO); + while (!ttline.equals("")) + { + nl_util::pstring_list io = nl_util::split(ttline,"|"); + // checks + assert(io.count() == 3); + nl_util::pstring_list inout = nl_util::split(io[0], ","); + assert(inout.count() == m_num_bits); + nl_util::pstring_list out = nl_util::split(io[1], ","); + assert(out.count() == m_NO); + nl_util::pstring_list times = nl_util::split(io[2], ","); + assert(times.count() == m_NO); - UINT16 val = 0; - UINT8 tindex[m_NO]; - for (int j=0; jm_timing_nt[k] != netlist_time::zero && m_ttp->m_timing_nt[k] != t) - k++; - m_ttp->m_timing_nt[k] = t; - tindex[j] = k; - } + UINT16 val = 0; + UINT8 tindex[m_NO]; + for (int j=0; jm_timing_nt[k] != netlist_time::zero && m_ttp->m_timing_nt[k] != t) + k++; + m_ttp->m_timing_nt[k] = t; + tindex[j] = k; + } - help(0, inout, 0 , 0 , val, tindex); - ttline = pstring(truthtable[0]); - truthtable++; - } - for (int j=0; j < m_size; j++) - printf("%05x %04x %04x %04x\n", j, m_ttp->m_outs[j] & ((1 << m_NO)-1), - m_ttp->m_outs[j] >> m_NO, m_ttp->m_timing[j][0]); - for (int k=0; m_ttp->m_timing_nt[k] != netlist_time::zero; k++) - printf("%d %f\n", k, m_ttp->m_timing_nt[k].as_double() * 1000000.0); + help(0, inout, 0 , 0 , val, tindex); + ttline = pstring(truthtable[0]); + truthtable++; + } + for (int j=0; j < m_size; j++) + printf("%05x %04x %04x %04x\n", j, m_ttp->m_outs[j] & ((1 << m_NO)-1), + m_ttp->m_outs[j] >> m_NO, m_ttp->m_timing[j][0]); + for (int k=0; m_ttp->m_timing_nt[k] != netlist_time::zero; k++) + printf("%d %f\n", k, m_ttp->m_timing_nt[k].as_double() * 1000000.0); - m_ttp->m_initialized = true; + m_ttp->m_initialized = true; - } + } - ATTR_COLD void reset() - { - //m_Q.initial(1); - m_active = 1; - m_last_state = 0; - } + ATTR_COLD void reset() + { + //m_Q.initial(1); + m_active = 1; + m_last_state = 0; + } - ATTR_HOT ATTR_ALIGN void update() - { - //const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)}; + ATTR_HOT ATTR_ALIGN void update() + { + //const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)}; - // FIXME: this check is needed because update is called during startup as well - if (UNEXPECTED(USE_DEACTIVE_DEVICE && m_active == 0)) - return; + // FIXME: this check is needed because update is called during startup as well + if (UNEXPECTED(USE_DEACTIVE_DEVICE && m_active == 0)) + return; - UINT32 state = 0; - for (int i=0; i< m_NI; i++) - { - m_i[i].activate(); - state = state | (INPLOGIC(m_i[i]) << i); - } + UINT32 state = 0; + for (int i=0; i< m_NI; i++) + { + m_i[i].activate(); + state = state | (INPLOGIC(m_i[i]) << i); + } - const UINT32 nstate = (has_state ? state | (m_last_state << m_NI) : state); - const UINT32 out = m_ttp->m_outs[nstate] & ((1 << m_NO) - 1); - const UINT32 ign = m_ttp->m_outs[nstate] >> m_NO; - if (has_state) m_last_state = (state << m_NO) | out; + const UINT32 nstate = (has_state ? state | (m_last_state << m_NI) : state); + const UINT32 out = m_ttp->m_outs[nstate] & ((1 << m_NO) - 1); + const UINT32 ign = m_ttp->m_outs[nstate] >> m_NO; + if (has_state) m_last_state = (state << m_NO) | out; - for (int i=0; i< m_NI; i++) - if (ign & (1 << i)) - m_i[i].inactivate(); + for (int i=0; i< m_NI; i++) + if (ign & (1 << i)) + m_i[i].inactivate(); - for (int i=0; i> i) & 1, times[(out >> i) & 1]);// ? 22000 : 15000); - OUTLOGIC(m_Q[i], (out >> i) & 1, m_ttp->m_timing_nt[m_ttp->m_timing[nstate][i]]);// ? 22000 : 15000); + OUTLOGIC(m_Q[i], (out >> i) & 1, m_ttp->m_timing_nt[m_ttp->m_timing[nstate][i]]);// ? 22000 : 15000); - } + } #if (USE_DEACTIVE_DEVICE) - ATTR_HOT void inc_active() - { - if (++m_active == 1) - { - update(); - } - } + ATTR_HOT void inc_active() + { + if (++m_active == 1) + { + update(); + } + } - ATTR_HOT void dec_active() - { - if (--m_active == 0) - { - for (int i = 0; i< m_NI; i++) - m_i[i].inactivate(); - } - } + ATTR_HOT void dec_active() + { + if (--m_active == 0) + { + for (int i = 0; i< m_NI; i++) + m_i[i].inactivate(); + } + } #endif - netlist_ttl_input_t m_i[m_NI]; - netlist_ttl_output_t m_Q[m_NO]; + netlist_ttl_input_t m_i[m_NI]; + netlist_ttl_output_t m_Q[m_NO]; private: - UINT32 m_last_state; - INT32 m_active; + UINT32 m_last_state; + INT32 m_active; - truthtable_t *m_ttp; - const char **m_desc; + truthtable_t *m_ttp; + const char **m_desc; }; #endif /* NLD_TRUTHTABLE_H_ */ diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index a9b8e2ef694..1a94734ed93 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -244,7 +244,7 @@ typedef void (*net_update_delegate)(netlist_core_device_t *); #define NETLIB_LOGIC_FAMILY(_fam) \ ATTR_COLD virtual const netlist_logic_family_desc_t *logic_family() \ { \ - return &netlist_family_ ## _fam; \ + return &netlist_family_ ## _fam; \ } @@ -298,14 +298,14 @@ extern netlist_logic_family_desc_t netlist_family_CD4000; template< typename X> class netlist_state_t { public: - inline netlist_state_t() : m_x(static_cast(0)) {} - inline netlist_state_t(const X& x_) : m_x(x_) {} - inline const X& get() const { return m_x; } - inline X& ref() { return m_x; } - inline operator const X&() const { return m_x; } - inline operator X&() { return m_x; } + inline netlist_state_t() : m_x(static_cast(0)) {} + inline netlist_state_t(const X& x_) : m_x(x_) {} + inline const X& get() const { return m_x; } + inline X& ref() { return m_x; } + inline operator const X&() const { return m_x; } + inline operator X&() { return m_x; } private: - X m_x; + X m_x; }; // ----------------------------------------------------------------------------- @@ -324,7 +324,7 @@ public: NET = 4, DEVICE = 5, NETLIST = 6, - QUEUE = 7, + QUEUE = 7, }; enum family_t { // Terminal families @@ -336,12 +336,12 @@ public: RESISTOR, // Resistor CAPACITOR, // Capacitor DIODE, // Diode - DUMMY, // DUMMY device without function - BJT_EB, // BJT(Ebers-Moll) + DUMMY, // DUMMY device without function + BJT_EB, // BJT(Ebers-Moll) BJT_SWITCH, // BJT(Switch) VCVS, // Voltage controlled voltage source VCCS, // Voltage controlled current source - CCCS, // Current controlled current source + CCCS, // Current controlled current source GND, // GND device }; @@ -356,9 +356,9 @@ public: PSTATE_INTERFACE_DECL() template ATTR_COLD void save(netlist_state_t &state, - const pstring &stname) + const pstring &stname) { - save(state.ref(), stname); + save(state.ref(), stname); } ATTR_HOT inline const type_t type() const { return m_objtype; } @@ -469,7 +469,7 @@ class ATTR_ALIGN netlist_terminal_t : public netlist_core_terminal_t NETLIST_PREVENT_COPYING(netlist_terminal_t) public: - typedef plinearlist_t list_t; + typedef plinearlist_t list_t; ATTR_COLD netlist_terminal_t(); @@ -479,27 +479,27 @@ public: ATTR_HOT inline void set(const double G) { - set_ptr(m_Idr1, 0); + set_ptr(m_Idr1, 0); set_ptr(m_go1, G); set_ptr(m_gt1, G); } ATTR_HOT inline void set(const double GO, const double GT) { - set_ptr(m_Idr1, 0); + set_ptr(m_Idr1, 0); set_ptr(m_go1, GO); set_ptr(m_gt1, GT); } ATTR_HOT inline void set(const double GO, const double GT, const double I) { - set_ptr(m_Idr1, I); + set_ptr(m_Idr1, I); set_ptr(m_go1, GO); set_ptr(m_gt1, GT); } - ATTR_HOT void schedule_solve(); - ATTR_HOT void schedule_after(const netlist_time &after); + ATTR_HOT void schedule_solve(); + ATTR_HOT void schedule_after(const netlist_time &after); netlist_terminal_t *m_otherterm; @@ -508,11 +508,11 @@ protected: ATTR_COLD virtual void reset(); private: - inline void set_ptr(double *ptr, const double val) - { - if (ptr != NULL) - *ptr = val; - } + inline void set_ptr(double *ptr, const double val) + { + if (ptr != NULL) + *ptr = val; + } }; @@ -531,8 +531,8 @@ public: set_state(STATE_INP_ACTIVE); } - ATTR_HOT inline void inactivate(); - ATTR_HOT inline void activate(); + ATTR_HOT inline void inactivate(); + ATTR_HOT inline void activate(); protected: ATTR_COLD virtual void reset() @@ -559,8 +559,8 @@ public: ATTR_HOT inline const netlist_sig_t Q() const; ATTR_HOT inline const netlist_sig_t last_Q() const; - ATTR_HOT inline void activate_hl(); - ATTR_HOT inline void activate_lh(); + ATTR_HOT inline void activate_hl(); + ATTR_HOT inline void activate_lh(); }; @@ -610,11 +610,11 @@ public: ATTR_COLD void merge_net(netlist_net_t *othernet); ATTR_COLD void register_railterminal(netlist_output_t &mr); - ATTR_HOT inline netlist_logic_net_t & RESTRICT as_logic(); - ATTR_HOT inline const netlist_logic_net_t & RESTRICT as_logic() const; + ATTR_HOT inline netlist_logic_net_t & RESTRICT as_logic(); + ATTR_HOT inline const netlist_logic_net_t & RESTRICT as_logic() const; - ATTR_HOT inline netlist_analog_net_t & RESTRICT as_analog(); - ATTR_HOT inline const netlist_analog_net_t & RESTRICT as_analog() const; + ATTR_HOT inline netlist_analog_net_t & RESTRICT as_analog(); + ATTR_HOT inline const netlist_analog_net_t & RESTRICT as_analog() const; ATTR_HOT void update_devs(); @@ -625,98 +625,98 @@ public: ATTR_HOT inline const netlist_core_terminal_t & RESTRICT railterminal() const { return *m_railterminal; } ATTR_HOT inline void push_to_queue(const netlist_time delay); - ATTR_HOT inline void reschedule_in_queue(const netlist_time delay); + ATTR_HOT inline void reschedule_in_queue(const netlist_time delay); ATTR_HOT bool inline is_queued() const { return m_in_queue == 1; } ATTR_HOT inline int num_cons() const { return m_core_terms.count(); } - ATTR_HOT void inc_active(netlist_core_terminal_t &term); - ATTR_HOT void dec_active(netlist_core_terminal_t &term); + ATTR_HOT void inc_active(netlist_core_terminal_t &term); + ATTR_HOT void dec_active(netlist_core_terminal_t &term); - ATTR_COLD void rebuild_list(); /* rebuild m_list after a load */ + ATTR_COLD void rebuild_list(); /* rebuild m_list after a load */ - ATTR_COLD void move_connections(netlist_net_t *new_net); + ATTR_COLD void move_connections(netlist_net_t *new_net); - plinearlist_t m_core_terms; // save post-start m_list ... + plinearlist_t m_core_terms; // save post-start m_list ... protected: //FIXME: needed by current solver code ATTR_COLD virtual void save_register(); ATTR_COLD virtual void reset(); - netlist_sig_t m_new_Q; - netlist_sig_t m_cur_Q; + netlist_sig_t m_new_Q; + netlist_sig_t m_cur_Q; private: - netlist_core_terminal_t * RESTRICT m_railterminal; - plinkedlist_t m_list_active; + netlist_core_terminal_t * RESTRICT m_railterminal; + plinkedlist_t m_list_active; - netlist_time m_time; - INT32 m_active; - UINT8 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */ + netlist_time m_time; + INT32 m_active; + UINT8 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */ public: - // We have to have those on one object. Dividing those does lead - // to a significant performance hit - // FIXME: Have to fix the public at some time - double m_cur_Analog; + // We have to have those on one object. Dividing those does lead + // to a significant performance hit + // FIXME: Have to fix the public at some time + double m_cur_Analog; }; class netlist_logic_net_t : public netlist_net_t { - NETLIST_PREVENT_COPYING(netlist_logic_net_t) + NETLIST_PREVENT_COPYING(netlist_logic_net_t) public: - typedef plinearlist_t list_t; + typedef plinearlist_t list_t; - ATTR_COLD netlist_logic_net_t(); - ATTR_COLD virtual ~netlist_logic_net_t() { }; + ATTR_COLD netlist_logic_net_t(); + ATTR_COLD virtual ~netlist_logic_net_t() { }; - ATTR_HOT inline const netlist_sig_t Q() const - { - return m_cur_Q; - } + ATTR_HOT inline const netlist_sig_t Q() const + { + return m_cur_Q; + } - ATTR_HOT inline const netlist_sig_t new_Q() const - { - return m_new_Q; - } + ATTR_HOT inline const netlist_sig_t new_Q() const + { + return m_new_Q; + } - ATTR_HOT inline void set_Q(const netlist_sig_t newQ, const netlist_time delay) - { - if (EXPECTED(newQ != m_new_Q)) - { - m_new_Q = newQ; - push_to_queue(delay); - } - } + ATTR_HOT inline void set_Q(const netlist_sig_t newQ, const netlist_time delay) + { + if (EXPECTED(newQ != m_new_Q)) + { + m_new_Q = newQ; + push_to_queue(delay); + } + } - ATTR_HOT inline void toggle_new_Q() - { - m_new_Q ^= 1; - } + ATTR_HOT inline void toggle_new_Q() + { + m_new_Q ^= 1; + } - ATTR_COLD void initial(const netlist_sig_t val) - { - m_cur_Q = val; - m_new_Q = val; - } + ATTR_COLD void initial(const netlist_sig_t val) + { + m_cur_Q = val; + m_new_Q = val; + } - /* internal state support - * FIXME: get rid of this and implement export/import in MAME - */ - ATTR_COLD inline netlist_sig_t &Q_state_ptr() - { - assert(family() == LOGIC); - return m_cur_Q; - } + /* internal state support + * FIXME: get rid of this and implement export/import in MAME + */ + ATTR_COLD inline netlist_sig_t &Q_state_ptr() + { + assert(family() == LOGIC); + return m_cur_Q; + } protected: //FIXME: needed by current solver code - ATTR_COLD virtual void save_register(); - ATTR_COLD virtual void reset(); + ATTR_COLD virtual void save_register(); + ATTR_COLD virtual void reset(); private: @@ -727,47 +727,47 @@ public: class netlist_analog_net_t : public netlist_net_t { - NETLIST_PREVENT_COPYING(netlist_analog_net_t) + NETLIST_PREVENT_COPYING(netlist_analog_net_t) public: - typedef plinearlist_t list_t; + typedef plinearlist_t list_t; - ATTR_COLD netlist_analog_net_t(); - ATTR_COLD virtual ~netlist_analog_net_t() { }; + ATTR_COLD netlist_analog_net_t(); + ATTR_COLD virtual ~netlist_analog_net_t() { }; - ATTR_HOT inline const double Q_Analog() const - { - //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); - assert(family() == ANALOG); - return m_cur_Analog; - } + ATTR_HOT inline const double Q_Analog() const + { + //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); + assert(family() == ANALOG); + return m_cur_Analog; + } - ATTR_COLD inline double &Q_Analog_state_ptr() - { - //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); - assert(family() == ANALOG); - return m_cur_Analog; - } + ATTR_COLD inline double &Q_Analog_state_ptr() + { + //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); + assert(family() == ANALOG); + return m_cur_Analog; + } - ATTR_HOT inline netlist_matrix_solver_t *solver() { return m_solver; } + ATTR_HOT inline netlist_matrix_solver_t *solver() { return m_solver; } - ATTR_COLD bool already_processed(list_t *groups, int cur_group); - ATTR_COLD void process_net(list_t *groups, int &cur_group); + ATTR_COLD bool already_processed(list_t *groups, int cur_group); + ATTR_COLD void process_net(list_t *groups, int &cur_group); protected: - ATTR_COLD virtual void save_register(); - ATTR_COLD virtual void reset(); + ATTR_COLD virtual void save_register(); + ATTR_COLD virtual void reset(); private: public: - double m_DD_n_m_1; - double m_h_n_m_1; + double m_DD_n_m_1; + double m_h_n_m_1; - //FIXME: needed by current solver code - netlist_matrix_solver_t *m_solver; + //FIXME: needed by current solver code + netlist_matrix_solver_t *m_solver; }; // ----------------------------------------------------------------------------- @@ -811,7 +811,7 @@ public: } private: - netlist_logic_net_t m_my_net; + netlist_logic_net_t m_my_net; nld_base_d_to_a_proxy *m_proxy; }; @@ -834,10 +834,10 @@ public: ATTR_HOT inline void set_Q(const double newQ); - netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic + netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic private: - netlist_analog_net_t m_my_net; + netlist_analog_net_t m_my_net; }; // ----------------------------------------------------------------------------- @@ -1030,7 +1030,7 @@ protected: ATTR_COLD virtual void start() { } ATTR_COLD virtual const netlist_logic_family_desc_t *logic_family() { - return &netlist_family_TTL; + return &netlist_family_TTL; } private: @@ -1079,15 +1079,15 @@ private: // ----------------------------------------------------------------------------- class netlist_queue_t : public netlist_timed_queue, - public netlist_object_t, + public netlist_object_t, public pstate_callback_t { public: - netlist_queue_t(netlist_base_t &nl); + netlist_queue_t(netlist_base_t &nl); protected: - void reset() {} + void reset() {} void register_state(pstate_manager_t &manager, const pstring &module); void on_pre_save(); @@ -1126,10 +1126,10 @@ public: m_queue.push(netlist_queue_t::entry_t(attime, out)); } - ATTR_HOT inline void remove_from_queue(netlist_net_t *out) - { - m_queue.remove(out); - } + ATTR_HOT inline void remove_from_queue(netlist_net_t *out) + { + m_queue.remove(out); + } ATTR_HOT void process_queue(const netlist_time delta); ATTR_HOT inline void abort_current_queue_slice() { m_stop = netlist_time::zero; } @@ -1161,10 +1161,10 @@ public: template _C *get_first_device() { - //FIXME: - for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry)) - { - _C *dev = dynamic_cast<_C *>(*entry); + //FIXME: + for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry)) + { + _C *dev = dynamic_cast<_C *>(*entry); if (dev != NULL) return dev; } @@ -1175,9 +1175,9 @@ public: _C *get_single_device(const char *classname) { _C *ret = NULL; - for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry)) - { - _C *dev = dynamic_cast<_C *>(*entry); + for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry)) + { + _C *dev = dynamic_cast<_C *>(*entry); if (dev != NULL) { if (ret != NULL) @@ -1261,26 +1261,26 @@ ATTR_HOT inline void netlist_param_double_t::setTo(const double param) ATTR_HOT inline netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() { - assert(family() == LOGIC); - return static_cast(*this); + assert(family() == LOGIC); + return static_cast(*this); } ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const { - assert(family() == LOGIC); - return static_cast(*this); + assert(family() == LOGIC); + return static_cast(*this); } ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() { - assert(family() == ANALOG); - return static_cast(*this); + assert(family() == ANALOG); + return static_cast(*this); } ATTR_HOT inline const netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() const { - assert(family() == ANALOG); - return static_cast(*this); + assert(family() == ANALOG); + return static_cast(*this); } @@ -1337,16 +1337,16 @@ ATTR_HOT inline void netlist_net_t::push_to_queue(const netlist_time delay) ATTR_HOT inline void netlist_net_t::reschedule_in_queue(const netlist_time delay) { - //if (UNEXPECTED(m_num_cons == 0 || is_queued())) - if (is_queued()) - netlist().remove_from_queue(this); + //if (UNEXPECTED(m_num_cons == 0 || is_queued())) + if (is_queued()) + netlist().remove_from_queue(this); - m_time = netlist().time() + delay; - m_in_queue = (m_active > 0); /* queued ? */ - if (EXPECTED(m_in_queue)) - { - netlist().push_to_queue(this, m_time); - } + m_time = netlist().time() + delay; + m_in_queue = (m_active > 0); /* queued ? */ + if (EXPECTED(m_in_queue)) + { + netlist().push_to_queue(this, m_time); + } } @@ -1362,11 +1362,11 @@ ATTR_HOT inline const double netlist_analog_input_t::Q_Analog() const ATTR_HOT inline void netlist_analog_output_t::set_Q(const double newQ) { - if (newQ != net().as_analog().m_cur_Analog) - { - net().as_analog().m_cur_Analog = newQ; - net().push_to_queue(NLTIME_FROM_NS(1)); - } + if (newQ != net().as_analog().m_cur_Analog) + { + net().as_analog().m_cur_Analog = newQ; + net().push_to_queue(NLTIME_FROM_NS(1)); + } } diff --git a/src/emu/netlist/nl_dice_compat.h b/src/emu/netlist/nl_dice_compat.h index c27e7a094cf..6fbede6d453 100644 --- a/src/emu/netlist/nl_dice_compat.h +++ b/src/emu/netlist/nl_dice_compat.h @@ -70,10 +70,10 @@ public: ALIAS(_name.1, _name ## _SW.Q) #define CHIP_INPUT_ACTIVE_HIGH(_name) \ - SWITCH2(_name ## _SW) \ - NET_C(_name ## _SW.2, V5) \ - NET_CSTR(# _name "_SW.1", "GND") \ - ALIAS(_name.1, _name ## _SW.Q) + SWITCH2(_name ## _SW) \ + NET_C(_name ## _SW.2, V5) \ + NET_CSTR(# _name "_SW.1", "GND") \ + ALIAS(_name.1, _name ## _SW.Q) #define CHIP_LATCH(_name) \ NETDEV_RSFF(_name) \ diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h index ab24bfdfe48..67b398503d6 100644 --- a/src/emu/netlist/nl_lists.h +++ b/src/emu/netlist/nl_lists.h @@ -74,21 +74,21 @@ public: ATTR_HOT inline void remove(const _Element elem) { - entry_t * i = m_end - 1; - while (i > &m_list[0]) - { - if (i->object() == elem) - { - m_end--; - while (i < m_end) - { - *i = *(i+1); - i++; - } - return; - } - i--; - } + entry_t * i = m_end - 1; + while (i > &m_list[0]) + { + if (i->object() == elem) + { + m_end--; + while (i < m_end) + { + *i = *(i+1); + i++; + } + return; + } + i--; + } } ATTR_COLD void clear() diff --git a/src/emu/netlist/nl_setup.h b/src/emu/netlist/nl_setup.h index eee03e361be..9a6028c4848 100644 --- a/src/emu/netlist/nl_setup.h +++ b/src/emu/netlist/nl_setup.h @@ -83,7 +83,7 @@ public: struct link_t { link_t() { } - link_t(void *) { } + link_t(void *) { } // Copy constructor link_t(const link_t &from) { diff --git a/src/emu/netlist/nl_time.h b/src/emu/netlist/nl_time.h index 1cd650cbfe5..af358320f8a 100644 --- a/src/emu/netlist/nl_time.h +++ b/src/emu/netlist/nl_time.h @@ -40,7 +40,7 @@ public: ATTR_HOT friend inline bool operator<(const netlist_time &left, const netlist_time &right); ATTR_HOT friend inline bool operator>=(const netlist_time &left, const netlist_time &right); ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend inline bool operator!=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend inline bool operator!=(const netlist_time &left, const netlist_time &right); ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; } ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; } @@ -114,7 +114,7 @@ ATTR_HOT inline bool operator>=(const netlist_time &left, const netlist_time &ri ATTR_HOT inline bool operator!=(const netlist_time &left, const netlist_time &right) { - return (left.m_time != right.m_time); + return (left.m_time != right.m_time); } #endif /* NLTIME_H_ */ diff --git a/src/emu/netlist/plists.h b/src/emu/netlist/plists.h index 7835205048a..17b90d538ae 100644 --- a/src/emu/netlist/plists.h +++ b/src/emu/netlist/plists.h @@ -26,19 +26,19 @@ public: { m_num_elements = numElements; if (m_num_elements == 0) - m_list = NULL; + m_list = NULL; else - m_list = new _ListClass[m_num_elements]; + m_list = new _ListClass[m_num_elements]; m_count = 0; } ATTR_COLD plinearlist_t(const plinearlist_t &rhs) { m_num_elements = rhs.capacity(); - if (m_num_elements == 0) - m_list = NULL; - else - m_list = new _ListClass[m_num_elements]; + if (m_num_elements == 0) + m_list = NULL; + else + m_list = new _ListClass[m_num_elements]; m_count = 0; for (int i=0; i= m_num_elements){ - int new_size = m_num_elements * 2; - if (new_size < 32) - new_size = 32; - resize(new_size); + int new_size = m_num_elements * 2; + if (new_size < 32) + new_size = 32; + resize(new_size); } m_list[m_count++] = elem; @@ -116,14 +116,14 @@ public: } } - ATTR_HOT inline void swap(const int pos1, const int pos2) - { - assert((pos1>=0) && (pos1=0) && (pos2=0) && (pos1=0) && (pos2 0) - { - _ListClass *m_new = new _ListClass[new_size]; - _ListClass *pd = m_new; + ATTR_HOT inline void resize(const int new_size) + { + int cnt = count(); + if (new_size > 0) + { + _ListClass *m_new = new _ListClass[new_size]; + _ListClass *pd = m_new; - if (cnt > new_size) - cnt = new_size; - for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++) - *pd = *ps; - if (m_list != NULL) - delete[] m_list; - m_list = m_new; - m_count = cnt; - } - else - { - if (m_list != NULL) - delete[] m_list; - m_list = NULL; - m_count = 0; - } - m_num_elements = new_size; - } + if (cnt > new_size) + cnt = new_size; + for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++) + *pd = *ps; + if (m_list != NULL) + delete[] m_list; + m_list = m_new; + m_count = cnt; + } + else + { + if (m_list != NULL) + delete[] m_list; + m_list = NULL; + m_count = 0; + } + m_num_elements = new_size; + } - int m_count; + int m_count; _ListClass * m_list /* ATTR_ALIGN */; int m_num_elements; }; @@ -203,35 +203,35 @@ template class pnamedlist_t : public plinearlist_t<_C> { public: - _C find(const pstring name) const - { - for (int i=0; i < this->count(); i++) - if (get_name((*this)[i]) == name) - return (*this)[i]; - return _C(NULL); - } + _C find(const pstring name) const + { + for (int i=0; i < this->count(); i++) + if (get_name((*this)[i]) == name) + return (*this)[i]; + return _C(NULL); + } - void remove_by_name(const pstring name) - { - plinearlist_t<_C>::remove(find(name)); - } + void remove_by_name(const pstring name) + { + plinearlist_t<_C>::remove(find(name)); + } - bool add(_C dev, bool allow_duplicate) - { - if (allow_duplicate) - plinearlist_t<_C>::add(dev); - else - { - if (!(this->find(get_name(dev)) == _C(NULL))) - return false; - plinearlist_t<_C>::add(dev); - } - return true; - } + bool add(_C dev, bool allow_duplicate) + { + if (allow_duplicate) + plinearlist_t<_C>::add(dev); + else + { + if (!(this->find(get_name(dev)) == _C(NULL))) + return false; + plinearlist_t<_C>::add(dev); + } + return true; + } private: - template static const pstring get_name(T &elem) { return elem.name(); } - template static const pstring get_name(T *elem) { return elem->name(); } + template static const pstring get_name(T &elem) { return elem.name(); } + template static const pstring get_name(T *elem) { return elem->name(); } }; diff --git a/src/emu/netlist/pstate.h b/src/emu/netlist/pstate.h index e959e98e1d2..59f91bc59a1 100644 --- a/src/emu/netlist/pstate.h +++ b/src/emu/netlist/pstate.h @@ -37,21 +37,21 @@ enum pstate_data_type_e { template struct nl_datatype { - static const pstate_data_type_e type = pstate_data_type_e(NOT_SUPPORTED); - static const bool is_ptr = false; + static const pstate_data_type_e type = pstate_data_type_e(NOT_SUPPORTED); + static const bool is_ptr = false; }; template struct nl_datatype<_ItemType *> { - static const pstate_data_type_e type = pstate_data_type_e(NOT_SUPPORTED); - static const bool is_ptr = true; + static const pstate_data_type_e type = pstate_data_type_e(NOT_SUPPORTED); + static const bool is_ptr = true; }; //template struct type_checker<_ItemType*> { static const bool is_atom = false; static const bool is_pointer = true; }; #define NETLIST_SAVE_TYPE(TYPE, TYPEDESC) \ - template<> struct nl_datatype{ static const pstate_data_type_e type = pstate_data_type_e(TYPEDESC); static const bool is_ptr = false;}; \ - template<> struct nl_datatype{ static const pstate_data_type_e type = pstate_data_type_e(TYPEDESC); static const bool is_ptr = true;}; + template<> struct nl_datatype{ static const pstate_data_type_e type = pstate_data_type_e(TYPEDESC); static const bool is_ptr = false;}; \ + template<> struct nl_datatype{ static const pstate_data_type_e type = pstate_data_type_e(TYPEDESC); static const bool is_ptr = true;}; NETLIST_SAVE_TYPE(char, DT_INT8); NETLIST_SAVE_TYPE(double, DT_DOUBLE); @@ -104,10 +104,10 @@ struct pstate_entry_t template T *resolved() { - if (m_is_ptr) - return *static_cast(m_ptr); - else - return static_cast(m_ptr); + if (m_is_ptr) + return *static_cast(m_ptr); + else + return static_cast(m_ptr); } }; diff --git a/src/emu/sound.h b/src/emu/sound.h index c2e48204c0e..438c0663989 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -23,7 +23,7 @@ //************************************************************************** const int STREAM_SYNC = -1; // special rate value indicating a one-sample-at-a-time stream - // with actual rate defined by its input + // with actual rate defined by its input //************************************************************************** // MACROS diff --git a/src/emu/sound/amiga.h b/src/emu/sound/amiga.h index 56e092b248f..1963f5a16d2 100644 --- a/src/emu/sound/amiga.h +++ b/src/emu/sound/amiga.h @@ -18,7 +18,7 @@ // ======================> amiga_sound_device -class amiga_sound_device : public device_t, public device_sound_interface +class amiga_sound_device : public device_t, public device_sound_interface { public: amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); diff --git a/src/emu/sound/ay8910.h b/src/emu/sound/ay8910.h index 537f7ec6109..d8803044b4f 100644 --- a/src/emu/sound/ay8910.h +++ b/src/emu/sound/ay8910.h @@ -70,7 +70,7 @@ YMZ294: 0 I/O port #define MCFG_AY8910_OUTPUT_TYPE(_flag) \ ay8910_device::set_flags(*device, _flag); - + #define MCFG_AY8910_RES_LOADS(_res0, _res1, _res2) \ ay8910_device::set_resistors_load(*device, _res0, _res1, _res2); @@ -100,16 +100,16 @@ public: // construction/destruction ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ay8910_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, - UINT32 clock, psg_type_t psg_type, int streams, int ioports, const char *shortname, const char *source); + UINT32 clock, psg_type_t psg_type, int streams, int ioports, const char *shortname, const char *source); // static configuration helpers static void set_flags(device_t &device, int flags) { downcast(device).m_flags = flags; } - static void set_resistors_load(device_t &device, int res_load0, int res_load1, int res_load2) { downcast(device).m_res_load[0] = res_load0; downcast(device).m_res_load[1] = res_load1; downcast(device).m_res_load[2] = res_load2; } + static void set_resistors_load(device_t &device, int res_load0, int res_load1, int res_load2) { downcast(device).m_res_load[0] = res_load0; downcast(device).m_res_load[1] = res_load1; downcast(device).m_res_load[2] = res_load2; } template static devcb_base &set_port_a_read_callback(device_t &device, _Object object) { return downcast(device).m_port_a_read_cb.set_callback(object); } template static devcb_base &set_port_b_read_callback(device_t &device, _Object object) { return downcast(device).m_port_b_read_cb.set_callback(object); } template static devcb_base &set_port_a_write_callback(device_t &device, _Object object) { return downcast(device).m_port_a_write_cb.set_callback(object); } template static devcb_base &set_port_b_write_callback(device_t &device, _Object object) { return downcast(device).m_port_b_write_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( data_r ); DECLARE_WRITE8_MEMBER( address_w ); DECLARE_WRITE8_MEMBER( data_w ); @@ -125,7 +125,7 @@ public: void set_volume(int channel,int volume); void ay_set_clock(int clock); - + struct ay_ym_param { double r_up; @@ -134,13 +134,13 @@ public: double res[32]; }; - struct mosfet_param - { - double m_Vth; - double m_Vg; - int m_count; - double m_Kn[32]; - }; + struct mosfet_param + { + double m_Vth; + double m_Vg; + int m_count; + double m_Kn[32]; + }; void ay8910_write_ym(int addr, int data); int ay8910_read_ym(); diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h index 427a91e4a5e..d61e7127bb0 100644 --- a/src/emu/sound/discrete.h +++ b/src/emu/sound/discrete.h @@ -3751,7 +3751,7 @@ enum * add and delete may be slow - the focus is on access! */ - // TODO: replace with dynamic_array from utils + // TODO: replace with dynamic_array from utils template struct dynamic_array_t { public: diff --git a/src/emu/sound/es5506.h b/src/emu/sound/es5506.h index dfb99ca17ae..c434ec8b12e 100644 --- a/src/emu/sound/es5506.h +++ b/src/emu/sound/es5506.h @@ -19,37 +19,37 @@ #define MCFG_ES5506_REGION1(_region) \ es5506_device::set_region1(*device, _region); - + #define MCFG_ES5506_REGION2(_region) \ es5506_device::set_region2(*device, _region); - + #define MCFG_ES5506_REGION3(_region) \ es5506_device::set_region3(*device, _region); #define MCFG_ES5506_CHANNELS(_chan) \ es5506_device::set_channels(*device, _chan); - + #define MCFG_ES5506_IRQ_CB(_devcb) \ devcb = &es5506_device::set_irq_callback(*device, DEVCB_##_devcb); #define MCFG_ES5506_READ_PORT_CB(_devcb) \ - devcb = &es5506_device::set_read_port_callback(*device, DEVCB_##_devcb); + devcb = &es5506_device::set_read_port_callback(*device, DEVCB_##_devcb); + - #define MCFG_ES5505_REGION0(_region) \ es5505_device::set_region0(*device, _region); #define MCFG_ES5505_REGION1(_region) \ es5505_device::set_region1(*device, _region); - + #define MCFG_ES5505_CHANNELS(_chan) \ es5505_device::set_channels(*device, _chan); - + #define MCFG_ES5505_IRQ_CB(_devcb) \ devcb = &es5505_device::set_irq_callback(*device, DEVCB_##_devcb); #define MCFG_ES5505_READ_PORT_CB(_devcb) \ - devcb = &es5505_device::set_read_port_callback(*device, DEVCB_##_devcb); + devcb = &es5505_device::set_read_port_callback(*device, DEVCB_##_devcb); /* struct describing a single playing voice */ @@ -117,7 +117,7 @@ class es550x_device : public device_t, public: es550x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); ~es550x_device() {} - + static void set_region0(device_t &device, const char *region0) { downcast(device).m_region0 = region0; } static void set_region1(device_t &device, const char *region1) { downcast(device).m_region1 = region1; } static void set_region2(device_t &device, const char *region2) { downcast(device).m_region2 = region2; } @@ -125,7 +125,7 @@ public: static void set_channels(device_t &device, int channels) { downcast(device).m_channels = channels; } template static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } template static devcb_base &set_read_port_callback(device_t &device, _Object object) { return downcast(device).m_read_port_cb.set_callback(object); } - + protected: // device-level overrides @@ -164,7 +164,7 @@ protected: #endif FILE *m_eslog; - + const char * m_region0; /* memory region where the sample ROM lives */ const char * m_region1; /* memory region where the sample ROM lives */ const char * m_region2; /* memory region where the sample ROM lives */ diff --git a/src/emu/sound/gaelco.h b/src/emu/sound/gaelco.h index c1cf64ed6d7..83235e9f69c 100644 --- a/src/emu/sound/gaelco.h +++ b/src/emu/sound/gaelco.h @@ -51,7 +51,7 @@ public: dev.m_banks[2] = offs3; dev.m_banks[3] = offs4; } - + protected: // device-level overrides virtual void device_start(); diff --git a/src/emu/sound/namco.h b/src/emu/sound/namco.h index b0c1d2a4fbc..3da05979fb3 100644 --- a/src/emu/sound/namco.h +++ b/src/emu/sound/namco.h @@ -40,7 +40,7 @@ public: // static configuration static void set_voices(device_t &device, int voices) { downcast(device).m_voices = voices; } static void set_stereo(device_t &device, int stereo) { downcast(device).m_stereo = stereo; } - + protected: // device-level overrides virtual void device_start(); diff --git a/src/emu/sound/nes_apu.h b/src/emu/sound/nes_apu.h index 3c8d777159a..3027c23d4b9 100644 --- a/src/emu/sound/nes_apu.h +++ b/src/emu/sound/nes_apu.h @@ -47,7 +47,7 @@ class nesapu_device : public device_t, public: nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~nesapu_device() {} - + static void set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu_tag = tag; } DECLARE_READ8_MEMBER( read ); diff --git a/src/emu/sound/okim6258.h b/src/emu/sound/okim6258.h index affbb5019be..57eaf465a1e 100644 --- a/src/emu/sound/okim6258.h +++ b/src/emu/sound/okim6258.h @@ -84,8 +84,8 @@ private: UINT8 m_nibble_shift; /* nibble select */ sound_stream *m_stream; /* which stream are we playing on? */ - UINT8 m_output_bits; /* D/A precision is 10-bits but 12-bit data can be - output serially to an external DAC */ + UINT8 m_output_bits; /* D/A precision is 10-bits but 12-bit data can be + output serially to an external DAC */ INT32 m_signal; INT32 m_step; diff --git a/src/emu/sound/pokey.h b/src/emu/sound/pokey.h index e66bab4e465..2c55c6fcb6c 100644 --- a/src/emu/sound/pokey.h +++ b/src/emu/sound/pokey.h @@ -220,7 +220,7 @@ public: template static devcb_base &set_allpot_r_callback(device_t &device, _Object object) { return downcast(device).m_allpot_r_cb.set_callback(object); } template static devcb_base &set_serin_r_callback(device_t &device, _Object object) { return downcast(device).m_serin_r_cb.set_callback(object); } template static devcb_base &set_serout_w_callback(device_t &device, _Object object) { return downcast(device).m_serout_w_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); diff --git a/src/emu/sound/rf5c68.h b/src/emu/sound/rf5c68.h index d4d5b13cf04..ca6cebc3989 100644 --- a/src/emu/sound/rf5c68.h +++ b/src/emu/sound/rf5c68.h @@ -62,7 +62,7 @@ public: ~rf5c68_device() { } static void set_end_callback(device_t &device, rf5c68_sample_end_cb_delegate callback) { downcast(device).m_sample_end_cb = callback; } - + protected: // device-level overrides virtual void device_start(); diff --git a/src/emu/sound/segapcm.h b/src/emu/sound/segapcm.h index 2c4e38f03f8..c090a74f29b 100644 --- a/src/emu/sound/segapcm.h +++ b/src/emu/sound/segapcm.h @@ -38,13 +38,13 @@ class segapcm_device : public device_t, public: segapcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~segapcm_device() { } - + // static configuration static void set_bank(device_t &device, int bank) { downcast(device).m_bank = bank; } - + DECLARE_WRITE8_MEMBER( sega_pcm_w ); DECLARE_READ8_MEMBER( sega_pcm_r ); - + protected: // device-level overrides virtual void device_start(); diff --git a/src/emu/sound/tms36xx.h b/src/emu/sound/tms36xx.h index 8cdf5f2c798..a38552592a1 100644 --- a/src/emu/sound/tms36xx.h +++ b/src/emu/sound/tms36xx.h @@ -44,8 +44,8 @@ public: tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~tms36xx_device() { } - static void set_subtype(device_t &device, int type) - { + static void set_subtype(device_t &device, int type) + { tms36xx_device &dev = downcast(device); switch (type) { @@ -63,9 +63,9 @@ public: break; } } - static void set_tune_speed(device_t &device, double speed) - { - downcast(device).m_speed = (speed > 0) ? TMS36XX_VMAX / speed : TMS36XX_VMAX; + static void set_tune_speed(device_t &device, double speed) + { + downcast(device).m_speed = (speed > 0) ? TMS36XX_VMAX / speed : TMS36XX_VMAX; } static void set_decays(device_t &device, double decay_0, double decay_1, double decay_2, double decay_3, double decay_4, double decay_5) { @@ -77,7 +77,7 @@ public: dev.m_decay_time[4] = decay_4; dev.m_decay_time[5] = decay_5; } - + protected: // device-level overrides virtual void device_start(); diff --git a/src/emu/sound/tms5110.h b/src/emu/sound/tms5110.h index e11e0534c79..bf6eed76ee8 100644 --- a/src/emu/sound/tms5110.h +++ b/src/emu/sound/tms5110.h @@ -80,8 +80,8 @@ protected: void set_variant(int variant); - UINT8 m_talk_status; - sound_stream *m_stream; + UINT8 m_talk_status; + sound_stream *m_stream; private: void new_int_write(UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr); @@ -107,7 +107,7 @@ private: UINT8 m_CTL_pins; UINT8 m_speaking_now; - + UINT8 m_state; /* Rom interface */ @@ -259,7 +259,7 @@ public: static void set_stop_bit(device_t &device, UINT8 stop_bit) { downcast(device).m_stop_bit = stop_bit; } template static devcb_base &set_pdc_callback(device_t &device, _Object object) { return downcast(device).m_pdc_cb.set_callback(object); } template static devcb_base &set_ctl_callback(device_t &device, _Object object) { return downcast(device).m_ctl_cb.set_callback(object); } - + DECLARE_WRITE_LINE_MEMBER( m0_w ); DECLARE_READ_LINE_MEMBER( data_r ); @@ -314,25 +314,25 @@ extern const device_type TMSPROM; #define MCFG_TMSPROM_ROM_SIZE(_size) \ tmsprom_device::set_rom_size(*device, _size); - + #define MCFG_TMSPROM_PDC_BIT(_bit) \ tmsprom_device::set_pdc_bit(*device, _bit); - + #define MCFG_TMSPROM_CTL1_BIT(_bit) \ tmsprom_device::set_ctl1_bit(*device, _bit); #define MCFG_TMSPROM_CTL2_BIT(_bit) \ tmsprom_device::set_ctl2_bit(*device, _bit); - + #define MCFG_TMSPROM_CTL4_BIT(_bit) \ tmsprom_device::set_ctl4_bit(*device, _bit); - + #define MCFG_TMSPROM_CTL8_BIT(_bit) \ tmsprom_device::set_ctl8_bit(*device, _bit); #define MCFG_TMSPROM_RESET_BIT(_bit) \ tmsprom_device::set_reset_bit(*device, _bit); - + #define MCFG_TMSPROM_STOP_BIT(_bit) \ tmsprom_device::set_stop_bit(*device, _bit); @@ -340,6 +340,6 @@ extern const device_type TMSPROM; devcb = &tmsprom_device::set_pdc_callback(*device, DEVCB_##_devcb); #define MCFG_TMSPROM_CTL_CB(_devcb) \ - devcb = &tmsprom_device::set_ctl_callback(*device, DEVCB_##_devcb); + devcb = &tmsprom_device::set_ctl_callback(*device, DEVCB_##_devcb); #endif /* __TMS5110_H__ */ diff --git a/src/emu/sound/vrender0.h b/src/emu/sound/vrender0.h index 21515269027..e44bdae2dc5 100644 --- a/src/emu/sound/vrender0.h +++ b/src/emu/sound/vrender0.h @@ -41,7 +41,7 @@ public: protected: // device-level overrides virtual void device_start(); - + // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); diff --git a/src/emu/video.h b/src/emu/video.h index b1c74355410..5904b4c6c53 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -170,7 +170,7 @@ private: attotime m_mng_frame_period; // period of a single movie frame attotime m_mng_next_frame_time; // time of next frame UINT32 m_mng_frame; // current movie frame number - + // movie recording - AVI avi_file * m_avi_file; // handle to the open movie file attotime m_avi_frame_period; // period of a single movie frame diff --git a/src/emu/video/crtc_ega.h b/src/emu/video/crtc_ega.h index 5356ee28f5f..3ea4d22d8a0 100644 --- a/src/emu/video/crtc_ega.h +++ b/src/emu/video/crtc_ega.h @@ -59,20 +59,20 @@ class crtc_ega_device : public device_t, public: crtc_ega_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - template static devcb_base &set_res_out_de_callback(device_t &device, _Object object) + template static devcb_base &set_res_out_de_callback(device_t &device, _Object object) { return downcast(device).m_res_out_de_cb.set_callback(object); } - template static devcb_base &set_res_out_hsync_callback(device_t &device, _Object object) + template static devcb_base &set_res_out_hsync_callback(device_t &device, _Object object) { return downcast(device).m_res_out_hsync_cb.set_callback(object); } - template static devcb_base &set_res_out_vsync_callback(device_t &device, _Object object) + template static devcb_base &set_res_out_vsync_callback(device_t &device, _Object object) { return downcast(device).m_res_out_vsync_cb.set_callback(object); } - template static devcb_base &set_res_out_vblank_callback(device_t &device, _Object object) + template static devcb_base &set_res_out_vblank_callback(device_t &device, _Object object) { return downcast(device).m_res_out_vblank_cb.set_callback(object); } static void set_begin_update_callback(device_t &device, crtc_ega_begin_update_delegate callback) { downcast(device).m_begin_update_cb = callback; } static void set_row_update_callback(device_t &device, crtc_ega_row_update_delegate callback) { downcast(device).m_row_update_cb = callback; } static void set_end_update_callback(device_t &device, crtc_ega_end_update_delegate callback) { downcast(device).m_end_update_cb = callback; } static void set_hpixels_per_column(device_t &device, int hpixels_per_column) { downcast(device).m_hpixels_per_column = hpixels_per_column; } - + /* select one of the registers for reading or writing */ DECLARE_WRITE8_MEMBER( address_w ); @@ -119,16 +119,16 @@ private: optionally return a pointer that will be passed to the update and tear down callbacks */ crtc_ega_begin_update_delegate m_begin_update_cb; - + /* this gets called for every row, the driver must output x_count * hpixels_per_column pixels. cursor_x indicates the character position where the cursor is, or -1 if there is no cursor on this row */ crtc_ega_row_update_delegate m_row_update_cb; - + /* if specified, this gets called after all row updating is complete */ crtc_ega_end_update_delegate m_end_update_cb; - + /* ega/vga register file */ UINT8 m_horiz_char_total; /* 0x00 */ UINT8 m_horiz_disp; /* 0x01 */ diff --git a/src/emu/video/huc6202.h b/src/emu/video/huc6202.h index 1f4b6d100fd..e5f16f679de 100644 --- a/src/emu/video/huc6202.h +++ b/src/emu/video/huc6202.h @@ -46,13 +46,13 @@ #define MCFG_HUC6202_WRITE_1_CB(_devcb) \ devcb = &huc6202_device::set_write_1_callback(*device, DEVCB_##_devcb); - + class huc6202_device : public device_t { public: // construction/destruction huc6202_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_next_pixel_0_callback(device_t &device, _Object object) { return downcast(device).m_next_pixel_0_cb.set_callback(object); } template static devcb_base &set_time_til_next_event_0_callback(device_t &device, _Object object) { return downcast(device).m_time_til_next_event_0_cb.set_callback(object); } template static devcb_base &set_vsync_changed_0_callback(device_t &device, _Object object) { return downcast(device).m_vsync_changed_0_cb.set_callback(object); } @@ -65,7 +65,7 @@ public: template static devcb_base &set_hsync_changed_1_callback(device_t &device, _Object object) { return downcast(device).m_hsync_changed_1_cb.set_callback(object); } template static devcb_base &set_read_1_callback(device_t &device, _Object object) { return downcast(device).m_read_1_cb.set_callback(object); } template static devcb_base &set_write_1_callback(device_t &device, _Object object) { return downcast(device).m_write_1_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); DECLARE_READ8_MEMBER( io_read ); diff --git a/src/emu/video/mc6845.h b/src/emu/video/mc6845.h index 702c9a6f6d6..b12cb56875b 100644 --- a/src/emu/video/mc6845.h +++ b/src/emu/video/mc6845.h @@ -67,7 +67,7 @@ typedef device_delegate #define MC6845_BEGIN_UPDATE(name) void name(bitmap_rgb32 &bitmap, const rectangle &cliprect) typedef device_delegate mc6845_update_row_delegate; + UINT16 y, UINT8 x_count, INT8 cursor_x, int de, int hbp, int vbp)> mc6845_update_row_delegate; #define MC6845_UPDATE_ROW(name) void name(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, \ UINT16 y, UINT8 x_count, INT8 cursor_x, int de, int hbp, int vbp) @@ -97,7 +97,7 @@ public: mc6845_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); static void set_show_border_area(device_t &device, bool show) { downcast(device).m_show_border_area = show; } - static void set_visarea_adjust(device_t &device, int min_x, int max_x, int min_y, int max_y) + static void set_visarea_adjust(device_t &device, int min_x, int max_x, int min_y, int max_y) { mc6845_device &dev = downcast(device); dev.m_visarea_adjust_min_x = min_x; @@ -116,7 +116,7 @@ public: template static devcb_base &set_out_cur_callback(device_t &device, _Object object) { return downcast(device).m_out_cur_cb.set_callback(object); } template static devcb_base &set_out_hsync_callback(device_t &device, _Object object) { return downcast(device).m_out_hsync_cb.set_callback(object); } template static devcb_base &set_out_vsync_callback(device_t &device, _Object object) { return downcast(device).m_out_vsync_cb.set_callback(object); } - + /* select one of the registers for reading or writing */ DECLARE_WRITE8_MEMBER( address_w ); @@ -238,7 +238,7 @@ protected: emu_timer *m_light_pen_latch_timer; emu_timer *m_upd_adr_timer; emu_timer *m_upd_trans_timer; - + /* computed values - do NOT state save these! */ /* These computed are used to define the screen parameters for a driver */ UINT16 m_horiz_pix_total; @@ -271,45 +271,45 @@ protected: /************************ interface CRTC - driver ************************/ - + bool m_show_border_area; /* visible screen area (false) active display (true) active display + blanking */ - + /* visible screen area adjustment */ int m_visarea_adjust_min_x; int m_visarea_adjust_max_x; int m_visarea_adjust_min_y; int m_visarea_adjust_max_y; - + int m_hpixels_per_column; /* number of pixels per video memory address */ /* if specified, this gets called before any pixel update, optionally return a pointer that will be passed to the update and tear down callbacks */ mc6845_begin_update_delegate m_begin_update_cb; - + /* this gets called for every row, the driver must output x_count * hpixels_per_column pixels. cursor_x indicates the character position where the cursor is, or -1 if there is no cursor on this row */ mc6845_update_row_delegate m_update_row_cb; - + /* if specified, this gets called after all row updating is complete */ mc6845_end_update_delegate m_end_update_cb; - + /* Called whenever the update address changes * For vblank/hblank timing strobe indicates the physical update. * vblank/hblank timing not supported yet! */ mc6845_on_update_addr_changed_delegate m_on_update_addr_changed_cb; - + /* if specified, this gets called for every change of the disply enable pin (pin 18) */ devcb_write_line m_out_de_cb; - + /* if specified, this gets called for every change of the cursor pin (pin 19) */ devcb_write_line m_out_cur_cb; - + /* if specified, this gets called for every change of the HSYNC pin (pin 39) */ devcb_write_line m_out_hsync_cb; - + /* if specified, this gets called for every change of the VSYNC pin (pin 40) */ devcb_write_line m_out_vsync_cb; }; diff --git a/src/emu/video/mc6847.h b/src/emu/video/mc6847.h index b86c8d5a4de..eea69cbaa27 100644 --- a/src/emu/video/mc6847.h +++ b/src/emu/video/mc6847.h @@ -269,11 +269,11 @@ protected: // callbacks devcb_write_line m_write_hsync; devcb_write_line m_write_fsync; - + /* if specified, this reads the external char rom off of the driver state */ // moved here from mc6847_base_device so to be useable in GIME mc6847_get_char_rom_delegate m_charrom_cb; - + // incidentals character_map m_character_map; artifacter m_artifacter; @@ -546,7 +546,7 @@ protected: virtual void field_sync_changed(bool line); virtual void record_body_scanline(UINT16 physical_scanline, UINT16 scanline); virtual void record_partial_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline, INT32 start_clock, INT32 end_clock); - + void set_custom_palette(const pixel_t *custom_palette) { if ( m_palette != m_bw_palette ) @@ -568,7 +568,7 @@ private: static const UINT32 s_palette[PALETTE_LENGTH]; // callbacks - + /* if specified, this gets called whenever reading a byte (offs_t ~0 specifies DA* entering the tristate mode) */ devcb_read8 m_input_cb; @@ -616,7 +616,7 @@ private: // setup functions void setup_fixed_mode(); - + // runtime functions void record_body_scanline(UINT16 physical_scanline, UINT16 scanline, INT32 start_pos, INT32 end_pos); pixel_t border_value(UINT8 mode, const pixel_t *palette, bool is_mc6847t1); @@ -678,7 +678,7 @@ class s68047_device : public mc6847_base_device { public: s68047_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + void hack_black_becomes_blue(bool flag); private: @@ -687,7 +687,7 @@ private: class m5c6847p1_device : public mc6847_base_device { -public: +public: m5c6847p1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; diff --git a/src/emu/video/ramdac.h b/src/emu/video/ramdac.h index 310f17deadf..967646c012b 100644 --- a/src/emu/video/ramdac.h +++ b/src/emu/video/ramdac.h @@ -73,7 +73,7 @@ private: const address_space_config m_space_config; required_device m_palette; - + UINT8 m_split_read_reg; // read register index is separated, seen in rltennis }; diff --git a/src/emu/video/snes_ppu.h b/src/emu/video/snes_ppu.h index 80c95444573..5f628e76259 100644 --- a/src/emu/video/snes_ppu.h +++ b/src/emu/video/snes_ppu.h @@ -54,7 +54,7 @@ enum struct SNES_SCANLINE { int enable, clip; - + UINT16 buffer[SNES_SCR_WIDTH]; UINT8 priority[SNES_SCR_WIDTH]; UINT8 layer[SNES_SCR_WIDTH]; @@ -74,9 +74,9 @@ public: template static devcb_base &static_set_open_bus_callback(device_t &device, _Object object) { return downcast(device).m_openbus_cb.set_callback(object); } UINT8 m_regs[0x40]; - + SNES_SCANLINE m_scanlines[2]; - + struct { /* clipmasks */ @@ -85,23 +85,23 @@ public: UINT8 wlog_mask; /* color math enabled */ UINT8 color_math; - + UINT8 charmap; UINT8 tilemap; UINT8 tilemap_size; - + UINT8 tile_size; UINT8 mosaic_enabled; // actually used only for layers 0->3! - + UINT8 main_window_enabled; UINT8 sub_window_enabled; UINT8 main_bg_enabled; UINT8 sub_bg_enabled; - + UINT16 hoffs; UINT16 voffs; } m_layer[6]; // this is for the BG1 - BG2 - BG3 - BG4 - OBJ - color layers - + struct { UINT8 address_low; @@ -119,7 +119,7 @@ public: UINT8 flip; UINT16 write_latch; } m_oam; - + struct { UINT16 latch_horz; @@ -129,7 +129,7 @@ public: UINT8 last_visible_line; UINT8 interlace_count; } m_beam; - + struct { UINT8 repeat; @@ -145,7 +145,7 @@ public: UINT16 ver_offset; UINT8 extbg; } m_mode7; - + struct OAM { UINT16 tile; @@ -153,19 +153,19 @@ public: UINT8 size, vflip, hflip, priority_bits, pal; int height, width; }; - + struct OAM m_oam_spritelist[SNES_SCR_WIDTH / 2]; - + UINT8 m_oam_itemlist[32]; - + struct TILELIST { INT16 x; UINT16 priority, pal, tileaddr; int hflip; }; - + struct TILELIST m_oam_tilelist[34]; - + #if SNES_LAYER_DEBUG struct DEBUGOPTS { @@ -180,7 +180,7 @@ public: }; struct DEBUGOPTS m_debug_options; #endif - + UINT8 m_mosaic_size; UINT8 m_clip_to_black; UINT8 m_prevent_color_math; @@ -188,13 +188,13 @@ public: UINT8 m_bg3_priority_bit; UINT8 m_direct_color; UINT8 m_ppu_last_scroll; /* as per Anomie's doc and Theme Park, all scroll regs shares (but mode 7 ones) the same - 'previous' scroll value */ + 'previous' scroll value */ UINT8 m_mode7_last_scroll; /* as per Anomie's doc mode 7 scroll regs use a different value, shared with mode 7 matrix! */ - + UINT8 m_ppu1_open_bus, m_ppu2_open_bus; UINT8 m_ppu1_version, m_ppu2_version; UINT8 m_window1_left, m_window1_right, m_window2_left, m_window2_right; - + UINT16 m_mosaic_table[16][4096]; UINT8 m_clipmasks[6][SNES_SCR_WIDTH]; UINT8 m_update_windows; @@ -209,7 +209,7 @@ public: UINT8 m_color_modes; UINT8 m_stat77; UINT8 m_stat78; - + UINT16 m_htmult; /* in 512 wide, we run HTOTAL double and halve it on latching */ UINT16 m_cgram_address; /* CGRAM address */ UINT8 m_read_ophct; @@ -221,7 +221,7 @@ public: UINT16 m_vram_fgr_shift; UINT16 m_vram_read_buffer; UINT16 m_vmadd; - + inline UINT16 get_bgcolor(UINT8 direct_colors, UINT16 palette, UINT8 color); inline void set_scanline_pixel(int screen, INT16 x, UINT16 color, UINT8 priority, UINT8 layer, int blend); inline void draw_bgtile_lores(UINT8 layer, INT16 ii, UINT8 colour, UINT16 pal, UINT8 direct_colors, UINT8 priority); @@ -249,15 +249,15 @@ public: void update_offsets(void); inline void draw_blend(UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens); void refresh_scanline(running_machine &machine, bitmap_rgb32 &bitmap, UINT16 curline); - + void latch_counters(running_machine &machine); void dynamic_res_change(running_machine &machine); inline UINT32 get_vram_address(running_machine &machine); UINT8 dbg_video(running_machine &machine, UINT16 curline); - + UINT8 read(address_space &space, UINT32 offset, UINT8 wrio_bit7); void write(address_space &space, UINT32 offset, UINT8 data); - + DECLARE_READ8_MEMBER( oam_read ); DECLARE_WRITE8_MEMBER( oam_write ); DECLARE_READ8_MEMBER( cgram_read ); @@ -271,7 +271,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void device_reset() {}; + virtual void device_reset() {}; private: devcb_read16 m_openbus_cb; diff --git a/src/emu/video/t6a04.h b/src/emu/video/t6a04.h index 2685f8b38b4..2fe5b68bd33 100644 --- a/src/emu/video/t6a04.h +++ b/src/emu/video/t6a04.h @@ -29,7 +29,7 @@ public: dev.m_width = w; dev.m_height = h; } - + // device interface DECLARE_WRITE8_MEMBER(control_write); DECLARE_READ8_MEMBER(control_read); diff --git a/src/emu/video/tms3556.h b/src/emu/video/tms3556.h index 6de8f1b880b..5914780397f 100644 --- a/src/emu/video/tms3556.h +++ b/src/emu/video/tms3556.h @@ -108,14 +108,14 @@ private: // register interface int m_reg_access_phase; - + int m_row_col_written; int m_bamp_written; int m_colrow; - dma_mode_tt m_vdp_acmpxy_mode; - UINT16 m_vdp_acmpxy; - UINT16 m_vdp_acmp; - int m_init_read; + dma_mode_tt m_vdp_acmpxy_mode; + UINT16 m_vdp_acmpxy; + UINT16 m_vdp_acmp; + int m_init_read; int m_scanline; // scanline counter int m_blink, m_blink_count; // blinking diff --git a/src/emu/video/tms9928a.h b/src/emu/video/tms9928a.h index 19ba5a69226..4baebba655a 100644 --- a/src/emu/video/tms9928a.h +++ b/src/emu/video/tms9928a.h @@ -39,13 +39,13 @@ #define TMS9928A_VERT_DISPLAY_START_PAL (13 + 51) #define TMS9928A_VERT_DISPLAY_START_NTSC (13 + 27) -// MCFG_DEVICE_ADD(_tag, _variant, XTAL_10_738635MHz / 2 ) +// MCFG_DEVICE_ADD(_tag, _variant, XTAL_10_738635MHz / 2 ) #define MCFG_TMS9928A_VRAM_SIZE(_size) \ tms9928a_device::set_vram_size(*device, _size); #define MCFG_TMS9928A_OUT_INT_LINE_CB(_devcb) \ - devcb = &tms9928a_device::set_out_int_line_callback(*device, DEVCB_##_devcb); + devcb = &tms9928a_device::set_out_int_line_callback(*device, DEVCB_##_devcb); #define MCFG_TMS9928A_SET_SCREEN MCFG_VIDEO_SET_SCREEN @@ -85,7 +85,7 @@ public: static void set_vram_size(device_t &device, int vram_size) { downcast(device).m_vram_size = vram_size; } template static devcb_base &set_out_int_line_callback(device_t &device, _Object object) { return downcast(device).m_out_int_line_cb.set_callback(object); } - + DECLARE_READ8_MEMBER( vram_read ); DECLARE_WRITE8_MEMBER( vram_write ); DECLARE_READ8_MEMBER( register_read ); @@ -115,7 +115,7 @@ private: void set_palette(); static const device_timer_id TIMER_LINE = 0; - + int m_vram_size; /* 4K, 8K, or 16K. This should be replaced by fetching data from an address space? */ devcb_write_line m_out_int_line_cb; /* Callback is called whenever the state of the INT output changes */ diff --git a/src/emu/video/vic4567.h b/src/emu/video/vic4567.h index 1c0c27df27d..4582c537d7e 100644 --- a/src/emu/video/vic4567.h +++ b/src/emu/video/vic4567.h @@ -135,7 +135,7 @@ public: template static devcb_base &set_lightpen_x_callback(device_t &device, _Object object) { return downcast(device).m_lightpen_x_cb.set_callback(object); } template static devcb_base &set_lightpen_y_callback(device_t &device, _Object object) { return downcast(device).m_lightpen_y_cb.set_callback(object); } template static devcb_base &set_c64_mem_r_callback(device_t &device, _Object object) { return downcast(device).m_c64_mem_r_cb.set_callback(object); } - + DECLARE_WRITE8_MEMBER(port_w); DECLARE_WRITE8_MEMBER(palette_w); DECLARE_READ8_MEMBER(port_r); @@ -221,7 +221,7 @@ private: devcb_read8 m_lightpen_button_cb; devcb_read8 m_lightpen_x_cb; devcb_read8 m_lightpen_y_cb; - + /* C64 memory access */ devcb_read8 m_c64_mem_r_cb; @@ -239,10 +239,10 @@ extern const device_type VIC3; #define MCFG_VIC3_CPU(_tag) \ vic3_device::static_set_cpu_tag(*device, "^"_tag); - + #define MCFG_VIC3_TYPE(_type) \ vic3_device::set_vic3_type(*device, _type); - + #define MCFG_VIC3_DMA_READ_CB(_devcb) \ devcb = &vic3_device::set_dma_read_callback(*device, DEVCB_##_devcb); diff --git a/src/emu/video/vooddefs.h b/src/emu/video/vooddefs.h index b75737c2b75..8cb4a34ba18 100644 --- a/src/emu/video/vooddefs.h +++ b/src/emu/video/vooddefs.h @@ -3400,10 +3400,10 @@ do /* add clocal or alocal to alpha */ \ if (FBZCP_CCA_ADD_ACLOCAL(FBZCOLORPATH)) \ a += c_local.rgb.a; \ - \ + \ /* clamp */ \ CLAMP(a, 0x00, 0xff); \ - \ + \ /* invert */ \ if (FBZCP_CCA_INVERT_OUTPUT(FBZCOLORPATH)) \ a ^= 0xff; \ diff --git a/src/emu/video/voodoo.h b/src/emu/video/voodoo.h index 70234ab4148..dcd03d38876 100644 --- a/src/emu/video/voodoo.h +++ b/src/emu/video/voodoo.h @@ -39,23 +39,23 @@ enum ***************************************************************************/ #define MCFG_VOODOO_FBMEM(_value) \ - voodoo_device::static_set_fbmem(*device, _value); + voodoo_device::static_set_fbmem(*device, _value); #define MCFG_VOODOO_TMUMEM(_value1, _value2) \ - voodoo_device::static_set_tmumem(*device, _value1, _value2); + voodoo_device::static_set_tmumem(*device, _value1, _value2); #define MCFG_VOODOO_SCREEN_TAG(_tag) \ - voodoo_device::static_set_screen_tag(*device, _tag); + voodoo_device::static_set_screen_tag(*device, _tag); #define MCFG_VOODOO_CPU_TAG(_tag) \ - voodoo_device::static_set_cpu_tag(*device, _tag); + voodoo_device::static_set_cpu_tag(*device, _tag); #define MCFG_VOODOO_VBLANK_CB(_devcb) \ devcb = &voodoo_device::static_set_vblank_callback(*device, DEVCB_##_devcb); - + #define MCFG_VOODOO_STALL_CB(_devcb) \ devcb = &voodoo_device::static_set_stall_callback(*device, DEVCB_##_devcb); - + /*************************************************************************** FUNCTION PROTOTYPES @@ -81,14 +81,14 @@ public: static void static_set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cputag = tag; } template static devcb_base &static_set_vblank_callback(device_t &device, _Object object) { return downcast(device).m_vblank.set_callback(object); } template static devcb_base &static_set_stall_callback(device_t &device, _Object object) { return downcast(device).m_stall.set_callback(object); } - + DECLARE_READ32_MEMBER( voodoo_r ); DECLARE_WRITE32_MEMBER( voodoo_w ); // access to legacy token struct voodoo_state *token() const { assert(m_token != NULL); return m_token; } void common_start_voodoo(UINT8 type); - + UINT8 m_fbmem; UINT8 m_tmumem0; UINT8 m_tmumem1; @@ -96,7 +96,7 @@ public: const char * m_cputag; devcb_write_line m_vblank; devcb_write_line m_stall; - + protected: // device-level overrides virtual void device_config_complete(); diff --git a/src/lib/lua/bridge/LuaBridge.h b/src/lib/lua/bridge/LuaBridge.h index 1928e9a1f03..80f000e310b 100644 --- a/src/lib/lua/bridge/LuaBridge.h +++ b/src/lib/lua/bridge/LuaBridge.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2007, Nathan Reed @@ -45,7 +45,6 @@ namespace luabridge { - // Forward declaration // template @@ -73,31 +72,31 @@ class LuaRef; class Security { public: - static bool hideMetatables () - { - return getSettings().hideMetatables; - } + static bool hideMetatables () + { + return getSettings().hideMetatables; + } - static void setHideMetatables (bool shouldHide) - { - getSettings().hideMetatables = shouldHide; - } + static void setHideMetatables (bool shouldHide) + { + getSettings().hideMetatables = shouldHide; + } private: - struct Settings - { - Settings () : hideMetatables (true) - { - } + struct Settings + { + Settings () : hideMetatables (true) + { + } - bool hideMetatables; - }; + bool hideMetatables; + }; - static Settings& getSettings () - { - static Settings settings; - return settings; - } + static Settings& getSettings () + { + static Settings settings; + return settings; + } }; #include "detail/Userdata.h" @@ -111,7 +110,7 @@ private: template inline void push (lua_State* L, T t) { - Stack ::push (L, t); + Stack ::push (L, t); } //------------------------------------------------------------------------------ @@ -124,8 +123,8 @@ inline void push (lua_State* L, T t) template inline void setGlobal (lua_State* L, T t, char const* name) { - push (L, t); - lua_setglobal (L, name); + push (L, t); + lua_setglobal (L, name); } //------------------------------------------------------------------------------ @@ -134,7 +133,7 @@ inline void setGlobal (lua_State* L, T t, char const* name) */ inline void setHideMetatables (bool shouldHide) { - Security::setHideMetatables (shouldHide); + Security::setHideMetatables (shouldHide); } } diff --git a/src/lib/lua/bridge/detail/CFunctions.h b/src/lib/lua/bridge/detail/CFunctions.h index 0497b6bb4b9..635aa038785 100644 --- a/src/lib/lua/bridge/detail/CFunctions.h +++ b/src/lib/lua/bridge/detail/CFunctions.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco License: The MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -30,413 +30,413 @@ // struct CFunc { - //---------------------------------------------------------------------------- - /** - __index metamethod for a namespace or class static members. + //---------------------------------------------------------------------------- + /** + __index metamethod for a namespace or class static members. - This handles: - Retrieving functions and class static methods, stored in the metatable. - Reading global and class static data, stored in the __propget table. - Reading global and class properties, stored in the __propget table. - */ - static int indexMetaMethod (lua_State* L) - { - int result = 0; - lua_getmetatable (L, 1); // push metatable of arg1 - for (;;) - { - lua_pushvalue (L, 2); // push key arg2 - lua_rawget (L, -2); // lookup key in metatable - if (lua_isnil (L, -1)) // not found - { - lua_pop (L, 1); // discard nil - rawgetfield (L, -1, "__propget"); // lookup __propget in metatable - lua_pushvalue (L, 2); // push key arg2 - lua_rawget (L, -2); // lookup key in __propget - lua_remove (L, -2); // discard __propget - if (lua_iscfunction (L, -1)) - { - lua_remove (L, -2); // discard metatable - lua_pushvalue (L, 1); // push arg1 - lua_call (L, 1, 1); // call cfunction - result = 1; - break; - } - else - { - assert (lua_isnil (L, -1)); - lua_pop (L, 1); // discard nil and fall through - } - } - else - { - assert (lua_istable (L, -1) || lua_iscfunction (L, -1)); - lua_remove (L, -2); - result = 1; - break; - } + This handles: + Retrieving functions and class static methods, stored in the metatable. + Reading global and class static data, stored in the __propget table. + Reading global and class properties, stored in the __propget table. + */ + static int indexMetaMethod (lua_State* L) + { + int result = 0; + lua_getmetatable (L, 1); // push metatable of arg1 + for (;;) + { + lua_pushvalue (L, 2); // push key arg2 + lua_rawget (L, -2); // lookup key in metatable + if (lua_isnil (L, -1)) // not found + { + lua_pop (L, 1); // discard nil + rawgetfield (L, -1, "__propget"); // lookup __propget in metatable + lua_pushvalue (L, 2); // push key arg2 + lua_rawget (L, -2); // lookup key in __propget + lua_remove (L, -2); // discard __propget + if (lua_iscfunction (L, -1)) + { + lua_remove (L, -2); // discard metatable + lua_pushvalue (L, 1); // push arg1 + lua_call (L, 1, 1); // call cfunction + result = 1; + break; + } + else + { + assert (lua_isnil (L, -1)); + lua_pop (L, 1); // discard nil and fall through + } + } + else + { + assert (lua_istable (L, -1) || lua_iscfunction (L, -1)); + lua_remove (L, -2); + result = 1; + break; + } - rawgetfield (L, -1, "__parent"); - if (lua_istable (L, -1)) - { - // Remove metatable and repeat the search in __parent. - lua_remove (L, -2); - } - else - { - // Discard metatable and return nil. - assert (lua_isnil (L, -1)); - lua_remove (L, -2); - result = 1; - break; - } - } + rawgetfield (L, -1, "__parent"); + if (lua_istable (L, -1)) + { + // Remove metatable and repeat the search in __parent. + lua_remove (L, -2); + } + else + { + // Discard metatable and return nil. + assert (lua_isnil (L, -1)); + lua_remove (L, -2); + result = 1; + break; + } + } - return result; - } + return result; + } - //---------------------------------------------------------------------------- - /** - __newindex metamethod for a namespace or class static members. + //---------------------------------------------------------------------------- + /** + __newindex metamethod for a namespace or class static members. - The __propset table stores proxy functions for assignment to: - Global and class static data. - Global and class properties. - */ - static int newindexMetaMethod (lua_State* L) - { - int result = 0; - lua_getmetatable (L, 1); // push metatable of arg1 - for (;;) - { - rawgetfield (L, -1, "__propset"); // lookup __propset in metatable - assert (lua_istable (L, -1)); - lua_pushvalue (L, 2); // push key arg2 - lua_rawget (L, -2); // lookup key in __propset - lua_remove (L, -2); // discard __propset - if (lua_iscfunction (L, -1)) // ensure value is a cfunction - { - lua_remove (L, -2); // discard metatable - lua_pushvalue (L, 3); // push new value arg3 - lua_call (L, 1, 0); // call cfunction - result = 0; - break; - } - else - { - assert (lua_isnil (L, -1)); - lua_pop (L, 1); - } + The __propset table stores proxy functions for assignment to: + Global and class static data. + Global and class properties. + */ + static int newindexMetaMethod (lua_State* L) + { + int result = 0; + lua_getmetatable (L, 1); // push metatable of arg1 + for (;;) + { + rawgetfield (L, -1, "__propset"); // lookup __propset in metatable + assert (lua_istable (L, -1)); + lua_pushvalue (L, 2); // push key arg2 + lua_rawget (L, -2); // lookup key in __propset + lua_remove (L, -2); // discard __propset + if (lua_iscfunction (L, -1)) // ensure value is a cfunction + { + lua_remove (L, -2); // discard metatable + lua_pushvalue (L, 3); // push new value arg3 + lua_call (L, 1, 0); // call cfunction + result = 0; + break; + } + else + { + assert (lua_isnil (L, -1)); + lua_pop (L, 1); + } - rawgetfield (L, -1, "__parent"); - if (lua_istable (L, -1)) - { - // Remove metatable and repeat the search in __parent. - lua_remove (L, -2); - } - else - { - assert (lua_isnil (L, -1)); - lua_pop (L, 2); - result = luaL_error (L,"no writable variable '%s'", lua_tostring (L, 2)); - } - } + rawgetfield (L, -1, "__parent"); + if (lua_istable (L, -1)) + { + // Remove metatable and repeat the search in __parent. + lua_remove (L, -2); + } + else + { + assert (lua_isnil (L, -1)); + lua_pop (L, 2); + result = luaL_error (L,"no writable variable '%s'", lua_tostring (L, 2)); + } + } - return result; - } + return result; + } - //---------------------------------------------------------------------------- - /** - lua_CFunction to report an error writing to a read-only value. + //---------------------------------------------------------------------------- + /** + lua_CFunction to report an error writing to a read-only value. - The name of the variable is in the first upvalue. - */ - static int readOnlyError (lua_State* L) - { - std::string s; - - s = s + "'" + lua_tostring (L, lua_upvalueindex (1)) + "' is read-only"; + The name of the variable is in the first upvalue. + */ + static int readOnlyError (lua_State* L) + { + std::string s; - return luaL_error (L, s.c_str ()); - } - - //---------------------------------------------------------------------------- - /** - lua_CFunction to get a variable. + s = s + "'" + lua_tostring (L, lua_upvalueindex (1)) + "' is read-only"; - This is used for global variables or class static data members. + return luaL_error (L, s.c_str ()); + } - The pointer to the data is in the first upvalue. - */ - template - static int getVariable (lua_State* L) - { - assert (lua_islightuserdata (L, lua_upvalueindex (1))); - T const* ptr = static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (ptr != 0); - Stack ::push (L, *ptr); - return 1; - } + //---------------------------------------------------------------------------- + /** + lua_CFunction to get a variable. - //---------------------------------------------------------------------------- - /** - lua_CFunction to set a variable. + This is used for global variables or class static data members. - This is used for global variables or class static data members. + The pointer to the data is in the first upvalue. + */ + template + static int getVariable (lua_State* L) + { + assert (lua_islightuserdata (L, lua_upvalueindex (1))); + T const* ptr = static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (ptr != 0); + Stack ::push (L, *ptr); + return 1; + } - The pointer to the data is in the first upvalue. - */ - template - static int setVariable (lua_State* L) - { - assert (lua_islightuserdata (L, lua_upvalueindex (1))); - T* ptr = static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (ptr != 0); - *ptr = Stack ::get (L, 1); - return 0; - } + //---------------------------------------------------------------------------- + /** + lua_CFunction to set a variable. - //---------------------------------------------------------------------------- - /** - lua_CFunction to call a function with a return value. + This is used for global variables or class static data members. - This is used for global functions, global properties, class static methods, - and class static properties. + The pointer to the data is in the first upvalue. + */ + template + static int setVariable (lua_State* L) + { + assert (lua_islightuserdata (L, lua_upvalueindex (1))); + T* ptr = static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (ptr != 0); + *ptr = Stack ::get (L, 1); + return 0; + } - The function pointer is in the first upvalue. - */ - template ::ReturnType> - struct Call - { - typedef typename FuncTraits ::Params Params; - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - FnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - ArgList args (L); - Stack ::ReturnType>::push (L, FuncTraits ::call (fnptr, args)); - return 1; - } - }; + //---------------------------------------------------------------------------- + /** + lua_CFunction to call a function with a return value. - //---------------------------------------------------------------------------- - /** - lua_CFunction to call a function with no return value. + This is used for global functions, global properties, class static methods, + and class static properties. - This is used for global functions, global properties, class static methods, - and class static properties. + The function pointer is in the first upvalue. + */ + template ::ReturnType> + struct Call + { + typedef typename FuncTraits ::Params Params; + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + FnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + ArgList args (L); + Stack ::ReturnType>::push (L, FuncTraits ::call (fnptr, args)); + return 1; + } + }; - The function pointer is in the first upvalue. - */ - template - struct Call - { - typedef typename FuncTraits ::Params Params; - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - FnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - ArgList args (L); - FuncTraits ::call (fnptr, args); - return 0; - } - }; + //---------------------------------------------------------------------------- + /** + lua_CFunction to call a function with no return value. - //---------------------------------------------------------------------------- - /** - lua_CFunction to call a class member function with a return value. + This is used for global functions, global properties, class static methods, + and class static properties. - The member function pointer is in the first upvalue. - The class userdata object is at the top of the Lua stack. - */ - template ::ReturnType> - struct CallMember - { - typedef typename FuncTraits ::ClassType T; - typedef typename FuncTraits ::Params Params; + The function pointer is in the first upvalue. + */ + template + struct Call + { + typedef typename FuncTraits ::Params Params; + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + FnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + ArgList args (L); + FuncTraits ::call (fnptr, args); + return 0; + } + }; - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - T* const t = Userdata::get (L, 1, false); - MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - ArgList args (L); - Stack ::push (L, FuncTraits ::call (t, fnptr, args)); - return 1; - } - }; + //---------------------------------------------------------------------------- + /** + lua_CFunction to call a class member function with a return value. - template ::ReturnType> - struct CallConstMember - { - typedef typename FuncTraits ::ClassType T; - typedef typename FuncTraits ::Params Params; + The member function pointer is in the first upvalue. + The class userdata object is at the top of the Lua stack. + */ + template ::ReturnType> + struct CallMember + { + typedef typename FuncTraits ::ClassType T; + typedef typename FuncTraits ::Params Params; - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - T const* const t = Userdata::get (L, 1, true); - MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - ArgList args(L); - Stack ::push (L, FuncTraits ::call (t, fnptr, args)); - return 1; - } - }; + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + T* const t = Userdata::get (L, 1, false); + MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + ArgList args (L); + Stack ::push (L, FuncTraits ::call (t, fnptr, args)); + return 1; + } + }; - //---------------------------------------------------------------------------- - /** - lua_CFunction to call a class member function with no return value. + template ::ReturnType> + struct CallConstMember + { + typedef typename FuncTraits ::ClassType T; + typedef typename FuncTraits ::Params Params; - The member function pointer is in the first upvalue. - The class userdata object is at the top of the Lua stack. - */ - template - struct CallMember - { - typedef typename FuncTraits ::ClassType T; - typedef typename FuncTraits ::Params Params; + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + T const* const t = Userdata::get (L, 1, true); + MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + ArgList args(L); + Stack ::push (L, FuncTraits ::call (t, fnptr, args)); + return 1; + } + }; - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - T* const t = Userdata::get (L, 1, false); - MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - ArgList args (L); - FuncTraits ::call (t, fnptr, args); - return 0; - } - }; + //---------------------------------------------------------------------------- + /** + lua_CFunction to call a class member function with no return value. - template - struct CallConstMember - { - typedef typename FuncTraits ::ClassType T; - typedef typename FuncTraits ::Params Params; + The member function pointer is in the first upvalue. + The class userdata object is at the top of the Lua stack. + */ + template + struct CallMember + { + typedef typename FuncTraits ::ClassType T; + typedef typename FuncTraits ::Params Params; - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - T const* const t = Userdata::get (L, 1, true); - MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - ArgList args (L); - FuncTraits ::call (t, fnptr, args); - return 0; - } - }; + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + T* const t = Userdata::get (L, 1, false); + MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + ArgList args (L); + FuncTraits ::call (t, fnptr, args); + return 0; + } + }; - //-------------------------------------------------------------------------- - /** - lua_CFunction to call a class member lua_CFunction. + template + struct CallConstMember + { + typedef typename FuncTraits ::ClassType T; + typedef typename FuncTraits ::Params Params; - The member function pointer is in the first upvalue. - The class userdata object is at the top of the Lua stack. - */ - template - struct CallMemberCFunction - { - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - typedef int (T::*MFP)(lua_State* L); - T* const t = Userdata::get (L, 1, false); - MFP const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - return (t->*fnptr) (L); - } - }; + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + T const* const t = Userdata::get (L, 1, true); + MemFnPtr const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + ArgList args (L); + FuncTraits ::call (t, fnptr, args); + return 0; + } + }; - template - struct CallConstMemberCFunction - { - static int f (lua_State* L) - { - assert (isfulluserdata (L, lua_upvalueindex (1))); - typedef int (T::*MFP)(lua_State* L); - T const* const t = Userdata::get (L, 1, true); - MFP const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); - assert (fnptr != 0); - return (t->*fnptr) (L); - } - }; + //-------------------------------------------------------------------------- + /** + lua_CFunction to call a class member lua_CFunction. - //-------------------------------------------------------------------------- + The member function pointer is in the first upvalue. + The class userdata object is at the top of the Lua stack. + */ + template + struct CallMemberCFunction + { + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + typedef int (T::*MFP)(lua_State* L); + T* const t = Userdata::get (L, 1, false); + MFP const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + return (t->*fnptr) (L); + } + }; - // SFINAE Helpers + template + struct CallConstMemberCFunction + { + static int f (lua_State* L) + { + assert (isfulluserdata (L, lua_upvalueindex (1))); + typedef int (T::*MFP)(lua_State* L); + T const* const t = Userdata::get (L, 1, true); + MFP const& fnptr = *static_cast (lua_touserdata (L, lua_upvalueindex (1))); + assert (fnptr != 0); + return (t->*fnptr) (L); + } + }; - template - struct CallMemberFunctionHelper - { - static void add (lua_State* L, char const* name, MemFnPtr mf) - { - new (lua_newuserdata (L, sizeof (MemFnPtr))) MemFnPtr (mf); - lua_pushcclosure (L, &CallConstMember ::f, 1); - lua_pushvalue (L, -1); - rawsetfield (L, -5, name); // const table - rawsetfield (L, -3, name); // class table - } - }; + //-------------------------------------------------------------------------- - template - struct CallMemberFunctionHelper - { - static void add (lua_State* L, char const* name, MemFnPtr mf) - { - new (lua_newuserdata (L, sizeof (MemFnPtr))) MemFnPtr (mf); - lua_pushcclosure (L, &CallMember ::f, 1); - rawsetfield (L, -3, name); // class table - } - }; + // SFINAE Helpers - //-------------------------------------------------------------------------- - /** - __gc metamethod for a class. - */ - template - static int gcMetaMethod (lua_State* L) - { - Userdata* const ud = Userdata::getExact (L, 1); - ud->~Userdata (); - return 0; - } + template + struct CallMemberFunctionHelper + { + static void add (lua_State* L, char const* name, MemFnPtr mf) + { + new (lua_newuserdata (L, sizeof (MemFnPtr))) MemFnPtr (mf); + lua_pushcclosure (L, &CallConstMember ::f, 1); + lua_pushvalue (L, -1); + rawsetfield (L, -5, name); // const table + rawsetfield (L, -3, name); // class table + } + }; - //-------------------------------------------------------------------------- - /** - lua_CFunction to get a class data member. + template + struct CallMemberFunctionHelper + { + static void add (lua_State* L, char const* name, MemFnPtr mf) + { + new (lua_newuserdata (L, sizeof (MemFnPtr))) MemFnPtr (mf); + lua_pushcclosure (L, &CallMember ::f, 1); + rawsetfield (L, -3, name); // class table + } + }; - The pointer-to-member is in the first upvalue. - The class userdata object is at the top of the Lua stack. - */ - template - static int getProperty (lua_State* L) - { - C const* const c = Userdata::get (L, 1, true); - T C::** mp = static_cast (lua_touserdata (L, lua_upvalueindex (1))); - Stack ::push (L, c->**mp); - return 1; - } + //-------------------------------------------------------------------------- + /** + __gc metamethod for a class. + */ + template + static int gcMetaMethod (lua_State* L) + { + Userdata* const ud = Userdata::getExact (L, 1); + ud->~Userdata (); + return 0; + } - //-------------------------------------------------------------------------- - /** - lua_CFunction to set a class data member. + //-------------------------------------------------------------------------- + /** + lua_CFunction to get a class data member. - The pointer-to-member is in the first upvalue. - The class userdata object is at the top of the Lua stack. - */ - template - static int setProperty (lua_State* L) - { - C* const c = Userdata::get (L, 1, false); - T C::** mp = static_cast (lua_touserdata (L, lua_upvalueindex (1))); - c->**mp = Stack ::get (L, 2); - return 0; - } + The pointer-to-member is in the first upvalue. + The class userdata object is at the top of the Lua stack. + */ + template + static int getProperty (lua_State* L) + { + C const* const c = Userdata::get (L, 1, true); + T C::** mp = static_cast (lua_touserdata (L, lua_upvalueindex (1))); + Stack ::push (L, c->**mp); + return 1; + } + + //-------------------------------------------------------------------------- + /** + lua_CFunction to set a class data member. + + The pointer-to-member is in the first upvalue. + The class userdata object is at the top of the Lua stack. + */ + template + static int setProperty (lua_State* L) + { + C* const c = Userdata::get (L, 1, false); + T C::** mp = static_cast (lua_touserdata (L, lua_upvalueindex (1))); + c->**mp = Stack ::get (L, 2); + return 0; + } }; diff --git a/src/lib/lua/bridge/detail/ClassInfo.h b/src/lib/lua/bridge/detail/ClassInfo.h index 8d580694777..4c6e8aa438d 100644 --- a/src/lib/lua/bridge/detail/ClassInfo.h +++ b/src/lib/lua/bridge/detail/ClassInfo.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco License: The MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -36,38 +36,37 @@ template class ClassInfo { public: - /** Get the key for the static table. + /** Get the key for the static table. - The static table holds the static data members, static properties, and - static member functions for a class. - */ - static void const* getStaticKey () - { - static char value; - return &value; - } + The static table holds the static data members, static properties, and + static member functions for a class. + */ + static void const* getStaticKey () + { + static char value; + return &value; + } - /** Get the key for the class table. + /** Get the key for the class table. - The class table holds the data members, properties, and member functions - of a class. Read-only data and properties, and const member functions are - also placed here (to save a lookup in the const table). - */ - static void const* getClassKey () - { - static char value; - return &value; - } + The class table holds the data members, properties, and member functions + of a class. Read-only data and properties, and const member functions are + also placed here (to save a lookup in the const table). + */ + static void const* getClassKey () + { + static char value; + return &value; + } - /** Get the key for the const table. + /** Get the key for the const table. - The const table holds read-only data members and properties, and const - member functions of a class. - */ - static void const* getConstKey () - { - static char value; - return &value; - } + The const table holds read-only data members and properties, and const + member functions of a class. + */ + static void const* getConstKey () + { + static char value; + return &value; + } }; - diff --git a/src/lib/lua/bridge/detail/Constructor.h b/src/lib/lua/bridge/detail/Constructor.h index 7b2dad05986..ad9f1fcbd2b 100644 --- a/src/lib/lua/bridge/detail/Constructor.h +++ b/src/lib/lua/bridge/detail/Constructor.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2007, Nathan Reed @@ -49,156 +49,156 @@ struct Constructor {}; template struct Constructor { - static T* call (TypeListValues const&) - { - return new T; - } - static T* call (void* mem, TypeListValues const&) - { - return new (mem) T; - } + static T* call (TypeListValues const&) + { + return new T; + } + static T* call (void* mem, TypeListValues const&) + { + return new (mem) T; + } }; template struct Constructor > { - static T* call (const TypeListValues > &tvl) - { - return new T(tvl.hd); - } - static T* call (void* mem, const TypeListValues > &tvl) - { - return new (mem) T(tvl.hd); - } + static T* call (const TypeListValues > &tvl) + { + return new T(tvl.hd); + } + static T* call (void* mem, const TypeListValues > &tvl) + { + return new (mem) T(tvl.hd); + } }; template struct Constructor > > { - static T* call (const TypeListValues > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd); - } + static T* call (const TypeListValues > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd); + } }; template struct Constructor > > > { - static T* call (const TypeListValues > > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static T* call (const TypeListValues > > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct Constructor > > > > + TypeList > > > > { - static T* call (const TypeListValues > > > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static T* call (const TypeListValues > > > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template + class P5> struct Constructor > > > > > + TypeList > > > > > { - static T* call (const TypeListValues > > > > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > > > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd); - } + static T* call (const TypeListValues > > > > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > > > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd); + } }; template + class P5, class P6> struct Constructor > > > > > > + TypeList > > > > > > { - static T* call (const TypeListValues > > > > > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > > > > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static T* call (const TypeListValues > > > > > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > > > > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template + class P5, class P6, class P7> struct Constructor > > > > > > > + TypeList > > > > > > > { - static T* call (const TypeListValues > > > > > > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.tl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > > > > > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.tl.tl.hd); - } + static T* call (const TypeListValues > > > > > > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.tl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > > > > > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template + class P5, class P6, class P7, class P8> struct Constructor > > > > > > > > + TypeList > > > > > > > > { - static T* call (const TypeListValues > > > > > > > > &tvl) - { - return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } - static T* call (void* mem, const TypeListValues > > > > > > > > &tvl) - { - return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static T* call (const TypeListValues > > > > > > > > &tvl) + { + return new T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } + static T* call (void* mem, const TypeListValues > > > > > > > > &tvl) + { + return new (mem) T(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; #endif diff --git a/src/lib/lua/bridge/detail/FuncTraits.h b/src/lib/lua/bridge/detail/FuncTraits.h index 7eccb61832b..bf8e7c9bc50 100644 --- a/src/lib/lua/bridge/detail/FuncTraits.h +++ b/src/lib/lua/bridge/detail/FuncTraits.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco License: The MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -33,7 +33,7 @@ 'noexcept' (if C++11 is available) to distinguish the functions. */ #if defined (__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__clang__) || defined(__GNUC__) || \ - (defined (_MSC_VER) && (_MSC_VER >= 1700)) + (defined (_MSC_VER) && (_MSC_VER >= 1700)) // Do not define LUABRIDGE_THROWSPEC since the Xcode and gcc compilers do not // distinguish the throw specification in the function signature. #else @@ -64,118 +64,118 @@ struct FuncTraits template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef None Params; - static R call (D fp, TypeListValues ) - { - return fp (); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef None Params; + static R call (D fp, TypeListValues ) + { + return fp (); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; /* Non-const member function pointers. */ @@ -183,136 +183,136 @@ struct FuncTraits template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef None Params; - static R call (T* obj, D fp, TypeListValues ) - { - return (obj->*fp)(); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef None Params; + static R call (T* obj, D fp, TypeListValues ) + { + return (obj->*fp)(); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; /* Const member function pointers. */ @@ -320,137 +320,137 @@ struct FuncTraits template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef None Params; - static R call (T const* obj, D fp, TypeListValues ) - { - return (obj->*fp)(); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef None Params; + static R call (T const* obj, D fp, TypeListValues ) + { + return (obj->*fp)(); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > Params; - static R call (T const* obj, R (T::*fp) (P1, P2) const, - TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > Params; + static R call (T const* obj, R (T::*fp) (P1, P2) const, + TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; #if defined (LUABRIDGE_THROWSPEC) @@ -460,118 +460,118 @@ struct FuncTraits template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef None Params; - static R call (D fp, TypeListValues const&) - { - return fp (); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef None Params; + static R call (D fp, TypeListValues const&) + { + return fp (); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = false; - typedef D DeclType; - typedef R ReturnType; - typedef TypeList > > > > > > > Params; - static R call (D fp, TypeListValues tvl) - { - return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = false; + typedef D DeclType; + typedef R ReturnType; + typedef TypeList > > > > > > > Params; + static R call (D fp, TypeListValues tvl) + { + return fp (tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; /* Non-const member function pointers with THROWSPEC. */ @@ -579,136 +579,136 @@ struct FuncTraits struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef None Params; - static R call (T* obj, D fp, TypeListValues const&) - { - return (obj->*fp)(); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef None Params; + static R call (T* obj, D fp, TypeListValues const&) + { + return (obj->*fp)(); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = false; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > > Params; - static R call (T* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = false; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > > Params; + static R call (T* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; /* Const member function pointers with THROWSPEC. */ @@ -716,137 +716,137 @@ struct FuncTraits struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef None Params; - static R call (T const* obj, D fp, TypeListValues ) - { - return (obj->*fp)(); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef None Params; + static R call (T const* obj, D fp, TypeListValues ) + { + return (obj->*fp)(); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, - tvl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, + tvl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd); + } }; template struct FuncTraits { - static bool const isMemberFunction = true; - static bool const isConstMemberFunction = true; - typedef D DeclType; - typedef T ClassType; - typedef R ReturnType; - typedef TypeList > > > > > > > Params; - static R call (T const* obj, D fp, TypeListValues tvl) - { - return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); - } + static bool const isMemberFunction = true; + static bool const isConstMemberFunction = true; + typedef D DeclType; + typedef T ClassType; + typedef R ReturnType; + typedef TypeList > > > > > > > Params; + static R call (T const* obj, D fp, TypeListValues tvl) + { + return (obj->*fp)(tvl.hd, tvl.tl.hd, tvl.tl.tl.hd, tvl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.hd, tvl.tl.tl.tl.tl.tl.tl.tl.hd); + } }; #endif diff --git a/src/lib/lua/bridge/detail/Iterator.h b/src/lib/lua/bridge/detail/Iterator.h index d883fb3989a..12086479635 100644 --- a/src/lib/lua/bridge/detail/Iterator.h +++ b/src/lib/lua/bridge/detail/Iterator.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco License: The MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -31,84 +31,83 @@ class Iterator { private: - lua_State* m_L; - LuaRef m_table; - LuaRef m_key; - LuaRef m_value; + lua_State* m_L; + LuaRef m_table; + LuaRef m_key; + LuaRef m_value; - void next () - { - m_table.push(m_L); - m_key.push (m_L); - if (lua_next (m_L, -2)) - { - m_value.pop (m_L); - m_key.pop (m_L); - } - else - { - m_key = Nil(); - m_value = Nil(); - } - lua_pop(m_L, 1); - } + void next () + { + m_table.push(m_L); + m_key.push (m_L); + if (lua_next (m_L, -2)) + { + m_value.pop (m_L); + m_key.pop (m_L); + } + else + { + m_key = Nil(); + m_value = Nil(); + } + lua_pop(m_L, 1); + } public: - explicit Iterator (LuaRef table) - : m_L (table.state ()) - , m_table (table) - , m_key (table.state ()) // m_key is nil - , m_value (table.state ()) // m_value is nil - { - next (); // get the first (key, value) pair from table - } + explicit Iterator (LuaRef table) + : m_L (table.state ()) + , m_table (table) + , m_key (table.state ()) // m_key is nil + , m_value (table.state ()) // m_value is nil + { + next (); // get the first (key, value) pair from table + } - lua_State* state () const - { - return m_L; - } + lua_State* state () const + { + return m_L; + } - LuaRef operator* () const - { - return m_value; - } + LuaRef operator* () const + { + return m_value; + } - LuaRef operator-> () const - { - return m_value; - } + LuaRef operator-> () const + { + return m_value; + } - Iterator& operator++ () - { - if (isNil()) - { - // if the iterator reaches the end, do nothing - return *this; - } - else - { - next(); - return *this; - } - } + Iterator& operator++ () + { + if (isNil()) + { + // if the iterator reaches the end, do nothing + return *this; + } + else + { + next(); + return *this; + } + } - inline bool isNil () const - { - return m_key.isNil (); - } + inline bool isNil () const + { + return m_key.isNil (); + } - inline LuaRef key () const - { - return m_key; - } + inline LuaRef key () const + { + return m_key; + } - inline LuaRef value () const - { - return m_value; - } + inline LuaRef value () const + { + return m_value; + } private: - // Don't use postfix increment, it is less efficient - Iterator operator++ (int); + // Don't use postfix increment, it is less efficient + Iterator operator++ (int); }; - diff --git a/src/lib/lua/bridge/detail/LuaException.h b/src/lib/lua/bridge/detail/LuaException.h index a0944961ced..7720e1be8d2 100644 --- a/src/lib/lua/bridge/detail/LuaException.h +++ b/src/lib/lua/bridge/detail/LuaException.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2008, Nigel Atkinson @@ -27,87 +27,87 @@ */ //============================================================================== -class LuaException : public std::exception +class LuaException : public std::exception { private: - lua_State* m_L; - std::string m_what; + lua_State* m_L; + std::string m_what; public: - //---------------------------------------------------------------------------- - /** - Construct a LuaException after a lua_pcall(). - */ - LuaException (lua_State* L, int /*code*/) - : m_L (L) - { - whatFromStack (); - } + //---------------------------------------------------------------------------- + /** + Construct a LuaException after a lua_pcall(). + */ + LuaException (lua_State* L, int /*code*/) + : m_L (L) + { + whatFromStack (); + } - //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- - LuaException (lua_State *L, - char const*, - char const*, - long) - : m_L (L) - { - whatFromStack (); - } + LuaException (lua_State *L, + char const*, + char const*, + long) + : m_L (L) + { + whatFromStack (); + } - //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- - ~LuaException() throw () - { - } + ~LuaException() throw () + { + } - //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- - char const* what() const throw () - { - return m_what.c_str(); - } + char const* what() const throw () + { + return m_what.c_str(); + } - //============================================================================ - /** - Throw an exception. + //============================================================================ + /** + Throw an exception. - This centralizes all the exceptions thrown, so that we can set - breakpoints before the stack is unwound, or otherwise customize the - behavior. - */ - template - static void Throw (Exception e) - { - throw e; - } + This centralizes all the exceptions thrown, so that we can set + breakpoints before the stack is unwound, or otherwise customize the + behavior. + */ + template + static void Throw (Exception e) + { + throw e; + } - //---------------------------------------------------------------------------- - /** - Wrapper for lua_pcall that throws. - */ - static void pcall (lua_State* L, int nargs = 0, int nresults = 0, int msgh = 0) - { - int code = lua_pcall (L, nargs, nresults, msgh); + //---------------------------------------------------------------------------- + /** + Wrapper for lua_pcall that throws. + */ + static void pcall (lua_State* L, int nargs = 0, int nresults = 0, int msgh = 0) + { + int code = lua_pcall (L, nargs, nresults, msgh); - if (code != LUABRIDGE_LUA_OK) - Throw (LuaException (L, code)); - } + if (code != LUABRIDGE_LUA_OK) + Throw (LuaException (L, code)); + } - //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- protected: - void whatFromStack () - { - if (lua_gettop (m_L) > 0) - { - char const* s = lua_tostring (m_L, -1); - m_what = s ? s : ""; - } - else - { - // stack is empty - m_what = "missing error"; - } - } + void whatFromStack () + { + if (lua_gettop (m_L) > 0) + { + char const* s = lua_tostring (m_L, -1); + m_what = s ? s : ""; + } + else + { + // stack is empty + m_what = "missing error"; + } + } }; diff --git a/src/lib/lua/bridge/detail/LuaHelpers.h b/src/lib/lua/bridge/detail/LuaHelpers.h index 7bc84eb1642..5bff2c9e2d4 100644 --- a/src/lib/lua/bridge/detail/LuaHelpers.h +++ b/src/lib/lua/bridge/detail/LuaHelpers.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2007, Nathan Reed @@ -32,26 +32,26 @@ #if LUA_VERSION_NUM < 502 inline int lua_absindex (lua_State* L, int idx) { - if (idx > LUA_REGISTRYINDEX && idx < 0) - return lua_gettop (L) + idx + 1; - else - return idx; + if (idx > LUA_REGISTRYINDEX && idx < 0) + return lua_gettop (L) + idx + 1; + else + return idx; } inline void lua_rawgetp (lua_State* L, int idx, void const* p) { - idx = lua_absindex (L, idx); - lua_pushlightuserdata (L, const_cast (p)); - lua_rawget (L,idx); + idx = lua_absindex (L, idx); + lua_pushlightuserdata (L, const_cast (p)); + lua_rawget (L,idx); } inline void lua_rawsetp (lua_State* L, int idx, void const* p) { - idx = lua_absindex (L, idx); - lua_pushlightuserdata (L, const_cast (p)); - // put key behind value - lua_insert (L, -2); - lua_rawset (L, idx); + idx = lua_absindex (L, idx); + lua_pushlightuserdata (L, const_cast (p)); + // put key behind value + lua_insert (L, -2); + lua_rawset (L, idx); } #define LUA_OPEQ 1 @@ -60,37 +60,37 @@ inline void lua_rawsetp (lua_State* L, int idx, void const* p) inline int lua_compare (lua_State* L, int idx1, int idx2, int op) { - switch (op) - { - case LUA_OPEQ: - return lua_equal (L, idx1, idx2); - break; + switch (op) + { + case LUA_OPEQ: + return lua_equal (L, idx1, idx2); + break; - case LUA_OPLT: - return lua_lessthan (L, idx1, idx2); - break; + case LUA_OPLT: + return lua_lessthan (L, idx1, idx2); + break; - case LUA_OPLE: - return lua_equal (L, idx1, idx2) || lua_lessthan (L, idx1, idx2); - break; + case LUA_OPLE: + return lua_equal (L, idx1, idx2) || lua_lessthan (L, idx1, idx2); + break; - default: - return 0; - }; + default: + return 0; + }; } inline int get_length (lua_State* L, int idx) { - return int (lua_objlen (L, idx)); + return int (lua_objlen (L, idx)); } #else inline int get_length (lua_State* L, int idx) { - lua_len (L, idx); - int len = int (luaL_checknumber (L, -1)); - lua_pop (L, 1); - return len; + lua_len (L, idx); + int len = int (luaL_checknumber (L, -1)); + lua_pop (L, 1); + return len; } #endif @@ -102,31 +102,31 @@ inline int get_length (lua_State* L, int idx) #endif /** Get a table value, bypassing metamethods. -*/ +*/ inline void rawgetfield (lua_State* L, int index, char const* key) { - assert (lua_istable (L, index)); - index = lua_absindex (L, index); - lua_pushstring (L, key); - lua_rawget (L, index); + assert (lua_istable (L, index)); + index = lua_absindex (L, index); + lua_pushstring (L, key); + lua_rawget (L, index); } /** Set a table value, bypassing metamethods. -*/ +*/ inline void rawsetfield (lua_State* L, int index, char const* key) { - assert (lua_istable (L, index)); - index = lua_absindex (L, index); - lua_pushstring (L, key); - lua_insert (L, -2); - lua_rawset (L, index); + assert (lua_istable (L, index)); + index = lua_absindex (L, index); + lua_pushstring (L, key); + lua_insert (L, -2); + lua_rawset (L, index); } /** Returns true if the value is a full userdata (not light). */ inline bool isfulluserdata (lua_State* L, int index) { - return lua_isuserdata (L, index) && !lua_islightuserdata (L, index); + return lua_isuserdata (L, index) && !lua_islightuserdata (L, index); } /** Test lua_State objects for global equality. @@ -138,6 +138,6 @@ inline bool isfulluserdata (lua_State* L, int index) */ inline bool equalstates (lua_State* L1, lua_State* L2) { - return lua_topointer (L1, LUA_REGISTRYINDEX) == - lua_topointer (L2, LUA_REGISTRYINDEX); + return lua_topointer (L1, LUA_REGISTRYINDEX) == + lua_topointer (L2, LUA_REGISTRYINDEX); } diff --git a/src/lib/lua/bridge/detail/LuaRef.h b/src/lib/lua/bridge/detail/LuaRef.h index e726bcafe7b..739eba539da 100644 --- a/src/lib/lua/bridge/detail/LuaRef.h +++ b/src/lib/lua/bridge/detail/LuaRef.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2008, Nigel Atkinson @@ -51,1072 +51,1072 @@ struct Nil class LuaRef { private: - class Proxy; - friend struct Stack ; + class Proxy; + friend struct Stack ; - //---------------------------------------------------------------------------- - /** - Pop the Lua stack. + //---------------------------------------------------------------------------- + /** + Pop the Lua stack. - Pops the specified number of stack items on destruction. We use this - when returning objects, to avoid an explicit temporary variable, since - the destructor executes after the return statement. For example: + Pops the specified number of stack items on destruction. We use this + when returning objects, to avoid an explicit temporary variable, since + the destructor executes after the return statement. For example: - template - U cast (lua_State* L) - { - StackPop p (L, 1); - ... - return U (); // dtor called after this line - } + template + U cast (lua_State* L) + { + StackPop p (L, 1); + ... + return U (); // dtor called after this line + } - @note The `StackPop` object must always be a named local variable. - */ - class StackPop - { - public: - /** Create a StackPop object. + @note The `StackPop` object must always be a named local variable. + */ + class StackPop + { + public: + /** Create a StackPop object. - @param count The number of stack entries to pop on destruction. - */ - StackPop (lua_State* L, int count) - : m_L (L) - , m_count (count) - { - } + @param count The number of stack entries to pop on destruction. + */ + StackPop (lua_State* L, int count) + : m_L (L) + , m_count (count) + { + } - ~StackPop () - { - lua_pop (m_L, m_count); - } + ~StackPop () + { + lua_pop (m_L, m_count); + } - private: - lua_State* m_L; - int m_count; - }; + private: + lua_State* m_L; + int m_count; + }; - //---------------------------------------------------------------------------- - /** - A proxy for representing table values. - */ - class Proxy - { - private: - lua_State* m_L; - int m_tableRef; - int m_keyRef; + //---------------------------------------------------------------------------- + /** + A proxy for representing table values. + */ + class Proxy + { + private: + lua_State* m_L; + int m_tableRef; + int m_keyRef; - public: - //-------------------------------------------------------------------------- - /** - Construct a Proxy from a table value. + public: + //-------------------------------------------------------------------------- + /** + Construct a Proxy from a table value. - The table is in the registry, and the key is at the top of the stack. - The key is popped off the stack. - */ - Proxy (lua_State* L, int tableRef) - : m_L (L) - , m_tableRef (tableRef) - , m_keyRef (luaL_ref (L, LUA_REGISTRYINDEX)) - { - } + The table is in the registry, and the key is at the top of the stack. + The key is popped off the stack. + */ + Proxy (lua_State* L, int tableRef) + : m_L (L) + , m_tableRef (tableRef) + , m_keyRef (luaL_ref (L, LUA_REGISTRYINDEX)) + { + } - //-------------------------------------------------------------------------- - /** - Create a Proxy via copy constructor. + //-------------------------------------------------------------------------- + /** + Create a Proxy via copy constructor. - It is best to avoid code paths that invoke this, because it creates - an extra temporary Lua reference. Typically this is done by passing - the Proxy parameter as a `const` reference. - */ - Proxy (Proxy const& other) - : m_L (other.m_L) - , m_tableRef (other.m_tableRef) - { - // If this assert goes off it means code is taking this path, - // which is better avoided. - // - assert (0); + It is best to avoid code paths that invoke this, because it creates + an extra temporary Lua reference. Typically this is done by passing + the Proxy parameter as a `const` reference. + */ + Proxy (Proxy const& other) + : m_L (other.m_L) + , m_tableRef (other.m_tableRef) + { + // If this assert goes off it means code is taking this path, + // which is better avoided. + // + assert (0); - lua_rawgeti (m_L, LUA_REGISTRYINDEX, other.m_keyRef); - m_keyRef = luaL_ref (m_L, LUA_REGISTRYINDEX); - } + lua_rawgeti (m_L, LUA_REGISTRYINDEX, other.m_keyRef); + m_keyRef = luaL_ref (m_L, LUA_REGISTRYINDEX); + } - //-------------------------------------------------------------------------- - /** - Destroy the proxy. + //-------------------------------------------------------------------------- + /** + Destroy the proxy. - This does not destroy the table value. - */ - ~Proxy () - { - luaL_unref (m_L, LUA_REGISTRYINDEX, m_keyRef); - } + This does not destroy the table value. + */ + ~Proxy () + { + luaL_unref (m_L, LUA_REGISTRYINDEX, m_keyRef); + } - //-------------------------------------------------------------------------- - /** - Return a reference to the table value. - */ - int createRef () const - { - push (m_L); - return luaL_ref (m_L, LUA_REGISTRYINDEX); - } + //-------------------------------------------------------------------------- + /** + Return a reference to the table value. + */ + int createRef () const + { + push (m_L); + return luaL_ref (m_L, LUA_REGISTRYINDEX); + } - //-------------------------------------------------------------------------- - /** - Assign a new value to this table key. + //-------------------------------------------------------------------------- + /** + Assign a new value to this table key. - This may invoke metamethods. - */ - template - Proxy& operator= (T v) - { - StackPop p (m_L, 1); - lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef); - lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_keyRef); - Stack ::push (m_L, v); - lua_rawset (m_L, -3); - return *this; - } + This may invoke metamethods. + */ + template + Proxy& operator= (T v) + { + StackPop p (m_L, 1); + lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef); + lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_keyRef); + Stack ::push (m_L, v); + lua_rawset (m_L, -3); + return *this; + } - //-------------------------------------------------------------------------- - /** - Assign a new value to this table key. + //-------------------------------------------------------------------------- + /** + Assign a new value to this table key. - The assignment is raw, no metamethods are invoked. - */ - template - Proxy& rawset (T v) - { - StackPop p (m_L, 1); - lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef); - lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_keyRef); - Stack ::push (m_L, v); - lua_settable (m_L, -3); - return *this; - } + The assignment is raw, no metamethods are invoked. + */ + template + Proxy& rawset (T v) + { + StackPop p (m_L, 1); + lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef); + lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_keyRef); + Stack ::push (m_L, v); + lua_settable (m_L, -3); + return *this; + } - //========================================================================== - // - // This group of member functions mirrors the member functions in LuaRef. + //========================================================================== + // + // This group of member functions mirrors the member functions in LuaRef. - /** Retrieve the lua_State associated with the table value. - */ - lua_State* state () const - { - return m_L; - } + /** Retrieve the lua_State associated with the table value. + */ + lua_State* state () const + { + return m_L; + } - //-------------------------------------------------------------------------- - /** - Push the value onto the Lua stack. - */ - void push (lua_State* L) const - { - assert (equalstates (L, m_L)); - lua_rawgeti (L, LUA_REGISTRYINDEX, m_tableRef); - lua_rawgeti (L, LUA_REGISTRYINDEX, m_keyRef); - lua_gettable (L, -2); - lua_remove (L, -2); // remove the table - } + //-------------------------------------------------------------------------- + /** + Push the value onto the Lua stack. + */ + void push (lua_State* L) const + { + assert (equalstates (L, m_L)); + lua_rawgeti (L, LUA_REGISTRYINDEX, m_tableRef); + lua_rawgeti (L, LUA_REGISTRYINDEX, m_keyRef); + lua_gettable (L, -2); + lua_remove (L, -2); // remove the table + } - //-------------------------------------------------------------------------- - /** - Determine the object type. + //-------------------------------------------------------------------------- + /** + Determine the object type. - The return values are the same as for `lua_type`. - */ - int type () const - { - int result; - push (m_L); - result = lua_type (m_L, -1); - lua_pop (m_L, 1); - return result; - } + The return values are the same as for `lua_type`. + */ + int type () const + { + int result; + push (m_L); + result = lua_type (m_L, -1); + lua_pop (m_L, 1); + return result; + } - inline bool isNil () const { return type () == LUA_TNIL; } - inline bool isNumber () const { return type () == LUA_TNUMBER; } - inline bool isString () const { return type () == LUA_TSTRING; } - inline bool isTable () const { return type () == LUA_TTABLE; } - inline bool isFunction () const { return type () == LUA_TFUNCTION; } - inline bool isUserdata () const { return type () == LUA_TUSERDATA; } - inline bool isThread () const { return type () == LUA_TTHREAD; } - inline bool isLightUserdata () const { return type () == LUA_TLIGHTUSERDATA; } + inline bool isNil () const { return type () == LUA_TNIL; } + inline bool isNumber () const { return type () == LUA_TNUMBER; } + inline bool isString () const { return type () == LUA_TSTRING; } + inline bool isTable () const { return type () == LUA_TTABLE; } + inline bool isFunction () const { return type () == LUA_TFUNCTION; } + inline bool isUserdata () const { return type () == LUA_TUSERDATA; } + inline bool isThread () const { return type () == LUA_TTHREAD; } + inline bool isLightUserdata () const { return type () == LUA_TLIGHTUSERDATA; } - //-------------------------------------------------------------------------- - /** - Perform an explicit conversion. - */ - template - T cast () const - { - StackPop p (m_L, 1); - push (m_L); + //-------------------------------------------------------------------------- + /** + Perform an explicit conversion. + */ + template + T cast () const + { + StackPop p (m_L, 1); + push (m_L); - // lua_gettop is used because Userdata::getClass() doesn't handle - // negative stack indexes. - // - return Stack ::get (m_L, lua_gettop (m_L)); - } + // lua_gettop is used because Userdata::getClass() doesn't handle + // negative stack indexes. + // + return Stack ::get (m_L, lua_gettop (m_L)); + } - //-------------------------------------------------------------------------- - /** - Universal implicit conversion operator. + //-------------------------------------------------------------------------- + /** + Universal implicit conversion operator. - NOTE: Visual Studio 2010 and 2012 have a bug where this function - is not used. See: + NOTE: Visual Studio 2010 and 2012 have a bug where this function + is not used. See: - http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/e30b2664-a92d-445c-9db2-e8e0fbde2014 - https://connect.microsoft.com/VisualStudio/feedback/details/771509/correct-code-doesnt-compile + http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/e30b2664-a92d-445c-9db2-e8e0fbde2014 + https://connect.microsoft.com/VisualStudio/feedback/details/771509/correct-code-doesnt-compile - // This code snippet fails to compile in vs2010,vs2012 - struct S { - template inline operator T () const { return T (); } - }; - int main () { - S () || false; - return 0; - } - */ - template - inline operator T () const - { - return cast (); - } + // This code snippet fails to compile in vs2010,vs2012 + struct S { + template inline operator T () const { return T (); } + }; + int main () { + S () || false; + return 0; + } + */ + template + inline operator T () const + { + return cast (); + } - //-------------------------------------------------------------------------- - /** - Universal comparison operators. - */ - /** @{ */ - template - bool operator== (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -2, -1, LUA_OPEQ) == 1; - } + //-------------------------------------------------------------------------- + /** + Universal comparison operators. + */ + /** @{ */ + template + bool operator== (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -2, -1, LUA_OPEQ) == 1; + } - template - bool operator< (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -2, -1, LUA_OPLT) == 1; - } + template + bool operator< (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -2, -1, LUA_OPLT) == 1; + } - template - bool operator<= (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -2, -1, LUA_OPLE) == 1; - } + template + bool operator<= (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -2, -1, LUA_OPLE) == 1; + } - template - bool operator> (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -1, -2, LUA_OPLT) == 1; - } + template + bool operator> (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -1, -2, LUA_OPLT) == 1; + } - template - bool operator>= (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -1, -2, LUA_OPLE) == 1; - } + template + bool operator>= (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -1, -2, LUA_OPLE) == 1; + } - template - bool rawequal (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_rawequal (m_L, -1, -2) == 1; - } - /** @} */ + template + bool rawequal (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_rawequal (m_L, -1, -2) == 1; + } + /** @} */ - //-------------------------------------------------------------------------- - /** - Access a table value using a key. + //-------------------------------------------------------------------------- + /** + Access a table value using a key. - This invokes metamethods. - */ - template - Proxy operator[] (T key) const - { - return LuaRef (*this) [key]; - } + This invokes metamethods. + */ + template + Proxy operator[] (T key) const + { + return LuaRef (*this) [key]; + } - //-------------------------------------------------------------------------- - /** - Access a table value using a key. + //-------------------------------------------------------------------------- + /** + Access a table value using a key. - The operation is raw, metamethods are not invoked. The result is - passed by value and may not be modified. - */ - template - LuaRef rawget (T key) const - { - StackPop (m_L, 1); - push (m_L); - Stack ::push (m_L, key); - lua_rawget (m_L, -2); - return LuaRef (m_L, FromStack ()); - } + The operation is raw, metamethods are not invoked. The result is + passed by value and may not be modified. + */ + template + LuaRef rawget (T key) const + { + StackPop (m_L, 1); + push (m_L); + Stack ::push (m_L, key); + lua_rawget (m_L, -2); + return LuaRef (m_L, FromStack ()); + } - //-------------------------------------------------------------------------- - /** - Append a value to the table. + //-------------------------------------------------------------------------- + /** + Append a value to the table. - If the table is a sequence this will add another element to it. - */ - template - void append (T v) const - { - push (m_L); - Stack ::push (m_L, v); - luaL_ref (m_L, -2); - lua_pop (m_L, 1); - } + If the table is a sequence this will add another element to it. + */ + template + void append (T v) const + { + push (m_L); + Stack ::push (m_L, v); + luaL_ref (m_L, -2); + lua_pop (m_L, 1); + } - //-------------------------------------------------------------------------- - /** - Call the length operator. + //-------------------------------------------------------------------------- + /** + Call the length operator. - This is identical to applying the Lua # operator. - */ - int length () const - { - StackPop p (m_L, 1); - push (m_L); - return get_length (m_L, -1); - } + This is identical to applying the Lua # operator. + */ + int length () const + { + StackPop p (m_L, 1); + push (m_L); + return get_length (m_L, -1); + } - //-------------------------------------------------------------------------- - /** - Call Lua code. + //-------------------------------------------------------------------------- + /** + Call Lua code. - These overloads allow Lua code to be called with up to 8 parameters. - The return value is provided as a LuaRef (which may be LUA_REFNIL). - If an error occurs, a LuaException is thrown. - */ - /** @{ */ - LuaRef const operator() () const - { - push (m_L); - LuaException::pcall (m_L, 0, 1); - return LuaRef (m_L, FromStack ()); - } + These overloads allow Lua code to be called with up to 8 parameters. + The return value is provided as a LuaRef (which may be LUA_REFNIL). + If an error occurs, a LuaException is thrown. + */ + /** @{ */ + LuaRef const operator() () const + { + push (m_L); + LuaException::pcall (m_L, 0, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1) const - { - push (m_L); - Stack ::push (m_L, p1); - LuaException::pcall (m_L, 1, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1) const + { + push (m_L); + Stack ::push (m_L, p1); + LuaException::pcall (m_L, 1, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - LuaException::pcall (m_L, 2, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1, P2 p2) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + LuaException::pcall (m_L, 2, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - LuaException::pcall (m_L, 3, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + LuaException::pcall (m_L, 3, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - LuaException::pcall (m_L, 4, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + LuaException::pcall (m_L, 4, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - LuaException::pcall (m_L, 5, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + LuaException::pcall (m_L, 5, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - Stack ::push (m_L, p6); - LuaException::pcall (m_L, 6, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + Stack ::push (m_L, p6); + LuaException::pcall (m_L, 6, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - Stack ::push (m_L, p6); - Stack ::push (m_L, p7); - LuaException::pcall (m_L, 7, 1); - return LuaRef (m_L, FromStack ()); - } + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + Stack ::push (m_L, p6); + Stack ::push (m_L, p7); + LuaException::pcall (m_L, 7, 1); + return LuaRef (m_L, FromStack ()); + } - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - Stack ::push (m_L, p6); - Stack ::push (m_L, p7); - Stack ::push (m_L, p8); - LuaException::pcall (m_L, 8, 1); - return LuaRef (m_L, FromStack ()); - } - /** @} */ + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + Stack ::push (m_L, p6); + Stack ::push (m_L, p7); + Stack ::push (m_L, p8); + LuaException::pcall (m_L, 8, 1); + return LuaRef (m_L, FromStack ()); + } + /** @} */ - //========================================================================== - }; + //========================================================================== + }; private: - friend struct Stack ; + friend struct Stack ; - //---------------------------------------------------------------------------- - /** - Type tag for stack construction. - */ - struct FromStack { }; + //---------------------------------------------------------------------------- + /** + Type tag for stack construction. + */ + struct FromStack { }; - //---------------------------------------------------------------------------- - /** - Create a reference to an object at the top of the Lua stack and pop it. + //---------------------------------------------------------------------------- + /** + Create a reference to an object at the top of the Lua stack and pop it. - This constructor is private and not invoked directly. - Instead, use the `fromStack` function. + This constructor is private and not invoked directly. + Instead, use the `fromStack` function. - @note The object is popped. - */ - LuaRef (lua_State* L, FromStack) - : m_L (L) - { - m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); - } + @note The object is popped. + */ + LuaRef (lua_State* L, FromStack) + : m_L (L) + { + m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); + } - //---------------------------------------------------------------------------- - /** - Create a reference to an object on the Lua stack. + //---------------------------------------------------------------------------- + /** + Create a reference to an object on the Lua stack. - This constructor is private and not invoked directly. - Instead, use the `fromStack` function. + This constructor is private and not invoked directly. + Instead, use the `fromStack` function. - @note The object is not popped. - */ - LuaRef (lua_State* L, int index, FromStack) - : m_L (L) - { - lua_pushvalue (m_L, index); - m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); - } + @note The object is not popped. + */ + LuaRef (lua_State* L, int index, FromStack) + : m_L (L) + { + lua_pushvalue (m_L, index); + m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); + } - //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- - // This type of construction is disallowed, since we don't have a `lua_State`. - // - template - LuaRef (T) - { - } + // This type of construction is disallowed, since we don't have a `lua_State`. + // + template + LuaRef (T) + { + } - //---------------------------------------------------------------------------- - /** - Create a reference to this ref. + //---------------------------------------------------------------------------- + /** + Create a reference to this ref. - This is used internally. - */ - int createRef () const - { - if (m_ref != LUA_REFNIL) - { - push (m_L); - return luaL_ref (m_L, LUA_REGISTRYINDEX); - } - else - { - return LUA_REFNIL; - } - } + This is used internally. + */ + int createRef () const + { + if (m_ref != LUA_REFNIL) + { + push (m_L); + return luaL_ref (m_L, LUA_REGISTRYINDEX); + } + else + { + return LUA_REFNIL; + } + } public: - //---------------------------------------------------------------------------- - /** - Create a nil reference. - - The LuaRef may be assigned later. - */ - LuaRef (lua_State* L) - : m_L (L) - , m_ref (LUA_REFNIL) - { - } - - //---------------------------------------------------------------------------- - /** - Create a reference to a value. - */ - template - LuaRef (lua_State* L, T v) - : m_L (L) - { - Stack ::push (m_L, v); - m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); - } - - //---------------------------------------------------------------------------- - /** - Create a reference to a table value. - */ - LuaRef (Proxy const& v) - : m_L (v.state ()) - , m_ref (v.createRef ()) - { - } - - //---------------------------------------------------------------------------- - /** - Create a new reference to an existing reference. - */ - LuaRef (LuaRef const& other) - : m_L (other.m_L) - , m_ref (other.createRef ()) - { - } - - //---------------------------------------------------------------------------- - /** - Destroy a reference. - - The corresponding Lua registry reference will be released. - - @note If the state refers to a thread, it is the responsibility of the - caller to ensure that the thread still exists when the LuaRef - is destroyed. - */ - ~LuaRef () - { - luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); - } - - //---------------------------------------------------------------------------- - /** - Return a LuaRef from a stack item. - - The stack item is not popped. - */ - static LuaRef fromStack (lua_State* L, int index) - { - lua_pushvalue (L, index); - return LuaRef (L, FromStack ()); - } - - //---------------------------------------------------------------------------- - /** - Create a new empty table and return a reference to it. - - It is also possible to use the free function `newTable`. - - @see ::getGlobal - */ - static LuaRef newTable (lua_State* L) - { - lua_newtable (L); - return LuaRef (L, FromStack ()); - } - - //---------------------------------------------------------------------------- - /** - Return a reference to a named global. - - It is also possible to use the free function `getGlobal`. - - @see ::getGlobal - */ - static LuaRef getGlobal (lua_State *L, char const* name) - { - lua_getglobal (L, name); - return LuaRef (L, FromStack ()); - } - - //---------------------------------------------------------------------------- - /** - Assign a different value to this LuaRef. - */ - template - LuaRef& operator= (T rhs) - { - luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); - Stack ::push (m_L, rhs); - m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); - return *this; - } - - //---------------------------------------------------------------------------- - /** - Assign another LuaRef to this LuaRef. - */ - LuaRef& operator= (LuaRef const& rhs) - { - luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); - rhs.push (m_L); - m_L = rhs.state (); - m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); - return *this; - } - - //---------------------------------------------------------------------------- - /** - converts to a string using luas tostring function - */ - std::string tostring() const - { - lua_getglobal (m_L, "tostring"); - push (m_L); - lua_call (m_L, 1, 1); - const char* str = lua_tostring(m_L, 1); - lua_pop(m_L, 1); - return std::string(str); - } - - //---------------------------------------------------------------------------- - /** - Print a text description of the value to a stream. - - This is used for diagnostics. - */ - void print (std::ostream& os) const - { - switch (type ()) - { - case LUA_TNIL: - os << "nil"; - break; - - case LUA_TNUMBER: - os << cast (); - break; - - case LUA_TBOOLEAN: - os << (cast () ? "true" : "false"); - break; - - case LUA_TSTRING: - os << '"' << cast () << '"'; - break; - - case LUA_TTABLE: - os << "table: " << tostring(); - break; - - case LUA_TFUNCTION: - os << "function: " << tostring(); - break; - - case LUA_TUSERDATA: - os << "userdata: " << tostring(); - break; - - case LUA_TTHREAD: - os << "thread: " << tostring(); - break; - - case LUA_TLIGHTUSERDATA: - os << "lightuserdata: " << tostring(); - break; - - default: - os << "unknown"; - break; - } - } - - //============================================================================ - // - // This group of member functions is mirrored in Proxy - // - - /** Retrieve the lua_State associated with the reference. - */ - lua_State* state () const - { - return m_L; - } - - //---------------------------------------------------------------------------- - /** - Place the object onto the Lua stack. - */ - void push (lua_State* L) const - { - assert (equalstates (L, m_L)); - lua_rawgeti (L, LUA_REGISTRYINDEX, m_ref); - } - - //---------------------------------------------------------------------------- - /** - Pop the top of Lua stack and assign the ref to m_ref - */ - void pop (lua_State* L) - { - assert (equalstates (L, m_L)); - luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); - m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); - } - - //---------------------------------------------------------------------------- - /** - Determine the object type. - - The return values are the same as for `lua_type`. - */ - /** @{ */ - int type () const - { - int result; - if (m_ref != LUA_REFNIL) - { - push (m_L); - result = lua_type (m_L, -1); - lua_pop (m_L, 1); - } - else - { - result = LUA_TNIL; - } - - return result; - } - - // should never happen - //inline bool isNone () const { return m_ref == LUA_NOREF; } - - inline bool isNil () const { return type () == LUA_TNIL; } - inline bool isNumber () const { return type () == LUA_TNUMBER; } - inline bool isString () const { return type () == LUA_TSTRING; } - inline bool isTable () const { return type () == LUA_TTABLE; } - inline bool isFunction () const { return type () == LUA_TFUNCTION; } - inline bool isUserdata () const { return type () == LUA_TUSERDATA; } - inline bool isThread () const { return type () == LUA_TTHREAD; } - inline bool isLightUserdata () const { return type () == LUA_TLIGHTUSERDATA; } - /** @} */ - - //---------------------------------------------------------------------------- - /** - Perform an explicit conversion. - */ - template - T cast () const - { - StackPop p (m_L, 1); - push (m_L); - - // lua_gettop is used because Userdata::getClass() doesn't handle - // negative stack indexes. - // - return Stack ::get (m_L, lua_gettop (m_L)); - } - - //---------------------------------------------------------------------------- - /** - Universal implicit conversion operator. - - NOTE: Visual Studio 2010 and 2012 have a bug where this function - is not used. See: - - http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/e30b2664-a92d-445c-9db2-e8e0fbde2014 - https://connect.microsoft.com/VisualStudio/feedback/details/771509/correct-code-doesnt-compile - - // This code snippet fails to compile in vs2010,vs2012 - struct S { - template inline operator T () const { return T (); } - }; - int main () { - S () || false; - return 0; - } - */ - template - inline operator T () const - { - return cast (); - } - - //---------------------------------------------------------------------------- - /** - Universal comparison operators. - */ - /** @{ */ - template - bool operator== (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -2, -1, LUA_OPEQ) == 1; - } - - template - bool operator< (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -2, -1, LUA_OPLT) == 1; - } - - template - bool operator<= (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -2, -1, LUA_OPLE) == 1; - } - - template - bool operator> (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -1, -2, LUA_OPLT) == 1; - } - - template - bool operator>= (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_compare (m_L, -1, -2, LUA_OPLE) == 1; - } - - template - bool rawequal (T rhs) const - { - StackPop p (m_L, 2); - push (m_L); - Stack ::push (m_L, rhs); - return lua_rawequal (m_L, -1, -2) == 1; - } - /** @} */ - - //---------------------------------------------------------------------------- - /** - Append a value to the table. - - If the table is a sequence this will add another element to it. - */ - template - void append (T v) const - { - push (m_L); - Stack ::push (m_L, v); - luaL_ref (m_L, -2); - lua_pop (m_L, 1); - } - - //---------------------------------------------------------------------------- - /** - Call the length operator. - - This is identical to applying the Lua # operator. - */ - int length () const - { - StackPop p (m_L, 1); - push (m_L); - return get_length (m_L, -1); - } - - //---------------------------------------------------------------------------- - /** - Access a table value using a key. - - This invokes metamethods. - */ - template - Proxy operator[] (T key) const - { - Stack ::push (m_L, key); - return Proxy (m_L, m_ref); - } - - //---------------------------------------------------------------------------- - /** - Call Lua code. - - These overloads allow Lua code to be called with up to 8 parameters. - The return value is provided as a LuaRef (which may be LUA_REFNIL). - If an error occurs, a LuaException is thrown. - */ - /** @{ */ - LuaRef const operator() () const - { - push (m_L); - LuaException::pcall (m_L, 0, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1) const - { - push (m_L); - Stack ::push (m_L, p1); - LuaException::pcall (m_L, 1, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - LuaException::pcall (m_L, 2, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - LuaException::pcall (m_L, 3, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - LuaException::pcall (m_L, 4, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - LuaException::pcall (m_L, 5, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - Stack ::push (m_L, p6); - LuaException::pcall (m_L, 6, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - Stack ::push (m_L, p6); - Stack ::push (m_L, p7); - LuaException::pcall (m_L, 7, 1); - return LuaRef (m_L, FromStack ()); - } - - template - LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const - { - push (m_L); - Stack ::push (m_L, p1); - Stack ::push (m_L, p2); - Stack ::push (m_L, p3); - Stack ::push (m_L, p4); - Stack ::push (m_L, p5); - Stack ::push (m_L, p6); - Stack ::push (m_L, p7); - Stack ::push (m_L, p8); - LuaException::pcall (m_L, 8, 1); - return LuaRef (m_L, FromStack ()); - } - /** @} */ - - //============================================================================ + //---------------------------------------------------------------------------- + /** + Create a nil reference. + + The LuaRef may be assigned later. + */ + LuaRef (lua_State* L) + : m_L (L) + , m_ref (LUA_REFNIL) + { + } + + //---------------------------------------------------------------------------- + /** + Create a reference to a value. + */ + template + LuaRef (lua_State* L, T v) + : m_L (L) + { + Stack ::push (m_L, v); + m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); + } + + //---------------------------------------------------------------------------- + /** + Create a reference to a table value. + */ + LuaRef (Proxy const& v) + : m_L (v.state ()) + , m_ref (v.createRef ()) + { + } + + //---------------------------------------------------------------------------- + /** + Create a new reference to an existing reference. + */ + LuaRef (LuaRef const& other) + : m_L (other.m_L) + , m_ref (other.createRef ()) + { + } + + //---------------------------------------------------------------------------- + /** + Destroy a reference. + + The corresponding Lua registry reference will be released. + + @note If the state refers to a thread, it is the responsibility of the + caller to ensure that the thread still exists when the LuaRef + is destroyed. + */ + ~LuaRef () + { + luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); + } + + //---------------------------------------------------------------------------- + /** + Return a LuaRef from a stack item. + + The stack item is not popped. + */ + static LuaRef fromStack (lua_State* L, int index) + { + lua_pushvalue (L, index); + return LuaRef (L, FromStack ()); + } + + //---------------------------------------------------------------------------- + /** + Create a new empty table and return a reference to it. + + It is also possible to use the free function `newTable`. + + @see ::getGlobal + */ + static LuaRef newTable (lua_State* L) + { + lua_newtable (L); + return LuaRef (L, FromStack ()); + } + + //---------------------------------------------------------------------------- + /** + Return a reference to a named global. + + It is also possible to use the free function `getGlobal`. + + @see ::getGlobal + */ + static LuaRef getGlobal (lua_State *L, char const* name) + { + lua_getglobal (L, name); + return LuaRef (L, FromStack ()); + } + + //---------------------------------------------------------------------------- + /** + Assign a different value to this LuaRef. + */ + template + LuaRef& operator= (T rhs) + { + luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); + Stack ::push (m_L, rhs); + m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); + return *this; + } + + //---------------------------------------------------------------------------- + /** + Assign another LuaRef to this LuaRef. + */ + LuaRef& operator= (LuaRef const& rhs) + { + luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); + rhs.push (m_L); + m_L = rhs.state (); + m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); + return *this; + } + + //---------------------------------------------------------------------------- + /** + converts to a string using luas tostring function + */ + std::string tostring() const + { + lua_getglobal (m_L, "tostring"); + push (m_L); + lua_call (m_L, 1, 1); + const char* str = lua_tostring(m_L, 1); + lua_pop(m_L, 1); + return std::string(str); + } + + //---------------------------------------------------------------------------- + /** + Print a text description of the value to a stream. + + This is used for diagnostics. + */ + void print (std::ostream& os) const + { + switch (type ()) + { + case LUA_TNIL: + os << "nil"; + break; + + case LUA_TNUMBER: + os << cast (); + break; + + case LUA_TBOOLEAN: + os << (cast () ? "true" : "false"); + break; + + case LUA_TSTRING: + os << '"' << cast () << '"'; + break; + + case LUA_TTABLE: + os << "table: " << tostring(); + break; + + case LUA_TFUNCTION: + os << "function: " << tostring(); + break; + + case LUA_TUSERDATA: + os << "userdata: " << tostring(); + break; + + case LUA_TTHREAD: + os << "thread: " << tostring(); + break; + + case LUA_TLIGHTUSERDATA: + os << "lightuserdata: " << tostring(); + break; + + default: + os << "unknown"; + break; + } + } + + //============================================================================ + // + // This group of member functions is mirrored in Proxy + // + + /** Retrieve the lua_State associated with the reference. + */ + lua_State* state () const + { + return m_L; + } + + //---------------------------------------------------------------------------- + /** + Place the object onto the Lua stack. + */ + void push (lua_State* L) const + { + assert (equalstates (L, m_L)); + lua_rawgeti (L, LUA_REGISTRYINDEX, m_ref); + } + + //---------------------------------------------------------------------------- + /** + Pop the top of Lua stack and assign the ref to m_ref + */ + void pop (lua_State* L) + { + assert (equalstates (L, m_L)); + luaL_unref (m_L, LUA_REGISTRYINDEX, m_ref); + m_ref = luaL_ref (m_L, LUA_REGISTRYINDEX); + } + + //---------------------------------------------------------------------------- + /** + Determine the object type. + + The return values are the same as for `lua_type`. + */ + /** @{ */ + int type () const + { + int result; + if (m_ref != LUA_REFNIL) + { + push (m_L); + result = lua_type (m_L, -1); + lua_pop (m_L, 1); + } + else + { + result = LUA_TNIL; + } + + return result; + } + + // should never happen + //inline bool isNone () const { return m_ref == LUA_NOREF; } + + inline bool isNil () const { return type () == LUA_TNIL; } + inline bool isNumber () const { return type () == LUA_TNUMBER; } + inline bool isString () const { return type () == LUA_TSTRING; } + inline bool isTable () const { return type () == LUA_TTABLE; } + inline bool isFunction () const { return type () == LUA_TFUNCTION; } + inline bool isUserdata () const { return type () == LUA_TUSERDATA; } + inline bool isThread () const { return type () == LUA_TTHREAD; } + inline bool isLightUserdata () const { return type () == LUA_TLIGHTUSERDATA; } + /** @} */ + + //---------------------------------------------------------------------------- + /** + Perform an explicit conversion. + */ + template + T cast () const + { + StackPop p (m_L, 1); + push (m_L); + + // lua_gettop is used because Userdata::getClass() doesn't handle + // negative stack indexes. + // + return Stack ::get (m_L, lua_gettop (m_L)); + } + + //---------------------------------------------------------------------------- + /** + Universal implicit conversion operator. + + NOTE: Visual Studio 2010 and 2012 have a bug where this function + is not used. See: + + http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/e30b2664-a92d-445c-9db2-e8e0fbde2014 + https://connect.microsoft.com/VisualStudio/feedback/details/771509/correct-code-doesnt-compile + + // This code snippet fails to compile in vs2010,vs2012 + struct S { + template inline operator T () const { return T (); } + }; + int main () { + S () || false; + return 0; + } + */ + template + inline operator T () const + { + return cast (); + } + + //---------------------------------------------------------------------------- + /** + Universal comparison operators. + */ + /** @{ */ + template + bool operator== (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -2, -1, LUA_OPEQ) == 1; + } + + template + bool operator< (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -2, -1, LUA_OPLT) == 1; + } + + template + bool operator<= (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -2, -1, LUA_OPLE) == 1; + } + + template + bool operator> (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -1, -2, LUA_OPLT) == 1; + } + + template + bool operator>= (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_compare (m_L, -1, -2, LUA_OPLE) == 1; + } + + template + bool rawequal (T rhs) const + { + StackPop p (m_L, 2); + push (m_L); + Stack ::push (m_L, rhs); + return lua_rawequal (m_L, -1, -2) == 1; + } + /** @} */ + + //---------------------------------------------------------------------------- + /** + Append a value to the table. + + If the table is a sequence this will add another element to it. + */ + template + void append (T v) const + { + push (m_L); + Stack ::push (m_L, v); + luaL_ref (m_L, -2); + lua_pop (m_L, 1); + } + + //---------------------------------------------------------------------------- + /** + Call the length operator. + + This is identical to applying the Lua # operator. + */ + int length () const + { + StackPop p (m_L, 1); + push (m_L); + return get_length (m_L, -1); + } + + //---------------------------------------------------------------------------- + /** + Access a table value using a key. + + This invokes metamethods. + */ + template + Proxy operator[] (T key) const + { + Stack ::push (m_L, key); + return Proxy (m_L, m_ref); + } + + //---------------------------------------------------------------------------- + /** + Call Lua code. + + These overloads allow Lua code to be called with up to 8 parameters. + The return value is provided as a LuaRef (which may be LUA_REFNIL). + If an error occurs, a LuaException is thrown. + */ + /** @{ */ + LuaRef const operator() () const + { + push (m_L); + LuaException::pcall (m_L, 0, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1) const + { + push (m_L); + Stack ::push (m_L, p1); + LuaException::pcall (m_L, 1, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + LuaException::pcall (m_L, 2, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + LuaException::pcall (m_L, 3, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + LuaException::pcall (m_L, 4, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + LuaException::pcall (m_L, 5, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + Stack ::push (m_L, p6); + LuaException::pcall (m_L, 6, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + Stack ::push (m_L, p6); + Stack ::push (m_L, p7); + LuaException::pcall (m_L, 7, 1); + return LuaRef (m_L, FromStack ()); + } + + template + LuaRef const operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const + { + push (m_L); + Stack ::push (m_L, p1); + Stack ::push (m_L, p2); + Stack ::push (m_L, p3); + Stack ::push (m_L, p4); + Stack ::push (m_L, p5); + Stack ::push (m_L, p6); + Stack ::push (m_L, p7); + Stack ::push (m_L, p8); + LuaException::pcall (m_L, 8, 1); + return LuaRef (m_L, FromStack ()); + } + /** @} */ + + //============================================================================ private: - lua_State* m_L; - int m_ref; + lua_State* m_L; + int m_ref; }; //------------------------------------------------------------------------------ @@ -1127,10 +1127,10 @@ template <> struct Stack { public: - static inline void push (lua_State* L, Nil) - { - lua_pushnil (L); - } + static inline void push (lua_State* L, Nil) + { + lua_pushnil (L); + } }; //------------------------------------------------------------------------------ @@ -1141,17 +1141,17 @@ template <> struct Stack { public: - // The value is const& to prevent a copy construction. - // - static inline void push (lua_State* L, LuaRef const& v) - { - v.push (L); - } + // The value is const& to prevent a copy construction. + // + static inline void push (lua_State* L, LuaRef const& v) + { + v.push (L); + } - static inline LuaRef get (lua_State* L, int index) - { - return LuaRef (L, index, LuaRef::FromStack ()); - } + static inline LuaRef get (lua_State* L, int index) + { + return LuaRef (L, index, LuaRef::FromStack ()); + } }; //------------------------------------------------------------------------------ @@ -1162,12 +1162,12 @@ template <> struct Stack { public: - // The value is const& to prevent a copy construction. - // - static inline void push (lua_State* L, LuaRef::Proxy const& v) - { - v.push (L); - } + // The value is const& to prevent a copy construction. + // + static inline void push (lua_State* L, LuaRef::Proxy const& v) + { + v.push (L); + } }; //------------------------------------------------------------------------------ @@ -1178,7 +1178,7 @@ public: */ inline LuaRef newTable (lua_State* L) { - return LuaRef::newTable (L); + return LuaRef::newTable (L); } //------------------------------------------------------------------------------ @@ -1189,7 +1189,7 @@ inline LuaRef newTable (lua_State* L) */ inline LuaRef getGlobal (lua_State *L, char const* name) { - return LuaRef::getGlobal (L, name); + return LuaRef::getGlobal (L, name); } //------------------------------------------------------------------------------ @@ -1200,8 +1200,8 @@ inline LuaRef getGlobal (lua_State *L, char const* name) */ inline std::ostream& operator<< (std::ostream& os, LuaRef const& ref) { - ref.print (os); - return os; + ref.print (os); + return os; } //------------------------------------------------------------------------------ @@ -1211,5 +1211,5 @@ inline std::ostream& operator<< (std::ostream& os, LuaRef const& ref) template inline T LuaRef_cast(LuaRef const& lr) { - return lr.cast(); + return lr.cast(); } diff --git a/src/lib/lua/bridge/detail/Namespace.h b/src/lib/lua/bridge/detail/Namespace.h index ff22e6b092c..e4b150b3b71 100644 --- a/src/lib/lua/bridge/detail/Namespace.h +++ b/src/lib/lua/bridge/detail/Namespace.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2007, Nathan Reed @@ -35,1091 +35,1091 @@ class Namespace { private: - Namespace& operator= (Namespace const& other); + Namespace& operator= (Namespace const& other); - lua_State* const L; - int mutable m_stackSize; + lua_State* const L; + int mutable m_stackSize; private: - //============================================================================ - /** - Error reporting. + //============================================================================ + /** + Error reporting. - VF: This function looks handy, why aren't we using it? - */ + VF: This function looks handy, why aren't we using it? + */ #if 0 - static int luaError (lua_State* L, std::string message) - { - assert (lua_isstring (L, lua_upvalueindex (1))); - std::string s; + static int luaError (lua_State* L, std::string message) + { + assert (lua_isstring (L, lua_upvalueindex (1))); + std::string s; - // Get information on the caller's caller to format the message, - // so the error appears to originate from the Lua source. - lua_Debug ar; - int result = lua_getstack (L, 2, &ar); - if (result != 0) - { - lua_getinfo (L, "Sl", &ar); - s = ar.short_src; - if (ar.currentline != -1) - { - // poor mans int to string to avoid . - lua_pushnumber (L, ar.currentline); - s = s + ":" + lua_tostring (L, -1) + ": "; - lua_pop (L, 1); - } - } + // Get information on the caller's caller to format the message, + // so the error appears to originate from the Lua source. + lua_Debug ar; + int result = lua_getstack (L, 2, &ar); + if (result != 0) + { + lua_getinfo (L, "Sl", &ar); + s = ar.short_src; + if (ar.currentline != -1) + { + // poor mans int to string to avoid . + lua_pushnumber (L, ar.currentline); + s = s + ":" + lua_tostring (L, -1) + ": "; + lua_pop (L, 1); + } + } - s = s + message; + s = s + message; - return luaL_error (L, s.c_str ()); - } + return luaL_error (L, s.c_str ()); + } #endif - //---------------------------------------------------------------------------- - /** - Pop the Lua stack. - */ - void pop (int n) const - { - if (m_stackSize >= n && lua_gettop (L) >= n) - { - lua_pop (L, n); - m_stackSize -= n; - } - else - { - throw std::logic_error ("invalid stack"); - } - } + //---------------------------------------------------------------------------- + /** + Pop the Lua stack. + */ + void pop (int n) const + { + if (m_stackSize >= n && lua_gettop (L) >= n) + { + lua_pop (L, n); + m_stackSize -= n; + } + else + { + throw std::logic_error ("invalid stack"); + } + } private: - /** - Factored base to reduce template instantiations. - */ - class ClassBase - { - private: - ClassBase& operator= (ClassBase const& other); + /** + Factored base to reduce template instantiations. + */ + class ClassBase + { + private: + ClassBase& operator= (ClassBase const& other); - protected: - friend class Namespace; + protected: + friend class Namespace; - lua_State* const L; - int mutable m_stackSize; + lua_State* const L; + int mutable m_stackSize; - protected: - //-------------------------------------------------------------------------- - /** - __index metamethod for a class. + protected: + //-------------------------------------------------------------------------- + /** + __index metamethod for a class. - This implements member functions, data members, and property members. - Functions are stored in the metatable and const metatable. Data members - and property members are in the __propget table. + This implements member functions, data members, and property members. + Functions are stored in the metatable and const metatable. Data members + and property members are in the __propget table. - If the key is not found, the search proceeds up the hierarchy of base - classes. - */ - static int indexMetaMethod (lua_State* L) - { - int result = 0; + If the key is not found, the search proceeds up the hierarchy of base + classes. + */ + static int indexMetaMethod (lua_State* L) + { + int result = 0; - assert (lua_isuserdata (L, 1)); // warn on security bypass - lua_getmetatable (L, 1); // get metatable for object - for (;;) - { - lua_pushvalue (L, 2); // push key arg2 - lua_rawget (L, -2); // lookup key in metatable - if (lua_iscfunction (L, -1)) // ensure its a cfunction - { - lua_remove (L, -2); // remove metatable - result = 1; - break; - } - else if (lua_isnil (L, -1)) - { - lua_pop (L, 1); - } - else - { - lua_pop (L, 2); - throw std::logic_error ("not a cfunction"); - } + assert (lua_isuserdata (L, 1)); // warn on security bypass + lua_getmetatable (L, 1); // get metatable for object + for (;;) + { + lua_pushvalue (L, 2); // push key arg2 + lua_rawget (L, -2); // lookup key in metatable + if (lua_iscfunction (L, -1)) // ensure its a cfunction + { + lua_remove (L, -2); // remove metatable + result = 1; + break; + } + else if (lua_isnil (L, -1)) + { + lua_pop (L, 1); + } + else + { + lua_pop (L, 2); + throw std::logic_error ("not a cfunction"); + } - rawgetfield (L, -1, "__propget"); // get __propget table - if (lua_istable (L, -1)) // ensure it is a table - { - lua_pushvalue (L, 2); // push key arg2 - lua_rawget (L, -2); // lookup key in __propget - lua_remove (L, -2); // remove __propget - if (lua_iscfunction (L, -1)) // ensure its a cfunction - { - lua_remove (L, -2); // remove metatable - lua_pushvalue (L, 1); // push class arg1 - lua_call (L, 1, 1); - result = 1; - break; - } - else if (lua_isnil (L, -1)) - { - lua_pop (L, 1); - } - else - { - lua_pop (L, 2); + rawgetfield (L, -1, "__propget"); // get __propget table + if (lua_istable (L, -1)) // ensure it is a table + { + lua_pushvalue (L, 2); // push key arg2 + lua_rawget (L, -2); // lookup key in __propget + lua_remove (L, -2); // remove __propget + if (lua_iscfunction (L, -1)) // ensure its a cfunction + { + lua_remove (L, -2); // remove metatable + lua_pushvalue (L, 1); // push class arg1 + lua_call (L, 1, 1); + result = 1; + break; + } + else if (lua_isnil (L, -1)) + { + lua_pop (L, 1); + } + else + { + lua_pop (L, 2); - // We only put cfunctions into __propget. - throw std::logic_error ("not a cfunction"); - } - } - else - { - lua_pop (L, 2); + // We only put cfunctions into __propget. + throw std::logic_error ("not a cfunction"); + } + } + else + { + lua_pop (L, 2); - // __propget is missing, or not a table. - throw std::logic_error ("missing __propget table"); - } + // __propget is missing, or not a table. + throw std::logic_error ("missing __propget table"); + } - // Repeat the lookup in the __parent metafield, - // or return nil if the field doesn't exist. - rawgetfield (L, -1, "__parent"); - if (lua_istable (L, -1)) - { - // Remove metatable and repeat the search in __parent. - lua_remove (L, -2); - } - else if (lua_isnil (L, -1)) - { - result = 1; - break; - } - else - { - lua_pop (L, 2); + // Repeat the lookup in the __parent metafield, + // or return nil if the field doesn't exist. + rawgetfield (L, -1, "__parent"); + if (lua_istable (L, -1)) + { + // Remove metatable and repeat the search in __parent. + lua_remove (L, -2); + } + else if (lua_isnil (L, -1)) + { + result = 1; + break; + } + else + { + lua_pop (L, 2); - throw std::logic_error ("__parent is not a table"); - } - } + throw std::logic_error ("__parent is not a table"); + } + } - return result; - } + return result; + } - //-------------------------------------------------------------------------- - /** - __newindex metamethod for classes. + //-------------------------------------------------------------------------- + /** + __newindex metamethod for classes. - This supports writable variables and properties on class objects. The - corresponding object is passed in the first parameter to the set function. - */ - static int newindexMetaMethod (lua_State* L) - { - int result = 0; + This supports writable variables and properties on class objects. The + corresponding object is passed in the first parameter to the set function. + */ + static int newindexMetaMethod (lua_State* L) + { + int result = 0; - lua_getmetatable (L, 1); + lua_getmetatable (L, 1); - for (;;) - { - // Check __propset - rawgetfield (L, -1, "__propset"); - if (!lua_isnil (L, -1)) - { - lua_pushvalue (L, 2); - lua_rawget (L, -2); - if (!lua_isnil (L, -1)) - { - // found it, call the setFunction. - assert (lua_isfunction (L, -1)); - lua_pushvalue (L, 1); - lua_pushvalue (L, 3); - lua_call (L, 2, 0); - result = 0; - break; - } - lua_pop (L, 1); - } - lua_pop (L, 1); + for (;;) + { + // Check __propset + rawgetfield (L, -1, "__propset"); + if (!lua_isnil (L, -1)) + { + lua_pushvalue (L, 2); + lua_rawget (L, -2); + if (!lua_isnil (L, -1)) + { + // found it, call the setFunction. + assert (lua_isfunction (L, -1)); + lua_pushvalue (L, 1); + lua_pushvalue (L, 3); + lua_call (L, 2, 0); + result = 0; + break; + } + lua_pop (L, 1); + } + lua_pop (L, 1); - // Repeat the lookup in the __parent metafield. - rawgetfield (L, -1, "__parent"); - if (lua_isnil (L, -1)) - { - // Either the property or __parent must exist. - result = luaL_error (L, - "no member named '%s'", lua_tostring (L, 2)); - } - lua_remove (L, -2); - } + // Repeat the lookup in the __parent metafield. + rawgetfield (L, -1, "__parent"); + if (lua_isnil (L, -1)) + { + // Either the property or __parent must exist. + result = luaL_error (L, + "no member named '%s'", lua_tostring (L, 2)); + } + lua_remove (L, -2); + } - return result; - } + return result; + } - //-------------------------------------------------------------------------- - /** - Create the const table. - */ - void createConstTable (char const* name) - { - lua_newtable (L); - lua_pushvalue (L, -1); - lua_setmetatable (L, -2); - lua_pushboolean (L, 1); - lua_rawsetp (L, -2, getIdentityKey ()); - lua_pushstring (L, (std::string ("const ") + name).c_str ()); - rawsetfield (L, -2, "__type"); - lua_pushcfunction (L, &indexMetaMethod); - rawsetfield (L, -2, "__index"); - lua_pushcfunction (L, &newindexMetaMethod); - rawsetfield (L, -2, "__newindex"); - lua_newtable (L); - rawsetfield (L, -2, "__propget"); - - if (Security::hideMetatables ()) - { - lua_pushnil (L); - rawsetfield (L, -2, "__metatable"); - } - } + //-------------------------------------------------------------------------- + /** + Create the const table. + */ + void createConstTable (char const* name) + { + lua_newtable (L); + lua_pushvalue (L, -1); + lua_setmetatable (L, -2); + lua_pushboolean (L, 1); + lua_rawsetp (L, -2, getIdentityKey ()); + lua_pushstring (L, (std::string ("const ") + name).c_str ()); + rawsetfield (L, -2, "__type"); + lua_pushcfunction (L, &indexMetaMethod); + rawsetfield (L, -2, "__index"); + lua_pushcfunction (L, &newindexMetaMethod); + rawsetfield (L, -2, "__newindex"); + lua_newtable (L); + rawsetfield (L, -2, "__propget"); - //-------------------------------------------------------------------------- - /** - Create the class table. + if (Security::hideMetatables ()) + { + lua_pushnil (L); + rawsetfield (L, -2, "__metatable"); + } + } - The Lua stack should have the const table on top. - */ - void createClassTable (char const* name) - { - lua_newtable (L); - lua_pushvalue (L, -1); - lua_setmetatable (L, -2); - lua_pushboolean (L, 1); - lua_rawsetp (L, -2, getIdentityKey ()); - lua_pushstring (L, name); - rawsetfield (L, -2, "__type"); - lua_pushcfunction (L, &indexMetaMethod); - rawsetfield (L, -2, "__index"); - lua_pushcfunction (L, &newindexMetaMethod); - rawsetfield (L, -2, "__newindex"); - lua_newtable (L); - rawsetfield (L, -2, "__propget"); - lua_newtable (L); - rawsetfield (L, -2, "__propset"); + //-------------------------------------------------------------------------- + /** + Create the class table. - lua_pushvalue (L, -2); - rawsetfield (L, -2, "__const"); // point to const table + The Lua stack should have the const table on top. + */ + void createClassTable (char const* name) + { + lua_newtable (L); + lua_pushvalue (L, -1); + lua_setmetatable (L, -2); + lua_pushboolean (L, 1); + lua_rawsetp (L, -2, getIdentityKey ()); + lua_pushstring (L, name); + rawsetfield (L, -2, "__type"); + lua_pushcfunction (L, &indexMetaMethod); + rawsetfield (L, -2, "__index"); + lua_pushcfunction (L, &newindexMetaMethod); + rawsetfield (L, -2, "__newindex"); + lua_newtable (L); + rawsetfield (L, -2, "__propget"); + lua_newtable (L); + rawsetfield (L, -2, "__propset"); - lua_pushvalue (L, -1); - rawsetfield (L, -3, "__class"); // point const table to class table + lua_pushvalue (L, -2); + rawsetfield (L, -2, "__const"); // point to const table - if (Security::hideMetatables ()) - { - lua_pushnil (L); - rawsetfield (L, -2, "__metatable"); - } - } + lua_pushvalue (L, -1); + rawsetfield (L, -3, "__class"); // point const table to class table - //-------------------------------------------------------------------------- - /** - Create the static table. + if (Security::hideMetatables ()) + { + lua_pushnil (L); + rawsetfield (L, -2, "__metatable"); + } + } - The Lua stack should have: - -1 class table - -2 const table - -3 enclosing namespace - */ - void createStaticTable (char const* name) - { - lua_newtable (L); - lua_newtable (L); - lua_pushvalue (L, -1); - lua_setmetatable (L, -3); - lua_insert (L, -2); - rawsetfield (L, -5, name); + //-------------------------------------------------------------------------- + /** + Create the static table. + + The Lua stack should have: + -1 class table + -2 const table + -3 enclosing namespace + */ + void createStaticTable (char const* name) + { + lua_newtable (L); + lua_newtable (L); + lua_pushvalue (L, -1); + lua_setmetatable (L, -3); + lua_insert (L, -2); + rawsetfield (L, -5, name); #if 0 - lua_pushlightuserdata (L, this); - lua_pushcclosure (L, &tostringMetaMethod, 1); - rawsetfield (L, -2, "__tostring"); + lua_pushlightuserdata (L, this); + lua_pushcclosure (L, &tostringMetaMethod, 1); + rawsetfield (L, -2, "__tostring"); #endif - lua_pushcfunction (L, &CFunc::indexMetaMethod); - rawsetfield (L, -2, "__index"); - lua_pushcfunction (L, &CFunc::newindexMetaMethod); - rawsetfield (L, -2, "__newindex"); - lua_newtable (L); - rawsetfield (L, -2, "__propget"); - lua_newtable (L); - rawsetfield (L, -2, "__propset"); + lua_pushcfunction (L, &CFunc::indexMetaMethod); + rawsetfield (L, -2, "__index"); + lua_pushcfunction (L, &CFunc::newindexMetaMethod); + rawsetfield (L, -2, "__newindex"); + lua_newtable (L); + rawsetfield (L, -2, "__propget"); + lua_newtable (L); + rawsetfield (L, -2, "__propset"); - lua_pushvalue (L, -2); - rawsetfield (L, -2, "__class"); // point to class table + lua_pushvalue (L, -2); + rawsetfield (L, -2, "__class"); // point to class table - if (Security::hideMetatables ()) - { - lua_pushnil (L); - rawsetfield (L, -2, "__metatable"); - } - } + if (Security::hideMetatables ()) + { + lua_pushnil (L); + rawsetfield (L, -2, "__metatable"); + } + } - //========================================================================== - /** - lua_CFunction to construct a class object wrapped in a container. - */ - template - static int ctorContainerProxy (lua_State* L) - { - typedef typename ContainerTraits ::Type T; - ArgList args (L); - T* const p = Constructor ::call (args); - UserdataSharedHelper ::push (L, p); - return 1; - } + //========================================================================== + /** + lua_CFunction to construct a class object wrapped in a container. + */ + template + static int ctorContainerProxy (lua_State* L) + { + typedef typename ContainerTraits ::Type T; + ArgList args (L); + T* const p = Constructor ::call (args); + UserdataSharedHelper ::push (L, p); + return 1; + } - //-------------------------------------------------------------------------- - /** - lua_CFunction to construct a class object in-place in the userdata. - */ - template - static int ctorPlacementProxy (lua_State* L) - { - ArgList args (L); - Constructor ::call (UserdataValue ::place (L), args); - return 1; - } + //-------------------------------------------------------------------------- + /** + lua_CFunction to construct a class object in-place in the userdata. + */ + template + static int ctorPlacementProxy (lua_State* L) + { + ArgList args (L); + Constructor ::call (UserdataValue ::place (L), args); + return 1; + } - //-------------------------------------------------------------------------- - /** - Pop the Lua stack. - */ - void pop (int n) const - { - if (m_stackSize >= n && lua_gettop (L) >= n) - { - lua_pop (L, n); - m_stackSize -= n; - } - else - { - throw std::logic_error ("invalid stack"); - } - } + //-------------------------------------------------------------------------- + /** + Pop the Lua stack. + */ + void pop (int n) const + { + if (m_stackSize >= n && lua_gettop (L) >= n) + { + lua_pop (L, n); + m_stackSize -= n; + } + else + { + throw std::logic_error ("invalid stack"); + } + } - public: - //-------------------------------------------------------------------------- - explicit ClassBase (lua_State* L_) - : L (L_) - , m_stackSize (0) - { - } + public: + //-------------------------------------------------------------------------- + explicit ClassBase (lua_State* L_) + : L (L_) + , m_stackSize (0) + { + } - //-------------------------------------------------------------------------- - /** - Copy Constructor. - */ - ClassBase (ClassBase const& other) - : L (other.L) - , m_stackSize (0) - { - m_stackSize = other.m_stackSize; - other.m_stackSize = 0; - } + //-------------------------------------------------------------------------- + /** + Copy Constructor. + */ + ClassBase (ClassBase const& other) + : L (other.L) + , m_stackSize (0) + { + m_stackSize = other.m_stackSize; + other.m_stackSize = 0; + } - ~ClassBase () - { - pop (m_stackSize); - } - }; + ~ClassBase () + { + pop (m_stackSize); + } + }; - //============================================================================ - // - // Class - // - //============================================================================ - /** - Provides a class registration in a lua_State. + //============================================================================ + // + // Class + // + //============================================================================ + /** + Provides a class registration in a lua_State. - After contstruction the Lua stack holds these objects: - -1 static table - -2 class table - -3 const table - -4 (enclosing namespace) - */ - template - class Class : public ClassBase - { - public: - //========================================================================== - /** - Register a new class or add to an existing class registration. - */ - Class (char const* name, Namespace const* parent) : ClassBase (parent->L) - { - m_stackSize = parent->m_stackSize + 3; - parent->m_stackSize = 0; + After contstruction the Lua stack holds these objects: + -1 static table + -2 class table + -3 const table + -4 (enclosing namespace) + */ + template + class Class : public ClassBase + { + public: + //========================================================================== + /** + Register a new class or add to an existing class registration. + */ + Class (char const* name, Namespace const* parent) : ClassBase (parent->L) + { + m_stackSize = parent->m_stackSize + 3; + parent->m_stackSize = 0; - assert (lua_istable (L, -1)); - rawgetfield (L, -1, name); - - if (lua_isnil (L, -1)) - { - lua_pop (L, 1); + assert (lua_istable (L, -1)); + rawgetfield (L, -1, name); - createConstTable (name); - lua_pushcfunction (L, &CFunc::gcMetaMethod ); - rawsetfield (L, -2, "__gc"); + if (lua_isnil (L, -1)) + { + lua_pop (L, 1); - createClassTable (name); - lua_pushcfunction (L, &CFunc::gcMetaMethod ); - rawsetfield (L, -2, "__gc"); + createConstTable (name); + lua_pushcfunction (L, &CFunc::gcMetaMethod ); + rawsetfield (L, -2, "__gc"); - createStaticTable (name); + createClassTable (name); + lua_pushcfunction (L, &CFunc::gcMetaMethod ); + rawsetfield (L, -2, "__gc"); - // Map T back to its tables. - lua_pushvalue (L, -1); - lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getStaticKey ()); - lua_pushvalue (L, -2); - lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); - lua_pushvalue (L, -3); - lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); - } - else - { - rawgetfield (L, -1, "__class"); - rawgetfield (L, -1, "__const"); + createStaticTable (name); - // Reverse the top 3 stack elements - lua_insert (L, -3); - lua_insert (L, -2); - } - } + // Map T back to its tables. + lua_pushvalue (L, -1); + lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getStaticKey ()); + lua_pushvalue (L, -2); + lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); + lua_pushvalue (L, -3); + lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); + } + else + { + rawgetfield (L, -1, "__class"); + rawgetfield (L, -1, "__const"); - //========================================================================== - /** - Derive a new class. - */ - Class (char const* name, Namespace const* parent, void const* const staticKey) - : ClassBase (parent->L) - { - m_stackSize = parent->m_stackSize + 3; - parent->m_stackSize = 0; + // Reverse the top 3 stack elements + lua_insert (L, -3); + lua_insert (L, -2); + } + } - assert (lua_istable (L, -1)); + //========================================================================== + /** + Derive a new class. + */ + Class (char const* name, Namespace const* parent, void const* const staticKey) + : ClassBase (parent->L) + { + m_stackSize = parent->m_stackSize + 3; + parent->m_stackSize = 0; - createConstTable (name); - lua_pushcfunction (L, &CFunc::gcMetaMethod ); - rawsetfield (L, -2, "__gc"); + assert (lua_istable (L, -1)); - createClassTable (name); - lua_pushcfunction (L, &CFunc::gcMetaMethod ); - rawsetfield (L, -2, "__gc"); + createConstTable (name); + lua_pushcfunction (L, &CFunc::gcMetaMethod ); + rawsetfield (L, -2, "__gc"); - createStaticTable (name); + createClassTable (name); + lua_pushcfunction (L, &CFunc::gcMetaMethod ); + rawsetfield (L, -2, "__gc"); - lua_rawgetp (L, LUA_REGISTRYINDEX, staticKey); - assert (lua_istable (L, -1)); - rawgetfield (L, -1, "__class"); - assert (lua_istable (L, -1)); - rawgetfield (L, -1, "__const"); - assert (lua_istable (L, -1)); + createStaticTable (name); - rawsetfield (L, -6, "__parent"); - rawsetfield (L, -4, "__parent"); - rawsetfield (L, -2, "__parent"); + lua_rawgetp (L, LUA_REGISTRYINDEX, staticKey); + assert (lua_istable (L, -1)); + rawgetfield (L, -1, "__class"); + assert (lua_istable (L, -1)); + rawgetfield (L, -1, "__const"); + assert (lua_istable (L, -1)); - lua_pushvalue (L, -1); - lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getStaticKey ()); - lua_pushvalue (L, -2); - lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); - lua_pushvalue (L, -3); - lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); - } + rawsetfield (L, -6, "__parent"); + rawsetfield (L, -4, "__parent"); + rawsetfield (L, -2, "__parent"); - //-------------------------------------------------------------------------- - /** - Continue registration in the enclosing namespace. - */ - Namespace endClass () - { - return Namespace (this); - } + lua_pushvalue (L, -1); + lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getStaticKey ()); + lua_pushvalue (L, -2); + lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); + lua_pushvalue (L, -3); + lua_rawsetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); + } - //-------------------------------------------------------------------------- - /** - Add or replace a static data member. - */ - template - Class & addStaticData (char const* name, U* pu, bool isWritable = true) - { - assert (lua_istable (L, -1)); + //-------------------------------------------------------------------------- + /** + Continue registration in the enclosing namespace. + */ + Namespace endClass () + { + return Namespace (this); + } - rawgetfield (L, -1, "__propget"); - assert (lua_istable (L, -1)); - lua_pushlightuserdata (L, pu); - lua_pushcclosure (L, &CFunc::getVariable , 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); + //-------------------------------------------------------------------------- + /** + Add or replace a static data member. + */ + template + Class & addStaticData (char const* name, U* pu, bool isWritable = true) + { + assert (lua_istable (L, -1)); - rawgetfield (L, -1, "__propset"); - assert (lua_istable (L, -1)); - if (isWritable) - { - lua_pushlightuserdata (L, pu); - lua_pushcclosure (L, &CFunc::setVariable , 1); - } - else - { - lua_pushstring (L, name); - lua_pushcclosure (L, &CFunc::readOnlyError, 1); - } - rawsetfield (L, -2, name); - lua_pop (L, 1); + rawgetfield (L, -1, "__propget"); + assert (lua_istable (L, -1)); + lua_pushlightuserdata (L, pu); + lua_pushcclosure (L, &CFunc::getVariable , 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); - return *this; - } + rawgetfield (L, -1, "__propset"); + assert (lua_istable (L, -1)); + if (isWritable) + { + lua_pushlightuserdata (L, pu); + lua_pushcclosure (L, &CFunc::setVariable , 1); + } + else + { + lua_pushstring (L, name); + lua_pushcclosure (L, &CFunc::readOnlyError, 1); + } + rawsetfield (L, -2, name); + lua_pop (L, 1); - //-------------------------------------------------------------------------- - /** - Add or replace a static property member. + return *this; + } - If the set function is null, the property is read-only. - */ - template - Class & addStaticProperty (char const* name, U (*get)(), void (*set)(U) = 0) - { - typedef U (*get_t)(); - typedef void (*set_t)(U); - - assert (lua_istable (L, -1)); + //-------------------------------------------------------------------------- + /** + Add or replace a static property member. - rawgetfield (L, -1, "__propget"); - assert (lua_istable (L, -1)); - new (lua_newuserdata (L, sizeof (get))) get_t (get); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); + If the set function is null, the property is read-only. + */ + template + Class & addStaticProperty (char const* name, U (*get)(), void (*set)(U) = 0) + { + typedef U (*get_t)(); + typedef void (*set_t)(U); - rawgetfield (L, -1, "__propset"); - assert (lua_istable (L, -1)); - if (set != 0) - { - new (lua_newuserdata (L, sizeof (set))) set_t (set); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - } - else - { - lua_pushstring (L, name); - lua_pushcclosure (L, &CFunc::readOnlyError, 1); - } - rawsetfield (L, -2, name); - lua_pop (L, 1); + assert (lua_istable (L, -1)); - return *this; - } + rawgetfield (L, -1, "__propget"); + assert (lua_istable (L, -1)); + new (lua_newuserdata (L, sizeof (get))) get_t (get); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); - //-------------------------------------------------------------------------- - /** - Add or replace a static member function. - */ - template - Class & addStaticFunction (char const* name, FP const fp) - { - new (lua_newuserdata (L, sizeof (fp))) FP (fp); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - rawsetfield (L, -2, name); + rawgetfield (L, -1, "__propset"); + assert (lua_istable (L, -1)); + if (set != 0) + { + new (lua_newuserdata (L, sizeof (set))) set_t (set); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + } + else + { + lua_pushstring (L, name); + lua_pushcclosure (L, &CFunc::readOnlyError, 1); + } + rawsetfield (L, -2, name); + lua_pop (L, 1); - return *this; - } + return *this; + } - //-------------------------------------------------------------------------- - /** - Add or replace a lua_CFunction. - */ - Class & addStaticCFunction (char const* name, int (*const fp)(lua_State*)) - { - lua_pushcfunction (L, fp); - rawsetfield (L, -2, name); - return *this; - } + //-------------------------------------------------------------------------- + /** + Add or replace a static member function. + */ + template + Class & addStaticFunction (char const* name, FP const fp) + { + new (lua_newuserdata (L, sizeof (fp))) FP (fp); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + rawsetfield (L, -2, name); - //-------------------------------------------------------------------------- - /** - Add or replace a data member. - */ - template - Class & addData (char const* name, const U T::* mp, bool isWritable = true) - { - typedef const U T::*mp_t; + return *this; + } - // Add to __propget in class and const tables. - { - rawgetfield (L, -2, "__propget"); - rawgetfield (L, -4, "__propget"); - new (lua_newuserdata (L, sizeof (mp_t))) mp_t (mp); - lua_pushcclosure (L, &CFunc::getProperty , 1); - lua_pushvalue (L, -1); - rawsetfield (L, -4, name); - rawsetfield (L, -2, name); - lua_pop (L, 2); - } + //-------------------------------------------------------------------------- + /** + Add or replace a lua_CFunction. + */ + Class & addStaticCFunction (char const* name, int (*const fp)(lua_State*)) + { + lua_pushcfunction (L, fp); + rawsetfield (L, -2, name); + return *this; + } - if (isWritable) - { - // Add to __propset in class table. - rawgetfield (L, -2, "__propset"); - assert (lua_istable (L, -1)); - new (lua_newuserdata (L, sizeof (mp_t))) mp_t (mp); - lua_pushcclosure (L, &CFunc::setProperty , 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); - } + //-------------------------------------------------------------------------- + /** + Add or replace a data member. + */ + template + Class & addData (char const* name, const U T::* mp, bool isWritable = true) + { + typedef const U T::*mp_t; - return *this; - } + // Add to __propget in class and const tables. + { + rawgetfield (L, -2, "__propget"); + rawgetfield (L, -4, "__propget"); + new (lua_newuserdata (L, sizeof (mp_t))) mp_t (mp); + lua_pushcclosure (L, &CFunc::getProperty , 1); + lua_pushvalue (L, -1); + rawsetfield (L, -4, name); + rawsetfield (L, -2, name); + lua_pop (L, 2); + } - //-------------------------------------------------------------------------- - /** - Add or replace a property member. - */ - template - Class & addProperty (char const* name, TG (T::* get) () const, void (T::* set) (TS)) - { - // Add to __propget in class and const tables. - { - rawgetfield (L, -2, "__propget"); - rawgetfield (L, -4, "__propget"); - typedef TG (T::*get_t) () const; - new (lua_newuserdata (L, sizeof (get_t))) get_t (get); - lua_pushcclosure (L, &CFunc::CallConstMember ::f, 1); - lua_pushvalue (L, -1); - rawsetfield (L, -4, name); - rawsetfield (L, -2, name); - lua_pop (L, 2); - } + if (isWritable) + { + // Add to __propset in class table. + rawgetfield (L, -2, "__propset"); + assert (lua_istable (L, -1)); + new (lua_newuserdata (L, sizeof (mp_t))) mp_t (mp); + lua_pushcclosure (L, &CFunc::setProperty , 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); + } - { - // Add to __propset in class table. - rawgetfield (L, -2, "__propset"); - assert (lua_istable (L, -1)); - typedef void (T::* set_t) (TS); - new (lua_newuserdata (L, sizeof (set_t))) set_t (set); - lua_pushcclosure (L, &CFunc::CallMember ::f, 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); - } + return *this; + } - return *this; - } + //-------------------------------------------------------------------------- + /** + Add or replace a property member. + */ + template + Class & addProperty (char const* name, TG (T::* get) () const, void (T::* set) (TS)) + { + // Add to __propget in class and const tables. + { + rawgetfield (L, -2, "__propget"); + rawgetfield (L, -4, "__propget"); + typedef TG (T::*get_t) () const; + new (lua_newuserdata (L, sizeof (get_t))) get_t (get); + lua_pushcclosure (L, &CFunc::CallConstMember ::f, 1); + lua_pushvalue (L, -1); + rawsetfield (L, -4, name); + rawsetfield (L, -2, name); + lua_pop (L, 2); + } - // read-only - template - Class & addProperty (char const* name, TG (T::* get) () const) - { - // Add to __propget in class and const tables. - rawgetfield (L, -2, "__propget"); - rawgetfield (L, -4, "__propget"); - typedef TG (T::*get_t) () const; - new (lua_newuserdata (L, sizeof (get_t))) get_t (get); - lua_pushcclosure (L, &CFunc::CallConstMember ::f, 1); - lua_pushvalue (L, -1); - rawsetfield (L, -4, name); - rawsetfield (L, -2, name); - lua_pop (L, 2); + { + // Add to __propset in class table. + rawgetfield (L, -2, "__propset"); + assert (lua_istable (L, -1)); + typedef void (T::* set_t) (TS); + new (lua_newuserdata (L, sizeof (set_t))) set_t (set); + lua_pushcclosure (L, &CFunc::CallMember ::f, 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); + } - return *this; - } + return *this; + } - //-------------------------------------------------------------------------- - /** - Add or replace a property member, by proxy. + // read-only + template + Class & addProperty (char const* name, TG (T::* get) () const) + { + // Add to __propget in class and const tables. + rawgetfield (L, -2, "__propget"); + rawgetfield (L, -4, "__propget"); + typedef TG (T::*get_t) () const; + new (lua_newuserdata (L, sizeof (get_t))) get_t (get); + lua_pushcclosure (L, &CFunc::CallConstMember ::f, 1); + lua_pushvalue (L, -1); + rawsetfield (L, -4, name); + rawsetfield (L, -2, name); + lua_pop (L, 2); - When a class is closed for modification and does not provide (or cannot - provide) the function signatures necessary to implement get or set for - a property, this will allow non-member functions act as proxies. + return *this; + } - Both the get and the set functions require a T const* and T* in the first - argument respectively. - */ - template - Class & addProperty (char const* name, TG (*get) (T const*), void (*set) (T*, TS)) - { - // Add to __propget in class and const tables. - { - rawgetfield (L, -2, "__propget"); - rawgetfield (L, -4, "__propget"); - typedef TG (*get_t) (T const*); - new (lua_newuserdata (L, sizeof (get_t))) get_t (get); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - lua_pushvalue (L, -1); - rawsetfield (L, -4, name); - rawsetfield (L, -2, name); - lua_pop (L, 2); - } + //-------------------------------------------------------------------------- + /** + Add or replace a property member, by proxy. - if (set != 0) - { - // Add to __propset in class table. - rawgetfield (L, -2, "__propset"); - assert (lua_istable (L, -1)); - typedef void (*set_t) (T*, TS); - new (lua_newuserdata (L, sizeof (set_t))) set_t (set); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); - } + When a class is closed for modification and does not provide (or cannot + provide) the function signatures necessary to implement get or set for + a property, this will allow non-member functions act as proxies. - return *this; - } + Both the get and the set functions require a T const* and T* in the first + argument respectively. + */ + template + Class & addProperty (char const* name, TG (*get) (T const*), void (*set) (T*, TS)) + { + // Add to __propget in class and const tables. + { + rawgetfield (L, -2, "__propget"); + rawgetfield (L, -4, "__propget"); + typedef TG (*get_t) (T const*); + new (lua_newuserdata (L, sizeof (get_t))) get_t (get); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + lua_pushvalue (L, -1); + rawsetfield (L, -4, name); + rawsetfield (L, -2, name); + lua_pop (L, 2); + } - // read-only - template - Class & addProperty (char const* name, TG (*get) (T const*)) - { - // Add to __propget in class and const tables. - rawgetfield (L, -2, "__propget"); - rawgetfield (L, -4, "__propget"); - typedef TG (*get_t) (T const*); - new (lua_newuserdata (L, sizeof (get_t))) get_t (get); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - lua_pushvalue (L, -1); - rawsetfield (L, -4, name); - rawsetfield (L, -2, name); - lua_pop (L, 2); + if (set != 0) + { + // Add to __propset in class table. + rawgetfield (L, -2, "__propset"); + assert (lua_istable (L, -1)); + typedef void (*set_t) (T*, TS); + new (lua_newuserdata (L, sizeof (set_t))) set_t (set); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); + } - return *this; - } + return *this; + } - //-------------------------------------------------------------------------- - /** - Add or replace a member function. - */ - template - Class & addFunction (char const* name, MemFn mf) - { - CFunc::CallMemberFunctionHelper ::isConstMemberFunction>::add (L, name, mf); - return *this; - } + // read-only + template + Class & addProperty (char const* name, TG (*get) (T const*)) + { + // Add to __propget in class and const tables. + rawgetfield (L, -2, "__propget"); + rawgetfield (L, -4, "__propget"); + typedef TG (*get_t) (T const*); + new (lua_newuserdata (L, sizeof (get_t))) get_t (get); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + lua_pushvalue (L, -1); + rawsetfield (L, -4, name); + rawsetfield (L, -2, name); + lua_pop (L, 2); - //-------------------------------------------------------------------------- - /** - Add or replace a member lua_CFunction. - */ - Class & addCFunction (char const* name, int (T::*mfp)(lua_State*)) - { - typedef int (T::*MFP)(lua_State*); - assert (lua_istable (L, -1)); - new (lua_newuserdata (L, sizeof (mfp))) MFP (mfp); - lua_pushcclosure (L, &CFunc::CallMemberCFunction ::f, 1); - rawsetfield (L, -3, name); // class table + return *this; + } - return *this; - } + //-------------------------------------------------------------------------- + /** + Add or replace a member function. + */ + template + Class & addFunction (char const* name, MemFn mf) + { + CFunc::CallMemberFunctionHelper ::isConstMemberFunction>::add (L, name, mf); + return *this; + } - //-------------------------------------------------------------------------- - /** - Add or replace a const member lua_CFunction. - */ - Class & addCFunction (char const* name, int (T::*mfp)(lua_State*) const) - { - typedef int (T::*MFP)(lua_State*) const; - assert (lua_istable (L, -1)); - new (lua_newuserdata (L, sizeof (mfp))) MFP (mfp); - lua_pushcclosure (L, &CFunc::CallConstMemberCFunction ::f, 1); - lua_pushvalue (L, -1); - rawsetfield (L, -5, name); // const table - rawsetfield (L, -3, name); // class table + //-------------------------------------------------------------------------- + /** + Add or replace a member lua_CFunction. + */ + Class & addCFunction (char const* name, int (T::*mfp)(lua_State*)) + { + typedef int (T::*MFP)(lua_State*); + assert (lua_istable (L, -1)); + new (lua_newuserdata (L, sizeof (mfp))) MFP (mfp); + lua_pushcclosure (L, &CFunc::CallMemberCFunction ::f, 1); + rawsetfield (L, -3, name); // class table - return *this; - } + return *this; + } - //-------------------------------------------------------------------------- - /** - Add or replace a primary Constructor. + //-------------------------------------------------------------------------- + /** + Add or replace a const member lua_CFunction. + */ + Class & addCFunction (char const* name, int (T::*mfp)(lua_State*) const) + { + typedef int (T::*MFP)(lua_State*) const; + assert (lua_istable (L, -1)); + new (lua_newuserdata (L, sizeof (mfp))) MFP (mfp); + lua_pushcclosure (L, &CFunc::CallConstMemberCFunction ::f, 1); + lua_pushvalue (L, -1); + rawsetfield (L, -5, name); // const table + rawsetfield (L, -3, name); // class table - The primary Constructor is invoked when calling the class type table - like a function. + return *this; + } - The template parameter should be a function pointer type that matches - the desired Constructor (since you can't take the address of a Constructor - and pass it as an argument). - */ - template - Class & addConstructor () - { - lua_pushcclosure (L, - &ctorContainerProxy ::Params, C>, 0); - rawsetfield(L, -2, "__call"); + //-------------------------------------------------------------------------- + /** + Add or replace a primary Constructor. - return *this; - } + The primary Constructor is invoked when calling the class type table + like a function. - template - Class & addConstructor () - { - lua_pushcclosure (L, - &ctorPlacementProxy ::Params, T>, 0); - rawsetfield(L, -2, "__call"); + The template parameter should be a function pointer type that matches + the desired Constructor (since you can't take the address of a Constructor + and pass it as an argument). + */ + template + Class & addConstructor () + { + lua_pushcclosure (L, + &ctorContainerProxy ::Params, C>, 0); + rawsetfield(L, -2, "__call"); - return *this; - } - }; + return *this; + } + + template + Class & addConstructor () + { + lua_pushcclosure (L, + &ctorPlacementProxy ::Params, T>, 0); + rawsetfield(L, -2, "__call"); + + return *this; + } + }; private: - //---------------------------------------------------------------------------- - /** - Open the global namespace for registrations. - */ - explicit Namespace (lua_State* L_) - : L (L_) - , m_stackSize (0) - { - lua_getglobal (L, "_G"); - ++m_stackSize; - } + //---------------------------------------------------------------------------- + /** + Open the global namespace for registrations. + */ + explicit Namespace (lua_State* L_) + : L (L_) + , m_stackSize (0) + { + lua_getglobal (L, "_G"); + ++m_stackSize; + } - //---------------------------------------------------------------------------- - /** - Open a namespace for registrations. + //---------------------------------------------------------------------------- + /** + Open a namespace for registrations. - The namespace is created if it doesn't already exist. - The parent namespace is at the top of the Lua stack. - */ - Namespace (char const* name, Namespace const* parent) - : L (parent->L) - , m_stackSize (0) - { - m_stackSize = parent->m_stackSize + 1; - parent->m_stackSize = 0; + The namespace is created if it doesn't already exist. + The parent namespace is at the top of the Lua stack. + */ + Namespace (char const* name, Namespace const* parent) + : L (parent->L) + , m_stackSize (0) + { + m_stackSize = parent->m_stackSize + 1; + parent->m_stackSize = 0; - assert (lua_istable (L, -1)); - rawgetfield (L, -1, name); - if (lua_isnil (L, -1)) - { - lua_pop (L, 1); + assert (lua_istable (L, -1)); + rawgetfield (L, -1, name); + if (lua_isnil (L, -1)) + { + lua_pop (L, 1); - lua_newtable (L); - lua_pushvalue (L, -1); - lua_setmetatable (L, -2); - lua_pushcfunction (L, &CFunc::indexMetaMethod); - rawsetfield (L, -2, "__index"); - lua_pushcfunction (L, &CFunc::newindexMetaMethod); - rawsetfield (L, -2, "__newindex"); - lua_newtable (L); - rawsetfield (L, -2, "__propget"); - lua_newtable (L); - rawsetfield (L, -2, "__propset"); - lua_pushvalue (L, -1); - rawsetfield (L, -3, name); + lua_newtable (L); + lua_pushvalue (L, -1); + lua_setmetatable (L, -2); + lua_pushcfunction (L, &CFunc::indexMetaMethod); + rawsetfield (L, -2, "__index"); + lua_pushcfunction (L, &CFunc::newindexMetaMethod); + rawsetfield (L, -2, "__newindex"); + lua_newtable (L); + rawsetfield (L, -2, "__propget"); + lua_newtable (L); + rawsetfield (L, -2, "__propset"); + lua_pushvalue (L, -1); + rawsetfield (L, -3, name); #if 0 - lua_pushcfunction (L, &tostringMetaMethod); - rawsetfield (L, -2, "__tostring"); + lua_pushcfunction (L, &tostringMetaMethod); + rawsetfield (L, -2, "__tostring"); #endif - } - } + } + } - //---------------------------------------------------------------------------- - /** - Creates a continued registration from a child namespace. - */ - explicit Namespace (Namespace const* child) - : L (child->L) - , m_stackSize (0) - { - m_stackSize = child->m_stackSize - 1; - child->m_stackSize = 1; - child->pop (1); + //---------------------------------------------------------------------------- + /** + Creates a continued registration from a child namespace. + */ + explicit Namespace (Namespace const* child) + : L (child->L) + , m_stackSize (0) + { + m_stackSize = child->m_stackSize - 1; + child->m_stackSize = 1; + child->pop (1); - // It is not necessary or valid to call - // endNamespace() for the global namespace! - // - assert (m_stackSize != 0); - } + // It is not necessary or valid to call + // endNamespace() for the global namespace! + // + assert (m_stackSize != 0); + } - //---------------------------------------------------------------------------- - /** - Creates a continued registration from a child class. - */ - explicit Namespace (ClassBase const* child) - : L (child->L) - , m_stackSize (0) - { - m_stackSize = child->m_stackSize - 3; - child->m_stackSize = 3; - child->pop (3); - } + //---------------------------------------------------------------------------- + /** + Creates a continued registration from a child class. + */ + explicit Namespace (ClassBase const* child) + : L (child->L) + , m_stackSize (0) + { + m_stackSize = child->m_stackSize - 3; + child->m_stackSize = 3; + child->pop (3); + } public: - //---------------------------------------------------------------------------- - /** - Copy Constructor. + //---------------------------------------------------------------------------- + /** + Copy Constructor. - Ownership of the stack is transferred to the new object. This happens - when the compiler emits temporaries to hold these objects while chaining - registrations across namespaces. - */ - Namespace (Namespace const& other) : L (other.L) - { - m_stackSize = other.m_stackSize; - other.m_stackSize = 0; - } + Ownership of the stack is transferred to the new object. This happens + when the compiler emits temporaries to hold these objects while chaining + registrations across namespaces. + */ + Namespace (Namespace const& other) : L (other.L) + { + m_stackSize = other.m_stackSize; + other.m_stackSize = 0; + } - //---------------------------------------------------------------------------- - /** - Closes this namespace registration. - */ - ~Namespace () - { - pop (m_stackSize); - } + //---------------------------------------------------------------------------- + /** + Closes this namespace registration. + */ + ~Namespace () + { + pop (m_stackSize); + } - //---------------------------------------------------------------------------- - /** - Open the global namespace. - */ - static Namespace getGlobalNamespace (lua_State* L) - { - return Namespace (L); - } + //---------------------------------------------------------------------------- + /** + Open the global namespace. + */ + static Namespace getGlobalNamespace (lua_State* L) + { + return Namespace (L); + } - //---------------------------------------------------------------------------- - /** - Open a new or existing namespace for registrations. - */ - Namespace beginNamespace (char const* name) - { - return Namespace (name, this); - } + //---------------------------------------------------------------------------- + /** + Open a new or existing namespace for registrations. + */ + Namespace beginNamespace (char const* name) + { + return Namespace (name, this); + } - //---------------------------------------------------------------------------- - /** - Continue namespace registration in the parent. + //---------------------------------------------------------------------------- + /** + Continue namespace registration in the parent. - Do not use this on the global namespace. - */ - Namespace endNamespace () - { - return Namespace (this); - } + Do not use this on the global namespace. + */ + Namespace endNamespace () + { + return Namespace (this); + } - //---------------------------------------------------------------------------- - /** - Add or replace a variable. - */ - template - Namespace& addVariable (char const* name, T* pt, bool isWritable = true) - { - assert (lua_istable (L, -1)); + //---------------------------------------------------------------------------- + /** + Add or replace a variable. + */ + template + Namespace& addVariable (char const* name, T* pt, bool isWritable = true) + { + assert (lua_istable (L, -1)); - rawgetfield (L, -1, "__propget"); - assert (lua_istable (L, -1)); - lua_pushlightuserdata (L, pt); - lua_pushcclosure (L, &CFunc::getVariable , 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); + rawgetfield (L, -1, "__propget"); + assert (lua_istable (L, -1)); + lua_pushlightuserdata (L, pt); + lua_pushcclosure (L, &CFunc::getVariable , 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); - rawgetfield (L, -1, "__propset"); - assert (lua_istable (L, -1)); - if (isWritable) - { - lua_pushlightuserdata (L, pt); - lua_pushcclosure (L, &CFunc::setVariable , 1); - } - else - { - lua_pushstring (L, name); - lua_pushcclosure (L, &CFunc::readOnlyError, 1); - } - rawsetfield (L, -2, name); - lua_pop (L, 1); + rawgetfield (L, -1, "__propset"); + assert (lua_istable (L, -1)); + if (isWritable) + { + lua_pushlightuserdata (L, pt); + lua_pushcclosure (L, &CFunc::setVariable , 1); + } + else + { + lua_pushstring (L, name); + lua_pushcclosure (L, &CFunc::readOnlyError, 1); + } + rawsetfield (L, -2, name); + lua_pop (L, 1); - return *this; - } - - //---------------------------------------------------------------------------- - /** - Add or replace a property. + return *this; + } - If the set function is omitted or null, the property is read-only. - */ - template - Namespace& addProperty (char const* name, TG (*get) (), void (*set)(TS) = 0) - { - assert (lua_istable (L, -1)); + //---------------------------------------------------------------------------- + /** + Add or replace a property. - rawgetfield (L, -1, "__propget"); - assert (lua_istable (L, -1)); - typedef TG (*get_t) (); - new (lua_newuserdata (L, sizeof (get_t))) get_t (get); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - rawsetfield (L, -2, name); - lua_pop (L, 1); + If the set function is omitted or null, the property is read-only. + */ + template + Namespace& addProperty (char const* name, TG (*get) (), void (*set)(TS) = 0) + { + assert (lua_istable (L, -1)); - rawgetfield (L, -1, "__propset"); - assert (lua_istable (L, -1)); - if (set != 0) - { - typedef void (*set_t) (TS); - new (lua_newuserdata (L, sizeof (set_t))) set_t (set); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - } - else - { - lua_pushstring (L, name); - lua_pushcclosure (L, &CFunc::readOnlyError, 1); - } - rawsetfield (L, -2, name); - lua_pop (L, 1); + rawgetfield (L, -1, "__propget"); + assert (lua_istable (L, -1)); + typedef TG (*get_t) (); + new (lua_newuserdata (L, sizeof (get_t))) get_t (get); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + rawsetfield (L, -2, name); + lua_pop (L, 1); - return *this; - } + rawgetfield (L, -1, "__propset"); + assert (lua_istable (L, -1)); + if (set != 0) + { + typedef void (*set_t) (TS); + new (lua_newuserdata (L, sizeof (set_t))) set_t (set); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + } + else + { + lua_pushstring (L, name); + lua_pushcclosure (L, &CFunc::readOnlyError, 1); + } + rawsetfield (L, -2, name); + lua_pop (L, 1); - //---------------------------------------------------------------------------- - /** - Add or replace a free function. - */ - template - Namespace& addFunction (char const* name, FP const fp) - { - assert (lua_istable (L, -1)); + return *this; + } - new (lua_newuserdata (L, sizeof (fp))) FP (fp); - lua_pushcclosure (L, &CFunc::Call ::f, 1); - rawsetfield (L, -2, name); + //---------------------------------------------------------------------------- + /** + Add or replace a free function. + */ + template + Namespace& addFunction (char const* name, FP const fp) + { + assert (lua_istable (L, -1)); - return *this; - } + new (lua_newuserdata (L, sizeof (fp))) FP (fp); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + rawsetfield (L, -2, name); - //---------------------------------------------------------------------------- - /** - Add or replace a lua_CFunction. - */ - Namespace& addCFunction (char const* name, int (*const fp)(lua_State*)) - { - lua_pushcfunction (L, fp); - rawsetfield (L, -2, name); + return *this; + } - return *this; - } + //---------------------------------------------------------------------------- + /** + Add or replace a lua_CFunction. + */ + Namespace& addCFunction (char const* name, int (*const fp)(lua_State*)) + { + lua_pushcfunction (L, fp); + rawsetfield (L, -2, name); - //---------------------------------------------------------------------------- - /** - Open a new or existing class for registrations. - */ - template - Class beginClass (char const* name) - { - return Class (name, this); - } + return *this; + } - //---------------------------------------------------------------------------- - /** - Derive a new class for registrations. + //---------------------------------------------------------------------------- + /** + Open a new or existing class for registrations. + */ + template + Class beginClass (char const* name) + { + return Class (name, this); + } - To continue registrations for the class later, use beginClass(). - Do not call deriveClass() again. - */ - template - Class deriveClass (char const* name) - { - return Class (name, this, ClassInfo ::getStaticKey ()); - } + //---------------------------------------------------------------------------- + /** + Derive a new class for registrations. + + To continue registrations for the class later, use beginClass(). + Do not call deriveClass() again. + */ + template + Class deriveClass (char const* name) + { + return Class (name, this, ClassInfo ::getStaticKey ()); + } }; //------------------------------------------------------------------------------ @@ -1132,5 +1132,5 @@ public: */ inline Namespace getGlobalNamespace (lua_State* L) { - return Namespace::getGlobalNamespace (L); + return Namespace::getGlobalNamespace (L); } diff --git a/src/lib/lua/bridge/detail/Stack.h b/src/lib/lua/bridge/detail/Stack.h index 1a0aae7c29b..0774e328eca 100644 --- a/src/lib/lua/bridge/detail/Stack.h +++ b/src/lib/lua/bridge/detail/Stack.h @@ -34,10 +34,10 @@ template <> struct Stack { - static lua_State* get (lua_State* L, int) - { - return L; - } + static lua_State* get (lua_State* L, int) + { + return L; + } }; //------------------------------------------------------------------------------ @@ -47,15 +47,15 @@ struct Stack template <> struct Stack { - static void push (lua_State* L, lua_CFunction f) - { - lua_pushcfunction (L, f); - } + static void push (lua_State* L, lua_CFunction f) + { + lua_pushcfunction (L, f); + } - static lua_CFunction get (lua_State* L, int index) - { - return lua_tocfunction (L, index); - } + static lua_CFunction get (lua_State* L, int index) + { + return lua_tocfunction (L, index); + } }; //------------------------------------------------------------------------------ @@ -65,29 +65,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, int value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline int get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, int value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline int get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, int value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline int get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, int value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline int get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ /** @@ -96,29 +96,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, unsigned int value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline unsigned int get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, unsigned int value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline unsigned int get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, unsigned int value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline unsigned int get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, unsigned int value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline unsigned int get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -128,29 +128,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, unsigned char value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline unsigned char get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, unsigned char value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline unsigned char get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, unsigned char value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline unsigned char get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, unsigned char value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline unsigned char get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -160,29 +160,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, short value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline short get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, short value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline short get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, short value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline short get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, short value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline short get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -192,29 +192,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, unsigned short value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline unsigned short get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, unsigned short value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline unsigned short get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, unsigned short value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline unsigned short get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, unsigned short value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline unsigned short get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -224,29 +224,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, long value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline long get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, long value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline long get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, long value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline long get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, long value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline long get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -256,29 +256,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, unsigned long value) - { - lua_pushinteger (L, static_cast (value)); - } - - static inline unsigned long get (lua_State* L, int index) - { - return static_cast (luaL_checkinteger (L, index)); - } + static inline void push (lua_State* L, unsigned long value) + { + lua_pushinteger (L, static_cast (value)); + } + + static inline unsigned long get (lua_State* L, int index) + { + return static_cast (luaL_checkinteger (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, unsigned long value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline unsigned long get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, unsigned long value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline unsigned long get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -288,29 +288,29 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, float value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline float get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, float value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline float get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, float value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline float get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, float value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline float get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -319,28 +319,28 @@ struct Stack */ template <> struct Stack { - static inline void push (lua_State* L, double value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline double get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, double value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline double get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; template <> struct Stack { - static inline void push (lua_State* L, double value) - { - lua_pushnumber (L, static_cast (value)); - } - - static inline double get (lua_State* L, int index) - { - return static_cast (luaL_checknumber (L, index)); - } + static inline void push (lua_State* L, double value) + { + lua_pushnumber (L, static_cast (value)); + } + + static inline double get (lua_State* L, int index) + { + return static_cast (luaL_checknumber (L, index)); + } }; //------------------------------------------------------------------------------ @@ -349,28 +349,28 @@ template <> struct Stack */ template <> struct Stack { - static inline void push (lua_State* L, bool value) - { - lua_pushboolean (L, value ? 1 : 0); - } - - static inline bool get (lua_State* L, int index) - { - return lua_toboolean (L, index) ? true : false; - } + static inline void push (lua_State* L, bool value) + { + lua_pushboolean (L, value ? 1 : 0); + } + + static inline bool get (lua_State* L, int index) + { + return lua_toboolean (L, index) ? true : false; + } }; template <> struct Stack { - static inline void push (lua_State* L, bool value) - { - lua_pushboolean (L, value ? 1 : 0); - } - - static inline bool get (lua_State* L, int index) - { - return lua_toboolean (L, index) ? true : false; - } + static inline void push (lua_State* L, bool value) + { + lua_pushboolean (L, value ? 1 : 0); + } + + static inline bool get (lua_State* L, int index) + { + return lua_toboolean (L, index) ? true : false; + } }; //------------------------------------------------------------------------------ @@ -380,31 +380,31 @@ struct Stack { template <> struct Stack { - static inline void push (lua_State* L, char value) - { - char str [2] = { value, 0 }; - lua_pushstring (L, str); - } - - static inline char get (lua_State* L, int index) - { - return luaL_checkstring (L, index) [0]; - } + static inline void push (lua_State* L, char value) + { + char str [2] = { value, 0 }; + lua_pushstring (L, str); + } + + static inline char get (lua_State* L, int index) + { + return luaL_checkstring (L, index) [0]; + } }; template <> struct Stack { - static inline void push (lua_State* L, char value) - { - char str [2] = { value, 0 }; - lua_pushstring (L, str); - } - - static inline char get (lua_State* L, int index) - { - return luaL_checkstring (L, index) [0]; - } + static inline void push (lua_State* L, char value) + { + char str [2] = { value, 0 }; + lua_pushstring (L, str); + } + + static inline char get (lua_State* L, int index) + { + return luaL_checkstring (L, index) [0]; + } }; //------------------------------------------------------------------------------ @@ -414,18 +414,18 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, char const* str) - { - if (str != 0) - lua_pushstring (L, str); - else - lua_pushnil (L); - } + static inline void push (lua_State* L, char const* str) + { + if (str != 0) + lua_pushstring (L, str); + else + lua_pushnil (L); + } - static inline char const* get (lua_State* L, int index) - { - return lua_isnil (L, index) ? 0 : luaL_checkstring (L, index); - } + static inline char const* get (lua_State* L, int index) + { + return lua_isnil (L, index) ? 0 : luaL_checkstring (L, index); + } }; //------------------------------------------------------------------------------ @@ -435,17 +435,17 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, std::string const& str) - { - lua_pushlstring (L, str.c_str (), str.size()); - } + static inline void push (lua_State* L, std::string const& str) + { + lua_pushlstring (L, str.c_str (), str.size()); + } - static inline std::string get (lua_State* L, int index) - { - size_t len; - const char *str = luaL_checklstring(L, index, &len); - return std::string (str, len); - } + static inline std::string get (lua_State* L, int index) + { + size_t len; + const char *str = luaL_checklstring(L, index, &len); + return std::string (str, len); + } }; //------------------------------------------------------------------------------ @@ -455,15 +455,15 @@ struct Stack template <> struct Stack { - static inline void push (lua_State* L, std::string const& str) - { - lua_pushstring (L, str.c_str()); - } + static inline void push (lua_State* L, std::string const& str) + { + lua_pushstring (L, str.c_str()); + } - static inline std::string get (lua_State* L, int index) - { - size_t len; - const char *str = luaL_checklstring(L, index, &len); - return std::string (str, len); - } + static inline std::string get (lua_State* L, int index) + { + size_t len; + const char *str = luaL_checklstring(L, index, &len); + return std::string (str, len); + } }; diff --git a/src/lib/lua/bridge/detail/TypeList.h b/src/lib/lua/bridge/detail/TypeList.h index 21f850e89df..8e4572eed19 100644 --- a/src/lib/lua/bridge/detail/TypeList.h +++ b/src/lib/lua/bridge/detail/TypeList.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco Copyright 2007, Nathan Reed @@ -26,19 +26,19 @@ SOFTWARE. This file incorporates work covered by the following copyright and - permission notice: + permission notice: The Loki Library Copyright (c) 2001 by Andrei Alexandrescu This code accompanies the book: - Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design + Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design Patterns Applied". Copyright (c) 2001. Addison-Wesley. - Permission to use, copy, modify, distribute and sell this software for any - purpose is hereby granted without fee, provided that the above copyright - notice appear in all copies and that both that copyright notice and this + Permission to use, copy, modify, distribute and sell this software for any + purpose is hereby granted without fee, provided that the above copyright + notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. - The author or Addison-Welsey Longman make no representations about the - suitability of this software for any purpose. It is provided "as is" + The author or Addison-Welsey Longman make no representations about the + suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ //============================================================================== @@ -59,10 +59,10 @@ struct TypeList template struct TypeListValues { - static std::string const tostring (bool) - { - return ""; - } + static std::string const tostring (bool) + { + return ""; + } }; /** @@ -71,25 +71,25 @@ struct TypeListValues template struct TypeListValues > { - Head hd; - TypeListValues tl; + Head hd; + TypeListValues tl; - TypeListValues (Head hd_, TypeListValues const& tl_) - : hd (hd_), tl (tl_) - { - } + TypeListValues (Head hd_, TypeListValues const& tl_) + : hd (hd_), tl (tl_) + { + } - static std::string const tostring (bool comma = false) - { - std::string s; + static std::string const tostring (bool comma = false) + { + std::string s; - if (comma) - s = ", "; + if (comma) + s = ", "; - s = s + typeid (Head).name (); + s = s + typeid (Head).name (); - return s + TypeListValues ::tostring (true); - } + return s + TypeListValues ::tostring (true); + } }; // Specializations of type/value list for head types that are references and @@ -99,49 +99,49 @@ struct TypeListValues > template struct TypeListValues > { - Head hd; - TypeListValues tl; + Head hd; + TypeListValues tl; - TypeListValues (Head& hd_, TypeListValues const& tl_) - : hd (hd_), tl (tl_) - { - } + TypeListValues (Head& hd_, TypeListValues const& tl_) + : hd (hd_), tl (tl_) + { + } - static std::string const tostring (bool comma = false) - { - std::string s; + static std::string const tostring (bool comma = false) + { + std::string s; - if (comma) - s = ", "; + if (comma) + s = ", "; - s = s + typeid (Head).name () + "&"; + s = s + typeid (Head).name () + "&"; - return s + TypeListValues ::tostring (true); - } + return s + TypeListValues ::tostring (true); + } }; template struct TypeListValues > { - Head hd; - TypeListValues tl; + Head hd; + TypeListValues tl; - TypeListValues (Head const& hd_, const TypeListValues & tl_) - : hd (hd_), tl (tl_) - { - } + TypeListValues (Head const& hd_, const TypeListValues & tl_) + : hd (hd_), tl (tl_) + { + } - static std::string const tostring (bool comma = false) - { - std::string s; + static std::string const tostring (bool comma = false) + { + std::string s; - if (comma) - s = ", "; + if (comma) + s = ", "; - s = s + typeid (Head).name () + " const&"; + s = s + typeid (Head).name () + " const&"; - return s + TypeListValues ::tostring (true); - } + return s + TypeListValues ::tostring (true); + } }; //============================================================================== @@ -157,18 +157,18 @@ struct ArgList template struct ArgList : public TypeListValues { - ArgList (lua_State*) - { - } + ArgList (lua_State*) + { + } }; template struct ArgList , Start> - : public TypeListValues > + : public TypeListValues > { - ArgList (lua_State* L) - : TypeListValues > (Stack ::get (L, Start), - ArgList (L)) - { - } + ArgList (lua_State* L) + : TypeListValues > (Stack ::get (L, Start), + ArgList (L)) + { + } }; diff --git a/src/lib/lua/bridge/detail/TypeTraits.h b/src/lib/lua/bridge/detail/TypeTraits.h index 5dd077194f1..fedb9ff48ca 100644 --- a/src/lib/lua/bridge/detail/TypeTraits.h +++ b/src/lib/lua/bridge/detail/TypeTraits.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco License: The MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -56,7 +56,7 @@ template struct ContainerTraits { - typedef bool isNotContainer; + typedef bool isNotContainer; }; //------------------------------------------------------------------------------ @@ -67,59 +67,59 @@ struct ContainerTraits */ struct TypeTraits { - /** Determine if type T is a container. + /** Determine if type T is a container. - To be considered a container, there must be a specialization of - ContainerTraits with the required fields. - */ - template - class isContainer - { - private: - typedef char yes[1]; // sizeof (yes) == 1 - typedef char no [2]; // sizeof (no) == 2 + To be considered a container, there must be a specialization of + ContainerTraits with the required fields. + */ + template + class isContainer + { + private: + typedef char yes[1]; // sizeof (yes) == 1 + typedef char no [2]; // sizeof (no) == 2 - template - static no& test (typename C::isNotContainer*); - - template - static yes& test (...); - - public: - static const bool value = sizeof (test >(0)) == sizeof (yes); - }; + template + static no& test (typename C::isNotContainer*); - /** Determine if T is const qualified. - */ - /** @{ */ - template - struct isConst - { - static bool const value = false; - }; + template + static yes& test (...); - template - struct isConst - { - static bool const value = true; - }; - /** @} */ + public: + static const bool value = sizeof (test >(0)) == sizeof (yes); + }; - /** Remove the const qualifier from T. - */ - /** @{ */ - template - struct removeConst - { - typedef T Type; - }; + /** Determine if T is const qualified. + */ + /** @{ */ + template + struct isConst + { + static bool const value = false; + }; - template - struct removeConst - { - typedef T Type; - }; - /**@}*/ + template + struct isConst + { + static bool const value = true; + }; + /** @} */ + + /** Remove the const qualifier from T. + */ + /** @{ */ + template + struct removeConst + { + typedef T Type; + }; + + template + struct removeConst + { + typedef T Type; + }; + /**@}*/ }; #endif diff --git a/src/lib/lua/bridge/detail/Userdata.h b/src/lib/lua/bridge/detail/Userdata.h index 19451bd7d3e..8954b0bf2b1 100644 --- a/src/lib/lua/bridge/detail/Userdata.h +++ b/src/lib/lua/bridge/detail/Userdata.h @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ /* https://github.com/vinniefalco/LuaBridge - + Copyright 2012, Vinnie Falco License: The MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -52,8 +52,8 @@ */ inline void* getIdentityKey () { - static char value; - return &value; + static char value; + return &value; } /** @@ -62,177 +62,177 @@ inline void* getIdentityKey () class Userdata { protected: - void* m_p; // subclasses must set this + void* m_p; // subclasses must set this - //-------------------------------------------------------------------------- - /** - Get an untyped pointer to the contained class. - */ - inline void* const getPointer () - { - return m_p; - } + //-------------------------------------------------------------------------- + /** + Get an untyped pointer to the contained class. + */ + inline void* const getPointer () + { + return m_p; + } private: - //-------------------------------------------------------------------------- - /** - Validate and retrieve a Userdata on the stack. + //-------------------------------------------------------------------------- + /** + Validate and retrieve a Userdata on the stack. - The Userdata must exactly match the corresponding class table or - const table, or else a Lua error is raised. This is used for the - __gc metamethod. - */ - static Userdata* getExactClass (lua_State* L, - int narg, - void const* classKey) - { - Userdata* ud = 0; - int const index = lua_absindex (L, narg); + The Userdata must exactly match the corresponding class table or + const table, or else a Lua error is raised. This is used for the + __gc metamethod. + */ + static Userdata* getExactClass (lua_State* L, + int narg, + void const* classKey) + { + Userdata* ud = 0; + int const index = lua_absindex (L, narg); - bool mismatch = false; - char const* got = 0; + bool mismatch = false; + char const* got = 0; - lua_rawgetp (L, LUA_REGISTRYINDEX, classKey); - assert (lua_istable (L, -1)); + lua_rawgetp (L, LUA_REGISTRYINDEX, classKey); + assert (lua_istable (L, -1)); - // Make sure we have a userdata. - if (!lua_isuserdata (L, index)) - mismatch = true; + // Make sure we have a userdata. + if (!lua_isuserdata (L, index)) + mismatch = true; - // Make sure it's metatable is ours. - if (!mismatch) - { - lua_getmetatable (L, index); - lua_rawgetp (L, -1, getIdentityKey ()); - if (lua_isboolean (L, -1)) - { - lua_pop (L, 1); - } - else - { - lua_pop (L, 2); - mismatch = true; - } - } + // Make sure it's metatable is ours. + if (!mismatch) + { + lua_getmetatable (L, index); + lua_rawgetp (L, -1, getIdentityKey ()); + if (lua_isboolean (L, -1)) + { + lua_pop (L, 1); + } + else + { + lua_pop (L, 2); + mismatch = true; + } + } - if (!mismatch) - { - if (lua_rawequal (L, -1, -2)) - { - // Matches class table. - lua_pop (L, 2); - ud = static_cast (lua_touserdata (L, index)); - } - else - { - rawgetfield (L, -2, "__const"); - if (lua_rawequal (L, -1, -2)) - { - // Matches const table - lua_pop (L, 3); - ud = static_cast (lua_touserdata (L, index)); - } - else - { - // Mismatch, but its one of ours so get a type name. - rawgetfield (L, -2, "__type"); - lua_insert (L, -4); - lua_pop (L, 2); - got = lua_tostring (L, -2); - mismatch = true; - } - } - } + if (!mismatch) + { + if (lua_rawequal (L, -1, -2)) + { + // Matches class table. + lua_pop (L, 2); + ud = static_cast (lua_touserdata (L, index)); + } + else + { + rawgetfield (L, -2, "__const"); + if (lua_rawequal (L, -1, -2)) + { + // Matches const table + lua_pop (L, 3); + ud = static_cast (lua_touserdata (L, index)); + } + else + { + // Mismatch, but its one of ours so get a type name. + rawgetfield (L, -2, "__type"); + lua_insert (L, -4); + lua_pop (L, 2); + got = lua_tostring (L, -2); + mismatch = true; + } + } + } - if (mismatch) - { - rawgetfield (L, -1, "__type"); - assert (lua_type (L, -1) == LUA_TSTRING); - char const* const expected = lua_tostring (L, -1); + if (mismatch) + { + rawgetfield (L, -1, "__type"); + assert (lua_type (L, -1) == LUA_TSTRING); + char const* const expected = lua_tostring (L, -1); - if (got == 0) - got = lua_typename (L, lua_type (L, index)); + if (got == 0) + got = lua_typename (L, lua_type (L, index)); - char const* const msg = lua_pushfstring ( - L, "%s expected, got %s", expected, got); + char const* const msg = lua_pushfstring ( + L, "%s expected, got %s", expected, got); - if (narg > 0) - luaL_argerror (L, narg, msg); - else - lua_error (L); - } + if (narg > 0) + luaL_argerror (L, narg, msg); + else + lua_error (L); + } - return ud; - } + return ud; + } - //-------------------------------------------------------------------------- - /** - Validate and retrieve a Userdata on the stack. + //-------------------------------------------------------------------------- + /** + Validate and retrieve a Userdata on the stack. - The Userdata must be derived from or the same as the given base class, - identified by the key. If canBeConst is false, generates an error if - the resulting Userdata represents to a const object. We do the type check - first so that the error message is informative. - */ - static Userdata* getClass (lua_State* L, - int index, - void const* baseClassKey, - bool canBeConst) - { - assert (index > 0); - Userdata* ud = 0; + The Userdata must be derived from or the same as the given base class, + identified by the key. If canBeConst is false, generates an error if + the resulting Userdata represents to a const object. We do the type check + first so that the error message is informative. + */ + static Userdata* getClass (lua_State* L, + int index, + void const* baseClassKey, + bool canBeConst) + { + assert (index > 0); + Userdata* ud = 0; - bool mismatch = false; - char const* got = 0; + bool mismatch = false; + char const* got = 0; - lua_rawgetp (L, LUA_REGISTRYINDEX, baseClassKey); - assert (lua_istable (L, -1)); + lua_rawgetp (L, LUA_REGISTRYINDEX, baseClassKey); + assert (lua_istable (L, -1)); - // Make sure we have a userdata. - if (lua_isuserdata (L, index)) - { - // Make sure it's metatable is ours. - lua_getmetatable (L, index); - lua_rawgetp (L, -1, getIdentityKey ()); - if (lua_isboolean (L, -1)) - { - lua_pop (L, 1); + // Make sure we have a userdata. + if (lua_isuserdata (L, index)) + { + // Make sure it's metatable is ours. + lua_getmetatable (L, index); + lua_rawgetp (L, -1, getIdentityKey ()); + if (lua_isboolean (L, -1)) + { + lua_pop (L, 1); - // If __const is present, object is NOT const. - rawgetfield (L, -1, "__const"); - assert (lua_istable (L, -1) || lua_isnil (L, -1)); - bool const isConst = lua_isnil (L, -1); - lua_pop (L, 1); + // If __const is present, object is NOT const. + rawgetfield (L, -1, "__const"); + assert (lua_istable (L, -1) || lua_isnil (L, -1)); + bool const isConst = lua_isnil (L, -1); + lua_pop (L, 1); - // Replace the class table with the const table if needed. - if (isConst) - { - rawgetfield (L, -2, "__const"); - assert (lua_istable (L, -1)); - lua_replace (L, -3); - } + // Replace the class table with the const table if needed. + if (isConst) + { + rawgetfield (L, -2, "__const"); + assert (lua_istable (L, -1)); + lua_replace (L, -3); + } - for (;;) - { - if (lua_rawequal (L, -1, -2)) - { - lua_pop (L, 2); + for (;;) + { + if (lua_rawequal (L, -1, -2)) + { + lua_pop (L, 2); - // Match, now check const-ness. - if (isConst && !canBeConst) - { - luaL_argerror (L, index, "cannot be const"); - } - else - { - ud = static_cast (lua_touserdata (L, index)); - break; - } - } - else - { - // Replace current metatable with it's base class. - rawgetfield (L, -1, "__parent"); + // Match, now check const-ness. + if (isConst && !canBeConst) + { + luaL_argerror (L, index, "cannot be const"); + } + else + { + ud = static_cast (lua_touserdata (L, index)); + break; + } + } + else + { + // Replace current metatable with it's base class. + rawgetfield (L, -1, "__parent"); /* ud class metatable @@ -240,85 +240,85 @@ ud metatable ud __parent (nil) */ - if (lua_isnil (L, -1)) - { - lua_remove (L, -1); - // Mismatch, but its one of ours so get a type name. - rawgetfield (L, -1, "__type"); - lua_insert (L, -3); - lua_pop (L, 1); - got = lua_tostring (L, -2); - mismatch = true; - break; - } - else - { - lua_remove (L, -2); - } - } - } - } - else - { - lua_pop (L, 2); - mismatch = true; - } - } - else - { - mismatch = true; - } + if (lua_isnil (L, -1)) + { + lua_remove (L, -1); + // Mismatch, but its one of ours so get a type name. + rawgetfield (L, -1, "__type"); + lua_insert (L, -3); + lua_pop (L, 1); + got = lua_tostring (L, -2); + mismatch = true; + break; + } + else + { + lua_remove (L, -2); + } + } + } + } + else + { + lua_pop (L, 2); + mismatch = true; + } + } + else + { + mismatch = true; + } - if (mismatch) - { - assert (lua_type (L, -1) == LUA_TTABLE); - rawgetfield (L, -1, "__type"); - assert (lua_type (L, -1) == LUA_TSTRING); - char const* const expected = lua_tostring (L, -1); + if (mismatch) + { + assert (lua_type (L, -1) == LUA_TTABLE); + rawgetfield (L, -1, "__type"); + assert (lua_type (L, -1) == LUA_TSTRING); + char const* const expected = lua_tostring (L, -1); - if (got == 0) - got = lua_typename (L, lua_type (L, index)); + if (got == 0) + got = lua_typename (L, lua_type (L, index)); - char const* const msg = lua_pushfstring ( - L, "%s expected, got %s", expected, got); + char const* const msg = lua_pushfstring ( + L, "%s expected, got %s", expected, got); - luaL_argerror (L, index, msg); - } + luaL_argerror (L, index, msg); + } - return ud; - } + return ud; + } public: - virtual ~Userdata () { } + virtual ~Userdata () { } - //-------------------------------------------------------------------------- - /** - Returns the Userdata* if the class on the Lua stack matches. + //-------------------------------------------------------------------------- + /** + Returns the Userdata* if the class on the Lua stack matches. - If the class does not match, a Lua error is raised. - */ - template - static inline Userdata* getExact (lua_State* L, int index) - { - return getExactClass (L, index, ClassInfo ::getClassKey ()); - } + If the class does not match, a Lua error is raised. + */ + template + static inline Userdata* getExact (lua_State* L, int index) + { + return getExactClass (L, index, ClassInfo ::getClassKey ()); + } - //-------------------------------------------------------------------------- - /** - Get a pointer to the class from the Lua stack. + //-------------------------------------------------------------------------- + /** + Get a pointer to the class from the Lua stack. - If the object is not the class or a subclass, or it violates the - const-ness, a Lua error is raised. - */ - template - static inline T* get (lua_State* L, int index, bool canBeConst) - { - if (lua_isnil (L, index)) - return 0; - else - return static_cast (getClass (L, index, - ClassInfo ::getClassKey (), canBeConst)->getPointer ()); - } + If the object is not the class or a subclass, or it violates the + const-ness, a Lua error is raised. + */ + template + static inline T* get (lua_State* L, int index, bool canBeConst) + { + if (lua_isnil (L, index)) + return 0; + else + return static_cast (getClass (L, index, + ClassInfo ::getClassKey (), canBeConst)->getPointer ()); + } }; //---------------------------------------------------------------------------- @@ -332,59 +332,59 @@ template class UserdataValue : public Userdata { private: - UserdataValue (UserdataValue const&); - UserdataValue operator= (UserdataValue const&); + UserdataValue (UserdataValue const&); + UserdataValue operator= (UserdataValue const&); - char m_storage [sizeof (T)]; + char m_storage [sizeof (T)]; - inline T* getObject () - { - // If this fails to compile it means you forgot to provide - // a Container specialization for your container! - // - return reinterpret_cast (&m_storage [0]); - } + inline T* getObject () + { + // If this fails to compile it means you forgot to provide + // a Container specialization for your container! + // + return reinterpret_cast (&m_storage [0]); + } private: - /** - Used for placement construction. - */ - UserdataValue () - { - m_p = getObject (); - } + /** + Used for placement construction. + */ + UserdataValue () + { + m_p = getObject (); + } - ~UserdataValue () - { - getObject ()->~T (); - } + ~UserdataValue () + { + getObject ()->~T (); + } public: - /** - Push a T via placement new. + /** + Push a T via placement new. - The caller is responsible for calling placement new using the - returned uninitialized storage. - */ - static void* place (lua_State* const L) - { - UserdataValue * const ud = new ( - lua_newuserdata (L, sizeof (UserdataValue ))) UserdataValue (); - lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); - // If this goes off it means you forgot to register the class! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - return ud->getPointer (); - } + The caller is responsible for calling placement new using the + returned uninitialized storage. + */ + static void* place (lua_State* const L) + { + UserdataValue * const ud = new ( + lua_newuserdata (L, sizeof (UserdataValue ))) UserdataValue (); + lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); + // If this goes off it means you forgot to register the class! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + return ud->getPointer (); + } - /** - Push T via copy construction from U. - */ - template - static inline void push (lua_State* const L, U const& u) - { - new (place (L)) U (u); - } + /** + Push T via copy construction from U. + */ + template + static inline void push (lua_State* const L, U const& u) + { + new (place (L)) U (u); + } }; //---------------------------------------------------------------------------- @@ -396,78 +396,78 @@ public: class UserdataPtr : public Userdata { private: - UserdataPtr (UserdataPtr const&); - UserdataPtr operator= (UserdataPtr const&); + UserdataPtr (UserdataPtr const&); + UserdataPtr operator= (UserdataPtr const&); private: - /** Push non-const pointer to object using metatable key. - */ - static void push (lua_State* L, void* const p, void const* const key) - { - if (p) - { - new (lua_newuserdata (L, sizeof (UserdataPtr))) UserdataPtr (p); - lua_rawgetp (L, LUA_REGISTRYINDEX, key); - // If this goes off it means you forgot to register the class! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - } - else - { - lua_pushnil (L); - } - } + /** Push non-const pointer to object using metatable key. + */ + static void push (lua_State* L, void* const p, void const* const key) + { + if (p) + { + new (lua_newuserdata (L, sizeof (UserdataPtr))) UserdataPtr (p); + lua_rawgetp (L, LUA_REGISTRYINDEX, key); + // If this goes off it means you forgot to register the class! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + } + else + { + lua_pushnil (L); + } + } - /** Push const pointer to object using metatable key. - */ - static void push (lua_State* L, void const* const p, void const* const key) - { - if (p) - { - new (lua_newuserdata (L, sizeof (UserdataPtr))) - UserdataPtr (const_cast (p)); - lua_rawgetp (L, LUA_REGISTRYINDEX, key); - // If this goes off it means you forgot to register the class! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - } - else - { - lua_pushnil (L); - } - } + /** Push const pointer to object using metatable key. + */ + static void push (lua_State* L, void const* const p, void const* const key) + { + if (p) + { + new (lua_newuserdata (L, sizeof (UserdataPtr))) + UserdataPtr (const_cast (p)); + lua_rawgetp (L, LUA_REGISTRYINDEX, key); + // If this goes off it means you forgot to register the class! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + } + else + { + lua_pushnil (L); + } + } - explicit UserdataPtr (void* const p) - { - m_p = p; + explicit UserdataPtr (void* const p) + { + m_p = p; - // Can't construct with a null pointer! - // - assert (m_p != 0); - } + // Can't construct with a null pointer! + // + assert (m_p != 0); + } public: - /** Push non-const pointer to object. - */ - template - static inline void push (lua_State* const L, T* const p) - { - if (p) - push (L, p, ClassInfo ::getClassKey ()); - else - lua_pushnil (L); - } + /** Push non-const pointer to object. + */ + template + static inline void push (lua_State* const L, T* const p) + { + if (p) + push (L, p, ClassInfo ::getClassKey ()); + else + lua_pushnil (L); + } - /** Push const pointer to object. - */ - template - static inline void push (lua_State* const L, T const* const p) - { - if (p) - push (L, p, ClassInfo ::getConstKey ()); - else - lua_pushnil (L); - } + /** Push const pointer to object. + */ + template + static inline void push (lua_State* const L, T const* const p) + { + if (p) + push (L, p, ClassInfo ::getConstKey ()); + else + lua_pushnil (L); + } }; //============================================================================ @@ -481,39 +481,39 @@ template class UserdataShared : public Userdata { private: - UserdataShared (UserdataShared const&); - UserdataShared & operator= (UserdataShared const&); + UserdataShared (UserdataShared const&); + UserdataShared & operator= (UserdataShared const&); - typedef typename TypeTraits::removeConst < - typename ContainerTraits ::Type>::Type T; + typedef typename TypeTraits::removeConst < + typename ContainerTraits ::Type>::Type T; - C m_c; + C m_c; private: - ~UserdataShared () - { - } + ~UserdataShared () + { + } public: - /** - Construct from a container to the class or a derived class. - */ - template - explicit UserdataShared (U const& u) : m_c (u) - { - m_p = const_cast (reinterpret_cast ( - (ContainerTraits ::get (m_c)))); - } + /** + Construct from a container to the class or a derived class. + */ + template + explicit UserdataShared (U const& u) : m_c (u) + { + m_p = const_cast (reinterpret_cast ( + (ContainerTraits ::get (m_c)))); + } - /** - Construct from a pointer to the class or a derived class. - */ - template - explicit UserdataShared (U* u) : m_c (u) - { - m_p = const_cast (reinterpret_cast ( - (ContainerTraits ::get (m_c)))); - } + /** + Construct from a pointer to the class or a derived class. + */ + template + explicit UserdataShared (U* u) : m_c (u) + { + m_p = const_cast (reinterpret_cast ( + (ContainerTraits ::get (m_c)))); + } }; //---------------------------------------------------------------------------- @@ -525,80 +525,80 @@ public: template struct UserdataSharedHelper { - typedef typename TypeTraits::removeConst < - typename ContainerTraits ::Type>::Type T; + typedef typename TypeTraits::removeConst < + typename ContainerTraits ::Type>::Type T; - static void push (lua_State* L, C const& c) - { - if (ContainerTraits ::get (c) != 0) - { - new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (c); - lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); - // If this goes off it means the class T is unregistered! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - } - else - { - lua_pushnil (L); - } - } + static void push (lua_State* L, C const& c) + { + if (ContainerTraits ::get (c) != 0) + { + new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (c); + lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); + // If this goes off it means the class T is unregistered! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + } + else + { + lua_pushnil (L); + } + } - static void push (lua_State* L, T* const t) - { - if (t) - { - new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (t); - lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); - // If this goes off it means the class T is unregistered! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - } - else - { - lua_pushnil (L); - } - } + static void push (lua_State* L, T* const t) + { + if (t) + { + new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (t); + lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); + // If this goes off it means the class T is unregistered! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + } + else + { + lua_pushnil (L); + } + } }; // const objects template struct UserdataSharedHelper { - typedef typename TypeTraits::removeConst < - typename ContainerTraits ::Type>::Type T; + typedef typename TypeTraits::removeConst < + typename ContainerTraits ::Type>::Type T; - static void push (lua_State* L, C const& c) - { - if (ContainerTraits ::get (c) != 0) - { - new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (c); - lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); - // If this goes off it means the class T is unregistered! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - } - else - { - lua_pushnil (L); - } - } + static void push (lua_State* L, C const& c) + { + if (ContainerTraits ::get (c) != 0) + { + new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (c); + lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); + // If this goes off it means the class T is unregistered! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + } + else + { + lua_pushnil (L); + } + } - static void push (lua_State* L, T* const t) - { - if (t) - { - new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (t); - lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); - // If this goes off it means the class T is unregistered! - assert (lua_istable (L, -1)); - lua_setmetatable (L, -2); - } - else - { - lua_pushnil (L); - } - } + static void push (lua_State* L, T* const t) + { + if (t) + { + new (lua_newuserdata (L, sizeof (UserdataShared ))) UserdataShared (t); + lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getConstKey ()); + // If this goes off it means the class T is unregistered! + assert (lua_istable (L, -1)); + lua_setmetatable (L, -2); + } + else + { + lua_pushnil (L); + } + } }; /** @@ -613,19 +613,19 @@ struct UserdataSharedHelper template struct StackHelper { - static inline void push (lua_State* L, C const& c) - { - UserdataSharedHelper ::Type>::value>::push (L, c); - } + static inline void push (lua_State* L, C const& c) + { + UserdataSharedHelper ::Type>::value>::push (L, c); + } - typedef typename TypeTraits::removeConst < - typename ContainerTraits ::Type>::Type T; + typedef typename TypeTraits::removeConst < + typename ContainerTraits ::Type>::Type T; - static inline C get (lua_State* L, int index) - { - return Userdata::get (L, index, true); - } + static inline C get (lua_State* L, int index) + { + return Userdata::get (L, index, true); + } }; /** @@ -638,15 +638,15 @@ struct StackHelper template struct StackHelper { - static inline void push (lua_State* L, T const& t) - { - UserdataValue ::push (L, t); - } + static inline void push (lua_State* L, T const& t) + { + UserdataValue ::push (L, t); + } - static inline T const& get (lua_State* L, int index) - { - return *Userdata::get (L, index, true); - } + static inline T const& get (lua_State* L, int index) + { + return *Userdata::get (L, index, true); + } }; //============================================================================== @@ -658,17 +658,17 @@ template struct Stack { public: - static inline void push (lua_State* L, T const& t) - { - StackHelper ::value>::push (L, t); - } + static inline void push (lua_State* L, T const& t) + { + StackHelper ::value>::push (L, t); + } - static inline T get (lua_State* L, int index) - { - return StackHelper ::value>::get (L, index); - } + static inline T get (lua_State* L, int index) + { + return StackHelper ::value>::get (L, index); + } }; //------------------------------------------------------------------------------ @@ -684,134 +684,134 @@ public: template struct Stack { - static inline void push (lua_State* L, T* const p) - { - UserdataPtr::push (L, p); - } + static inline void push (lua_State* L, T* const p) + { + UserdataPtr::push (L, p); + } - static inline T* const get (lua_State* L, int index) - { - return Userdata::get (L, index, false); - } + static inline T* const get (lua_State* L, int index) + { + return Userdata::get (L, index, false); + } }; // Strips the const off the right side of * template struct Stack { - static inline void push (lua_State* L, T* const p) - { - UserdataPtr::push (L, p); - } + static inline void push (lua_State* L, T* const p) + { + UserdataPtr::push (L, p); + } - static inline T* const get (lua_State* L, int index) - { - return Userdata::get (L, index, false); - } + static inline T* const get (lua_State* L, int index) + { + return Userdata::get (L, index, false); + } }; // pointer to const template struct Stack { - static inline void push (lua_State* L, T const* const p) - { - UserdataPtr::push (L, p); - } + static inline void push (lua_State* L, T const* const p) + { + UserdataPtr::push (L, p); + } - static inline T const* const get (lua_State* L, int index) - { - return Userdata::get (L, index, true); - } + static inline T const* const get (lua_State* L, int index) + { + return Userdata::get (L, index, true); + } }; // Strips the const off the right side of * template struct Stack { - static inline void push (lua_State* L, T const* const p) - { - UserdataPtr::push (L, p); - } + static inline void push (lua_State* L, T const* const p) + { + UserdataPtr::push (L, p); + } - static inline T const* const get (lua_State* L, int index) - { - return Userdata::get (L, index, true); - } + static inline T const* const get (lua_State* L, int index) + { + return Userdata::get (L, index, true); + } }; // reference template struct Stack { - static inline void push (lua_State* L, T& t) - { - UserdataPtr::push (L, &t); - } + static inline void push (lua_State* L, T& t) + { + UserdataPtr::push (L, &t); + } - static T& get (lua_State* L, int index) - { - T* const t = Userdata::get (L, index, false); - if (!t) - luaL_error (L, "nil passed to reference"); - return *t; - } + static T& get (lua_State* L, int index) + { + T* const t = Userdata::get (L, index, false); + if (!t) + luaL_error (L, "nil passed to reference"); + return *t; + } }; template struct RefStackHelper { - typedef C return_type; - - static inline void push (lua_State* L, C const& t) - { - UserdataSharedHelper ::Type>::value>::push (L, t); - } + typedef C return_type; - typedef typename TypeTraits::removeConst < - typename ContainerTraits ::Type>::Type T; + static inline void push (lua_State* L, C const& t) + { + UserdataSharedHelper ::Type>::value>::push (L, t); + } - static return_type get (lua_State* L, int index) - { - return Userdata::get (L, index, true); - } + typedef typename TypeTraits::removeConst < + typename ContainerTraits ::Type>::Type T; + + static return_type get (lua_State* L, int index) + { + return Userdata::get (L, index, true); + } }; template struct RefStackHelper { - typedef T const& return_type; - + typedef T const& return_type; + static inline void push (lua_State* L, T const& t) { - UserdataPtr::push (L, &t); + UserdataPtr::push (L, &t); } - static return_type get (lua_State* L, int index) - { - T const* const t = Userdata::get (L, index, true); + static return_type get (lua_State* L, int index) + { + T const* const t = Userdata::get (L, index, true); + + if (!t) + luaL_error (L, "nil passed to reference"); + return *t; + } - if (!t) - luaL_error (L, "nil passed to reference"); - return *t; - } - }; // reference to const template struct Stack { - typedef RefStackHelper ::value> helper_t; - - static inline void push (lua_State* L, T const& t) - { - helper_t::push (L, t); - } + typedef RefStackHelper ::value> helper_t; - static typename helper_t::return_type get (lua_State* L, int index) - { - return helper_t::get (L, index); - } + static inline void push (lua_State* L, T const& t) + { + helper_t::push (L, t); + } + + static typename helper_t::return_type get (lua_State* L, int index) + { + return helper_t::get (L, index); + } }; diff --git a/src/lib/lua/bridge/detail/dump.h b/src/lib/lua/bridge/detail/dump.h index c0668035737..82f6a45ac1d 100644 --- a/src/lib/lua/bridge/detail/dump.h +++ b/src/lib/lua/bridge/detail/dump.h @@ -13,7 +13,7 @@ std::string dumpLuaState(lua_State *L) { ostr << " " << i << ": '" << lua_tostring(L, i) << "'\n"; break; case LUA_TBOOLEAN: - ostr << " " << i << ": " << + ostr << " " << i << ": " << (lua_toboolean(L, i) ? "true" : "false") << "\n"; break; case LUA_TNUMBER: diff --git a/src/lib/lua/lapi.h b/src/lib/lua/lapi.h index c7d34ad8486..c0ddd20300a 100644 --- a/src/lib/lua/lapi.h +++ b/src/lib/lua/lapi.h @@ -15,10 +15,10 @@ "stack overflow");} #define adjustresults(L,nres) \ - { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } + { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } -#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ - "not enough elements in the stack") +#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ + "not enough elements in the stack") #endif diff --git a/src/lib/lua/lauxlib.h b/src/lib/lua/lauxlib.h index 0fb023b8e73..523061441d7 100644 --- a/src/lib/lua/lauxlib.h +++ b/src/lib/lua/lauxlib.h @@ -21,31 +21,31 @@ typedef struct luaL_Reg { - const char *name; - lua_CFunction func; + const char *name; + lua_CFunction func; } luaL_Reg; LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver); -#define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM) +#define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM) LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, - size_t *l); + size_t *l); LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, - const char *def, size_t *l); + const char *def, size_t *l); LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, - lua_Integer def); + lua_Integer def); LUALIB_API lua_Unsigned (luaL_checkunsigned) (lua_State *L, int numArg); LUALIB_API lua_Unsigned (luaL_optunsigned) (lua_State *L, int numArg, - lua_Unsigned def); + lua_Unsigned def); LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); @@ -60,7 +60,7 @@ LUALIB_API void (luaL_where) (lua_State *L, int lvl); LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, - const char *const lst[]); + const char *const lst[]); LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); LUALIB_API int (luaL_execresult) (lua_State *L, int stat); @@ -73,12 +73,12 @@ LUALIB_API int (luaL_ref) (lua_State *L, int t); LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, - const char *mode); + const char *mode); -#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) +#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, - const char *name, const char *mode); + const char *name, const char *mode); LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); LUALIB_API lua_State *(luaL_newstate) (void); @@ -86,17 +86,17 @@ LUALIB_API lua_State *(luaL_newstate) (void); LUALIB_API int (luaL_len) (lua_State *L, int idx); LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, - const char *r); + const char *r); LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, - const char *msg, int level); + const char *msg, int level); LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, - lua_CFunction openf, int glb); + lua_CFunction openf, int glb); /* ** =============================================================== @@ -105,21 +105,21 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, */ -#define luaL_newlibtable(L,l) \ - lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) +#define luaL_newlibtable(L,l) \ + lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) -#define luaL_newlib(L,l) (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) +#define luaL_newlib(L,l) (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) -#define luaL_argcheck(L, cond,numarg,extramsg) \ +#define luaL_argcheck(L, cond,numarg,extramsg) \ ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) -#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) -#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) -#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) -#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) -#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) #define luaL_dofile(L, fn) \ (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) @@ -127,11 +127,11 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, #define luaL_dostring(L, s) \ (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) -#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) -#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) -#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) +#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) /* @@ -141,19 +141,19 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, */ typedef struct luaL_Buffer { - char *b; /* buffer address */ - size_t size; /* buffer size */ - size_t n; /* number of characters in buffer */ - lua_State *L; - char initb[LUAL_BUFFERSIZE]; /* initial buffer */ + char *b; /* buffer address */ + size_t size; /* buffer size */ + size_t n; /* number of characters in buffer */ + lua_State *L; + char initb[LUAL_BUFFERSIZE]; /* initial buffer */ } luaL_Buffer; #define luaL_addchar(B,c) \ - ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ - ((B)->b[(B)->n++] = (c))) + ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ + ((B)->b[(B)->n++] = (c))) -#define luaL_addsize(B,s) ((B)->n += (s)) +#define luaL_addsize(B,s) ((B)->n += (s)) LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); @@ -164,7 +164,7 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); -#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) +#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) /* }====================================================== */ @@ -186,8 +186,8 @@ LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); typedef struct luaL_Stream { - FILE *f; /* stream (NULL for incompletely created streams) */ - lua_CFunction closef; /* to close stream (NULL for closed streams) */ + FILE *f; /* stream (NULL for incompletely created streams) */ + lua_CFunction closef; /* to close stream (NULL for closed streams) */ } luaL_Stream; /* }====================================================== */ @@ -198,15 +198,13 @@ typedef struct luaL_Stream { #if defined(LUA_COMPAT_MODULE) LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, - int sizehint); + int sizehint); LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, - const luaL_Reg *l, int nup); + const luaL_Reg *l, int nup); -#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) +#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) #endif #endif - - diff --git a/src/lib/lua/lcode.h b/src/lib/lua/lcode.h index 6a1424cf5a7..a03a6e08f31 100644 --- a/src/lib/lua/lcode.h +++ b/src/lib/lua/lcode.h @@ -24,25 +24,25 @@ ** grep "ORDER OPR" if you change these enums (ORDER OP) */ typedef enum BinOpr { - OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, - OPR_CONCAT, - OPR_EQ, OPR_LT, OPR_LE, - OPR_NE, OPR_GT, OPR_GE, - OPR_AND, OPR_OR, - OPR_NOBINOPR + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_EQ, OPR_LT, OPR_LE, + OPR_NE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR } BinOpr; typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; -#define getcode(fs,e) ((fs)->f->code[(e)->u.info]) +#define getcode(fs,e) ((fs)->f->code[(e)->u.info]) -#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) -#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) -#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) +#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); @@ -76,7 +76,7 @@ LUAI_FUNC int luaK_getlabel (FuncState *fs); LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, - expdesc *v2, int line); + expdesc *v2, int line); LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); diff --git a/src/lib/lua/lctype.h b/src/lib/lua/lctype.h index b09b21a337c..84d99bbc9aa 100644 --- a/src/lib/lua/lctype.h +++ b/src/lib/lua/lctype.h @@ -20,58 +20,58 @@ #if 'A' == 65 && '0' == 48 /* ASCII case: can use its own tables; faster and fixed */ -#define LUA_USE_CTYPE 0 +#define LUA_USE_CTYPE 0 #else /* must use standard C ctype */ -#define LUA_USE_CTYPE 1 +#define LUA_USE_CTYPE 1 #endif #endif -#if !LUA_USE_CTYPE /* { */ +#if !LUA_USE_CTYPE /* { */ #include #include "llimits.h" -#define ALPHABIT 0 -#define DIGITBIT 1 -#define PRINTBIT 2 -#define SPACEBIT 3 -#define XDIGITBIT 4 +#define ALPHABIT 0 +#define DIGITBIT 1 +#define PRINTBIT 2 +#define SPACEBIT 3 +#define XDIGITBIT 4 -#define MASK(B) (1 << (B)) +#define MASK(B) (1 << (B)) /* ** add 1 to char to allow index -1 (EOZ) */ -#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) +#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) /* ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' */ -#define lislalpha(c) testprop(c, MASK(ALPHABIT)) -#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) -#define lisdigit(c) testprop(c, MASK(DIGITBIT)) -#define lisspace(c) testprop(c, MASK(SPACEBIT)) -#define lisprint(c) testprop(c, MASK(PRINTBIT)) -#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) +#define lislalpha(c) testprop(c, MASK(ALPHABIT)) +#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) +#define lisdigit(c) testprop(c, MASK(DIGITBIT)) +#define lisspace(c) testprop(c, MASK(SPACEBIT)) +#define lisprint(c) testprop(c, MASK(PRINTBIT)) +#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) /* ** this 'ltolower' only works for alphabetic characters */ -#define ltolower(c) ((c) | ('A' ^ 'a')) +#define ltolower(c) ((c) | ('A' ^ 'a')) /* two more entries for 0 and -1 (EOZ) */ LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; -#else /* }{ */ +#else /* }{ */ /* ** use standard C ctypes @@ -80,16 +80,15 @@ LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; #include -#define lislalpha(c) (isalpha(c) || (c) == '_') -#define lislalnum(c) (isalnum(c) || (c) == '_') -#define lisdigit(c) (isdigit(c)) -#define lisspace(c) (isspace(c)) -#define lisprint(c) (isprint(c)) -#define lisxdigit(c) (isxdigit(c)) +#define lislalpha(c) (isalpha(c) || (c) == '_') +#define lislalnum(c) (isalnum(c) || (c) == '_') +#define lisdigit(c) (isdigit(c)) +#define lisspace(c) (isspace(c)) +#define lisprint(c) (isprint(c)) +#define lisxdigit(c) (isxdigit(c)) -#define ltolower(c) (tolower(c)) +#define ltolower(c) (tolower(c)) -#endif /* } */ +#endif /* } */ #endif - diff --git a/src/lib/lua/ldebug.h b/src/lib/lua/ldebug.h index 6445c763ea5..78c61a9103f 100644 --- a/src/lib/lua/ldebug.h +++ b/src/lib/lua/ldebug.h @@ -11,23 +11,23 @@ #include "lstate.h" -#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) -#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) +#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) -#define resethookcount(L) (L->hookcount = L->basehookcount) +#define resethookcount(L) (L->hookcount = L->basehookcount) /* Active Lua function (given call info) */ -#define ci_func(ci) (clLvalue((ci)->func)) +#define ci_func(ci) (clLvalue((ci)->func)) LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, - const char *opname); + const char *opname); LUAI_FUNC l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2); LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1, - const TValue *p2); + const TValue *p2); LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, - const TValue *p2); + const TValue *p2); LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); LUAI_FUNC l_noret luaG_errormsg (lua_State *L); diff --git a/src/lib/lua/ldo.h b/src/lib/lua/ldo.h index d3d3082c9ba..f8cceddc90d 100644 --- a/src/lib/lua/ldo.h +++ b/src/lib/lua/ldo.h @@ -13,27 +13,27 @@ #include "lzio.h" -#define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ - luaD_growstack(L, n); else condmovestack(L); +#define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ + luaD_growstack(L, n); else condmovestack(L); #define incr_top(L) {L->top++; luaD_checkstack(L,0);} -#define savestack(L,p) ((char *)(p) - (char *)L->stack) -#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) /* type of protected functions, to be ran by `runprotected' */ typedef void (*Pfunc) (lua_State *L, void *ud); LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode); + const char *mode); LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults, - int allowyield); + int allowyield); LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t oldtop, ptrdiff_t ef); + ptrdiff_t oldtop, ptrdiff_t ef); LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); LUAI_FUNC void luaD_growstack (lua_State *L, int n); @@ -43,4 +43,3 @@ LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); #endif - diff --git a/src/lib/lua/lfunc.h b/src/lib/lua/lfunc.h index ca0d3a3e0b0..59f3e45f700 100644 --- a/src/lib/lua/lfunc.h +++ b/src/lib/lua/lfunc.h @@ -11,11 +11,11 @@ #include "lobject.h" -#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ - cast(int, sizeof(TValue)*((n)-1))) +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) -#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ - cast(int, sizeof(TValue *)*((n)-1))) +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) LUAI_FUNC Proto *luaF_newproto (lua_State *L); @@ -27,7 +27,7 @@ LUAI_FUNC void luaF_close (lua_State *L, StkId level); LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, - int pc); + int pc); #endif diff --git a/src/lib/lua/lgc.h b/src/lib/lua/lgc.h index 84bb1cdf99f..bd67335b38f 100644 --- a/src/lib/lua/lgc.h +++ b/src/lib/lua/lgc.h @@ -29,25 +29,25 @@ /* how much to allocate before next GC step */ #if !defined(GCSTEPSIZE) /* ~100 small strings */ -#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) +#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) #endif /* ** Possible states of the Garbage Collector */ -#define GCSpropagate 0 -#define GCSatomic 1 -#define GCSsweepstring 2 -#define GCSsweepudata 3 -#define GCSsweep 4 -#define GCSpause 5 +#define GCSpropagate 0 +#define GCSatomic 1 +#define GCSsweepstring 2 +#define GCSsweepudata 3 +#define GCSsweep 4 +#define GCSpause 5 #define issweepphase(g) \ (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep) -#define isgenerational(g) ((g)->gckind == KGC_GEN) +#define isgenerational(g) ((g)->gckind == KGC_GEN) /* ** macros to tell when main invariant (white objects cannot point to black @@ -58,7 +58,7 @@ ** invariant must be kept all times. */ -#define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic) +#define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic) /* @@ -66,34 +66,34 @@ ** 'propagate', so 'keepinvariant' is always true. */ #define keepinvariantout(g) \ - check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \ - g->gcstate <= GCSatomic) + check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \ + g->gcstate <= GCSatomic) /* ** some useful bit tricks */ -#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) -#define setbits(x,m) ((x) |= (m)) -#define testbits(x,m) ((x) & (m)) -#define bitmask(b) (1<<(b)) -#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) -#define l_setbit(x,b) setbits(x, bitmask(b)) -#define resetbit(x,b) resetbits(x, bitmask(b)) -#define testbit(x,b) testbits(x, bitmask(b)) +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) /* Layout for bit use in `marked' field: */ -#define WHITE0BIT 0 /* object is white (type 0) */ -#define WHITE1BIT 1 /* object is white (type 1) */ -#define BLACKBIT 2 /* object is black */ -#define FINALIZEDBIT 3 /* object has been separated for finalization */ -#define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */ -#define FIXEDBIT 5 /* object is fixed (should not be collected) */ -#define OLDBIT 6 /* object is old (only in generational mode) */ +#define WHITE0BIT 0 /* object is white (type 0) */ +#define WHITE1BIT 1 /* object is white (type 1) */ +#define BLACKBIT 2 /* object is black */ +#define FINALIZEDBIT 3 /* object has been separated for finalization */ +#define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */ +#define FIXEDBIT 5 /* object is fixed (should not be collected) */ +#define OLDBIT 6 /* object is old (only in generational mode) */ /* bit 7 is currently used by tests (luaL_checkmemory) */ -#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) #define iswhite(x) testbits((x)->gch.marked, WHITEBITS) @@ -101,27 +101,27 @@ #define isgray(x) /* neither white nor black */ \ (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT))) -#define isold(x) testbit((x)->gch.marked, OLDBIT) +#define isold(x) testbit((x)->gch.marked, OLDBIT) /* MOVE OLD rule: whenever an object is moved to the beginning of a GC list, its old bit must be cleared */ -#define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT) +#define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT) -#define otherwhite(g) (g->currentwhite ^ WHITEBITS) -#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) -#define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked) +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) +#define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked) -#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) -#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) -#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) -#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) #define luaC_condGC(L,c) \ {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);} -#define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);) +#define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);) #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ @@ -135,10 +135,10 @@ luaC_barrier_(L,obj2gco(p),obj2gco(o)); } #define luaC_objbarrierback(L,p,o) \ - { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); } + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); } #define luaC_barrierproto(L,p,c) \ - { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); } + { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); } LUAI_FUNC void luaC_freeallobjects (lua_State *L); LUAI_FUNC void luaC_step (lua_State *L); @@ -146,7 +146,7 @@ LUAI_FUNC void luaC_forcestep (lua_State *L); LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz, - GCObject **list, int offset); + GCObject **list, int offset); LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c); diff --git a/src/lib/lua/llex.h b/src/lib/lua/llex.h index a4acdd30218..8fb9f38ef01 100644 --- a/src/lib/lua/llex.h +++ b/src/lib/lua/llex.h @@ -11,7 +11,7 @@ #include "lzio.h" -#define FIRST_RESERVED 257 +#define FIRST_RESERVED 257 @@ -20,54 +20,54 @@ * grep "ORDER RESERVED" */ enum RESERVED { - /* terminal symbols denoted by reserved words */ - TK_AND = FIRST_RESERVED, TK_BREAK, - TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, - TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, - TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, - /* other terminal symbols */ - TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS, - TK_NUMBER, TK_NAME, TK_STRING + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS, + TK_NUMBER, TK_NAME, TK_STRING }; /* number of reserved words */ -#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) typedef union { - lua_Number r; - TString *ts; + lua_Number r; + TString *ts; } SemInfo; /* semantics information */ typedef struct Token { - int token; - SemInfo seminfo; + int token; + SemInfo seminfo; } Token; /* state of the lexer plus state of the parser when shared by all functions */ typedef struct LexState { - int current; /* current character (charint) */ - int linenumber; /* input line counter */ - int lastline; /* line of last token `consumed' */ - Token t; /* current token */ - Token lookahead; /* look ahead token */ - struct FuncState *fs; /* current function (parser) */ - struct lua_State *L; - ZIO *z; /* input stream */ - Mbuffer *buff; /* buffer for tokens */ - struct Dyndata *dyd; /* dynamic structures used by the parser */ - TString *source; /* current source name */ - TString *envn; /* environment variable name */ - char decpoint; /* locale decimal point */ + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* current function (parser) */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + struct Dyndata *dyd; /* dynamic structures used by the parser */ + TString *source; /* current source name */ + TString *envn; /* environment variable name */ + char decpoint; /* locale decimal point */ } LexState; LUAI_FUNC void luaX_init (lua_State *L); LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, - TString *source, int firstchar); + TString *source, int firstchar); LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); LUAI_FUNC int luaX_lookahead (LexState *ls); diff --git a/src/lib/lua/llimits.h b/src/lib/lua/llimits.h index 152dd055154..73f05a67937 100644 --- a/src/lib/lua/llimits.h +++ b/src/lib/lua/llimits.h @@ -27,11 +27,11 @@ typedef LUAI_MEM l_mem; typedef unsigned char lu_byte; -#define MAX_SIZET ((size_t)(~(size_t)0)-2) +#define MAX_SIZET ((size_t)(~(size_t)0)-2) -#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) -#define MAX_LMEM ((l_mem) ((MAX_LUMEM >> 1) - 2)) +#define MAX_LMEM ((l_mem) ((MAX_LUMEM >> 1) - 2)) #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ @@ -47,7 +47,7 @@ typedef unsigned char lu_byte; /* type to ensure maximum alignment */ #if !defined(LUAI_USER_ALIGNMENT_T) -#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } #endif typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; @@ -59,13 +59,13 @@ typedef LUAI_UACNUMBER l_uacNumber; /* internal assertions for in-house debugging */ #if defined(lua_assert) -#define check_exp(c,e) (lua_assert(c), (e)) +#define check_exp(c,e) (lua_assert(c), (e)) /* to avoid problems with conditions too long */ -#define lua_longassert(c) { if (!(c)) lua_assert(0); } +#define lua_longassert(c) { if (!(c)) lua_assert(0); } #else -#define lua_assert(c) ((void)0) -#define check_exp(c,e) (e) -#define lua_longassert(c) ((void)0) +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define lua_longassert(c) ((void)0) #endif /* @@ -75,38 +75,38 @@ typedef LUAI_UACNUMBER l_uacNumber; #if defined(LUA_USE_APICHECK) #include -#define luai_apicheck(L,e) assert(e) +#define luai_apicheck(L,e) assert(e) #else -#define luai_apicheck(L,e) lua_assert(e) +#define luai_apicheck(L,e) lua_assert(e) #endif #endif -#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) +#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) #if !defined(UNUSED) -#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ #endif -#define cast(t, exp) ((t)(exp)) +#define cast(t, exp) ((t)(exp)) -#define cast_byte(i) cast(lu_byte, (i)) -#define cast_num(i) cast(lua_Number, (i)) -#define cast_int(i) cast(int, (i)) -#define cast_uchar(i) cast(unsigned char, (i)) +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) +#define cast_uchar(i) cast(unsigned char, (i)) /* ** non-return type */ #if defined(__GNUC__) -#define l_noret void __attribute__((noreturn)) +#define l_noret void __attribute__((noreturn)) #elif defined(_MSC_VER) -#define l_noret void __declspec(noreturn) +#define l_noret void __declspec(noreturn) #else -#define l_noret void +#define l_noret void #endif @@ -116,14 +116,14 @@ typedef LUAI_UACNUMBER l_uacNumber; ** in a program. (Value must fit in an unsigned short int.) */ #if !defined(LUAI_MAXCCALLS) -#define LUAI_MAXCCALLS 200 +#define LUAI_MAXCCALLS 200 #endif /* ** maximum number of upvalues in a closure (both C and Lua). (Value ** must fit in an unsigned char.) */ -#define MAXUPVAL UCHAR_MAX +#define MAXUPVAL UCHAR_MAX /* @@ -135,19 +135,19 @@ typedef lu_int32 Instruction; /* maximum stack for a Lua function */ -#define MAXSTACK 250 +#define MAXSTACK 250 /* minimum size for the string table (must be power of 2) */ #if !defined(MINSTRTABSIZE) -#define MINSTRTABSIZE 32 +#define MINSTRTABSIZE 32 #endif /* minimum size for string buffer */ #if !defined(LUA_MINBUFFER) -#define LUA_MINBUFFER 32 +#define LUA_MINBUFFER 32 #endif @@ -167,19 +167,19 @@ typedef lu_int32 Instruction; ** created/deleted/resumed/yielded. */ #if !defined(luai_userstateopen) -#define luai_userstateopen(L) ((void)L) +#define luai_userstateopen(L) ((void)L) #endif #if !defined(luai_userstateclose) -#define luai_userstateclose(L) ((void)L) +#define luai_userstateclose(L) ((void)L) #endif #if !defined(luai_userstatethread) -#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) #endif #if !defined(luai_userstatefree) -#define luai_userstatefree(L,L1) ((void)L) +#define luai_userstatefree(L,L1) ((void)L) #endif #if !defined(luai_userstateresume) @@ -200,78 +200,78 @@ typedef lu_int32 Instruction; ** both small and large values (outside the range of integers). */ -#if defined(MS_ASMTRICK) || defined(LUA_MSASMTRICK) /* { */ +#if defined(MS_ASMTRICK) || defined(LUA_MSASMTRICK) /* { */ /* trick with Microsoft assembler for X86 */ #define lua_number2int(i,n) __asm {__asm fld n __asm fistp i} -#define lua_number2integer(i,n) lua_number2int(i, n) +#define lua_number2integer(i,n) lua_number2int(i, n) #define lua_number2unsigned(i,n) \ - {__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;} + {__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;} -#elif defined(LUA_IEEE754TRICK) /* }{ */ +#elif defined(LUA_IEEE754TRICK) /* }{ */ /* the next trick should work on any machine using IEEE754 with a 32-bit int type */ union luai_Cast { double l_d; LUA_INT32 l_p[2]; }; -#if !defined(LUA_IEEEENDIAN) /* { */ -#define LUAI_EXTRAIEEE \ - static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)}; -#define LUA_IEEEENDIANLOC (ieeeendian.l_p[1] == 33) +#if !defined(LUA_IEEEENDIAN) /* { */ +#define LUAI_EXTRAIEEE \ + static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)}; +#define LUA_IEEEENDIANLOC (ieeeendian.l_p[1] == 33) #else -#define LUA_IEEEENDIANLOC LUA_IEEEENDIAN -#define LUAI_EXTRAIEEE /* empty */ -#endif /* } */ +#define LUA_IEEEENDIANLOC LUA_IEEEENDIAN +#define LUAI_EXTRAIEEE /* empty */ +#endif /* } */ #define lua_number2int32(i,n,t) \ - { LUAI_EXTRAIEEE \ - volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \ - (i) = (t)u.l_p[LUA_IEEEENDIANLOC]; } + { LUAI_EXTRAIEEE \ + volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \ + (i) = (t)u.l_p[LUA_IEEEENDIANLOC]; } #define luai_hashnum(i,n) \ - { volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \ - (i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */ + { volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \ + (i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */ -#define lua_number2int(i,n) lua_number2int32(i, n, int) -#define lua_number2unsigned(i,n) lua_number2int32(i, n, lua_Unsigned) +#define lua_number2int(i,n) lua_number2int32(i, n, int) +#define lua_number2unsigned(i,n) lua_number2int32(i, n, lua_Unsigned) /* the trick can be expanded to lua_Integer when it is a 32-bit value */ #if defined(LUA_IEEELL) -#define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer) +#define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer) #endif -#endif /* } */ +#endif /* } */ /* the following definitions always work, but may be slow */ #if !defined(lua_number2int) -#define lua_number2int(i,n) ((i)=(int)(n)) +#define lua_number2int(i,n) ((i)=(int)(n)) #endif #if !defined(lua_number2integer) -#define lua_number2integer(i,n) ((i)=(lua_Integer)(n)) +#define lua_number2integer(i,n) ((i)=(lua_Integer)(n)) #endif -#if !defined(lua_number2unsigned) /* { */ +#if !defined(lua_number2unsigned) /* { */ /* the following definition assures proper modulo behavior */ #if defined(LUA_NUMBER_DOUBLE) || defined(LUA_NUMBER_FLOAT) #include -#define SUPUNSIGNED ((lua_Number)(~(lua_Unsigned)0) + 1) +#define SUPUNSIGNED ((lua_Number)(~(lua_Unsigned)0) + 1) #define lua_number2unsigned(i,n) \ ((i)=(lua_Unsigned)((n) - floor((n)/SUPUNSIGNED)*SUPUNSIGNED)) #else -#define lua_number2unsigned(i,n) ((i)=(lua_Unsigned)(n)) +#define lua_number2unsigned(i,n) ((i)=(lua_Unsigned)(n)) #endif -#endif /* } */ +#endif /* } */ #if !defined(lua_unsigned2number) /* on several machines, coercion from unsigned to double is slow, so it may be worth to avoid */ #define lua_unsigned2number(u) \ - (((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u)) + (((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u)) #endif @@ -282,8 +282,8 @@ union luai_Cast { double l_d; LUA_INT32 l_p[2]; }; #include #define luai_hashnum(i,n) { int e; \ - n = l_mathop(frexp)(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP); \ - lua_number2int(i, n); i += e; } + n = l_mathop(frexp)(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP); \ + lua_number2int(i, n); i += e; } #endif @@ -293,14 +293,14 @@ union luai_Cast { double l_d; LUA_INT32 l_p[2]; }; ** macro to control inclusion of some hard tests on stack reallocation */ #if !defined(HARDSTACKTESTS) -#define condmovestack(L) ((void)0) +#define condmovestack(L) ((void)0) #else /* realloc stack keeping its size */ -#define condmovestack(L) luaD_reallocstack((L), (L)->stacksize) +#define condmovestack(L) luaD_reallocstack((L), (L)->stacksize) #endif #if !defined(HARDMEMTESTS) -#define condchangemem(L) condmovestack(L) +#define condchangemem(L) condmovestack(L) #else #define condchangemem(L) \ ((void)(!(G(L)->gcrunning) || (luaC_fullgc(L, 0), 1))) diff --git a/src/lib/lua/lmem.h b/src/lib/lua/lmem.h index bd4f4e0726f..3f0563ef8cd 100644 --- a/src/lib/lua/lmem.h +++ b/src/lib/lua/lmem.h @@ -22,36 +22,35 @@ ** cast to 'void' avoids warnings of "value unused". */ #define luaM_reallocv(L,b,on,n,e) \ - (cast(void, \ - (cast(size_t, (n)+1) > MAX_SIZET/(e)) ? (luaM_toobig(L), 0) : 0), \ - luaM_realloc_(L, (b), (on)*(e), (n)*(e))) + (cast(void, \ + (cast(size_t, (n)+1) > MAX_SIZET/(e)) ? (luaM_toobig(L), 0) : 0), \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e))) -#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) -#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) #define luaM_freearray(L, b, n) luaM_reallocv(L, (b), n, 0, sizeof((b)[0])) -#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) -#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) #define luaM_newvector(L,n,t) \ cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) -#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) +#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) #define luaM_growvector(L,v,nelems,size,t,limit,e) \ - if ((nelems)+1 > (size)) \ - ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) #define luaM_reallocvector(L, v,oldn,n,t) \ - ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) LUAI_FUNC l_noret luaM_toobig (lua_State *L); /* not to be called directly */ LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, - size_t size); + size_t size); LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, - size_t size_elem, int limit, - const char *what); + size_t size_elem, int limit, + const char *what); #endif - diff --git a/src/lib/lua/lobject.h b/src/lib/lua/lobject.h index 3a630b944c7..38026107792 100644 --- a/src/lib/lua/lobject.h +++ b/src/lib/lua/lobject.h @@ -19,14 +19,14 @@ /* ** Extra tags for non-values */ -#define LUA_TPROTO LUA_NUMTAGS -#define LUA_TUPVAL (LUA_NUMTAGS+1) -#define LUA_TDEADKEY (LUA_NUMTAGS+2) +#define LUA_TPROTO LUA_NUMTAGS +#define LUA_TUPVAL (LUA_NUMTAGS+1) +#define LUA_TDEADKEY (LUA_NUMTAGS+2) /* ** number of all possible tags (including LUA_TNONE but excluding DEADKEY) */ -#define LUA_TOTALTAGS (LUA_TUPVAL+2) +#define LUA_TOTALTAGS (LUA_TUPVAL+2) /* @@ -36,7 +36,7 @@ ** bit 6: whether value is collectable */ -#define VARBITS (3 << 4) +#define VARBITS (3 << 4) /* @@ -47,21 +47,21 @@ */ /* Variant tags for functions */ -#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ -#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ -#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ +#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ +#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ +#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ /* Variant tags for strings */ -#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ -#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ +#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ +#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ /* Bit mark for collectable types */ -#define BIT_ISCOLLECTABLE (1 << 6) +#define BIT_ISCOLLECTABLE (1 << 6) /* mark a tag as collectable */ -#define ctb(t) ((t) | BIT_ISCOLLECTABLE) +#define ctb(t) ((t) | BIT_ISCOLLECTABLE) /* @@ -74,14 +74,14 @@ typedef union GCObject GCObject; ** Common Header for all collectable objects (in macro form, to be ** included in other objects) */ -#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked /* ** Common header in struct form */ typedef struct GCheader { - CommonHeader; + CommonHeader; } GCheader; @@ -92,7 +92,7 @@ typedef struct GCheader { typedef union Value Value; -#define numfield lua_Number n; /* numbers */ +#define numfield lua_Number n; /* numbers */ @@ -101,80 +101,80 @@ typedef union Value Value; ** an actual value plus a tag with its type. */ -#define TValuefields Value value_; int tt_ +#define TValuefields Value value_; int tt_ typedef struct lua_TValue TValue; /* macro defining a nil value */ -#define NILCONSTANT {NULL}, LUA_TNIL +#define NILCONSTANT {NULL}, LUA_TNIL -#define val_(o) ((o)->value_) -#define num_(o) (val_(o).n) +#define val_(o) ((o)->value_) +#define num_(o) (val_(o).n) /* raw type tag of a TValue */ -#define rttype(o) ((o)->tt_) +#define rttype(o) ((o)->tt_) /* tag with no variants (bits 0-3) */ -#define novariant(x) ((x) & 0x0F) +#define novariant(x) ((x) & 0x0F) /* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ -#define ttype(o) (rttype(o) & 0x3F) +#define ttype(o) (rttype(o) & 0x3F) /* type tag of a TValue with no variants (bits 0-3) */ -#define ttypenv(o) (novariant(rttype(o))) +#define ttypenv(o) (novariant(rttype(o))) /* Macros to test type */ -#define checktag(o,t) (rttype(o) == (t)) -#define checktype(o,t) (ttypenv(o) == (t)) -#define ttisnumber(o) checktag((o), LUA_TNUMBER) -#define ttisnil(o) checktag((o), LUA_TNIL) -#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) -#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) -#define ttisstring(o) checktype((o), LUA_TSTRING) -#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) -#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) -#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) -#define ttisfunction(o) checktype(o, LUA_TFUNCTION) -#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) -#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) -#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) -#define ttislcf(o) checktag((o), LUA_TLCF) -#define ttisuserdata(o) checktag((o), ctb(LUA_TUSERDATA)) -#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) -#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) +#define checktag(o,t) (rttype(o) == (t)) +#define checktype(o,t) (ttypenv(o) == (t)) +#define ttisnumber(o) checktag((o), LUA_TNUMBER) +#define ttisnil(o) checktag((o), LUA_TNIL) +#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) +#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) +#define ttisstring(o) checktype((o), LUA_TSTRING) +#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) +#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) +#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) +#define ttisfunction(o) checktype(o, LUA_TFUNCTION) +#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) +#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) +#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) +#define ttislcf(o) checktag((o), LUA_TLCF) +#define ttisuserdata(o) checktag((o), ctb(LUA_TUSERDATA)) +#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) +#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) -#define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) +#define ttisequal(o1,o2) (rttype(o1) == rttype(o2)) /* Macros to access values */ -#define nvalue(o) check_exp(ttisnumber(o), num_(o)) -#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) -#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) -#define rawtsvalue(o) check_exp(ttisstring(o), &val_(o).gc->ts) -#define tsvalue(o) (&rawtsvalue(o)->tsv) -#define rawuvalue(o) check_exp(ttisuserdata(o), &val_(o).gc->u) -#define uvalue(o) (&rawuvalue(o)->uv) -#define clvalue(o) check_exp(ttisclosure(o), &val_(o).gc->cl) -#define clLvalue(o) check_exp(ttisLclosure(o), &val_(o).gc->cl.l) -#define clCvalue(o) check_exp(ttisCclosure(o), &val_(o).gc->cl.c) -#define fvalue(o) check_exp(ttislcf(o), val_(o).f) -#define hvalue(o) check_exp(ttistable(o), &val_(o).gc->h) -#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) -#define thvalue(o) check_exp(ttisthread(o), &val_(o).gc->th) +#define nvalue(o) check_exp(ttisnumber(o), num_(o)) +#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) +#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) +#define rawtsvalue(o) check_exp(ttisstring(o), &val_(o).gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &val_(o).gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisclosure(o), &val_(o).gc->cl) +#define clLvalue(o) check_exp(ttisLclosure(o), &val_(o).gc->cl.l) +#define clCvalue(o) check_exp(ttisCclosure(o), &val_(o).gc->cl.c) +#define fvalue(o) check_exp(ttislcf(o), val_(o).f) +#define hvalue(o) check_exp(ttistable(o), &val_(o).gc->h) +#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) +#define thvalue(o) check_exp(ttisthread(o), &val_(o).gc->th) /* a dead value may get the 'gc' field, but cannot access its contents */ -#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) +#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) -#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) -#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) +#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) /* Macros for internal tests */ -#define righttt(obj) (ttype(obj) == gcvalue(obj)->gch.tt) +#define righttt(obj) (ttype(obj) == gcvalue(obj)->gch.tt) #define checkliveness(g,obj) \ lua_longassert(!iscollectable(obj) || \ @@ -182,65 +182,65 @@ typedef struct lua_TValue TValue; /* Macros to set values */ -#define settt_(o,t) ((o)->tt_=(t)) +#define settt_(o,t) ((o)->tt_=(t)) #define setnvalue(obj,x) \ - { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); } + { TValue *io=(obj); num_(io)=(x); settt_(io, LUA_TNUMBER); } #define setnilvalue(obj) settt_(obj, LUA_TNIL) #define setfvalue(obj,x) \ - { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } + { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } #define setpvalue(obj,x) \ - { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } + { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } #define setbvalue(obj,x) \ - { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } + { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } #define setgcovalue(L,obj,x) \ - { TValue *io=(obj); GCObject *i_g=(x); \ - val_(io).gc=i_g; settt_(io, ctb(gch(i_g)->tt)); } + { TValue *io=(obj); GCObject *i_g=(x); \ + val_(io).gc=i_g; settt_(io, ctb(gch(i_g)->tt)); } #define setsvalue(L,obj,x) \ - { TValue *io=(obj); \ - TString *x_ = (x); \ - val_(io).gc=cast(GCObject *, x_); settt_(io, ctb(x_->tsv.tt)); \ - checkliveness(G(L),io); } + { TValue *io=(obj); \ + TString *x_ = (x); \ + val_(io).gc=cast(GCObject *, x_); settt_(io, ctb(x_->tsv.tt)); \ + checkliveness(G(L),io); } #define setuvalue(L,obj,x) \ - { TValue *io=(obj); \ - val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TUSERDATA)); \ - checkliveness(G(L),io); } + { TValue *io=(obj); \ + val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TUSERDATA)); \ + checkliveness(G(L),io); } #define setthvalue(L,obj,x) \ - { TValue *io=(obj); \ - val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTHREAD)); \ - checkliveness(G(L),io); } + { TValue *io=(obj); \ + val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTHREAD)); \ + checkliveness(G(L),io); } #define setclLvalue(L,obj,x) \ - { TValue *io=(obj); \ - val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TLCL)); \ - checkliveness(G(L),io); } + { TValue *io=(obj); \ + val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TLCL)); \ + checkliveness(G(L),io); } #define setclCvalue(L,obj,x) \ - { TValue *io=(obj); \ - val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TCCL)); \ - checkliveness(G(L),io); } + { TValue *io=(obj); \ + val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TCCL)); \ + checkliveness(G(L),io); } #define sethvalue(L,obj,x) \ - { TValue *io=(obj); \ - val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTABLE)); \ - checkliveness(G(L),io); } + { TValue *io=(obj); \ + val_(io).gc=cast(GCObject *, (x)); settt_(io, ctb(LUA_TTABLE)); \ + checkliveness(G(L),io); } -#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) +#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) #define setobj(L,obj1,obj2) \ { const TValue *io2=(obj2); TValue *io1=(obj1); \ - io1->value_ = io2->value_; io1->tt_ = io2->tt_; \ - checkliveness(G(L),io1); } + io1->value_ = io2->value_; io1->tt_ = io2->tt_; \ + checkliveness(G(L),io1); } /* @@ -248,23 +248,23 @@ typedef struct lua_TValue TValue; */ /* from stack to (same) stack */ -#define setobjs2s setobj +#define setobjs2s setobj /* to stack (not from same stack) */ -#define setobj2s setobj -#define setsvalue2s setsvalue -#define sethvalue2s sethvalue -#define setptvalue2s setptvalue +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue /* from table to same table */ -#define setobjt2t setobj +#define setobjt2t setobj /* to table */ -#define setobj2t setobj +#define setobj2t setobj /* to new object */ -#define setobj2n setobj -#define setsvalue2n setsvalue +#define setobj2n setobj +#define setsvalue2n setsvalue /* check whether a number is valid (useful only for NaN trick) */ -#define luai_checknum(L,o,c) { /* empty */ } +#define luai_checknum(L,o,c) { /* empty */ } /* @@ -282,7 +282,7 @@ typedef struct lua_TValue TValue; */ /* allows for external implementation for part of the trick */ -#if !defined(NNMARK) /* { */ +#if !defined(NNMARK) /* { */ #if !defined(LUA_IEEEENDIAN) @@ -290,60 +290,60 @@ typedef struct lua_TValue TValue; #endif -#define NNMARK 0x7FF7A500 -#define NNMASK 0x7FFFFF00 +#define NNMARK 0x7FF7A500 +#define NNMASK 0x7FFFFF00 #undef TValuefields #undef NILCONSTANT -#if (LUA_IEEEENDIAN == 0) /* { */ +#if (LUA_IEEEENDIAN == 0) /* { */ /* little endian */ #define TValuefields \ union { struct { Value v__; int tt__; } i; double d__; } u -#define NILCONSTANT {{{NULL}, tag2tt(LUA_TNIL)}} +#define NILCONSTANT {{{NULL}, tag2tt(LUA_TNIL)}} /* field-access macros */ -#define v_(o) ((o)->u.i.v__) -#define d_(o) ((o)->u.d__) -#define tt_(o) ((o)->u.i.tt__) +#define v_(o) ((o)->u.i.v__) +#define d_(o) ((o)->u.d__) +#define tt_(o) ((o)->u.i.tt__) -#else /* }{ */ +#else /* }{ */ /* big endian */ #define TValuefields \ union { struct { int tt__; Value v__; } i; double d__; } u -#define NILCONSTANT {{tag2tt(LUA_TNIL), {NULL}}} +#define NILCONSTANT {{tag2tt(LUA_TNIL), {NULL}}} /* field-access macros */ -#define v_(o) ((o)->u.i.v__) -#define d_(o) ((o)->u.d__) -#define tt_(o) ((o)->u.i.tt__) +#define v_(o) ((o)->u.i.v__) +#define d_(o) ((o)->u.d__) +#define tt_(o) ((o)->u.i.tt__) -#endif /* } */ +#endif /* } */ -#endif /* } */ +#endif /* } */ /* correspondence with standard representation */ #undef val_ -#define val_(o) v_(o) +#define val_(o) v_(o) #undef num_ -#define num_(o) d_(o) +#define num_(o) d_(o) #undef numfield -#define numfield /* no such field; numbers are the entire struct */ +#define numfield /* no such field; numbers are the entire struct */ /* basic check to distinguish numbers from non-numbers */ #undef ttisnumber -#define ttisnumber(o) ((tt_(o) & NNMASK) != NNMARK) +#define ttisnumber(o) ((tt_(o) & NNMASK) != NNMARK) -#define tag2tt(t) (NNMARK | (t)) +#define tag2tt(t) (NNMARK | (t)) #undef rttype -#define rttype(o) (ttisnumber(o) ? LUA_TNUMBER : tt_(o) & 0xff) +#define rttype(o) (ttisnumber(o) ? LUA_TNUMBER : tt_(o) & 0xff) #undef settt_ -#define settt_(o,t) (tt_(o) = tag2tt(t)) +#define settt_(o,t) (tt_(o) = tag2tt(t)) #undef setnvalue #define setnvalue(obj,x) \ @@ -352,8 +352,8 @@ typedef struct lua_TValue TValue; #undef setobj #define setobj(L,obj1,obj2) \ { const TValue *o2_=(obj2); TValue *o1_=(obj1); \ - o1_->u = o2_->u; \ - checkliveness(G(L),o1_); } + o1_->u = o2_->u; \ + checkliveness(G(L),o1_); } /* @@ -362,8 +362,8 @@ typedef struct lua_TValue TValue; #undef checktag #undef checktype -#define checktag(o,t) (tt_(o) == tag2tt(t)) -#define checktype(o,t) (ctb(tt_(o) | VARBITS) == ctb(tag2tt(t) | VARBITS)) +#define checktag(o,t) (tt_(o) == tag2tt(t)) +#define checktype(o,t) (ctb(tt_(o) | VARBITS) == ctb(tag2tt(t) | VARBITS)) #undef ttisequal #define ttisequal(o1,o2) \ @@ -371,7 +371,7 @@ typedef struct lua_TValue TValue; #undef luai_checknum -#define luai_checknum(L,o,c) { if (!ttisnumber(o)) c; } +#define luai_checknum(L,o,c) { if (!ttisnumber(o)) c; } #endif /* }====================================================== */ @@ -386,16 +386,16 @@ typedef struct lua_TValue TValue; union Value { - GCObject *gc; /* collectable objects */ - void *p; /* light userdata */ - int b; /* booleans */ - lua_CFunction f; /* light C functions */ - numfield /* numbers */ + GCObject *gc; /* collectable objects */ + void *p; /* light userdata */ + int b; /* booleans */ + lua_CFunction f; /* light C functions */ + numfield /* numbers */ }; struct lua_TValue { - TValuefields; + TValuefields; }; @@ -408,18 +408,18 @@ typedef TValue *StkId; /* index to stack elements */ ** Header for string value; string bytes follow the end of this structure */ typedef union TString { - L_Umaxalign dummy; /* ensures maximum alignment for strings */ - struct { - CommonHeader; - lu_byte extra; /* reserved words for short strings; "has hash" for longs */ - unsigned int hash; - size_t len; /* number of characters in string */ - } tsv; + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte extra; /* reserved words for short strings; "has hash" for longs */ + unsigned int hash; + size_t len; /* number of characters in string */ + } tsv; } TString; /* get the actual string (array of bytes) from a TString */ -#define getstr(ts) cast(const char *, (ts) + 1) +#define getstr(ts) cast(const char *, (ts) + 1) /* get the actual string (array of bytes) from a Lua value */ #define svalue(o) getstr(rawtsvalue(o)) @@ -429,13 +429,13 @@ typedef union TString { ** Header for userdata; memory area follows the end of this structure */ typedef union Udata { - L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ - struct { - CommonHeader; - struct Table *metatable; - struct Table *env; - size_t len; /* number of bytes */ - } uv; + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; /* number of bytes */ + } uv; } Udata; @@ -444,9 +444,9 @@ typedef union Udata { ** Description of an upvalue for function prototypes */ typedef struct Upvaldesc { - TString *name; /* upvalue name (for debug information) */ - lu_byte instack; /* whether it is in stack */ - lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ + TString *name; /* upvalue name (for debug information) */ + lu_byte instack; /* whether it is in stack */ + lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ } Upvaldesc; @@ -455,9 +455,9 @@ typedef struct Upvaldesc { ** (used for debug information) */ typedef struct LocVar { - TString *varname; - int startpc; /* first point where variable is active */ - int endpc; /* first point where variable is dead */ + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ } LocVar; @@ -465,27 +465,27 @@ typedef struct LocVar { ** Function Prototypes */ typedef struct Proto { - CommonHeader; - TValue *k; /* constants used by the function */ - Instruction *code; - struct Proto **p; /* functions defined inside the function */ - int *lineinfo; /* map from opcodes to source lines (debug information) */ - LocVar *locvars; /* information about local variables (debug information) */ - Upvaldesc *upvalues; /* upvalue information */ - union Closure *cache; /* last created closure with this prototype */ - TString *source; /* used for debug information */ - int sizeupvalues; /* size of 'upvalues' */ - int sizek; /* size of `k' */ - int sizecode; - int sizelineinfo; - int sizep; /* size of `p' */ - int sizelocvars; - int linedefined; - int lastlinedefined; - GCObject *gclist; - lu_byte numparams; /* number of fixed parameters */ - lu_byte is_vararg; - lu_byte maxstacksize; /* maximum stack used by this function */ + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines (debug information) */ + LocVar *locvars; /* information about local variables (debug information) */ + Upvaldesc *upvalues; /* upvalue information */ + union Closure *cache; /* last created closure with this prototype */ + TString *source; /* used for debug information */ + int sizeupvalues; /* size of 'upvalues' */ + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte numparams; /* number of fixed parameters */ + lu_byte is_vararg; + lu_byte maxstacksize; /* maximum stack used by this function */ } Proto; @@ -494,15 +494,15 @@ typedef struct Proto { ** Lua Upvalues */ typedef struct UpVal { - CommonHeader; - TValue *v; /* points to stack or to its own value */ - union { - TValue value; /* the value (when closed) */ - struct { /* double linked list (when open) */ - struct UpVal *prev; - struct UpVal *next; - } l; - } u; + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; } UpVal; @@ -514,28 +514,28 @@ typedef struct UpVal { CommonHeader; lu_byte nupvalues; GCObject *gclist typedef struct CClosure { - ClosureHeader; - lua_CFunction f; - TValue upvalue[1]; /* list of upvalues */ + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; /* list of upvalues */ } CClosure; typedef struct LClosure { - ClosureHeader; - struct Proto *p; - UpVal *upvals[1]; /* list of upvalues */ + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; /* list of upvalues */ } LClosure; typedef union Closure { - CClosure c; - LClosure l; + CClosure c; + LClosure l; } Closure; -#define isLfunction(o) ttisLclosure(o) +#define isLfunction(o) ttisLclosure(o) -#define getproto(o) (clLvalue(o)->p) +#define getproto(o) (clLvalue(o)->p) /* @@ -543,30 +543,30 @@ typedef union Closure { */ typedef union TKey { - struct { - TValuefields; - struct Node *next; /* for chaining */ - } nk; - TValue tvk; + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; } TKey; typedef struct Node { - TValue i_val; - TKey i_key; + TValue i_val; + TKey i_key; } Node; typedef struct Table { - CommonHeader; - lu_byte flags; /* 1<

lsizenode)) +#define twoto(x) (1<<(x)) +#define sizenode(t) (twoto((t)->lsizenode)) /* ** (address of) a fixed nil value */ -#define luaO_nilobject (&luaO_nilobject_) +#define luaO_nilobject (&luaO_nilobject_) LUAI_DDEC const TValue luaO_nilobject_; @@ -598,10 +598,9 @@ LUAI_FUNC lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2); LUAI_FUNC int luaO_str2d (const char *s, size_t len, lua_Number *result); LUAI_FUNC int luaO_hexavalue (int c); LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, - va_list argp); + va_list argp); LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); #endif - diff --git a/src/lib/lua/lopcodes.h b/src/lib/lua/lopcodes.h index 51f57915455..bf17ba9e641 100644 --- a/src/lib/lua/lopcodes.h +++ b/src/lib/lua/lopcodes.h @@ -14,12 +14,12 @@ We assume that instructions are unsigned numbers. All instructions have an opcode in the first 6 bits. Instructions can have the following fields: - `A' : 8 bits - `B' : 9 bits - `C' : 9 bits - 'Ax' : 26 bits ('A', 'B', and 'C' together) - `Bx' : 18 bits (`B' and `C' together) - `sBx' : signed Bx + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + 'Ax' : 26 bits ('A', 'B', and 'C' together) + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx A signed argument is represented in excess K; that is, the number value is the unsigned value minus K. K is exactly the maximum value @@ -35,20 +35,20 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ /* ** size and position of opcode arguments. */ -#define SIZE_C 9 -#define SIZE_B 9 -#define SIZE_Bx (SIZE_C + SIZE_B) -#define SIZE_A 8 -#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 +#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) -#define SIZE_OP 6 +#define SIZE_OP 6 -#define POS_OP 0 -#define POS_A (POS_OP + SIZE_OP) -#define POS_C (POS_A + SIZE_A) -#define POS_B (POS_C + SIZE_C) -#define POS_Bx POS_C -#define POS_Ax POS_A +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C +#define POS_Ax POS_A /* @@ -65,9 +65,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ #endif #if SIZE_Ax < LUAI_BITSINT-1 -#define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) -#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ +#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ ((cast(Instruction, o)<>pos) & MASK1(size,0))) -#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ - ((cast(Instruction, v)<>pos) & MASK1(size,0))) +#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ + ((cast(Instruction, v)<= R(A) + 1 */ -OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ -OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ -OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ +OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A) + 1 */ +OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ +OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ +OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ -OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ -OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ +OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ -OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ -OP_FORLOOP,/* A sBx R(A)+=R(A+2); - if R(A) > 4) & 3)) -#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) -#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) -#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ /* number of list items to accumulate before a SETLIST instruction */ -#define LFIELDS_PER_FLUSH 50 +#define LFIELDS_PER_FLUSH 50 #endif diff --git a/src/lib/lua/lparser.h b/src/lib/lua/lparser.h index 0346e3c41a8..f63a4ee9dab 100644 --- a/src/lib/lua/lparser.h +++ b/src/lib/lua/lparser.h @@ -17,74 +17,74 @@ */ typedef enum { - VVOID, /* no value */ - VNIL, - VTRUE, - VFALSE, - VK, /* info = index of constant in `k' */ - VKNUM, /* nval = numerical value */ - VNONRELOC, /* info = result register */ - VLOCAL, /* info = local register */ - VUPVAL, /* info = index of upvalue in 'upvalues' */ - VINDEXED, /* t = table register/upvalue; idx = index R/K */ - VJMP, /* info = instruction pc */ - VRELOCABLE, /* info = instruction pc */ - VCALL, /* info = instruction pc */ - VVARARG /* info = instruction pc */ + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VNONRELOC, /* info = result register */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in 'upvalues' */ + VINDEXED, /* t = table register/upvalue; idx = index R/K */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ } expkind; -#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) -#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) +#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) +#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) typedef struct expdesc { - expkind k; - union { - struct { /* for indexed variables (VINDEXED) */ - short idx; /* index (R/K) */ - lu_byte t; /* table (register or upvalue) */ - lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ - } ind; - int info; /* for generic use */ - lua_Number nval; /* for VKNUM */ - } u; - int t; /* patch list of `exit when true' */ - int f; /* patch list of `exit when false' */ + expkind k; + union { + struct { /* for indexed variables (VINDEXED) */ + short idx; /* index (R/K) */ + lu_byte t; /* table (register or upvalue) */ + lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ + } ind; + int info; /* for generic use */ + lua_Number nval; /* for VKNUM */ + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ } expdesc; /* description of active local variable */ typedef struct Vardesc { - short idx; /* variable index in stack */ + short idx; /* variable index in stack */ } Vardesc; /* description of pending goto statements and label statements */ typedef struct Labeldesc { - TString *name; /* label identifier */ - int pc; /* position in code */ - int line; /* line where it appeared */ - lu_byte nactvar; /* local level where it appears in current block */ + TString *name; /* label identifier */ + int pc; /* position in code */ + int line; /* line where it appeared */ + lu_byte nactvar; /* local level where it appears in current block */ } Labeldesc; /* list of labels or gotos */ typedef struct Labellist { - Labeldesc *arr; /* array */ - int n; /* number of entries in use */ - int size; /* array size */ + Labeldesc *arr; /* array */ + int n; /* number of entries in use */ + int size; /* array size */ } Labellist; /* dynamic structures used by the parser */ typedef struct Dyndata { - struct { /* list of active local variables */ - Vardesc *arr; - int n; - int size; - } actvar; - Labellist gt; /* list of pending gotos */ - Labellist label; /* list of active labels */ + struct { /* list of active local variables */ + Vardesc *arr; + int n; + int size; + } actvar; + Labellist gt; /* list of pending gotos */ + Labellist label; /* list of active labels */ } Dyndata; @@ -94,26 +94,26 @@ struct BlockCnt; /* defined in lparser.c */ /* state needed to generate code for a given function */ typedef struct FuncState { - Proto *f; /* current function header */ - Table *h; /* table to find (and reuse) elements in `k' */ - struct FuncState *prev; /* enclosing function */ - struct LexState *ls; /* lexical state */ - struct BlockCnt *bl; /* chain of current blocks */ - int pc; /* next position to code (equivalent to `ncode') */ - int lasttarget; /* 'label' of last 'jump label' */ - int jpc; /* list of pending jumps to `pc' */ - int nk; /* number of elements in `k' */ - int np; /* number of elements in `p' */ - int firstlocal; /* index of first local var (in Dyndata array) */ - short nlocvars; /* number of elements in 'f->locvars' */ - lu_byte nactvar; /* number of active local variables */ - lu_byte nups; /* number of upvalues */ - lu_byte freereg; /* first free register */ + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* 'label' of last 'jump label' */ + int jpc; /* list of pending jumps to `pc' */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + int firstlocal; /* index of first local var (in Dyndata array) */ + short nlocvars; /* number of elements in 'f->locvars' */ + lu_byte nactvar; /* number of active local variables */ + lu_byte nups; /* number of upvalues */ + lu_byte freereg; /* first free register */ } FuncState; LUAI_FUNC Closure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar); + Dyndata *dyd, const char *name, int firstchar); #endif diff --git a/src/lib/lua/lstate.h b/src/lib/lua/lstate.h index daffd9aacfb..0d30369f809 100644 --- a/src/lib/lua/lstate.h +++ b/src/lib/lua/lstate.h @@ -51,15 +51,15 @@ struct lua_longjmp; /* defined in ldo.c */ /* kinds of Garbage Collection */ -#define KGC_NORMAL 0 -#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ -#define KGC_GEN 2 /* generational collection */ +#define KGC_NORMAL 0 +#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ +#define KGC_GEN 2 /* generational collection */ typedef struct stringtable { - GCObject **hash; - lu_int32 nuse; /* number of elements */ - int size; + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; } stringtable; @@ -67,84 +67,84 @@ typedef struct stringtable { ** information about a call */ typedef struct CallInfo { - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ - struct CallInfo *previous, *next; /* dynamic call link */ - short nresults; /* expected number of results from this function */ - lu_byte callstatus; - ptrdiff_t extra; - union { - struct { /* only for Lua functions */ - StkId base; /* base for this function */ - const Instruction *savedpc; - } l; - struct { /* only for C functions */ - int ctx; /* context info. in case of yields */ - lua_CFunction k; /* continuation in case of yields */ - ptrdiff_t old_errfunc; - lu_byte old_allowhook; - lu_byte status; - } c; - } u; + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + struct CallInfo *previous, *next; /* dynamic call link */ + short nresults; /* expected number of results from this function */ + lu_byte callstatus; + ptrdiff_t extra; + union { + struct { /* only for Lua functions */ + StkId base; /* base for this function */ + const Instruction *savedpc; + } l; + struct { /* only for C functions */ + int ctx; /* context info. in case of yields */ + lua_CFunction k; /* continuation in case of yields */ + ptrdiff_t old_errfunc; + lu_byte old_allowhook; + lu_byte status; + } c; + } u; } CallInfo; /* ** Bits in CallInfo status */ -#define CIST_LUA (1<<0) /* call is running a Lua function */ -#define CIST_HOOKED (1<<1) /* call is running a debug hook */ -#define CIST_REENTRY (1<<2) /* call is running on same invocation of +#define CIST_LUA (1<<0) /* call is running a Lua function */ +#define CIST_HOOKED (1<<1) /* call is running a debug hook */ +#define CIST_REENTRY (1<<2) /* call is running on same invocation of luaV_execute of previous call */ -#define CIST_YIELDED (1<<3) /* call reentered after suspension */ -#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ -#define CIST_STAT (1<<5) /* call has an error status (pcall) */ -#define CIST_TAIL (1<<6) /* call was tail called */ -#define CIST_HOOKYIELD (1<<7) /* last hook called yielded */ +#define CIST_YIELDED (1<<3) /* call reentered after suspension */ +#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ +#define CIST_STAT (1<<5) /* call has an error status (pcall) */ +#define CIST_TAIL (1<<6) /* call was tail called */ +#define CIST_HOOKYIELD (1<<7) /* last hook called yielded */ -#define isLua(ci) ((ci)->callstatus & CIST_LUA) +#define isLua(ci) ((ci)->callstatus & CIST_LUA) /* ** `global state', shared by all threads of this state */ typedef struct global_State { - lua_Alloc frealloc; /* function to reallocate memory */ - void *ud; /* auxiliary data to `frealloc' */ - lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */ - l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ - lu_mem GCmemtrav; /* memory traversed by the GC */ - lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ - stringtable strt; /* hash table for strings */ - TValue l_registry; - unsigned int seed; /* randomized seed for hashes */ - lu_byte currentwhite; - lu_byte gcstate; /* state of garbage collector */ - lu_byte gckind; /* kind of GC running */ - lu_byte gcrunning; /* true if GC is running */ - int sweepstrgc; /* position of sweep in `strt' */ - GCObject *allgc; /* list of all collectable objects */ - GCObject *finobj; /* list of collectable objects with finalizers */ - GCObject **sweepgc; /* current position of sweep in list 'allgc' */ - GCObject **sweepfin; /* current position of sweep in list 'finobj' */ - GCObject *gray; /* list of gray objects */ - GCObject *grayagain; /* list of objects to be traversed atomically */ - GCObject *weak; /* list of tables with weak values */ - GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ - GCObject *allweak; /* list of all-weak tables */ - GCObject *tobefnz; /* list of userdata to be GC */ - UpVal uvhead; /* head of double-linked list of all open upvalues */ - Mbuffer buff; /* temporary buffer for string concatenation */ - int gcpause; /* size of pause between successive GCs */ - int gcmajorinc; /* pause between major collections (only in gen. mode) */ - int gcstepmul; /* GC `granularity' */ - lua_CFunction panic; /* to be called in unprotected errors */ - struct lua_State *mainthread; - const lua_Number *version; /* pointer to version number */ - TString *memerrmsg; /* memory-error message */ - TString *tmname[TM_N]; /* array with tag-method names */ - struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */ + l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ + lu_mem GCmemtrav; /* memory traversed by the GC */ + lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ + stringtable strt; /* hash table for strings */ + TValue l_registry; + unsigned int seed; /* randomized seed for hashes */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + lu_byte gckind; /* kind of GC running */ + lu_byte gcrunning; /* true if GC is running */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *allgc; /* list of all collectable objects */ + GCObject *finobj; /* list of collectable objects with finalizers */ + GCObject **sweepgc; /* current position of sweep in list 'allgc' */ + GCObject **sweepfin; /* current position of sweep in list 'finobj' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of tables with weak values */ + GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ + GCObject *allweak; /* list of all-weak tables */ + GCObject *tobefnz; /* list of userdata to be GC */ + UpVal uvhead; /* head of double-linked list of all open upvalues */ + Mbuffer buff; /* temporary buffer for string concatenation */ + int gcpause; /* size of pause between successive GCs */ + int gcmajorinc; /* pause between major collections (only in gen. mode) */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + struct lua_State *mainthread; + const lua_Number *version; /* pointer to version number */ + TString *memerrmsg; /* memory-error message */ + TString *tmname[TM_N]; /* array with tag-method names */ + struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ } global_State; @@ -152,71 +152,71 @@ typedef struct global_State { ** `per thread' state */ struct lua_State { - CommonHeader; - lu_byte status; - StkId top; /* first free slot in the stack */ - global_State *l_G; - CallInfo *ci; /* call info for current function */ - const Instruction *oldpc; /* last pc traced */ - StkId stack_last; /* last free slot in the stack */ - StkId stack; /* stack base */ - int stacksize; - unsigned short nny; /* number of non-yieldable calls in stack */ - unsigned short nCcalls; /* number of nested C calls */ - lu_byte hookmask; - lu_byte allowhook; - int basehookcount; - int hookcount; - lua_Hook hook; - GCObject *openupval; /* list of open upvalues in this stack */ - GCObject *gclist; - struct lua_longjmp *errorJmp; /* current error recover point */ - ptrdiff_t errfunc; /* current error handling function (stack index) */ - CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *oldpc; /* last pc traced */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + int stacksize; + unsigned short nny; /* number of non-yieldable calls in stack */ + unsigned short nCcalls; /* number of nested C calls */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ + CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ }; -#define G(L) (L->l_G) +#define G(L) (L->l_G) /* ** Union of all collectable objects */ union GCObject { - GCheader gch; /* common header */ - union TString ts; - union Udata u; - union Closure cl; - struct Table h; - struct Proto p; - struct UpVal uv; - struct lua_State th; /* thread */ + GCheader gch; /* common header */ + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ }; -#define gch(o) (&(o)->gch) +#define gch(o) (&(o)->gch) /* macros to convert a GCObject into a specific value */ #define rawgco2ts(o) \ check_exp(novariant((o)->gch.tt) == LUA_TSTRING, &((o)->ts)) -#define gco2ts(o) (&rawgco2ts(o)->tsv) -#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) -#define gco2u(o) (&rawgco2u(o)->uv) -#define gco2lcl(o) check_exp((o)->gch.tt == LUA_TLCL, &((o)->cl.l)) -#define gco2ccl(o) check_exp((o)->gch.tt == LUA_TCCL, &((o)->cl.c)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2lcl(o) check_exp((o)->gch.tt == LUA_TLCL, &((o)->cl.l)) +#define gco2ccl(o) check_exp((o)->gch.tt == LUA_TCCL, &((o)->cl.c)) #define gco2cl(o) \ check_exp(novariant((o)->gch.tt) == LUA_TFUNCTION, &((o)->cl)) -#define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) -#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) -#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) -#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) +#define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) /* macro to convert any Lua object into a GCObject */ -#define obj2gco(v) (cast(GCObject *, (v))) +#define obj2gco(v) (cast(GCObject *, (v))) /* actual number of total bytes allocated */ -#define gettotalbytes(g) ((g)->totalbytes + (g)->GCdebt) +#define gettotalbytes(g) ((g)->totalbytes + (g)->GCdebt) LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); @@ -225,4 +225,3 @@ LUAI_FUNC void luaE_freeCI (lua_State *L); #endif - diff --git a/src/lib/lua/lstring.h b/src/lib/lua/lstring.h index 260e7f169bd..025010a7c7f 100644 --- a/src/lib/lua/lstring.h +++ b/src/lib/lua/lstring.h @@ -12,26 +12,26 @@ #include "lstate.h" -#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) -#define sizeudata(u) (sizeof(union Udata)+(u)->len) +#define sizeudata(u) (sizeof(union Udata)+(u)->len) -#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ - (sizeof(s)/sizeof(char))-1)) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) -#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) /* ** test whether a string is a reserved word */ -#define isreserved(s) ((s)->tsv.tt == LUA_TSHRSTR && (s)->tsv.extra > 0) +#define isreserved(s) ((s)->tsv.tt == LUA_TSHRSTR && (s)->tsv.extra > 0) /* ** equality for short strings, which are always internalized */ -#define eqshrstr(a,b) check_exp((a)->tsv.tt == LUA_TSHRSTR, (a) == (b)) +#define eqshrstr(a,b) check_exp((a)->tsv.tt == LUA_TSHRSTR, (a) == (b)) LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); diff --git a/src/lib/lua/ltable.h b/src/lib/lua/ltable.h index d69449b2b86..622063469e3 100644 --- a/src/lib/lua/ltable.h +++ b/src/lib/lua/ltable.h @@ -10,16 +10,16 @@ #include "lobject.h" -#define gnode(t,i) (&(t)->node[i]) -#define gkey(n) (&(n)->i_key.tvk) -#define gval(n) (&(n)->i_val) -#define gnext(n) ((n)->i_key.nk.next) +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.tvk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) -#define invalidateTMcache(t) ((t)->flags = 0) +#define invalidateTMcache(t) ((t)->flags = 0) /* returns the key, given the value of a table entry */ #define keyfromval(v) \ - (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) + (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) LUAI_FUNC const TValue *luaH_getint (Table *t, int key); diff --git a/src/lib/lua/ltm.h b/src/lib/lua/ltm.h index 7f89c841f9c..a83be3a9a9e 100644 --- a/src/lib/lua/ltm.h +++ b/src/lib/lua/ltm.h @@ -16,42 +16,42 @@ * grep "ORDER TM" */ typedef enum { - TM_INDEX, - TM_NEWINDEX, - TM_GC, - TM_MODE, - TM_LEN, - TM_EQ, /* last tag method with `fast' access */ - TM_ADD, - TM_SUB, - TM_MUL, - TM_DIV, - TM_MOD, - TM_POW, - TM_UNM, - TM_LT, - TM_LE, - TM_CONCAT, - TM_CALL, - TM_N /* number of elements in the enum */ + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_LEN, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ } TMS; #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ - ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) -#define fasttm(l,et,e) gfasttm(G(l), et, e) +#define fasttm(l,et,e) gfasttm(G(l), et, e) -#define ttypename(x) luaT_typenames_[(x) + 1] -#define objtypename(x) ttypename(ttypenv(x)) +#define ttypename(x) luaT_typenames_[(x) + 1] +#define objtypename(x) ttypename(ttypenv(x)) LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, - TMS event); + TMS event); LUAI_FUNC void luaT_init (lua_State *L); #endif diff --git a/src/lib/lua/lua.h b/src/lib/lua/lua.h index 149a2c37bcd..1eb6b340bed 100644 --- a/src/lib/lua/lua.h +++ b/src/lib/lua/lua.h @@ -16,39 +16,39 @@ #include "luaconf.h" -#define LUA_VERSION_MAJOR "5" -#define LUA_VERSION_MINOR "2" -#define LUA_VERSION_NUM 502 -#define LUA_VERSION_RELEASE "3" +#define LUA_VERSION_MAJOR "5" +#define LUA_VERSION_MINOR "2" +#define LUA_VERSION_NUM 502 +#define LUA_VERSION_RELEASE "3" -#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR -#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE -#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2013 Lua.org, PUC-Rio" -#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" +#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2013 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" /* mark for precompiled code ('Lua') */ -#define LUA_SIGNATURE "\033Lua" +#define LUA_SIGNATURE "\033Lua" /* option for multiple returns in 'lua_pcall' and 'lua_call' */ -#define LUA_MULTRET (-1) +#define LUA_MULTRET (-1) /* ** pseudo-indices */ -#define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX -#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) +#define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX +#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) /* thread status */ -#define LUA_OK 0 -#define LUA_YIELD 1 -#define LUA_ERRRUN 2 -#define LUA_ERRSYNTAX 3 -#define LUA_ERRMEM 4 -#define LUA_ERRGCMM 5 -#define LUA_ERRERR 6 +#define LUA_OK 0 +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRGCMM 5 +#define LUA_ERRERR 6 typedef struct lua_State lua_State; @@ -73,30 +73,30 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); /* ** basic types */ -#define LUA_TNONE (-1) +#define LUA_TNONE (-1) -#define LUA_TNIL 0 -#define LUA_TBOOLEAN 1 -#define LUA_TLIGHTUSERDATA 2 -#define LUA_TNUMBER 3 -#define LUA_TSTRING 4 -#define LUA_TTABLE 5 -#define LUA_TFUNCTION 6 -#define LUA_TUSERDATA 7 -#define LUA_TTHREAD 8 +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 -#define LUA_NUMTAGS 9 +#define LUA_NUMTAGS 9 /* minimum Lua stack available to a C function */ -#define LUA_MINSTACK 20 +#define LUA_MINSTACK 20 /* predefined values in the registry */ -#define LUA_RIDX_MAINTHREAD 1 -#define LUA_RIDX_GLOBALS 2 -#define LUA_RIDX_LAST LUA_RIDX_GLOBALS +#define LUA_RIDX_MAINTHREAD 1 +#define LUA_RIDX_GLOBALS 2 +#define LUA_RIDX_LAST LUA_RIDX_GLOBALS /* type of numbers in Lua */ @@ -172,7 +172,7 @@ LUA_API int (lua_toboolean) (lua_State *L, int idx); LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); LUA_API size_t (lua_rawlen) (lua_State *L, int idx); LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); -LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); LUA_API const void *(lua_topointer) (lua_State *L, int idx); @@ -181,19 +181,19 @@ LUA_API const void *(lua_topointer) (lua_State *L, int idx); ** Comparison and arithmetic functions */ -#define LUA_OPADD 0 /* ORDER TM */ -#define LUA_OPSUB 1 -#define LUA_OPMUL 2 -#define LUA_OPDIV 3 -#define LUA_OPMOD 4 -#define LUA_OPPOW 5 -#define LUA_OPUNM 6 +#define LUA_OPADD 0 /* ORDER TM */ +#define LUA_OPSUB 1 +#define LUA_OPMUL 2 +#define LUA_OPDIV 3 +#define LUA_OPMOD 4 +#define LUA_OPPOW 5 +#define LUA_OPUNM 6 LUA_API void (lua_arith) (lua_State *L, int op); -#define LUA_OPEQ 0 -#define LUA_OPLT 1 -#define LUA_OPLE 2 +#define LUA_OPEQ 0 +#define LUA_OPLT 1 +#define LUA_OPLE 2 LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); @@ -209,7 +209,7 @@ LUA_API void (lua_pushunsigned) (lua_State *L, lua_Unsigned n); LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t l); LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, - va_list argp); + va_list argp); LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); LUA_API void (lua_pushboolean) (lua_State *L, int b); @@ -249,18 +249,18 @@ LUA_API void (lua_setuservalue) (lua_State *L, int idx); ** 'load' and 'call' functions (load and run Lua code) */ LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx, - lua_CFunction k); -#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) + lua_CFunction k); +#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) LUA_API int (lua_getctx) (lua_State *L, int *ctx); LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, - int ctx, lua_CFunction k); -#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) + int ctx, lua_CFunction k); +#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, - const char *chunkname, - const char *mode); + const char *chunkname, + const char *mode); LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); @@ -269,8 +269,8 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); ** coroutine functions */ LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx, - lua_CFunction k); -#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) + lua_CFunction k); +#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); LUA_API int (lua_status) (lua_State *L); @@ -278,18 +278,18 @@ LUA_API int (lua_status) (lua_State *L); ** garbage-collection function and options */ -#define LUA_GCSTOP 0 -#define LUA_GCRESTART 1 -#define LUA_GCCOLLECT 2 -#define LUA_GCCOUNT 3 -#define LUA_GCCOUNTB 4 -#define LUA_GCSTEP 5 -#define LUA_GCSETPAUSE 6 -#define LUA_GCSETSTEPMUL 7 -#define LUA_GCSETMAJORINC 8 -#define LUA_GCISRUNNING 9 -#define LUA_GCGEN 10 -#define LUA_GCINC 11 +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 +#define LUA_GCSETMAJORINC 8 +#define LUA_GCISRUNNING 9 +#define LUA_GCGEN 10 +#define LUA_GCINC 11 LUA_API int (lua_gc) (lua_State *L, int what, int data); @@ -316,34 +316,34 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); ** =============================================================== */ -#define lua_tonumber(L,i) lua_tonumberx(L,i,NULL) -#define lua_tointeger(L,i) lua_tointegerx(L,i,NULL) -#define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL) +#define lua_tonumber(L,i) lua_tonumberx(L,i,NULL) +#define lua_tointeger(L,i) lua_tointegerx(L,i,NULL) +#define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL) -#define lua_pop(L,n) lua_settop(L, -(n)-1) +#define lua_pop(L,n) lua_settop(L, -(n)-1) -#define lua_newtable(L) lua_createtable(L, 0, 0) +#define lua_newtable(L) lua_createtable(L, 0, 0) #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) -#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) -#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) -#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) -#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) -#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) -#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) -#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) -#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) -#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) -#define lua_pushliteral(L, s) \ +#define lua_pushliteral(L, s) \ lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) #define lua_pushglobaltable(L) \ lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS) -#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) @@ -357,20 +357,20 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); /* ** Event codes */ -#define LUA_HOOKCALL 0 -#define LUA_HOOKRET 1 -#define LUA_HOOKLINE 2 -#define LUA_HOOKCOUNT 3 +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 #define LUA_HOOKTAILCALL 4 /* ** Event masks */ -#define LUA_MASKCALL (1 << LUA_HOOKCALL) -#define LUA_MASKRET (1 << LUA_HOOKRET) -#define LUA_MASKLINE (1 << LUA_HOOKLINE) -#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) typedef struct lua_Debug lua_Debug; /* activation record */ @@ -388,7 +388,7 @@ LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, - int fidx2, int n2); + int fidx2, int n2); LUA_API int (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); LUA_API lua_Hook (lua_gethook) (lua_State *L); @@ -397,21 +397,21 @@ LUA_API int (lua_gethookcount) (lua_State *L); struct lua_Debug { - int event; - const char *name; /* (n) */ - const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ - const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ - const char *source; /* (S) */ - int currentline; /* (l) */ - int linedefined; /* (S) */ - int lastlinedefined; /* (S) */ - unsigned char nups; /* (u) number of upvalues */ - unsigned char nparams;/* (u) number of parameters */ - char isvararg; /* (u) */ - char istailcall; /* (t) */ - char short_src[LUA_IDSIZE]; /* (S) */ - /* private part */ - struct CallInfo *i_ci; /* active function */ + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ + const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + unsigned char nups; /* (u) number of upvalues */ + unsigned char nparams;/* (u) number of parameters */ + char isvararg; /* (u) */ + char istailcall; /* (t) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + struct CallInfo *i_ci; /* active function */ }; /* }====================================================================== */ diff --git a/src/lib/lua/luaconf.h b/src/lib/lua/luaconf.h index 18be9a9e436..823661dcbe5 100644 --- a/src/lib/lua/luaconf.h +++ b/src/lib/lua/luaconf.h @@ -30,32 +30,32 @@ #if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE) -#define LUA_WIN /* enable goodies for regular Windows platforms */ +#define LUA_WIN /* enable goodies for regular Windows platforms */ #endif #if defined(LUA_WIN) #define LUA_DL_DLL -#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ +#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ #endif #if defined(LUA_USE_LINUX) #define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ -#define LUA_USE_READLINE /* needs some extra libraries */ -#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ -#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ -#define LUA_USE_LONGLONG /* assume support for long long */ +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ +#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ +#define LUA_USE_LONGLONG /* assume support for long long */ #endif #if defined(LUA_USE_MACOSX) #define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* does not need -ldl */ -#define LUA_USE_READLINE /* needs an extra library: -lreadline */ -#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ -#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ -#define LUA_USE_LONGLONG /* assume support for long long */ +#define LUA_USE_DLOPEN /* does not need -ldl */ +#define LUA_USE_READLINE /* needs an extra library: -lreadline */ +#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ +#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ +#define LUA_USE_LONGLONG /* assume support for long long */ #endif @@ -84,31 +84,31 @@ ** hierarchy or if you want to install your libraries in ** non-conventional directories. */ -#if defined(_WIN32) /* { */ +#if defined(_WIN32) /* { */ /* ** In Windows, any exclamation mark ('!') in the path is replaced by the ** path of the directory of the executable file of the current process. */ -#define LUA_LDIR "!\\lua\\" -#define LUA_CDIR "!\\" +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" ".\\?.lua" #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll" -#else /* }{ */ +#else /* }{ */ -#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/" -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/" +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR +#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" "./?.lua" #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" -#endif /* } */ +#endif /* } */ /* @@ -117,9 +117,9 @@ ** and is not Windows. (On Windows Lua automatically uses "\".) */ #if defined(_WIN32) -#define LUA_DIRSEP "\\" +#define LUA_DIRSEP "\\" #else -#define LUA_DIRSEP "/" +#define LUA_DIRSEP "/" #endif @@ -128,7 +128,7 @@ @@ environment, used to access global names. ** CHANGE it if you do not like this name. */ -#define LUA_ENV "_ENV" +#define LUA_ENV "_ENV" /* @@ -140,24 +140,24 @@ ** the libraries, you may want to use the following definition (define ** LUA_BUILD_AS_DLL to get it). */ -#if defined(LUA_BUILD_AS_DLL) /* { */ +#if defined(LUA_BUILD_AS_DLL) /* { */ -#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ #define LUA_API __declspec(dllexport) -#else /* }{ */ +#else /* }{ */ #define LUA_API __declspec(dllimport) -#endif /* } */ +#endif /* } */ -#else /* }{ */ +#else /* }{ */ -#define LUA_API extern +#define LUA_API extern -#endif /* } */ +#endif /* } */ /* more often than not the libs go together with the core */ -#define LUALIB_API LUA_API -#define LUAMOD_API LUALIB_API +#define LUALIB_API LUA_API +#define LUAMOD_API LUALIB_API /* @@ -175,16 +175,16 @@ ** default definition. */ #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) /* { */ -#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -#define LUAI_DDEC LUAI_FUNC -#define LUAI_DDEF /* empty */ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DDEC LUAI_FUNC +#define LUAI_DDEF /* empty */ -#else /* }{ */ -#define LUAI_FUNC extern -#define LUAI_DDEC extern -#define LUAI_DDEF /* empty */ -#endif /* } */ +#else /* }{ */ +#define LUAI_FUNC extern +#define LUAI_DDEC extern +#define LUAI_DDEF /* empty */ +#endif /* } */ @@ -192,8 +192,8 @@ @@ LUA_QL describes how error messages quote program elements. ** CHANGE it if you want a different appearance. */ -#define LUA_QL(x) "'" x "'" -#define LUA_QS LUA_QL("%s") +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") /* @@ -201,7 +201,7 @@ @* of a function in debug information. ** CHANGE it if you want a different size. */ -#define LUA_IDSIZE 60 +#define LUA_IDSIZE 60 /* @@ -211,8 +211,8 @@ */ #if defined(LUA_LIB) || defined(lua_c) #include -#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) -#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) +#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) #endif /* @@ -244,7 +244,7 @@ ** You can define it to get all options, or change specific options ** to fit your specific needs. */ -#if defined(LUA_COMPAT_ALL) /* { */ +#if defined(LUA_COMPAT_ALL) /* { */ /* @@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. @@ -264,8 +264,8 @@ */ #define lua_cpcall(L,f,u) \ (lua_pushcfunction(L, (f)), \ - lua_pushlightuserdata(L,(u)), \ - lua_pcall(L,1,0,0)) + lua_pushlightuserdata(L,(u)), \ + lua_pcall(L,1,0,0)) /* @@ -290,12 +290,12 @@ ** changes in the API. The macros themselves document how to ** change your code to avoid using them. */ -#define lua_strlen(L,i) lua_rawlen(L, (i)) +#define lua_strlen(L,i) lua_rawlen(L, (i)) -#define lua_objlen(L,i) lua_rawlen(L, (i)) +#define lua_objlen(L,i) lua_rawlen(L, (i)) -#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) -#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) /* @@ LUA_COMPAT_MODULE controls compatibility with previous @@ -303,7 +303,7 @@ */ #define LUA_COMPAT_MODULE -#endif /* } */ +#endif /* } */ /* }================================================================== */ @@ -315,14 +315,14 @@ ** your machine. Probably you do not need to change this. */ /* avoid overflows in comparison */ -#if INT_MAX-20 < 32760 /* { */ -#define LUAI_BITSINT 16 -#elif INT_MAX > 2147483640L /* }{ */ +#if INT_MAX-20 < 32760 /* { */ +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L /* }{ */ /* int has at least 32 bits */ -#define LUAI_BITSINT 32 -#else /* }{ */ +#define LUAI_BITSINT 32 +#else /* }{ */ #error "you must define LUA_BITSINT with number of bits in an integer" -#endif /* } */ +#endif /* } */ /* @@ -335,16 +335,16 @@ ** good enough for your machine. Probably you do not need to change ** this. */ -#if LUAI_BITSINT >= 32 /* { */ -#define LUA_INT32 int -#define LUAI_UMEM size_t -#define LUAI_MEM ptrdiff_t -#else /* }{ */ +#if LUAI_BITSINT >= 32 /* { */ +#define LUA_INT32 int +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else /* }{ */ /* 16-bit ints */ -#define LUA_INT32 long -#define LUAI_UMEM unsigned long -#define LUAI_MEM long -#endif /* } */ +#define LUA_INT32 long +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif /* } */ /* @@ -354,13 +354,13 @@ ** space (and to reserve some numbers for pseudo-indices). */ #if LUAI_BITSINT >= 32 -#define LUAI_MAXSTACK 1000000 +#define LUAI_MAXSTACK 1000000 #else -#define LUAI_MAXSTACK 15000 +#define LUAI_MAXSTACK 15000 #endif /* reserve some space for error handling */ -#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) +#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) @@ -369,7 +369,7 @@ @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. ** CHANGE it if it uses too much C-stack space. */ -#define LUAL_BUFFERSIZE BUFSIZ +#define LUAL_BUFFERSIZE BUFSIZ @@ -384,13 +384,13 @@ */ #define LUA_NUMBER_DOUBLE -#define LUA_NUMBER double +#define LUA_NUMBER double /* @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @* over a number. */ -#define LUAI_UACNUMBER double +#define LUAI_UACNUMBER double /* @@ -399,16 +399,16 @@ @@ lua_number2str converts a number to a string. @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. */ -#define LUA_NUMBER_SCAN "%lf" -#define LUA_NUMBER_FMT "%.14g" -#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) -#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ /* @@ l_mathop allows the addition of an 'l' or 'f' to all math operations */ -#define l_mathop(x) (x) +#define l_mathop(x) (x) /* @@ -419,10 +419,10 @@ ** systems, you can leave 'lua_strx2number' undefined and Lua will ** provide its own implementation. */ -#define lua_str2number(s,p) strtod((s), (p)) +#define lua_str2number(s,p) strtod((s), (p)) #if defined(LUA_USE_STRTODHEX) -#define lua_strx2number(s,p) strtod((s), (p)) +#define lua_strx2number(s,p) strtod((s), (p)) #endif @@ -433,21 +433,21 @@ /* the following operations need the math library */ #if defined(lobject_c) || defined(lvm_c) #include -#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) -#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) +#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) +#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) #endif /* these are quite standard operations */ #if defined(LUA_CORE) -#define luai_numadd(L,a,b) ((a)+(b)) -#define luai_numsub(L,a,b) ((a)-(b)) -#define luai_nummul(L,a,b) ((a)*(b)) -#define luai_numdiv(L,a,b) ((a)/(b)) -#define luai_numunm(L,a) (-(a)) -#define luai_numeq(a,b) ((a)==(b)) -#define luai_numlt(L,a,b) ((a)<(b)) -#define luai_numle(L,a,b) ((a)<=(b)) -#define luai_numisnan(L,a) (!luai_numeq((a), (a))) +#define luai_numadd(L,a,b) ((a)+(b)) +#define luai_numsub(L,a,b) ((a)-(b)) +#define luai_nummul(L,a,b) ((a)*(b)) +#define luai_numdiv(L,a,b) ((a)/(b)) +#define luai_numunm(L,a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(L,a,b) ((a)<(b)) +#define luai_numle(L,a,b) ((a)<=(b)) +#define luai_numisnan(L,a) (!luai_numeq((a), (a))) #endif @@ -457,13 +457,13 @@ ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** machines, ptrdiff_t gives a good choice between int or long.) */ -#define LUA_INTEGER ptrdiff_t +#define LUA_INTEGER ptrdiff_t /* @@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. ** It must have at least 32 bits. */ -#define LUA_UNSIGNED unsigned LUA_INT32 +#define LUA_UNSIGNED unsigned LUA_INT32 @@ -471,7 +471,7 @@ ** Some tricks with doubles */ -#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ /* ** The next definitions activate some tricks to speed up the ** conversion from doubles to integer types, mainly to LUA_UNSIGNED. @@ -498,10 +498,10 @@ */ /* Microsoft compiler on a Pentium (32 bit) ? */ -#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ +#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ #define LUA_MSASMTRICK -#define LUA_IEEEENDIAN 0 +#define LUA_IEEEENDIAN 0 #define LUA_NANTRICK @@ -510,28 +510,28 @@ #define LUA_IEEE754TRICK #define LUA_IEEELL -#define LUA_IEEEENDIAN 0 +#define LUA_IEEEENDIAN 0 #define LUA_NANTRICK /* pentium 64 bits? */ -#elif defined(__x86_64) /* }{ */ +#elif defined(__x86_64) /* }{ */ #define LUA_IEEE754TRICK -#define LUA_IEEEENDIAN 0 +#define LUA_IEEEENDIAN 0 -#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */ +#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */ #define LUA_IEEE754TRICK -#define LUA_IEEEENDIAN 1 +#define LUA_IEEEENDIAN 1 -#else /* }{ */ +#else /* }{ */ /* assume IEEE754 and a 32-bit integer type */ #define LUA_IEEE754TRICK -#endif /* } */ +#endif /* } */ -#endif /* } */ +#endif /* } */ /* }================================================================== */ @@ -548,4 +548,3 @@ #endif - diff --git a/src/lib/lua/lualib.h b/src/lib/lua/lualib.h index da82005c9de..1b07f0b07c2 100644 --- a/src/lib/lua/lualib.h +++ b/src/lib/lua/lualib.h @@ -14,31 +14,31 @@ LUAMOD_API int (luaopen_base) (lua_State *L); -#define LUA_COLIBNAME "coroutine" +#define LUA_COLIBNAME "coroutine" LUAMOD_API int (luaopen_coroutine) (lua_State *L); -#define LUA_TABLIBNAME "table" +#define LUA_TABLIBNAME "table" LUAMOD_API int (luaopen_table) (lua_State *L); -#define LUA_IOLIBNAME "io" +#define LUA_IOLIBNAME "io" LUAMOD_API int (luaopen_io) (lua_State *L); -#define LUA_OSLIBNAME "os" +#define LUA_OSLIBNAME "os" LUAMOD_API int (luaopen_os) (lua_State *L); -#define LUA_STRLIBNAME "string" +#define LUA_STRLIBNAME "string" LUAMOD_API int (luaopen_string) (lua_State *L); -#define LUA_BITLIBNAME "bit32" +#define LUA_BITLIBNAME "bit32" LUAMOD_API int (luaopen_bit32) (lua_State *L); -#define LUA_MATHLIBNAME "math" +#define LUA_MATHLIBNAME "math" LUAMOD_API int (luaopen_math) (lua_State *L); -#define LUA_DBLIBNAME "debug" +#define LUA_DBLIBNAME "debug" LUAMOD_API int (luaopen_debug) (lua_State *L); -#define LUA_LOADLIBNAME "package" +#define LUA_LOADLIBNAME "package" LUAMOD_API int (luaopen_package) (lua_State *L); @@ -48,7 +48,7 @@ LUALIB_API void (luaL_openlibs) (lua_State *L); #if !defined(lua_assert) -#define lua_assert(x) ((void)0) +#define lua_assert(x) ((void)0) #endif diff --git a/src/lib/lua/lundump.h b/src/lib/lua/lundump.h index 5255db259df..67b416c7ff2 100644 --- a/src/lib/lua/lundump.h +++ b/src/lib/lua/lundump.h @@ -20,9 +20,9 @@ LUAI_FUNC void luaU_header (lu_byte* h); LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); /* data to catch conversion errors */ -#define LUAC_TAIL "\x19\x93\r\n\x1a\n" +#define LUAC_TAIL "\x19\x93\r\n\x1a\n" /* size in bytes of header of binary files */ -#define LUAC_HEADERSIZE (sizeof(LUA_SIGNATURE)-sizeof(char)+2+6+sizeof(LUAC_TAIL)-sizeof(char)) +#define LUAC_HEADERSIZE (sizeof(LUA_SIGNATURE)-sizeof(char)+2+6+sizeof(LUAC_TAIL)-sizeof(char)) #endif diff --git a/src/lib/lua/lvm.h b/src/lib/lua/lvm.h index 5380270da63..56e43fd51f5 100644 --- a/src/lib/lua/lvm.h +++ b/src/lib/lua/lvm.h @@ -15,11 +15,11 @@ #define tostring(L,o) (ttisstring(o) || (luaV_tostring(L, o))) -#define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL)) +#define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL)) #define equalobj(L,o1,o2) (ttisequal(o1, o2) && luaV_equalobj_(L, o1, o2)) -#define luaV_rawequalobj(o1,o2) equalobj(NULL,o1,o2) +#define luaV_rawequalobj(o1,o2) equalobj(NULL,o1,o2) /* not to called directly */ @@ -31,14 +31,14 @@ LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, - StkId val); + StkId val); LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, - StkId val); + StkId val); LUAI_FUNC void luaV_finishOp (lua_State *L); LUAI_FUNC void luaV_execute (lua_State *L); LUAI_FUNC void luaV_concat (lua_State *L, int total); LUAI_FUNC void luaV_arith (lua_State *L, StkId ra, const TValue *rb, - const TValue *rc, TMS op); + const TValue *rc, TMS op); LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); #endif diff --git a/src/lib/lua/lzio.h b/src/lib/lua/lzio.h index 441f7479cb1..60e927510e4 100644 --- a/src/lib/lua/lzio.h +++ b/src/lib/lua/lzio.h @@ -13,7 +13,7 @@ #include "lmem.h" -#define EOZ (-1) /* end of stream */ +#define EOZ (-1) /* end of stream */ typedef struct Zio ZIO; @@ -21,16 +21,16 @@ typedef struct Zio ZIO; typedef struct Mbuffer { - char *buffer; - size_t n; - size_t buffsize; + char *buffer; + size_t n; + size_t buffsize; } Mbuffer; #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) -#define luaZ_buffer(buff) ((buff)->buffer) -#define luaZ_sizebuffer(buff) ((buff)->buffsize) -#define luaZ_bufflen(buff) ((buff)->n) +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) #define luaZ_resetbuffer(buff) ((buff)->n = 0) @@ -39,24 +39,24 @@ typedef struct Mbuffer { (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ (buff)->buffsize = size) -#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, - void *data); -LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ /* --------- Private Part ------------------ */ struct Zio { - size_t n; /* bytes still unread */ - const char *p; /* current position in buffer */ - lua_Reader reader; /* reader function */ - void* data; /* additional data */ - lua_State *L; /* Lua state (for reader) */ + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; /* reader function */ + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ }; diff --git a/src/lib/sqlite3/shell.c b/src/lib/sqlite3/shell.c index 3004c467123..d4b7d2cf30b 100644 --- a/src/lib/sqlite3/shell.c +++ b/src/lib/sqlite3/shell.c @@ -3848,4 +3848,4 @@ int main(int argc, char **argv){ } sqlite3_free(data.zFreeOnClose); return rc; -} +} diff --git a/src/lib/sqlite3/sqlite3.h b/src/lib/sqlite3/sqlite3.h index 0884ebad0e0..36f0d2c2e79 100644 --- a/src/lib/sqlite3/sqlite3.h +++ b/src/lib/sqlite3/sqlite3.h @@ -135,8 +135,8 @@ extern "C" { ** function is provided for use in DLLs since DLL users usually do not have ** direct access to string constants within the DLL. ^The ** sqlite3_libversion_number() function returns an integer equal to -** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns -** a pointer to a string constant whose value is the same as the +** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns +** a pointer to a string constant whose value is the same as the ** [SQLITE_SOURCE_ID] C preprocessor macro. ** ** See also: [sqlite_version()] and [sqlite_source_id()]. @@ -149,20 +149,20 @@ SQLITE_API int sqlite3_libversion_number(void); /* ** CAPI3REF: Run-Time Library Compilation Options Diagnostics ** -** ^The sqlite3_compileoption_used() function returns 0 or 1 -** indicating whether the specified option was defined at -** compile time. ^The SQLITE_ prefix may be omitted from the -** option name passed to sqlite3_compileoption_used(). +** ^The sqlite3_compileoption_used() function returns 0 or 1 +** indicating whether the specified option was defined at +** compile time. ^The SQLITE_ prefix may be omitted from the +** option name passed to sqlite3_compileoption_used(). ** ** ^The sqlite3_compileoption_get() function allows iterating ** over the list of options that were defined at compile time by ** returning the N-th compile time option string. ^If N is out of range, -** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ -** prefix is omitted from any strings returned by +** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ +** prefix is omitted from any strings returned by ** sqlite3_compileoption_get(). ** ** ^Support for the diagnostic functions sqlite3_compileoption_used() -** and sqlite3_compileoption_get() may be omitted by specifying the +** and sqlite3_compileoption_get() may be omitted by specifying the ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. ** ** See also: SQL functions [sqlite_compileoption_used()] and @@ -183,7 +183,7 @@ SQLITE_API const char *sqlite3_compileoption_get(int N); ** SQLite can be compiled with or without mutexes. When ** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes ** are enabled and SQLite is threadsafe. When the -** [SQLITE_THREADSAFE] macro is 0, +** [SQLITE_THREADSAFE] macro is 0, ** the mutexes are omitted. Without the mutexes, it is not safe ** to use SQLite concurrently from more than one thread. ** @@ -240,18 +240,18 @@ typedef struct sqlite3 sqlite3; ** ** ^The sqlite3_int64 and sqlite_int64 types can store integer values ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The -** sqlite3_uint64 and sqlite_uint64 types can store integer values +** sqlite3_uint64 and sqlite_uint64 types can store integer values ** between 0 and +18446744073709551615 inclusive. */ #ifdef SQLITE_INT64_TYPE - typedef SQLITE_INT64_TYPE sqlite_int64; - typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; + typedef SQLITE_INT64_TYPE sqlite_int64; + typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; #elif defined(_MSC_VER) || defined(__BORLANDC__) - typedef __int64 sqlite_int64; - typedef unsigned __int64 sqlite_uint64; + typedef __int64 sqlite_int64; + typedef unsigned __int64 sqlite_uint64; #else - typedef long long int sqlite_int64; - typedef unsigned long long int sqlite_uint64; + typedef long long int sqlite_int64; + typedef unsigned long long int sqlite_uint64; #endif typedef sqlite_int64 sqlite3_int64; typedef sqlite_uint64 sqlite3_uint64; @@ -285,7 +285,7 @@ typedef sqlite_uint64 sqlite3_uint64; ** destructors are called is arbitrary. ** ** Applications should [sqlite3_finalize | finalize] all [prepared statements], -** [sqlite3_blob_close | close] all [BLOB handles], and +** [sqlite3_blob_close | close] all [BLOB handles], and ** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated ** with the [sqlite3] object prior to attempting to close the object. ^If ** sqlite3_close_v2() is called on a [database connection] that still has @@ -321,7 +321,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** The sqlite3_exec() interface is a convenience wrapper around ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], ** that allows an application to run multiple statements of SQL -** without having to use a lot of C code. +** without having to use a lot of C code. ** ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, ** semicolon-separate SQL statements passed into its 2nd argument, @@ -361,7 +361,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** from [sqlite3_column_name()]. ** ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer -** to an empty string, or a pointer that contains only whitespace and/or +** to an empty string, or a pointer that contains only whitespace and/or ** SQL comments, then no SQL statements are evaluated and the database ** is not changed. ** @@ -377,11 +377,11 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** */ SQLITE_API int sqlite3_exec( - sqlite3*, /* An open database */ - const char *sql, /* SQL to be evaluated */ - int (*callback)(void*,int,char**,char**), /* Callback function */ - void *, /* 1st argument to callback */ - char **errmsg /* Error msg written here */ + sqlite3*, /* An open database */ + const char *sql, /* SQL to be evaluated */ + int (*callback)(void*,int,char**,char**), /* Callback function */ + void *, /* 1st argument to callback */ + char **errmsg /* Error msg written here */ ); /* @@ -622,7 +622,7 @@ SQLITE_API int sqlite3_exec( /* ** CAPI3REF: OS Interface Open File Handle ** -** An [sqlite3_file] object represents an open file in the +** An [sqlite3_file] object represents an open file in the ** [sqlite3_vfs | OS interface layer]. Individual OS interface ** implementations will ** want to subclass this object by appending additional fields @@ -632,7 +632,7 @@ SQLITE_API int sqlite3_exec( */ typedef struct sqlite3_file sqlite3_file; struct sqlite3_file { - const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ + const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ }; /* @@ -644,7 +644,7 @@ struct sqlite3_file { ** This object defines the methods used to perform various operations ** against the open file represented by the [sqlite3_file] object. ** -** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element +** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element ** to a non-NULL pointer, then the sqlite3_io_methods.xClose method ** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The ** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] @@ -727,29 +727,29 @@ struct sqlite3_file { */ typedef struct sqlite3_io_methods sqlite3_io_methods; struct sqlite3_io_methods { - int iVersion; - int (*xClose)(sqlite3_file*); - int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); - int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); - int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); - int (*xSync)(sqlite3_file*, int flags); - int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); - int (*xLock)(sqlite3_file*, int); - int (*xUnlock)(sqlite3_file*, int); - int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); - int (*xFileControl)(sqlite3_file*, int op, void *pArg); - int (*xSectorSize)(sqlite3_file*); - int (*xDeviceCharacteristics)(sqlite3_file*); - /* Methods above are valid for version 1 */ - int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); - int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); - void (*xShmBarrier)(sqlite3_file*); - int (*xShmUnmap)(sqlite3_file*, int deleteFlag); - /* Methods above are valid for version 2 */ - int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); - int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p); - /* Methods above are valid for version 3 */ - /* Additional methods may be added in future releases */ + int iVersion; + int (*xClose)(sqlite3_file*); + int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); + int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); + int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); + int (*xSync)(sqlite3_file*, int flags); + int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); + int (*xLock)(sqlite3_file*, int); + int (*xUnlock)(sqlite3_file*, int); + int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); + int (*xFileControl)(sqlite3_file*, int op, void *pArg); + int (*xSectorSize)(sqlite3_file*); + int (*xDeviceCharacteristics)(sqlite3_file*); + /* Methods above are valid for version 1 */ + int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); + int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); + void (*xShmBarrier)(sqlite3_file*); + int (*xShmUnmap)(sqlite3_file*, int deleteFlag); + /* Methods above are valid for version 2 */ + int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); + int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p); + /* Methods above are valid for version 3 */ + /* Additional methods may be added in future releases */ }; /* @@ -778,7 +778,7 @@ struct sqlite3_io_methods { **

  • [[SQLITE_FCNTL_CHUNK_SIZE]] ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** extends and truncates the database file in chunks of a size specified -** by the user. The fourth argument to [sqlite3_file_control()] should +** by the user. The fourth argument to [sqlite3_file_control()] should ** point to an integer (type int) containing the new chunk-size to use ** for the nominated database. Allocating database file space in large ** chunks (say 1MB at a time), may reduce file-system fragmentation and @@ -796,24 +796,24 @@ struct sqlite3_io_methods { **
  • [[SQLITE_FCNTL_SYNC]] ** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and ** sent to the VFS immediately before the xSync method is invoked on a -** database file descriptor. Or, if the xSync method is not invoked -** because the user has configured SQLite with -** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place +** database file descriptor. Or, if the xSync method is not invoked +** because the user has configured SQLite with +** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place ** of the xSync method. In most cases, the pointer argument passed with ** this file-control is NULL. However, if the database file is being synced ** as part of a multi-database commit, the argument points to a nul-terminated -** string containing the transactions master-journal file name. VFSes that -** do not need this signal should silently ignore this opcode. Applications -** should not call [sqlite3_file_control()] with this opcode as doing so may -** disrupt the operation of the specialized VFSes that do require it. +** string containing the transactions master-journal file name. VFSes that +** do not need this signal should silently ignore this opcode. Applications +** should not call [sqlite3_file_control()] with this opcode as doing so may +** disrupt the operation of the specialized VFSes that do require it. ** **
  • [[SQLITE_FCNTL_COMMIT_PHASETWO]] ** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite ** and sent to the VFS after a transaction has been committed immediately ** but before the database is unlocked. VFSes that do not need this signal ** should silently ignore this opcode. Applications should not call -** [sqlite3_file_control()] with this opcode as doing so may disrupt the -** operation of the specialized VFSes that do require it. +** [sqlite3_file_control()] with this opcode as doing so may disrupt the +** operation of the specialized VFSes that do require it. ** **
  • [[SQLITE_FCNTL_WIN32_AV_RETRY]] ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic @@ -860,13 +860,13 @@ struct sqlite3_io_methods { **
  • [[SQLITE_FCNTL_OVERWRITE]] ** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening ** a write transaction to indicate that, unless it is rolled back for some -** reason, the entire database file will be overwritten by the current +** reason, the entire database file will be overwritten by the current ** transaction. This is used by VACUUM operations. ** **
  • [[SQLITE_FCNTL_VFSNAME]] ** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of ** all [VFSes] in the VFS stack. The names are of all VFS shims and the -** final bottom-level VFS are written into memory obtained from +** final bottom-level VFS are written into memory obtained from ** [sqlite3_malloc()] and the result is stored in the char* variable ** that the fourth parameter of [sqlite3_file_control()] points to. ** The caller is responsible for freeing the memory when done. As with @@ -876,7 +876,7 @@ struct sqlite3_io_methods { ** is intended for diagnostic use only. ** **
  • [[SQLITE_FCNTL_PRAGMA]] -** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] +** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] ** file control is sent to the open [sqlite3_file] object corresponding ** to the database file to which the pragma statement refers. ^The argument ** to the [SQLITE_FCNTL_PRAGMA] file control is an array of @@ -887,7 +887,7 @@ struct sqlite3_io_methods { ** of the char** argument point to a string obtained from [sqlite3_mprintf()] ** or the equivalent and that string will become the result of the pragma or ** the error message if the pragma fails. ^If the -** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal +** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] ** file control returns [SQLITE_OK], then the parser assumes that the ** VFS has handled the PRAGMA itself and the parser generates a no-op @@ -925,7 +925,7 @@ struct sqlite3_io_methods { ** The argument is a pointer to a value of type sqlite3_int64 that ** is an advisory maximum number of bytes in the file to memory map. The ** pointer is overwritten with the old value. The limit is not changed if -** the value originally pointed to is negative, and so the current limit +** the value originally pointed to is negative, and so the current limit ** can be queried by passing in a pointer to a negative number. This ** file-control is used internally to implement [PRAGMA mmap_size]. ** @@ -1027,14 +1027,14 @@ typedef struct sqlite3_mutex sqlite3_mutex; ** the [sqlite3_file] can safely store a pointer to the ** filename if it needs to remember the filename for some reason. ** If the zFilename parameter to xOpen is a NULL pointer then xOpen -** must invent its own temporary name for the file. ^Whenever the +** must invent its own temporary name for the file. ^Whenever the ** xFilename parameter is NULL it will also be the case that the ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. ** ** The flags argument to xOpen() includes all bits set in ** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] ** or [sqlite3_open16()] is used, then flags includes at least -** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. +** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. ** If xOpen() opens a file read-only then it sets *pOutFlags to ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. ** @@ -1076,10 +1076,10 @@ typedef struct sqlite3_mutex sqlite3_mutex; ** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction ** with the [SQLITE_OPEN_CREATE] flag, which are both directly ** analogous to the O_EXCL and O_CREAT flags of the POSIX open() -** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the +** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the ** SQLITE_OPEN_CREATE, is used to indicate that file should always ** be created, and that it is an error if it already exists. -** It is not used to indicate the file should be opened +** It is not used to indicate the file should be opened ** for exclusive access. ** ** ^At least szOsFile bytes of memory are allocated by SQLite @@ -1117,16 +1117,16 @@ typedef struct sqlite3_mutex sqlite3_mutex; ** method returns a Julian Day Number for the current date and time as ** a floating point value. ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian -** Day Number multiplied by 86400000 (the number of milliseconds in -** a 24-hour day). +** Day Number multiplied by 86400000 (the number of milliseconds in +** a 24-hour day). ** ^SQLite will use the xCurrentTimeInt64() method to get the current -** date and time if that method is available (if iVersion is 2 or +** date and time if that method is available (if iVersion is 2 or ** greater and the function pointer is not NULL) and will fall back ** to xCurrentTime() if xCurrentTimeInt64() is unavailable. ** ** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces ** are not used by the SQLite core. These optional interfaces are provided -** by some VFSes to facilitate testing of the VFS code. By overriding +** by some VFSes to facilitate testing of the VFS code. By overriding ** system calls with functions under its control, a test program can ** simulate faults and error conditions that would otherwise be difficult ** or impossible to induce. The set of system calls that can be overridden @@ -1139,42 +1139,42 @@ typedef struct sqlite3_mutex sqlite3_mutex; typedef struct sqlite3_vfs sqlite3_vfs; typedef void (*sqlite3_syscall_ptr)(void); struct sqlite3_vfs { - int iVersion; /* Structure version number (currently 3) */ - int szOsFile; /* Size of subclassed sqlite3_file */ - int mxPathname; /* Maximum file pathname length */ - sqlite3_vfs *pNext; /* Next registered VFS */ - const char *zName; /* Name of this virtual file system */ - void *pAppData; /* Pointer to application-specific data */ - int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, - int flags, int *pOutFlags); - int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); - int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); - int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); - void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); - void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); - void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); - void (*xDlClose)(sqlite3_vfs*, void*); - int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); - int (*xSleep)(sqlite3_vfs*, int microseconds); - int (*xCurrentTime)(sqlite3_vfs*, double*); - int (*xGetLastError)(sqlite3_vfs*, int, char *); - /* - ** The methods above are in version 1 of the sqlite_vfs object - ** definition. Those that follow are added in version 2 or later - */ - int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); - /* - ** The methods above are in versions 1 and 2 of the sqlite_vfs object. - ** Those below are for version 3 and greater. - */ - int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); - sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); - const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); - /* - ** The methods above are in versions 1 through 3 of the sqlite_vfs object. - ** New fields may be appended in figure versions. The iVersion - ** value will increment whenever this happens. - */ + int iVersion; /* Structure version number (currently 3) */ + int szOsFile; /* Size of subclassed sqlite3_file */ + int mxPathname; /* Maximum file pathname length */ + sqlite3_vfs *pNext; /* Next registered VFS */ + const char *zName; /* Name of this virtual file system */ + void *pAppData; /* Pointer to application-specific data */ + int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, + int flags, int *pOutFlags); + int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); + int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); + int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); + void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); + void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); + void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); + void (*xDlClose)(sqlite3_vfs*, void*); + int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); + int (*xSleep)(sqlite3_vfs*, int microseconds); + int (*xCurrentTime)(sqlite3_vfs*, double*); + int (*xGetLastError)(sqlite3_vfs*, int, char *); + /* + ** The methods above are in version 1 of the sqlite_vfs object + ** definition. Those that follow are added in version 2 or later + */ + int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); + /* + ** The methods above are in versions 1 and 2 of the sqlite_vfs object. + ** Those below are for version 3 and greater. + */ + int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); + sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); + const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); + /* + ** The methods above are in versions 1 through 3 of the sqlite_vfs object. + ** New fields may be appended in figure versions. The iVersion + ** value will increment whenever this happens. + */ }; /* @@ -1217,7 +1217,7 @@ struct sqlite3_vfs { ** ** ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as -** was given no the corresponding lock. +** was given no the corresponding lock. ** ** The xShmLock method can transition between unlocked and SHARED or ** between unlocked and EXCLUSIVE. It cannot transition between SHARED @@ -1359,7 +1359,7 @@ SQLITE_API int sqlite3_config(int, ...); ** [database connection] (specified in the first argument). ** ** The second argument to sqlite3_db_config(D,V,...) is the -** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code +** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code ** that indicates what aspect of the [database connection] is being configured. ** Subsequent arguments vary depending on the configuration verb. ** @@ -1377,7 +1377,7 @@ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); ** This object is used in only one place in the SQLite interface. ** A pointer to an instance of this object is the argument to ** [sqlite3_config()] when the configuration option is -** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. +** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. ** By creating an instance of this object ** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) ** during configuration, an application can specify an alternative @@ -1407,7 +1407,7 @@ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); ** allocators round up memory allocations at least to the next multiple ** of 8. Some allocators round up to a larger multiple or to a power of 2. ** Every memory allocation request coming in through [sqlite3_malloc()] -** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. For example, @@ -1433,14 +1433,14 @@ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); */ typedef struct sqlite3_mem_methods sqlite3_mem_methods; struct sqlite3_mem_methods { - void *(*xMalloc)(int); /* Memory allocation function */ - void (*xFree)(void*); /* Free a prior allocation */ - void *(*xRealloc)(void*,int); /* Resize an allocation */ - int (*xSize)(void*); /* Return the size of an allocation */ - int (*xRoundup)(int); /* Round up request size to allocation size */ - int (*xInit)(void*); /* Initialize the memory allocator */ - void (*xShutdown)(void*); /* Deinitialize the memory allocator */ - void *pAppData; /* Argument to xInit() and xShutdown() */ + void *(*xMalloc)(int); /* Memory allocation function */ + void (*xFree)(void*); /* Free a prior allocation */ + void *(*xRealloc)(void*,int); /* Resize an allocation */ + int (*xSize)(void*); /* Return the size of an allocation */ + int (*xRoundup)(int); /* Round up request size to allocation size */ + int (*xInit)(void*); /* Initialize the memory allocator */ + void (*xShutdown)(void*); /* Deinitialize the memory allocator */ + void *pAppData; /* Argument to xInit() and xShutdown() */ }; /* @@ -1465,7 +1465,7 @@ struct sqlite3_mem_methods { ** by a single thread. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to change the [threading mode] from its default -** value of Single-thread and so [sqlite3_config()] will return +** value of Single-thread and so [sqlite3_config()] will return ** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD ** configuration option. ** @@ -1516,9 +1516,9 @@ struct sqlite3_mem_methods { ** tracks memory usage, for example. ** ** [[SQLITE_CONFIG_MEMSTATUS]]
    SQLITE_CONFIG_MEMSTATUS
    -**
    ^This option takes single argument of type int, interpreted as a -** boolean, which enables or disables the collection of memory allocation -** statistics. ^(When memory allocation statistics are disabled, the +**
    ^This option takes single argument of type int, interpreted as a +** boolean, which enables or disables the collection of memory allocation +** statistics. ^(When memory allocation statistics are disabled, the ** following SQLite interfaces become non-operational: **
      **
    • [sqlite3_memory_used()] @@ -1544,12 +1544,12 @@ struct sqlite3_mem_methods { ** N should be set to twice the expected maximum number of threads. ** ^SQLite will never require a scratch buffer that is more than 6 ** times the database page size. ^If SQLite needs needs additional -** scratch memory beyond what is provided by this configuration option, then +** scratch memory beyond what is provided by this configuration option, then ** [sqlite3_malloc()] will be used to obtain the memory needed.
    ** ** [[SQLITE_CONFIG_PAGECACHE]]
    SQLITE_CONFIG_PAGECACHE
    **
    ^This option specifies a static memory buffer that SQLite can use for -** the database page cache with the default page cache implementation. +** the database page cache with the default page cache implementation. ** This configuration should not be used if an application-define page ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option. ** There are three arguments to this option: A pointer to 8-byte aligned @@ -1635,7 +1635,7 @@ struct sqlite3_mem_methods { **
    The SQLITE_CONFIG_LOG option is used to configure the SQLite ** global [error log]. ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a -** function with a call signature of void(*)(void*,int,const char*), +** function with a call signature of void(*)(void*,int,const char*), ** and a pointer to void. ^If the function pointer is not NULL, it is ** invoked by [sqlite3_log()] to process each logging event. ^If the ** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. @@ -1732,7 +1732,7 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ -/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ +/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ #define SQLITE_CONFIG_PCACHE 14 /* no-op */ #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ @@ -1760,7 +1760,7 @@ struct sqlite3_mem_methods { ** **
    **
    SQLITE_DBCONFIG_LOOKASIDE
    -**
    ^This option takes three additional arguments that determine the +**
    ^This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. ** ^The first argument (the third parameter to [sqlite3_db_config()] is a ** pointer to a memory buffer to use for lookaside memory. @@ -1778,7 +1778,7 @@ struct sqlite3_mem_methods { ** when the "current value" returned by ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** Any attempt to change the lookaside memory configuration when lookaside -** memory is in use leaves the configuration unchanged and returns +** memory is in use leaves the configuration unchanged and returns ** [SQLITE_BUSY].)^
    ** **
    SQLITE_DBCONFIG_ENABLE_FKEY
    @@ -1828,18 +1828,18 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); ** the table has a column of type [INTEGER PRIMARY KEY] then that column ** is another alias for the rowid. ** -** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the +** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the ** most recent successful [INSERT] into a rowid table or [virtual table] ** on database connection D. ** ^Inserts into [WITHOUT ROWID] tables are not recorded. ** ^If no successful [INSERT]s into rowid tables -** have ever occurred on the database connection D, +** have ever occurred on the database connection D, ** then sqlite3_last_insert_rowid(D) returns zero. ** ** ^(If an [INSERT] occurs within a trigger or within a [virtual table] ** method, then this routine will return the [rowid] of the inserted ** row as long as the trigger or virtual table method is running. -** But once the trigger or virtual table method ends, the value returned +** But once the trigger or virtual table method ends, the value returned ** by this routine reverts to what it was before the trigger or virtual ** table method began.)^ ** @@ -1890,7 +1890,7 @@ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); ** mechanisms do not count as direct row changes.)^ ** ** A "trigger context" is a scope of execution that begins and -** ends with the script of a [CREATE TRIGGER | trigger]. +** ends with the script of a [CREATE TRIGGER | trigger]. ** Most SQL statements are ** evaluated outside of any trigger. This is the "top level" ** trigger context. If a trigger fires from the top level, a @@ -1933,7 +1933,7 @@ SQLITE_API int sqlite3_changes(sqlite3*); ** the count does not include changes used to implement [REPLACE] constraints, ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The ** count does not include rows of views that fire an [INSTEAD OF trigger], -** though if the INSTEAD OF trigger makes changes of its own, those changes +** though if the INSTEAD OF trigger makes changes of its own, those changes ** are counted.)^ ** ^The sqlite3_total_changes() function counts the changes as soon as ** the statement that makes them is completed (when the statement handle @@ -1973,7 +1973,7 @@ SQLITE_API int sqlite3_total_changes(sqlite3*); ** ** ^The sqlite3_interrupt(D) call is in effect until all currently running ** SQL statements on [database connection] D complete. ^Any new SQL statements -** that are started after the sqlite3_interrupt() call and before the +** that are started after the sqlite3_interrupt() call and before the ** running statements reaches zero are interrupted as if they had been ** running prior to the sqlite3_interrupt() call. ^New SQL statements ** that are started after the running statement count reaches zero are @@ -2008,7 +2008,7 @@ SQLITE_API void sqlite3_interrupt(sqlite3*); ** ^These routines do not parse the SQL statements thus ** will not detect syntactically incorrect SQL. ** -** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior +** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior ** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked ** automatically by sqlite3_complete16(). If that initialization fails, ** then the return value from sqlite3_complete16() will be non-zero @@ -2083,7 +2083,7 @@ SQLITE_API int sqlite3_complete16(const void *sql); ** The busy callback should not take any actions which modify the ** database connection that invoked the busy handler. Any such actions ** result in undefined behavior. -** +** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ @@ -2182,12 +2182,12 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); ** [sqlite3_errmsg()]. */ SQLITE_API int sqlite3_get_table( - sqlite3 *db, /* An open database */ - const char *zSql, /* SQL to be evaluated */ - char ***pazResult, /* Results of the query */ - int *pnRow, /* Number of result rows written here */ - int *pnColumn, /* Number of result columns written here */ - char **pzErrmsg /* Error msg written here */ + sqlite3 *db, /* An open database */ + const char *zSql, /* SQL to be evaluated */ + char ***pazResult, /* Results of the query */ + int *pnRow, /* Number of result rows written here */ + int *pnColumn, /* Number of result columns written here */ + char **pzErrmsg /* Error msg written here */ ); SQLITE_API void sqlite3_free_table(char **result); @@ -2435,7 +2435,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P); ** requested is ok. ^When the callback returns [SQLITE_DENY], the ** [sqlite3_prepare_v2()] or equivalent call that triggered the ** authorizer will fail with an error message explaining that -** access is denied. +** access is denied. ** ** ^The first parameter to the authorizer callback is a copy of the third ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter @@ -2482,7 +2482,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P); ** database connections for the meaning of "modify" in this paragraph. ** ** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the -** statement might be re-prepared during [sqlite3_step()] due to a +** statement might be re-prepared during [sqlite3_step()] due to a ** schema change. Hence, the application should ensure that the ** correct authorizer callback remains in place during the [sqlite3_step()]. ** @@ -2493,9 +2493,9 @@ SQLITE_API void sqlite3_randomness(int N, void *P); ** sqlite3_prepare_v2() to reprepare a statement after a schema change. */ SQLITE_API int sqlite3_set_authorizer( - sqlite3*, - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), - void *pUserData + sqlite3*, + int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), + void *pUserData ); /* @@ -2598,7 +2598,7 @@ SQLITE_API int sqlite3_set_authorizer( */ SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, - void(*xProfile)(void*,const char*,sqlite3_uint64), void*); + void(*xProfile)(void*,const char*,sqlite3_uint64), void*); /* ** CAPI3REF: Query Progress Callbacks @@ -2609,8 +2609,8 @@ SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, ** database connection D. An example use for this ** interface is to keep a GUI updated during a large query. ** -** ^The parameter P is passed through as the only parameter to the -** callback function X. ^The parameter N is the approximate number of +** ^The parameter P is passed through as the only parameter to the +** callback function X. ^The parameter N is the approximate number of ** [virtual machine instructions] that are evaluated between successive ** invocations of the callback X. ^If N is less than one then the progress ** handler is disabled. @@ -2636,7 +2636,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); /* ** CAPI3REF: Opening A New Database Connection ** -** ^These routines open an SQLite database file as specified by the +** ^These routines open an SQLite database file as specified by the ** filename argument. ^The filename argument is interpreted as UTF-8 for ** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte ** order for sqlite3_open16(). ^(A [database connection] handle is usually @@ -2661,7 +2661,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** except that it accepts two additional parameters for additional control ** over the new database connection. ^(The flags parameter to ** sqlite3_open_v2() can take one of -** the following three values, optionally combined with the +** the following three values, optionally combined with the ** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], ** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^ ** @@ -2729,17 +2729,17 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** information. ** ** URI filenames are parsed according to RFC 3986. ^If the URI contains an -** authority, then it must be either an empty string or the string -** "localhost". ^If the authority is not an empty string or "localhost", an -** error is returned to the caller. ^The fragment component of a URI, if +** authority, then it must be either an empty string or the string +** "localhost". ^If the authority is not an empty string or "localhost", an +** error is returned to the caller. ^The fragment component of a URI, if ** present, is ignored. ** ** ^SQLite uses the path component of the URI as the name of the disk file -** which contains the database. ^If the path begins with a '/' character, -** then it is interpreted as an absolute path. ^If the path does not begin +** which contains the database. ^If the path begins with a '/' character, +** then it is interpreted as an absolute path. ^If the path does not begin ** with a '/' (meaning that the authority section is omitted from the URI) -** then the path is interpreted as a relative path. -** ^On windows, the first component of an absolute path +** then the path is interpreted as a relative path. +** ^On windows, the first component of an absolute path ** is a drive specification (e.g. "C:"). ** ** [[core URI query parameters]] @@ -2758,13 +2758,13 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** **
  • mode: ^(The mode parameter may be set to either "ro", "rw", ** "rwc", or "memory". Attempting to set it to any other value is -** an error)^. -** ^If "ro" is specified, then the database is opened for read-only -** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the -** third argument to sqlite3_open_v2(). ^If the mode option is set to -** "rw", then the database is opened for read-write (but not create) -** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had -** been set. ^Value "rwc" is equivalent to setting both +** an error)^. +** ^If "ro" is specified, then the database is opened for read-only +** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the +** third argument to sqlite3_open_v2(). ^If the mode option is set to +** "rw", then the database is opened for read-write (but not create) +** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had +** been set. ^Value "rwc" is equivalent to setting both ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is ** set to "memory" then a pure [in-memory database] that never reads ** or writes from disk is used. ^It is an error to specify a value for @@ -2774,7 +2774,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); **
  • cache: ^The cache parameter may be set to either "shared" or ** "private". ^Setting it to "shared" is equivalent to setting the ** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to -** sqlite3_open_v2(). ^Setting the cache parameter to "private" is +** sqlite3_open_v2(). ^Setting the cache parameter to "private" is ** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. ** ^If sqlite3_open_v2() is used and the "cache" parameter is present in ** a URI filename, its value overrides any behavior requested by setting @@ -2790,35 +2790,35 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** ** **
    URI filenames Results -**
    file:data.db +**
    file:data.db ** Open the file "data.db" in the current directory. **
    file:/home/fred/data.db
    -** file:///home/fred/data.db
    -** file://localhost/home/fred/data.db
    +** file:///home/fred/data.db
    +** file://localhost/home/fred/data.db
    ** Open the database file "/home/fred/data.db". -**
    file://darkstar/home/fred/data.db +**
    file://darkstar/home/fred/data.db ** An error. "darkstar" is not a recognized authority. -**
    +**
    ** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db ** Windows only: Open the file "data.db" on fred's desktop on drive -** C:. Note that the %20 escaping in this example is not strictly +** C:. Note that the %20 escaping in this example is not strictly ** necessary - space characters can be used literally ** in URI filenames. -**
    file:data.db?mode=ro&cache=private +**
    file:data.db?mode=ro&cache=private ** Open file "data.db" in the current directory for read-only access. ** Regardless of whether or not shared-cache mode is enabled by ** default, use a private cache. **
    file:/home/fred/data.db?vfs=unix-nolock ** Open file "/home/fred/data.db". Use the special VFS "unix-nolock". -**
    file:data.db?mode=readonly +**
    file:data.db?mode=readonly ** An error. "readonly" is not a valid option for the "mode" parameter. **
    ** ** ^URI hexadecimal escape sequences (%HH) are supported within the path and ** query components of a URI. A hexadecimal escape sequence consists of a -** percent sign - "%" - followed by exactly two hexadecimal digits +** percent sign - "%" - followed by exactly two hexadecimal digits ** specifying an octet value. ^Before the path or query components of a -** URI filename are interpreted, they are encoded using UTF-8 and all +** URI filename are interpreted, they are encoded using UTF-8 and all ** hexadecimal escape sequences replaced by a single byte containing the ** corresponding octet. If this process generates an invalid UTF-8 encoding, ** the results are undefined. @@ -2836,33 +2836,33 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** See also: [sqlite3_temp_directory] */ SQLITE_API int sqlite3_open( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb /* OUT: SQLite db handle */ ); SQLITE_API int sqlite3_open16( - const void *filename, /* Database filename (UTF-16) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ + const void *filename, /* Database filename (UTF-16) */ + sqlite3 **ppDb /* OUT: SQLite db handle */ ); SQLITE_API int sqlite3_open_v2( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb, /* OUT: SQLite db handle */ - int flags, /* Flags */ - const char *zVfs /* Name of VFS module to use */ + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb, /* OUT: SQLite db handle */ + int flags, /* Flags */ + const char *zVfs /* Name of VFS module to use */ ); /* ** CAPI3REF: Obtain Values For URI Parameters ** ** These are utility routines, useful to VFS implementations, that check -** to see if a database file was a URI that contained a specific query +** to see if a database file was a URI that contained a specific query ** parameter, and if so obtains the value of that query parameter. ** -** If F is the database filename pointer passed into the xOpen() method of -** a VFS implementation when the flags parameter to xOpen() has one or +** If F is the database filename pointer passed into the xOpen() method of +** a VFS implementation when the flags parameter to xOpen() has one or ** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and ** P is the name of the query parameter, then ** sqlite3_uri_parameter(F,P) returns the value of the P -** parameter if it exists or a NULL pointer if P does not appear as a +** parameter if it exists or a NULL pointer if P does not appear as a ** query parameter on F. If P is a query parameter of F ** has no explicit value, then sqlite3_uri_parameter(F,P) returns ** a pointer to an empty string. @@ -2871,7 +2871,7 @@ SQLITE_API int sqlite3_open_v2( ** parameter and returns true (1) or false (0) according to the value ** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the ** value of query parameter P is one of "yes", "true", or "on" in any -** case or if the value begins with a non-zero number. The +** case or if the value begins with a non-zero number. The ** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of ** query parameter P is one of "no", "false", or "off" in any case or ** if the value begins with a numeric zero. If P is not a query @@ -2882,7 +2882,7 @@ SQLITE_API int sqlite3_open_v2( ** 64-bit signed integer and returns that integer, or D if P does not ** exist. If the value of P is something other than an integer, then ** zero is returned. -** +** ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and ** is not a database file pathname pointer that SQLite passed into the xOpen @@ -2902,7 +2902,7 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int ** associated with a [database connection]. If a prior API call failed ** but the most recent API call succeeded, the return value from ** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() -** interface is the same except that it always returns the +** interface is the same except that it always returns the ** [extended result code] even when extended result codes are ** disabled. ** @@ -2975,7 +2975,7 @@ typedef struct sqlite3_stmt sqlite3_stmt; ** new limit for that construct.)^ ** ** ^If the new limit is a negative number, the limit is unchanged. -** ^(For each limit category SQLITE_LIMIT_NAME there is a +** ^(For each limit category SQLITE_LIMIT_NAME there is a ** [limits | hard upper bound] ** set at compile-time by a C preprocessor macro called ** [limits | SQLITE_MAX_NAME]. @@ -2983,7 +2983,7 @@ typedef struct sqlite3_stmt sqlite3_stmt; ** ^Attempts to increase a limit above its hard upper bound are ** silently truncated to the hard upper bound. ** -** ^Regardless of whether or not the limit was changed, the +** ^Regardless of whether or not the limit was changed, the ** [sqlite3_limit()] interface returns the prior value of the limit. ** ^Hence, to find the current value of a limit without changing it, ** simply invoke this interface with the third parameter set to -1. @@ -3138,12 +3138,12 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); **
  • ** **
  • -** ^If the specific value bound to [parameter | host parameter] in the +** ^If the specific value bound to [parameter | host parameter] in the ** WHERE clause might influence the choice of query plan for a statement, -** then the statement will be automatically recompiled, as if there had been +** then the statement will be automatically recompiled, as if there had been ** a schema change, on the first [sqlite3_step()] call following any change -** to the [sqlite3_bind_text | bindings] of that [parameter]. -** ^The specific value of WHERE-clause [parameter] might influence the +** to the [sqlite3_bind_text | bindings] of that [parameter]. +** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. @@ -3151,32 +3151,32 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** */ SQLITE_API int sqlite3_prepare( - sqlite3 *db, /* Database handle */ - const char *zSql, /* SQL statement, UTF-8 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const char **pzTail /* OUT: Pointer to unused portion of zSql */ + sqlite3 *db, /* Database handle */ + const char *zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare_v2( - sqlite3 *db, /* Database handle */ - const char *zSql, /* SQL statement, UTF-8 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const char **pzTail /* OUT: Pointer to unused portion of zSql */ + sqlite3 *db, /* Database handle */ + const char *zSql, /* SQL statement, UTF-8 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare16( - sqlite3 *db, /* Database handle */ - const void *zSql, /* SQL statement, UTF-16 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const void **pzTail /* OUT: Pointer to unused portion of zSql */ + sqlite3 *db, /* Database handle */ + const void *zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare16_v2( - sqlite3 *db, /* Database handle */ - const void *zSql, /* SQL statement, UTF-16 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const void **pzTail /* OUT: Pointer to unused portion of zSql */ + sqlite3 *db, /* Database handle */ + const void *zSql, /* SQL statement, UTF-16 encoded */ + int nByte, /* Maximum length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); /* @@ -3196,8 +3196,8 @@ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); ** the content of the database file. ** ** Note that [application-defined SQL functions] or -** [virtual tables] might change the database indirectly as a side effect. -** ^(For example, if an application defines a function "eval()" that +** [virtual tables] might change the database indirectly as a side effect. +** ^(For example, if an application defines a function "eval()" that ** calls [sqlite3_exec()], then the following SQL statement would ** change the database file through side-effects: ** @@ -3211,10 +3211,10 @@ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); ** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], ** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, ** since the statements themselves do not actually modify the database but -** rather they control the timing of when other statements modify the +** rather they control the timing of when other statements modify the ** database. ^The [ATTACH] and [DETACH] statements also cause ** sqlite3_stmt_readonly() to return true since, while those statements -** change the configuration of a database connection, they do not make +** change the configuration of a database connection, they do not make ** changes to the content of the database files on disk. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); @@ -3223,17 +3223,17 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); ** CAPI3REF: Determine If A Prepared Statement Has Been Reset ** ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the -** [prepared statement] S has been stepped at least once using -** [sqlite3_step(S)] but has not run to completion and/or has not +** [prepared statement] S has been stepped at least once using +** [sqlite3_step(S)] but has not run to completion and/or has not ** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) -** interface returns false if S is a NULL pointer. If S is not a +** interface returns false if S is a NULL pointer. If S is not a ** NULL pointer and is not a pointer to a valid [prepared statement] ** object, then the behavior is undefined and probably undesirable. ** ** This interface can be used in combination [sqlite3_next_stmt()] -** to locate all prepared statements associated with a database +** to locate all prepared statements associated with a database ** connection that are in need of being reset. This can be used, -** for example, in diagnostic routines to search for prepared +** for example, in diagnostic routines to search for prepared ** statements that are holding a transaction open. */ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); @@ -3258,7 +3258,7 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); ** sqlite3_value object but no mutex is held for an unprotected ** sqlite3_value object. If SQLite is compiled to be single-threaded ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) -** or if SQLite is run in one of reduced mutex modes +** or if SQLite is run in one of reduced mutex modes ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] ** then there is no distinction between protected and unprotected ** sqlite3_value objects and they can be used interchangeably. However, @@ -3343,7 +3343,7 @@ typedef struct sqlite3_context sqlite3_context; ** If a non-negative fourth parameter is provided to sqlite3_bind_text() ** or sqlite3_bind_text16() then that parameter must be the byte offset ** where the NUL terminator would occur assuming the string were NUL -** terminated. If any NUL characters occur at byte offsets less than +** terminated. If any NUL characters occur at byte offsets less than ** the value of the fourth parameter then the resulting string value will ** contain embedded NULs. The result of expressions involving strings ** with embedded NULs is undefined. @@ -3352,7 +3352,7 @@ typedef struct sqlite3_context sqlite3_context; ** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or ** string after SQLite has finished with it. ^The destructor is called ** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(), -** sqlite3_bind_text(), or sqlite3_bind_text16() fails. +** sqlite3_bind_text(), or sqlite3_bind_text16() fails. ** ^If the fifth argument is ** the special value [SQLITE_STATIC], then SQLite assumes that the ** information is in static, unmanaged space and does not need to be freed. @@ -3648,7 +3648,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); ** For all versions of SQLite up to and including 3.6.23.1, a call to ** [sqlite3_reset()] was required after sqlite3_step() returned anything ** other than [SQLITE_ROW] before any subsequent invocation of -** sqlite3_step(). Failure to reset the prepared statement using +** sqlite3_step(). Failure to reset the prepared statement using ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from ** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began ** calling [sqlite3_reset()] automatically in this circumstance rather @@ -3778,7 +3778,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** the number of bytes in that string. ** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. ** -** ^The values returned by [sqlite3_column_bytes()] and +** ^The values returned by [sqlite3_column_bytes()] and ** [sqlite3_column_bytes16()] do not include the zero terminators at the end ** of the string. ^For clarity: the values returned by ** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of @@ -3971,7 +3971,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** ^The second parameter is the name of the SQL function to be created or ** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 ** representation, exclusive of the zero-terminator. ^Note that the name -** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. +** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. ** ^Any attempt to create a function with a longer name ** will result in [SQLITE_MISUSE] being returned. ** @@ -3986,7 +3986,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** ^The fourth parameter, eTextRep, specifies what ** [SQLITE_UTF8 | text encoding] this SQL function prefers for ** its parameters. The application should set this parameter to -** [SQLITE_UTF16LE] if the function implementation invokes +** [SQLITE_UTF16LE] if the function implementation invokes ** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the ** implementation invokes [sqlite3_value_text16be()] on an input, or ** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] @@ -4017,13 +4017,13 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** callbacks. ** ** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL, -** then it is destructor for the application data pointer. +** then it is destructor for the application data pointer. ** The destructor is invoked when the function is deleted, either by being ** overloaded or when the database connection closes.)^ ** ^The destructor is also invoked if the call to ** sqlite3_create_function_v2() fails. ** ^When the destructor callback of the tenth parameter is invoked, it -** is passed a single argument which is a copy of the application data +** is passed a single argument which is a copy of the application data ** pointer which was the fifth parameter to sqlite3_create_function_v2(). ** ** ^It is permitted to register multiple implementations of the same @@ -4034,7 +4034,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** nArg parameter is a better match than a function implementation with ** a negative nArg. ^A function where the preferred text encoding ** matches the database encoding is a better -** match than a function where the encoding is different. +** match than a function where the encoding is different. ** ^A function where the encoding difference is between UTF16le and UTF16be ** is a closer match than a function where the encoding difference is ** between UTF8 and UTF16. @@ -4047,35 +4047,35 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** statement in which the function is running. */ SQLITE_API int sqlite3_create_function( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) + sqlite3 *db, + const char *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*) ); SQLITE_API int sqlite3_create_function16( - sqlite3 *db, - const void *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) + sqlite3 *db, + const void *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*) ); SQLITE_API int sqlite3_create_function_v2( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void(*xDestroy)(void*) + sqlite3 *db, + const char *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*), + void(*xDestroy)(void*) ); /* @@ -4094,7 +4094,7 @@ SQLITE_API int sqlite3_create_function_v2( /* ** CAPI3REF: Function Flags ** -** These constants may be ORed together with the +** These constants may be ORed together with the ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. @@ -4106,7 +4106,7 @@ SQLITE_API int sqlite3_create_function_v2( ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain -** backwards compatibility with older code, these functions continue +** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid ** the use of these functions. To help encourage people to avoid ** using these functions, we are not going to tell you what they do. @@ -4118,7 +4118,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int), - void*,sqlite3_int64); + void*,sqlite3_int64); #endif /* @@ -4185,7 +4185,7 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); ** Implementations of aggregate SQL functions use this ** routine to allocate memory for storing their state. ** -** ^The first time the sqlite3_aggregate_context(C,N) routine is called +** ^The first time the sqlite3_aggregate_context(C,N) routine is called ** for a particular aggregate function, SQLite ** allocates N of memory, zeroes out that memory, and returns a pointer ** to the new memory. ^On second and subsequent calls to @@ -4198,7 +4198,7 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); ** In those cases, sqlite3_aggregate_context() might be called for the ** first time from within xFinal().)^ ** -** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer +** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** @@ -4207,10 +4207,10 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); ** value of N in subsequent call to sqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ Within the xFinal callback, it is customary to set -** N=0 in calls to sqlite3_aggregate_context(C,N) so that no +** N=0 in calls to sqlite3_aggregate_context(C,N) so that no ** pointless memory allocations occur. ** -** ^SQLite automatically frees the memory allocated by +** ^SQLite automatically frees the memory allocated by ** sqlite3_aggregate_context() when the aggregate query concludes. ** ** The first parameter must be a copy of the @@ -4257,7 +4257,7 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** some circumstances the associated metadata may be preserved. An example ** of where this might be useful is in a regular-expression matching ** function. The compiled version of the regular expression can be stored as -** metadata associated with the pattern string. +** metadata associated with the pattern string. ** Then as long as the pattern string remains the same, ** the compiled regular expression can be reused on multiple ** invocations of the same function. @@ -4281,10 +4281,10 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); **
  • when [sqlite3_reset()] or [sqlite3_finalize()] is called for the ** SQL statement, or **
  • when sqlite3_set_auxdata() is invoked again on the same parameter, or -**
  • during the original sqlite3_set_auxdata() call when a memory +**
  • during the original sqlite3_set_auxdata() call when a memory ** allocation error occurs. )^ ** -** Note the last bullet in particular. The destructor X in +** Note the last bullet in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() ** should be called near the end of the function implementation and the @@ -4485,7 +4485,7 @@ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); ** deleted. ^When all collating functions having the same name are deleted, ** that collation is no longer usable. ** -** ^The collating function callback is invoked with a copy of the pArg +** ^The collating function callback is invoked with a copy of the pArg ** application data pointer and with two strings in the encoding specified ** by the eTextRep argument. The collating function must return an ** integer that is negative, zero, or positive @@ -4515,38 +4515,38 @@ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); ** calls to the collation creation functions or when the ** [database connection] is closed using [sqlite3_close()]. ** -** ^The xDestroy callback is not called if the +** ^The xDestroy callback is not called if the ** sqlite3_create_collation_v2() function fails. Applications that invoke -** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should +** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should ** check the return code and dispose of the application data pointer ** themselves rather than expecting SQLite to deal with it for them. -** This is different from every other SQLite interface. The inconsistency -** is unfortunate but cannot be changed without breaking backwards +** This is different from every other SQLite interface. The inconsistency +** is unfortunate but cannot be changed without breaking backwards ** compatibility. ** ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. */ SQLITE_API int sqlite3_create_collation( - sqlite3*, - const char *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*) + sqlite3*, + const char *zName, + int eTextRep, + void *pArg, + int(*xCompare)(void*,int,const void*,int,const void*) ); SQLITE_API int sqlite3_create_collation_v2( - sqlite3*, - const char *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*), - void(*xDestroy)(void*) + sqlite3*, + const char *zName, + int eTextRep, + void *pArg, + int(*xCompare)(void*,int,const void*,int,const void*), + void(*xDestroy)(void*) ); SQLITE_API int sqlite3_create_collation16( - sqlite3*, - const void *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*) + sqlite3*, + const void *zName, + int eTextRep, + void *pArg, + int(*xCompare)(void*,int,const void*,int,const void*) ); /* @@ -4576,14 +4576,14 @@ SQLITE_API int sqlite3_create_collation16( ** [sqlite3_create_collation_v2()]. */ SQLITE_API int sqlite3_collation_needed( - sqlite3*, - void*, - void(*)(void*,sqlite3*,int eTextRep,const char*) + sqlite3*, + void*, + void(*)(void*,sqlite3*,int eTextRep,const char*) ); SQLITE_API int sqlite3_collation_needed16( - sqlite3*, - void*, - void(*)(void*,sqlite3*,int eTextRep,const void*) + sqlite3*, + void*, + void(*)(void*,sqlite3*,int eTextRep,const void*) ); #ifdef SQLITE_HAS_CODEC @@ -4595,13 +4595,13 @@ SQLITE_API int sqlite3_collation_needed16( ** of SQLite. */ SQLITE_API int sqlite3_key( - sqlite3 *db, /* Database to be rekeyed */ - const void *pKey, int nKey /* The key */ + sqlite3 *db, /* Database to be rekeyed */ + const void *pKey, int nKey /* The key */ ); SQLITE_API int sqlite3_key_v2( - sqlite3 *db, /* Database to be rekeyed */ - const char *zDbName, /* Name of the database */ - const void *pKey, int nKey /* The key */ + sqlite3 *db, /* Database to be rekeyed */ + const char *zDbName, /* Name of the database */ + const void *pKey, int nKey /* The key */ ); /* @@ -4613,31 +4613,31 @@ SQLITE_API int sqlite3_key_v2( ** of SQLite. */ SQLITE_API int sqlite3_rekey( - sqlite3 *db, /* Database to be rekeyed */ - const void *pKey, int nKey /* The new key */ + sqlite3 *db, /* Database to be rekeyed */ + const void *pKey, int nKey /* The new key */ ); SQLITE_API int sqlite3_rekey_v2( - sqlite3 *db, /* Database to be rekeyed */ - const char *zDbName, /* Name of the database */ - const void *pKey, int nKey /* The new key */ + sqlite3 *db, /* Database to be rekeyed */ + const char *zDbName, /* Name of the database */ + const void *pKey, int nKey /* The new key */ ); /* -** Specify the activation key for a SEE database. Unless +** Specify the activation key for a SEE database. Unless ** activated, none of the SEE routines will work. */ SQLITE_API void sqlite3_activate_see( - const char *zPassPhrase /* Activation phrase */ + const char *zPassPhrase /* Activation phrase */ ); #endif #ifdef SQLITE_ENABLE_CEROD /* -** Specify the activation key for a CEROD database. Unless +** Specify the activation key for a CEROD database. Unless ** activated, none of the CEROD routines will work. */ SQLITE_API void sqlite3_activate_cerod( - const char *zPassPhrase /* Activation phrase */ + const char *zPassPhrase /* Activation phrase */ ); #endif @@ -4682,7 +4682,7 @@ SQLITE_API int sqlite3_sleep(int); ** ^The [temp_store_directory pragma] may modify this variable and cause ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, ** the [temp_store_directory pragma] always assumes that any string -** that this variable points to is held in memory obtained from +** that this variable points to is held in memory obtained from ** [sqlite3_malloc] and the pragma may attempt to free that memory ** using [sqlite3_free]. ** Hence, if this variable is modified directly, either it should be @@ -4734,7 +4734,7 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; ** ^The [data_store_directory pragma] may modify this variable and cause ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, ** the [data_store_directory pragma] always assumes that any string -** that this variable points to is held in memory obtained from +** that this variable points to is held in memory obtained from ** [sqlite3_malloc] and the pragma may attempt to free that memory ** using [sqlite3_free]. ** Hence, if this variable is modified directly, either it should be @@ -4916,9 +4916,9 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); ** interfaces. */ SQLITE_API void *sqlite3_update_hook( - sqlite3*, - void(*)(void *,int ,char const *,char const *,sqlite3_int64), - void* + sqlite3*, + void(*)(void *,int ,char const *,char const *,sqlite3_int64), + void* ); /* @@ -4991,7 +4991,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*); ** as heap memory usages approaches the limit. ** ^The soft heap limit is "soft" because even though SQLite strives to stay ** below the limit, it will exceed the limit rather than generate -** an [SQLITE_NOMEM] error. In other words, the soft heap limit +** an [SQLITE_NOMEM] error. In other words, the soft heap limit ** is advisory only. ** ** ^The return value from sqlite3_soft_heap_limit64() is the size of @@ -5108,15 +5108,15 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. */ SQLITE_API int sqlite3_table_column_metadata( - sqlite3 *db, /* Connection handle */ - const char *zDbName, /* Database name or NULL */ - const char *zTableName, /* Table name */ - const char *zColumnName, /* Column name */ - char const **pzDataType, /* OUTPUT: Declared data type */ - char const **pzCollSeq, /* OUTPUT: Collation sequence name */ - int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ - int *pPrimaryKey, /* OUTPUT: True if column part of PK */ - int *pAutoinc /* OUTPUT: True if column is auto-increment */ + sqlite3 *db, /* Connection handle */ + const char *zDbName, /* Database name or NULL */ + const char *zTableName, /* Table name */ + const char *zColumnName, /* Column name */ + char const **pzDataType, /* OUTPUT: Declared data type */ + char const **pzCollSeq, /* OUTPUT: Collation sequence name */ + int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ + int *pPrimaryKey, /* OUTPUT: True if column part of PK */ + int *pAutoinc /* OUTPUT: True if column is auto-increment */ ); /* @@ -5154,10 +5154,10 @@ SQLITE_API int sqlite3_table_column_metadata( ** See also the [load_extension() SQL function]. */ SQLITE_API int sqlite3_load_extension( - sqlite3 *db, /* Load the extension into this database connection */ - const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Derived from zFile if 0 */ - char **pzErrMsg /* Put error message here if not 0 */ + sqlite3 *db, /* Load the extension into this database connection */ + const char *zFile, /* Name of the shared library containing extension */ + const char *zProc, /* Entry point. Derived from zFile if 0 */ + char **pzErrMsg /* Put error message here if not 0 */ ); /* @@ -5219,7 +5219,7 @@ SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the ** initialization routine X that was registered using a prior call to ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] -** routine returns 1 if initialization routine X was successfully +** routine returns 1 if initialization routine X was successfully ** unregistered and it returns 0 if X was not on the list of initialization ** routines. */ @@ -5254,8 +5254,8 @@ typedef struct sqlite3_module sqlite3_module; ** CAPI3REF: Virtual Table Object ** KEYWORDS: sqlite3_module {virtual table module} ** -** This structure, sometimes called a "virtual table module", -** defines the implementation of a [virtual tables]. +** This structure, sometimes called a "virtual table module", +** defines the implementation of a [virtual tables]. ** This structure consists mostly of methods for the module. ** ** ^A virtual table module is created by filling in a persistent @@ -5267,38 +5267,38 @@ typedef struct sqlite3_module sqlite3_module; ** any database connection. */ struct sqlite3_module { - int iVersion; - int (*xCreate)(sqlite3*, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xConnect)(sqlite3*, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); - int (*xDisconnect)(sqlite3_vtab *pVTab); - int (*xDestroy)(sqlite3_vtab *pVTab); - int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); - int (*xClose)(sqlite3_vtab_cursor*); - int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv); - int (*xNext)(sqlite3_vtab_cursor*); - int (*xEof)(sqlite3_vtab_cursor*); - int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); - int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); - int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); - int (*xBegin)(sqlite3_vtab *pVTab); - int (*xSync)(sqlite3_vtab *pVTab); - int (*xCommit)(sqlite3_vtab *pVTab); - int (*xRollback)(sqlite3_vtab *pVTab); - int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), - void **ppArg); - int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); - /* The methods above are in version 1 of the sqlite_module object. Those - ** below are for version 2 and greater. */ - int (*xSavepoint)(sqlite3_vtab *pVTab, int); - int (*xRelease)(sqlite3_vtab *pVTab, int); - int (*xRollbackTo)(sqlite3_vtab *pVTab, int); + int iVersion; + int (*xCreate)(sqlite3*, void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVTab, char**); + int (*xConnect)(sqlite3*, void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVTab, char**); + int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); + int (*xDisconnect)(sqlite3_vtab *pVTab); + int (*xDestroy)(sqlite3_vtab *pVTab); + int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); + int (*xClose)(sqlite3_vtab_cursor*); + int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, + int argc, sqlite3_value **argv); + int (*xNext)(sqlite3_vtab_cursor*); + int (*xEof)(sqlite3_vtab_cursor*); + int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); + int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); + int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); + int (*xBegin)(sqlite3_vtab *pVTab); + int (*xSync)(sqlite3_vtab *pVTab); + int (*xCommit)(sqlite3_vtab *pVTab); + int (*xRollback)(sqlite3_vtab *pVTab); + int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, + void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), + void **ppArg); + int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); + /* The methods above are in version 1 of the sqlite_module object. Those + ** below are for version 2 and greater. */ + int (*xSavepoint)(sqlite3_vtab *pVTab, int); + int (*xRelease)(sqlite3_vtab *pVTab, int); + int (*xRollbackTo)(sqlite3_vtab *pVTab, int); }; /* @@ -5351,7 +5351,7 @@ struct sqlite3_module { ** ** ^The estimatedCost value is an estimate of the cost of a particular ** strategy. A cost of N indicates that the cost of the strategy is similar -** to a linear scan of an SQLite table with N rows. A cost of log(N) +** to a linear scan of an SQLite table with N rows. A cost of log(N) ** indicates that the expense of the operation is similar to that of a ** binary search on a unique indexed field of an SQLite table with N rows. ** @@ -5360,38 +5360,38 @@ struct sqlite3_module { ** ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info ** structure for SQLite version 3.8.2. If a virtual table extension is -** used with an SQLite version earlier than 3.8.2, the results of attempting -** to read or write the estimatedRows field are undefined (but are likely +** used with an SQLite version earlier than 3.8.2, the results of attempting +** to read or write the estimatedRows field are undefined (but are likely ** to included crashing the application). The estimatedRows field should ** therefore only be used if [sqlite3_libversion_number()] returns a ** value greater than or equal to 3008002. */ struct sqlite3_index_info { - /* Inputs */ - int nConstraint; /* Number of entries in aConstraint */ - struct sqlite3_index_constraint { - int iColumn; /* Column on left-hand side of constraint */ - unsigned char op; /* Constraint operator */ - unsigned char usable; /* True if this constraint is usable */ - int iTermOffset; /* Used internally - xBestIndex should ignore */ - } *aConstraint; /* Table of WHERE clause constraints */ - int nOrderBy; /* Number of terms in the ORDER BY clause */ - struct sqlite3_index_orderby { - int iColumn; /* Column number */ - unsigned char desc; /* True for DESC. False for ASC. */ - } *aOrderBy; /* The ORDER BY clause */ - /* Outputs */ - struct sqlite3_index_constraint_usage { - int argvIndex; /* if >0, constraint is part of argv to xFilter */ - unsigned char omit; /* Do not code a test for this constraint */ - } *aConstraintUsage; - int idxNum; /* Number used to identify the index */ - char *idxStr; /* String, possibly obtained from sqlite3_malloc */ - int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ - int orderByConsumed; /* True if output is already ordered */ - double estimatedCost; /* Estimated cost of using this index */ - /* Fields below are only available in SQLite 3.8.2 and later */ - sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ + /* Inputs */ + int nConstraint; /* Number of entries in aConstraint */ + struct sqlite3_index_constraint { + int iColumn; /* Column on left-hand side of constraint */ + unsigned char op; /* Constraint operator */ + unsigned char usable; /* True if this constraint is usable */ + int iTermOffset; /* Used internally - xBestIndex should ignore */ + } *aConstraint; /* Table of WHERE clause constraints */ + int nOrderBy; /* Number of terms in the ORDER BY clause */ + struct sqlite3_index_orderby { + int iColumn; /* Column number */ + unsigned char desc; /* True for DESC. False for ASC. */ + } *aOrderBy; /* The ORDER BY clause */ + /* Outputs */ + struct sqlite3_index_constraint_usage { + int argvIndex; /* if >0, constraint is part of argv to xFilter */ + unsigned char omit; /* Do not code a test for this constraint */ + } *aConstraintUsage; + int idxNum; /* Number used to identify the index */ + char *idxStr; /* String, possibly obtained from sqlite3_malloc */ + int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ + int orderByConsumed; /* True if output is already ordered */ + double estimatedCost; /* Estimated cost of using this index */ + /* Fields below are only available in SQLite 3.8.2 and later */ + sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ }; /* @@ -5418,7 +5418,7 @@ struct sqlite3_index_info { ** preexisting [virtual table] for the module. ** ** ^The module name is registered on the [database connection] specified -** by the first parameter. ^The name of the module is given by the +** by the first parameter. ^The name of the module is given by the ** second parameter. ^The third parameter is a pointer to ** the implementation of the [virtual table module]. ^The fourth ** parameter is an arbitrary client data pointer that is passed through @@ -5435,17 +5435,17 @@ struct sqlite3_index_info { ** destructor. */ SQLITE_API int sqlite3_create_module( - sqlite3 *db, /* SQLite connection to register module with */ - const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ - void *pClientData /* Client data for xCreate/xConnect */ + sqlite3 *db, /* SQLite connection to register module with */ + const char *zName, /* Name of the module */ + const sqlite3_module *p, /* Methods for the module */ + void *pClientData /* Client data for xCreate/xConnect */ ); SQLITE_API int sqlite3_create_module_v2( - sqlite3 *db, /* SQLite connection to register module with */ - const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ - void *pClientData, /* Client data for xCreate/xConnect */ - void(*xDestroy)(void*) /* Module destructor function */ + sqlite3 *db, /* SQLite connection to register module with */ + const char *zName, /* Name of the module */ + const sqlite3_module *p, /* Methods for the module */ + void *pClientData, /* Client data for xCreate/xConnect */ + void(*xDestroy)(void*) /* Module destructor function */ ); /* @@ -5467,10 +5467,10 @@ SQLITE_API int sqlite3_create_module_v2( ** freed by sqlite3_free() and the zErrMsg field will be zeroed. */ struct sqlite3_vtab { - const sqlite3_module *pModule; /* The module for this virtual table */ - int nRef; /* NO LONGER USED */ - char *zErrMsg; /* Error message from sqlite3_mprintf() */ - /* Virtual table implementations will typically add additional fields */ + const sqlite3_module *pModule; /* The module for this virtual table */ + int nRef; /* NO LONGER USED */ + char *zErrMsg; /* Error message from sqlite3_mprintf() */ + /* Virtual table implementations will typically add additional fields */ }; /* @@ -5491,8 +5491,8 @@ struct sqlite3_vtab { ** are common to all implementations. */ struct sqlite3_vtab_cursor { - sqlite3_vtab *pVtab; /* Virtual table of this cursor */ - /* Virtual table implementations will typically add additional fields */ + sqlite3_vtab *pVtab; /* Virtual table of this cursor */ + /* Virtual table implementations will typically add additional fields */ }; /* @@ -5509,7 +5509,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); ** CAPI3REF: Overload A Function For A Virtual Table ** ** ^(Virtual tables can provide alternative implementations of functions -** using the [xFindFunction] method of the [virtual table module]. +** using the [xFindFunction] method of the [virtual table module]. ** But global versions of those functions ** must exist in order to be overloaded.)^ ** @@ -5560,8 +5560,8 @@ typedef struct sqlite3_blob sqlite3_blob; ** ** ^If the flags parameter is non-zero, then the BLOB is opened for read ** and write access. ^If it is zero, the BLOB is opened for read access. -** ^It is not possible to open a column that is part of an index or primary -** key for writing. ^If [foreign key constraints] are enabled, it is +** ^It is not possible to open a column that is part of an index or primary +** key for writing. ^If [foreign key constraints] are enabled, it is ** not possible to open a column that is part of a [child key] for writing. ** ** ^Note that the database name is not the filename that contains @@ -5607,13 +5607,13 @@ typedef struct sqlite3_blob sqlite3_blob; ** be released by a call to [sqlite3_blob_close()]. */ SQLITE_API int sqlite3_blob_open( - sqlite3*, - const char *zDb, - const char *zTable, - const char *zColumn, - sqlite3_int64 iRow, - int flags, - sqlite3_blob **ppBlob + sqlite3*, + const char *zDb, + const char *zTable, + const char *zColumn, + sqlite3_int64 iRow, + int flags, + sqlite3_blob **ppBlob ); /* @@ -5667,7 +5667,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *); /* ** CAPI3REF: Return The Size Of An Open BLOB ** -** ^Returns the size in bytes of the BLOB accessible via the +** ^Returns the size in bytes of the BLOB accessible via the ** successfully opened [BLOB handle] in its only argument. ^The ** incremental blob I/O routines can only read or overwriting existing ** blob content; they cannot change the size of a blob. @@ -5964,15 +5964,15 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); */ typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; struct sqlite3_mutex_methods { - int (*xMutexInit)(void); - int (*xMutexEnd)(void); - sqlite3_mutex *(*xMutexAlloc)(int); - void (*xMutexFree)(sqlite3_mutex *); - void (*xMutexEnter)(sqlite3_mutex *); - int (*xMutexTry)(sqlite3_mutex *); - void (*xMutexLeave)(sqlite3_mutex *); - int (*xMutexHeld)(sqlite3_mutex *); - int (*xMutexNotheld)(sqlite3_mutex *); + int (*xMutexInit)(void); + int (*xMutexEnd)(void); + sqlite3_mutex *(*xMutexAlloc)(int); + void (*xMutexFree)(sqlite3_mutex *); + void (*xMutexEnter)(sqlite3_mutex *); + int (*xMutexTry)(sqlite3_mutex *); + void (*xMutexLeave)(sqlite3_mutex *); + int (*xMutexHeld)(sqlite3_mutex *); + int (*xMutexNotheld)(sqlite3_mutex *); }; /* @@ -6033,7 +6033,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); /* ** CAPI3REF: Retrieve the mutex for a database connection ** -** ^This interface returns a pointer the [sqlite3_mutex] object that +** ^This interface returns a pointer the [sqlite3_mutex] object that ** serializes access to the [database connection] given in the argument ** when the [threading mode] is Serialized. ** ^If the [threading mode] is Single-thread or Multi-thread then this @@ -6179,7 +6179,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF **
    This parameter records the largest memory allocation request ** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their ** internal equivalents). Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. +** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
    )^ ** ** [[SQLITE_STATUS_MALLOC_COUNT]] ^(
    SQLITE_STATUS_MALLOC_COUNT
    @@ -6188,11 +6188,11 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF ** ** [[SQLITE_STATUS_PAGECACHE_USED]] ^(
    SQLITE_STATUS_PAGECACHE_USED
    **
    This parameter returns the number of pages used out of the -** [pagecache memory allocator] that was configured using +** [pagecache memory allocator] that was configured using ** [SQLITE_CONFIG_PAGECACHE]. The ** value returned is in pages, not in bytes.
    )^ ** -** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] +** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] ** ^(
    SQLITE_STATUS_PAGECACHE_OVERFLOW
    **
    This parameter returns the number of bytes of page cache ** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE] @@ -6205,7 +6205,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF ** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(
    SQLITE_STATUS_PAGECACHE_SIZE
    **
    This parameter records the largest memory allocation request ** handed to [pagecache memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. +** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
    )^ ** ** [[SQLITE_STATUS_SCRATCH_USED]] ^(
    SQLITE_STATUS_SCRATCH_USED
    @@ -6229,7 +6229,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF ** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(
    SQLITE_STATUS_SCRATCH_SIZE
    **
    This parameter records the largest memory allocation request ** handed to [scratch memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. +** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
    )^ ** ** [[SQLITE_STATUS_PARSER_STACK]] ^(
    SQLITE_STATUS_PARSER_STACK
    @@ -6253,12 +6253,12 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF /* ** CAPI3REF: Database Connection Status ** -** ^This interface is used to retrieve runtime status information +** ^This interface is used to retrieve runtime status information ** about a single [database connection]. ^The first argument is the ** database connection object to be interrogated. ^The second argument ** is an integer constant, taken from the set of ** [SQLITE_DBSTATUS options], that -** determines the parameter to interrogate. The set of +** determines the parameter to interrogate. The set of ** [SQLITE_DBSTATUS options] is likely ** to grow in future releases of SQLite. ** @@ -6293,7 +6293,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r ** checked out.
  • )^ ** ** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(
    SQLITE_DBSTATUS_LOOKASIDE_HIT
    -**
    This parameter returns the number malloc attempts that were +**
    This parameter returns the number malloc attempts that were ** satisfied using lookaside memory. Only the high-water value is meaningful; ** the current value is always zero.)^ ** @@ -6321,7 +6321,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
    SQLITE_DBSTATUS_SCHEMA_USED
    **
    This parameter returns the approximate number of of bytes of heap ** memory used to store the schema for all databases associated -** with the connection - main, temp, and any [ATTACH]-ed databases.)^ +** with the connection - main, temp, and any [ATTACH]-ed databases.)^ ** ^The full amount of memory used by the schemas is reported, even if the ** schema memory is shared with other database connections due to ** [shared cache mode] being enabled. @@ -6336,13 +6336,13 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r ** ** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(
    SQLITE_DBSTATUS_CACHE_HIT
    **
    This parameter returns the number of pager cache hits that have -** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT +** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT ** is always 0. **
    ** ** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(
    SQLITE_DBSTATUS_CACHE_MISS
    **
    This parameter returns the number of pager cache misses that have -** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS +** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS ** is always 0. **
    ** @@ -6388,7 +6388,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r ** statements. For example, if the number of table steps greatly exceeds ** the number of table searches or result rows, that would tend to indicate ** that the prepared statement is using a full table scan rather than -** an index. +** an index. ** ** ^(This interface is used to retrieve and reset counter values from ** a [prepared statement]. The first argument is the prepared statement @@ -6415,7 +6415,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); ** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]]
    SQLITE_STMTSTATUS_FULLSCAN_STEP
    **
    ^This is the number of times that SQLite has stepped forward in ** a table as part of a full table scan. Large numbers for this counter -** may indicate opportunities for performance improvement through +** may indicate opportunities for performance improvement through ** careful use of indices.
    ** ** [[SQLITE_STMTSTATUS_SORT]]
    SQLITE_STMTSTATUS_SORT
    @@ -6433,7 +6433,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); ** [[SQLITE_STMTSTATUS_VM_STEP]]
    SQLITE_STMTSTATUS_VM_STEP
    **
    ^This is the number of virtual machine operations executed ** by the prepared statement if that number is less than or equal -** to 2147483647. The number of virtual machine operations can be +** to 2147483647. The number of virtual machine operations can be ** used as a proxy for the total work done by the prepared statement. ** If the number of virtual machine operations exceeds 2147483647 ** then the value returned by this statement status code is undefined. @@ -6470,8 +6470,8 @@ typedef struct sqlite3_pcache sqlite3_pcache; */ typedef struct sqlite3_pcache_page sqlite3_pcache_page; struct sqlite3_pcache_page { - void *pBuf; /* The content of the page */ - void *pExtra; /* Extra information associated with the page */ + void *pBuf; /* The content of the page */ + void *pExtra; /* Extra information associated with the page */ }; /* @@ -6479,15 +6479,15 @@ struct sqlite3_pcache_page { ** KEYWORDS: {page cache} ** ** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can -** register an alternative page cache implementation by passing in an +** register an alternative page cache implementation by passing in an ** instance of the sqlite3_pcache_methods2 structure.)^ -** In many applications, most of the heap memory allocated by +** In many applications, most of the heap memory allocated by ** SQLite is used for the page cache. -** By implementing a +** By implementing a ** custom page cache using this API, an application can better control -** the amount of memory consumed by SQLite, the way in which -** that memory is allocated and released, and the policies used to -** determine exactly which parts of a database file are cached and for +** the amount of memory consumed by SQLite, the way in which +** that memory is allocated and released, and the policies used to +** determine exactly which parts of a database file are cached and for ** how long. ** ** The alternative page cache mechanism is an @@ -6500,19 +6500,19 @@ struct sqlite3_pcache_page { ** [sqlite3_config()] returns.)^ ** ** [[the xInit() page cache method]] -** ^(The xInit() method is called once for each effective +** ^(The xInit() method is called once for each effective ** call to [sqlite3_initialize()])^ ** (usually only once during the lifetime of the process). ^(The xInit() ** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ -** The intent of the xInit() method is to set up global data structures -** required by the custom page cache implementation. -** ^(If the xInit() method is NULL, then the +** The intent of the xInit() method is to set up global data structures +** required by the custom page cache implementation. +** ^(If the xInit() method is NULL, then the ** built-in default page cache is used instead of the application defined ** page cache.)^ ** ** [[the xShutdown() page cache method]] ** ^The xShutdown() method is called by [sqlite3_shutdown()]. -** It can be used to clean up +** It can be used to clean up ** any outstanding resources before process shutdown, if required. ** ^The xShutdown() method may be NULL. ** @@ -6531,7 +6531,7 @@ struct sqlite3_pcache_page { ** though this is not guaranteed. ^The ** first parameter, szPage, is the size in bytes of the pages that must ** be allocated by the cache. ^szPage will always a power of two. ^The -** second parameter szExtra is a number of bytes of extra storage +** second parameter szExtra is a number of bytes of extra storage ** associated with each page cache entry. ^The szExtra parameter will ** a number less than 250. SQLite will use the ** extra szExtra bytes on each page to store metadata about the underlying @@ -6544,7 +6544,7 @@ struct sqlite3_pcache_page { ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will ** never invoke xUnpin() except to deliberately delete a page. ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to -** false will always have the "discard" flag set to true. +** false will always have the "discard" flag set to true. ** ^Hence, a cache created with bPurgeable false will ** never contain any unpinned pages. ** @@ -6559,12 +6559,12 @@ struct sqlite3_pcache_page { ** [[the xPagecount() page cache methods]] ** The xPagecount() method must return the number of pages currently ** stored in the cache, both pinned and unpinned. -** +** ** [[the xFetch() page cache methods]] -** The xFetch() method locates a page in the cache and returns a pointer to +** The xFetch() method locates a page in the cache and returns a pointer to ** an sqlite3_pcache_page object associated with that page, or a NULL pointer. ** The pBuf element of the returned sqlite3_pcache_page object will be a -** pointer to a buffer of szPage bytes used to store the content of a +** pointer to a buffer of szPage bytes used to store the content of a ** single database page. The pExtra element of sqlite3_pcache_page will be ** a pointer to the szExtra bytes of extra storage that SQLite has requested ** for each entry in the page cache. @@ -6603,8 +6603,8 @@ struct sqlite3_pcache_page { ** page cache implementation. ^The page cache implementation ** may choose to evict unpinned pages at any time. ** -** The cache must not perform any reference counting. A single -** call to xUnpin() unpins the page regardless of the number of prior calls +** The cache must not perform any reference counting. A single +** call to xUnpin() unpins the page regardless of the number of prior calls ** to xFetch(). ** ** [[the xRekey() page cache methods]] @@ -6635,20 +6635,20 @@ struct sqlite3_pcache_page { */ typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; struct sqlite3_pcache_methods2 { - int iVersion; - void *pArg; - int (*xInit)(void*); - void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); - void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, - unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); - void (*xShrink)(sqlite3_pcache*); + int iVersion; + void *pArg; + int (*xInit)(void*); + void (*xShutdown)(void*); + sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); + void (*xCachesize)(sqlite3_pcache*, int nCachesize); + int (*xPagecount)(sqlite3_pcache*); + sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); + void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, + unsigned oldKey, unsigned newKey); + void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(sqlite3_pcache*); + void (*xShrink)(sqlite3_pcache*); }; /* @@ -6658,17 +6658,17 @@ struct sqlite3_pcache_methods2 { */ typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; struct sqlite3_pcache_methods { - void *pArg; - int (*xInit)(void*); - void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, void*, int discard); - void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); + void *pArg; + int (*xInit)(void*); + void (*xShutdown)(void*); + sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); + void (*xCachesize)(sqlite3_pcache*, int nCachesize); + int (*xPagecount)(sqlite3_pcache*); + void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(sqlite3_pcache*, void*, int discard); + void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); + void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(sqlite3_pcache*); }; @@ -6689,7 +6689,7 @@ typedef struct sqlite3_backup sqlite3_backup; ** ** The backup API copies the content of one database into another. ** It is useful either for creating backups of databases or -** for copying in-memory databases to or from persistent files. +** for copying in-memory databases to or from persistent files. ** ** See Also: [Using the SQLite Online Backup API] ** @@ -6700,28 +6700,28 @@ typedef struct sqlite3_backup sqlite3_backup; ** ^Thus, the backup may be performed on a live source database without ** preventing other database connections from ** reading or writing to the source database while the backup is underway. -** -** ^(To perform a backup operation: +** +** ^(To perform a backup operation: **
      **
    1. sqlite3_backup_init() is called once to initialize the -** backup, -**
    2. sqlite3_backup_step() is called one or more times to transfer +** backup, +**
    3. sqlite3_backup_step() is called one or more times to transfer ** the data between the two databases, and finally -**
    4. sqlite3_backup_finish() is called to release all resources -** associated with the backup operation. +**
    5. sqlite3_backup_finish() is called to release all resources +** associated with the backup operation. **
    )^ ** There should be exactly one call to sqlite3_backup_finish() for each ** successful call to sqlite3_backup_init(). ** ** [[sqlite3_backup_init()]] sqlite3_backup_init() ** -** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the -** [database connection] associated with the destination database +** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the +** [database connection] associated with the destination database ** and the database name, respectively. ** ^The database name is "main" for the main database, "temp" for the ** temporary database, or the name specified after the AS keyword in ** an [ATTACH] statement for an attached database. -** ^The S and M arguments passed to +** ^The S and M arguments passed to ** sqlite3_backup_init(D,N,S,M) identify the [database connection] ** and database name of the source database, respectively. ** ^The source and destination [database connections] (parameters S and D) @@ -6737,14 +6737,14 @@ typedef struct sqlite3_backup sqlite3_backup; ** ^A successful call to sqlite3_backup_init() returns a pointer to an ** [sqlite3_backup] object. ** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and -** sqlite3_backup_finish() functions to perform the specified backup +** sqlite3_backup_finish() functions to perform the specified backup ** operation. ** ** [[sqlite3_backup_step()]] sqlite3_backup_step() ** -** ^Function sqlite3_backup_step(B,N) will copy up to N pages between +** ^Function sqlite3_backup_step(B,N) will copy up to N pages between ** the source and destination databases specified by [sqlite3_backup] object B. -** ^If N is negative, all remaining source pages are copied. +** ^If N is negative, all remaining source pages are copied. ** ^If sqlite3_backup_step(B,N) successfully copies N pages and there ** are still more pages to be copied, then the function returns [SQLITE_OK]. ** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages @@ -6766,8 +6766,8 @@ typedef struct sqlite3_backup sqlite3_backup; ** ** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then ** the [sqlite3_busy_handler | busy-handler function] -** is invoked (if one is specified). ^If the -** busy-handler returns non-zero before the lock is available, then +** is invoked (if one is specified). ^If the +** busy-handler returns non-zero before the lock is available, then ** [SQLITE_BUSY] is returned to the caller. ^In this case the call to ** sqlite3_backup_step() can be retried later. ^If the source ** [database connection] @@ -6775,15 +6775,15 @@ typedef struct sqlite3_backup sqlite3_backup; ** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this ** case the call to sqlite3_backup_step() can be retried later on. ^(If ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or -** [SQLITE_READONLY] is returned, then -** there is no point in retrying the call to sqlite3_backup_step(). These -** errors are considered fatal.)^ The application must accept -** that the backup operation has failed and pass the backup operation handle +** [SQLITE_READONLY] is returned, then +** there is no point in retrying the call to sqlite3_backup_step(). These +** errors are considered fatal.)^ The application must accept +** that the backup operation has failed and pass the backup operation handle ** to the sqlite3_backup_finish() to release associated resources. ** ** ^The first call to sqlite3_backup_step() obtains an exclusive lock -** on the destination file. ^The exclusive lock is not released until either -** sqlite3_backup_finish() is called or the backup operation is complete +** on the destination file. ^The exclusive lock is not released until either +** sqlite3_backup_finish() is called or the backup operation is complete ** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to ** sqlite3_backup_step() obtains a [shared lock] on the source database that ** lasts for the duration of the sqlite3_backup_step() call. @@ -6792,18 +6792,18 @@ typedef struct sqlite3_backup sqlite3_backup; ** through the backup process. ^If the source database is modified by an ** external process or via a database connection other than the one being ** used by the backup operation, then the backup will be automatically -** restarted by the next call to sqlite3_backup_step(). ^If the source +** restarted by the next call to sqlite3_backup_step(). ^If the source ** database is modified by the using the same database connection as is used ** by the backup operation, then the backup database is automatically ** updated at the same time. ** ** [[sqlite3_backup_finish()]] sqlite3_backup_finish() ** -** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the +** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the ** application wishes to abandon the backup operation, the application ** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). ** ^The sqlite3_backup_finish() interfaces releases all -** resources associated with the [sqlite3_backup] object. +** resources associated with the [sqlite3_backup] object. ** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any ** active write-transaction on the destination database is rolled back. ** The [sqlite3_backup] object is invalid @@ -6843,8 +6843,8 @@ typedef struct sqlite3_backup sqlite3_backup; ** connections, then the source database connection may be used concurrently ** from within other threads. ** -** However, the application must guarantee that the destination -** [database connection] is not passed to any other API (by any thread) after +** However, the application must guarantee that the destination +** [database connection] is not passed to any other API (by any thread) after ** sqlite3_backup_init() is called and before the corresponding call to ** sqlite3_backup_finish(). SQLite does not currently check to see ** if the application incorrectly accesses the destination [database connection] @@ -6855,11 +6855,11 @@ typedef struct sqlite3_backup sqlite3_backup; ** If running in [shared cache mode], the application must ** guarantee that the shared cache used by the destination database ** is not accessed while the backup is running. In practice this means -** that the application must guarantee that the disk file being +** that the application must guarantee that the disk file being ** backed up to is not accessed by any connection within the process, ** not just the specific connection that was passed to sqlite3_backup_init(). ** -** The [sqlite3_backup] object itself is partially threadsafe. Multiple +** The [sqlite3_backup] object itself is partially threadsafe. Multiple ** threads may safely make multiple concurrent calls to sqlite3_backup_step(). ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() ** APIs are not strictly speaking threadsafe. If they are invoked at the @@ -6867,10 +6867,10 @@ typedef struct sqlite3_backup sqlite3_backup; ** possible that they return invalid values. */ SQLITE_API sqlite3_backup *sqlite3_backup_init( - sqlite3 *pDest, /* Destination database handle */ - const char *zDestName, /* Destination database name */ - sqlite3 *pSource, /* Source database handle */ - const char *zSourceName /* Source database name */ + sqlite3 *pDest, /* Destination database handle */ + const char *zDestName, /* Destination database name */ + sqlite3 *pSource, /* Source database handle */ + const char *zSourceName /* Source database name */ ); SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); @@ -6883,8 +6883,8 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** ^When running in shared-cache mode, a database operation may fail with ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or ** individual tables within the shared-cache cannot be obtained. See -** [SQLite Shared-Cache Mode] for a description of shared-cache locking. -** ^This API may be used to register a callback that SQLite will invoke +** [SQLite Shared-Cache Mode] for a description of shared-cache locking. +** ^This API may be used to register a callback that SQLite will invoke ** when the connection currently holding the required lock relinquishes it. ** ^This API is only available if the library was compiled with the ** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. @@ -6892,14 +6892,14 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** See Also: [Using the SQLite Unlock Notification Feature]. ** ** ^Shared-cache locks are released when a database connection concludes -** its current transaction, either by committing it or rolling it back. +** its current transaction, either by committing it or rolling it back. ** ** ^When a connection (known as the blocked connection) fails to obtain a ** shared-cache lock and SQLITE_LOCKED is returned to the caller, the ** identity of the database connection (the blocking connection) that -** has locked the required resource is stored internally. ^After an +** has locked the required resource is stored internally. ^After an ** application receives an SQLITE_LOCKED error, it may call the -** sqlite3_unlock_notify() method with the blocked connection handle as +** sqlite3_unlock_notify() method with the blocked connection handle as ** the first argument to register for a callback that will be invoked ** when the blocking connections current transaction is concluded. ^The ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] @@ -6913,15 +6913,15 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** ** ^If the blocked connection is attempting to obtain a write-lock on a ** shared-cache table, and more than one other connection currently holds -** a read-lock on the same table, then SQLite arbitrarily selects one of +** a read-lock on the same table, then SQLite arbitrarily selects one of ** the other connections to use as the blocking connection. ** -** ^(There may be at most one unlock-notify callback registered by a +** ^(There may be at most one unlock-notify callback registered by a ** blocked connection. If sqlite3_unlock_notify() is called when the ** blocked connection already has a registered unlock-notify callback, ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is canceled. ^The blocked connections +** unlock-notify callback is canceled. ^The blocked connections ** unlock-notify callback may also be canceled by closing the blocked ** connection using [sqlite3_close()]. ** @@ -6934,7 +6934,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** ** Callback Invocation Details ** -** When an unlock-notify callback is registered, the application provides a +** When an unlock-notify callback is registered, the application provides a ** single void* pointer that is passed to the callback when it is invoked. ** However, the signature of the callback function allows SQLite to pass ** it an array of void* context pointers. The first argument passed to @@ -6947,12 +6947,12 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** same callback function, then instead of invoking the callback function ** multiple times, it is invoked once with the set of void* context pointers ** specified by the blocked connections bundled together into an array. -** This gives the application an opportunity to prioritize any actions +** This gives the application an opportunity to prioritize any actions ** related to the set of unblocked database connections. ** ** Deadlock Detection ** -** Assuming that after registering for an unlock-notify callback a +** Assuming that after registering for an unlock-notify callback a ** database waits for the callback to be issued before taking any further ** action (a reasonable assumption), then using this API may cause the ** application to deadlock. For example, if connection X is waiting for @@ -6975,7 +6975,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** ** The "DROP TABLE" Exception ** -** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost +** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost ** always appropriate to call sqlite3_unlock_notify(). There is however, ** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, ** SQLite checks if there are any currently executing SELECT statements @@ -6988,13 +6988,13 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** One way around this problem is to check the extended error code returned ** by an sqlite3_step() call. ^(If there is a blocking connection, then the ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in -** the special "DROP TABLE/INDEX" case, the extended error code is just +** the special "DROP TABLE/INDEX" case, the extended error code is just ** SQLITE_LOCKED.)^ */ SQLITE_API int sqlite3_unlock_notify( - sqlite3 *pBlocked, /* Waiting connection */ - void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ - void *pNotifyArg /* Argument to pass to xNotify */ + sqlite3 *pBlocked, /* Waiting connection */ + void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ + void *pNotifyArg /* Argument to pass to xNotify */ ); @@ -7053,10 +7053,10 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** ^The [sqlite3_wal_hook()] function is used to register a callback that ** will be invoked each time a database connection commits data to a ** [write-ahead log] (i.e. whenever a transaction is committed in -** [journal_mode | journal_mode=WAL mode]). +** [journal_mode | journal_mode=WAL mode]). ** -** ^The callback is invoked by SQLite after the commit has taken place and -** the associated write-lock on the database released, so the implementation +** ^The callback is invoked by SQLite after the commit has taken place and +** the associated write-lock on the database released, so the implementation ** may read, write or [checkpoint] the database as required. ** ** ^The first parameter passed to the callback function when it is invoked @@ -7075,7 +7075,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** that does not correspond to any valid SQLite error code, the results ** are undefined. ** -** A single database handle may have at most a single write-ahead log callback +** A single database handle may have at most a single write-ahead log callback ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any ** previously registered write-ahead log callback. ^Note that the ** [sqlite3_wal_autocheckpoint()] interface and the @@ -7083,9 +7083,9 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** those overwrite any prior [sqlite3_wal_hook()] settings. */ SQLITE_API void *sqlite3_wal_hook( - sqlite3*, - int(*)(void *,sqlite3*,const char*,int), - void* + sqlite3*, + int(*)(void *,sqlite3*,const char*,int), + void* ); /* @@ -7095,7 +7095,7 @@ SQLITE_API void *sqlite3_wal_hook( ** [sqlite3_wal_hook()] that causes any database on [database connection] D ** to automatically [checkpoint] ** after committing a transaction if there are N or -** more frames in the [write-ahead log] file. ^Passing zero or +** more frames in the [write-ahead log] file. ^Passing zero or ** a negative value as the nFrame parameter disables automatic ** checkpoints entirely. ** @@ -7136,15 +7136,15 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); /* ** CAPI3REF: Checkpoint a database ** -** Run a checkpoint operation on WAL database zDb attached to database -** handle db. The specific operation is determined by the value of the +** Run a checkpoint operation on WAL database zDb attached to database +** handle db. The specific operation is determined by the value of the ** eMode parameter: ** **
    **
    SQLITE_CHECKPOINT_PASSIVE
    -** Checkpoint as many frames as possible without waiting for any database +** Checkpoint as many frames as possible without waiting for any database ** readers or writers to finish. Sync the db file if all frames in the log -** are checkpointed. This mode is the same as calling +** are checkpointed. This mode is the same as calling ** sqlite3_wal_checkpoint(). The busy-handler callback is never invoked. ** **
    SQLITE_CHECKPOINT_FULL
    @@ -7155,10 +7155,10 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); ** but not database readers. ** **
    SQLITE_CHECKPOINT_RESTART
    -** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after +** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after ** checkpointing the log file it blocks (calls the busy-handler callback) -** until all readers are reading from the database file only. This ensures -** that the next client to write to the database file restarts the log file +** until all readers are reading from the database file only. This ensures +** that the next client to write to the database file restarts the log file ** from the beginning. This call blocks database writers while it is running, ** but not database readers. **
    @@ -7172,30 +7172,30 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); ** before returning to communicate this to the caller. ** ** All calls obtain an exclusive "checkpoint" lock on the database file. If -** any other process is running a checkpoint operation at the same time, the -** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a +** any other process is running a checkpoint operation at the same time, the +** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a ** busy-handler configured, it will not be invoked in this case. ** -** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive +** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive ** "writer" lock on the database file. If the writer lock cannot be obtained ** immediately, and a busy-handler is configured, it is invoked and the writer ** lock retried until either the busy-handler returns 0 or the lock is ** successfully obtained. The busy-handler is also invoked while waiting for ** database readers as described above. If the busy-handler returns 0 before ** the writer lock is obtained or while waiting for database readers, the -** checkpoint operation proceeds from that point in the same way as -** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible +** checkpoint operation proceeds from that point in the same way as +** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible ** without blocking any further. SQLITE_BUSY is returned in this case. ** ** If parameter zDb is NULL or points to a zero length string, then the ** specified operation is attempted on all WAL databases. In this case the -** values written to output parameters *pnLog and *pnCkpt are undefined. If -** an SQLITE_BUSY error is encountered when processing one or more of the -** attached WAL databases, the operation is still attempted on any remaining -** attached databases and SQLITE_BUSY is returned to the caller. If any other -** error occurs while processing an attached database, processing is abandoned -** and the error code returned to the caller immediately. If no error -** (SQLITE_BUSY or otherwise) is encountered while processing the attached +** values written to output parameters *pnLog and *pnCkpt are undefined. If +** an SQLITE_BUSY error is encountered when processing one or more of the +** attached WAL databases, the operation is still attempted on any remaining +** attached databases and SQLITE_BUSY is returned to the caller. If any other +** error occurs while processing an attached database, processing is abandoned +** and the error code returned to the caller immediately. If no error +** (SQLITE_BUSY or otherwise) is encountered while processing the attached ** databases, SQLITE_OK is returned. ** ** If database zDb is the name of an attached database that is not in WAL @@ -7204,11 +7204,11 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); ** attached database, SQLITE_ERROR is returned to the caller. */ SQLITE_API int sqlite3_wal_checkpoint_v2( - sqlite3 *db, /* Database handle */ - const char *zDb, /* Name of attached database (or NULL) */ - int eMode, /* SQLITE_CHECKPOINT_* value */ - int *pnLog, /* OUT: Size of WAL log in frames */ - int *pnCkpt /* OUT: Total number of frames checkpointed */ + sqlite3 *db, /* Database handle */ + const char *zDb, /* Name of attached database (or NULL) */ + int eMode, /* SQLITE_CHECKPOINT_* value */ + int *pnLog, /* OUT: Size of WAL log in frames */ + int *pnCkpt /* OUT: Total number of frames checkpointed */ ); /* @@ -7261,20 +7261,20 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); ** If X is non-zero, then the virtual table implementation guarantees ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before ** any modifications to internal or persistent data structures have been made. -** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite +** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite ** is able to roll back a statement or database transaction, and abandon -** or continue processing the current SQL statement as appropriate. +** or continue processing the current SQL statement as appropriate. ** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns ** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode ** had been ABORT. ** ** Virtual table implementations that are required to handle OR REPLACE -** must do so within the [xUpdate] method. If a call to the -** [sqlite3_vtab_on_conflict()] function indicates that the current ON -** CONFLICT policy is REPLACE, the virtual table implementation should +** must do so within the [xUpdate] method. If a call to the +** [sqlite3_vtab_on_conflict()] function indicates that the current ON +** CONFLICT policy is REPLACE, the virtual table implementation should ** silently replace the appropriate rows within the xUpdate callback and ** return SQLITE_OK. Or, if this is not possible, it may return -** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT +** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT ** constraint handling. ** */ @@ -7354,14 +7354,14 @@ typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; ** SELECT ... FROM WHERE MATCH $zGeom(... params ...) */ SQLITE_API int sqlite3_rtree_geometry_callback( - sqlite3 *db, - const char *zGeom, + sqlite3 *db, + const char *zGeom, #ifdef SQLITE_RTREE_INT_ONLY - int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes), + int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes), #else - int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes), + int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes), #endif - void *pContext + void *pContext ); @@ -7370,11 +7370,11 @@ SQLITE_API int sqlite3_rtree_geometry_callback( ** argument to callbacks registered using rtree_geometry_callback(). */ struct sqlite3_rtree_geometry { - void *pContext; /* Copy of pContext passed to s_r_g_c() */ - int nParam; /* Size of array aParam[] */ - double *aParam; /* Parameters passed to SQL geom function */ - void *pUser; /* Callback implementation user data */ - void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ + void *pContext; /* Copy of pContext passed to s_r_g_c() */ + int nParam; /* Size of array aParam[] */ + double *aParam; /* Parameters passed to SQL geom function */ + void *pUser; /* Callback implementation user data */ + void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ }; @@ -7383,4 +7383,3 @@ struct sqlite3_rtree_geometry { #endif #endif /* ifndef _SQLITE3RTREE_H_ */ - diff --git a/src/lib/sqlite3/sqlite3ext.h b/src/lib/sqlite3/sqlite3ext.h index ecf93f62f6c..c4e7db38517 100644 --- a/src/lib/sqlite3/sqlite3ext.h +++ b/src/lib/sqlite3/sqlite3ext.h @@ -12,7 +12,7 @@ ** This header file defines the SQLite interface for use by ** shared libraries that want to be imported as extensions into ** an SQLite instance. Shared libraries that intend to be loaded -** as extensions by SQLite should #include this file instead of +** as extensions by SQLite should #include this file instead of ** sqlite3.h. */ #ifndef _SQLITE3EXT_H_ @@ -32,224 +32,224 @@ typedef struct sqlite3_api_routines sqlite3_api_routines; ** libraries! */ struct sqlite3_api_routines { - void * (*aggregate_context)(sqlite3_context*,int nBytes); - int (*aggregate_count)(sqlite3_context*); - int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); - int (*bind_double)(sqlite3_stmt*,int,double); - int (*bind_int)(sqlite3_stmt*,int,int); - int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); - int (*bind_null)(sqlite3_stmt*,int); - int (*bind_parameter_count)(sqlite3_stmt*); - int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); - const char * (*bind_parameter_name)(sqlite3_stmt*,int); - int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); - int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); - int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); - int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); - int (*busy_timeout)(sqlite3*,int ms); - int (*changes)(sqlite3*); - int (*close)(sqlite3*); - int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, - int eTextRep,const char*)); - int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, - int eTextRep,const void*)); - const void * (*column_blob)(sqlite3_stmt*,int iCol); - int (*column_bytes)(sqlite3_stmt*,int iCol); - int (*column_bytes16)(sqlite3_stmt*,int iCol); - int (*column_count)(sqlite3_stmt*pStmt); - const char * (*column_database_name)(sqlite3_stmt*,int); - const void * (*column_database_name16)(sqlite3_stmt*,int); - const char * (*column_decltype)(sqlite3_stmt*,int i); - const void * (*column_decltype16)(sqlite3_stmt*,int); - double (*column_double)(sqlite3_stmt*,int iCol); - int (*column_int)(sqlite3_stmt*,int iCol); - sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); - const char * (*column_name)(sqlite3_stmt*,int); - const void * (*column_name16)(sqlite3_stmt*,int); - const char * (*column_origin_name)(sqlite3_stmt*,int); - const void * (*column_origin_name16)(sqlite3_stmt*,int); - const char * (*column_table_name)(sqlite3_stmt*,int); - const void * (*column_table_name16)(sqlite3_stmt*,int); - const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); - const void * (*column_text16)(sqlite3_stmt*,int iCol); - int (*column_type)(sqlite3_stmt*,int iCol); - sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); - void * (*commit_hook)(sqlite3*,int(*)(void*),void*); - int (*complete)(const char*sql); - int (*complete16)(const void*sql); - int (*create_collation)(sqlite3*,const char*,int,void*, - int(*)(void*,int,const void*,int,const void*)); - int (*create_collation16)(sqlite3*,const void*,int,void*, - int(*)(void*,int,const void*,int,const void*)); - int (*create_function)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_function16)(sqlite3*,const void*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); - int (*data_count)(sqlite3_stmt*pStmt); - sqlite3 * (*db_handle)(sqlite3_stmt*); - int (*declare_vtab)(sqlite3*,const char*); - int (*enable_shared_cache)(int); - int (*errcode)(sqlite3*db); - const char * (*errmsg)(sqlite3*); - const void * (*errmsg16)(sqlite3*); - int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); - int (*expired)(sqlite3_stmt*); - int (*finalize)(sqlite3_stmt*pStmt); - void (*free)(void*); - void (*free_table)(char**result); - int (*get_autocommit)(sqlite3*); - void * (*get_auxdata)(sqlite3_context*,int); - int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); - int (*global_recover)(void); - void (*interruptx)(sqlite3*); - sqlite_int64 (*last_insert_rowid)(sqlite3*); - const char * (*libversion)(void); - int (*libversion_number)(void); - void *(*malloc)(int); - char * (*mprintf)(const char*,...); - int (*open)(const char*,sqlite3**); - int (*open16)(const void*,sqlite3**); - int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); - void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); - void *(*realloc)(void*,int); - int (*reset)(sqlite3_stmt*pStmt); - void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_double)(sqlite3_context*,double); - void (*result_error)(sqlite3_context*,const char*,int); - void (*result_error16)(sqlite3_context*,const void*,int); - void (*result_int)(sqlite3_context*,int); - void (*result_int64)(sqlite3_context*,sqlite_int64); - void (*result_null)(sqlite3_context*); - void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); - void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_value)(sqlite3_context*,sqlite3_value*); - void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); - int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, - const char*,const char*),void*); - void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); - char * (*snprintf)(int,char*,const char*,...); - int (*step)(sqlite3_stmt*); - int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, - char const**,char const**,int*,int*,int*); - void (*thread_cleanup)(void); - int (*total_changes)(sqlite3*); - void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); - int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); - void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, - sqlite_int64),void*); - void * (*user_data)(sqlite3_context*); - const void * (*value_blob)(sqlite3_value*); - int (*value_bytes)(sqlite3_value*); - int (*value_bytes16)(sqlite3_value*); - double (*value_double)(sqlite3_value*); - int (*value_int)(sqlite3_value*); - sqlite_int64 (*value_int64)(sqlite3_value*); - int (*value_numeric_type)(sqlite3_value*); - const unsigned char * (*value_text)(sqlite3_value*); - const void * (*value_text16)(sqlite3_value*); - const void * (*value_text16be)(sqlite3_value*); - const void * (*value_text16le)(sqlite3_value*); - int (*value_type)(sqlite3_value*); - char *(*vmprintf)(const char*,va_list); - /* Added ??? */ - int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); - /* Added by 3.3.13 */ - int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - int (*clear_bindings)(sqlite3_stmt*); - /* Added by 3.4.1 */ - int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, - void (*xDestroy)(void *)); - /* Added by 3.5.0 */ - int (*bind_zeroblob)(sqlite3_stmt*,int,int); - int (*blob_bytes)(sqlite3_blob*); - int (*blob_close)(sqlite3_blob*); - int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, - int,sqlite3_blob**); - int (*blob_read)(sqlite3_blob*,void*,int,int); - int (*blob_write)(sqlite3_blob*,const void*,int,int); - int (*create_collation_v2)(sqlite3*,const char*,int,void*, - int(*)(void*,int,const void*,int,const void*), - void(*)(void*)); - int (*file_control)(sqlite3*,const char*,int,void*); - sqlite3_int64 (*memory_highwater)(int); - sqlite3_int64 (*memory_used)(void); - sqlite3_mutex *(*mutex_alloc)(int); - void (*mutex_enter)(sqlite3_mutex*); - void (*mutex_free)(sqlite3_mutex*); - void (*mutex_leave)(sqlite3_mutex*); - int (*mutex_try)(sqlite3_mutex*); - int (*open_v2)(const char*,sqlite3**,int,const char*); - int (*release_memory)(int); - void (*result_error_nomem)(sqlite3_context*); - void (*result_error_toobig)(sqlite3_context*); - int (*sleep)(int); - void (*soft_heap_limit)(int); - sqlite3_vfs *(*vfs_find)(const char*); - int (*vfs_register)(sqlite3_vfs*,int); - int (*vfs_unregister)(sqlite3_vfs*); - int (*xthreadsafe)(void); - void (*result_zeroblob)(sqlite3_context*,int); - void (*result_error_code)(sqlite3_context*,int); - int (*test_control)(int, ...); - void (*randomness)(int,void*); - sqlite3 *(*context_db_handle)(sqlite3_context*); - int (*extended_result_codes)(sqlite3*,int); - int (*limit)(sqlite3*,int,int); - sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); - const char *(*sql)(sqlite3_stmt*); - int (*status)(int,int*,int*,int); - int (*backup_finish)(sqlite3_backup*); - sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); - int (*backup_pagecount)(sqlite3_backup*); - int (*backup_remaining)(sqlite3_backup*); - int (*backup_step)(sqlite3_backup*,int); - const char *(*compileoption_get)(int); - int (*compileoption_used)(const char*); - int (*create_function_v2)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void(*xDestroy)(void*)); - int (*db_config)(sqlite3*,int,...); - sqlite3_mutex *(*db_mutex)(sqlite3*); - int (*db_status)(sqlite3*,int,int*,int*,int); - int (*extended_errcode)(sqlite3*); - void (*log)(int,const char*,...); - sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); - const char *(*sourceid)(void); - int (*stmt_status)(sqlite3_stmt*,int,int); - int (*strnicmp)(const char*,const char*,int); - int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); - int (*wal_autocheckpoint)(sqlite3*,int); - int (*wal_checkpoint)(sqlite3*,const char*); - void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); - int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); - int (*vtab_config)(sqlite3*,int op,...); - int (*vtab_on_conflict)(sqlite3*); - /* Version 3.7.16 and later */ - int (*close_v2)(sqlite3*); - const char *(*db_filename)(sqlite3*,const char*); - int (*db_readonly)(sqlite3*,const char*); - int (*db_release_memory)(sqlite3*); - const char *(*errstr)(int); - int (*stmt_busy)(sqlite3_stmt*); - int (*stmt_readonly)(sqlite3_stmt*); - int (*stricmp)(const char*,const char*); - int (*uri_boolean)(const char*,const char*,int); - sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); - const char *(*uri_parameter)(const char*,const char*); - char *(*vsnprintf)(int,char*,const char*,va_list); - int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); + void * (*aggregate_context)(sqlite3_context*,int nBytes); + int (*aggregate_count)(sqlite3_context*); + int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); + int (*bind_double)(sqlite3_stmt*,int,double); + int (*bind_int)(sqlite3_stmt*,int,int); + int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); + int (*bind_null)(sqlite3_stmt*,int); + int (*bind_parameter_count)(sqlite3_stmt*); + int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); + const char * (*bind_parameter_name)(sqlite3_stmt*,int); + int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); + int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); + int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); + int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); + int (*busy_timeout)(sqlite3*,int ms); + int (*changes)(sqlite3*); + int (*close)(sqlite3*); + int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, + int eTextRep,const char*)); + int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, + int eTextRep,const void*)); + const void * (*column_blob)(sqlite3_stmt*,int iCol); + int (*column_bytes)(sqlite3_stmt*,int iCol); + int (*column_bytes16)(sqlite3_stmt*,int iCol); + int (*column_count)(sqlite3_stmt*pStmt); + const char * (*column_database_name)(sqlite3_stmt*,int); + const void * (*column_database_name16)(sqlite3_stmt*,int); + const char * (*column_decltype)(sqlite3_stmt*,int i); + const void * (*column_decltype16)(sqlite3_stmt*,int); + double (*column_double)(sqlite3_stmt*,int iCol); + int (*column_int)(sqlite3_stmt*,int iCol); + sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); + const char * (*column_name)(sqlite3_stmt*,int); + const void * (*column_name16)(sqlite3_stmt*,int); + const char * (*column_origin_name)(sqlite3_stmt*,int); + const void * (*column_origin_name16)(sqlite3_stmt*,int); + const char * (*column_table_name)(sqlite3_stmt*,int); + const void * (*column_table_name16)(sqlite3_stmt*,int); + const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); + const void * (*column_text16)(sqlite3_stmt*,int iCol); + int (*column_type)(sqlite3_stmt*,int iCol); + sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); + void * (*commit_hook)(sqlite3*,int(*)(void*),void*); + int (*complete)(const char*sql); + int (*complete16)(const void*sql); + int (*create_collation)(sqlite3*,const char*,int,void*, + int(*)(void*,int,const void*,int,const void*)); + int (*create_collation16)(sqlite3*,const void*,int,void*, + int(*)(void*,int,const void*,int,const void*)); + int (*create_function)(sqlite3*,const char*,int,int,void*, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*)); + int (*create_function16)(sqlite3*,const void*,int,int,void*, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*)); + int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); + int (*data_count)(sqlite3_stmt*pStmt); + sqlite3 * (*db_handle)(sqlite3_stmt*); + int (*declare_vtab)(sqlite3*,const char*); + int (*enable_shared_cache)(int); + int (*errcode)(sqlite3*db); + const char * (*errmsg)(sqlite3*); + const void * (*errmsg16)(sqlite3*); + int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); + int (*expired)(sqlite3_stmt*); + int (*finalize)(sqlite3_stmt*pStmt); + void (*free)(void*); + void (*free_table)(char**result); + int (*get_autocommit)(sqlite3*); + void * (*get_auxdata)(sqlite3_context*,int); + int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); + int (*global_recover)(void); + void (*interruptx)(sqlite3*); + sqlite_int64 (*last_insert_rowid)(sqlite3*); + const char * (*libversion)(void); + int (*libversion_number)(void); + void *(*malloc)(int); + char * (*mprintf)(const char*,...); + int (*open)(const char*,sqlite3**); + int (*open16)(const void*,sqlite3**); + int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); + int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); + void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); + void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); + void *(*realloc)(void*,int); + int (*reset)(sqlite3_stmt*pStmt); + void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); + void (*result_double)(sqlite3_context*,double); + void (*result_error)(sqlite3_context*,const char*,int); + void (*result_error16)(sqlite3_context*,const void*,int); + void (*result_int)(sqlite3_context*,int); + void (*result_int64)(sqlite3_context*,sqlite_int64); + void (*result_null)(sqlite3_context*); + void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); + void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); + void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); + void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); + void (*result_value)(sqlite3_context*,sqlite3_value*); + void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); + int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, + const char*,const char*),void*); + void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); + char * (*snprintf)(int,char*,const char*,...); + int (*step)(sqlite3_stmt*); + int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, + char const**,char const**,int*,int*,int*); + void (*thread_cleanup)(void); + int (*total_changes)(sqlite3*); + void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); + int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); + void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, + sqlite_int64),void*); + void * (*user_data)(sqlite3_context*); + const void * (*value_blob)(sqlite3_value*); + int (*value_bytes)(sqlite3_value*); + int (*value_bytes16)(sqlite3_value*); + double (*value_double)(sqlite3_value*); + int (*value_int)(sqlite3_value*); + sqlite_int64 (*value_int64)(sqlite3_value*); + int (*value_numeric_type)(sqlite3_value*); + const unsigned char * (*value_text)(sqlite3_value*); + const void * (*value_text16)(sqlite3_value*); + const void * (*value_text16be)(sqlite3_value*); + const void * (*value_text16le)(sqlite3_value*); + int (*value_type)(sqlite3_value*); + char *(*vmprintf)(const char*,va_list); + /* Added ??? */ + int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); + /* Added by 3.3.13 */ + int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); + int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); + int (*clear_bindings)(sqlite3_stmt*); + /* Added by 3.4.1 */ + int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, + void (*xDestroy)(void *)); + /* Added by 3.5.0 */ + int (*bind_zeroblob)(sqlite3_stmt*,int,int); + int (*blob_bytes)(sqlite3_blob*); + int (*blob_close)(sqlite3_blob*); + int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, + int,sqlite3_blob**); + int (*blob_read)(sqlite3_blob*,void*,int,int); + int (*blob_write)(sqlite3_blob*,const void*,int,int); + int (*create_collation_v2)(sqlite3*,const char*,int,void*, + int(*)(void*,int,const void*,int,const void*), + void(*)(void*)); + int (*file_control)(sqlite3*,const char*,int,void*); + sqlite3_int64 (*memory_highwater)(int); + sqlite3_int64 (*memory_used)(void); + sqlite3_mutex *(*mutex_alloc)(int); + void (*mutex_enter)(sqlite3_mutex*); + void (*mutex_free)(sqlite3_mutex*); + void (*mutex_leave)(sqlite3_mutex*); + int (*mutex_try)(sqlite3_mutex*); + int (*open_v2)(const char*,sqlite3**,int,const char*); + int (*release_memory)(int); + void (*result_error_nomem)(sqlite3_context*); + void (*result_error_toobig)(sqlite3_context*); + int (*sleep)(int); + void (*soft_heap_limit)(int); + sqlite3_vfs *(*vfs_find)(const char*); + int (*vfs_register)(sqlite3_vfs*,int); + int (*vfs_unregister)(sqlite3_vfs*); + int (*xthreadsafe)(void); + void (*result_zeroblob)(sqlite3_context*,int); + void (*result_error_code)(sqlite3_context*,int); + int (*test_control)(int, ...); + void (*randomness)(int,void*); + sqlite3 *(*context_db_handle)(sqlite3_context*); + int (*extended_result_codes)(sqlite3*,int); + int (*limit)(sqlite3*,int,int); + sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); + const char *(*sql)(sqlite3_stmt*); + int (*status)(int,int*,int*,int); + int (*backup_finish)(sqlite3_backup*); + sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); + int (*backup_pagecount)(sqlite3_backup*); + int (*backup_remaining)(sqlite3_backup*); + int (*backup_step)(sqlite3_backup*,int); + const char *(*compileoption_get)(int); + int (*compileoption_used)(const char*); + int (*create_function_v2)(sqlite3*,const char*,int,int,void*, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*), + void(*xDestroy)(void*)); + int (*db_config)(sqlite3*,int,...); + sqlite3_mutex *(*db_mutex)(sqlite3*); + int (*db_status)(sqlite3*,int,int*,int*,int); + int (*extended_errcode)(sqlite3*); + void (*log)(int,const char*,...); + sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); + const char *(*sourceid)(void); + int (*stmt_status)(sqlite3_stmt*,int,int); + int (*strnicmp)(const char*,const char*,int); + int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); + int (*wal_autocheckpoint)(sqlite3*,int); + int (*wal_checkpoint)(sqlite3*,const char*); + void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); + int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); + int (*vtab_config)(sqlite3*,int op,...); + int (*vtab_on_conflict)(sqlite3*); + /* Version 3.7.16 and later */ + int (*close_v2)(sqlite3*); + const char *(*db_filename)(sqlite3*,const char*); + int (*db_readonly)(sqlite3*,const char*); + int (*db_release_memory)(sqlite3*); + const char *(*errstr)(int); + int (*stmt_busy)(sqlite3_stmt*); + int (*stmt_readonly)(sqlite3_stmt*); + int (*stricmp)(const char*,const char*); + int (*uri_boolean)(const char*,const char*,int); + sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); + const char *(*uri_parameter)(const char*,const char*); + char *(*vsnprintf)(int,char*,const char*,va_list); + int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); }; /* @@ -470,15 +470,15 @@ struct sqlite3_api_routines { #endif /* SQLITE_CORE */ #ifndef SQLITE_CORE - /* This case when the file really is being compiled as a loadable - ** extension */ + /* This case when the file really is being compiled as a loadable + ** extension */ # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; # define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; # define SQLITE_EXTENSION_INIT3 \ - extern const sqlite3_api_routines *sqlite3_api; + extern const sqlite3_api_routines *sqlite3_api; #else - /* This case when the file is being statically linked into the - ** application */ + /* This case when the file is being statically linked into the + ** application */ # define SQLITE_EXTENSION_INIT1 /*no-op*/ # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ # define SQLITE_EXTENSION_INIT3 /*no-op*/ diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h index 426bcf36a36..c0115701e35 100644 --- a/src/lib/util/cdrom.h +++ b/src/lib/util/cdrom.h @@ -56,7 +56,7 @@ enum }; #define CD_FLAG_GDROM 0x00000001 // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata -#define CD_FLAG_GDROMLE 0x00000002 // legacy GD-ROM, with little-endian CDDA data +#define CD_FLAG_GDROMLE 0x00000002 // legacy GD-ROM, with little-endian CDDA data /*************************************************************************** TYPE DEFINITIONS diff --git a/src/lib/web/mongoose.h b/src/lib/web/mongoose.h index c616be466d0..45e8360948d 100644 --- a/src/lib/web/mongoose.h +++ b/src/lib/web/mongoose.h @@ -31,56 +31,56 @@ extern "C" { // This structure contains information about HTTP request. struct mg_connection { - const char *request_method; // "GET", "POST", etc - const char *uri; // URL-decoded URI - const char *http_version; // E.g. "1.0", "1.1" - const char *query_string; // URL part after '?', not including '?', or NULL + const char *request_method; // "GET", "POST", etc + const char *uri; // URL-decoded URI + const char *http_version; // E.g. "1.0", "1.1" + const char *query_string; // URL part after '?', not including '?', or NULL - char remote_ip[48]; // Max IPv6 string length is 45 characters - char local_ip[48]; // Local IP address - unsigned short remote_port; // Client's port - unsigned short local_port; // Local port number + char remote_ip[48]; // Max IPv6 string length is 45 characters + char local_ip[48]; // Local IP address + unsigned short remote_port; // Client's port + unsigned short local_port; // Local port number - int num_headers; // Number of HTTP headers - struct mg_header { - const char *name; // HTTP header name - const char *value; // HTTP header value - } http_headers[30]; + int num_headers; // Number of HTTP headers + struct mg_header { + const char *name; // HTTP header name + const char *value; // HTTP header value + } http_headers[30]; - char *content; // POST (or websocket message) data, or NULL - size_t content_len; // Data length + char *content; // POST (or websocket message) data, or NULL + size_t content_len; // Data length - int is_websocket; // Connection is a websocket connection - int status_code; // HTTP status code for HTTP error handler - int wsbits; // First byte of the websocket frame - void *server_param; // Parameter passed to mg_add_uri_handler() - void *connection_param; // Placeholder for connection-specific data - void *callback_param; // Needed by mg_iterate_over_connections() + int is_websocket; // Connection is a websocket connection + int status_code; // HTTP status code for HTTP error handler + int wsbits; // First byte of the websocket frame + void *server_param; // Parameter passed to mg_add_uri_handler() + void *connection_param; // Placeholder for connection-specific data + void *callback_param; // Needed by mg_iterate_over_connections() }; struct mg_server; // Opaque structure describing server instance enum mg_result { MG_FALSE, MG_TRUE, MG_MORE }; enum mg_event { - MG_POLL = 100, // Callback return value is ignored - MG_CONNECT, // If callback returns MG_FALSE, connect fails - MG_AUTH, // If callback returns MG_FALSE, authentication fails - MG_REQUEST, // If callback returns MG_FALSE, Mongoose continues with req - MG_REPLY, // If callback returns MG_FALSE, Mongoose closes connection - MG_CLOSE, // Connection is closed, callback return value is ignored - MG_WS_HANDSHAKE, // New websocket connection, handshake request - MG_WS_CONNECT, // New websocket connection established - MG_HTTP_ERROR // If callback returns MG_FALSE, Mongoose continues with err + MG_POLL = 100, // Callback return value is ignored + MG_CONNECT, // If callback returns MG_FALSE, connect fails + MG_AUTH, // If callback returns MG_FALSE, authentication fails + MG_REQUEST, // If callback returns MG_FALSE, Mongoose continues with req + MG_REPLY, // If callback returns MG_FALSE, Mongoose closes connection + MG_CLOSE, // Connection is closed, callback return value is ignored + MG_WS_HANDSHAKE, // New websocket connection, handshake request + MG_WS_CONNECT, // New websocket connection established + MG_HTTP_ERROR // If callback returns MG_FALSE, Mongoose continues with err }; typedef int (*mg_handler_t)(struct mg_connection *, enum mg_event); // Websocket opcodes, from http://tools.ietf.org/html/rfc6455 enum { - WEBSOCKET_OPCODE_CONTINUATION = 0x0, - WEBSOCKET_OPCODE_TEXT = 0x1, - WEBSOCKET_OPCODE_BINARY = 0x2, - WEBSOCKET_OPCODE_CONNECTION_CLOSE = 0x8, - WEBSOCKET_OPCODE_PING = 0x9, - WEBSOCKET_OPCODE_PONG = 0xa + WEBSOCKET_OPCODE_CONTINUATION = 0x0, + WEBSOCKET_OPCODE_TEXT = 0x1, + WEBSOCKET_OPCODE_BINARY = 0x2, + WEBSOCKET_OPCODE_CONNECTION_CLOSE = 0x8, + WEBSOCKET_OPCODE_PING = 0x9, + WEBSOCKET_OPCODE_PONG = 0xa }; // Server management functions @@ -107,21 +107,21 @@ size_t mg_write(struct mg_connection *, const void *buf, int len); size_t mg_printf(struct mg_connection *conn, const char *fmt, ...); size_t mg_websocket_write(struct mg_connection *, int opcode, - const char *data, size_t data_len); + const char *data, size_t data_len); size_t mg_websocket_printf(struct mg_connection* conn, int opcode, - const char *fmt, ...); - + const char *fmt, ...); + void mg_send_file(struct mg_connection *, const char *path); const char *mg_get_header(const struct mg_connection *, const char *name); const char *mg_get_mime_type(const char *name, const char *default_mime_type); int mg_get_var(const struct mg_connection *conn, const char *var_name, - char *buf, size_t buf_len); + char *buf, size_t buf_len); int mg_parse_header(const char *hdr, const char *var_name, char *buf, size_t); int mg_parse_multipart(const char *buf, int buf_len, - char *var_name, int var_name_len, - char *file_name, int file_name_len, - const char **data, int *data_len); + char *var_name, int var_name_len, + char *file_name, int file_name_len, + const char **data, int *data_len); // Utility functions void *mg_start_thread(void *(*func)(void *), void *param); @@ -132,11 +132,11 @@ int mg_url_decode(const char *src, int src_len, char *dst, int dst_len, int); // Templates support struct mg_expansion { - const char *keyword; - void (*handler)(struct mg_connection *); + const char *keyword; + void (*handler)(struct mg_connection *); }; void mg_template(struct mg_connection *, const char *text, - struct mg_expansion *expansions); + struct mg_expansion *expansions); #ifdef __cplusplus diff --git a/src/mame/audio/cage.h b/src/mame/audio/cage.h index f1db2dd3e26..1226192de8f 100644 --- a/src/mame/audio/cage.h +++ b/src/mame/audio/cage.h @@ -19,7 +19,7 @@ #define MCFG_ATARI_CAGE_SPEEDUP(_speedup) \ atari_cage_device::static_set_speedup(*device, _speedup); - + class atari_cage_device : public device_t { public: @@ -32,15 +32,15 @@ public: // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + void reset_w(int state); UINT16 main_r(); void main_w(UINT16 data); UINT16 control_r(); - void control_w(UINT16 data); - + void control_w(UINT16 data); + TIMER_DEVICE_CALLBACK_MEMBER( dma_timer_callback ); void update_dma_state(address_space &space); TIMER_DEVICE_CALLBACK_MEMBER( cage_timer_callback ); @@ -58,8 +58,8 @@ public: protected: // device-level overrides - virtual void device_start(); - + virtual void device_start(); + private: cpu_device *m_cpu; attotime m_cpu_h1_clock_period; @@ -85,7 +85,7 @@ private: UINT32 *m_speedup_ram; dmadac_sound_device *m_dmadac[4]; - + offs_t m_speedup; }; @@ -98,10 +98,10 @@ class atari_cage_seattle_device : public atari_cage_device public: // construction/destruction atari_cage_seattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition diff --git a/src/mame/audio/cps3.h b/src/mame/audio/cps3.h index c952d45846b..7964fff83a4 100644 --- a/src/mame/audio/cps3.h +++ b/src/mame/audio/cps3.h @@ -30,7 +30,7 @@ class cps3_sound_device : public device_t, public: cps3_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~cps3_sound_device() { } - + void set_base(INT8* base) { m_base = base; } DECLARE_WRITE32_MEMBER( cps3_sound_w ); diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h index 2e2d9f7ef18..0f137b83282 100644 --- a/src/mame/audio/dcs.h +++ b/src/mame/audio/dcs.h @@ -18,7 +18,7 @@ #define MCFG_DCS2_AUDIO_POLLING_OFFSET(_polling_offset) \ dcs_audio_device::static_set_polling_offset(*device, _polling_offset); - + class dcs_audio_device : public device_t { public: @@ -106,12 +106,12 @@ public: TIMER_CALLBACK_MEMBER( s2_ack_callback ); int preprocess_stage_2(UINT16 data); int preprocess_write(UINT16 data); - + protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - + protected: struct sdrc_state { @@ -181,10 +181,10 @@ protected: UINT8 m_last_output_full; UINT8 m_last_input_empty; UINT16 m_progflags; - + write_line_delegate m_output_full_cb; write_line_delegate m_input_empty_cb; - + read16_delegate m_fifo_data_r; read16_delegate m_fifo_status_r; write_line_delegate m_fifo_reset_w; @@ -206,7 +206,7 @@ protected: sdrc_state m_sdrc; dsio_state m_dsio; hle_transfer_state m_transfer; - + int m_dram_in_mb; }; @@ -218,10 +218,10 @@ class dcs_audio_2k_device : public dcs_audio_device public: // construction/destruction dcs_audio_2k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition @@ -234,10 +234,10 @@ class dcs_audio_2k_uart_device : public dcs_audio_device public: // construction/destruction dcs_audio_2k_uart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition @@ -250,10 +250,10 @@ class dcs_audio_8k_device : public dcs_audio_device public: // construction/destruction dcs_audio_8k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition @@ -266,7 +266,7 @@ class dcs_audio_wpc_device : public dcs_audio_device public: // construction/destruction dcs_audio_wpc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; }; @@ -285,7 +285,7 @@ public: protected: // device-level overrides - virtual void device_start(); + virtual void device_start(); }; // dcs2_audio_2115_device @@ -295,10 +295,10 @@ class dcs2_audio_2115_device : public dcs2_audio_device public: // construction/destruction dcs2_audio_2115_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition @@ -311,10 +311,10 @@ class dcs2_audio_2104_device : public dcs2_audio_device public: // construction/destruction dcs2_audio_2104_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition @@ -327,10 +327,10 @@ class dcs2_audio_dsio_device : public dcs2_audio_device public: // construction/destruction dcs2_audio_dsio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition @@ -343,10 +343,10 @@ class dcs2_audio_denver_device : public dcs2_audio_device public: // construction/destruction dcs2_audio_denver_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; - + }; // device type definition diff --git a/src/mame/audio/taitosnd.h b/src/mame/audio/taitosnd.h index 756d2d5ba76..2cead8a8975 100644 --- a/src/mame/audio/taitosnd.h +++ b/src/mame/audio/taitosnd.h @@ -37,12 +37,12 @@ public: DECLARE_WRITE8_MEMBER( slave_port_w ); DECLARE_READ8_MEMBER( slave_comm_r ); DECLARE_WRITE8_MEMBER( slave_comm_w ); - + protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - + private: void update_nmi(); diff --git a/src/mame/drivers/bfm_sc45_helper.h b/src/mame/drivers/bfm_sc45_helper.h index e4baa5ebd89..f6dbcb8cbae 100644 --- a/src/mame/drivers/bfm_sc45_helper.h +++ b/src/mame/drivers/bfm_sc45_helper.h @@ -2,4 +2,3 @@ void bfm_sc45_layout_helper(running_machine &machine); int find_project_string(running_machine &machine, int addrxor, int mode); - diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 6d65683e050..11d9d71b3f3 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -254,7 +254,7 @@ Ernesto Corvi & Mariusz Wojcieszek #define REG_COLOR29 (0x1BA/2) /* W D Color table 29 */ #define REG_COLOR30 (0x1BC/2) /* W D Color table 30 */ #define REG_COLOR31 (0x1BE/2) /* W D Color table 31 */ -#define REG_BEAMCON0 (0x1dc/2) // W A Programmable signal generator (ECS Agnus) +#define REG_BEAMCON0 (0x1dc/2) // W A Programmable signal generator (ECS Agnus) #define REG_DIWHIGH (0x1E4/2) /* W A D Display window upper bits for start/stop */ #define REG_FMODE (0x1FC/2) /* W A D Fetch mode */ @@ -316,9 +316,9 @@ Ernesto Corvi & Mariusz Wojcieszek // chipset -#define IS_OCS(state) (state->m_denise_id == 0xff) -#define IS_ECS(state) (state->m_denise_id == 0xfc) -#define IS_AGA(state) (state->m_denise_id == 0xf8) +#define IS_OCS(state) (state->m_denise_id == 0xff) +#define IS_ECS(state) (state->m_denise_id == 0xfc) +#define IS_AGA(state) (state->m_denise_id == 0xf8) class amiga_state : public driver_device @@ -378,7 +378,7 @@ public: UINT16 (*m_chip_ram_r)(amiga_state *state, offs_t offset); void (*m_chip_ram_w)(amiga_state *state, offs_t offset, UINT16 data); - + /* sprite states */ UINT8 m_sprite_comparitor_enable_mask; UINT8 m_sprite_dma_reload_mask; @@ -446,7 +446,7 @@ public: DECLARE_READ8_MEMBER( cia_1_port_a_read ); DECLARE_WRITE8_MEMBER( cia_1_port_a_write ); DECLARE_WRITE_LINE_MEMBER( cia_1_irq ); - + DECLARE_WRITE_LINE_MEMBER( rs232_rx_w ); DECLARE_WRITE_LINE_MEMBER( rs232_dcd_w ); DECLARE_WRITE_LINE_MEMBER( rs232_dsr_w ); @@ -518,7 +518,7 @@ protected: // denise/lisa chip id enum { - DENISE = 0xffff, // actually this register doesn't exist on ocs + DENISE = 0xffff, // actually this register doesn't exist on ocs DENISE_HR = 0x00fc, LISA = 0x00f8 }; @@ -593,27 +593,27 @@ private: enum { - VPOSR_LOF = 0x8000 // long frame + VPOSR_LOF = 0x8000 // long frame }; enum { - ADKCON_UARTBRK = 0x800 // send break + ADKCON_UARTBRK = 0x800 // send break }; // serial port flags enum { - SERDATR_RXD = 0x0800, // serial data - SERDATR_TSRE = 0x1000, // transmit ready - SERDATR_TBE = 0x2000, // transmit buffer empty - SERDATR_RBF = 0x4000, // receive buffer full - SERDATR_OVRUN = 0x8000 // receive buffer overrun + SERDATR_RXD = 0x0800, // serial data + SERDATR_TSRE = 0x1000, // transmit ready + SERDATR_TBE = 0x2000, // transmit buffer empty + SERDATR_RBF = 0x4000, // receive buffer full + SERDATR_OVRUN = 0x8000 // receive buffer overrun }; enum { - SERPER_LONG = 0x8000 // 9-bit mode + SERPER_LONG = 0x8000 // 9-bit mode }; // pot counters diff --git a/src/mame/includes/armedf.h b/src/mame/includes/armedf.h index 532eb140fec..fe4c9153edd 100644 --- a/src/mame/includes/armedf.h +++ b/src/mame/includes/armedf.h @@ -21,7 +21,7 @@ public: required_device m_gfxdecode; required_device m_palette; required_device m_spriteram; - + /* memory pointers */ UINT8 *m_text_videoram; required_shared_ptr m_spr_pal_clut; diff --git a/src/mame/includes/atari.h b/src/mame/includes/atari.h index 1ed1eda6fb1..3af3d880c76 100644 --- a/src/mame/includes/atari.h +++ b/src/mame/includes/atari.h @@ -37,10 +37,10 @@ public: TIMER_DEVICE_CALLBACK_MEMBER( a5200_interrupt ); DECLARE_PALETTE_INIT(atari); - + DECLARE_READ8_MEMBER( atari_gtia_r ); DECLARE_WRITE8_MEMBER( atari_gtia_w ); - + DECLARE_READ8_MEMBER ( atari_antic_r ); DECLARE_WRITE8_MEMBER ( atari_antic_w ); diff --git a/src/mame/includes/atarigt.h b/src/mame/includes/atarigt.h index bfbdd94e464..c5f355cb1d1 100644 --- a/src/mame/includes/atarigt.h +++ b/src/mame/includes/atarigt.h @@ -72,9 +72,9 @@ public: DECLARE_READ32_MEMBER(colorram_protection_r); DECLARE_WRITE32_MEMBER(colorram_protection_w); DECLARE_WRITE32_MEMBER(tmek_pf_w); - + DECLARE_WRITE8_MEMBER(cage_irq_callback); - + void atarigt_colorram_w(offs_t address, UINT16 data, UINT16 mem_mask); UINT16 atarigt_colorram_r(offs_t address); DECLARE_DRIVER_INIT(primrage); diff --git a/src/mame/includes/bfm_sc45.h b/src/mame/includes/bfm_sc45.h index 0f993c977c0..220a45f77d7 100644 --- a/src/mame/includes/bfm_sc45.h +++ b/src/mame/includes/bfm_sc45.h @@ -30,7 +30,7 @@ #define SC45_BUTTON_MATRIX_7_0 IPT_BUTTON13 #define SC45_BUTTON_MATRIX_7_1 IPT_BUTTON14 #define SC45_BUTTON_MATRIX_7_2 IPT_BUTTON15 -#define SC45_BUTTON_MATRIX_7_3 IPT_BUTTON16 +#define SC45_BUTTON_MATRIX_7_3 IPT_BUTTON16 #define SC45_BUTTON_MATRIX_7_4 IPT_MAHJONG_A // having more buttons would make sense and be cleaner but as a temporary solution (these are meant to be driven more by the clickable layouts anyway)..... #define SC45_BUTTON_MATRIX_7_5 IPT_MAHJONG_B @@ -578,7 +578,7 @@ public: DECLARE_MACHINE_RESET(sc4); DECLARE_WRITE_LINE_MEMBER(bfm_sc4_irqhandler); - + void bfm_sc4_68307_porta_w(address_space &space, bool dedicated, UINT8 data, UINT8 line_mask); DECLARE_WRITE8_MEMBER( bfm_sc4_reel3_w ); DECLARE_WRITE8_MEMBER( bfm_sc4_reel4_w ); @@ -731,7 +731,7 @@ INPUT_PORTS_EXTERN( sc4_raw ); PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) \ PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) \ PORT_MODIFY("IN-18") \ - PORT_DIPNAME( 0x0001, 0x0000, "IN 18-0 (DSW11)" ) /* DIL11 18.0 */ \ + PORT_DIPNAME( 0x0001, 0x0000, "IN 18-0 (DSW11)" ) /* DIL11 18.0 */ \ PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) \ PORT_DIPSETTING( 0x0001, DEF_STR( On ) ) \ PORT_DIPNAME( 0x0002, 0x0000, "IN 18-1 (DSW12)" ) /* DIL12 18.1 */ \ diff --git a/src/mame/includes/boogwing.h b/src/mame/includes/boogwing.h index d52e53b6ced..b7a024c1e50 100644 --- a/src/mame/includes/boogwing.h +++ b/src/mame/includes/boogwing.h @@ -63,7 +63,7 @@ public: void mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_READ16_MEMBER( boogwing_protection_region_0_104_r ); DECLARE_WRITE16_MEMBER( boogwing_protection_region_0_104_w ); - + DECO16IC_BANK_CB_MEMBER(bank_callback); DECO16IC_BANK_CB_MEMBER(bank_callback2); }; diff --git a/src/mame/includes/chqflag.h b/src/mame/includes/chqflag.h index dffdc29d3e3..96589de6032 100644 --- a/src/mame/includes/chqflag.h +++ b/src/mame/includes/chqflag.h @@ -47,7 +47,7 @@ public: required_device m_k051316_1; required_device m_k051316_2; required_device m_palette; - + DECLARE_WRITE8_MEMBER(chqflag_bankswitch_w); DECLARE_WRITE8_MEMBER(chqflag_vreg_w); DECLARE_WRITE8_MEMBER(select_analog_ctrl_w); diff --git a/src/mame/includes/darkseal.h b/src/mame/includes/darkseal.h index ef76bf98a98..fab8b8fee0b 100644 --- a/src/mame/includes/darkseal.h +++ b/src/mame/includes/darkseal.h @@ -44,5 +44,5 @@ public: required_device m_audiocpu; required_device m_palette; required_shared_ptr m_generic_paletteram_16; - required_shared_ptr m_generic_paletteram2_16; + required_shared_ptr m_generic_paletteram2_16; }; diff --git a/src/mame/includes/deco32.h b/src/mame/includes/deco32.h index 92a662cf6ea..68a5bb913cf 100644 --- a/src/mame/includes/deco32.h +++ b/src/mame/includes/deco32.h @@ -211,7 +211,7 @@ public: void screen_eof_dragngun(screen_device &screen, bool state); void dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata); READ32_MEMBER( dragngun_unk_video_r ); - + DECO16IC_BANK_CB_MEMBER(bank_1_callback); DECO16IC_BANK_CB_MEMBER(bank_2_callback); diff --git a/src/mame/includes/esd16.h b/src/mame/includes/esd16.h index 2502edbcf22..fbac457eebf 100644 --- a/src/mame/includes/esd16.h +++ b/src/mame/includes/esd16.h @@ -52,7 +52,7 @@ public: required_device m_gfxdecode; optional_device m_sprgen; optional_device m_eeprom; - + DECLARE_WRITE16_MEMBER(esd16_sound_command_w); DECLARE_WRITE16_MEMBER(hedpanic_platform_w); DECLARE_READ16_MEMBER(esd_eeprom_r); diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h index 9c16724feda..3ae5c2cc35e 100644 --- a/src/mame/includes/gaelco3d.h +++ b/src/mame/includes/gaelco3d.h @@ -69,7 +69,7 @@ public: m_serial(*this, "serial"), m_screen(*this, "screen"), m_paletteram16(*this, "paletteram"), - m_paletteram32(*this, "paletteram") { } + m_paletteram32(*this, "paletteram") { } required_shared_ptr m_adsp_ram_base; required_shared_ptr m_m68k_ram_base; diff --git a/src/mame/includes/gstriker.h b/src/mame/includes/gstriker.h index 12560ddee81..529c90dadda 100644 --- a/src/mame/includes/gstriker.h +++ b/src/mame/includes/gstriker.h @@ -56,7 +56,7 @@ public: DECLARE_READ16_MEMBER(vbl_toggle_r); DECLARE_WRITE16_MEMBER(vbl_toggle_w); - + DECLARE_DRIVER_INIT(twrldc94a); DECLARE_DRIVER_INIT(vgoalsoc); DECLARE_DRIVER_INIT(twrldc94); diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index 17622898e46..5761711216f 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -454,7 +454,7 @@ public: /* DS III/IV board */ TIMER_DEVICE_CALLBACK_MEMBER( ds3sdsp_internal_timer_callback ); TIMER_DEVICE_CALLBACK_MEMBER( ds3xdsp_internal_timer_callback ); - + }; diff --git a/src/mame/includes/kaneko16.h b/src/mame/includes/kaneko16.h index c49ac9bfb8b..33a402cf6f4 100644 --- a/src/mame/includes/kaneko16.h +++ b/src/mame/includes/kaneko16.h @@ -68,7 +68,7 @@ public: DECLARE_READ16_MEMBER(kaneko16_ay2_YM2149_r); DECLARE_WRITE16_MEMBER(kaneko16_ay2_YM2149_w); DECLARE_WRITE16_MEMBER(bakubrkr_oki_bank_sw); - + DECLARE_READ8_MEMBER(eeprom_r); DECLARE_WRITE8_MEMBER(eeprom_w); diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h index ee12f964d0e..c12c21fda96 100644 --- a/src/mame/includes/konamigx.h +++ b/src/mame/includes/konamigx.h @@ -34,9 +34,9 @@ public: m_an0(*this, "AN0"), m_an1(*this, "AN1"), m_light0_x(*this, "LIGHT0_X"), - m_light0_y(*this, "LIGHT0_Y"), + m_light0_y(*this, "LIGHT0_Y"), m_light1_x(*this, "LIGHT1_X"), - m_light1_y(*this, "LIGHT1_Y"), + m_light1_y(*this, "LIGHT1_Y"), m_eepromout(*this, "EEPROMOUT"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), @@ -162,7 +162,7 @@ public: void konamigx_mixer_init(screen_device &screen, int objdma); void konamigx_objdma(void); - + void fantjour_dma_install(); void konamigx_mixer_primode(int mode); @@ -225,4 +225,3 @@ extern UINT16 konamigx_wrport2; #define GXSUB_4BPP 0x04 // 16 colors #define GXSUB_5BPP 0x05 // 32 colors #define GXSUB_8BPP 0x08 // 256 colors - diff --git a/src/mame/includes/megadriv.h b/src/mame/includes/megadriv.h index e76c55d82ee..4413163ce98 100644 --- a/src/mame/includes/megadriv.h +++ b/src/mame/includes/megadriv.h @@ -122,7 +122,7 @@ public: DECLARE_VIDEO_START( megadriv ); UINT32 screen_update_megadriv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void screen_eof_megadriv(screen_device &screen, bool state); - + DECLARE_WRITE8_MEMBER(megadriv_tas_callback); }; diff --git a/src/mame/includes/midtunit.h b/src/mame/includes/midtunit.h index 1fcf248336e..c725ddce871 100644 --- a/src/mame/includes/midtunit.h +++ b/src/mame/includes/midtunit.h @@ -78,7 +78,7 @@ public: required_device m_palette; optional_device m_dcs; required_shared_ptr m_generic_paletteram_16; - + void register_state_saving(); void init_tunit_generic(int sound); void init_nbajam_common(int te_protection); diff --git a/src/mame/includes/midzeus.h b/src/mame/includes/midzeus.h index 5509756a59c..6586eaf1cbc 100644 --- a/src/mame/includes/midzeus.h +++ b/src/mame/includes/midzeus.h @@ -82,7 +82,7 @@ private: void zeus_draw_quad(int long_fmt, const UINT32 *databuffer, UINT32 texdata, int logit); void log_fifo_command(const UINT32 *data, int numwords, const char *suffix); - void log_waveram(UINT32 length_and_base); + void log_waveram(UINT32 length_and_base); }; @@ -96,13 +96,13 @@ public: UINT32 screen_update_midzeus2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_READ32_MEMBER( zeus2_r ); DECLARE_WRITE32_MEMBER( zeus2_w ); -private: +private: void exit_handler2(); void zeus2_register32_w(offs_t offset, UINT32 data, int logit); void zeus2_register_update(offs_t offset, UINT32 oldval, int logit); int zeus2_fifo_process(const UINT32 *data, int numwords); void zeus2_pointer_write(UINT8 which, UINT32 value); void zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit); - void zeus2_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit); + void zeus2_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit); void log_fifo_command(const UINT32 *data, int numwords, const char *suffix); }; diff --git a/src/mame/includes/model3.h b/src/mame/includes/model3.h index cdaafcb4266..65139a2ce67 100644 --- a/src/mame/includes/model3.h +++ b/src/mame/includes/model3.h @@ -41,7 +41,7 @@ public: int intensity; UINT32 color; }; - + required_device m_maincpu; optional_device m_lsi53c810; required_device m_audiocpu; diff --git a/src/mame/includes/mystwarr.h b/src/mame/includes/mystwarr.h index 1e9eb8e79f0..e27c85f550a 100644 --- a/src/mame/includes/mystwarr.h +++ b/src/mame/includes/mystwarr.h @@ -20,7 +20,7 @@ public: required_device m_maincpu; required_device m_k053252; required_device m_k056832; - required_device m_k055673; + required_device m_k055673; required_shared_ptr m_gx_workram; optional_shared_ptr m_spriteram; diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index 87d7664cf4a..5ffd813e63b 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -121,7 +121,7 @@ protected: void set_outputs( ); void set_output_latch( UINT8 data ); void set_output_data( UINT8 data ); - + @@ -154,7 +154,7 @@ protected: required_device m_screen; optional_device m_palette; optional_device m_memcard; - + // configuration enum {NEOGEO_MVS, NEOGEO_AES, NEOGEO_CD} m_type; @@ -495,5 +495,3 @@ ADDRESS_MAP_EXTERN(neogeo_main_map,16); #define ROM_Y_ZOOM \ ROM_REGION( 0x20000, "zoomy", 0 ) \ ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) - - diff --git a/src/mame/includes/niyanpai.h b/src/mame/includes/niyanpai.h index ec7edbd87b5..ab7c9cab80b 100644 --- a/src/mame/includes/niyanpai.h +++ b/src/mame/includes/niyanpai.h @@ -54,7 +54,7 @@ public: DECLARE_WRITE8_MEMBER(cpu_portb_w); DECLARE_WRITE8_MEMBER(cpu_portc_w); DECLARE_WRITE8_MEMBER(cpu_porte_w); - + DECLARE_READ16_MEMBER(niyanpai_dipsw_r); DECLARE_READ16_MEMBER(musobana_inputport_0_r); DECLARE_WRITE16_MEMBER(musobana_inputport_w); diff --git a/src/mame/includes/plygonet.h b/src/mame/includes/plygonet.h index fb34b91b4bf..1d906819974 100644 --- a/src/mame/includes/plygonet.h +++ b/src/mame/includes/plygonet.h @@ -40,7 +40,7 @@ public: required_device m_gfxdecode; required_device m_palette; required_shared_ptr m_generic_paletteram_32; - + ioport_port *m_inputs[4]; UINT8 m_sys0; UINT8 m_sys1; diff --git a/src/mame/includes/rpunch.h b/src/mame/includes/rpunch.h index 8bfb444a7a2..eb193fee3f1 100644 --- a/src/mame/includes/rpunch.h +++ b/src/mame/includes/rpunch.h @@ -23,11 +23,11 @@ public: required_device m_gfxdecode; required_device m_screen; required_device m_palette; - + required_shared_ptr m_videoram; required_shared_ptr m_bitmapram; required_shared_ptr m_spriteram; - + UINT8 m_sound_data; UINT8 m_sound_busy; UINT8 m_ym2151_irq; @@ -59,7 +59,7 @@ public: TILE_GET_INFO_MEMBER(get_bg1_tile_info); virtual void machine_start(); virtual void machine_reset(); - + DECLARE_VIDEO_START(rpunch); DECLARE_VIDEO_START(svolley); diff --git a/src/mame/includes/spbactn.h b/src/mame/includes/spbactn.h index cd0210ac805..798b2627981 100644 --- a/src/mame/includes/spbactn.h +++ b/src/mame/includes/spbactn.h @@ -82,5 +82,5 @@ public: required_device m_mixer; - + }; diff --git a/src/mame/includes/taito_z.h b/src/mame/includes/taito_z.h index d60e01dc8d7..f897bb3d859 100644 --- a/src/mame/includes/taito_z.h +++ b/src/mame/includes/taito_z.h @@ -65,7 +65,7 @@ public: optional_device m_tc0110pcr; optional_device m_tc0220ioc; optional_device m_tc0510nio; - optional_device m_tc0140syt; // bshark & spacegun miss the CPUs which shall use TC0140 + optional_device m_tc0140syt; // bshark & spacegun miss the CPUs which shall use TC0140 required_device m_gfxdecode; required_device m_palette; diff --git a/src/mame/includes/toaplan2.h b/src/mame/includes/toaplan2.h index 3e048901c04..38b7fe59dbb 100644 --- a/src/mame/includes/toaplan2.h +++ b/src/mame/includes/toaplan2.h @@ -159,7 +159,7 @@ public: UINT8 m_pwrkick_hopper; DECLARE_CUSTOM_INPUT_MEMBER(pwrkick_hopper_status_r); DECLARE_WRITE8_MEMBER(pwrkick_coin_w); - + DECLARE_WRITE_LINE_MEMBER(toaplan2_reset); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); diff --git a/src/mame/includes/unico.h b/src/mame/includes/unico.h index 8f6a189f065..cb5dc73436d 100644 --- a/src/mame/includes/unico.h +++ b/src/mame/includes/unico.h @@ -56,5 +56,5 @@ public: required_device m_screen; required_device m_palette; optional_shared_ptr m_generic_paletteram_16; - optional_shared_ptr m_generic_paletteram_32; + optional_shared_ptr m_generic_paletteram_32; }; diff --git a/src/mame/includes/wc90.h b/src/mame/includes/wc90.h index ca5741b640a..06ca8b7764a 100644 --- a/src/mame/includes/wc90.h +++ b/src/mame/includes/wc90.h @@ -28,7 +28,7 @@ public: m_sprgen(*this, "spritegen") { } - + required_shared_ptr m_fgvideoram; required_shared_ptr m_bgvideoram; diff --git a/src/mame/includes/wpc_pin.h b/src/mame/includes/wpc_pin.h index 9fe0e7f859c..dc9816fda42 100644 --- a/src/mame/includes/wpc_pin.h +++ b/src/mame/includes/wpc_pin.h @@ -106,7 +106,7 @@ class wpc_dcs_state : public wpc_flip2_state public: wpc_dcs_state(const machine_config &mconfig, device_type type, const char *tag) : wpc_flip2_state(mconfig, type, tag), - m_dcs(*this, "dcs") + m_dcs(*this, "dcs") { } public: @@ -115,7 +115,7 @@ public: DECLARE_WRITE8_MEMBER(wpc_dcs_sound_ctrl_w); DECLARE_READ8_MEMBER(wpc_dcs_sound_data_r); DECLARE_WRITE8_MEMBER(wpc_dcs_sound_data_w); - + required_device m_dcs; private: bool m_send; diff --git a/src/mame/layout/fireball.lay b/src/mame/layout/fireball.lay index 4b85ef7d18a..1a721c1fbad 100644 --- a/src/mame/layout/fireball.lay +++ b/src/mame/layout/fireball.lay @@ -9,7 +9,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -38,8 +38,8 @@ - - + + @@ -75,52 +75,52 @@ - + - + - + - + - + - + - - + + - - + + - - + + - + - + - + @@ -131,13 +131,13 @@ - - - + + + - + - + diff --git a/src/mame/layout/kenseim.lay b/src/mame/layout/kenseim.lay index 0861ad1bd7b..da10c1f6575 100644 --- a/src/mame/layout/kenseim.lay +++ b/src/mame/layout/kenseim.lay @@ -20,14 +20,14 @@ - + - + @@ -50,7 +50,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -131,10 +131,10 @@ - + - + @@ -145,7 +145,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -165,7 +165,7 @@ - + @@ -175,7 +175,7 @@ - + @@ -205,7 +205,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -357,7 +357,7 @@ - + @@ -371,9 +371,9 @@ - + - + diff --git a/src/mame/machine/c117.h b/src/mame/machine/c117.h index de36fa39682..ae5d8e4218b 100644 --- a/src/mame/machine/c117.h +++ b/src/mame/machine/c117.h @@ -12,10 +12,10 @@ //************************************************************************** #define MCFG_CUS117_CPUS(_maincpu, _subcpu) \ - namco_c117_device::set_cpu_tags(*device, _maincpu, _subcpu); + namco_c117_device::set_cpu_tags(*device, _maincpu, _subcpu); #define MCFG_CUS117_SUBRES_CB(_devcb) \ - devcb = &namco_c117_device::set_subres_cb(*device, DEVCB_##_devcb); + devcb = &namco_c117_device::set_subres_cb(*device, DEVCB_##_devcb); //*************************************************************************** diff --git a/src/mame/machine/konppc.h b/src/mame/machine/konppc.h index 00c0d9667f7..6fb8a8806a9 100644 --- a/src/mame/machine/konppc.h +++ b/src/mame/machine/konppc.h @@ -23,11 +23,11 @@ public: static void static_set_num_boards(device_t &device, int num) { downcast(device).num_cgboards = num; } static void static_set_cbboard_type(device_t &device, int cgtype) { downcast(device).cgboard_type = cgtype; } - + void set_cgboard_id(int board_id); int get_cgboard_id(void); void set_cgboard_texture_bank(int board, const char *bank, UINT8 *rom); - + // read/write DECLARE_READ32_MEMBER( cgboard_dsp_comm_r_ppc ); @@ -58,7 +58,7 @@ public: protected: // device-level overrides virtual void device_start(); - + UINT32 dsp_comm_sharc_r(int board, int offset); void dsp_comm_sharc_w(address_space &space, int board, int offset, UINT32 data); UINT32 dsp_shared_ram_r_sharc(int board, int offset); @@ -67,31 +67,31 @@ protected: UINT32 nwk_fifo_r(address_space &space, int board); void nwk_fifo_w(int board, UINT32 data); private: - // internal state + // internal state UINT32 dsp_comm_ppc[MAX_CG_BOARDS][2]; UINT32 dsp_comm_sharc[MAX_CG_BOARDS][2]; UINT8 dsp_shared_ram_bank[MAX_CG_BOARDS]; - + INT32 cgboard_id; INT32 cgboard_type; INT32 num_cgboards; - - UINT32 *dsp_shared_ram[MAX_CG_BOARDS]; - + + UINT32 *dsp_shared_ram[MAX_CG_BOARDS]; + UINT32 dsp_state[MAX_CG_BOARDS]; UINT32 nwk_device_sel[MAX_CG_BOARDS]; const char *texture_bank[MAX_CG_BOARDS]; - + int nwk_fifo_half_full_r; int nwk_fifo_half_full_w; int nwk_fifo_full; int nwk_fifo_mask; - + UINT32 *nwk_fifo[MAX_CG_BOARDS]; INT32 nwk_fifo_read_ptr[MAX_CG_BOARDS]; INT32 nwk_fifo_write_ptr[MAX_CG_BOARDS]; - - UINT32 *nwk_ram[MAX_CG_BOARDS]; + + UINT32 *nwk_ram[MAX_CG_BOARDS]; }; diff --git a/src/mame/machine/midwayic.h b/src/mame/machine/midwayic.h index e300e7f473f..f542b0db5fc 100644 --- a/src/mame/machine/midwayic.h +++ b/src/mame/machine/midwayic.h @@ -20,9 +20,9 @@ public: // construction/destruction midway_serial_pic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); midway_serial_pic_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - + static void static_set_upper(device_t &device, int upper) { downcast(device).m_upper = upper; } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); DECLARE_READ8_MEMBER( status_r ); @@ -30,13 +30,13 @@ public: protected: // device-level overrides - virtual void device_start(); - + virtual void device_start(); + void generate_serial_data(int upper); void serial_register_state(); - + UINT8 m_data[16]; // reused by other devices - int m_upper; + int m_upper; private: UINT8 m_buff; UINT8 m_idx; @@ -51,13 +51,13 @@ extern const device_type MIDWAY_SERIAL_PIC; #define MCFG_MIDWAY_SERIAL_PIC_UPPER(_upper) \ midway_serial_pic_device::static_set_upper(*device, _upper); - + /* 2nd generation Midway serial/NVRAM/RTC PIC */ // ======================> midway_serial_pic2_device class midway_serial_pic2_device : public midway_serial_pic_device, - public device_nvram_interface + public device_nvram_interface { public: // construction/destruction @@ -65,7 +65,7 @@ public: midway_serial_pic2_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); static void static_set_yearoffs(device_t &device, int yearoffs) { downcast(device).m_yearoffs = yearoffs; } - + DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); DECLARE_READ8_MEMBER( status_r ); @@ -80,12 +80,12 @@ protected: virtual void nvram_default(); virtual void nvram_read(emu_file &file); virtual void nvram_write(emu_file &file); - + private: void pic_register_state(); TIMER_CALLBACK_MEMBER( reset_timer ); - + UINT16 m_latch; attotime m_latch_expire_time; UINT8 m_state; @@ -106,7 +106,7 @@ private: // device type definition extern const device_type MIDWAY_SERIAL_PIC2; -#define MCFG_MIDWAY_SERIAL_PIC2_UPPER MCFG_MIDWAY_SERIAL_PIC_UPPER +#define MCFG_MIDWAY_SERIAL_PIC2_UPPER MCFG_MIDWAY_SERIAL_PIC_UPPER #define MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS(_yearoffs) \ midway_serial_pic2_device::static_set_yearoffs(*device, _yearoffs); @@ -124,7 +124,7 @@ public: static void static_set_shuffle(device_t &device, UINT8 shuffle) { downcast(device).m_shuffle_type = shuffle; } static void static_set_shuffle_default(device_t &device, UINT8 shuffle) { downcast(device).m_shuffle_default = shuffle; } static void static_set_auto_ack(device_t &device, UINT8 auto_ack) { downcast(device).m_auto_ack = auto_ack; } - template static devcb_base &set_irqhandler_callback(device_t &device, _Object object) { return downcast(device).m_irq_callback.set_callback(object); } + template static devcb_base &set_irqhandler_callback(device_t &device, _Object object) { return downcast(device).m_irq_callback.set_callback(object); } void set_shuffle_state(int state); void fifo_w(UINT16 data); @@ -136,14 +136,14 @@ public: DECLARE_WRITE_LINE_MEMBER(ioasic_input_empty); DECLARE_WRITE_LINE_MEMBER(ioasic_output_full); - + DECLARE_READ32_MEMBER( read ); DECLARE_WRITE32_MEMBER( write ); DECLARE_READ32_MEMBER( packed_r ); DECLARE_WRITE32_MEMBER( packed_w ); DECLARE_WRITE8_MEMBER(cage_irq_handler); - + void ioasic_reset(); protected: @@ -174,7 +174,7 @@ private: UINT16 m_fifo_out; UINT16 m_fifo_bytes; offs_t m_fifo_force_buffer_empty_pc; - + atari_cage_device *m_cage; dcs_audio_device *m_dcs; }; @@ -183,13 +183,13 @@ private: // device type definition extern const device_type MIDWAY_IOASIC; -#define MCFG_MIDWAY_IOASIC_UPPER MCFG_MIDWAY_SERIAL_PIC_UPPER +#define MCFG_MIDWAY_IOASIC_UPPER MCFG_MIDWAY_SERIAL_PIC_UPPER #define MCFG_MIDWAY_IOASIC_YEAR_OFFS MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS #define MCFG_MIDWAY_IOASIC_SHUFFLE(_shuffle) \ midway_ioasic_device::static_set_shuffle(*device, _shuffle); - + #define MCFG_MIDWAY_IOASIC_SHUFFLE_DEFAULT(_shuffle) \ midway_ioasic_device::static_set_shuffle_default(*device, _shuffle); @@ -198,8 +198,8 @@ extern const device_type MIDWAY_IOASIC; #define MCFG_MIDWAY_IOASIC_AUTO_ACK(_ack) \ midway_ioasic_device::static_set_auto_ack(*device, _ack); - - + + enum { MIDWAY_IOASIC_STANDARD = 0, @@ -213,4 +213,4 @@ enum MIDWAY_IOASIC_HYPRDRIV }; -#endif \ No newline at end of file +#endif diff --git a/src/mame/machine/ng_memcard.h b/src/mame/machine/ng_memcard.h index e24565aae56..7b00b113406 100644 --- a/src/mame/machine/ng_memcard.h +++ b/src/mame/machine/ng_memcard.h @@ -28,12 +28,12 @@ // ======================> ng_memcard_device class ng_memcard_device : public device_t, - public device_image_interface + public device_image_interface { public: // construction/destruction ng_memcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + virtual iodevice_t image_type() const { return IO_MEMCARD; } virtual bool is_readable() const { return 1; } @@ -51,12 +51,12 @@ public: // device-level overrides virtual void device_start(); virtual void device_config_complete(); - + DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); + DECLARE_WRITE8_MEMBER(write); /* returns the index of the current memory card, or -1 if none */ - int present() { return is_loaded() ? 0 : -1; } + int present() { return is_loaded() ? 0 : -1; } private: UINT8 m_memcard_data[0x800]; }; diff --git a/src/mame/machine/nmk112.h b/src/mame/machine/nmk112.h index 5f956d410a9..9c05e1a44d4 100644 --- a/src/mame/machine/nmk112.h +++ b/src/mame/machine/nmk112.h @@ -21,7 +21,7 @@ public: static void set_rom0_tag(device_t &device, const char *tag) { downcast(device).m_tag0 = tag; } static void set_rom1_tag(device_t &device, const char *tag) { downcast(device).m_tag1 = tag; } static void set_page_mask(device_t &device, UINT8 mask) { downcast(device).m_page_mask = ~mask; } - + DECLARE_WRITE8_MEMBER( okibank_w ); protected: diff --git a/src/mame/machine/wpc_out.h b/src/mame/machine/wpc_out.h index 5cdcbe361fe..63a3233f884 100644 --- a/src/mame/machine/wpc_out.h +++ b/src/mame/machine/wpc_out.h @@ -6,8 +6,8 @@ #ifndef WPC_OUT_H #define WPC_OUT_H -#define MCFG_WPC_OUT_ADD( _tag, _count ) \ - MCFG_DEVICE_ADD( _tag, WPC_OUT, 0 ) \ +#define MCFG_WPC_OUT_ADD( _tag, _count ) \ + MCFG_DEVICE_ADD( _tag, WPC_OUT, 0 ) \ downcast(device)->set_gi_count(_count); class wpc_out_device : public device_t diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 9c40958f67b..93b2f6a1454 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -100,7 +100,7 @@ mspacmnf // hack mspacmat // hack msheartb // hack mspacmanbg // bootleg -mspacmanbgd // bootleg +mspacmanbgd // bootleg woodpeck // (c) 1981 Amenip (Palcom Queen River) woodpeca // (c) 1981 Amenip Nova Games Ltd. mspacmab // bootleg @@ -175,7 +175,7 @@ galap4 // hack galturbo // hack swarm // hack zerotime // hack -zerotimed // hack +zerotimed // hack starfght // hack galaxbsf // hack galaxianbl // bootleg @@ -324,7 +324,7 @@ omega // bootleg ckongs // bootleg froggers // bootleg frogf // bootleg -quaak // bootleg +quaak // bootleg amidars // GX337 (c) 1982 Konami triplep // (c) 1982 KKI / made by Sanritsu? triplepa // (c) 1982 KKI / made by Sanritsu? @@ -701,8 +701,8 @@ pleiads // (c) 1981 Tehkan pleiadsb2 // bootleg pleiadbl // bootleg pleiadce // (c) 1981 Centuri + Tehkan -pleiadsi // bootleg? -pleiadss // bootleg +pleiadsi // bootleg? +pleiadss // bootleg capitol // bootleg? survival // (c) 1982 Rock-ola naughtyb // (c) 1982 Jaleco @@ -866,7 +866,7 @@ questers // (c) 1987 (Japan) pacmania // (c) 1987 pacmaniaj // (c) 1987 (Japan) galaga88 // (c) 1987 -galaga88a // (c) 1987 +galaga88a // (c) 1987 galaga88j // (c) 1987 (Japan) ws // (c) 1988 (Japan) berabohm // (c) 1988 (Japan, Rev C) @@ -1463,7 +1463,7 @@ invasiona // bootleg invasionb // bootleg invasionrz // bootleg invasionrza // bootleg -invadersem // Electromar +invadersem // Electromar sstrangr // (c) 1978 Yachiyo Electronics, Ltd. sstrangr2 // (c) 1979 Yachiyo Electronics, Ltd. sinvemag // Zenitone-Microsec Ltd. @@ -2994,7 +2994,7 @@ blktiger // 8/1987 (c) 1987 (US) blktigera // 8/1987 (c) 1987 (US) blktigerb1 // bootleg blktigerb2 // bootleg -blktigerb3 // bootleg? +blktigerb3 // bootleg? blkdrgon // 8/1987 (c) 1987 (Japan) blkdrgonb // bootleg, hacked to say Black Tiger sf // 8/1987 (c) 1987 (World) @@ -3087,7 +3087,7 @@ cawingj // 12/10/1990 (c) 1990 (Japan) cawingbl // bootleg cawingb2 // bootleg nemo // 30/11/1990 (c) 1990 (World) -nemor1 // 09/11/1990 (c) 1990 (World) +nemor1 // 09/11/1990 (c) 1990 (World) nemoj // 20/11/1990 (c) 1990 (Japan) sf2 // 22/05/1991 (c) 1991 (World) sf2eb // 14/02/1991 (c) 1991 (World) @@ -4552,7 +4552,7 @@ mvpj // (c) 1989 (FD1094, decrypted) passsht // (c) 1988 (FD1094, decrypted) passshta // (c) 1988 (FD1094, decrypted) passshtj // (c) 1988 (FD1094, decrypted) -cencourt // (c) 1988 (MC-8123B) +cencourt // (c) 1988 (MC-8123B) riotcity // (c) 1991 Sega / Westone (Unprotected) ryukyu // (c) 1990 (FD1094, decrypted) sdib // (c) 1987 (FD1089A, decrypted) @@ -5077,7 +5077,7 @@ column2j // (c) 1990 Sega // System C-2 games borench // (c) 1990 Sega -borencha // (c) 1990 Sega +borencha // (c) 1990 Sega tfrceac // (c) 1990 Sega / Technosoft tfrceacj // (c) 1990 Sega / Technosoft tfrceacb // bootleg @@ -5401,7 +5401,7 @@ manicpnc // 2007.07 Manic Panic Ghosts! pokasuka // 2007.07 Pokasuka Ghost! sl2007 // 2007.07 Shooting Love asndynmt // 2007.07 Dynamite Deka EX - Asian dynamite -rhytngk // 2007.09 Rhythm Tengoku +rhytngk // 2007.09 Rhythm Tengoku ausfache // 2008.02 Akatsuki Denkou Senki Ausf.Achse illvelo // 2008.06 Illvelo (Illmatic Envelope) mamonoro // 2008.07 Mamoru-kun wa Norowarete Shimatta! @@ -5435,7 +5435,7 @@ vf4 // 2001.08.02 Virtua Fighter 4 (GD-ROM) vf4b // 2001.08.20 Virtua Fighter 4 (Rev B) (cartridge) vf4c // 2002.01.31 Virtua Fighter 4 (Rev C) (cartridge) kingrt66 // 2002.02 The King of Route 66 (Rev A) - // 2002.02.14 Initial D Arcade Stage (Japan) + // 2002.02.14 Initial D Arcade Stage (Japan) initd // 2002.03 Initial D Arcade Stage (Japan) (Rev B) // 2002.06 World Club Champion Football Serie A 2001-2002 soulsurf // 2002.07 Soul Surfer @@ -5451,7 +5451,7 @@ clubk2kf // 2003.?? Club Kart: European Session (2003, not protected) initdexpo // 2002.?? Initial D Arcade Stage (Export) // 2002.?? Sega Driving Simulator // 2003.03 World Club Champion Football Serie A 2001-2002 Ver.2 - // 2003.05 Initial D Arcade Stage Ver. 2 (Japan) (Rev A) + // 2003.05 Initial D Arcade Stage Ver. 2 (Japan) (Rev A) initdv2j // 2003.05.27 Initial D Arcade Stage Ver. 2 (Japan) (Rev B) // 2003.09 World Club Champion Football Serie A 2002-2003 // 2003.?? Club Kart Cycraft Edition @@ -5528,11 +5528,11 @@ airtrix // 2001.02 Air Trix triforce // 2002.?? Triforce BIOS vs2002ex // 2002.07.30 Virtua Striker 2002 (Export) vs2002j // 2002.10 Virtua Striker 2002 (Japan) -fzeroaxc // 2003.06.11 F-Zero AX (Rev. C) +fzeroaxc // 2003.06.11 F-Zero AX (Rev. C) avalons // 2003.07 The Key Of Avalon: The Wizard Master (server) (Rev C) // 2003.10 The Key Of Avalon 1.01 gekpurya // 2003.10 Gekitou Pro Yakyuu Mizushima Shinji All Stars vs. Pro Yakyuu (Rev C) -fzeroax // 2003.12 F-Zero AX (Rev. E) +fzeroax // 2003.12 F-Zero AX (Rev. E) // 2003.12 The Key Of Avalon 1.10 // 2004.04 The Key Of Avalon 1.20 - Summon The New Monsters avalon13 // 2004.06.08 The Key Of Avalon 1.30 - Chaotic Sabbat (client) (Rev C) @@ -5544,11 +5544,11 @@ tfupdate // 2004.?? Triforce GDROM Boot Update // 2005.08 Avalon no Kagi Ver.2.5 Kagi Seisen mkartagp // 2005.12 Mario Kart Arcade Grand Prix // 2005.?? Donkey Kong Jungle Fever - // 2006.01.31 Virtua Striker 4 Ver.2006 (export) + // 2006.01.31 Virtua Striker 4 Ver.2006 (export) vs42006 // 2006.05 Virtua Striker 4 Ver.2006 (Japan) (Rev D) // 2006.?? Firmware Update For Compact Flash Box (Rev A) -mkartag2 // 2007.03 Mario Kart Arcade Grand Prix 2 -mkartag2a // 2007.03 Mario Kart Arcade Grand Prix 2 +mkartag2 // 2007.03 Mario Kart Arcade Grand Prix 2 +mkartag2a // 2007.03 Mario Kart Arcade Grand Prix 2 // Chihiro (X-Box based) chihiro // 2002.?? Chihiro BIOS @@ -5586,7 +5586,7 @@ mj2c // 2004.12 Sega Network Taisen Mahjong MJ 2 (Rev C) // 2004.12 Sega Network Taisen Mahjong MJ 2 (Rev D) // 2005.02 Sega Network Taisen Mahjong MJ 2 (Rev E) // 2005.02 Sega Network Taisen Mahjong MJ 2 (Rev F) -mj2 // 2005.02.02 Sega Network Taisen Mahjong MJ 2 (Rev G) +mj2 // 2005.02.02 Sega Network Taisen Mahjong MJ 2 (Rev G) // 2005.03 Sangokushi Taisen gundamos // 2005.03 Gundam Battle Operating Simulator // 2005.04 Quest of D Ver.1.20 @@ -5629,7 +5629,7 @@ scg06nt // 2005.12 Sega Golf Club 2006: Next Tours (Rev A) // 2008.?? Sangokushi Taisen 3 Ver.J // 2008.?? Sangokushi Taisen 3 War Begins // 2008.?? Sangokushi Taisen 3 War Begins Ver.3.59 - // 2009.03 Firmware Update For Compact Flash Box + // 2009.03 Firmware Update For Compact Flash Box ccfboxa // 2009.03.31 Firmware Update For Compact Flash Box (Rev A) hshavoc // (c) 1993 Data East @@ -5887,7 +5887,7 @@ cbuster // MAB (c) 1990 Data East Corporation (World) cbusterw // MAB (c) 1990 Data East Corporation (World) cbusterj // MAB (c) 1990 Data East Corporation (Japan) twocrude // MAB (c) 1990 Data East USA (US) -twocrudea // MAB (c) 1990 Data East USA (US) +twocrudea // MAB (c) 1990 Data East USA (US) darkseal // MAC (c) 1990 Data East Corporation (World) darkseal1 // MAC (c) 1990 Data East Corporation (World) darksealj // MAC (c) 1990 Data East Corporation (Japan) @@ -6106,7 +6106,7 @@ tknight // (c) 1989 Tecmo stratof // (c) 1991 Tecmo raiga // (c) 1991 Tecmo drgnbowl // (c) 1992 Nics -drgnbowla // (c) 1992 Nics +drgnbowla // (c) 1992 Nics wc90 // (c) 1989 Tecmo wc90a // (c) 1989 Tecmo wc90b // (c) 1989 Tecmo @@ -7688,9 +7688,9 @@ skyadvnt // Alpha-68K96V 'SA' (c) 1989 Alpha Denshi Co. skyadvntu // Alpha-68K96V 'SA' (c) 1989 SNK of America licensed from Alpha skyadvntj // Alpha-68K96V 'SA' (c) 1989 Alpha Denshi Co. gangwars // Alpha-68K96V (c) 1989 Alpha Denshi Co. -gangwarsj // Alpha-68K96V (c) 1989 Alpha Denshi Co. +gangwarsj // Alpha-68K96V (c) 1989 Alpha Denshi Co. gangwarsu // Alpha-68K96V (c) 1989 Alpha Denshi Co. -gangwarsb // bootleg +gangwarsb // bootleg sbasebal // Alpha-68K96V (c) 1989 SNK of America licensed from Alpha tnextspc // A8003 'NS' (c) 1989 - MASKROM tnextspc2 // A8003 'NS' (c) 1989 - EPROMs @@ -8341,7 +8341,7 @@ ejanhs // (c) 1996 Seibu Kaihatsu rdft // (c) 1996 Seibu Kaihatsu rdftu // (c) 1996 Seibu Kaihatsu (Fabtek license) rdftau // (c) 1996 Seibu Kaihatsu -rdftauge // (c) 1996 Seibu Kaihatsu (Tuning license and text display, but Australia region code) +rdftauge // (c) 1996 Seibu Kaihatsu (Tuning license and text display, but Australia region code) rdftj // (c) 1996 Seibu Kaihatsu rdftadi // (c) 1996 Seibu Kaihatsu (Dream Island license) rdftam // (c) 1996 Seibu Kaihatsu (Metrotainment license) @@ -8589,7 +8589,7 @@ crshrace // (c) 1993 Video System Co. crshrace2 // (c) 1993 Video System Co. taotaido // (c) 1993 Video System Co. taotaidoa // (c) 1993 Video System Co. -taotaido3 // (c) 1993 Video System Co. +taotaido3 // (c) 1993 Video System Co. gstriker // (c) [1993] Human gstrikera // (c) [1993] Human gstrikerj // (c) [1993] Human @@ -8623,7 +8623,7 @@ tengaij // (c) 1996 // Semicom games on "Psikyo 68020"-like hardware baryon // (c) 1997 SemiCom dreamwld // (c) 2000 SemiCom -rolcrush // (c) 1999 Trust +rolcrush // (c) 1999 Trust // SH2 board s1945ii // (c) 1997 @@ -8786,7 +8786,7 @@ galpani3hk // (c) 1995 Kaneko (Hong Kong) // Kaneko "AX System" games berlwall // (c) 1991 Kaneko berlwallt // (c) 1991 Kaneko -berlwallk // (c) 1991 Kaneko (Korea, Inter license) +berlwallk // (c) 1991 Kaneko (Korea, Inter license) mgcrystl // (c) 1991 Kaneko (World) mgcrystlo // (c) 1991 Kaneko (World) mgcrystlj // (c) 1991 Kaneko + distributed by Atlus (Japan) @@ -9117,7 +9117,7 @@ gulfstrmm // (c) 1991 Dooyong + distributed by Media Shoji pollux // (c) 1991 Dooyong polluxa // (c) 1991 Dooyong polluxa2 // (c) 1991 Dooyong -polluxn // (c) 1991 NTC +polluxn // (c) 1991 NTC flytiger // (c) 1992 Dooyong flytigera // (c) 1992 Dooyong bluehawk // (c) 1993 Dooyong @@ -9341,17 +9341,17 @@ grdnstrm // (c) 1998 Apples Industries license grdnstrmv // (c) 1998 Apples Industries license grdnstrmk // (c) 1998 (Korea) grdnstrmg // (c) 1998 -grdnstrmj // (c) 1998 (Japan) +grdnstrmj // (c) 1998 (Japan) redfoxwp2 // (c) 1998 (China) redfoxwp2a // (c) 1998 (China) bubl2000 // (c) 1998 Tuning hotbubl // (c) 1998 Pandora popspops // (c) 1999 firehawk // (c) 2001 ESD -firehawkv // (c) 2001 ESD +firehawkv // (c) 2001 ESD mangchi // (c) 2000 spec2k // (c) 2000 Yonatech -spec2kh // (c) 2000 Yonatech +spec2kh // (c) 2000 Yonatech // ESD games // http://www.esdgame.co.kr/english/ @@ -9659,7 +9659,7 @@ kovsh // (c) 1999 Knights of Valor Superheroes kovsh103 // kovsh102 // kovsh101 // -kovsh100 // +kovsh100 // kovqhsgs // bootleg photoy2k // (c) 1999 Photo Y2k photoy2k102 // @@ -28337,7 +28337,7 @@ ac1pster // Pound Sterling (Ace) ac1pstrt // Pound Stretcher (Pcp) ac1primt // Primetime (Ace) ac1taklv // Take It Or Leave It (Ace) -ac1cshtw // Cash Towers (Ace) +ac1cshtw // Cash Towers (Ace) ac1bbclb // Big Break Club (Ace) ac1bbclba // ac1clbsv // Club Sovereign (Ace) @@ -31687,4 +31687,3 @@ fireball amusco // 1987, Amusco. cocoloco // 198?, Petaco S.A. - diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 2e87967b5f3..9ca7a85787d 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -2437,7 +2437,7 @@ $(MAMEOBJ)/misc.a: \ $(DRIVERS)/wms.o \ $(DRIVERS)/xtom3d.o \ $(DRIVERS)/xyonix.o $(VIDEO)/xyonix.o \ - + #------------------------------------------------- # layout dependencies @@ -2521,7 +2521,7 @@ $(DRIVERS)/bfm_sc4.o: $(LAYOUT)/bfm_sc4.lh \ $(LAYOUT)/sc4_dmd.lh \ $(LAYOUT)/sc4dnd.lh \ $(LAYOUT)/sc4dndtp.lh \ - $(LAYOUT)/sc4dnddw.lh + $(LAYOUT)/sc4dnddw.lh $(DRIVERS)/bfm_sc5.o: $(LAYOUT)/bfm_sc5.lh diff --git a/src/mame/video/deco16ic.h b/src/mame/video/deco16ic.h index 8919e515b81..115d429d366 100644 --- a/src/mame/video/deco16ic.h +++ b/src/mame/video/deco16ic.h @@ -41,7 +41,7 @@ public: static void set_pf2_col_bank(device_t &device, int bank) { downcast(device).m_pf2_colour_bank = bank; } static void set_pf12_8x8_bank(device_t &device, int bank) { downcast(device).m_pf12_8x8_gfx_bank = bank; } static void set_pf12_16x16_bank(device_t &device, int bank) { downcast(device).m_pf12_16x16_gfx_bank = bank; } - + DECLARE_WRITE16_MEMBER( pf1_data_w ); DECLARE_WRITE16_MEMBER( pf2_data_w ); @@ -144,7 +144,7 @@ private: int m_pf1_colour_bank, m_pf2_colour_bank; int m_pf1_colourmask, m_pf2_colourmask; int m_pf12_8x8_gfx_bank, m_pf12_16x16_gfx_bank; - + TILEMAP_MAPPER_MEMBER(deco16_scan_rows); TILE_GET_INFO_MEMBER(get_pf2_tile_info); TILE_GET_INFO_MEMBER(get_pf1_tile_info); diff --git a/src/mame/video/deco_zoomspr.h b/src/mame/video/deco_zoomspr.h index c7e4c43bc03..caf8a03f9c9 100644 --- a/src/mame/video/deco_zoomspr.h +++ b/src/mame/video/deco_zoomspr.h @@ -36,4 +36,3 @@ extern const device_type DECO_ZOOMSPR; #define MCFG_DECO_ZOOMSPR_GFXDECODE(_gfxtag) \ deco_zoomspr_device::static_set_gfxdecode_tag(*device, "^" _gfxtag); - diff --git a/src/mame/video/excellent_spr.h b/src/mame/video/excellent_spr.h index f28a5f0d98c..ec4d5e65d04 100644 --- a/src/mame/video/excellent_spr.h +++ b/src/mame/video/excellent_spr.h @@ -15,12 +15,10 @@ public: protected: UINT8* m_ram; - + virtual void device_start(); virtual void device_reset(); private: }; extern const device_type EXCELLENT_SPRITE; - - diff --git a/src/mame/video/k001005.h b/src/mame/video/k001005.h index 1e72e5d0747..160660f1769 100644 --- a/src/mame/video/k001005.h +++ b/src/mame/video/k001005.h @@ -134,7 +134,7 @@ private: int m_fifo_read_ptr; int m_fifo_write_ptr; UINT32 m_reg_far_z; - + k001005_renderer *m_renderer; }; diff --git a/src/mame/video/k001604.h b/src/mame/video/k001604.h index 903f0d6ea44..910dea0792f 100644 --- a/src/mame/video/k001604.h +++ b/src/mame/video/k001604.h @@ -18,7 +18,7 @@ public: static void set_roz_size(device_t &device, int size) { downcast(device).m_roz_size = size; } static void set_txt_mem_offset(device_t &device, int offs) { downcast(device).m_txt_mem_offset = offs; } static void set_roz_mem_offset(device_t &device, int offs) { downcast(device).m_roz_mem_offset = offs; } - + void draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cliprect ); void draw_front_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ); DECLARE_WRITE32_MEMBER( tile_w ); diff --git a/src/mame/video/k051316.h b/src/mame/video/k051316.h index f39881dd521..05fb3d85b3a 100644 --- a/src/mame/video/k051316.h +++ b/src/mame/video/k051316.h @@ -36,7 +36,7 @@ public: DECLARE_GFXDECODE_MEMBER(gfxinfo7); DECLARE_GFXDECODE_MEMBER(gfxinfo8); DECLARE_GFXDECODE_MEMBER(gfxinfo4_ram); - + // static configuration static void set_k051316_callback(device_t &device, k051316_cb_delegate callback) { downcast(device).m_k051316_cb = callback; } static void set_wrap(device_t &device, int wrap) { downcast(device).m_wrap = wrap; } diff --git a/src/mame/video/k051960.h b/src/mame/video/k051960.h index 848039d3411..a01ec04b9e9 100644 --- a/src/mame/video/k051960.h +++ b/src/mame/video/k051960.h @@ -2,7 +2,7 @@ #ifndef __K051960_H__ #define __K051960_H__ -enum +enum { K051960_PLANEORDER_BASE = 0, K051960_PLANEORDER_MIA, @@ -29,7 +29,7 @@ class k051960_device : public device_t, DECLARE_GFXDECODE_MEMBER(gfxinfo); DECLARE_GFXDECODE_MEMBER(gfxinfo_reverse); DECLARE_GFXDECODE_MEMBER(gfxinfo_gradius3); - + public: k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~k051960_device() {} @@ -73,12 +73,12 @@ protected: private: // internal state UINT8 *m_ram; - + UINT8 *m_sprite_rom; UINT32 m_sprite_size; - + k051960_cb_delegate m_k051960_cb; - + UINT8 m_spriterombank[3]; int m_romoffset; int m_spriteflip, m_readroms; diff --git a/src/mame/video/k052109.h b/src/mame/video/k052109.h index e5b3c433e4f..7a2f68c79c9 100644 --- a/src/mame/video/k052109.h +++ b/src/mame/video/k052109.h @@ -95,7 +95,7 @@ private: UINT8 *m_char_rom; UINT32 m_char_size; - + k052109_cb_delegate m_k052109_cb; TILE_GET_INFO_MEMBER(get_tile_info0); diff --git a/src/mame/video/k053244_k053245.h b/src/mame/video/k053244_k053245.h index 41aa668a0bf..e510cc28701 100644 --- a/src/mame/video/k053244_k053245.h +++ b/src/mame/video/k053244_k053245.h @@ -17,7 +17,7 @@ typedef device_delegate k05324x_cb_ k05324x_device::set_offsets(*device, _xoffs, _yoffs); -class k05324x_device : public device_t, +class k05324x_device : public device_t, public device_gfx_interface { static const gfx_layout spritelayout; diff --git a/src/mame/video/k053246_k053247_k055673.h b/src/mame/video/k053246_k053247_k055673.h index 7ecc02d2538..b763b103191 100644 --- a/src/mame/video/k053246_k053247_k055673.h +++ b/src/mame/video/k053246_k053247_k055673.h @@ -78,7 +78,7 @@ public: dev.m_dx = dx; dev.m_dy = dy; } - + void clear_all(); DECLARE_READ16_MEMBER( k055673_rom_word_r ); diff --git a/src/mame/video/k053936.h b/src/mame/video/k053936.h index f4d3977763e..8d7de39b6a7 100644 --- a/src/mame/video/k053936.h +++ b/src/mame/video/k053936.h @@ -28,7 +28,7 @@ public: dev.m_xoff = x_offset; dev.m_yoff = y_offset; } - + DECLARE_WRITE16_MEMBER( ctrl_w ); DECLARE_READ16_MEMBER( ctrl_r ); DECLARE_WRITE16_MEMBER( linectrl_w ); diff --git a/src/mame/video/k054156_k054157_k056832.h b/src/mame/video/k054156_k054157_k056832.h index 865a54d920c..03613aba542 100644 --- a/src/mame/video/k054156_k054157_k056832.h +++ b/src/mame/video/k054156_k054157_k056832.h @@ -53,7 +53,7 @@ public: dev.m_djmain_hack = djmain_hack; dev.m_k055555_tag = k055555; } - + // static configuration static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void static_set_palette_tag(device_t &device, const char *tag); @@ -141,9 +141,9 @@ private: int m_bpp; int m_big; int m_djmain_hack; - + const char *m_k055555_tag; // tbyahhoo uses the k056832 together with a k055555 - + // ROM readback involves reading 2 halves of a word // from the same location in a row. Reading the diff --git a/src/mame/video/kan_pand.h b/src/mame/video/kan_pand.h index a44daf33463..1b40c0aba88 100644 --- a/src/mame/video/kan_pand.h +++ b/src/mame/video/kan_pand.h @@ -30,7 +30,7 @@ public: dev.m_xoffset = x_offset; dev.m_yoffset = y_offset; } - + DECLARE_WRITE8_MEMBER ( spriteram_w ); DECLARE_READ8_MEMBER( spriteram_r ); DECLARE_WRITE16_MEMBER( spriteram_LSB_w ); diff --git a/src/mame/video/mb60553.h b/src/mame/video/mb60553.h index 0b405f14aa3..90f48f0f88a 100644 --- a/src/mame/video/mb60553.h +++ b/src/mame/video/mb60553.h @@ -8,7 +8,7 @@ public: mb60553_zooming_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void set_gfx_region(device_t &device, int gfxregion); - + tilemap_t* m_tmap; UINT16* m_vram; UINT16 m_regs[8]; diff --git a/src/mame/video/neogeo_spr.h b/src/mame/video/neogeo_spr.h index 577b2f02180..38650cc7ebe 100644 --- a/src/mame/video/neogeo_spr.h +++ b/src/mame/video/neogeo_spr.h @@ -20,7 +20,7 @@ class neosprite_base_device : public device_t { public: neosprite_base_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, device_type type); -// neosprite_base_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +// neosprite_base_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual void optimize_sprite_data(); virtual void set_optimized_sprite_data(UINT8* sprdata, UINT32 mask); @@ -70,10 +70,10 @@ public: emu_timer *m_auto_animation_timer; emu_timer *m_sprite_line_timer; - + TIMER_CALLBACK_MEMBER(auto_animation_timer_callback); TIMER_CALLBACK_MEMBER(sprite_line_timer_callback); - + int m_bppshift; // 4 for 4bpp gfx (NeoGeo) 8 for 8bpp gfx (Midas) @@ -128,7 +128,7 @@ class neosprite_midas_device : public neosprite_base_device { public: neosprite_midas_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + virtual void draw_pixel(int romaddr, UINT32* dst, const pen_t *line_pens); UINT16* m_videoram_buffer; @@ -142,5 +142,3 @@ public: }; extern const device_type NEOGEO_SPRITE_MIDAS; - - diff --git a/src/mame/video/pc080sn.h b/src/mame/video/pc080sn.h index ed6b7b6e506..b0fe811eb8a 100644 --- a/src/mame/video/pc080sn.h +++ b/src/mame/video/pc080sn.h @@ -19,7 +19,7 @@ public: dev.m_x_offset = x_offset; dev.m_y_offset = y_offset; } - + DECLARE_READ16_MEMBER( word_r ); DECLARE_WRITE16_MEMBER( word_w ); DECLARE_WRITE16_MEMBER( xscroll_word_w ); @@ -65,7 +65,7 @@ public: int m_x_offset, m_y_offset; int m_y_invert; int m_dblwidth; - + required_device m_gfxdecode; required_device m_palette; }; diff --git a/src/mame/video/pc090oj.h b/src/mame/video/pc090oj.h index b602f38e20c..97149252a3a 100644 --- a/src/mame/video/pc090oj.h +++ b/src/mame/video/pc090oj.h @@ -18,7 +18,7 @@ public: dev.m_x_offset = x_offset; dev.m_y_offset = y_offset; } - + DECLARE_READ16_MEMBER( word_r ); DECLARE_WRITE16_MEMBER( word_w ); diff --git a/src/mame/video/tc0080vco.h b/src/mame/video/tc0080vco.h index e1fbbc624c7..9e5656db684 100644 --- a/src/mame/video/tc0080vco.h +++ b/src/mame/video/tc0080vco.h @@ -19,7 +19,7 @@ public: dev.m_bg_yoffs = y_offset; } static void set_bgflip_yoffs(device_t &device, int offs) { downcast(device).m_bg_flip_yoffs = offs; } - + DECLARE_READ16_MEMBER( word_r ); DECLARE_WRITE16_MEMBER( word_w ); @@ -65,7 +65,7 @@ private: tilemap_t *m_tilemap[3]; INT32 m_flipscreen; - + int m_gfxnum; int m_txnum; int m_bg_xoffs, m_bg_yoffs; diff --git a/src/mame/video/tc0100scn.h b/src/mame/video/tc0100scn.h index 0013e187533..244b886146f 100644 --- a/src/mame/video/tc0100scn.h +++ b/src/mame/video/tc0100scn.h @@ -32,7 +32,7 @@ public: dev.m_flip_text_xoffs = x_offset; dev.m_flip_text_yoffs = y_offset; } - + #define TC0100SCN_SINGLE_VDU 1024 /* Function to set separate color banks for the three tilemapped layers. @@ -104,7 +104,7 @@ private: int m_flip_text_xoffs, m_flip_text_yoffs; int m_multiscrn_xoffs; int m_multiscrn_hack; - + required_device m_gfxdecode; required_device m_palette; diff --git a/src/mame/video/tc0480scp.h b/src/mame/video/tc0480scp.h index 4d7a787e107..4f98e6b4c63 100644 --- a/src/mame/video/tc0480scp.h +++ b/src/mame/video/tc0480scp.h @@ -31,7 +31,7 @@ public: dev.m_flip_xoffs = x_offset; dev.m_flip_yoffs = y_offset; } - + /* When writing a driver, pass zero for the text and flip offsets initially: then tweak them once you have the 4 bg layer positions correct. Col_base may be needed when tilemaps use a palette area from sprites. */ @@ -89,9 +89,9 @@ private: int m_x_offset, m_y_offset; int m_text_xoffs, m_text_yoffs; int m_flip_xoffs, m_flip_yoffs; - + int m_col_base; - + required_device m_gfxdecode; required_device m_palette; diff --git a/src/mame/video/tecmo_mix.h b/src/mame/video/tecmo_mix.h index cade29cbed6..f6e021f0546 100644 --- a/src/mame/video/tecmo_mix.h +++ b/src/mame/video/tecmo_mix.h @@ -7,7 +7,7 @@ class tecmo_mix_device : public device_t, { public: tecmo_mix_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + void mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, palette_device* palette, bitmap_ind16* bitmap_bg, bitmap_ind16* bitmap_fg, bitmap_ind16* bitmap_tx, bitmap_ind16* bitmap_sp); static void set_mixer_shifts(device_t &device, int sprpri_shift, int sprbln_shift, int sprcol_shift); static void set_blendcols(device_t &device, int bgblend_comp, int fgblend_comp, int txblend_comp, int spblend_comp); @@ -70,5 +70,3 @@ extern const device_type TECMO_MIXER; #define MCFG_TECMO_MIXER_BGPEN(_bgpen) \ tecmo_mix_device::set_bgpen(*device, _bgpen); - - diff --git a/src/mame/video/tecmo_spr.h b/src/mame/video/tecmo_spr.h index 4c3c801f6c1..fa33c7d5fbc 100644 --- a/src/mame/video/tecmo_spr.h +++ b/src/mame/video/tecmo_spr.h @@ -11,7 +11,7 @@ public: // gaiden.c / spbactn.c / tecmo16.c sprites void gaiden_draw_sprites(screen_device &screen, gfxdecode_device *gfxdecode, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flip_screen, bitmap_ind16 &sprite_bitmap); - + // tecmo.c sprites void draw_sprites_8bit(screen_device &screen, bitmap_ind16 &bitmap, gfxdecode_device *gfxdecode, const rectangle &cliprect, UINT8* spriteram, int size, int video_type, int flip_screen); @@ -40,6 +40,3 @@ extern const device_type TECMO_SPRITE; #define MCFG_TECMO_SPRITE_BOOTLEG(_bootleg) \ tecmo_spr_device::set_bootleg(*device, _bootleg); - - - diff --git a/src/mame/video/vs920a.h b/src/mame/video/vs920a.h index 0fc4f2630f6..091a0fb8ecf 100644 --- a/src/mame/video/vs920a.h +++ b/src/mame/video/vs920a.h @@ -40,6 +40,3 @@ extern const device_type VS920A; #define MCFG_VS920A_GFXDECODE(_gfxtag) \ vs920a_text_tilemap_device::static_set_gfxdecode_tag(*device, "^" _gfxtag); - - - diff --git a/src/mess/includes/apollo.h b/src/mess/includes/apollo.h index 51e17f0e106..29feadad134 100644 --- a/src/mess/includes/apollo.h +++ b/src/mess/includes/apollo.h @@ -330,8 +330,8 @@ protected: virtual void device_reset(); private: - UINT8 m_csrb; - UINT8 m_ip6; + UINT8 m_csrb; + UINT8 m_ip6; }; extern const device_type APOLLO_SIO; diff --git a/src/mess/includes/apple2.h b/src/mess/includes/apple2.h index 699479727e5..d262cfd8306 100644 --- a/src/mess/includes/apple2.h +++ b/src/mess/includes/apple2.h @@ -77,8 +77,8 @@ enum machine_type_t APPLE_II, // Apple II/II+ APPLE_IIE, // Apple IIe with aux slots APPLE_IIGS, // Apple IIgs - APPLE_IIC, // Apple IIc - APPLE_IICPLUS, // Apple IIc+ + APPLE_IIC, // Apple IIc + APPLE_IICPLUS, // Apple IIc+ TK2000, // Microdigital TK2000 LASER128, // Laser 128/128EX/128EX2 SPACE84, // "Space 84" with flipped text mode diff --git a/src/mess/includes/bebox.h b/src/mess/includes/bebox.h index d6712e21c52..fc81a61cf42 100644 --- a/src/mess/includes/bebox.h +++ b/src/mess/includes/bebox.h @@ -110,7 +110,7 @@ public: LSI53C810_DMA_CB(scsi_dma_callback); void bebox_set_irq_bit(unsigned int interrupt_bit, int val); - void bebox_update_interrupts(); + void bebox_update_interrupts(); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); diff --git a/src/mess/includes/coco.h b/src/mess/includes/coco.h index 3c5c13eab71..74bef719fa5 100644 --- a/src/mess/includes/coco.h +++ b/src/mess/includes/coco.h @@ -130,7 +130,7 @@ public: // floating bus DECLARE_READ8_MEMBER( floating_bus_read ) { return floating_bus_read(); } - + DECLARE_WRITE_LINE_MEMBER( cart_w ) { cart_w((bool) state); } protected: // device-level overrides diff --git a/src/mess/includes/cybiko.h b/src/mess/includes/cybiko.h index 4547d112367..28a0ff596b7 100644 --- a/src/mess/includes/cybiko.h +++ b/src/mess/includes/cybiko.h @@ -89,7 +89,7 @@ public: required_device m_rtc; required_device m_ram; optional_device m_flash1; - required_device m_nvram; + required_device m_nvram; DECLARE_DRIVER_INIT(cybikoxt); DECLARE_DRIVER_INIT(cybiko); virtual void machine_start(); diff --git a/src/mess/includes/dgnalpha.h b/src/mess/includes/dgnalpha.h index cbc6a63b509..30fd790b77a 100644 --- a/src/mess/includes/dgnalpha.h +++ b/src/mess/includes/dgnalpha.h @@ -52,7 +52,7 @@ public: DECLARE_WRITE8_MEMBER( pia2_pa_w ); DECLARE_WRITE_LINE_MEMBER( pia2_firq_a ); DECLARE_WRITE_LINE_MEMBER( pia2_firq_b ); - + /* psg */ DECLARE_READ8_MEMBER( psg_porta_read ); DECLARE_WRITE8_MEMBER( psg_porta_write ); diff --git a/src/mess/includes/hec2hrp.h b/src/mess/includes/hec2hrp.h index ed553e9624c..7cd06115b99 100644 --- a/src/mess/includes/hec2hrp.h +++ b/src/mess/includes/hec2hrp.h @@ -91,7 +91,7 @@ public: optional_shared_ptr m_videoram; optional_shared_ptr m_hector_videoram; required_ioport_array<9> m_keyboard; - + UINT8 m_hector_flag_hr; UINT8 m_hector_flag_80c; UINT8 m_hector_color[4]; diff --git a/src/mess/includes/hp48.h b/src/mess/includes/hp48.h index 97a93a24d86..06981deeb1f 100644 --- a/src/mess/includes/hp48.h +++ b/src/mess/includes/hp48.h @@ -182,11 +182,11 @@ public: static void set_port_config(device_t &device, int port, int module, int max_size) { - downcast(device).m_port = port; + downcast(device).m_port = port; downcast(device).m_module = module; downcast(device).m_max_size = max_size; } - + // image-level overrides virtual iodevice_t image_type() const { return IO_MEMCARD; } diff --git a/src/mess/includes/msx.h b/src/mess/includes/msx.h index 527d639edb4..0a498ffcb47 100644 --- a/src/mess/includes/msx.h +++ b/src/mess/includes/msx.h @@ -73,7 +73,7 @@ #define MCFG_MSX_LAYOUT_DISK2(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ MCFG_MSX_SLOT_DISK2_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages + 1, device); /* Memory mapped FDC registers are also accessible through page 2 */ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages + 1, device); /* Memory mapped FDC registers are also accessible through page 2 */ #define MCFG_MSX_LAYOUT_DISK3(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ MCFG_MSX_SLOT_DISK3_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ @@ -163,7 +163,7 @@ public: } // static configuration helpers - static void install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device); + static void install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device); DECLARE_ADDRESS_MAP(switched_device_map, 8); DECLARE_WRITE8_MEMBER(msx_sec_slot_w); diff --git a/src/mess/includes/newbrain.h b/src/mess/includes/newbrain.h index 0ec80ff2717..212cf43ab53 100644 --- a/src/mess/includes/newbrain.h +++ b/src/mess/includes/newbrain.h @@ -251,7 +251,7 @@ public: ADC0808_ANALOG_READ_CB(adc_vref_pos_r); ADC0808_ANALOG_READ_CB(adc_vref_neg_r); ADC0808_ANALOG_READ_CB(adc_input_r); - + TIMER_DEVICE_CALLBACK_MEMBER(ctc_c2_tick); void bankswitch(); diff --git a/src/mess/includes/p2000t.h b/src/mess/includes/p2000t.h index eb6eb42273f..903b5e28910 100644 --- a/src/mess/includes/p2000t.h +++ b/src/mess/includes/p2000t.h @@ -23,7 +23,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_videoram(*this, "videoram"), - m_keyboard(*this, "KEY") { } + m_keyboard(*this, "KEY") { } required_device m_maincpu; required_device m_speaker; diff --git a/src/mess/includes/ql.h b/src/mess/includes/ql.h index 23c77d1c19e..ad2b14039ac 100644 --- a/src/mess/includes/ql.h +++ b/src/mess/includes/ql.h @@ -27,7 +27,7 @@ #define ZX8302_TAG "ic23" #define RS232_A_TAG "ser1" #define RS232_B_TAG "ser2" -#define QIMI_TAG "qimi" +#define QIMI_TAG "qimi" #define X1 XTAL_15MHz #define X2 XTAL_32_768kHz diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h index edd2c063152..d81f71a633f 100644 --- a/src/mess/includes/thomson.h +++ b/src/mess/includes/thomson.h @@ -314,7 +314,7 @@ public: int m_centronics_busy; int m_centronics_perror; - + MC6854_OUT_FRAME_CB(to7_network_got_frame); protected: diff --git a/src/mess/includes/x68k.h b/src/mess/includes/x68k.h index 2842aac71fb..73be42990df 100644 --- a/src/mess/includes/x68k.h +++ b/src/mess/includes/x68k.h @@ -63,8 +63,8 @@ public: m_screen(*this, "screen"), m_upd72065(*this, "upd72065"), m_options(*this, "options"), - m_mouse1(*this, "mouse1"), - m_mouse2(*this, "mouse2"), + m_mouse1(*this, "mouse1"), + m_mouse2(*this, "mouse2"), m_mouse3(*this, "mouse3"), m_xpd1lr(*this, "xpd1lr"), m_ctrltype(*this, "ctrltype"), diff --git a/src/mess/layout/fb01.lay b/src/mess/layout/fb01.lay index 53398bb339d..f88d5f6de8b 100644 --- a/src/mess/layout/fb01.lay +++ b/src/mess/layout/fb01.lay @@ -75,11 +75,11 @@ diff --git a/src/mess/machine/ie15_kbd.h b/src/mess/machine/ie15_kbd.h index a0d574d02d0..3985bed7ecb 100644 --- a/src/mess/machine/ie15_kbd.h +++ b/src/mess/machine/ie15_kbd.h @@ -42,7 +42,7 @@ class ie15_keyboard_device : public: ie15_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); ie15_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + template static devcb_base &set_keyboard_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_cb.set_callback(object); } virtual ioport_constructor device_input_ports() const; diff --git a/src/mess/machine/mega32x.h b/src/mess/machine/mega32x.h index 53271842792..b3c6dc8eaf9 100644 --- a/src/mess/machine/mega32x.h +++ b/src/mess/machine/mega32x.h @@ -205,7 +205,7 @@ private: int m_current_fifo_read_pos; int m_fifo_block_a_full; int m_fifo_block_b_full; - + required_device m_palette; }; diff --git a/src/mess/machine/micropolis.h b/src/mess/machine/micropolis.h index fa4ec0482f0..3780232a2ea 100644 --- a/src/mess/machine/micropolis.h +++ b/src/mess/machine/micropolis.h @@ -54,7 +54,7 @@ public: dev.m_floppy_drive_tags[2] = tag3; dev.m_floppy_drive_tags[3] = tag4; } - + void set_drive(UINT8 drive); // set current drive (0-3) DECLARE_READ8_MEMBER( status_r ); diff --git a/src/mess/machine/msx_matsushita.h b/src/mess/machine/msx_matsushita.h index dfdd48ef2f0..123a5357423 100644 --- a/src/mess/machine/msx_matsushita.h +++ b/src/mess/machine/msx_matsushita.h @@ -44,4 +44,3 @@ private: }; #endif - diff --git a/src/mess/machine/msx_s1985.h b/src/mess/machine/msx_s1985.h index dbe00b16f44..21c45c4aa55 100644 --- a/src/mess/machine/msx_s1985.h +++ b/src/mess/machine/msx_s1985.h @@ -29,4 +29,3 @@ private: }; #endif - diff --git a/src/mess/machine/msx_systemflags.h b/src/mess/machine/msx_systemflags.h index 56f27ca25cf..28c5a060643 100644 --- a/src/mess/machine/msx_systemflags.h +++ b/src/mess/machine/msx_systemflags.h @@ -35,4 +35,3 @@ private: }; #endif - diff --git a/src/mess/machine/smartmed.h b/src/mess/machine/smartmed.h index 3be2b1c3141..e913870bdca 100644 --- a/src/mess/machine/smartmed.h +++ b/src/mess/machine/smartmed.h @@ -43,11 +43,11 @@ enum pointer_sm_mode_t // "Sequential Row Read is available only on K9F5608U0D_Y,P,V,F or K9F5608D0D_Y,P" enum { - NAND_CHIP_K9F5608U0D = 0, // K9F5608U0D - NAND_CHIP_K9F5608U0D_J, // K9F5608U0D-Jxxx - NAND_CHIP_K9F5608U0B, // K9F5608U0B - NAND_CHIP_K9F1G08U0B, // K9F1G08U0B - NAND_CHIP_K9LAG08U0M // K9LAG08U0M + NAND_CHIP_K9F5608U0D = 0, // K9F5608U0D + NAND_CHIP_K9F5608U0D_J, // K9F5608U0D-Jxxx + NAND_CHIP_K9F5608U0B, // K9F5608U0B + NAND_CHIP_K9F1G08U0B, // K9F1G08U0B + NAND_CHIP_K9LAG08U0M // K9LAG08U0M }; // ======================> nand_device @@ -133,7 +133,7 @@ public: break; } } - + int is_present(); int is_protected(); int is_busy(); @@ -186,7 +186,7 @@ protected: int m_col_address_cycles; int m_row_address_cycles; int m_sequential_row_read; - + devcb_write_line m_write_rnb; #ifdef SMARTMEDIA_IMAGE_SAVE diff --git a/src/mess/machine/ti99/videowrp.h b/src/mess/machine/ti99/videowrp.h index 458d48b1441..c58b8719dff 100644 --- a/src/mess/machine/ti99/videowrp.h +++ b/src/mess/machine/ti99/videowrp.h @@ -143,7 +143,7 @@ protected: MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \ MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \ MCFG_TMS9928A_VRAM_SIZE(_vsize) \ - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \ + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \ MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) \ MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update ) @@ -174,7 +174,7 @@ protected: MCFG_SCREEN_SIZE(_x, _y) \ MCFG_SCREEN_VISIBLE_AREA(0, _x - 1, 0, _y - 1) \ MCFG_SCREEN_PALETTE(VDP_TAG ":palette") - + #define MCFG_TI_SOUND_94624_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, TISOUND_94624, 0) diff --git a/src/mess/mess.lst b/src/mess/mess.lst index 71bfae9a206..79451969d9a 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -704,29 +704,29 @@ c128dcr_de c128dcr_se c128d81 -a1000 // Commodore Amiga 1000 +a1000 // Commodore Amiga 1000 a1000n -a2000 // Commodore Amiga 2000 +a2000 // Commodore Amiga 2000 a2000n -a500 // Commodore Amiga 500 +a500 // Commodore Amiga 500 a500n -cdtv // Commodore CDTV +cdtv // Commodore CDTV cdtvn -a3000 // Commodore Amiga 3000 +a3000 // Commodore Amiga 3000 a3000n -a500p // Commodore Amiga 500 Plus +a500p // Commodore Amiga 500 Plus a500pn -a600 // Commodore Amiga 600 +a600 // Commodore Amiga 600 a600n -a1200 // Commodore Amiga 1200 +a1200 // Commodore Amiga 1200 a1200n -a4000 // Commodore Amiga 4000/040 +a4000 // Commodore Amiga 4000/040 a4000n -a400030 // Commodore Amiga 4000/030 +a400030 // Commodore Amiga 4000/030 a400030n -cd32 // Commodore Amiga CD32 +cd32 // Commodore Amiga CD32 cd32n -a4000t // Commodore Amiga 4000T +a4000t // Commodore Amiga 4000T a4000tn c65 // 1991 C65 / C64DX (Prototype, NTSC) @@ -860,7 +860,7 @@ apxenp2 // 1993 Apricot XEN PC (P2 Motherboard) aprpand aprfte megapc // 1992 Amstrad plc -megapcpl +megapcpl megapcpla // AMI BIOS version with Winbond WINBUS chipset ec1849 t2000sx @@ -1915,7 +1915,7 @@ fmtownsux // 1991.11 FM-Towns II UX fmtownssj // FM-Towns II SJ fmtownshr // 1992 FM-Towns II HR fmtownsmx // FM-Towns II MX -fmtownsftv // 1994 FM-Towns II FreshTV +fmtownsftv // 1994 FM-Towns II FreshTV fmtmarty // 1993 Fujitsu FM-Towns Marty fmtmarty2 // 1993 Fujitsu FM-Towns Marty 2 carmarty // Fujitsu FM-Towns Car Marty diff --git a/src/mess/video/crt.h b/src/mess/video/crt.h index db4e456912d..d9bef19838b 100644 --- a/src/mess/video/crt.h +++ b/src/mess/video/crt.h @@ -60,11 +60,11 @@ public: dev.m_window_width = width; dev.m_window_height = height; } - + void plot(int x, int y); void eof(); void update(bitmap_ind16 &bitmap); - + protected: // device-level overrides virtual void device_start(); diff --git a/src/mess/video/gime.h b/src/mess/video/gime.h index 89fef2cc6b3..08f8458e385 100644 --- a/src/mess/video/gime.h +++ b/src/mess/video/gime.h @@ -203,7 +203,7 @@ private: const char *m_maincpu_tag; /* tag of main CPU */ const char *m_ram_tag; /* tag of RAM device */ const char *m_ext_tag; /* tag of expansion device */ - + // timer constants static const device_timer_id TIMER_FRAME = 0; static const device_timer_id TIMER_HSYNC_OFF = 1; diff --git a/src/mess/video/vtvideo.h b/src/mess/video/vtvideo.h index a369811df97..8c5644aacee 100644 --- a/src/mess/video/vtvideo.h +++ b/src/mess/video/vtvideo.h @@ -71,7 +71,7 @@ protected: const char *m_char_rom_tag; /* character rom region */ required_device m_palette; - + bool m_notify_vblank; int m_last_scroll; diff --git a/src/osd/modules/debugger/debugint.h b/src/osd/modules/debugger/debugint.h index 32f77924885..a3f0a441df8 100644 --- a/src/osd/modules/debugger/debugint.h +++ b/src/osd/modules/debugger/debugint.h @@ -22,7 +22,7 @@ public: // construction/destruction debugger_internal(const osd_interface &osd); virtual ~debugger_internal() { } - + virtual void init_debugger(); virtual void wait_for_debugger(device_t &device, bool firststop); virtual void debugger_update(); diff --git a/src/osd/modules/debugger/debugosx.h b/src/osd/modules/debugger/debugosx.h index f01eb254575..8de62ed911f 100644 --- a/src/osd/modules/debugger/debugosx.h +++ b/src/osd/modules/debugger/debugosx.h @@ -372,7 +372,7 @@ public: // construction/destruction debugger_osx(const osd_interface &osd); virtual ~debugger_osx() { } - + virtual void init_debugger(); virtual void wait_for_debugger(device_t &device, bool firststop); virtual void debugger_update(); diff --git a/src/osd/modules/debugger/debugqt.h b/src/osd/modules/debugger/debugqt.h index 7c1b15ce730..6accc743a83 100644 --- a/src/osd/modules/debugger/debugqt.h +++ b/src/osd/modules/debugger/debugqt.h @@ -22,7 +22,7 @@ public: // construction/destruction debugger_qt(const osd_interface &osd); virtual ~debugger_qt(); - + virtual void init_debugger(); virtual void wait_for_debugger(device_t &device, bool firststop); virtual void debugger_update(); diff --git a/src/osd/modules/debugger/debugwin.h b/src/osd/modules/debugger/debugwin.h index 55d08f8a1dd..e35fe20b1b0 100644 --- a/src/osd/modules/debugger/debugwin.h +++ b/src/osd/modules/debugger/debugwin.h @@ -20,7 +20,7 @@ public: // construction/destruction debugger_windows(const osd_interface &osd); virtual ~debugger_windows() { } - + virtual void init_debugger(); virtual void wait_for_debugger(device_t &device, bool firststop); virtual void debugger_update(); diff --git a/src/osd/modules/debugger/none.h b/src/osd/modules/debugger/none.h index 147c8ea59e6..a93001b572b 100644 --- a/src/osd/modules/debugger/none.h +++ b/src/osd/modules/debugger/none.h @@ -21,7 +21,7 @@ public: // construction/destruction debugger_none(const osd_interface &osd); virtual ~debugger_none() { } - + virtual void init_debugger(); virtual void wait_for_debugger(device_t &device, bool firststop); virtual void debugger_update(); diff --git a/src/osd/modules/sound/direct_sound.h b/src/osd/modules/sound/direct_sound.h index 342ef9996b5..52eba856583 100644 --- a/src/osd/modules/sound/direct_sound.h +++ b/src/osd/modules/sound/direct_sound.h @@ -28,7 +28,7 @@ public: // construction/destruction sound_direct_sound(const osd_interface &osd); virtual ~sound_direct_sound(); - + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); @@ -36,8 +36,8 @@ public: void dsound_kill(); HRESULT dsound_create_buffers(); void dsound_destroy_buffers(); - void copy_sample_data(const INT16 *data, int bytes_to_copy); -private: + void copy_sample_data(const INT16 *data, int bytes_to_copy); +private: }; extern const osd_sound_type OSD_SOUND_DIRECT_SOUND; diff --git a/src/osd/modules/sound/js_sound.h b/src/osd/modules/sound/js_sound.h index ad0785fe960..8bfb133ae4c 100644 --- a/src/osd/modules/sound/js_sound.h +++ b/src/osd/modules/sound/js_sound.h @@ -21,7 +21,7 @@ public: // construction/destruction sound_js(const osd_interface &osd); virtual ~sound_js() { } - + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); }; diff --git a/src/osd/modules/sound/none.h b/src/osd/modules/sound/none.h index 730567fc258..fbe4f14f565 100644 --- a/src/osd/modules/sound/none.h +++ b/src/osd/modules/sound/none.h @@ -21,7 +21,7 @@ public: // construction/destruction sound_none(const osd_interface &osd); virtual ~sound_none() { } - + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) { } virtual void set_mastervolume(int attenuation) { } }; diff --git a/src/osd/modules/sound/sdl_sound.h b/src/osd/modules/sound/sdl_sound.h index af9250d9838..3f3053bd193 100644 --- a/src/osd/modules/sound/sdl_sound.h +++ b/src/osd/modules/sound/sdl_sound.h @@ -21,7 +21,7 @@ public: // construction/destruction sound_sdl(const osd_interface &osd); virtual ~sound_sdl(); - + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); }; diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index 4e00c7647c1..4c7835579ac 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -62,7 +62,7 @@ #define ATTR_MALLOC #define ATTR_PURE #define ATTR_CONST -#define ATTR_FORCE_INLINE __forceinline +#define ATTR_FORCE_INLINE __forceinline #define ATTR_NONNULL(...) #define ATTR_DEPRECATED __declspec(deprecated) #define ATTR_HOT diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index b0e89f26cde..24535e6f494 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -25,7 +25,7 @@ #define OSDOPTION_LOG "log" #define OSDOPTION_VERBOSE "verbose" #define OSDOPTION_DEBUG "debug" -#define OSDOPTION_DEBUGGER "debugger" +#define OSDOPTION_DEBUGGER "debugger" #define OSDOPTION_OSLOG "oslog" #define OSDOPTION_WATCHDOG "watchdog" @@ -49,7 +49,7 @@ #define OSDOPTION_SWITCHRES "switchres" -#define OSDOPTION_SOUND "sound" +#define OSDOPTION_SOUND "sound" #define OSDOPTION_AUDIO_LATENCY "audio_latency" #define OSDOPTVAL_AUTO "auto" @@ -67,8 +67,8 @@ public: // debugging options bool verbose() const { return bool_value(OSDOPTION_VERBOSE); } bool log() const { return bool_value(OSDOPTION_LOG); } - bool debug() const { return bool_value(OSDOPTION_DEBUG); } - const char *debugger() const { return value(OSDOPTION_DEBUGGER); } + bool debug() const { return bool_value(OSDOPTION_DEBUG); } + const char *debugger() const { return value(OSDOPTION_DEBUGGER); } bool oslog() const { return bool_value(OSDOPTION_OSLOG); } int watchdog() const { return int_value(OSDOPTION_WATCHDOG); } @@ -137,7 +137,7 @@ public: virtual ~osd_interface(); void register_options(osd_options &options); - + // getters running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } @@ -167,15 +167,15 @@ public: // video overridables virtual void *get_slider_list(); - void init_subsystems(); - + void init_subsystems(); + virtual bool video_init(); virtual void video_register(); - + bool sound_init(); virtual void sound_register(); bool no_sound(); - + virtual bool input_init(); virtual void input_pause(); virtual void input_resume(); @@ -183,7 +183,7 @@ public: virtual bool network_init(); virtual bool midi_init(); - void exit_subsystems(); + void exit_subsystems(); virtual void video_exit(); void sound_exit(); virtual void input_exit(); @@ -192,26 +192,26 @@ public: virtual void midi_exit(); virtual void osd_exit(); - + void video_options_add(const char *name, void *type); void sound_options_add(const char *name, osd_sound_type type); void debugger_options_add(const char *name, osd_debugger_type type); private: // internal state - running_machine * m_machine; - + running_machine * m_machine; + void update_option(osd_options &options, const char * key, dynamic_array &values); - -protected: + +protected: osd_sound_interface* m_sound; osd_debugger_interface* m_debugger; -private: - //tagmap_t m_video_options; +private: + //tagmap_t m_video_options; dynamic_array m_video_names; - tagmap_t m_sound_options; + tagmap_t m_sound_options; dynamic_array m_sound_names; - tagmap_t m_debugger_options; + tagmap_t m_debugger_options; dynamic_array m_debugger_names; }; @@ -221,10 +221,10 @@ public: // construction/destruction osd_sound_interface(const osd_interface &osd); virtual ~osd_sound_interface(); - + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) = 0; virtual void set_mastervolume(int attenuation) = 0; -protected: +protected: const osd_interface& m_osd; }; @@ -241,13 +241,13 @@ public: // construction/destruction osd_debugger_interface(const osd_interface &osd); virtual ~osd_debugger_interface(); - + virtual void init_debugger() = 0; virtual void wait_for_debugger(device_t &device, bool firststop) = 0; virtual void debugger_update() = 0; virtual void debugger_exit() = 0; -protected: +protected: const osd_interface& m_osd; }; diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 211b48492de..ce2885628aa 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -199,7 +199,7 @@ public: virtual void video_register(); virtual void sound_register(); virtual void debugger_register(); - + virtual bool video_init(); virtual bool input_init(); virtual void input_pause(); diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 1fec57229d8..57689f6284d 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -97,8 +97,8 @@ struct sdl_window_info int resize_height; osd_ticks_t last_resize; #else - int screen_width; - int screen_height; + int screen_width; + int screen_height; #endif }; diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 40cbf4fd1d5..456808747f5 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -259,8 +259,8 @@ public: virtual void video_register(); virtual void sound_register(); virtual void debugger_register(); - - virtual bool video_init(); + + virtual bool video_init(); virtual bool input_init(); virtual void input_pause(); virtual void input_resume();