summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2013-09-17 06:47:03 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2013-09-17 06:47:03 +0000
commit96aa5e1c086b4927456dc88b925d8ec112f0482e (patch)
treef59d136c51d4a065f39e3ab0d73981526c4d156b
parenta7d12daf5b4c3374e8ad47a003ac7fff73d5c8fc (diff)
Cleanups and version bumpmame0150
-rw-r--r--hash/a800_flop.xml16
-rw-r--r--hash/amigaocs_flop.xml2
-rw-r--r--hash/apple2.xml2
-rw-r--r--hash/c64_cart.xml4
-rw-r--r--hash/c64_flop.xml2
-rw-r--r--hash/copera.xml16
-rw-r--r--hash/famicom_cass.xml2
-rw-r--r--hash/ibm5140.xml2
-rw-r--r--hash/ibm5170.xml2
-rw-r--r--hash/megadriv.xml38
-rw-r--r--hash/megaduck.xml10
-rw-r--r--hash/pc98.xml394
-rw-r--r--hash/visicom.xml2
-rw-r--r--src/emu/clifront.c4
-rw-r--r--src/emu/cpu/cpu.mak4
-rw-r--r--src/emu/cpu/cubeqcpu/cubeqcpu.c15
-rw-r--r--src/emu/cpu/es5510/es5510.c12
-rw-r--r--src/emu/cpu/es5510/es5510.h8
-rw-r--r--src/emu/cpu/f8/f8.c14
-rw-r--r--src/emu/cpu/i8085/i8085.c1
-rw-r--r--src/emu/cpu/i8089/i8089.h14
-rw-r--r--src/emu/cpu/i8089/i8089_channel.c20
-rw-r--r--src/emu/cpu/i8089/i8089_ops.c2
-rw-r--r--src/emu/cpu/i86/i186.c4
-rw-r--r--src/emu/cpu/i86/i286.c1
-rw-r--r--src/emu/cpu/i86/i286.h2
-rw-r--r--src/emu/cpu/i860/i860.c7
-rw-r--r--src/emu/cpu/i860/i860dec.c10
-rw-r--r--src/emu/cpu/i960/i960.c2
-rw-r--r--src/emu/cpu/jaguar/jaguar.c3
-rw-r--r--src/emu/cpu/lh5801/lh5801.c1
-rw-r--r--src/emu/cpu/m37710/m37710.h2
-rw-r--r--src/emu/cpu/m6800/m6800.c15
-rw-r--r--src/emu/cpu/m6800/m6800.h2
-rw-r--r--src/emu/cpu/m68000/m68k_in.c12
-rw-r--r--src/emu/cpu/mb86233/mb86233.c3
-rw-r--r--src/emu/cpu/mb88xx/mb88xx.c9
-rw-r--r--src/emu/cpu/mb88xx/mb88xx.h16
-rw-r--r--src/emu/cpu/mc68hc11/mc68hc11.c1
-rw-r--r--src/emu/cpu/mcs48/mcs48.c1
-rw-r--r--src/emu/cpu/mcs48/mcs48.h12
-rw-r--r--src/emu/cpu/mcs51/mcs51.c1
-rw-r--r--src/emu/cpu/minx/minx.c1
-rw-r--r--src/emu/cpu/minx/minx.h4
-rw-r--r--src/emu/cpu/mips/mips3drc.c3
-rw-r--r--src/emu/cpu/mn10200/mn10200.c2
-rw-r--r--src/emu/cpu/nec/v25.c2
-rw-r--r--src/emu/cpu/pic16c5x/pic16c5x.c69
-rw-r--r--src/emu/cpu/pic16c62x/pic16c62x.c1
-rw-r--r--src/emu/cpu/pic16c62x/pic16c62x.h4
-rw-r--r--src/emu/cpu/pps4/pps4.c1
-rw-r--r--src/emu/cpu/psx/rcnt.h2
-rw-r--r--src/emu/cpu/rsp/rspdrc.c1
-rw-r--r--src/emu/cpu/s2650/s2650.c1
-rw-r--r--src/emu/cpu/sh2/sh2comn.c8
-rw-r--r--src/emu/cpu/sh2/sh2comn.h2
-rw-r--r--src/emu/cpu/sh2/sh2fe.c1
-rw-r--r--src/emu/cpu/tlcs900/tlcs900.c1
-rw-r--r--src/emu/cpu/tms32082/dis_mp.c230
-rw-r--r--src/emu/cpu/tms32082/dis_pp.c142
-rw-r--r--src/emu/cpu/tms32082/mp_ops.c264
-rw-r--r--src/emu/cpu/tms32082/tms32082.c46
-rw-r--r--src/emu/cpu/tms32082/tms32082.h8
-rw-r--r--src/emu/cpu/tms34010/tms34010.c1
-rw-r--r--src/emu/cpu/tms34010/tms34010.h4
-rw-r--r--src/emu/cpu/tms9900/99xxcore.h2
-rw-r--r--src/emu/debug/debugcmd.c4
-rw-r--r--src/emu/debug/debugcpu.c58
-rw-r--r--src/emu/debug/debugcpu.h26
-rw-r--r--src/emu/debug/dvwpoints.c6
-rw-r--r--src/emu/divideo.c4
-rw-r--r--src/emu/divideo.h8
-rw-r--r--src/emu/emuopts.c8
-rw-r--r--src/emu/emuopts.h8
-rw-r--r--src/emu/machine.c2
-rw-r--r--src/emu/machine/40105.c4
-rw-r--r--src/emu/machine/40105.h2
-rw-r--r--src/emu/machine/74148.c5
-rw-r--r--src/emu/machine/74153.c8
-rw-r--r--src/emu/machine/74153.h4
-rw-r--r--src/emu/machine/74181.h3
-rw-r--r--src/emu/machine/aicartc.c6
-rw-r--r--src/emu/machine/aicartc.h2
-rw-r--r--src/emu/machine/atahle.c2
-rw-r--r--src/emu/machine/ataintf.c2
-rw-r--r--src/emu/machine/eeprom.c18
-rw-r--r--src/emu/machine/eeprom.h24
-rw-r--r--src/emu/machine/eeprompar.c57
-rw-r--r--src/emu/machine/eeprompar.h3
-rw-r--r--src/emu/machine/eepromser.c283
-rw-r--r--src/emu/machine/eepromser.h64
-rw-r--r--src/emu/machine/generic.c1
-rw-r--r--src/emu/machine/mb87078.h4
-rw-r--r--src/emu/machine/s2636.c6
-rw-r--r--src/emu/machine/s2636.h8
-rw-r--r--src/emu/machine/smc91c9x.h6
-rw-r--r--src/emu/machine/wd_fdc.c2
-rw-r--r--src/emu/mame.c8
-rw-r--r--src/emu/memarray.h20
-rw-r--r--src/emu/profiler.h2
-rw-r--r--src/emu/screen.h4
-rw-r--r--src/emu/sound/aica.c4
-rw-r--r--src/emu/sound/cdp1864.h2
-rw-r--r--src/emu/sound/esqpump.c11
-rw-r--r--src/emu/sound/esqpump.h5
-rw-r--r--src/emu/sound/multipcm.h2
-rw-r--r--src/emu/sound/okim6376.h4
-rw-r--r--src/emu/sound/s14001a.h4
-rw-r--r--src/emu/sound/sound.mak2
-rw-r--r--src/emu/sound/sp0250.c6
-rw-r--r--src/emu/sound/sp0250.h6
-rw-r--r--src/emu/sound/t6721a.h2
-rw-r--r--src/emu/sound/tms5220.c4
-rw-r--r--src/emu/sound/upd7752.c11
-rw-r--r--src/emu/sound/upd7752.h4
-rw-r--r--src/emu/tilemap.h2
-rw-r--r--src/emu/video/315_5124.h2
-rw-r--r--src/emu/video/dl1416.c2
-rw-r--r--src/emu/video/hd63484.h8
-rw-r--r--src/emu/video/huc6260.c2
-rw-r--r--src/emu/video/huc6261.c2
-rw-r--r--src/emu/video/i8275.h2
-rw-r--r--src/emu/video/i8275x.h6
-rw-r--r--src/emu/video/polynew.h2
-rw-r--r--src/emu/video/v9938.h14
-rw-r--r--src/emu/webengine.c105
-rw-r--r--src/emu/webengine.h18
-rw-r--r--src/lib/formats/cpis_dsk.c1
-rw-r--r--src/lib/formats/g64_dsk.c14
-rw-r--r--src/lib/web/json/config.h22
-rw-r--r--src/lib/web/json/features.h63
-rw-r--r--src/lib/web/json/forwards.h47
-rw-r--r--src/lib/web/json/json_batchallocator.h176
-rw-r--r--src/lib/web/json/json_tool.h96
-rw-r--r--src/lib/web/json/reader.h383
-rw-r--r--src/lib/web/json/value.h1885
-rw-r--r--src/lib/web/json/writer.h319
-rw-r--r--src/lib/web/mongoose.c7923
-rw-r--r--src/lib/web/mongoose.h202
-rw-r--r--src/lib/zlib/adler32.c246
-rw-r--r--src/lib/zlib/compress.c70
-rw-r--r--src/lib/zlib/crc32.c486
-rw-r--r--src/lib/zlib/crc32.h864
-rw-r--r--src/lib/zlib/deflate.c2919
-rw-r--r--src/lib/zlib/deflate.h408
-rw-r--r--src/lib/zlib/gzclose.c14
-rw-r--r--src/lib/zlib/gzguts.h72
-rw-r--r--src/lib/zlib/gzlib.c892
-rw-r--r--src/lib/zlib/gzread.c962
-rw-r--r--src/lib/zlib/gzwrite.c940
-rw-r--r--src/lib/zlib/infback.c998
-rw-r--r--src/lib/zlib/inffast.c482
-rw-r--r--src/lib/zlib/inffixed.h182
-rw-r--r--src/lib/zlib/inflate.c2136
-rw-r--r--src/lib/zlib/inflate.h144
-rw-r--r--src/lib/zlib/inftrees.c534
-rw-r--r--src/lib/zlib/inftrees.h16
-rw-r--r--src/lib/zlib/trees.c1529
-rw-r--r--src/lib/zlib/trees.h13
-rw-r--r--src/lib/zlib/uncompr.c66
-rw-r--r--src/lib/zlib/zconf.h70
-rw-r--r--src/lib/zlib/zlib.h224
-rw-r--r--src/lib/zlib/zutil.c260
-rw-r--r--src/lib/zlib/zutil.h62
-rw-r--r--src/mame/audio/decobsmt.h2
-rw-r--r--src/mame/audio/exidy.c4
-rw-r--r--src/mame/audio/exidy.h44
-rw-r--r--src/mame/audio/exidy440.c4
-rw-r--r--src/mame/audio/galaxian.c8
-rw-r--r--src/mame/audio/leland.c2
-rw-r--r--src/mame/audio/segam1audio.c7
-rw-r--r--src/mame/audio/seibu.c14
-rw-r--r--src/mame/audio/seibu.h50
-rw-r--r--src/mame/audio/t5182.c6
-rw-r--r--src/mame/audio/t5182.h4
-rw-r--r--src/mame/audio/taito_en.c2
-rw-r--r--src/mame/audio/taito_en.h10
-rw-r--r--src/mame/audio/taitosnd.c10
-rw-r--r--src/mame/audio/targ.c4
-rw-r--r--src/mame/drivers/20pacgal.c14
-rw-r--r--src/mame/drivers/3x3puzzl.c16
-rw-r--r--src/mame/drivers/arcadecl.c4
-rw-r--r--src/mame/drivers/atarig42.c2
-rw-r--r--src/mame/drivers/atarigt.c2
-rw-r--r--src/mame/drivers/atarigx2.c2
-rw-r--r--src/mame/drivers/atarisy1.c4
-rw-r--r--src/mame/drivers/atarisy2.c4
-rw-r--r--src/mame/drivers/badlands.c6
-rw-r--r--src/mame/drivers/batman.c2
-rw-r--r--src/mame/drivers/berzerk.c4
-rw-r--r--src/mame/drivers/bfm_sc1.c4
-rw-r--r--src/mame/drivers/blstroid.c2
-rw-r--r--src/mame/drivers/cabal.c2
-rw-r--r--src/mame/drivers/cave.c34
-rw-r--r--src/mame/drivers/cdi.c2
-rw-r--r--src/mame/drivers/crystal.c2
-rw-r--r--src/mame/drivers/cupidon.c14
-rw-r--r--src/mame/drivers/cyberbal.c4
-rw-r--r--src/mame/drivers/dambustr.c2
-rw-r--r--src/mame/drivers/dblewing.c4
-rw-r--r--src/mame/drivers/ddealer.c22
-rw-r--r--src/mame/drivers/ddragon.c24
-rw-r--r--src/mame/drivers/de_3.c84
-rw-r--r--src/mame/drivers/de_3b.c8
-rw-r--r--src/mame/drivers/eprom.c6
-rw-r--r--src/mame/drivers/exprraid.c8
-rw-r--r--src/mame/drivers/firebeat.c8
-rw-r--r--src/mame/drivers/freekick.c2
-rw-r--r--src/mame/drivers/galaxia.c2
-rw-r--r--src/mame/drivers/galaxold.c6
-rw-r--r--src/mame/drivers/galpani2.c38
-rw-r--r--src/mame/drivers/galpani3.c8
-rw-r--r--src/mame/drivers/galpanic.c38
-rw-r--r--src/mame/drivers/gticlub.c6
-rw-r--r--src/mame/drivers/harddriv.c2
-rw-r--r--src/mame/drivers/klax.c2
-rw-r--r--src/mame/drivers/ksys573.c2
-rw-r--r--src/mame/drivers/laserbas.c94
-rw-r--r--src/mame/drivers/malzak.c2
-rw-r--r--src/mame/drivers/maygay1b.c8
-rw-r--r--src/mame/drivers/mjkjidai.c2
-rw-r--r--src/mame/drivers/mlanding.c144
-rw-r--r--src/mame/drivers/model2.c2
-rw-r--r--src/mame/drivers/mpu5hw.c2
-rw-r--r--src/mame/drivers/mustache.c6
-rw-r--r--src/mame/drivers/namcond1.c2
-rw-r--r--src/mame/drivers/namcos22.c42
-rw-r--r--src/mame/drivers/naomi.c4
-rw-r--r--src/mame/drivers/nmk16.c22
-rw-r--r--src/mame/drivers/offtwall.c2
-rw-r--r--src/mame/drivers/panicr.c8
-rw-r--r--src/mame/drivers/polepos.c54
-rw-r--r--src/mame/drivers/r2dx_v33.c4
-rw-r--r--src/mame/drivers/raiden2.c8
-rw-r--r--src/mame/drivers/rampart.c2
-rw-r--r--src/mame/drivers/relief.c2
-rw-r--r--src/mame/drivers/renegade.c2
-rw-r--r--src/mame/drivers/sandscrp.c16
-rw-r--r--src/mame/drivers/seabattl.c2
-rw-r--r--src/mame/drivers/sfbonus.c2
-rw-r--r--src/mame/drivers/shanghai.c2
-rw-r--r--src/mame/drivers/skimaxx.c2
-rw-r--r--src/mame/drivers/skullxbo.c2
-rw-r--r--src/mame/drivers/snk68.c82
-rw-r--r--src/mame/drivers/stfight.c4
-rw-r--r--src/mame/drivers/taito_b.c4
-rw-r--r--src/mame/drivers/taito_f3.c2
-rw-r--r--src/mame/drivers/taito_x.c4
-rw-r--r--src/mame/drivers/taitoair.c6
-rw-r--r--src/mame/drivers/taitotx.c2
-rw-r--r--src/mame/drivers/taitotz.c2
-rw-r--r--src/mame/drivers/tapatune.c102
-rw-r--r--src/mame/drivers/thunderj.c2
-rw-r--r--src/mame/drivers/toaplan2.c3
-rw-r--r--src/mame/drivers/toobin.c4
-rw-r--r--src/mame/drivers/topspeed.c38
-rw-r--r--src/mame/drivers/trvmadns.c2
-rw-r--r--src/mame/drivers/tumbleb.c10
-rw-r--r--src/mame/drivers/vamphalf.c4
-rw-r--r--src/mame/drivers/vegas.c4
-rw-r--r--src/mame/drivers/vicdual.c2
-rw-r--r--src/mame/drivers/vindictr.c4
-rw-r--r--src/mame/drivers/xybots.c2
-rw-r--r--src/mame/includes/amiga.h2
-rw-r--r--src/mame/includes/arcadecl.h2
-rw-r--r--src/mame/includes/atarisy1.h2
-rw-r--r--src/mame/includes/cabal.h4
-rw-r--r--src/mame/includes/carpolo.h2
-rw-r--r--src/mame/includes/cd32.h14
-rw-r--r--src/mame/includes/darkmist.h4
-rw-r--r--src/mame/includes/ddragon3.h4
-rw-r--r--src/mame/includes/deadang.h4
-rw-r--r--src/mame/includes/dynduke.h2
-rw-r--r--src/mame/includes/exidy.h10
-rw-r--r--src/mame/includes/exprraid.h8
-rw-r--r--src/mame/includes/galaxia.h2
-rw-r--r--src/mame/includes/gauntlet.h8
-rw-r--r--src/mame/includes/harddriv.h2
-rw-r--r--src/mame/includes/klax.h2
-rw-r--r--src/mame/includes/macrossp.h5
-rw-r--r--src/mame/includes/micro3d.h2
-rw-r--r--src/mame/includes/mjkjidai.h4
-rw-r--r--src/mame/includes/model1.h2
-rw-r--r--src/mame/includes/model2.h4
-rw-r--r--src/mame/includes/mustache.h4
-rw-r--r--src/mame/includes/namcos22.h20
-rw-r--r--src/mame/includes/pgm.h2
-rw-r--r--src/mame/includes/raiden2.h2
-rw-r--r--src/mame/includes/segas32.h2
-rw-r--r--src/mame/includes/snes.h2
-rw-r--r--src/mame/includes/snk6502.h6
-rw-r--r--src/mame/includes/stfight.h4
-rw-r--r--src/mame/includes/taito_b.h2
-rw-r--r--src/mame/includes/taito_x.h4
-rw-r--r--src/mame/includes/toki.h2
-rw-r--r--src/mame/includes/topspeed.h18
-rw-r--r--src/mame/includes/vicdual.h12
-rw-r--r--src/mame/includes/wolfpack.h4
-rw-r--r--src/mame/includes/xybots.h6
-rw-r--r--src/mame/includes/zac2650.h4
-rw-r--r--src/mame/machine/atarigen.c6
-rw-r--r--src/mame/machine/atarigen.h13
-rw-r--r--src/mame/machine/cd32.c2
-rw-r--r--src/mame/machine/deco104.c2058
-rw-r--r--src/mame/machine/deco146.c2
-rw-r--r--src/mame/machine/decocass_tape.h8
-rw-r--r--src/mame/machine/decopincpu.c30
-rw-r--r--src/mame/machine/gaelco3d.c2
-rw-r--r--src/mame/machine/gaelco3d.h6
-rw-r--r--src/mame/machine/maple-dc.c3
-rw-r--r--src/mame/machine/megavdp.c6
-rw-r--r--src/mame/machine/namco62.h4
-rw-r--r--src/mame/machine/naomi.c32
-rw-r--r--src/mame/machine/neoprot.c12
-rw-r--r--src/mame/machine/nmk004.c6
-rw-r--r--src/mame/machine/nmk004.h6
-rw-r--r--src/mame/machine/pgmprot_igs025_igs028.c84
-rw-r--r--src/mame/machine/pgmprot_igs027a_type1.c192
-rw-r--r--src/mame/machine/pgmprot_igs027a_type2.c2
-rw-r--r--src/mame/machine/stfight.c2
-rw-r--r--src/mame/mame.lst26
-rw-r--r--src/mame/video/8080bw.c2
-rw-r--r--src/mame/video/atarimo.c60
-rw-r--r--src/mame/video/atarimo.h137
-rw-r--r--src/mame/video/atarirle.c54
-rw-r--r--src/mame/video/atarirle.h76
-rw-r--r--src/mame/video/bfm_adr2.c12
-rw-r--r--src/mame/video/bfm_adr2.h20
-rw-r--r--src/mame/video/bfm_dm01.c6
-rw-r--r--src/mame/video/bfm_dm01.h8
-rw-r--r--src/mame/video/cave.c6
-rw-r--r--src/mame/video/ddragon3.c3
-rw-r--r--src/mame/video/deco16ic.c2
-rw-r--r--src/mame/video/deco16ic.h2
-rw-r--r--src/mame/video/gticlub.c2
-rw-r--r--src/mame/video/k001005.c4
-rw-r--r--src/mame/video/k001005.h8
-rw-r--r--src/mame/video/k037122.h2
-rw-r--r--src/mame/video/kaneko_spr.c2
-rw-r--r--src/mame/video/mcd212.c2
-rw-r--r--src/mame/video/namcos2.c4
-rw-r--r--src/mame/video/namcos22.c32
-rw-r--r--src/mame/video/powervr2.c59
-rw-r--r--src/mame/video/powervr2.h2
-rw-r--r--src/mame/video/segaic16.c2
-rw-r--r--src/mame/video/segaic16.h2
-rw-r--r--src/mame/video/snes.c2
-rw-r--r--src/mame/video/tia.c2
-rw-r--r--src/mame/video/tia.h12
-rw-r--r--src/mame/video/toobin.c1
-rw-r--r--src/mame/video/vrender0.c2
-rw-r--r--src/mame/video/vrender0.h4
-rw-r--r--src/mame/video/ygv608.c8
-rw-r--r--src/mame/video/ygv608.h14
-rw-r--r--src/mess/drivers/a7800.c264
-rw-r--r--src/mess/drivers/abc1600.c4
-rw-r--r--src/mess/drivers/apple2.c17
-rw-r--r--src/mess/drivers/apricot.c4
-rw-r--r--src/mess/drivers/cat.c4
-rw-r--r--src/mess/drivers/cosmicos.c4
-rw-r--r--src/mess/drivers/dccons.c466
-rw-r--r--src/mess/drivers/dsb46.c2
-rw-r--r--src/mess/drivers/esq5505.c22
-rw-r--r--src/mess/drivers/kaypro.c4
-rw-r--r--src/mess/drivers/kyocera.c18
-rw-r--r--src/mess/drivers/lola8a.c111
-rw-r--r--src/mess/drivers/mac.c2
-rw-r--r--src/mess/drivers/megadriv.c1
-rw-r--r--src/mess/drivers/mtx.c42
-rw-r--r--src/mess/drivers/octopus.c48
-rw-r--r--src/mess/drivers/onyx.c6
-rw-r--r--src/mess/drivers/pc9801.c36
-rw-r--r--src/mess/drivers/rainbow.c246
-rw-r--r--src/mess/drivers/sbc6510.c2
-rw-r--r--src/mess/drivers/segapico.c41
-rw-r--r--src/mess/drivers/studio2.c20
-rw-r--r--src/mess/drivers/supracan.c4
-rw-r--r--src/mess/drivers/v1050.c40
-rw-r--r--src/mess/drivers/zaurus.c26
-rw-r--r--src/mess/includes/aim65.h2
-rw-r--r--src/mess/includes/amstr_pc.h4
-rw-r--r--src/mess/includes/dccons.h8
-rw-r--r--src/mess/includes/md_cons.h2
-rw-r--r--src/mess/includes/osi.h2
-rw-r--r--src/mess/includes/rmnimbus.h28
-rw-r--r--src/mess/includes/studio2.h2
-rw-r--r--src/mess/layout/rainbow.lay6
-rw-r--r--src/mess/machine/64h156.c2
-rw-r--r--src/mess/machine/a2applicard.c20
-rw-r--r--src/mess/machine/abc1600mac.c2
-rw-r--r--src/mess/machine/abc1600mac.h2
-rw-r--r--src/mess/machine/c2040.c16
-rw-r--r--src/mess/machine/c64/magic_voice.c104
-rw-r--r--src/mess/machine/c64/magic_voice.h2
-rw-r--r--src/mess/machine/c64/music64.h2
-rw-r--r--src/mess/machine/c64_nl10.h2
-rw-r--r--src/mess/machine/comx_fd.c4
-rw-r--r--src/mess/machine/dccons.c4
-rw-r--r--src/mess/machine/e05a03.c1
-rw-r--r--src/mess/machine/e05a03.h4
-rw-r--r--src/mess/machine/hardbox.c59
-rw-r--r--src/mess/machine/hardbox.h2
-rw-r--r--src/mess/machine/isa_wd1002a_wx1.c2
-rw-r--r--src/mess/machine/isa_xtide.c4
-rw-r--r--src/mess/machine/mac.c16
-rw-r--r--src/mess/machine/mackbd.c21
-rw-r--r--src/mess/machine/mackbd.h22
-rw-r--r--src/mess/machine/micropolis.c2
-rw-r--r--src/mess/machine/micropolis.h10
-rw-r--r--src/mess/machine/mpu401.c73
-rw-r--r--src/mess/machine/mpu401.h2
-rw-r--r--src/mess/machine/pc_lpt.h4
-rw-r--r--src/mess/machine/rmnimbus.c4
-rw-r--r--src/mess/machine/ti99/spchsyn.c4
-rw-r--r--src/mess/machine/ti99/videowrp.c4
-rw-r--r--src/mess/mess.lst2
-rw-r--r--src/mess/video/733_asr.h2
-rw-r--r--src/mess/video/911_vdt.h2
-rw-r--r--src/mess/video/abc1600.c18
-rw-r--r--src/mess/video/abc1600.h2
-rw-r--r--src/mess/video/cirrus.h2
-rw-r--r--src/mess/video/gb_lcd.h2
-rw-r--r--src/mess/video/k1ge.h6
-rw-r--r--src/mess/video/nubus_m2video.c4
-rw-r--r--src/mess/video/pds30_procolor816.c2
-rw-r--r--src/mess/video/vtvideo.c102
-rw-r--r--src/osd/osdcomm.h6
-rw-r--r--src/osd/portmedia/pmmidi.c14
-rw-r--r--src/osd/sdl/debugqtbreakpointswindow.c2
-rw-r--r--src/osd/windows/d3dhlsl.h111
-rw-r--r--src/osd/windows/d3dintf.h2
-rw-r--r--src/osd/windows/drawd3d.h2
-rw-r--r--src/osd/windows/winmain.c2
-rw-r--r--src/osd/windows/winmain.h2
-rw-r--r--src/osd/windows/winptty.c4
-rw-r--r--src/tools/jedutil.c600
-rw-r--r--src/version.c2
437 files changed, 17649 insertions, 17765 deletions
diff --git a/hash/a800_flop.xml b/hash/a800_flop.xml
index 3c5cb6df128..091e16709b0 100644
--- a/hash/a800_flop.xml
+++ b/hash/a800_flop.xml
@@ -2,12 +2,12 @@
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
<!--
- Atari 400 / 800 floppies
- (skeleton list)
-
- note: many 'original' floppy images are in .atx format, whereas cracked / unprotected ones are .atr format
- .atx is unsupported, although apparently has been reverse engineered (insert info link here)
- There are also images in .xex format?
+ Atari 400 / 800 floppies
+ (skeleton list)
+
+ note: many 'original' floppy images are in .atx format, whereas cracked / unprotected ones are .atr format
+ .atx is unsupported, although apparently has been reverse engineered (insert info link here)
+ There are also images in .xex format?
-->
@@ -23,6 +23,6 @@
</dataarea>
</part>
</software>
-
-
+
+
</softwarelist>
diff --git a/hash/amigaocs_flop.xml b/hash/amigaocs_flop.xml
index 1200cc5f449..2a6c70b9cc9 100644
--- a/hash/amigaocs_flop.xml
+++ b/hash/amigaocs_flop.xml
@@ -20935,7 +20935,7 @@
<dataarea name="flop" size="1049612">
<rom name="hugo - pa nye eventyr 2 (denmark) (disk 1 of 6).ipf" size="1049612" crc="47ebcd60" sha1="e7689d9fab1d1eabb204121633ad0fad87100e86" offset="0"/>
</dataarea>
- </part>
+ </part>
<part name="flop2" interface="floppy_3_5">
<feature name="part_id" value="Disk 2" />
<dataarea name="flop" size="1049612">
diff --git a/hash/apple2.xml b/hash/apple2.xml
index 423ad5f055c..f2e22474ce4 100644
--- a/hash/apple2.xml
+++ b/hash/apple2.xml
@@ -2766,7 +2766,7 @@
<software name="breakout">
<description>Breakout</description>
<year>19??</year>
- <publisher>Apple Computer, Inc.</publisher> <!-- programmed by Steve Wozniak -->
+ <publisher>Apple Computer, Inc.</publisher> <!-- programmed by Steve Wozniak -->
<part name="flop11" interface="floppy_5_25">
<dataarea name="flop1" size="143360">
diff --git a/hash/c64_cart.xml b/hash/c64_cart.xml
index d02e4c86c2a..ea8171018f4 100644
--- a/hash/c64_cart.xml
+++ b/hash/c64_cart.xml
@@ -6903,11 +6903,11 @@
<publisher>Commodore</publisher>
<info name="serial" value="C-64320" />
<sharedfeat name="compatibility" value="NTSC,PAL"/>
-
+
<part name="cart" interface="c64_cart">
<feature name="game" value="0" />
<feature name="exrom" value="0" />
-
+
<dataarea name="roml" size="0x4000">
<rom name="a-bee-c.rom" size="0x4000" crc="5cfe999c" sha1="57202c3829f1d668c445ae7e792ae80245682a99" offset="0" />
</dataarea>
diff --git a/hash/c64_flop.xml b/hash/c64_flop.xml
index 615e223e15e..3feb643665c 100644
--- a/hash/c64_flop.xml
+++ b/hash/c64_flop.xml
@@ -1085,7 +1085,7 @@
<rom name="cmk49.d64" size="174848" crc="5ef6645a" sha1="c9afd892731ebd68bc67bd8c6c84cbb1aa5e874d" offset="0" />
</dataarea>
</part>
- </software>
+ </software>
<!-- Test -->
diff --git a/hash/copera.xml b/hash/copera.xml
index d7e208d1409..c199f65c655 100644
--- a/hash/copera.xml
+++ b/hash/copera.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
- <!--
+ <!--
Games for the MIXT BOOK PLAYER COPERA
* メロディランド - Melody Land (Yamaha - 199312xx - MMGS-1)
@@ -16,9 +16,9 @@ not dumped?
* コペラのちきゅうだいすき - Copera no Chikyuu Daisuki (Yamaha - ???? - MMGS-9)
* 冒険!メロリン島 - Bouken! Merorin Shima (Yamaha - ???? - MMGS-10)
- -->
-
- <softwarelist name="copera" description="Yamaha / Sega Copera cartridges">
+ -->
+
+ <softwarelist name="copera" description="Yamaha / Sega Copera cartridges">
<software name="melody">
@@ -68,7 +68,7 @@ not dumped?
</dataarea>
</part>
</software>
-
+
<software name="outacanv">
<description>Outa no Canvas (Jpn)</description>
<year>1994</year>
@@ -83,8 +83,8 @@ not dumped?
</dataarea>
</part>
</software>
-
- <software name="copekono">
+
+ <software name="copekono">
<description>Copera no Kono Otonaani (Jpn)</description>
<year>1994</year>
<publisher>Yamaha</publisher>
@@ -98,7 +98,7 @@ not dumped?
</dataarea>
</part>
</software>
-
+
<software name="mikeatmw">
<description>Mike to Asobou Tobidase Milky Way (Jpn)</description>
<year>1994</year>
diff --git a/hash/famicom_cass.xml b/hash/famicom_cass.xml
index bab4db6bac9..55dda55ecaa 100644
--- a/hash/famicom_cass.xml
+++ b/hash/famicom_cass.xml
@@ -2,7 +2,7 @@
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
<softwarelist name="famicom_cass" description="Nintendo Famicom Family BASIC cassettes">
-<!--
+<!--
This list is a bit peculiar, since it contains cassette images obtained on a FC
by saving BASIC programs typed in from magazines, books, or homebrew
diff --git a/hash/ibm5140.xml b/hash/ibm5140.xml
index 4c7a3b193b6..af79581dbed 100644
--- a/hash/ibm5140.xml
+++ b/hash/ibm5140.xml
@@ -52,5 +52,5 @@
</dataarea>
</part>
</software>
-
+
</softwarelist>
diff --git a/hash/ibm5170.xml b/hash/ibm5170.xml
index d13845fcd6a..47f0a4cec65 100644
--- a/hash/ibm5170.xml
+++ b/hash/ibm5170.xml
@@ -13,7 +13,7 @@ Missing files come here
<description>Advanced Diagnostics for the IBM AT (v2.07)</description>
<year>1985</year>
<publisher>IBM</publisher>
-
+
<part name="flop1" interface="floppy_5_25">
<dataarea name="flop" size="368640">
<rom name="atad_207.img" size="368640" crc="43d0783b" sha1="63a48f7dd92382356222ed2030cd4b900d09de3d" offset="0" />
diff --git a/hash/megadriv.xml b/hash/megadriv.xml
index 0a9dc0976de..3af9614b6be 100644
--- a/hash/megadriv.xml
+++ b/hash/megadriv.xml
@@ -31027,16 +31027,16 @@ This dump is either a bad dump or a wrongly patched one.
-->
- <!-- Software below is test / demo software for the purpose of validating our emulation
- where possible any information / additional files provided with the software has been included in extra data areas
- in order to mirror the original release packages and possibly provide useful references
-
- If no additional materials are listed then the results of a successful run should be mentioned here for future reference.
- -->
-
- <!-- most effects currently fail -->
- <!-- titan-overdrivemegademo.zip -->
- <!-- http://www.pouet.net/prod.php?which=61724 -->
+ <!-- Software below is test / demo software for the purpose of validating our emulation
+ where possible any information / additional files provided with the software has been included in extra data areas
+ in order to mirror the original release packages and possibly provide useful references
+
+ If no additional materials are listed then the results of a successful run should be mentioned here for future reference.
+ -->
+
+ <!-- most effects currently fail -->
+ <!-- titan-overdrivemegademo.zip -->
+ <!-- http://www.pouet.net/prod.php?which=61724 -->
<software name="d_titovr">
<description>Overdrive (Demo) (Euro)</description>
<year>2013</year>
@@ -31045,19 +31045,19 @@ This dump is either a bad dump or a wrongly patched one.
<dataarea name="rom" size="0x400000">
<rom name="titan-overdrivemegademo.bin" size="0x3f01be" crc="3deb19a9" sha1="6085182099d6a9ad2c8242eae263507e42269b66" offset="0x000000" loadflag="load16_word_swap"/>
</dataarea>
- <!-- non-rom extras (should be marked as optional?) -->
- <dataarea name="misc" size="0x7af9">
+ <!-- non-rom extras (should be marked as optional?) -->
+ <dataarea name="misc" size="0x7af9">
<rom name="titan-overdrivemegademo.nfo" size="0x7af9" crc="d560530a" sha1="f3a130881878e95a1db6e32268e7b1b001965c1a" offset="0x000000"/>
</dataarea>
- <dataarea name="misc2" size="0x13489c0">
- <rom name="titan-overdrivemegademo_inlay.pdf" size="0x13489c0" crc="ae55e12d" sha1="620fcba1600563b87543b027c42687da7d876b03" offset="0x000000"/>
+ <dataarea name="misc2" size="0x13489c0">
+ <rom name="titan-overdrivemegademo_inlay.pdf" size="0x13489c0" crc="ae55e12d" sha1="620fcba1600563b87543b027c42687da7d876b03" offset="0x000000"/>
</dataarea>
- <dataarea name="misc3" size="0xa68cf">
- <rom name="titan-overdrivemegademo_label.pdf" size="0xa68cf" crc="a527c826" sha1="449c945a0ddcbb145c7c92bc01fac543fc1352da" offset="0x000000"/>
+ <dataarea name="misc3" size="0xa68cf">
+ <rom name="titan-overdrivemegademo_label.pdf" size="0xa68cf" crc="a527c826" sha1="449c945a0ddcbb145c7c92bc01fac543fc1352da" offset="0x000000"/>
</dataarea>
- <dataarea name="misc4" size="0x1c985d">
- <rom name="titan-overdrivemegademo_poster.png" size="0x1c985d" crc="0dfeac10" sha1="cdfd4ff93e199da66cab3ef49d39828f3eb6040c" offset="0x000000"/>
- </dataarea>
+ <dataarea name="misc4" size="0x1c985d">
+ <rom name="titan-overdrivemegademo_poster.png" size="0x1c985d" crc="0dfeac10" sha1="cdfd4ff93e199da66cab3ef49d39828f3eb6040c" offset="0x000000"/>
+ </dataarea>
</part>
</software>
diff --git a/hash/megaduck.xml b/hash/megaduck.xml
index 8b752623610..6ff9812a745 100644
--- a/hash/megaduck.xml
+++ b/hash/megaduck.xml
@@ -193,7 +193,7 @@
</dataarea>
</part>
</software>
-
+
<software name="2ndspace">
<description>2nd Space</description>
<year>1993</year>
@@ -206,7 +206,7 @@
</dataarea>
</part>
</software>
-
+
<software name="trapturn">
<description>Trap &amp; Turn</description>
<year>1993</year>
@@ -219,7 +219,7 @@
</dataarea>
</part>
</software>
-
+
<software name="bombdisp">
<description>Bomb Disposer</description>
<year>1993</year>
@@ -232,7 +232,7 @@
</dataarea>
</part>
</software>
-
+
<software name="mmaze">
<description>Magic Maze</description>
<year>1993</year>
@@ -245,7 +245,7 @@
</dataarea>
</part>
</software>
-
+
<software name="vex">
<description>Vex</description>
<year>1993</year>
diff --git a/hash/pc98.xml b/hash/pc98.xml
index f3d63d915eb..0c4af0b8939 100644
--- a/hash/pc98.xml
+++ b/hash/pc98.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
-<softwarelist name="pc98" description="NEC PC-9801 disk images">
+<softwarelist name="pc98" description="NEC PC-9801 disk images">
<software name="pc98dosd">
<description>PC-98DO+ System Disk</description>
@@ -98,7 +98,7 @@ only have some part of Windows file and a Video driver(CLGD?).
<!--
PC-98xx NEW (as per 31 July 2013) software list starts here.
TODO:
-- Manually parse the list, add publisher / year where possible, fix floppy order (i.e. if a floppy is labeled opening.fdi or system.fdi is the one
+- Manually parse the list, add publisher / year where possible, fix floppy order (i.e. if a floppy is labeled opening.fdi or system.fdi is the one
required at PC-98xx boot), label ALL userX.fdi images as bad dump, test all games and double check support status, fix zipnames (most sucks right now),
identify anything that has a size different than 1265664 (== 3'5" floppy image), document any unorthodox way for running a given sw.
@@ -145,12 +145,12 @@ TODO:
<dataarea name="flop" size="1265664">
<rom name="2069ad_b.fdi" size="1265664" crc="3e596802" sha1="05633e7847be623f1fdc8e4c4cbaa91dd7ac8a68" offset="0" />
</dataarea>
- </part>
+ </part>
<part name="flop3" interface="floppy_5_25">
<dataarea name="flop" size="1265664">
<rom name="2069ad_c.fdi" size="1265664" crc="25c601a5" sha1="a6b6b7096fedf6a0536fee0b380e976ebd0eb63b" offset="0" />
</dataarea>
- </part>
+ </part>
</software>
<software name="31iwayu" supported="yes">
@@ -162,7 +162,7 @@ TODO:
<rom name="disk a.fdi" size="1265664" crc="7131e56e" sha1="2070ebdd0acb1a50d77cc73368b448fe05096a3e" offset="0" />
</dataarea>
</part>
-
+
<part name="flop2" interface="floppy_5_25">
<dataarea name="flop" size="1265664">
<rom name="disk b.fdi" size="1265664" crc="54ed018b" sha1="69aaf92e5545a26fe62e4acd5334249173b0e06b" offset="0" />
@@ -209,7 +209,7 @@ TODO:
</dataarea>
</part>
<!--
- Note: all of these are expansions (and have no clue about how to load them either)
+ Note: all of these are expansions (and have no clue about how to load them either)
-->
<part name="flop2" interface="floppy_5_25">
<dataarea name="flop" size="1265664">
@@ -833,24 +833,24 @@ TODO:
<software name="add_pdrk">
<description>AD&amp;D Pools of Darkness</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="diska.fdi" size="1265664" crc="a40becba" sha1="3c65e5ab1f95d5f9863681c472b8c73927e0a2c2" offset="0" />
- </dataarea>
- </part>
- <part name="flop2" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="diskb.fdi" size="1265664" crc="2fb75bcb" sha1="78df14162d4fbd9e6c8f6a67e00d3aed3dd02bc7" offset="0" />
- </dataarea>
- </part>
- <part name="flop3" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="opening.fdi" size="1265664" crc="11cf2229" sha1="abf3bed693797d9bfecb1b7dc42eadcfb8a14641" offset="0" />
- </dataarea>
- </part>
- </software>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="diska.fdi" size="1265664" crc="a40becba" sha1="3c65e5ab1f95d5f9863681c472b8c73927e0a2c2" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop2" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="diskb.fdi" size="1265664" crc="2fb75bcb" sha1="78df14162d4fbd9e6c8f6a67e00d3aed3dd02bc7" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop3" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="opening.fdi" size="1265664" crc="11cf2229" sha1="abf3bed693797d9bfecb1b7dc42eadcfb8a14641" offset="0" />
+ </dataarea>
+ </part>
+ </software>
<software name="add_ssil" supported="no">
<description>AD&amp;D Secret of the Silver Blades</description>
@@ -882,7 +882,7 @@ TODO:
<rom name="user.d88" size="0x138fb0" crc="efd89d91" sha1="c243ec20af65ea9f612926c2c8ce868750a076e4" offset="0" status="baddump" />
</dataarea>
</part>
- </software>
+ </software>
<software name="advanp2p">
<description>Advanced Power Dolls 2 Premium Disk</description>
@@ -912,9 +912,9 @@ TODO:
</part>
<!-- hacked (and working since it's 2hd floppy) set, not going to be supported however
<part name="flop3" interface="floppy_5_25">
- <dataarea name="flop" size="0x1093f0">
- <rom name="adventureland 2hd.d88" size="0x1093f0" crc="dfe46669" sha1="ee0e6fae3553f8b60d515ba5c0bfdbe56cb7df16" offset="0" />
- </dataarea>
+ <dataarea name="flop" size="0x1093f0">
+ <rom name="adventureland 2hd.d88" size="0x1093f0" crc="dfe46669" sha1="ee0e6fae3553f8b60d515ba5c0bfdbe56cb7df16" offset="0" />
+ </dataarea>
</part>
-->
</software>
@@ -1645,16 +1645,16 @@ TODO:
</part>
</software>
<!--
- <software name="applec4">
- <description> Apple Club - Data Shuu #04 - Tonari no Oneesan Hen</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="?pc98????????1 ????#4.fdi" size="1265664" crc=" ***" sha1="20e87b43 ?CRC32*Apple Club 1\aplclub1.FD" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="applec4">
+ <description> Apple Club - Data Shuu #04 - Tonari no Oneesan Hen</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="?pc98????????1 ????#4.fdi" size="1265664" crc=" ***" sha1="20e87b43 ?CRC32*Apple Club 1\aplclub1.FD" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="applecl">
<description>Apple Club 1 - Kinjirareta Asobi Series</description>
@@ -2041,7 +2041,7 @@ TODO:
</dataarea>
</part>
</software>
-
+
<software name="asokono">
<description>Asoko no Koufuku - Yamamoto-san-chi no Baai ni Okeru Asoko no Fukou ni Tsuite</description>
<year>19??</year>
@@ -2638,7 +2638,7 @@ TODO:
</dataarea>
</part>
</software>
-
+
<software name="bodyins">
<description>Body Inspection in Belloncho</description>
<year>19??</year>
@@ -2664,7 +2664,7 @@ TODO:
<rom name="bokosuka.d88" size="0x10f760" crc="d5da4869" sha1="1fd6124180be8f20acd188702e3b9f9c2d128428" offset="0" />
</dataarea>
</part>
- </software>
+ </software>
<software name="bomberq">
<description>Bomber Quest</description>
@@ -3093,7 +3093,7 @@ TODO:
</dataarea>
</part>
</software>
-
+
<software name="burningd">
<description>Burning Dragon</description>
<year>19??</year>
@@ -3257,7 +3257,7 @@ TODO:
</dataarea>
</part>
</software>
-
+
<software name="carata" cloneof="carat">
<description>Carat - Magical Blocks(another)</description>
<year>19??</year>
@@ -4275,7 +4275,7 @@ TODO:
</part>
</software>
-<!--
+<!--
Presumably copy protection floppy, to be used with CD-Rom
-->
<software name="debut">
@@ -5098,7 +5098,7 @@ Presumably copy protection floppy, to be used with CD-Rom
</part>
</software>
-
+
<software name="dragone">
<description>Dragon Egg</description>
<year>19??</year>
@@ -5527,16 +5527,16 @@ Presumably copy protection floppy, to be used with CD-Rom
<!--
TODO: missing install disks
- <software name="eveber">
- <description>Eve - Burst Error</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="dos62.fdi" size="1265664" crc="678b88a7" sha1="480dee4a4df0c588416b0895057caeba862eea7f" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="eveber">
+ <description>Eve - Burst Error</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="dos62.fdi" size="1265664" crc="678b88a7" sha1="480dee4a4df0c588416b0895057caeba862eea7f" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="f14fd">
@@ -5873,30 +5873,30 @@ TODO: missing install disks
<!-- same as all bishoujo extra disk 2 -->
<!--
- <software name="floppyb2">
- <description>Floppy Bunko 17 - All Bishoujo Art Graphics Vol. 2</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="disk_2.fdi" size="1265664" crc="ee12585b" sha1="941abd888e3ce84c072a28f4cd73b15cb6c8945b" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="floppyb2">
+ <description>Floppy Bunko 17 - All Bishoujo Art Graphics Vol. 2</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="disk_2.fdi" size="1265664" crc="ee12585b" sha1="941abd888e3ce84c072a28f4cd73b15cb6c8945b" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<!-- same as all bishoujo extra disk 3 -->
<!--
- <software name="floppyb3">
- <description>Floppy Bunko 20 - All Bishoujo Art Graphics Vol. 3</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="disk_3.fdi" size="1265664" crc="30ae9567" sha1="e46a1cd8fa82a99a497048001b2e6d0268c4a5d6" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="floppyb3">
+ <description>Floppy Bunko 20 - All Bishoujo Art Graphics Vol. 3</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="disk_3.fdi" size="1265664" crc="30ae9567" sha1="e46a1cd8fa82a99a497048001b2e6d0268c4a5d6" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="foxy">
@@ -6429,16 +6429,16 @@ TODO: missing install disks
<!--
Fake disk?
- <software name="golflin">
- <description>Golf Links 386 Pro</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="golf links 386 pro anex86 cd & hd boot disk.fdi" size="1265664" crc="05559a9e" sha1="77510219ec879af55a90da092e268c5fa4b0257c" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="golflin">
+ <description>Golf Links 386 Pro</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="golf links 386 pro anex86 cd & hd boot disk.fdi" size="1265664" crc="05559a9e" sha1="77510219ec879af55a90da092e268c5fa4b0257c" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="golflpr">
<description>Golf Links Champion Course Pinehurst Resort and Country Ciub</description>
@@ -6814,7 +6814,7 @@ Fake disk?
</software>
<!--
-Game is named "image", with lowercase i on title screen
+Game is named "image", with lowercase i on title screen
-->
<software name="image">
<description>image</description>
@@ -7310,16 +7310,16 @@ Game is named "image", with lowercase i on title screen
<!--
TODO: other two disks, in .nfd format
- <software name="kawaisou">
- <description>Kawaisou Monogatari</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="user.fdi" size="1265664" crc="6c424c81" sha1="5feb465c5178534a575b555eeeabacae36b9f650" offset="0" status="baddump" />
- </dataarea>
- </part>
- </software>
+ <software name="kawaisou">
+ <description>Kawaisou Monogatari</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="user.fdi" size="1265664" crc="6c424c81" sha1="5feb465c5178534a575b555eeeabacae36b9f650" offset="0" status="baddump" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="kerakera">
<description>Kerakera-sei</description>
@@ -8279,7 +8279,7 @@ TODO: other two disks, in .nfd format
</dataarea>
</part>
</software>
-
+
<software name="madouars">
<description>Madou Monogatari A-R-S</description>
<year>19??</year>
@@ -8465,16 +8465,16 @@ TODO: other two disks, in .nfd format
</software>
<!-- TODO: another .nfd floppy used
- <software name="mtaikai">
- <description>Mahjong Taikai</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="user.fdi" size="1265664" crc="fca4122d" sha1="6797330e0237af84f1f4f112704034281834c97b" offset="0" status="baddump" />
- </dataarea>
- </part>
- </software>
+ <software name="mtaikai">
+ <description>Mahjong Taikai</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="user.fdi" size="1265664" crc="fca4122d" sha1="6797330e0237af84f1f4f112704034281834c97b" offset="0" status="baddump" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="mahoush">
<description>Mahou Shoujo Rina</description>
@@ -8736,16 +8736,16 @@ TODO: other two disks, in .nfd format
</software>
<!-- same as disk 02 fugasel1
- <software name="mazeque">
- <description>Maze Quest</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="maze quest.fdi" size="1265664" crc="3949e01a" sha1="9ee3c3dac883036375c69192fd98af11695ffea8" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="mazeque">
+ <description>Maze Quest</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="maze quest.fdi" size="1265664" crc="3949e01a" sha1="9ee3c3dac883036375c69192fd98af11695ffea8" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="meikyuu">
@@ -9072,16 +9072,16 @@ TODO: other two disks, in .nfd format
<!--
Omake disk?
- <software name="mime">
- <description>Mime</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="special.fdi" size="1265664" crc="7a3b8749" sha1="2ed561501500af290bd09e09e523d934c9ba7b5c" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="mime">
+ <description>Mime</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="special.fdi" size="1265664" crc="7a3b8749" sha1="2ed561501500af290bd09e09e523d934c9ba7b5c" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="mink01">
@@ -9222,7 +9222,7 @@ Omake disk?
</part>
</software>
-<!--
+<!--
Requires MS-DOS 5.00H plus an unknown procedure (HDD install?)
-->
<software name="gundamao" supported="no">
@@ -9753,18 +9753,18 @@ Requires MS-DOS 5.00H plus an unknown procedure (HDD install?)
</part>
</software>
-<!--
+<!--
Other three disks, in nfd format
- <software name="n88bas61">
- <description>N88 BASIC v6.1</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="rx_train.fdi" size="1265664" crc="607b85f8" sha1="0d2fdf6f0550e50127b27b42b470ba25b305239c" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="n88bas61">
+ <description>N88 BASIC v6.1</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="rx_train.fdi" size="1265664" crc="607b85f8" sha1="0d2fdf6f0550e50127b27b42b470ba25b305239c" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="nadiamw">
@@ -9780,16 +9780,16 @@ Other three disks, in nfd format
<!--
other two disks
- <software name="narumah">
- <description>Naru Mahjong</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="disk01.fdi" size="1265664" crc="d2db97c6" sha1="06910b3812d6efbac4f0b6adb9767397f2b590d7" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="narumah">
+ <description>Naru Mahjong</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="disk01.fdi" size="1265664" crc="d2db97c6" sha1="06910b3812d6efbac4f0b6adb9767397f2b590d7" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="natsudam">
@@ -9834,7 +9834,7 @@ other two disks
</dataarea>
</part>
</software>
-
+
<software name="nazopds7">
<description>Nazo Puyo (off DS7)</description>
<year>19??</year>
@@ -12152,16 +12152,16 @@ other two disks
</part>
</software>
<!--
- <software name="rougeno">
- <description>Rouge no Densetsu (hdi)</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="kidou.fdi" size="1265664" crc="e0b52ce7" sha1="00ed12fdff1986986e347343d9176f6205d5d87c" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="rougeno">
+ <description>Rouge no Densetsu (hdi)</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="kidou.fdi" size="1265664" crc="e0b52ce7" sha1="00ed12fdff1986986e347343d9176f6205d5d87c" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="roundwar">
<description>Round Warrior</description>
@@ -12763,41 +12763,41 @@ other two disks
<!--
Same as Police Quest 2 - Quest for Glory stand-alone disks
- <software name="sierradp">
- <description>Sierra 3D AVG Double Pack - Quest for Glory &amp; Police Quest 2</description>
- <year>19??</year>
- <publisher>&lt;unknown&gt;</publisher>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="police quest ii disk 01.fdi" size="1265664" crc="18f51678" sha1="49b137412230d20df0dec0c1236866003a3f1f15" offset="0" />
- </dataarea>
- </part>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="police quest ii disk 02.fdi" size="1265664" crc="3fd79ed8" sha1="6893264fd7ecdbf8ceb14d2e62d76bb548fb344e" offset="0" />
- </dataarea>
- </part>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="police quest ii disk 03.fdi" size="1265664" crc="4c6f0d6a" sha1="442e4f2074087b5d8401f808153a12ffef9a6e7c" offset="0" />
- </dataarea>
- </part>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="quest for glory disk 01.fdi" size="1265664" crc="695c079e" sha1="93195094944af1d88338c4a2ce82f9188a7f3898" offset="0" />
- </dataarea>
- </part>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="quest for glory disk 02.fdi" size="1265664" crc="b8cdbf73" sha1="d6048c691963d159ce29c9e90b0f33a60e71c29d" offset="0" />
- </dataarea>
- </part>
- <part name="flop1" interface="floppy_5_25">
- <dataarea name="flop" size="1265664">
- <rom name="quest for glory disk 03.fdi" size="1265664" crc="10f50bfa" sha1="7aab2821b8a18ef3ec4811d6c8e50767f96f0108" offset="0" />
- </dataarea>
- </part>
- </software>
+ <software name="sierradp">
+ <description>Sierra 3D AVG Double Pack - Quest for Glory &amp; Police Quest 2</description>
+ <year>19??</year>
+ <publisher>&lt;unknown&gt;</publisher>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="police quest ii disk 01.fdi" size="1265664" crc="18f51678" sha1="49b137412230d20df0dec0c1236866003a3f1f15" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="police quest ii disk 02.fdi" size="1265664" crc="3fd79ed8" sha1="6893264fd7ecdbf8ceb14d2e62d76bb548fb344e" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="police quest ii disk 03.fdi" size="1265664" crc="4c6f0d6a" sha1="442e4f2074087b5d8401f808153a12ffef9a6e7c" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="quest for glory disk 01.fdi" size="1265664" crc="695c079e" sha1="93195094944af1d88338c4a2ce82f9188a7f3898" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="quest for glory disk 02.fdi" size="1265664" crc="b8cdbf73" sha1="d6048c691963d159ce29c9e90b0f33a60e71c29d" offset="0" />
+ </dataarea>
+ </part>
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="1265664">
+ <rom name="quest for glory disk 03.fdi" size="1265664" crc="10f50bfa" sha1="7aab2821b8a18ef3ec4811d6c8e50767f96f0108" offset="0" />
+ </dataarea>
+ </part>
+ </software>
-->
<software name="simcity">
@@ -14988,7 +14988,7 @@ Same as Police Quest 2 - Quest for Glory stand-alone disks
</dataarea>
</part>
</software>
-
+
<software name="vg2">
<description>Variable Geo 2 - The Bout of Cabalistic Goddess</description>
<year>19??</year>
@@ -16508,7 +16508,7 @@ Same as Police Quest 2 - Quest for Glory stand-alone disks
</dataarea>
</part>
</software>
-
+
<software name="artemis">
<description>Artemis</description>
<year>19??</year>
diff --git a/hash/visicom.xml b/hash/visicom.xml
index 14e014fd681..3b25d710897 100644
--- a/hash/visicom.xml
+++ b/hash/visicom.xml
@@ -8,7 +8,7 @@ _________________________________________________________________
CAS-110 Arithmetic Drill (Math Fun & Fun with Numbers) no 算数ドリル
CAS-130 Sports Fan (Baseball & Sumo Wrestling) yes スポーツファン
-CAS-140 Gambler I (Blackjack) no ギャンブラーI
+CAS-140 Gambler I (Blackjack) no ギャンブラーI
CAS-141 Gambler II (Slot Machine and Dice) no ギャンブラーII
CAS-160 Space Command (Space War) no スペースコマンド
CAS-190 Inspiration (Bagua and Biorhythm) no 霊感
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 244762c9f4f..03fb7648d21 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -619,7 +619,7 @@ void cli_frontend::listdevices(const char *gamename)
// sort them by tag
qsort(&device_list[0], device_list.count(), sizeof(device_list[0]), compare_devices);
-
+
// dump the results
for (int index = 0; index < device_list.count(); index++)
{
@@ -629,7 +629,7 @@ void cli_frontend::listdevices(const char *gamename)
const char *tag = device->tag();
if (*tag == ':')
tag++;
-
+
// determine the depth
int depth = 1;
if (*tag == 0)
diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak
index 7bfbe9cdf91..8b5ab207e92 100644
--- a/src/emu/cpu/cpu.mak
+++ b/src/emu/cpu/cpu.mak
@@ -726,8 +726,8 @@ $(CPUOBJ)/i8085/i8085.o: $(CPUSRC)/i8085/i8085.c \
ifneq ($(filter I8089,$(CPUS)),)
OBJDIRS += $(CPUOBJ)/i8089
CPUOBJS += $(CPUOBJ)/i8089/i8089.o \
- $(CPUOBJ)/i8089/i8089_channel.o \
- $(CPUOBJ)/i8089/i8089_ops.o
+ $(CPUOBJ)/i8089/i8089_channel.o \
+ $(CPUOBJ)/i8089/i8089_ops.o
DASMOBJS += $(CPUOBJ)/i8089/i8089_dasm.o
endif
diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c
index 63f7dded5e2..157a53218f3 100644
--- a/src/emu/cpu/cubeqcpu/cubeqcpu.c
+++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c
@@ -111,8 +111,8 @@ offs_t cquestrot_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const U
cquestlin_cpu_device::cquestlin_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : cpu_device(mconfig, CQUESTLIN, "Cube Quest Line CPU", tag, owner, clock, "cquestlin", __FILE__)
- , m_program_config("program", ENDIANNESS_BIG, 64, 8, -3)
+ : cpu_device(mconfig, CQUESTLIN, "Cube Quest Line CPU", tag, owner, clock, "cquestlin", __FILE__)
+ , m_program_config("program", ENDIANNESS_BIG, 64, 8, -3)
, m_linedata_r(*this)
, m_flags(0)
, m_curpc(0)
@@ -358,8 +358,8 @@ void cquestrot_cpu_device::state_string_export(const device_state_entry &entry,
{
case STATE_GENFLAGS:
string.printf( "%c%c%c", m_cflag ? 'C' : '.',
- m_vflag ? 'V' : '.',
- m_f ? '.' : 'Z');
+ m_vflag ? 'V' : '.',
+ m_f ? '.' : 'Z');
break;
}
}
@@ -488,9 +488,9 @@ void cquestlin_cpu_device::state_string_export(const device_state_entry &entry,
{
case STATE_GENFLAGS:
string.printf( "%c%c%c|%cG", m_cflag ? 'C' : '.',
- m_vflag ? 'V' : '.',
- m_f ? '.' : 'Z',
- ( m_clkcnt & 3 ) ? 'B' : 'F');
+ m_vflag ? 'V' : '.',
+ m_f ? '.' : 'Z',
+ ( m_clkcnt & 3 ) ? 'B' : 'F');
break;
}
}
@@ -1551,4 +1551,3 @@ void cquestlin_cpu_device::execute_run()
m_clkcnt++;
} while (m_icount > 0);
}
-
diff --git a/src/emu/cpu/es5510/es5510.c b/src/emu/cpu/es5510/es5510.c
index 0786fcb36c0..1e6fbf6968c 100644
--- a/src/emu/cpu/es5510/es5510.c
+++ b/src/emu/cpu/es5510/es5510.c
@@ -168,7 +168,7 @@ es5510_device::es5510_device(const machine_config &mconfig, const char *tag, dev
instr_latch = 0;
ram_sel = 0;
host_control = 0;
-
+
pc = 0;
memset(&alu, 0, sizeof(alu));
memset(&mulacc, 0, sizeof(mulacc));
@@ -606,7 +606,7 @@ void es5510_device::list_program(void(p)(const char *, ...)) {
is_written[i] = is_read[i] = false;
name[i][0] = '\0';
}
-
+
for (addr = 0; addr < 0xa0; addr++) {
DESCRIBE_INSTR(buf, instr[addr], gpr[addr], NULL, NULL, NULL, NULL);
UINT64 inst = instr[addr];
@@ -621,7 +621,7 @@ void es5510_device::list_program(void(p)(const char *, ...)) {
}
UINT8 operandSelect = (UINT8)((inst >> 8) & 0x0f);
- const op_select_t &opSelect = OPERAND_SELECT[operandSelect];
+ const op_select_t &opSelect = OPERAND_SELECT[operandSelect];
if (opSelect.mac_src == SRC_DST_REG) {
is_read[cReg] = true;
@@ -630,7 +630,7 @@ void es5510_device::list_program(void(p)(const char *, ...)) {
if (opSelect.mac_dst != SRC_DST_DELAY) { // either REG or BOTH
is_written[cReg] = true;
}
-
+
alu_op_t aluOp = ALU_OPS[alu_op];
if (aluOp.operands == 1) {
if (opSelect.alu_src == SRC_DST_REG) {
@@ -663,7 +663,7 @@ void es5510_device::list_program(void(p)(const char *, ...)) {
for (int i = 0xc0; i < 0x100; i++) {
name[i][0] = 0;
}
-
+
for (addr = 0; addr < 0xa0; addr++) {
UINT8 aReg = (UINT8)((instr[addr] >> 16) & 0xff);
UINT8 bReg = (UINT8)((instr[addr] >> 24) & 0xff);
@@ -830,7 +830,7 @@ void es5510_device::execute_run() {
// *** T2, clock high
LOG_EXEC(("- T2.1\n"));
-
+
// --- Write ALU Result N-1
LOG_EXEC((". write ALU:\n"));
if (alu.write_result) {
diff --git a/src/emu/cpu/es5510/es5510.h b/src/emu/cpu/es5510/es5510.h
index 6e73e4e1542..974c8511705 100644
--- a/src/emu/cpu/es5510/es5510.h
+++ b/src/emu/cpu/es5510/es5510.h
@@ -152,8 +152,8 @@ private:
INT16 ser2l;
INT16 ser3r;
INT16 ser3l;
- INT64 machl; // 48 bits, right justified and sign extended
- bool mac_overflow; // whether reading the MAC register should return a saturated replacement value
+ INT64 machl; // 48 bits, right justified and sign extended
+ bool mac_overflow; // whether reading the MAC register should return a saturated replacement value
INT32 dil;
INT32 memsiz;
INT32 memmask;
@@ -165,8 +165,8 @@ private:
INT32 dbase;
INT32 sigreg;
int mulshift;
- INT8 ccr; // really, 5 bits, left justified
- INT8 cmr; // really, 6 bits, left justified
+ INT8 ccr; // really, 5 bits, left justified
+ INT8 cmr; // really, 6 bits, left justified
INT32 dol[2];
int dol_count;
diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c
index 00ca393bee4..c5c1dee0a0b 100644
--- a/src/emu/cpu/f8/f8.c
+++ b/src/emu/cpu/f8/f8.c
@@ -1601,7 +1601,7 @@ void f8_cpu_device::device_reset()
m_irq_vector = 0;
memset(m_r, 0, sizeof(m_r));
m_irq_request = 0;
-
+
m_w&=~I;
/* save PC0 to PC1 and reset PC0 */
@@ -2054,11 +2054,11 @@ void f8_cpu_device::state_string_export(const device_state_entry &entry, astring
{
case STATE_GENFLAGS:
string.printf("%c%c%c%c%c",
- m_w & 0x10 ? 'I':'.',
- m_w & 0x08 ? 'O':'.',
- m_w & 0x04 ? 'Z':'.',
- m_w & 0x02 ? 'C':'.',
- m_w & 0x01 ? 'S':'.');
+ m_w & 0x10 ? 'I':'.',
+ m_w & 0x08 ? 'O':'.',
+ m_w & 0x04 ? 'Z':'.',
+ m_w & 0x02 ? 'C':'.',
+ m_w & 0x01 ? 'S':'.');
break;
}
}
@@ -2075,5 +2075,3 @@ void f8_cpu_device::execute_set_input( int inptnum, int state )
{
m_irq_request = state;
}
-
-
diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c
index 64b2fa268e3..732a03cf349 100644
--- a/src/emu/cpu/i8085/i8085.c
+++ b/src/emu/cpu/i8085/i8085.c
@@ -1133,4 +1133,3 @@ offs_t i8085a_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT
extern CPU_DISASSEMBLE( i8085 );
return CPU_DISASSEMBLE_NAME(i8085)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/i8089/i8089.h b/src/emu/cpu/i8089/i8089.h
index c5d3d62a453..adcc945f765 100644
--- a/src/emu/cpu/i8089/i8089.h
+++ b/src/emu/cpu/i8089/i8089.h
@@ -121,14 +121,14 @@ private:
SOC,
DIVIDER1,
CH1_GA, CH1_GB, CH1_GC,
- CH1_TP, CH1_BC, CH1_IX,
- CH1_CC, CH1_MC, CH1_CP,
- CH1_PP, CH1_PSW,
+ CH1_TP, CH1_BC, CH1_IX,
+ CH1_CC, CH1_MC, CH1_CP,
+ CH1_PP, CH1_PSW,
DIVIDER2,
- CH2_GA, CH2_GB, CH2_GC,
- CH2_TP, CH2_BC, CH2_IX,
- CH2_CC, CH2_MC, CH2_CP,
- CH2_PP, CH2_PSW
+ CH2_GA, CH2_GB, CH2_GC,
+ CH2_TP, CH2_BC, CH2_IX,
+ CH2_CC, CH2_MC, CH2_CP,
+ CH2_PP, CH2_PSW
};
// system configuration
diff --git a/src/emu/cpu/i8089/i8089_channel.c b/src/emu/cpu/i8089/i8089_channel.c
index 8e9e2833b46..b8d93c7e0bf 100644
--- a/src/emu/cpu/i8089/i8089_channel.c
+++ b/src/emu/cpu/i8089/i8089_channel.c
@@ -19,16 +19,16 @@
#define VERBOSE_DMA 1
// channel control register fields
-#define CC_TMC ((m_r[CC].w >> 0) & 0x07) // terminate on masked compare
-#define CC_TBC ((m_r[CC].w >> 3) & 0x03) // terminate on byte count
-#define CC_TX ((m_r[CC].w >> 5) & 0x03) // terminate on external signal
-#define CC_TS ((m_r[CC].w >> 7) & 0x01) // terminate on single transfer
-#define CC_CHAIN ((m_r[CC].w >> 8) & 0x01) // chaining
-#define CC_LOCK ((m_r[CC].w >> 9) & 0x01) // actuate lock
-#define CC_SOURCE ((m_r[CC].w >> 10) & 0x01) // source register
-#define CC_SYNC ((m_r[CC].w >> 11) & 0x03) // synchronization
-#define CC_TRANS ((m_r[CC].w >> 13) & 0x01) // translation
-#define CC_FUNC ((m_r[CC].w >> 14) & 0x03) // function
+#define CC_TMC ((m_r[CC].w >> 0) & 0x07) // terminate on masked compare
+#define CC_TBC ((m_r[CC].w >> 3) & 0x03) // terminate on byte count
+#define CC_TX ((m_r[CC].w >> 5) & 0x03) // terminate on external signal
+#define CC_TS ((m_r[CC].w >> 7) & 0x01) // terminate on single transfer
+#define CC_CHAIN ((m_r[CC].w >> 8) & 0x01) // chaining
+#define CC_LOCK ((m_r[CC].w >> 9) & 0x01) // actuate lock
+#define CC_SOURCE ((m_r[CC].w >> 10) & 0x01) // source register
+#define CC_SYNC ((m_r[CC].w >> 11) & 0x03) // synchronization
+#define CC_TRANS ((m_r[CC].w >> 13) & 0x01) // translation
+#define CC_FUNC ((m_r[CC].w >> 14) & 0x03) // function
//**************************************************************************
diff --git a/src/emu/cpu/i8089/i8089_ops.c b/src/emu/cpu/i8089/i8089_ops.c
index 4ceff35ddc8..f65cae7986c 100644
--- a/src/emu/cpu/i8089/i8089_ops.c
+++ b/src/emu/cpu/i8089/i8089_ops.c
@@ -2,7 +2,7 @@
Intel 8089 I/O Processor
- Opcode implementations
+ Opcode implementations
***************************************************************************/
diff --git a/src/emu/cpu/i86/i186.c b/src/emu/cpu/i86/i186.c
index 5850c157330..a36b8bcfad2 100644
--- a/src/emu/cpu/i86/i186.c
+++ b/src/emu/cpu/i86/i186.c
@@ -1284,8 +1284,8 @@ void i80186_cpu_device::drq_callback(int which)
update_interrupt_state();
}
-// dma->finish_timer->adjust(attotime::from_hz(clock()/8), 0);
-// dma->drq_delay = true;
+// dma->finish_timer->adjust(attotime::from_hz(clock()/8), 0);
+// dma->drq_delay = true;
}
READ16_MEMBER(i80186_cpu_device::internal_port_r)
diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c
index efd37afe402..00b4df6be99 100644
--- a/src/emu/cpu/i86/i286.c
+++ b/src/emu/cpu/i86/i286.c
@@ -1956,4 +1956,3 @@ void i80286_cpu_device::check_permission(UINT8 check_seg, UINT32 offset, UINT16
throw TRAP(trap, 0);
}
}
-
diff --git a/src/emu/cpu/i86/i286.h b/src/emu/cpu/i86/i286.h
index f869c20ad4a..543f023fb50 100644
--- a/src/emu/cpu/i86/i286.h
+++ b/src/emu/cpu/i86/i286.h
@@ -7,7 +7,7 @@
extern const device_type I80286;
enum
-{ // same order as I8086 registers
+{ // same order as I8086 registers
I286_PC = 0,
I286_IP,
diff --git a/src/emu/cpu/i860/i860.c b/src/emu/cpu/i860/i860.c
index 0ea1be31177..f3aab4f7289 100644
--- a/src/emu/cpu/i860/i860.c
+++ b/src/emu/cpu/i860/i860.c
@@ -139,9 +139,9 @@ void i860_cpu_device::device_start()
void i860_cpu_device::state_import(const device_state_entry &entry)
{
#define I860_SET_INFO_F(fnum) m_frg[0+(4*fnum)] = (m_freg[fnum] & 0x000000ff); \
- m_frg[1+(4*fnum)] = (m_freg[fnum] & 0x0000ff00) >> 8; \
- m_frg[2+(4*fnum)] = (m_freg[fnum] & 0x00ff0000) >> 16; \
- m_frg[3+(4*fnum)] = (m_freg[fnum] & 0xff000000) >> 24;
+ m_frg[1+(4*fnum)] = (m_freg[fnum] & 0x0000ff00) >> 8; \
+ m_frg[2+(4*fnum)] = (m_freg[fnum] & 0x00ff0000) >> 16; \
+ m_frg[3+(4*fnum)] = (m_freg[fnum] & 0xff000000) >> 24;
switch (entry.index())
{
@@ -238,4 +238,3 @@ offs_t i860_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
* The actual decode and execute code.
**************************************************************************/
#include "i860dec.c"
-
diff --git a/src/emu/cpu/i860/i860dec.c b/src/emu/cpu/i860/i860dec.c
index 286e4a9f893..ac036a1f124 100644
--- a/src/emu/cpu/i860/i860dec.c
+++ b/src/emu/cpu/i860/i860dec.c
@@ -285,11 +285,11 @@ void i860_cpu_device::set_fregval_d (int fr, double d)
int i860_cpu_device::has_delay_slot(UINT32 insn)
{
- int opc = (insn >> 26) & 0x3f;
- if (opc == 0x10 || opc == 0x1a || opc == 0x1b || opc == 0x1d ||
- opc == 0x1f || opc == 0x2d || (opc == 0x13 && (insn & 3) == 2))
- return 1;
- return 0;
+ int opc = (insn >> 26) & 0x3f;
+ if (opc == 0x10 || opc == 0x1a || opc == 0x1b || opc == 0x1d ||
+ opc == 0x1f || opc == 0x2d || (opc == 0x13 && (insn & 3) == 2))
+ return 1;
+ return 0;
}
/* This is the external interface for asserting/deasserting pins on
diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c
index 05c9f768d38..b30f9dc865a 100644
--- a/src/emu/cpu/i960/i960.c
+++ b/src/emu/cpu/i960/i960.c
@@ -2077,7 +2077,6 @@ void i960_cpu_device::device_start()
void i960_cpu_device::state_string_export(const device_state_entry &entry, astring &string)
{
-
static const char *const conditions[8] =
{
"no", "g", "e", "ge", "l", "ne", "le", "o"
@@ -2116,4 +2115,3 @@ offs_t i960_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
extern CPU_DISASSEMBLE( i960 );
return CPU_DISASSEMBLE_NAME(i960)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c
index 3ac6d1fffe2..44a24f78b8d 100644
--- a/src/emu/cpu/jaguar/jaguar.c
+++ b/src/emu/cpu/jaguar/jaguar.c
@@ -416,7 +416,7 @@ void jaguar_cpu_device::state_string_export(const device_state_entry &entry, ast
FLAGS & 0x0008 ? 'I':'.',
FLAGS & 0x0004 ? 'N':'.',
FLAGS & 0x0002 ? 'C':'.',
- FLAGS & 0x0001 ? 'Z':'.');
+ FLAGS & 0x0001 ? 'Z':'.');
break;
}
}
@@ -1447,4 +1447,3 @@ offs_t jaguardsp_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const U
extern CPU_DISASSEMBLE( jaguardsp );
return CPU_DISASSEMBLE_NAME(jaguardsp)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/lh5801/lh5801.c b/src/emu/cpu/lh5801/lh5801.c
index 5c2151dbc87..bfaf8c7ec79 100644
--- a/src/emu/cpu/lh5801/lh5801.c
+++ b/src/emu/cpu/lh5801/lh5801.c
@@ -264,4 +264,3 @@ offs_t lh5801_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT
extern CPU_DISASSEMBLE( lh5801 );
return CPU_DISASSEMBLE_NAME(lh5801)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/m37710/m37710.h b/src/emu/cpu/m37710/m37710.h
index 32f33a81067..1aa492f99cb 100644
--- a/src/emu/cpu/m37710/m37710.h
+++ b/src/emu/cpu/m37710/m37710.h
@@ -161,7 +161,7 @@ private:
address_space *m_program;
address_space *m_io;
UINT32 m_stopped; /* Sets how the CPU is stopped */
-
+
// on-board peripheral stuff
UINT8 m_m37710_regs[128];
attotime m_reload[8];
diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c
index 1c5ad8e2598..aed01bf45c3 100644
--- a/src/emu/cpu/m6800/m6800.c
+++ b/src/emu/cpu/m6800/m6800.c
@@ -1708,17 +1708,17 @@ WRITE8_MEMBER( m6800_cpu_device::m6801_io_w )
}
}
-void m6801_cpu_device::m6801_clock_serial()
-{
+void m6801_cpu_device::m6801_clock_serial()
+{
if (m_use_ext_serclock)
{
- m_ext_serclock++;
+ m_ext_serclock++;
if (m_ext_serclock >= 8)
- {
- m_ext_serclock = 0;
- serial_transmit();
- serial_receive();
+ {
+ m_ext_serclock = 0;
+ serial_transmit();
+ serial_receive();
}
}
}
@@ -1777,4 +1777,3 @@ offs_t nsc8105_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UIN
extern CPU_DISASSEMBLE( nsc8105 );
return CPU_DISASSEMBLE_NAME(nsc8105)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/m6800/m6800.h b/src/emu/cpu/m6800/m6800.h
index 6560f738e99..d5d790e0151 100644
--- a/src/emu/cpu/m6800/m6800.h
+++ b/src/emu/cpu/m6800/m6800.h
@@ -139,7 +139,7 @@ protected:
int m_clock_divider;
UINT8 m_trcsr, m_rmcr, m_rdr, m_tdr, m_rsr, m_tsr;
int m_rxbits, m_txbits, m_txstate, m_trcsr_read_tdre, m_trcsr_read_orfe, m_trcsr_read_rdrf, m_tx, m_ext_serclock;
- bool m_use_ext_serclock;
+ bool m_use_ext_serclock;
int m_port2_written;
int m_icount;
diff --git a/src/emu/cpu/m68000/m68k_in.c b/src/emu/cpu/m68000/m68k_in.c
index 793137fa1e7..19af7dde3c9 100644
--- a/src/emu/cpu/m68000/m68k_in.c
+++ b/src/emu/cpu/m68000/m68k_in.c
@@ -3897,9 +3897,9 @@ M68KMAKE_OP(clr, 8, ., .)
{
UINT32 ea = M68KMAKE_GET_EA_AY_8;
- if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type))
+ if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type))
{
- m68ki_read_8((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */
+ m68ki_read_8((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */
}
m68ki_write_8((mc68kcpu), ea, 0);
@@ -3926,9 +3926,9 @@ M68KMAKE_OP(clr, 16, ., .)
{
UINT32 ea = M68KMAKE_GET_EA_AY_16;
- if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type))
+ if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type))
{
- m68ki_read_16((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */
+ m68ki_read_16((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */
}
m68ki_write_16((mc68kcpu), ea, 0);
@@ -3955,9 +3955,9 @@ M68KMAKE_OP(clr, 32, ., .)
{
UINT32 ea = M68KMAKE_GET_EA_AY_32;
- if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type))
+ if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type))
{
- m68ki_read_32((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */
+ m68ki_read_32((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */
}
m68ki_write_32((mc68kcpu), ea, 0);
diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c
index 67e2d388330..f1a4738d1e4 100644
--- a/src/emu/cpu/mb86233/mb86233.c
+++ b/src/emu/cpu/mb86233/mb86233.c
@@ -96,7 +96,7 @@ void mb86233_cpu_device::device_start()
m_fifo_read_cb.resolve_safe(0);
m_fifo_read_ok_cb.resolve_safe(0);
m_fifo_write_cb.resolve_safe();
-
+
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();
@@ -1582,4 +1582,3 @@ void mb86233_cpu_device::execute_run()
}
}
}
-
diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c
index 44a8393a71c..d613c7a989e 100644
--- a/src/emu/cpu/mb88xx/mb88xx.c
+++ b/src/emu/cpu/mb88xx/mb88xx.c
@@ -114,25 +114,25 @@ mb88_cpu_device::mb88_cpu_device(const machine_config &mconfig, device_type type
mb8841_cpu_device::mb8841_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : mb88_cpu_device(mconfig, MB8841, "MB8841", tag, owner, clock, "mb8841", __FILE__, 11, 7)
+ : mb88_cpu_device(mconfig, MB8841, "MB8841", tag, owner, clock, "mb8841", __FILE__, 11, 7)
{
}
mb8842_cpu_device::mb8842_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : mb88_cpu_device(mconfig, MB8842, "MB8842", tag, owner, clock, "mb8842", __FILE__, 11, 7)
+ : mb88_cpu_device(mconfig, MB8842, "MB8842", tag, owner, clock, "mb8842", __FILE__, 11, 7)
{
}
mb8843_cpu_device::mb8843_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : mb88_cpu_device(mconfig, MB8843, "MB8843", tag, owner, clock, "mb8843", __FILE__, 10, 6)
+ : mb88_cpu_device(mconfig, MB8843, "MB8843", tag, owner, clock, "mb8843", __FILE__, 10, 6)
{
}
mb8844_cpu_device::mb8844_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : mb88_cpu_device(mconfig, MB8844, "MB8844", tag, owner, clock, "mb8844", __FILE__, 10, 6)
+ : mb88_cpu_device(mconfig, MB8844, "MB8844", tag, owner, clock, "mb8844", __FILE__, 10, 6)
{
}
@@ -946,4 +946,3 @@ void mb88_cpu_device::execute_run()
update_pio(oc);
}
}
-
diff --git a/src/emu/cpu/mb88xx/mb88xx.h b/src/emu/cpu/mb88xx/mb88xx.h
index 3e0103b1c5c..254df96f266 100644
--- a/src/emu/cpu/mb88xx/mb88xx.h
+++ b/src/emu/cpu/mb88xx/mb88xx.h
@@ -158,32 +158,32 @@ private:
class mb8841_cpu_device : public mb88_cpu_device
{
public:
- // construction/destruction
- mb8841_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ // construction/destruction
+ mb8841_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class mb8842_cpu_device : public mb88_cpu_device
{
public:
- // construction/destruction
- mb8842_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ // construction/destruction
+ mb8842_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class mb8843_cpu_device : public mb88_cpu_device
{
public:
- // construction/destruction
- mb8843_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ // construction/destruction
+ mb8843_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class mb8844_cpu_device : public mb88_cpu_device
{
public:
- // construction/destruction
- mb8844_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ // construction/destruction
+ mb8844_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c
index 4ed5b4e76af..243157eeb19 100644
--- a/src/emu/cpu/mc68hc11/mc68hc11.c
+++ b/src/emu/cpu/mc68hc11/mc68hc11.c
@@ -595,4 +595,3 @@ void mc68hc11_cpu_device::execute_run()
(this->*hc11_optable[op])();
}
}
-
diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c
index ce3783120f4..36156cbf7b0 100644
--- a/src/emu/cpu/mcs48/mcs48.c
+++ b/src/emu/cpu/mcs48/mcs48.c
@@ -1330,4 +1330,3 @@ void mcs48_cpu_device::execute_set_input(int inputnum, int state)
break;
}
}
-
diff --git a/src/emu/cpu/mcs48/mcs48.h b/src/emu/cpu/mcs48/mcs48.h
index b95ea95b405..c1d19bc6c30 100644
--- a/src/emu/cpu/mcs48/mcs48.h
+++ b/src/emu/cpu/mcs48/mcs48.h
@@ -484,9 +484,9 @@ public:
i8021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
- // device_execute_interface overrides
- virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 30 - 1) / 30; }
- virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 30); }
+ // device_execute_interface overrides
+ virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 30 - 1) / 30; }
+ virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 30); }
};
class i8022_device : public mcs48_cpu_device
@@ -496,9 +496,9 @@ public:
i8022_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
- // device_execute_interface overrides
- virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 30 - 1) / 30; }
- virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 30); }
+ // device_execute_interface overrides
+ virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 30 - 1) / 30; }
+ virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 30); }
};
class i8035_device : public mcs48_cpu_device
diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c
index 69369cbc8af..fc6bee9cfd7 100644
--- a/src/emu/cpu/mcs51/mcs51.c
+++ b/src/emu/cpu/mcs51/mcs51.c
@@ -2506,4 +2506,3 @@ offs_t ds5002fp_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
extern CPU_DISASSEMBLE( ds5002fp );
return CPU_DISASSEMBLE_NAME(ds5002fp)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/minx/minx.c b/src/emu/cpu/minx/minx.c
index 6c02873a54b..f33dcadc26a 100644
--- a/src/emu/cpu/minx/minx.c
+++ b/src/emu/cpu/minx/minx.c
@@ -236,4 +236,3 @@ offs_t minx_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
extern CPU_DISASSEMBLE( minx );
return CPU_DISASSEMBLE_NAME(minx)(this, buffer, pc, oprom, opram, options);
}
-
diff --git a/src/emu/cpu/minx/minx.h b/src/emu/cpu/minx/minx.h
index 34d61dcd519..90217e973ac 100644
--- a/src/emu/cpu/minx/minx.h
+++ b/src/emu/cpu/minx/minx.h
@@ -880,8 +880,8 @@ private:
static const op_func insnminx_CE[256];
static const int insnminx_cycles_CE[256];
- static const op_func insnminx_CF[256];
- static const int insnminx_cycles_CF[256];
+ static const op_func insnminx_CF[256];
+ static const int insnminx_cycles_CF[256];
};
diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c
index bc0bb9c485d..f226b4c924f 100644
--- a/src/emu/cpu/mips/mips3drc.c
+++ b/src/emu/cpu/mips/mips3drc.c
@@ -3934,7 +3934,7 @@ CPU_GET_INFO( r4700le_drc )
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "R4700 (little) DRC"); break;
case CPUINFO_STR_SHORTNAME: strcpy(info->s, "r4700le_drc"); break;
-
+
/* --- everything else is handled generically --- */
default: CPU_GET_INFO_CALL(mips3); break;
}
@@ -4124,4 +4124,3 @@ DEFINE_LEGACY_CPU_DEVICE(QED5271LE_DRC, qed5271le_drc);
DEFINE_LEGACY_CPU_DEVICE(RM7000BE_DRC, rm7000be_drc);
DEFINE_LEGACY_CPU_DEVICE(RM7000LE_DRC, rm7000le_drc);
-
diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c
index 33cbeabc7ef..662183241d4 100644
--- a/src/emu/cpu/mn10200/mn10200.c
+++ b/src/emu/cpu/mn10200/mn10200.c
@@ -2436,5 +2436,3 @@ offs_t mn10200_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *
extern CPU_DISASSEMBLE( mn10200 );
return CPU_DISASSEMBLE_NAME(mn10200)(this, buffer, pc, oprom, opram, options);
}
-
-
diff --git a/src/emu/cpu/nec/v25.c b/src/emu/cpu/nec/v25.c
index 5ccb57fdfd0..e302dccc0ca 100644
--- a/src/emu/cpu/nec/v25.c
+++ b/src/emu/cpu/nec/v25.c
@@ -711,7 +711,7 @@ static CPU_GET_INFO( v25v35 )
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &nec_state->icount; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case CPUINFO_STR_NAME: strcpy(info->s, "NEC"); break;
+ case CPUINFO_STR_NAME: strcpy(info->s, "NEC"); break;
case CPUINFO_STR_FAMILY: strcpy(info->s, "NEC V-Series"); break;
case CPUINFO_STR_VERSION: strcpy(info->s, "2.0"); break;
case CPUINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c
index 3ab526f9a28..6dca0b2fe20 100644
--- a/src/emu/cpu/pic16c5x/pic16c5x.c
+++ b/src/emu/cpu/pic16c5x/pic16c5x.c
@@ -703,78 +703,78 @@ void pic16c5x_device::xorwf()
const pic16c5x_device::pic16c5x_opcode pic16c5x_device::s_opcode_main[256]=
{
/*00*/ {1, &pic16c5x_device::nop },{0, &pic16c5x_device::illegal },{1, &pic16c5x_device::movwf },{1, &pic16c5x_device::movwf },
- {1, &pic16c5x_device::clrw },{0, &pic16c5x_device::illegal },{1, &pic16c5x_device::clrf },{1, &pic16c5x_device::clrf },
+ {1, &pic16c5x_device::clrw },{0, &pic16c5x_device::illegal },{1, &pic16c5x_device::clrf },{1, &pic16c5x_device::clrf },
/*08*/ {1, &pic16c5x_device::subwf },{1, &pic16c5x_device::subwf },{1, &pic16c5x_device::subwf },{1, &pic16c5x_device::subwf },
- {1, &pic16c5x_device::decf },{1, &pic16c5x_device::decf },{1, &pic16c5x_device::decf },{1, &pic16c5x_device::decf },
+ {1, &pic16c5x_device::decf },{1, &pic16c5x_device::decf },{1, &pic16c5x_device::decf },{1, &pic16c5x_device::decf },
/*10*/ {1, &pic16c5x_device::iorwf },{1, &pic16c5x_device::iorwf },{1, &pic16c5x_device::iorwf },{1, &pic16c5x_device::iorwf },
- {1, &pic16c5x_device::andwf },{1, &pic16c5x_device::andwf },{1, &pic16c5x_device::andwf },{1, &pic16c5x_device::andwf },
+ {1, &pic16c5x_device::andwf },{1, &pic16c5x_device::andwf },{1, &pic16c5x_device::andwf },{1, &pic16c5x_device::andwf },
/*18*/ {1, &pic16c5x_device::xorwf },{1, &pic16c5x_device::xorwf },{1, &pic16c5x_device::xorwf },{1, &pic16c5x_device::xorwf },
- {1, &pic16c5x_device::addwf },{1, &pic16c5x_device::addwf },{1, &pic16c5x_device::addwf },{1, &pic16c5x_device::addwf },
+ {1, &pic16c5x_device::addwf },{1, &pic16c5x_device::addwf },{1, &pic16c5x_device::addwf },{1, &pic16c5x_device::addwf },
/*20*/ {1, &pic16c5x_device::movf },{1, &pic16c5x_device::movf },{1, &pic16c5x_device::movf },{1, &pic16c5x_device::movf },
- {1, &pic16c5x_device::comf },{1, &pic16c5x_device::comf },{1, &pic16c5x_device::comf },{1, &pic16c5x_device::comf },
+ {1, &pic16c5x_device::comf },{1, &pic16c5x_device::comf },{1, &pic16c5x_device::comf },{1, &pic16c5x_device::comf },
/*28*/ {1, &pic16c5x_device::incf },{1, &pic16c5x_device::incf },{1, &pic16c5x_device::incf },{1, &pic16c5x_device::incf },
- {1, &pic16c5x_device::decfsz },{1, &pic16c5x_device::decfsz },{1, &pic16c5x_device::decfsz },{1, &pic16c5x_device::decfsz },
+ {1, &pic16c5x_device::decfsz },{1, &pic16c5x_device::decfsz },{1, &pic16c5x_device::decfsz },{1, &pic16c5x_device::decfsz },
/*30*/ {1, &pic16c5x_device::rrf },{1, &pic16c5x_device::rrf },{1, &pic16c5x_device::rrf },{1, &pic16c5x_device::rrf },
- {1, &pic16c5x_device::rlf },{1, &pic16c5x_device::rlf },{1, &pic16c5x_device::rlf },{1, &pic16c5x_device::rlf },
+ {1, &pic16c5x_device::rlf },{1, &pic16c5x_device::rlf },{1, &pic16c5x_device::rlf },{1, &pic16c5x_device::rlf },
/*38*/ {1, &pic16c5x_device::swapf },{1, &pic16c5x_device::swapf },{1, &pic16c5x_device::swapf },{1, &pic16c5x_device::swapf },
- {1, &pic16c5x_device::incfsz },{1, &pic16c5x_device::incfsz },{1, &pic16c5x_device::incfsz },{1, &pic16c5x_device::incfsz },
+ {1, &pic16c5x_device::incfsz },{1, &pic16c5x_device::incfsz },{1, &pic16c5x_device::incfsz },{1, &pic16c5x_device::incfsz },
/*40*/ {1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },
- {1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },
+ {1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },
/*48*/ {1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },
- {1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },
+ {1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },{1, &pic16c5x_device::bcf },
/*50*/ {1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },
- {1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },
+ {1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },
/*58*/ {1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },
- {1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },
+ {1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },{1, &pic16c5x_device::bsf },
/*60*/ {1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },
- {1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },
+ {1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },
/*68*/ {1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },
- {1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },
+ {1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },{1, &pic16c5x_device::btfsc },
/*70*/ {1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },
- {1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },
+ {1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },
/*78*/ {1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },
- {1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },
+ {1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },{1, &pic16c5x_device::btfss },
/*80*/ {2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },
- {2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },
+ {2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },
/*88*/ {2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },
- {2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },
+ {2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },{2, &pic16c5x_device::retlw },
/*90*/ {2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },
- {2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },
+ {2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },
/*98*/ {2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },
- {2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },
+ {2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },{2, &pic16c5x_device::call },
/*A0*/ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
- {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
+ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
/*A8*/ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
- {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
+ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
/*B0*/ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
- {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
+ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
/*B8*/ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
- {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
+ {2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },{2, &pic16c5x_device::goto_op },
/*C0*/ {1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },
- {1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },
+ {1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },
/*C8*/ {1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },
- {1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },
+ {1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },{1, &pic16c5x_device::movlw },
/*D0*/ {1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },
- {1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },
+ {1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },
/*D8*/ {1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },
- {1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },
+ {1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },{1, &pic16c5x_device::iorlw },
/*E0*/ {1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },
- {1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },
+ {1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },
/*E8*/ {1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },
- {1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },
+ {1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },{1, &pic16c5x_device::andlw },
/*F0*/ {1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },
- {1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },
+ {1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },
/*F8*/ {1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },
- {1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw }
+ {1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw },{1, &pic16c5x_device::xorlw }
};
const pic16c5x_device::pic16c5x_opcode pic16c5x_device::s_opcode_00x[16]=
{
/*00*/ {1, &pic16c5x_device::nop },{0, &pic16c5x_device::illegal },{1, &pic16c5x_device::option },{1, &pic16c5x_device::sleepic },
- {1, &pic16c5x_device::clrwdt },{1, &pic16c5x_device::tris },{1, &pic16c5x_device::tris },{1, &pic16c5x_device::tris },
+ {1, &pic16c5x_device::clrwdt },{1, &pic16c5x_device::tris },{1, &pic16c5x_device::tris },{1, &pic16c5x_device::tris },
/*08*/ {0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },
- {0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal }
+ {0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal },{0, &pic16c5x_device::illegal }
};
@@ -1102,4 +1102,3 @@ void pic16c5x_device::execute_run()
} while (m_icount > 0);
}
-
diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c
index 37ed67b3703..6a4c239e2fb 100644
--- a/src/emu/cpu/pic16c62x/pic16c62x.c
+++ b/src/emu/cpu/pic16c62x/pic16c62x.c
@@ -1176,4 +1176,3 @@ void pic16c62x_device::device_reset()
pic16c62x_reset_regs();
SET(STATUS, (TO_FLAG | PD_FLAG));
}
-
diff --git a/src/emu/cpu/pic16c62x/pic16c62x.h b/src/emu/cpu/pic16c62x/pic16c62x.h
index 4e2e1ab3e89..a0e924b19de 100644
--- a/src/emu/cpu/pic16c62x/pic16c62x.h
+++ b/src/emu/cpu/pic16c62x/pic16c62x.h
@@ -227,8 +227,8 @@ public:
class pic16cr620a_device : public pic16c62x_device
{
public:
- // construction/destruction
- pic16cr620a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ // construction/destruction
+ pic16cr620a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
}*/;
class pic16c621_device : public pic16c62x_device
diff --git a/src/emu/cpu/pps4/pps4.c b/src/emu/cpu/pps4/pps4.c
index 3379dd2d413..84ace009839 100644
--- a/src/emu/cpu/pps4/pps4.c
+++ b/src/emu/cpu/pps4/pps4.c
@@ -367,4 +367,3 @@ void pps4_device::device_reset()
m_SB.d = 0;
m_B.d = 0;
}
-
diff --git a/src/emu/cpu/psx/rcnt.h b/src/emu/cpu/psx/rcnt.h
index d1477a91e5c..336109dd5d9 100644
--- a/src/emu/cpu/psx/rcnt.h
+++ b/src/emu/cpu/psx/rcnt.h
@@ -65,7 +65,7 @@ private:
UINT16 root_current( int n_counter );
int root_target( int n_counter );
void root_timer_adjust( int n_counter );
-
+
devcb2_write_line m_irq0_handler;
devcb2_write_line m_irq1_handler;
devcb2_write_line m_irq2_handler;
diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c
index 479d10d3786..eaa62b8d124 100644
--- a/src/emu/cpu/rsp/rspdrc.c
+++ b/src/emu/cpu/rsp/rspdrc.c
@@ -6167,4 +6167,3 @@ CPU_GET_INFO( rsp_drc )
}
DEFINE_LEGACY_CPU_DEVICE(RSP_DRC, rsp_drc);
-
diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c
index a0ad6bc71c7..64b71fc4e0a 100644
--- a/src/emu/cpu/s2650/s2650.c
+++ b/src/emu/cpu/s2650/s2650.c
@@ -1564,4 +1564,3 @@ void s2650_device::execute_run()
}
} while( m_icount > 0 );
}
-
diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c
index d90363c0f83..e866a83e910 100644
--- a/src/emu/cpu/sh2/sh2comn.c
+++ b/src/emu/cpu/sh2/sh2comn.c
@@ -17,11 +17,11 @@
INLINE sh2_state *GET_SH2(device_t *dev)
{
- if (dev->machine().options().drc()) {
+ if (dev->machine().options().drc()) {
return *(sh2_state **)downcast<legacy_cpu_device *>(dev)->token();
- } else {
+ } else {
return (sh2_state *)downcast<legacy_cpu_device *>(dev)->token();
- }
+ }
}
static const int div_tab[4] = { 3, 5, 7, 0 };
@@ -844,7 +844,7 @@ void sh2_set_irq_line(sh2_state *sh2, int irqline, int state)
sh2_exception(sh2, "Set IRQ line", 16);
if (sh2->isdrc)
- sh2->pending_nmi = 1;
+ sh2->pending_nmi = 1;
}
}
else
diff --git a/src/emu/cpu/sh2/sh2comn.h b/src/emu/cpu/sh2/sh2comn.h
index 64cadf3b965..6a1218ae2b5 100644
--- a/src/emu/cpu/sh2/sh2comn.h
+++ b/src/emu/cpu/sh2/sh2comn.h
@@ -117,7 +117,7 @@ struct sh2_state
UINT32 irqsr; // IRQ-time old SR for DRC
UINT32 target; // target for jmp/jsr/etc so the delay slot can't kill it
irq_entry irq_queue[16];
-
+
bool isdrc;
int pcfsel; // last pcflush entry set
diff --git a/src/emu/cpu/sh2/sh2fe.c b/src/emu/cpu/sh2/sh2fe.c
index e5981966ca6..688b729c8ff 100644
--- a/src/emu/cpu/sh2/sh2fe.c
+++ b/src/emu/cpu/sh2/sh2fe.c
@@ -760,4 +760,3 @@ bool sh2_frontend::describe_group_12(opcode_desc &desc, const opcode_desc *prev,
return false;
}
-
diff --git a/src/emu/cpu/tlcs900/tlcs900.c b/src/emu/cpu/tlcs900/tlcs900.c
index db55b567bc9..ac9f4e09f56 100644
--- a/src/emu/cpu/tlcs900/tlcs900.c
+++ b/src/emu/cpu/tlcs900/tlcs900.c
@@ -2168,4 +2168,3 @@ void tmp95c063_device::execute_set_input(int input, int level)
}
m_check_irqs = 1;
}
-
diff --git a/src/emu/cpu/tms32082/dis_mp.c b/src/emu/cpu/tms32082/dis_mp.c
index 6c50536ce0a..0bcb5a79788 100644
--- a/src/emu/cpu/tms32082/dis_mp.c
+++ b/src/emu/cpu/tms32082/dis_mp.c
@@ -16,10 +16,10 @@ static const char *BCND_CONDITION[32] =
static const char *BITNUM_CONDITION[32] =
{
- "eq.b", "ne.b", "gt.b", "le.b", "lt.b", "ge.b", "hi.b", "ls.b",
- "lo.b", "hs.b", "eq.h", "ne.h", "gt.h", "le.h", "lt.h", "ge.h",
- "hi.h", "ls.h", "lo.h", "hs.h", "eq.w", "ne.w", "gt.w", "le.w",
- "lt.w", "ge.w", "hi.w", "ls.w", "lo.w", "hs.w", "?", "?",
+ "eq.b", "ne.b", "gt.b", "le.b", "lt.b", "ge.b", "hi.b", "ls.b",
+ "lo.b", "hs.b", "eq.h", "ne.h", "gt.h", "le.h", "lt.h", "ge.h",
+ "hi.h", "ls.h", "lo.h", "hs.h", "eq.w", "ne.w", "gt.w", "le.w",
+ "lt.w", "ge.w", "hi.w", "ls.w", "lo.w", "hs.w", "?", "?",
};
static const char *MEMOP_S[2] =
@@ -156,8 +156,8 @@ static char* format_vector_op(UINT32 op, UINT32 imm32)
b += sprintf(b, "vrnd.%s%s 0x%08X, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[pd4], imm32, rs);
break;
- case 0xca: b += sprintf(b, "vrnd.%s%s R%d, R%d", FLOATOP_PRECISION[2 + p1], FLOATOP_PRECISION[pd2],src1, rs); break;
- case 0xcb: b += sprintf(b, "vrnd.%s%s 0x%08X, R%d", FLOATOP_PRECISION[2 + p1], FLOATOP_PRECISION[pd2], imm32, rs); break;
+ case 0xca: b += sprintf(b, "vrnd.%s%s R%d, R%d", FLOATOP_PRECISION[2 + p1], FLOATOP_PRECISION[pd2],src1, rs); break;
+ case 0xcb: b += sprintf(b, "vrnd.%s%s 0x%08X, R%d", FLOATOP_PRECISION[2 + p1], FLOATOP_PRECISION[pd2], imm32, rs); break;
case 0xcc: case 0xdc:
b += sprintf(b, "vmac.ss%s R%d, R%d, %s, %s", FLOATOP_PRECISION[(op >> 9) & 1], src1, rs, z ? "0" : ACC_SEL[acc], (regdest && rd == 0) ? ACC_SEL[acc] : dest);
@@ -172,7 +172,7 @@ static char* format_vector_op(UINT32 op, UINT32 imm32)
b += sprintf(b, "vmsc.ss%s 0x%08X, R%d, %s, %s", FLOATOP_PRECISION[(op >> 9) & 1], imm32, rs, z ? "0" : ACC_SEL[acc], (regdest && rd == 0) ? ACC_SEL[acc] : dest);
break;
- default: b += sprintf(b, "?"); break;
+ default: b += sprintf(b, "?"); break;
}
// align the line end
@@ -183,17 +183,17 @@ static char* format_vector_op(UINT32 op, UINT32 imm32)
{
b += sprintf(b, " ");
}
- }
+ }
// optional load/store op
switch (vector_ls_bits)
{
- case 0x01: b += sprintf(b, "|| vst.s R%d", rd); break;
- case 0x03: b += sprintf(b, "|| vst.d R%d", rd); break;
- case 0x04: b += sprintf(b, "|| vld0.s R%d", rd); break;
- case 0x05: b += sprintf(b, "|| vld1.s R%d", rd); break;
- case 0x06: b += sprintf(b, "|| vld0.d R%d", rd); break;
- case 0x07: b += sprintf(b, "|| vld1.d R%d", rd); break;
+ case 0x01: b += sprintf(b, "|| vst.s R%d", rd); break;
+ case 0x03: b += sprintf(b, "|| vst.d R%d", rd); break;
+ case 0x04: b += sprintf(b, "|| vld0.s R%d", rd); break;
+ case 0x05: b += sprintf(b, "|| vld1.s R%d", rd); break;
+ case 0x06: b += sprintf(b, "|| vld0.d R%d", rd); break;
+ case 0x07: b += sprintf(b, "|| vld1.d R%d", rd); break;
}
return buffer;
@@ -226,30 +226,30 @@ static offs_t tms32082_disasm_mp(char *buffer, offs_t pc, const UINT8 *oprom)
switch (subop)
{
- case 0x00: print("illop0 "); break;
- case 0x01: print("trap %d", UIMM15(uimm15)); break;
- case 0x02: print("cmnd 0x%04X", UIMM15(uimm15)); break;
- case 0x04: print("rdcr %s, R%d", get_creg_name(UIMM15(uimm15)), rd); break;
- case 0x05: print("swcr R%d, %s, R%d", rd, get_creg_name(UIMM15(uimm15)), rs); break;
- case 0x06: print("brcr %s", get_creg_name(UIMM15(uimm15))); break;
- case 0x08: print("shift%s.dz %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x09: print("shift%s.dm %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x0a: print("shift%s.ds %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x0b: print("shift%s.ez %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x0c: print("shift%s.em %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x0d: print("shift%s.es %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x0e: print("shift%s.iz %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x0f: print("shift%s.im %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
- case 0x11: print("and 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x12: print("and.tf 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x14: print("and.ft 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x16: print("xor 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x17: print("or 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x18: print("and.ff 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x19: print("xnor 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x1b: print("or.tf 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x1d: print("or.ft 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
- case 0x1e: print("or.ff 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x00: print("illop0 "); break;
+ case 0x01: print("trap %d", UIMM15(uimm15)); break;
+ case 0x02: print("cmnd 0x%04X", UIMM15(uimm15)); break;
+ case 0x04: print("rdcr %s, R%d", get_creg_name(UIMM15(uimm15)), rd); break;
+ case 0x05: print("swcr R%d, %s, R%d", rd, get_creg_name(UIMM15(uimm15)), rs); break;
+ case 0x06: print("brcr %s", get_creg_name(UIMM15(uimm15))); break;
+ case 0x08: print("shift%s.dz %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x09: print("shift%s.dm %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x0a: print("shift%s.ds %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x0b: print("shift%s.ez %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x0c: print("shift%s.em %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x0d: print("shift%s.es %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x0e: print("shift%s.iz %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x0f: print("shift%s.im %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
+ case 0x11: print("and 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x12: print("and.tf 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x14: print("and.ft 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x16: print("xor 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x17: print("or 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x18: print("and.ff 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x19: print("xnor 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x1b: print("or.tf 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x1d: print("or.ft 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
+ case 0x1e: print("or.ff 0x%04X, R%d, R%d", UIMM15(uimm15), rs, rd); break;
case 0x24: case 0x20:
print("ld.b 0x%04X(R%d%s), R%d", UIMM15(uimm15), rs, MEMOP_M[m], rd);
@@ -283,23 +283,23 @@ static offs_t tms32082_disasm_mp(char *buffer, offs_t pc, const UINT8 *oprom)
print("st.d R%d, 0x%04X(R%d%s)", rd, UIMM15(uimm15), rs, MEMOP_M[m]);
break;
- case 0x40: print("bsr 0x%08X, R%d", pc + (SIMM15(uimm15) * 4), link); break;
- case 0x41: print("bsr.a 0x%08X, R%d", pc + (SIMM15(uimm15) * 4), link); break;
- case 0x44: print("jsr 0x%04X(R%d), R%d", SIMM15(uimm15), rs, link); break;
- case 0x45: print("jsr.a 0x%04X(R%d), R%d", SIMM15(uimm15), rs, link); break;
- case 0x48: print("bbz 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x49: print("bbz.a 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x4a: print("bbo 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x4b: print("bbo.a 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x4c: print("bcnd 0x%08X, R%d, %s", pc + (SIMM15(uimm15) * 4), rs, BCND_CONDITION[rd]); break;
- case 0x4d: print("bcnd.a 0x%08X, R%d, %s", pc + (SIMM15(uimm15) * 4), rs, BCND_CONDITION[rd]); break;
- case 0x50: print("cmp 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
- case 0x58: print("add 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
- case 0x59: print("addu 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
- case 0x5a: print("sub 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
- case 0x5b: print("subu 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
-
- default: print("?"); break;
+ case 0x40: print("bsr 0x%08X, R%d", pc + (SIMM15(uimm15) * 4), link); break;
+ case 0x41: print("bsr.a 0x%08X, R%d", pc + (SIMM15(uimm15) * 4), link); break;
+ case 0x44: print("jsr 0x%04X(R%d), R%d", SIMM15(uimm15), rs, link); break;
+ case 0x45: print("jsr.a 0x%04X(R%d), R%d", SIMM15(uimm15), rs, link); break;
+ case 0x48: print("bbz 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x49: print("bbz.a 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x4a: print("bbo 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x4b: print("bbo.a 0x%08X, R%d, %s (%d)", pc + (SIMM15(uimm15) * 4), rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x4c: print("bcnd 0x%08X, R%d, %s", pc + (SIMM15(uimm15) * 4), rs, BCND_CONDITION[rd]); break;
+ case 0x4d: print("bcnd.a 0x%08X, R%d, %s", pc + (SIMM15(uimm15) * 4), rs, BCND_CONDITION[rd]); break;
+ case 0x50: print("cmp 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
+ case 0x58: print("add 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
+ case 0x59: print("addu 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
+ case 0x5a: print("sub 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
+ case 0x5b: print("subu 0x%08X, R%d, R%d", SIMM15(uimm15), rs, rd); break;
+
+ default: print("?"); break;
}
break;
}
@@ -324,16 +324,16 @@ static offs_t tms32082_disasm_mp(char *buffer, offs_t pc, const UINT8 *oprom)
switch (subop)
{
- case 0x02: print("trap %d", src1); break;
- case 0x03: print("trap %d", imm32); break;
- case 0x04: print("cmnd R%d", src1); break;
- case 0x05: print("cmnd 0x%08X", imm32); break;
- case 0x08: print("rdcr R%d, R%d,", src1, rd); break;
- case 0x09: print("rdcr %s, R%d", get_creg_name(imm32), rd); break;
- case 0x0a: print("swcr R%d, R%d, R%d", rd, src1, rs); break;
- case 0x0b: print("swcr R%d, %s, R%d", rd, get_creg_name(imm32), rs); break;
- case 0x0c: print("brcr R%d", src1); break;
- case 0x0d: print("brcr %s", get_creg_name(imm32)); break;
+ case 0x02: print("trap %d", src1); break;
+ case 0x03: print("trap %d", imm32); break;
+ case 0x04: print("cmnd R%d", src1); break;
+ case 0x05: print("cmnd 0x%08X", imm32); break;
+ case 0x08: print("rdcr R%d, R%d,", src1, rd); break;
+ case 0x09: print("rdcr %s, R%d", get_creg_name(imm32), rd); break;
+ case 0x0a: print("swcr R%d, R%d, R%d", rd, src1, rs); break;
+ case 0x0b: print("swcr R%d, %s, R%d", rd, get_creg_name(imm32), rs); break;
+ case 0x0c: print("brcr R%d", src1); break;
+ case 0x0d: print("brcr %s", get_creg_name(imm32)); break;
case 0x10: print("shift%s.dz %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
case 0x12: print("shift%s.dm %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break;
@@ -434,69 +434,69 @@ static offs_t tms32082_disasm_mp(char *buffer, offs_t pc, const UINT8 *oprom)
print("dcache 0x%08X(R%d)", imm32, rs);
break;
- case 0x80: print("bsr R%d, R%d", src1, link); break;
- case 0x81: print("bsr 0x%08X, R%d", imm32, link); break;
- case 0x82: print("bsr.a R%d, R%d", src1, rd); break;
- case 0x83: print("bsr.a 0x%08X, R%d", imm32, link); break;
- case 0x88: print("jsr R%d, R%d", src1, link); break;
- case 0x89: print("jsr 0x%08X, R%d", imm32, link); break;
- case 0x8a: print("jsr.a R%d, R%d", src1, link); break;
- case 0x8b: print("jsr.a 0x%08X, R%d", imm32, link); break;
- case 0x90: print("bbz R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x91: print("bbz 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x92: print("bbz.a R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x93: print("bbz.a 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x94: print("bbo R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x95: print("bbo 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x96: print("bbo.a R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x97: print("bbo.a 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
- case 0x98: print("bcnd R%d, R%d, %s", src1, rs, BCND_CONDITION[rd]); break;
- case 0x99: print("bcnd 0x%08X, R%d, %s", imm32, rs, BCND_CONDITION[rd]); break;
- case 0x9a: print("bcnd.a R%d, R%d, %s", src1, rs, BCND_CONDITION[rd]); break;
- case 0x9b: print("bcnd.a 0x%08X, R%d, %s", imm32, rs, BCND_CONDITION[rd]); break;
- case 0xa0: print("cmp R%d, R%d, R%d", src1, rs, rd); break;
- case 0xa1: print("cmp 0x%08X, R%d, R%d", imm32, rs, rd); break;
- case 0xb0: print("add R%d, R%d, R%d", src1, rs, rd); break;
- case 0xb1: print("add 0x%08X, R%d, R%d", imm32, rs, rd); break;
- case 0xb2: print("addu R%d, R%d, R%d", src1, rs, rd); break;
- case 0xb3: print("addu 0x%08X, R%d, R%d", imm32, rs, rd); break;
- case 0xb4: print("sub R%d, R%d, R%d", src1, rs, rd); break;
- case 0xb5: print("sub 0x%08X, R%d, R%d", imm32, rs, rd); break;
- case 0xb6: print("subu R%d, R%d, R%d", src1, rs, rd); break;
- case 0xb7: print("subu 0x%08X, R%d, R%d", imm32, rs, rd); break;
+ case 0x80: print("bsr R%d, R%d", src1, link); break;
+ case 0x81: print("bsr 0x%08X, R%d", imm32, link); break;
+ case 0x82: print("bsr.a R%d, R%d", src1, rd); break;
+ case 0x83: print("bsr.a 0x%08X, R%d", imm32, link); break;
+ case 0x88: print("jsr R%d, R%d", src1, link); break;
+ case 0x89: print("jsr 0x%08X, R%d", imm32, link); break;
+ case 0x8a: print("jsr.a R%d, R%d", src1, link); break;
+ case 0x8b: print("jsr.a 0x%08X, R%d", imm32, link); break;
+ case 0x90: print("bbz R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x91: print("bbz 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x92: print("bbz.a R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x93: print("bbz.a 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x94: print("bbo R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x95: print("bbo 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x96: print("bbo.a R%d, R%d, %s (%d)", src1, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x97: print("bbo.a 0x%08X, R%d, %s (%d)", imm32, rs, BITNUM_CONDITION[bitnum], bitnum); break;
+ case 0x98: print("bcnd R%d, R%d, %s", src1, rs, BCND_CONDITION[rd]); break;
+ case 0x99: print("bcnd 0x%08X, R%d, %s", imm32, rs, BCND_CONDITION[rd]); break;
+ case 0x9a: print("bcnd.a R%d, R%d, %s", src1, rs, BCND_CONDITION[rd]); break;
+ case 0x9b: print("bcnd.a 0x%08X, R%d, %s", imm32, rs, BCND_CONDITION[rd]); break;
+ case 0xa0: print("cmp R%d, R%d, R%d", src1, rs, rd); break;
+ case 0xa1: print("cmp 0x%08X, R%d, R%d", imm32, rs, rd); break;
+ case 0xb0: print("add R%d, R%d, R%d", src1, rs, rd); break;
+ case 0xb1: print("add 0x%08X, R%d, R%d", imm32, rs, rd); break;
+ case 0xb2: print("addu R%d, R%d, R%d", src1, rs, rd); break;
+ case 0xb3: print("addu 0x%08X, R%d, R%d", imm32, rs, rd); break;
+ case 0xb4: print("sub R%d, R%d, R%d", src1, rs, rd); break;
+ case 0xb5: print("sub 0x%08X, R%d, R%d", imm32, rs, rd); break;
+ case 0xb6: print("subu R%d, R%d, R%d", src1, rs, rd); break;
+ case 0xb7: print("subu 0x%08X, R%d, R%d", imm32, rs, rd); break;
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5:
case 0xc6: case 0xd6: case 0xc7: case 0xd7: case 0xc8: case 0xd8: case 0xc9: case 0xd9:
- case 0xca: case 0xcb: case 0xcc: case 0xdc: case 0xcd: case 0xdd: case 0xce: case 0xde:
+ case 0xca: case 0xcb: case 0xcc: case 0xdc: case 0xcd: case 0xdd: case 0xce: case 0xde:
case 0xcf: case 0xdf:
{
print("%s", format_vector_op(op, imm32));
break;
}
- case 0xe0: print("fadd.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
- case 0xe1: print("fadd.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
- case 0xe2: print("fsub.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
- case 0xe3: print("fsub.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
- case 0xe4: print("fmpy.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
- case 0xe5: print("fmpy.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
- case 0xe6: print("fdiv.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
- case 0xe7: print("fdiv.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
- case 0xe8: print("frnd%s.%s%s R%d, R%d", FLOATOP_ROUND[rndmode], FLOATOP_PRECISION[p1], FLOATOP_PRECISION[pd], src1, rd); break;
- case 0xe9: print("frnd%s.%s%s 0x%08X, R%d", FLOATOP_ROUND[rndmode], FLOATOP_PRECISION[p1], FLOATOP_PRECISION[pd], imm32, rd); break;
- case 0xea: print("fcmp R%d, R%d, R%d", src1, rs, rd); break;
- case 0xeb: print("fcmp 0x%08X, R%d, R%d", imm32, rs, rd); break;
- case 0xee: print("fsqrt R%d, R%d", src1, rd); break;
- case 0xef: print("fsqrt 0x%08X, R%d", imm32, rd); break;
- case 0xf0: print("lmo R%d, R%d", rs, rd); break;
- case 0xf2: print("rmo R%d, R%d", rs, rd); break;
- case 0xfc: print("estop "); break;
-
+ case 0xe0: print("fadd.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
+ case 0xe1: print("fadd.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
+ case 0xe2: print("fsub.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
+ case 0xe3: print("fsub.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
+ case 0xe4: print("fmpy.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
+ case 0xe5: print("fmpy.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
+ case 0xe6: print("fdiv.%s%s%s R%d, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], src1, rs, rd); break;
+ case 0xe7: print("fdiv.%s%s%s 0x%08X, R%d, R%d", FLOATOP_PRECISION[p1], FLOATOP_PRECISION[p2], FLOATOP_PRECISION[pd], imm32, rs, rd); break;
+ case 0xe8: print("frnd%s.%s%s R%d, R%d", FLOATOP_ROUND[rndmode], FLOATOP_PRECISION[p1], FLOATOP_PRECISION[pd], src1, rd); break;
+ case 0xe9: print("frnd%s.%s%s 0x%08X, R%d", FLOATOP_ROUND[rndmode], FLOATOP_PRECISION[p1], FLOATOP_PRECISION[pd], imm32, rd); break;
+ case 0xea: print("fcmp R%d, R%d, R%d", src1, rs, rd); break;
+ case 0xeb: print("fcmp 0x%08X, R%d, R%d", imm32, rs, rd); break;
+ case 0xee: print("fsqrt R%d, R%d", src1, rd); break;
+ case 0xef: print("fsqrt 0x%08X, R%d", imm32, rd); break;
+ case 0xf0: print("lmo R%d, R%d", rs, rd); break;
+ case 0xf2: print("rmo R%d, R%d", rs, rd); break;
+ case 0xfc: print("estop "); break;
+
case 0xfe: case 0xff:
print("illopF ");
break;
- default: print("?"); break;
+ default: print("?"); break;
}
break;
}
diff --git a/src/emu/cpu/tms32082/dis_pp.c b/src/emu/cpu/tms32082/dis_pp.c
index 01397ac39d3..cd63a3c2559 100644
--- a/src/emu/cpu/tms32082/dis_pp.c
+++ b/src/emu/cpu/tms32082/dis_pp.c
@@ -6,37 +6,37 @@
static const char *REG_NAMES[128] =
{
// 0 - 15
- "a0", "a1", "a2", "a3", "a4", "???", "a6", "a7",
- "a8", "a9", "a10", "a11", "a12", "???", "a14", "a15",
+ "a0", "a1", "a2", "a3", "a4", "???", "a6", "a7",
+ "a8", "a9", "a10", "a11", "a12", "???", "a14", "a15",
// 16 - 31
- "x0", "x1", "x2", "???", "???", "???", "???", "???",
- "x8", "x9", "x10", "???", "???", "???", "???", "???",
+ "x0", "x1", "x2", "???", "???", "???", "???", "???",
+ "x8", "x9", "x10", "???", "???", "???", "???", "???",
// 32 - 47
- "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
- "???", "sr", "mf", "???", "???", "???", "???", "???",
+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "???", "sr", "mf", "???", "???", "???", "???", "???",
// 48 - 63
- "???", "???", "???", "???", "???", "???", "???", "???",
- "pc/call", "ipa/br", "ipe", "iprs", "inten", "intflg", "comm", "lctl",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "pc/call", "ipa/br", "ipe", "iprs", "inten", "intflg", "comm", "lctl",
// 64 - 79
- "???", "???", "???", "???", "???", "???", "???", "???",
- "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
// 80 - 95
- "???", "???", "???", "???", "???", "???", "???", "???",
- "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
// 96 - 111
- "lc0", "lc1", "lc2", "???", "lr0", "lr1", "lr2", "???",
- "lrse0", "lrse1", "lrse2", "???", "lrs0", "lrs1", "lrs2", "???",
+ "lc0", "lc1", "lc2", "???", "lr0", "lr1", "lr2", "???",
+ "lrse0", "lrse1", "lrse2", "???", "lrs0", "lrs1", "lrs2", "???",
// 112 - 127
- "ls0", "ls1", "ls2", "???", "le0", "le1", "le2", "???",
- "???", "???", "???", "???", "tag0", "tag1", "tag2", "tag3"
+ "ls0", "ls1", "ls2", "???", "le0", "le1", "le2", "???",
+ "???", "???", "???", "???", "tag0", "tag1", "tag2", "tag3"
};
static const char *CONDITION_CODES[16] =
{
- "", "[p] ", "[ls] ", "[hi] ",
- "[lt] ", "[le] ", "[ge] ", "[gt] ",
- "[hs] ", "[lo] ", "[eq] ", "[ne] ",
- "[v] ", "[nv] ", "[n] ", "[nn] "
+ "", "[p] ", "[ls] ", "[hi] ",
+ "[lt] ", "[le] ", "[ge] ", "[gt] ",
+ "[hs] ", "[lo] ", "[eq] ", "[ne] ",
+ "[v] ", "[nv] ", "[n] ", "[nn] "
};
static const char *TRANSFER_SIZE[4] =
@@ -103,7 +103,7 @@ static void format_transfer(UINT64 op)
switch (gmode)
{
- case 0x00: // Format 7: Conditional DU || Conditional Move
+ case 0x00: // Format 7: Conditional DU || Conditional Move
{
int dstbank = (op >> 18) & 0xf;
int srcbank = (op >> 6) & 0xf;
@@ -117,14 +117,14 @@ static void format_transfer(UINT64 op)
b += sprintf(b, "%s = %s", REG_NAMES[dreg], REG_NAMES[sreg]);
break;
}
- case 0x01: // Format 8: Conditional DU ||Conditional Field Move
+ case 0x01: // Format 8: Conditional DU ||Conditional Field Move
{
int dstbank = (op >> 18) & 0xf;
int src = (op >> 10) & 0x7;
int dst = (op >> 3) & 0x7;
int itm = (op >> 22) & 0x3;
int size = (op >> 7) & 0x3;
- // int e = (op & (1 << 9));
+ // int e = (op & (1 << 9));
int dreg = (dstbank << 3) | dst;
int sreg = (4 << 3) | src;
@@ -133,7 +133,7 @@ static void format_transfer(UINT64 op)
b += sprintf(b, "%s = [%s%d]%s", REG_NAMES[dreg], TRANSFER_SIZE[size], itm, REG_NAMES[sreg]);
break;
}
- case 0x02: case 0x03: // Format 10: Conditional Non-D Data Unit
+ case 0x02: case 0x03: // Format 10: Conditional Non-D Data Unit
{
int as1bank = (op >> 6) & 0xf;
int adstbank = (op >> 18) & 0xf;
@@ -156,7 +156,7 @@ static void format_transfer(UINT64 op)
}
default:
{
- if (op & 0x4) // Format 9: Conditional DU || Conditional Global
+ if (op & 0x4) // Format 9: Conditional DU || Conditional Global
{
int bank = (op >> 18) & 0xf;
int le = ((op >> 16) & 2) | ((op >> 9) & 1);
@@ -178,7 +178,7 @@ static void format_transfer(UINT64 op)
case 3: b += sprintf(b, "%s = &%s%s", REG_NAMES[greg], TRANSFER_SIZE[size], format_address_mode(gmode, ga, s, gimx)); break;
}
}
- else // Format 5: Global (Long Offset)
+ else // Format 5: Global (Long Offset)
{
int bank = (op >> 18) & 0xf;
int le = ((op >> 16) & 2) | ((op >> 9) & 1);
@@ -194,7 +194,7 @@ static void format_transfer(UINT64 op)
// sign extend offset
if (s && (offset & 0x4000))
offset |= 0xffffc000;
-
+
switch (le)
{
case 0: b += sprintf(b, "&%s%s = %s", TRANSFER_SIZE[size], format_address_mode(gmode, ga, s, offset), REG_NAMES[greg]); break;
@@ -215,17 +215,17 @@ static void format_transfer(UINT64 op)
switch (mode)
{
- case 0x00: // Format 2: Move || Local
+ case 0x00: // Format 2: Move || Local
{
b += sprintf(b, "move||local <TODO>");
break;
}
- case 0x01: // Format 3: Field Move || Local
+ case 0x01: // Format 3: Field Move || Local
{
b += sprintf(b, "field move||local <TODO>");
break;
}
- case 0x02: case 0x03: // Format 6: Non-D DU || Local
+ case 0x02: case 0x03: // Format 6: Non-D DU || Local
{
int d = (op >> 32) & 0x7;
int s = (op & (1 << 28));
@@ -245,7 +245,7 @@ static void format_transfer(UINT64 op)
}
break;
}
- case 0x10: case 0x11: case 0x12: case 0x13: // Format 4: Local (Long Offset)
+ case 0x10: case 0x11: case 0x12: case 0x13: // Format 4: Local (Long Offset)
{
int d = (op >> 32) & 0x7;
int bank = (op >> 18) & 0xf;
@@ -277,7 +277,7 @@ static void format_transfer(UINT64 op)
}
break;
}
- case 0x14: case 0x15: case 0x16: case 0x17: // Format 1: Double Parallel
+ case 0x14: case 0x15: case 0x16: case 0x17: // Format 1: Double Parallel
case 0x18: case 0x19: case 0x1a: case 0x1b:
case 0x1c: case 0x1d: case 0x1e: case 0x1f:
{
@@ -329,83 +329,83 @@ static void format_transfer(UINT64 op)
static void format_alu_op(int aluop, int a, const char *dst_text, const char *a_text, const char *b_text, const char *c_text)
{
- if (a) // arithmetic
+ if (a) // arithmetic
{
int bits = (aluop & 1) | ((aluop >> 1) & 2) | ((aluop >> 2) & 4) | ((aluop >> 3) & 8);
switch (bits)
{
- case 1: print("%s = %s - %s<1<", dst_text, a_text, b_text); break;
- case 2: print("%s = %s + %s<0<", dst_text, a_text, b_text); break;
- case 3: print("%s = %s - %s", dst_text, a_text, c_text); break;
- case 4: print("%s = %s - %s>1>", dst_text, a_text, b_text); break;
- case 5: print("%s = %s - %s", dst_text, a_text, b_text); break;
- case 6: print("?"); break;
- case 7: print("%s = %s - %s>0>", dst_text, a_text, b_text); break;
- case 8: print("%s = %s + %s>0>", dst_text, a_text, b_text); break;
- case 9: print("?"); break;
- case 10: print("%s = %s + %s", dst_text, a_text, b_text); break;
- case 11: print("%s = %s + %s>1>", dst_text, a_text, b_text); break;
- case 12: print("%s = %s + %s", dst_text, a_text, c_text); break;
- case 13: print("%s = %s - %s<0<", dst_text, a_text, b_text); break;
- case 14: print("%s = %s + %s<1<", dst_text, a_text, b_text); break;
- case 15: print("%s = field %s + %s", dst_text, a_text, b_text); break;
+ case 1: print("%s = %s - %s<1<", dst_text, a_text, b_text); break;
+ case 2: print("%s = %s + %s<0<", dst_text, a_text, b_text); break;
+ case 3: print("%s = %s - %s", dst_text, a_text, c_text); break;
+ case 4: print("%s = %s - %s>1>", dst_text, a_text, b_text); break;
+ case 5: print("%s = %s - %s", dst_text, a_text, b_text); break;
+ case 6: print("?"); break;
+ case 7: print("%s = %s - %s>0>", dst_text, a_text, b_text); break;
+ case 8: print("%s = %s + %s>0>", dst_text, a_text, b_text); break;
+ case 9: print("?"); break;
+ case 10: print("%s = %s + %s", dst_text, a_text, b_text); break;
+ case 11: print("%s = %s + %s>1>", dst_text, a_text, b_text); break;
+ case 12: print("%s = %s + %s", dst_text, a_text, c_text); break;
+ case 13: print("%s = %s - %s<0<", dst_text, a_text, b_text); break;
+ case 14: print("%s = %s + %s<1<", dst_text, a_text, b_text); break;
+ case 15: print("%s = field %s + %s", dst_text, a_text, b_text); break;
}
}
- else // boolean
+ else // boolean
{
switch (aluop)
{
- case 0xaa: // A & B & C | A & ~B & C | A & B & ~C | A & ~B & ~C = A
+ case 0xaa: // A & B & C | A & ~B & C | A & B & ~C | A & ~B & ~C = A
print("%s = %s", dst_text, a_text);
break;
- case 0x55: // ~A & B & C | ~A & ~B & C | ~A & B & ~C | ~A & ~B & ~C = ~A
+ case 0x55: // ~A & B & C | ~A & ~B & C | ~A & B & ~C | ~A & ~B & ~C = ~A
print("%s = ~%s", dst_text, a_text);
break;
- case 0xcc: // A & B & C | ~A & B & C | A & B & ~C | ~A & B & ~C = B
+ case 0xcc: // A & B & C | ~A & B & C | A & B & ~C | ~A & B & ~C = B
print("%s = %s", dst_text, b_text);
break;
- case 0x33: // A & ~B & C | ~A & ~B & C | A & ~B & ~C | ~A & ~B & ~C = ~B
+ case 0x33: // A & ~B & C | ~A & ~B & C | A & ~B & ~C | ~A & ~B & ~C = ~B
print("%s = %s", dst_text, b_text);
break;
- case 0xf0: // A & B & C | ~A & B & C | A & ~B & C | ~A & ~B & C = C
+ case 0xf0: // A & B & C | ~A & B & C | A & ~B & C | ~A & ~B & C = C
print("%s = %s", dst_text, c_text);
break;
- case 0x0f: // A & B & ~C | ~A & B & ~C | A & ~B & ~C | ~A & ~B & ~C = ~C
+ case 0x0f: // A & B & ~C | ~A & B & ~C | A & ~B & ~C | ~A & ~B & ~C = ~C
print("%s = ~%s", dst_text, c_text);
break;
- case 0x80: // A & B & C
+ case 0x80: // A & B & C
print("%s = %s & %s & %s", dst_text, a_text, b_text, c_text);
break;
- case 0x88: // A & B & C | A & B & ~C = A & B
+ case 0x88: // A & B & C | A & B & ~C = A & B
print("%s = %s & %s", dst_text, a_text, b_text);
break;
- case 0xa0: // A & B & C | A & ~B & C = A & C
+ case 0xa0: // A & B & C | A & ~B & C = A & C
print("%s = %s & %s", dst_text, a_text, c_text);
break;
- case 0xc0: // A & B & C | ~A & B & C = B & C
+ case 0xc0: // A & B & C | ~A & B & C = B & C
print("%s = %s & %s", dst_text, b_text, c_text);
break;
- case 0xea: // A & B & C | ~A & B & C | A & ~B & C |
+ case 0xea: // A & B & C | ~A & B & C | A & ~B & C |
// A & B & ~C | A & ~B & ~C = A | C
print("%s = %s | %s", dst_text, a_text, c_text);
break;
- case 0xee: // A & B & C | ~A & B & C | A & ~B & C |
+ case 0xee: // A & B & C | ~A & B & C | A & ~B & C |
// A & B & ~C | ~A & B & ~C | A & ~B & ~C = A | B
print("%s = %s | %s", dst_text, a_text, b_text);
break;
- case 0x44: // ~A & B & C | ~A & B & ~C = ~A & B
+ case 0x44: // ~A & B & C | ~A & B & ~C = ~A & B
print("%s = ~%s & %s", dst_text, a_text, b_text);
break;
@@ -420,14 +420,14 @@ static offs_t tms32082_disasm_pp(char *buffer, offs_t pc, const UINT8 *oprom)
{
output = buffer;
UINT32 flags = 0;
-
+
UINT64 op = ((UINT64)(oprom[0]) << 56) | ((UINT64)(oprom[1]) << 48) | ((UINT64)(oprom[2]) << 40) | ((UINT64)(oprom[3]) << 32) |
((UINT64)(oprom[4]) << 24) | ((UINT64)(oprom[5]) << 16) | ((UINT64)(oprom[6]) << 8) | ((UINT64)(oprom[7]));
switch (op >> 60)
{
case 0x6:
- case 0x7: // Six-operand
+ case 0x7: // Six-operand
{
print("A: six operand <TODO>");
break;
@@ -452,7 +452,7 @@ static offs_t tms32082_disasm_pp(char *buffer, offs_t pc, const UINT8 *oprom)
case 0x00: print("nop"); break;
case 0x02: print("eint"); break;
case 0x03: print("dint"); break;
- default: print("<reserved>"); break;
+ default: print("<reserved>"); break;
}
format_transfer(parallel_xfer);
@@ -467,7 +467,7 @@ static offs_t tms32082_disasm_pp(char *buffer, offs_t pc, const UINT8 *oprom)
switch ((op >> 43) & 3)
{
case 0:
- case 1: // Base set ALU (5-bit immediate)
+ case 1: // Base set ALU (5-bit immediate)
{
UINT64 parallel_xfer = (op & U64(0x0000007fffffffff));
@@ -545,8 +545,8 @@ static offs_t tms32082_disasm_pp(char *buffer, offs_t pc, const UINT8 *oprom)
format_transfer(parallel_xfer);
break;
}
-
- case 2: // Base set ALU (reg src2)
+
+ case 2: // Base set ALU (reg src2)
{
UINT64 parallel_xfer = (op & U64(0x0000007fffffffff));
@@ -625,8 +625,8 @@ static offs_t tms32082_disasm_pp(char *buffer, offs_t pc, const UINT8 *oprom)
format_transfer(parallel_xfer);
break;
}
-
- case 3: // Base set ALU (32-bit immediate)
+
+ case 3: // Base set ALU (32-bit immediate)
{
int dst = (op >> 48) & 7;
int src1 = (op >> 45) & 7;
@@ -709,4 +709,4 @@ static offs_t tms32082_disasm_pp(char *buffer, offs_t pc, const UINT8 *oprom)
CPU_DISASSEMBLE(tms32082_pp)
{
return tms32082_disasm_pp(buffer, pc, oprom);
-} \ No newline at end of file
+}
diff --git a/src/emu/cpu/tms32082/mp_ops.c b/src/emu/cpu/tms32082/mp_ops.c
index b02cc1a5390..5f79cb2379c 100644
--- a/src/emu/cpu/tms32082/mp_ops.c
+++ b/src/emu/cpu/tms32082/mp_ops.c
@@ -32,7 +32,7 @@
#define SIGN16(x) (((x) & 0x8000) ? 1 : 0)
#define SIGN8(x) (((x) & 0x80) ? 1 : 0)
-#define SIGN_EXTEND(x, r) ((x) | (((x) & (0x80000000 >> r)) ? ((INT32)(0x80000000) >> r) : 0))
+#define SIGN_EXTEND(x, r) ((x) | (((x) & (0x80000000 >> r)) ? ((INT32)(0x80000000) >> r) : 0))
@@ -95,38 +95,38 @@ UINT32 tms32082_mp_device::calculate_cmp(UINT32 src1, UINT32 src2)
UINT32 flags = 0;
// 32-bits (bits 20-29)
- flags |= ((~c32) & 1) << 29; // higher than or same (C)
- flags |= ((c32) & 1) << 28; // lower than (~C)
- flags |= ((c32|z32) & 1) << 27; // lower than or same (~C|Z)
- flags |= ((~c32&~z32) & 1) << 26; // higher than (C&~Z)
- flags |= (((n32&v32)|(~n32&~v32)) & 1) << 25; // greater than or equal (N&V)|(~N&~V)
- flags |= (((n32&~v32)|(~n32&v32)) & 1) << 24; // less than (N&~V)|(~N&V)
- flags |= (((n32&~v32)|(~n32&v32)|(z32)) & 1) << 23; // less than or equal (N&~V)|(~N&V)|Z
- flags |= (((n32&v32&~z32)|(~n32&~v32&~z32)) & 1) << 22; // greater than (N&V&~Z)|(~N&~V&~Z)
- flags |= ((~z32) & 1) << 21; // not equal (~Z)
- flags |= ((z32) & 1) << 20; // equal (Z)
+ flags |= ((~c32) & 1) << 29; // higher than or same (C)
+ flags |= ((c32) & 1) << 28; // lower than (~C)
+ flags |= ((c32|z32) & 1) << 27; // lower than or same (~C|Z)
+ flags |= ((~c32&~z32) & 1) << 26; // higher than (C&~Z)
+ flags |= (((n32&v32)|(~n32&~v32)) & 1) << 25; // greater than or equal (N&V)|(~N&~V)
+ flags |= (((n32&~v32)|(~n32&v32)) & 1) << 24; // less than (N&~V)|(~N&V)
+ flags |= (((n32&~v32)|(~n32&v32)|(z32)) & 1) << 23; // less than or equal (N&~V)|(~N&V)|Z
+ flags |= (((n32&v32&~z32)|(~n32&~v32&~z32)) & 1) << 22; // greater than (N&V&~Z)|(~N&~V&~Z)
+ flags |= ((~z32) & 1) << 21; // not equal (~Z)
+ flags |= ((z32) & 1) << 20; // equal (Z)
// 16-bits (bits 10-19)
- flags |= ((~c16) & 1) << 19; // higher than or same (C)
- flags |= ((c16) & 1) << 18; // lower than (~C)
- flags |= ((c16|z16) & 1) << 17; // lower than or same (~C|Z)
- flags |= ((~c16&~z16) & 1) << 16; // higher than (C&~Z)
- flags |= (((n16&v16)|(~n16&~v16)) & 1) << 15; // greater than or equal (N&V)|(~N&~V)
- flags |= (((n16&~v16)|(~n16&v16)) & 1) << 14; // less than (N&~V)|(~N&V)
- flags |= (((n16&~v16)|(~n16&v16)|(z16)) & 1) << 13; // less than or equal (N&~V)|(~N&V)|Z
- flags |= (((n16&v16&~z16)|(~n16&~v16&~z16)) & 1) << 12; // greater than (N&V&~Z)|(~N&~V&~Z)
- flags |= ((~z16) & 1) << 11; // not equal (~Z)
- flags |= ((z16) & 1) << 10; // equal (Z)
+ flags |= ((~c16) & 1) << 19; // higher than or same (C)
+ flags |= ((c16) & 1) << 18; // lower than (~C)
+ flags |= ((c16|z16) & 1) << 17; // lower than or same (~C|Z)
+ flags |= ((~c16&~z16) & 1) << 16; // higher than (C&~Z)
+ flags |= (((n16&v16)|(~n16&~v16)) & 1) << 15; // greater than or equal (N&V)|(~N&~V)
+ flags |= (((n16&~v16)|(~n16&v16)) & 1) << 14; // less than (N&~V)|(~N&V)
+ flags |= (((n16&~v16)|(~n16&v16)|(z16)) & 1) << 13; // less than or equal (N&~V)|(~N&V)|Z
+ flags |= (((n16&v16&~z16)|(~n16&~v16&~z16)) & 1) << 12; // greater than (N&V&~Z)|(~N&~V&~Z)
+ flags |= ((~z16) & 1) << 11; // not equal (~Z)
+ flags |= ((z16) & 1) << 10; // equal (Z)
// 8-bits (bits 0-9)
- flags |= ((~c8) & 1) << 9; // higher than or same (C)
- flags |= ((c8) & 1) << 8; // lower than (~C)
- flags |= ((c8|z8) & 1) << 7; // lower than or same (~C|Z)
- flags |= ((~c8&~z8) & 1) << 6; // higher than (C&~Z)
- flags |= (((n8&v8)|(~n8&~v8)) & 1) << 5; // greater than or equal (N&V)|(~N&~V)
- flags |= (((n8&~v8)|(~n8&v8)) & 1) << 4; // less than (N&~V)|(~N&V)
- flags |= (((n8&~v8)|(~n8&v8)|(z8)) & 1) << 3; // less than or equal (N&~V)|(~N&V)|Z
- flags |= (((n8&v8&~z8)|(~n8&~v8&~z8)) & 1) << 2; // greater than (N&V&~Z)|(~N&~V&~Z)
- flags |= ((~z8) & 1) << 1; // not equal (~Z)
- flags |= ((z8) & 1) << 0; // equal (Z)
+ flags |= ((~c8) & 1) << 9; // higher than or same (C)
+ flags |= ((c8) & 1) << 8; // lower than (~C)
+ flags |= ((c8|z8) & 1) << 7; // lower than or same (~C|Z)
+ flags |= ((~c8&~z8) & 1) << 6; // higher than (C&~Z)
+ flags |= (((n8&v8)|(~n8&~v8)) & 1) << 5; // greater than or equal (N&V)|(~N&~V)
+ flags |= (((n8&~v8)|(~n8&v8)) & 1) << 4; // less than (N&~V)|(~N&V)
+ flags |= (((n8&~v8)|(~n8&v8)|(z8)) & 1) << 3; // less than or equal (N&~V)|(~N&V)|Z
+ flags |= (((n8&v8&~z8)|(~n8&~v8&~z8)) & 1) << 2; // greater than (N&V&~Z)|(~N&~V&~Z)
+ flags |= ((~z8) & 1) << 1; // not equal (~Z)
+ flags |= ((z8) & 1) << 0; // equal (Z)
return flags;
}
@@ -138,38 +138,38 @@ void tms32082_mp_device::vector_loadstore()
switch (vector_ls_bits)
{
- case 0x01: // vst.s
+ case 0x01: // vst.s
{
m_program->write_dword(m_outp, m_reg[rd]);
m_outp += 4;
break;
}
- case 0x03: // vst.d
+ case 0x03: // vst.d
{
UINT64 data = m_fpair[rd >> 1];
m_program->write_qword(m_outp, data);
m_outp += 8;
break;
}
- case 0x04: // vld0.s
+ case 0x04: // vld0.s
{
m_reg[rd] = m_program->read_dword(m_in0p);
m_in0p += 4;
break;
}
- case 0x05: // vld1.s
+ case 0x05: // vld1.s
{
m_reg[rd] = m_program->read_dword(m_in1p);
m_in1p += 4;
break;
}
- case 0x06: // vld0.d
+ case 0x06: // vld0.d
{
m_fpair[rd >> 1] = m_program->read_qword(m_in0p);
m_in0p += 8;
break;
}
- case 0x07: // vld1.d
+ case 0x07: // vld1.d
{
m_fpair[rd >> 1] = m_program->read_qword(m_in1p);
m_in1p += 8;
@@ -186,7 +186,7 @@ void tms32082_mp_device::execute_short_imm()
{
switch ((m_ir >> 15) & 0x7f)
{
- case 0x02: // cmnd
+ case 0x02: // cmnd
{
UINT32 data = OP_UIMM15();
@@ -220,7 +220,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x06: // brcr
+ case 0x06: // brcr
{
int cr = OP_UIMM15();
@@ -233,13 +233,13 @@ void tms32082_mp_device::execute_short_imm()
UINT32 data = read_creg(cr);
m_fetchpc = data & ~3;
- m_ie = (m_ie & ~1) | (data & 1); // global interrupt mask from creg
+ m_ie = (m_ie & ~1) | (data & 1); // global interrupt mask from creg
// TODO: user/supervisor latch from creg
}
break;
}
- case 0x08: // shift.dz
+ case 0x08: // shift.dz
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -251,14 +251,14 @@ void tms32082_mp_device::execute_short_imm()
UINT32 endmask = SHIFT_MASK[end ? end : 32];
if (inv) endmask = ~endmask;
- UINT32 compmask = endmask; // shiftmask == 0xffffffff
+ UINT32 compmask = endmask; // shiftmask == 0xffffffff
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = ROTATE_R(source, rot) & compmask;
}
- else // left
+ else // left
{
res = ROTATE_L(source, rot) & compmask;
}
@@ -268,7 +268,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0a: // shift.ds
+ case 0x0a: // shift.ds
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -280,15 +280,15 @@ void tms32082_mp_device::execute_short_imm()
UINT32 endmask = SHIFT_MASK[end ? end : 32];
if (inv) endmask = ~endmask;
- UINT32 compmask = endmask; // shiftmask == 0xffffffff
+ UINT32 compmask = endmask; // shiftmask == 0xffffffff
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = ROTATE_R(source, rot) & compmask;
res = SIGN_EXTEND(res, rot);
}
- else // left
+ else // left
{
res = ROTATE_L(source, rot) & compmask;
// sign extend makes no sense to left..
@@ -299,7 +299,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0b: // shift.ez
+ case 0x0b: // shift.ez
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -330,7 +330,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0c: // shift.em
+ case 0x0c: // shift.em
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -346,11 +346,11 @@ void tms32082_mp_device::execute_short_imm()
UINT32 compmask = endmask & shiftmask;
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = (ROTATE_R(source, rot) & compmask) | (m_reg[rd] & ~compmask);
}
- else // left
+ else // left
{
res = (ROTATE_L(source, rot) & compmask) | (m_reg[rd] & ~compmask);
}
@@ -360,7 +360,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0d: // shift.es
+ case 0x0d: // shift.es
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -371,18 +371,18 @@ void tms32082_mp_device::execute_short_imm()
UINT32 endmask = SHIFT_MASK[end ? end : 32];
if (inv) endmask = ~endmask;
-
+
int shift = r ? 32-rot : rot;
UINT32 shiftmask = SHIFT_MASK[shift ? shift : 32];
UINT32 compmask = endmask & shiftmask;
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = ROTATE_R(source, rot) & compmask;
res = SIGN_EXTEND(res, rot);
}
- else // left
+ else // left
{
res = ROTATE_L(source, rot) & compmask;
// sign extend makes no sense to left..
@@ -393,7 +393,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0e: // shift.iz
+ case 0x0e: // shift.iz
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -423,7 +423,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x0f: // shift.im
+ case 0x0f: // shift.im
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -439,11 +439,11 @@ void tms32082_mp_device::execute_short_imm()
UINT32 compmask = endmask & ~shiftmask;
UINT32 res = 0;
- if (r) // right
+ if (r) // right
{
res = (ROTATE_R(source, rot) & compmask) | (m_reg[rd] & ~compmask);
}
- else // left
+ else // left
{
res = (ROTATE_L(source, rot) & compmask) | (m_reg[rd] & ~compmask);
}
@@ -453,7 +453,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x11: // and
+ case 0x11: // and
{
int rd = OP_RD();
int rs = OP_RS();
@@ -464,7 +464,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x14: // and.ft
+ case 0x14: // and.ft
{
int rd = OP_RD();
int rs = OP_RS();
@@ -475,7 +475,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x17: // or
+ case 0x17: // or
{
int rd = OP_RD();
int rs = OP_RS();
@@ -486,7 +486,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x1d: // or.ft
+ case 0x1d: // or.ft
{
int rd = OP_RD();
int rs = OP_RS();
@@ -498,7 +498,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x24:
- case 0x20: // ld.b
+ case 0x20: // ld.b
{
int rd = OP_RD();
int base = OP_BASE();
@@ -517,7 +517,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x25:
- case 0x21: // ld.h
+ case 0x21: // ld.h
{
int rd = OP_RD();
int base = OP_BASE();
@@ -536,7 +536,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x26:
- case 0x22: // ld
+ case 0x22: // ld
{
int rd = OP_RD();
int base = OP_BASE();
@@ -554,7 +554,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x27:
- case 0x23: // ld.d
+ case 0x23: // ld.d
{
int rd = OP_RD();
int base = OP_BASE();
@@ -576,7 +576,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x28:
- case 0x2c: // ld.ub
+ case 0x2c: // ld.ub
{
int rd = OP_RD();
int base = OP_BASE();
@@ -594,7 +594,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x2d:
- case 0x29: // ld.uh
+ case 0x29: // ld.uh
{
int rd = OP_RD();
int base = OP_BASE();
@@ -612,7 +612,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x34:
- case 0x30: // st.b
+ case 0x30: // st.b
{
int rd = OP_RD();
int base = OP_BASE();
@@ -629,7 +629,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x35:
- case 0x31: // st.h
+ case 0x31: // st.h
{
int rd = OP_RD();
int base = OP_BASE();
@@ -663,7 +663,7 @@ void tms32082_mp_device::execute_short_imm()
}
case 0x37:
- case 0x33: // st.d
+ case 0x33: // st.d
{
int rd = OP_RD();
int base = OP_BASE();
@@ -679,8 +679,8 @@ void tms32082_mp_device::execute_short_imm()
m_reg[base] = address;
break;
}
-
- case 0x48: // bbz
+
+ case 0x48: // bbz
{
int bitnum = OP_BITNUM() ^ 0x1f;
INT32 offset = OP_SIMM15();
@@ -698,7 +698,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x49: // bbz.a
+ case 0x49: // bbz.a
{
int bitnum = OP_BITNUM() ^ 0x1f;
INT32 offset = OP_SIMM15();
@@ -711,7 +711,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x4a: // bbo
+ case 0x4a: // bbo
{
int bitnum = OP_BITNUM() ^ 0x1f;
INT32 offset = OP_SIMM15();
@@ -742,7 +742,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x4c: // bcnd
+ case 0x4c: // bcnd
{
INT32 offset = OP_SIMM15();
int code = OP_RD();
@@ -760,7 +760,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x4d: // bcnd.a
+ case 0x4d: // bcnd.a
{
INT32 offset = OP_SIMM15();
int code = OP_RD();
@@ -784,7 +784,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x58: // add
+ case 0x58: // add
{
INT32 imm = OP_SIMM15();
int rd = OP_RD();
@@ -808,7 +808,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x5a: // sub
+ case 0x5a: // sub
{
INT32 imm = OP_SIMM15();
int rd = OP_RD();
@@ -821,7 +821,7 @@ void tms32082_mp_device::execute_short_imm()
break;
}
- case 0x5b: // subu
+ case 0x5b: // subu
{
INT32 imm = OP_SIMM15();
int rd = OP_RD();
@@ -887,7 +887,7 @@ void tms32082_mp_device::execute_reg_long_imm()
break;
}
- case 0x1c: // shift.iz
+ case 0x1c: // shift.iz
{
int r = (m_ir & (1 << 10));
int inv = (m_ir & (1 << 11));
@@ -919,7 +919,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x22:
- case 0x23: // and
+ case 0x23: // and
{
int rd = OP_RD();
int rs = OP_RS();
@@ -943,7 +943,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0x2c:
- case 0x2d: // xor
+ case 0x2d: // xor
{
int rd = OP_RD();
int rs = OP_RS();
@@ -967,7 +967,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x40:
case 0x41:
case 0x48:
- case 0x49: // ld.b
+ case 0x49: // ld.b
{
int m = m_ir & (1 << 15);
@@ -977,7 +977,7 @@ void tms32082_mp_device::execute_reg_long_imm()
UINT32 address = m_reg[base] + (has_imm ? imm32 : m_reg[OP_SRC1()]);
UINT32 r = m_program->read_byte(address);
if (r & 0x80) r |= 0xffffff00;
-
+
if (rd)
m_reg[rd] = r;
@@ -989,7 +989,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x42:
case 0x4a:
case 0x43:
- case 0x4b: // ld.h
+ case 0x4b: // ld.h
{
int shift = (m_ir & (1 << 11)) ? 1 : 0;
int m = m_ir & (1 << 15);
@@ -1012,7 +1012,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x4c:
case 0x44:
case 0x4d:
- case 0x45: // ld
+ case 0x45: // ld
{
int shift = (m_ir & (1 << 11)) ? 2 : 0;
int m = m_ir & (1 << 15);
@@ -1033,7 +1033,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x4e:
case 0x4f:
case 0x46:
- case 0x47: // ld.d
+ case 0x47: // ld.d
{
int shift = (m_ir & (1 << 11)) ? 3 : 0;
int m = m_ir & (1 << 15);
@@ -1054,7 +1054,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x58:
case 0x59:
case 0x50:
- case 0x51: // ld.ub
+ case 0x51: // ld.ub
{
int m = m_ir & (1 << 15);
int base = OP_BASE();
@@ -1074,7 +1074,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x5a:
case 0x5b:
case 0x52:
- case 0x53: // ld.uh
+ case 0x53: // ld.uh
{
int shift = (m_ir & (1 << 11)) ? 1 : 0;
int m = m_ir & (1 << 15);
@@ -1095,7 +1095,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x60:
case 0x61:
case 0x68:
- case 0x69: // st.b
+ case 0x69: // st.b
{
int m = m_ir & (1 << 15);
@@ -1112,7 +1112,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x62:
case 0x63:
case 0x6a:
- case 0x6b: // st.h
+ case 0x6b: // st.h
{
int shift = (m_ir & (1 << 11)) ? 1 : 0;
int m = m_ir & (1 << 15);
@@ -1130,7 +1130,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0x6c:
case 0x6d:
case 0x64:
- case 0x65: // st
+ case 0x65: // st
{
int shift = (m_ir & (1 << 11)) ? 2 : 0;
int m = m_ir & (1 << 15);
@@ -1177,7 +1177,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xa0:
- case 0xa1: // cmp
+ case 0xa1: // cmp
{
int rd = OP_RD();
UINT32 src1 = has_imm ? imm32 : m_reg[OP_SRC1()];
@@ -1200,7 +1200,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xb4:
- case 0xb5: // sub
+ case 0xb5: // sub
{
int rd = OP_RD();
int rs = OP_RS();
@@ -1213,7 +1213,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xb6:
- case 0xb7: // subu
+ case 0xb7: // subu
{
int rd = OP_RD();
int rs = OP_RS();
@@ -1226,7 +1226,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0xc4:
case 0xd4:
case 0xc5:
- case 0xd5: // vmpy
+ case 0xd5: // vmpy
{
int p1 = m_ir & (1 << 5);
int pd = m_ir & (1 << 7);
@@ -1262,7 +1262,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0xc8:
case 0xd8:
case 0xc9:
- case 0xd9: // vrnd
+ case 0xd9: // vrnd
{
int acc = OP_ACC();
int p1 = m_ir & (1 << 5);
@@ -1282,7 +1282,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0:
m_reg[rd] = f2u((float)source);
break;
- case 1:
+ case 1:
m_fpair[rd >> 1] = d2u(source);
break;
case 2:
@@ -1313,7 +1313,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0xcc:
case 0xdc:
case 0xcd:
- case 0xdd: // vmac
+ case 0xdd: // vmac
{
int acc = OP_ACC();
int z = m_ir & (1 << 8);
@@ -1356,7 +1356,7 @@ void tms32082_mp_device::execute_reg_long_imm()
case 0xce:
case 0xde:
case 0xcf:
- case 0xdf: // vmsc
+ case 0xdf: // vmsc
{
int acc = OP_ACC();
int z = m_ir & (1 << 8);
@@ -1397,25 +1397,25 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xe0:
- case 0xe1: // fadd
+ case 0xe1: // fadd
{
int rd = OP_RD();
int rs = OP_RS();
int src1 = OP_SRC1();
int precision = (m_ir >> 5) & 0x3f;
- if (rd) // only calculate if destination register is valid
+ if (rd) // only calculate if destination register is valid
{
switch (precision)
{
- case 0x00: // SP - SP -> SP
+ case 0x00: // SP - SP -> SP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
float s2 = u2f(m_reg[rs]);
m_reg[rd] = f2u(s1 + s2);
break;
}
- case 0x10: // SP - SP -> DP
+ case 0x10: // SP - SP -> DP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
float s2 = u2f(m_reg[rs]);
@@ -1423,7 +1423,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x14: // SP - DP -> DP
+ case 0x14: // SP - DP -> DP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
double s2 = u2d(m_fpair[rs >> 1]);
@@ -1431,7 +1431,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x11: // DP - SP -> DP
+ case 0x11: // DP - SP -> DP
{
double s1 = u2d(m_fpair[src1 >> 1]);
float s2 = u2f(m_reg[rs]);
@@ -1439,7 +1439,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x15: // DP - DP -> DP
+ case 0x15: // DP - DP -> DP
{
double s1 = u2d(m_fpair[src1 >> 1]);
double s2 = u2d(m_fpair[rs >> 1]);
@@ -1455,25 +1455,25 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xe2:
- case 0xe3: // fsub
+ case 0xe3: // fsub
{
int rd = OP_RD();
int rs = OP_RS();
int src1 = OP_SRC1();
int precision = (m_ir >> 5) & 0x3f;
- if (rd) // only calculate if destination register is valid
+ if (rd) // only calculate if destination register is valid
{
switch (precision)
{
- case 0x00: // SP - SP -> SP
+ case 0x00: // SP - SP -> SP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
float s2 = u2f(m_reg[rs]);
m_reg[rd] = f2u(s1 - s2);
break;
}
- case 0x10: // SP - SP -> DP
+ case 0x10: // SP - SP -> DP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
float s2 = u2f(m_reg[rs]);
@@ -1481,7 +1481,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x14: // SP - DP -> DP
+ case 0x14: // SP - DP -> DP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
double s2 = u2d(m_fpair[rs >> 1]);
@@ -1489,7 +1489,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x11: // DP - SP -> DP
+ case 0x11: // DP - SP -> DP
{
double s1 = u2d(m_fpair[src1 >> 1]);
float s2 = u2f(m_reg[rs]);
@@ -1497,7 +1497,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x15: // DP - DP -> DP
+ case 0x15: // DP - DP -> DP
{
double s1 = u2d(m_fpair[src1 >> 1]);
double s2 = u2d(m_fpair[rs >> 1]);
@@ -1513,25 +1513,25 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xe4:
- case 0xe5: // fmpy
+ case 0xe5: // fmpy
{
int rd = OP_RD();
int rs = OP_RS();
int src1 = OP_SRC1();
int precision = (m_ir >> 5) & 0x3f;
- if (rd) // only calculate if destination register is valid
+ if (rd) // only calculate if destination register is valid
{
switch (precision)
{
- case 0x00: // SP x SP -> SP
+ case 0x00: // SP x SP -> SP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
float s2 = u2f(m_reg[rs]);
m_reg[rd] = f2u(s1 * s2);
break;
}
- case 0x10: // SP x SP -> DP
+ case 0x10: // SP x SP -> DP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
float s2 = u2f(m_reg[rs]);
@@ -1539,7 +1539,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x14: // SP x DP -> DP
+ case 0x14: // SP x DP -> DP
{
float s1 = u2f(has_imm ? imm32 : m_reg[src1]);
double s2 = u2d(m_fpair[rs >> 1]);
@@ -1547,7 +1547,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x11: // DP x SP -> DP
+ case 0x11: // DP x SP -> DP
{
double s1 = u2d(m_fpair[src1 >> 1]);
float s2 = u2f(m_reg[rs]);
@@ -1555,7 +1555,7 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x15: // DP x DP -> DP
+ case 0x15: // DP x DP -> DP
{
double s1 = u2d(m_fpair[src1 >> 1]);
double s2 = u2d(m_fpair[rs >> 1]);
@@ -1563,12 +1563,12 @@ void tms32082_mp_device::execute_reg_long_imm()
m_fpair[rd >> 1] = res;
break;
}
- case 0x2a: // I x I -> I
+ case 0x2a: // I x I -> I
{
m_reg[rd] = (INT32)(m_reg[rs]) * (INT32)(has_imm ? imm32 : m_reg[OP_SRC1()]);
break;
}
- case 0x3f: // U x U -> U
+ case 0x3f: // U x U -> U
{
m_reg[rd] = (UINT32)(m_reg[rs]) * (UINT32)(has_imm ? imm32 : m_reg[OP_SRC1()]);
break;
@@ -1581,7 +1581,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xe6:
- case 0xe7: // fdiv
+ case 0xe7: // fdiv
{
int rd = OP_RD();
int p1 = m_ir & (1 << 5);
@@ -1606,7 +1606,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xe8:
- case 0xe9: // frnd
+ case 0xe9: // frnd
{
//int mode = (m_ir >> 7) & 3;
int p1 = (m_ir >> 5) & 3;
@@ -1654,9 +1654,9 @@ void tms32082_mp_device::execute_reg_long_imm()
}
break;
}
-
+
case 0xea:
- case 0xeb: // fcmp
+ case 0xeb: // fcmp
{
int rd = OP_RD();
int p1 = m_ir & (1 << 5);
@@ -1689,7 +1689,7 @@ void tms32082_mp_device::execute_reg_long_imm()
}
case 0xee:
- case 0xef: // fsqrt
+ case 0xef: // fsqrt
{
int rd = OP_RD();
int src1 = OP_SRC1();
@@ -1709,7 +1709,7 @@ void tms32082_mp_device::execute_reg_long_imm()
break;
}
- case 0xf2: // rmo
+ case 0xf2: // rmo
{
UINT32 source = m_reg[OP_RS()];
int rd = OP_RD();
diff --git a/src/emu/cpu/tms32082/tms32082.c b/src/emu/cpu/tms32082/tms32082.c
index 914dccc8f86..b591f3fc6ac 100644
--- a/src/emu/cpu/tms32082/tms32082.c
+++ b/src/emu/cpu/tms32082/tms32082.c
@@ -22,7 +22,7 @@ const device_type TMS32082_PP = &device_creator<tms32082_pp_device>;
// internal memory map
static ADDRESS_MAP_START(mp_internal_map, AS_PROGRAM, 32, tms32082_mp_device)
- AM_RANGE(0x00000000, 0x00000fff) AM_RAM AM_SHARE("pp0_data0")
+ AM_RANGE(0x00000000, 0x00000fff) AM_RAM AM_SHARE("pp0_data0")
AM_RANGE(0x00001000, 0x00001fff) AM_RAM AM_SHARE("pp1_data0")
AM_RANGE(0x00008000, 0x00008fff) AM_RAM AM_SHARE("pp0_data1")
AM_RANGE(0x00009000, 0x00009fff) AM_RAM AM_SHARE("pp1_data1")
@@ -141,7 +141,7 @@ void tms32082_mp_device::device_start()
save_item(NAME(m_fetchpc));
save_item(NAME(m_reg));
save_item(NAME(m_acc));
-
+
save_item(NAME(m_in0p));
save_item(NAME(m_in1p));
save_item(NAME(m_outp));
@@ -256,7 +256,7 @@ void tms32082_mp_device::processor_command(UINT32 command)
printf("Task ");
if (command & 0x00002000)
printf("Msg ");
-
+
printf("to: ");
if (command & 0x00000400)
@@ -300,28 +300,28 @@ UINT32 tms32082_mp_device::read_creg(int reg)
{
switch (reg)
{
- case 0x0: // EPC
+ case 0x0: // EPC
return m_epc;
- case 0x1: // EIP
+ case 0x1: // EIP
return m_eip;
- case 0x4: // INTPEN
+ case 0x4: // INTPEN
return m_intpen;
- case 0x6: // IE
+ case 0x6: // IE
return m_ie;
case 0xa: // PPERROR
return 0xe0000;
- case 0x4000: // IN0P
+ case 0x4000: // IN0P
return m_in0p;
- case 0x4001: // IN1P
+ case 0x4001: // IN1P
return m_in1p;
- case 0x4002: // OUTP
+ case 0x4002: // OUTP
return m_outp;
default:
@@ -335,15 +335,15 @@ void tms32082_mp_device::write_creg(int reg, UINT32 data)
{
switch (reg)
{
- case 0x0: // EPC
+ case 0x0: // EPC
m_epc = data;
break;
- case 0x1: // EIP
+ case 0x1: // EIP
m_eip = data;
break;
- case 0x4: // INTPEN
+ case 0x4: // INTPEN
{
for (int i=0; i < 32; i++)
{
@@ -353,20 +353,20 @@ void tms32082_mp_device::write_creg(int reg, UINT32 data)
break;
}
- case 0x6: // IE
+ case 0x6: // IE
m_ie = data;
printf("IE = %08X\n", data);
break;
- case 0x4000: // IN0P
+ case 0x4000: // IN0P
m_in0p = data;
break;
- case 0x4001: // IN1P
+ case 0x4001: // IN1P
m_in1p = data;
break;
- case 0x4002: // OUTP
+ case 0x4002: // OUTP
m_outp = data;
break;
@@ -378,19 +378,19 @@ void tms32082_mp_device::write_creg(int reg, UINT32 data)
void tms32082_mp_device::check_interrupts()
{
- if (m_ie & 1) // global interrupt mask
+ if (m_ie & 1) // global interrupt mask
{
for (int i=1; i < 32; i++)
{
if (m_ie & m_intpen & (1 << i))
{
m_epc = (m_fetchpc & ~3);
- m_epc |= (m_ie & 1); // save global interrupt mask
+ m_epc |= (m_ie & 1); // save global interrupt mask
// TODO: user mode bit to EPC
m_eip = m_pc;
- m_ie &= ~1; // clear global interrupt mask
+ m_ie &= ~1; // clear global interrupt mask
// get new pc from vector table
m_fetchpc = m_pc = m_program->read_dword(0x01010180 + (i * 4));
@@ -445,7 +445,7 @@ void tms32082_mp_device::execute_run()
while (m_icount > 0)
{
m_pc = m_fetchpc;
-
+
check_interrupts();
debugger_instruction_hook(this, m_pc);
@@ -466,7 +466,7 @@ void tms32082_mp_device::execute_run()
// internal memory map
static ADDRESS_MAP_START(pp_internal_map, AS_PROGRAM, 32, tms32082_pp_device)
- AM_RANGE(0x00000000, 0x00000fff) AM_RAM AM_SHARE("pp0_data0")
+ AM_RANGE(0x00000000, 0x00000fff) AM_RAM AM_SHARE("pp0_data0")
AM_RANGE(0x00001000, 0x00001fff) AM_RAM AM_SHARE("pp1_data0")
AM_RANGE(0x00008000, 0x00008fff) AM_RAM AM_SHARE("pp0_data1")
AM_RANGE(0x00009000, 0x00009fff) AM_RAM AM_SHARE("pp1_data1")
@@ -528,4 +528,4 @@ void tms32082_pp_device::execute_run()
m_icount = 0;
return;
-} \ No newline at end of file
+}
diff --git a/src/emu/cpu/tms32082/tms32082.h b/src/emu/cpu/tms32082/tms32082.h
index 81dd80296fd..f791e52e157 100644
--- a/src/emu/cpu/tms32082/tms32082.h
+++ b/src/emu/cpu/tms32082/tms32082.h
@@ -58,10 +58,10 @@ public:
enum
{
- INPUT_X1 = 1,
- INPUT_X2 = 2,
- INPUT_X3 = 3,
- INPUT_X4 = 4,
+ INPUT_X1 = 1,
+ INPUT_X2 = 2,
+ INPUT_X3 = 3,
+ INPUT_X4 = 4,
};
DECLARE_READ32_MEMBER(mp_param_r);
diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c
index 9ed68966521..06aa593bebb 100644
--- a/src/emu/cpu/tms34010/tms34010.c
+++ b/src/emu/cpu/tms34010/tms34010.c
@@ -1842,4 +1842,3 @@ tms34020_device::tms34020_device(const machine_config &mconfig, device_type type
}
const device_type TMS34020 = &legacy_device_creator<tms34020_device>;
-
diff --git a/src/emu/cpu/tms34010/tms34010.h b/src/emu/cpu/tms34010/tms34010.h
index 4abf072789c..9240b33fa09 100644
--- a/src/emu/cpu/tms34010/tms34010.h
+++ b/src/emu/cpu/tms34010/tms34010.h
@@ -210,10 +210,10 @@ class tms34010_device : public legacy_cpu_device
public:
tms34010_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock);
tms34010_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func get_info);
-
+
UINT32 tms340x0_ind16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 tms340x0_rgb32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
-};
+};
extern const device_type TMS34010;
diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h
index 338d206355b..e014ccda059 100644
--- a/src/emu/cpu/tms9900/99xxcore.h
+++ b/src/emu/cpu/tms9900/99xxcore.h
@@ -4781,7 +4781,7 @@ void TMS99XX_GET_INFO(legacy_cpu_device *device, UINT32 state, cpuinfo *info)
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, TMS99XX_device_get_name); break;
case CPUINFO_STR_SHORTNAME: strcpy(info->s, TMS99XX_device_get_shortname); break;
-
+
case CPUINFO_STR_FAMILY: strcpy(info->s, "Texas Instruments 9900L"); break;
case CPUINFO_STR_VERSION: strcpy(info->s, "2.0"); break;
case CPUINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index cf0d7f0b1ab..6f5940973ec 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -1495,8 +1495,8 @@ static void execute_wplist(running_machine &machine, int ref, int params, const
{
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
- debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device->tag(),
- device->debug()->watchpoint_first(spacenum)->space().name());
+ debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device->tag(),
+ device->debug()->watchpoint_first(spacenum)->space().name());
/* loop over the watchpoints */
for (device_debug::watchpoint *wp = device->debug()->watchpoint_first(spacenum); wp != NULL; wp = wp->next())
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index 6ebcfd0f3ed..074de69dcc4 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -3279,18 +3279,18 @@ void device_debug::set_state(symbol_table &table, void *ref, UINT64 value)
//-------------------------------------------------
device_debug::breakpoint::breakpoint(device_debug* debugInterface,
- symbol_table &symbols,
- int index,
- offs_t address,
- const char *condition,
- const char *action)
+ symbol_table &symbols,
+ int index,
+ offs_t address,
+ const char *condition,
+ const char *action)
: m_debugInterface(debugInterface),
- m_next(NULL),
- m_index(index),
- m_enabled(true),
- m_address(address),
- m_condition(&symbols, (condition != NULL) ? condition : "1"),
- m_action((action != NULL) ? action : "")
+ m_next(NULL),
+ m_index(index),
+ m_enabled(true),
+ m_address(address),
+ m_condition(&symbols, (condition != NULL) ? condition : "1"),
+ m_action((action != NULL) ? action : "")
{
}
@@ -3335,25 +3335,25 @@ bool device_debug::breakpoint::hit(offs_t pc)
// watchpoint - constructor
//-------------------------------------------------
-device_debug::watchpoint::watchpoint(device_debug* debugInterface,
- symbol_table &symbols,
- int index,
- address_space &space,
- int type,
- offs_t address,
- offs_t length,
- const char *condition,
- const char *action)
+device_debug::watchpoint::watchpoint(device_debug* debugInterface,
+ symbol_table &symbols,
+ int index,
+ address_space &space,
+ int type,
+ offs_t address,
+ offs_t length,
+ const char *condition,
+ const char *action)
: m_debugInterface(debugInterface),
- m_next(NULL),
- m_space(space),
- m_index(index),
- m_enabled(true),
- m_type(type),
- m_address(space.address_to_byte(address) & space.bytemask()),
- m_length(space.address_to_byte(length)),
- m_condition(&symbols, (condition != NULL) ? condition : "1"),
- m_action((action != NULL) ? action : "")
+ m_next(NULL),
+ m_space(space),
+ m_index(index),
+ m_enabled(true),
+ m_type(type),
+ m_address(space.address_to_byte(address) & space.bytemask()),
+ m_length(space.address_to_byte(length)),
+ m_condition(&symbols, (condition != NULL) ? condition : "1"),
+ m_action((action != NULL) ? action : "")
{
}
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h
index e4d3e8306f8..f767b205b29 100644
--- a/src/emu/debug/debugcpu.h
+++ b/src/emu/debug/debugcpu.h
@@ -80,11 +80,11 @@ public:
public:
// construction/destruction
breakpoint(device_debug* debugInterface,
- symbol_table &symbols,
- int index,
- offs_t address,
- const char *condition = NULL,
- const char *action = NULL);
+ symbol_table &symbols,
+ int index,
+ offs_t address,
+ const char *condition = NULL,
+ const char *action = NULL);
// getters
const device_debug *debugInterface() const { return m_debugInterface; }
@@ -119,14 +119,14 @@ public:
public:
// construction/destruction
watchpoint(device_debug* debugInterface,
- symbol_table &symbols,
- int index,
- address_space &space,
- int type,
- offs_t address,
- offs_t length,
- const char *condition = NULL,
- const char *action = NULL);
+ symbol_table &symbols,
+ int index,
+ address_space &space,
+ int type,
+ offs_t address,
+ offs_t length,
+ const char *condition = NULL,
+ const char *action = NULL);
// getters
const device_debug *debugInterface() const { return m_debugInterface; }
diff --git a/src/emu/debug/dvwpoints.c b/src/emu/debug/dvwpoints.c
index 0eed8c98179..19a5ad1a4d6 100644
--- a/src/emu/debug/dvwpoints.c
+++ b/src/emu/debug/dvwpoints.c
@@ -496,9 +496,9 @@ void debug_view_watchpoints::view_update()
pad_astring_to_length(buffer, tableBreaks[2]);
buffer.catprintf("%s", wp->space().name());
pad_astring_to_length(buffer, tableBreaks[3]);
- buffer.catprintf("%s-%s",
- core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()),
- core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()));
+ buffer.catprintf("%s-%s",
+ core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()),
+ core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()));
pad_astring_to_length(buffer, tableBreaks[4]);
buffer.catprintf("%s", types[wp->type() & 3]);
pad_astring_to_length(buffer, tableBreaks[5]);
diff --git a/src/emu/divideo.c b/src/emu/divideo.c
index 5168fbcd1cf..9dd403e2b49 100644
--- a/src/emu/divideo.c
+++ b/src/emu/divideo.c
@@ -104,7 +104,7 @@ void device_video_interface::interface_validity_check(validity_checker &valid) c
if (screen == NULL)
mame_printf_error("Screen '%s' not found, explicitly set for device '%s'", m_screen_tag, device().tag());
}
-
+
// otherwise, look for a single match
else
{
@@ -138,7 +138,7 @@ void device_video_interface::interface_pre_start()
if (m_screen == NULL)
throw emu_fatalerror("Screen '%s' not found, explicitly set for device '%s'", m_screen_tag, device().tag());
}
-
+
// otherwise, look for a single match
else
{
diff --git a/src/emu/divideo.h b/src/emu/divideo.h
index 9445290a613..6df3da598f1 100644
--- a/src/emu/divideo.h
+++ b/src/emu/divideo.h
@@ -81,13 +81,13 @@ protected:
// optional operation overrides
virtual void interface_validity_check(validity_checker &valid) const;
virtual void interface_pre_start();
-
+
// configuration state
- bool m_screen_required; // is a screen required?
- const char * m_screen_tag; // configured tag for the target screen
+ bool m_screen_required; // is a screen required?
+ const char * m_screen_tag; // configured tag for the target screen
// internal state
- screen_device * m_screen; // pointer to the screen device
+ screen_device * m_screen; // pointer to the screen device
};
// iterator
diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c
index 099b9cbe68c..dd3a54af3e3 100644
--- a/src/emu/emuopts.c
+++ b/src/emu/emuopts.c
@@ -189,8 +189,8 @@ const options_entry emu_options::s_option_entries[] =
// misc options
{ NULL, NULL, OPTION_HEADER, "CORE MISC OPTIONS" },
- { OPTION_DRC, "1", OPTION_BOOLEAN, "enable DRC cpu core if available" },
- { OPTION_DRC_USE_C, "0", OPTION_BOOLEAN, "force DRC use C backend" },
+ { OPTION_DRC, "1", OPTION_BOOLEAN, "enable DRC cpu core if available" },
+ { OPTION_DRC_USE_C, "0", OPTION_BOOLEAN, "force DRC use C backend" },
{ OPTION_BIOS, NULL, OPTION_STRING, "select the system BIOS to use" },
{ OPTION_CHEAT ";c", "0", OPTION_BOOLEAN, "enable cheat subsystem" },
{ OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" },
@@ -202,8 +202,8 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" },
{ OPTION_AUTOBOOT_SCRIPT ";script", NULL, OPTION_STRING, "lua script to execute after machine boot" },
{ OPTION_HTTP, "0", OPTION_BOOLEAN, "enable local http server" },
- { OPTION_HTTP_PORT, "8080", OPTION_INTEGER, "http server listener port" },
- { OPTION_HTTP_PATH, "web", OPTION_STRING, "path to web files" },
+ { OPTION_HTTP_PORT, "8080", OPTION_INTEGER, "http server listener port" },
+ { OPTION_HTTP_PATH, "web", OPTION_STRING, "path to web files" },
{ NULL }
};
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index d95ce2c8409..c128ecddc16 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -206,9 +206,9 @@ enum
#define OPTION_AUTOBOOT_DELAY "autoboot_delay"
#define OPTION_AUTOBOOT_SCRIPT "autoboot_script"
-#define OPTION_HTTP "http"
-#define OPTION_HTTP_PORT "http_port"
-#define OPTION_HTTP_PATH "http_path"
+#define OPTION_HTTP "http"
+#define OPTION_HTTP_PORT "http_port"
+#define OPTION_HTTP_PATH "http_path"
//**************************************************************************
// TYPE DEFINITIONS
@@ -369,7 +369,7 @@ public:
const char *autoboot_command() const { return value(OPTION_AUTOBOOT_COMMAND); }
int autoboot_delay() const { return int_value(OPTION_AUTOBOOT_DELAY); }
const char *autoboot_script() const { return value(OPTION_AUTOBOOT_SCRIPT); }
-
+
bool http() const { return bool_value(OPTION_HTTP); }
const char *http_port() const { return value(OPTION_HTTP_PORT); }
const char *http_path() const { return value(OPTION_HTTP_PATH); }
diff --git a/src/emu/machine.c b/src/emu/machine.c
index ed8f40a31ef..37221bb3a5a 100644
--- a/src/emu/machine.c
+++ b/src/emu/machine.c
@@ -394,7 +394,7 @@ int running_machine::run(bool firstrun)
bool settingsloaded = config_load_settings(*this);
nvram_load(*this);
sound().ui_mute(false);
-
+
// initialize ui lists
ui_initialize(*this);
diff --git a/src/emu/machine/40105.c b/src/emu/machine/40105.c
index 9ef59e37c5e..3333053a57f 100644
--- a/src/emu/machine/40105.c
+++ b/src/emu/machine/40105.c
@@ -37,8 +37,8 @@ const device_type CMOS_40105 = &device_creator<cmos_40105_device>;
cmos_40105_device::cmos_40105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, CMOS_40105, "40105", tag, owner, clock, "40105", __FILE__),
- m_write_dir(*this),
- m_write_dor(*this)
+ m_write_dir(*this),
+ m_write_dor(*this)
{
}
diff --git a/src/emu/machine/40105.h b/src/emu/machine/40105.h
index 0291d75b0b6..7786acee153 100644
--- a/src/emu/machine/40105.h
+++ b/src/emu/machine/40105.h
@@ -48,7 +48,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( si_w );
DECLARE_WRITE_LINE_MEMBER( so_w );
-
+
DECLARE_READ_LINE_MEMBER( dir_r );
DECLARE_READ_LINE_MEMBER( dor_r );
diff --git a/src/emu/machine/74148.c b/src/emu/machine/74148.c
index 50c957b6321..ba9743ca0b2 100644
--- a/src/emu/machine/74148.c
+++ b/src/emu/machine/74148.c
@@ -70,12 +70,12 @@ void ttl74148_device::device_config_complete()
const ttl74148_config *intf = reinterpret_cast<const ttl74148_config *>(static_config());
if (intf != NULL)
*static_cast<ttl74148_config *>(this) = *intf;
-
+
// or initialize to defaults if none provided
else
{
}
-
+
}
//-------------------------------------------------
@@ -100,7 +100,6 @@ void ttl74148_device::device_start()
void ttl74148_device::device_reset()
{
-
m_enable_input = 1;
m_input_lines[0] = 1;
m_input_lines[1] = 1;
diff --git a/src/emu/machine/74153.c b/src/emu/machine/74153.c
index a5e5de8ec56..9d21cfc6387 100644
--- a/src/emu/machine/74153.c
+++ b/src/emu/machine/74153.c
@@ -52,13 +52,13 @@ ttl74153_device::ttl74153_device(const machine_config &mconfig, const char *tag,
m_input_lines[1][1] = 0;
m_input_lines[1][2] = 0;
m_input_lines[1][3] = 0;
-
+
for (int i = 0; i < 2; i++)
m_enable[i] = 0;
-
+
for (int i = 0; i < 2; i++)
m_output[i] = 0;
-
+
for (int i = 0; i < 2; i++)
m_last_output[i] = 0;
}
@@ -75,7 +75,7 @@ void ttl74153_device::device_config_complete()
const ttl74153_config *intf = reinterpret_cast<const ttl74153_config *>(static_config());
if (intf != NULL)
*static_cast<ttl74153_config *>(this) = *intf;
-
+
// or initialize to defaults if none provided
else
{
diff --git a/src/emu/machine/74153.h b/src/emu/machine/74153.h
index 2973fee12c8..a23b4941df3 100644
--- a/src/emu/machine/74153.h
+++ b/src/emu/machine/74153.h
@@ -59,13 +59,13 @@ public:
void input_line_w(int section, int input_line, int data);
void enable_w(int section, int data);
int output_r(int section);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
diff --git a/src/emu/machine/74181.h b/src/emu/machine/74181.h
index 4eed4bc697c..b7e8a0efd6e 100644
--- a/src/emu/machine/74181.h
+++ b/src/emu/machine/74181.h
@@ -19,8 +19,7 @@
//**************************************************************************
#define MCFG_TTL74181_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, TTL74181, 0) \
-
+ MCFG_DEVICE_ADD(_tag, TTL74181, 0)
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/emu/machine/aicartc.c b/src/emu/machine/aicartc.c
index ace57a368e8..5bd3323dff9 100644
--- a/src/emu/machine/aicartc.c
+++ b/src/emu/machine/aicartc.c
@@ -1,9 +1,9 @@
/***************************************************************************
- AICA-RTC sub-device
+ AICA-RTC sub-device
- TODO:
- - move this inside AICA sound core once that'll get modernized
+ TODO:
+ - move this inside AICA sound core once that'll get modernized
***************************************************************************/
diff --git a/src/emu/machine/aicartc.h b/src/emu/machine/aicartc.h
index 7f72c0eb4b9..592cf9f4e09 100644
--- a/src/emu/machine/aicartc.h
+++ b/src/emu/machine/aicartc.h
@@ -25,7 +25,7 @@ Template for skeleton device
// ======================> aicartc_device
class aicartc_device : public device_t,
- public device_rtc_interface
+ public device_rtc_interface
{
public:
// construction/destruction
diff --git a/src/emu/machine/atahle.c b/src/emu/machine/atahle.c
index d94eb4fe4ea..6632b3753ee 100644
--- a/src/emu/machine/atahle.c
+++ b/src/emu/machine/atahle.c
@@ -239,7 +239,7 @@ bool ata_hle_device::set_dma_mode(int word)
m_identify_buffer[word] |= 0x100 << (m_sector_count & 7);
return true;
}
-
+
return false;
}
diff --git a/src/emu/machine/ataintf.c b/src/emu/machine/ataintf.c
index 6082cf4d1ab..3c19c50e491 100644
--- a/src/emu/machine/ataintf.c
+++ b/src/emu/machine/ataintf.c
@@ -141,7 +141,7 @@ READ16_MEMBER( ata_interface_device::read_cs0 )
if (m_slot[i]->dev() != NULL)
result &= m_slot[i]->dev()->read_cs0(space, offset, mem_mask);
-// { static int last_status = -1; if (offset == 7 ) { if( result == last_status ) return last_status; last_status = result; } else last_status = -1; }
+// { static int last_status = -1; if (offset == 7 ) { if( result == last_status ) return last_status; last_status = result; } else last_status = -1; }
// printf( "read cs0 %04x %04x %04x\n", offset, result, mem_mask );
diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c
index a12a8da293e..70cd543483a 100644
--- a/src/emu/machine/eeprom.c
+++ b/src/emu/machine/eeprom.c
@@ -87,10 +87,10 @@ eeprom_base_device::eeprom_base_device(const machine_config &mconfig, device_typ
m_completion_time(attotime::zero)
{
// a 2ms write time is too long for rfjetsa
- m_operation_time[WRITE_TIME] = attotime::from_usec(1750);
- m_operation_time[WRITE_ALL_TIME] = attotime::from_usec(8000);
- m_operation_time[ERASE_TIME] = attotime::from_usec(1000);
- m_operation_time[ERASE_ALL_TIME] = attotime::from_usec(8000);
+ m_operation_time[WRITE_TIME] = attotime::from_usec(1750);
+ m_operation_time[WRITE_ALL_TIME] = attotime::from_usec(8000);
+ m_operation_time[ERASE_TIME] = attotime::from_usec(1000);
+ m_operation_time[ERASE_ALL_TIME] = attotime::from_usec(8000);
}
@@ -195,8 +195,8 @@ void eeprom_base_device::write(offs_t address, UINT32 data)
//-------------------------------------------------
// write_all - write data at all addresses
-// (assumes an erase has previously been
-// performed)
+// (assumes an erase has previously been
+// performed)
//-------------------------------------------------
void eeprom_base_device::write_all(UINT32 data)
@@ -308,7 +308,7 @@ void eeprom_base_device::nvram_default()
if (m_default_data.u8 != NULL)
{
mame_printf_verbose("Warning: Driver-specific EEPROM defaults are going away soon.\n");
- for (offs_t offs = 0; offs < m_default_data_size; offs++)
+ for (offs_t offs = 0; offs < m_default_data_size; offs++)
{
if (m_data_bits == 8)
m_addrspace[0]->write_byte(offs, m_default_data.u8[offs]);
@@ -385,8 +385,8 @@ UINT32 eeprom_base_device::internal_read(offs_t address)
//-------------------------------------------------
-// internal_write - write data at the given
-// address
+// internal_write - write data at the given
+// address
//-------------------------------------------------
void eeprom_base_device::internal_write(offs_t address, UINT32 data)
diff --git a/src/emu/machine/eeprom.h b/src/emu/machine/eeprom.h
index e90228d7a55..fd851283e72 100644
--- a/src/emu/machine/eeprom.h
+++ b/src/emu/machine/eeprom.h
@@ -72,7 +72,7 @@
// ======================> eeprom_base_device
-class eeprom_base_device : public device_t,
+class eeprom_base_device : public device_t,
public device_memory_interface,
public device_nvram_interface
{
@@ -84,10 +84,10 @@ public:
// timing constants
enum timing_type
{
- WRITE_TIME, // default = 2ms
- WRITE_ALL_TIME, // default = 8ms
- ERASE_TIME, // default = 1ms
- ERASE_ALL_TIME, // default = 8ms
+ WRITE_TIME, // default = 2ms
+ WRITE_ALL_TIME, // default = 8ms
+ ERASE_TIME, // default = 1ms
+ ERASE_ALL_TIME, // default = 8ms
TIMING_COUNT
};
@@ -104,10 +104,10 @@ public:
void write_all(UINT32 data);
void erase(offs_t address);
void erase_all();
-
+
// status
bool ready() const { return machine().time() >= m_completion_time; }
-
+
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const;
@@ -127,18 +127,18 @@ protected:
void internal_write(offs_t address, UINT32 data);
// configuration state
- UINT32 m_cells;
- UINT8 m_address_bits;
- UINT8 m_data_bits;
+ UINT32 m_cells;
+ UINT8 m_address_bits;
+ UINT8 m_data_bits;
address_space_config m_space_config;
generic_ptr m_default_data;
UINT32 m_default_data_size;
UINT32 m_default_value;
bool m_default_value_set;
- attotime m_operation_time[TIMING_COUNT];
+ attotime m_operation_time[TIMING_COUNT];
// live state
- attotime m_completion_time;
+ attotime m_completion_time;
};
diff --git a/src/emu/machine/eeprompar.c b/src/emu/machine/eeprompar.c
index b4417613c6d..0d730224df3 100644
--- a/src/emu/machine/eeprompar.c
+++ b/src/emu/machine/eeprompar.c
@@ -37,33 +37,33 @@
****************************************************************************
- Parallel EEPROMs are generally simpler than serial EEPROMs, though
- they require more pins to provide the full set of address and data
- lines necessary. They also require more pins the larger the EEPROM
- is, whereas serial EEPROMs all share the same pinout regardless of
- size.
-
- At a basic level, there are 5 sets of signals involved:
-
- * /CE = chip enable
- * /OE = output enable
- * /WE = write enable
- * D0-Dn = data lines
- * A0-An = address lines
-
- To access the chip, the various enable states must be asserted or
- cleared. Note that these are generally active-low, so asserted means
- pulled to GND, and cleared means pulled to Vcc:
-
- /CE /OE /WE Action
- ASSERT ASSERT CLEAR Read (D0-Dn contain output data)
- ASSERT CLEAR ASSERT Write/Erase (D0-Dn are input data)
-
- Erase is performed by doing a write with D0-Dn all set to 1.
-
- In general, it is slow to write or erase (9ms is quoted in the 2816A
- datasheet, for example), and the /WE must be held low for the entire
- write/erase duration in order to guarantee the data is written.
+ Parallel EEPROMs are generally simpler than serial EEPROMs, though
+ they require more pins to provide the full set of address and data
+ lines necessary. They also require more pins the larger the EEPROM
+ is, whereas serial EEPROMs all share the same pinout regardless of
+ size.
+
+ At a basic level, there are 5 sets of signals involved:
+
+ * /CE = chip enable
+ * /OE = output enable
+ * /WE = write enable
+ * D0-Dn = data lines
+ * A0-An = address lines
+
+ To access the chip, the various enable states must be asserted or
+ cleared. Note that these are generally active-low, so asserted means
+ pulled to GND, and cleared means pulled to Vcc:
+
+ /CE /OE /WE Action
+ ASSERT ASSERT CLEAR Read (D0-Dn contain output data)
+ ASSERT CLEAR ASSERT Write/Erase (D0-Dn are input data)
+
+ Erase is performed by doing a write with D0-Dn all set to 1.
+
+ In general, it is slow to write or erase (9ms is quoted in the 2816A
+ datasheet, for example), and the /WE must be held low for the entire
+ write/erase duration in order to guarantee the data is written.
***************************************************************************/
@@ -150,8 +150,7 @@ eeprom_parallel_##_lowercase##_device::eeprom_parallel_##_lowercase##_device(con
{ \
static_set_size(*this, _cells, _bits); \
}; \
-const device_type EEPROM_PARALLEL_##_uppercase = &device_creator<eeprom_parallel_##_lowercase##_device>; \
-
+const device_type EEPROM_PARALLEL_##_uppercase = &device_creator<eeprom_parallel_##_lowercase##_device>;
// standard 28XX class of 8-bit EEPROMs
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 2804, 2804, 8, 512)
DEFINE_PARALLEL_EEPROM_DEVICE(28xx, 2816, 2816, 8, 2048)
diff --git a/src/emu/machine/eeprompar.h b/src/emu/machine/eeprompar.h
index 83baf7c743a..aab0a6d8b4f 100644
--- a/src/emu/machine/eeprompar.h
+++ b/src/emu/machine/eeprompar.h
@@ -120,8 +120,7 @@ class eeprom_parallel_##_lowercase##_device : public eeprom_parallel_##_baseclas
public: \
eeprom_parallel_##_lowercase##_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); \
}; \
-extern const device_type EEPROM_PARALLEL_##_uppercase; \
-
+extern const device_type EEPROM_PARALLEL_##_uppercase;
// standard 28XX class of 8-bit EEPROMs
DECLARE_PARALLEL_EEPROM_DEVICE(28xx, 2804, 2804)
DECLARE_PARALLEL_EEPROM_DEVICE(28xx, 2816, 2816)
diff --git a/src/emu/machine/eepromser.c b/src/emu/machine/eepromser.c
index a1180e49f4d..461e059273b 100644
--- a/src/emu/machine/eepromser.c
+++ b/src/emu/machine/eepromser.c
@@ -37,95 +37,95 @@
****************************************************************************
- Serial EEPROMs generally work the same across manufacturers and models,
- varying largely by the size of the EEPROM and the packaging details.
-
- At a basic level, there are 5 signals involved:
-
- * CS = chip select
- * CLK = serial data clock
- * DI = serial data in
- * DO = serial data out
- * RDY/BUSY = ready (1) or busy (0) status
-
- Data is read or written via serial commands. A command is begun on a
- low-to-high transition of the CS line, following by clocking a start
- bit (1) on the DI line. After the start bit, subsequent clocks
- assemble one of the following commands:
-
- Start Opcode Address Data
- 1 01 aaaaaaaaa ddddddd WRITE data
- 1 10 aaaaaaaaa READ data
- 1 11 aaaaaaaaa ERASE data
- 1 00 00xxxxxxx WREN = WRite ENable
- 1 00 01xxxxxxx ddddddd WRAL = WRite ALl cells
- 1 00 10xxxxxxx ERAL = ERase ALl cells
- 1 00 11xxxxxxx WRDS = WRite DiSable
-
- The number of address bits (a) clocked varies based on the size of the
- chip, though it does not always map 1:1 with the size of the chip.
- For example, the 93C06 has 16 cells, which only needs 4 address bits;
- but commands to the 93C06 require 6 address bits (the top two must
- be 0).
-
- The number of data bits (d) clocked varies based on the chip and at
- times on the state of a pin on the chip which selects between multiple
- sizes (e.g., 8-bit versus 16-bit).
-
+ Serial EEPROMs generally work the same across manufacturers and models,
+ varying largely by the size of the EEPROM and the packaging details.
+
+ At a basic level, there are 5 signals involved:
+
+ * CS = chip select
+ * CLK = serial data clock
+ * DI = serial data in
+ * DO = serial data out
+ * RDY/BUSY = ready (1) or busy (0) status
+
+ Data is read or written via serial commands. A command is begun on a
+ low-to-high transition of the CS line, following by clocking a start
+ bit (1) on the DI line. After the start bit, subsequent clocks
+ assemble one of the following commands:
+
+ Start Opcode Address Data
+ 1 01 aaaaaaaaa ddddddd WRITE data
+ 1 10 aaaaaaaaa READ data
+ 1 11 aaaaaaaaa ERASE data
+ 1 00 00xxxxxxx WREN = WRite ENable
+ 1 00 01xxxxxxx ddddddd WRAL = WRite ALl cells
+ 1 00 10xxxxxxx ERAL = ERase ALl cells
+ 1 00 11xxxxxxx WRDS = WRite DiSable
+
+ The number of address bits (a) clocked varies based on the size of the
+ chip, though it does not always map 1:1 with the size of the chip.
+ For example, the 93C06 has 16 cells, which only needs 4 address bits;
+ but commands to the 93C06 require 6 address bits (the top two must
+ be 0).
+
+ The number of data bits (d) clocked varies based on the chip and at
+ times on the state of a pin on the chip which selects between multiple
+ sizes (e.g., 8-bit versus 16-bit).
+
****************************************************************************
- Most EEPROMs are based on the 93Cxx design (and have similar part
- designations):
-
- +--v--+
- CS |1 8| Vcc
- CLK |2 7| NC
- DI |3 6| NC
- DO |4 5| GND
- +-----+
-
- Note the lack of a READY/BUSY pin. On the 93Cxx series, the DO pin
- serves double-duty, returning READY/BUSY during a write/erase cycle,
- and outputting data during a read cycle.
-
- Some manufacturers have released "enhanced" versions with additional
- features:
-
- * Several manufacturers (ST) map pin 6 to "ORG", specifying the
- logical organization of the data. Connecting ORG to ground
- makes the EEPROM work as an 8-bit device, while connecting it
- to Vcc makes it work as a 16-bit device with one less
- address bit.
-
- * Other manufacturers (ST) have enhanced the read operations to
- allow serially streaming more than one cell. Essentially, after
- reading the first cell, keep CS high and keep clocking, and
- data from following cells will be read as well.
-
- The ER5911 is only slightly different:
-
- +--v--+
- CS |1 8| Vcc
- CLK |2 7| RDY/BUSY
- DI |3 6| ORG
- DO |4 5| GND
- +-----+
-
- Here we have an explicit RDY/BUSY signal, and the ORG flag as described
- above.
-
- From a command perspective, the ER5911 is also slightly different:
-
- 93Cxx has ERASE command; this maps to WRITE on ER5911
- 93Cxx has WRITEALL command; no equivalent on ER5911
+ Most EEPROMs are based on the 93Cxx design (and have similar part
+ designations):
+
+ +--v--+
+ CS |1 8| Vcc
+ CLK |2 7| NC
+ DI |3 6| NC
+ DO |4 5| GND
+ +-----+
+
+ Note the lack of a READY/BUSY pin. On the 93Cxx series, the DO pin
+ serves double-duty, returning READY/BUSY during a write/erase cycle,
+ and outputting data during a read cycle.
+
+ Some manufacturers have released "enhanced" versions with additional
+ features:
+
+ * Several manufacturers (ST) map pin 6 to "ORG", specifying the
+ logical organization of the data. Connecting ORG to ground
+ makes the EEPROM work as an 8-bit device, while connecting it
+ to Vcc makes it work as a 16-bit device with one less
+ address bit.
+
+ * Other manufacturers (ST) have enhanced the read operations to
+ allow serially streaming more than one cell. Essentially, after
+ reading the first cell, keep CS high and keep clocking, and
+ data from following cells will be read as well.
+
+ The ER5911 is only slightly different:
+
+ +--v--+
+ CS |1 8| Vcc
+ CLK |2 7| RDY/BUSY
+ DI |3 6| ORG
+ DO |4 5| GND
+ +-----+
+
+ Here we have an explicit RDY/BUSY signal, and the ORG flag as described
+ above.
+
+ From a command perspective, the ER5911 is also slightly different:
+
+ 93Cxx has ERASE command; this maps to WRITE on ER5911
+ 93Cxx has WRITEALL command; no equivalent on ER5911
****************************************************************************
- Issues with:
-
- kickgoal.c - code seems wrong, clock logic writes 0-0-0 instead of 0-1-0 as expected
- overdriv.c - drops CS, raises CS, keeps DI=1, triggering extraneous start bit
-
+ Issues with:
+
+ kickgoal.c - code seems wrong, clock logic writes 0-0-0 instead of 0-1-0 as expected
+ overdriv.c - drops CS, raises CS, keeps DI=1, triggering extraneous start bit
+
***************************************************************************/
#include "emu.h"
@@ -138,11 +138,11 @@
//**************************************************************************
// logging levels:
-// 0 = errors and warnings only
-// 1 = commands
-// 2 = state machine
-// 3 = DI/DO/READY reads & writes
-// 4 = all reads & writes
+// 0 = errors and warnings only
+// 1 = commands
+// 2 = state machine
+// 3 = DI/DO/READY reads & writes
+// 4 = all reads & writes
#define VERBOSE_PRINTF 0
#define VERBOSE_LOGERROR 0
@@ -195,7 +195,7 @@ eeprom_serial_base_device::eeprom_serial_base_device(const machine_config &mconf
//-------------------------------------------------
// static_set_address_bits - configuration helper
// to set the number of address bits in the
-// serial commands
+// serial commands
//-------------------------------------------------
void eeprom_serial_base_device::static_set_address_bits(device_t &device, int addrbits)
@@ -227,7 +227,7 @@ void eeprom_serial_base_device::device_start()
// start the base class
eeprom_base_device::device_start();
-
+
// save the current state
save_item(NAME(m_state));
save_item(NAME(m_cs_state));
@@ -269,8 +269,8 @@ void eeprom_serial_base_device::device_reset()
//**************************************************************************
//-------------------------------------------------
-// base_cs_write - set the state of the chip
-// select (CS) line
+// base_cs_write - set the state of the chip
+// select (CS) line
//-------------------------------------------------
void eeprom_serial_base_device::base_cs_write(int state)
@@ -280,10 +280,10 @@ void eeprom_serial_base_device::base_cs_write(int state)
if (state == m_cs_state)
return;
- // set the new state
+ // set the new state
LOG4((" cs_write(%d)\n", state));
m_cs_state = state;
-
+
// remember the rising edge time so we don't process CLK signals at the same time
if (state == ASSERT_LINE)
m_last_cs_rising_edge_time = machine().time();
@@ -292,7 +292,7 @@ void eeprom_serial_base_device::base_cs_write(int state)
//-------------------------------------------------
-// base_clk_write - set the state of the clock
+// base_clk_write - set the state of the clock
// (CLK) line
//-------------------------------------------------
@@ -303,7 +303,7 @@ void eeprom_serial_base_device::base_clk_write(int state)
if (state == m_clk_state)
return;
- // set the new state
+ // set the new state
LOG4((" clk_write(%d)\n", state));
m_clk_state = state;
handle_event((m_clk_state == ASSERT_LINE) ? EVENT_CLK_RISING_EDGE : EVENT_CLK_FALLING_EDGE);
@@ -311,8 +311,8 @@ void eeprom_serial_base_device::base_clk_write(int state)
//-------------------------------------------------
-// base_di_write - set the state of the data input
-// (DI) line
+// base_di_write - set the state of the data input
+// (DI) line
//-------------------------------------------------
void eeprom_serial_base_device::base_di_write(int state)
@@ -325,7 +325,7 @@ void eeprom_serial_base_device::base_di_write(int state)
//-------------------------------------------------
-// base_do_read - read the state of the data
+// base_do_read - read the state of the data
// output (DO) line
//-------------------------------------------------
@@ -341,7 +341,7 @@ int eeprom_serial_base_device::base_do_read()
//-------------------------------------------------
-// base_ready_read - read the state of the
+// base_ready_read - read the state of the
// READY/BUSY line
//-------------------------------------------------
@@ -390,7 +390,7 @@ void eeprom_serial_base_device::set_state(eeprom_state newstate)
//-------------------------------------------------
// handle_event - handle an event via the state
-// machine
+// machine
//-------------------------------------------------
void eeprom_serial_base_device::handle_event(eeprom_event event)
@@ -421,7 +421,7 @@ void eeprom_serial_base_device::handle_event(eeprom_event event)
if (event == EVENT_CS_RISING_EDGE)
set_state(STATE_WAIT_FOR_START_BIT);
break;
-
+
// CS is asserted; wait for rising clock with a 1 start bit; falling CS will reset us
// note that because each bit is written independently, it is possible for us to receive
// a false rising CLK edge at the exact same time as a rising CS edge; it appears we
@@ -435,7 +435,7 @@ void eeprom_serial_base_device::handle_event(eeprom_event event)
else if (event == EVENT_CS_FALLING_EDGE)
set_state(STATE_IN_RESET);
break;
-
+
// CS is asserted; wait for a command to come through; falling CS will reset us
case STATE_WAIT_FOR_COMMAND:
if (event == EVENT_CLK_RISING_EDGE)
@@ -448,13 +448,13 @@ void eeprom_serial_base_device::handle_event(eeprom_event event)
else if (event == EVENT_CS_FALLING_EDGE)
set_state(STATE_IN_RESET);
break;
-
+
// CS is asserted; reading data, clock the shift register; falling CS will reset us
case STATE_READING_DATA:
if (event == EVENT_CLK_RISING_EDGE)
{
int bit_index = m_bits_accum++;
-
+
// wrapping the address on multi-read is required by pacslot(cave.c)
if (bit_index % m_data_bits == 0 && (bit_index == 0 || m_streaming_enabled))
m_shift_register = read((m_address + m_bits_accum / m_data_bits) & ((1 << m_address_bits) - 1)) << (32 - m_data_bits);
@@ -474,7 +474,7 @@ void eeprom_serial_base_device::handle_event(eeprom_event event)
LOG0(("EEPROM: CS deasserted in READING_DATA after %d bits\n", m_bits_accum));
}
break;
-
+
// CS is asserted; waiting for data; clock data through until we accumulate enough; falling CS will reset us
case STATE_WAIT_FOR_DATA:
if (event == EVENT_CLK_RISING_EDGE)
@@ -489,7 +489,7 @@ void eeprom_serial_base_device::handle_event(eeprom_event event)
LOG0(("EEPROM: CS deasserted in STATE_WAIT_FOR_DATA after %d bits\n", m_bits_accum));
}
break;
-
+
// CS is asserted; waiting for completion; watch for CS falling
case STATE_WAIT_FOR_COMPLETION:
if (event == EVENT_CS_FALLING_EDGE)
@@ -501,7 +501,7 @@ void eeprom_serial_base_device::handle_event(eeprom_event event)
//-------------------------------------------------
// execute_command - execute a command once we
-// have enough bits for one
+// have enough bits for one
//-------------------------------------------------
void eeprom_serial_base_device::execute_command()
@@ -509,7 +509,7 @@ void eeprom_serial_base_device::execute_command()
// parse into a generic command and reset the accumulator count
parse_command_and_address();
m_bits_accum = 0;
-
+
#if (VERBOSE_PRINTF > 0 || VERBOSE_LOGERROR > 0)
// for debugging purposes
static const struct { eeprom_command command; const char *string; } s_command_names[] =
@@ -540,14 +540,14 @@ void eeprom_serial_base_device::execute_command()
m_shift_register = 0;
set_state(STATE_READING_DATA);
break;
-
+
// reset the shift register and wait for enough data to be clocked through
case COMMAND_WRITE:
case COMMAND_WRITEALL:
m_shift_register = 0;
set_state(STATE_WAIT_FOR_DATA);
break;
-
+
// erase the parsed address (unless locked) and wait for it to complete
case COMMAND_ERASE:
if (m_locked)
@@ -559,19 +559,19 @@ void eeprom_serial_base_device::execute_command()
erase(m_address);
set_state(STATE_WAIT_FOR_COMPLETION);
break;
-
+
// lock the chip; return to IN_RESET state
case COMMAND_LOCK:
m_locked = true;
set_state(STATE_IN_RESET);
break;
-
+
// unlock the chip; return to IN_RESET state
case COMMAND_UNLOCK:
m_locked = false;
set_state(STATE_IN_RESET);
break;
-
+
// erase the entire chip (unless locked) and wait for it to complete
case COMMAND_ERASEALL:
if (m_locked)
@@ -583,7 +583,7 @@ void eeprom_serial_base_device::execute_command()
erase_all();
set_state(STATE_WAIT_FOR_COMPLETION);
break;
-
+
default:
throw emu_fatalerror("execute_command called with invalid command %d\n", m_command);
}
@@ -591,8 +591,8 @@ void eeprom_serial_base_device::execute_command()
//-------------------------------------------------
-// execute_write_command - execute a write
-// command after receiving the data bits
+// execute_write_command - execute a write
+// command after receiving the data bits
//-------------------------------------------------
void eeprom_serial_base_device::execute_write_command()
@@ -627,7 +627,7 @@ void eeprom_serial_base_device::execute_write_command()
break;
// write the entire EEPROM with the same data; ERASEALL is required before so we
- // AND against the already-present data
+ // AND against the already-present data
case COMMAND_WRITEALL:
if (m_locked)
{
@@ -638,7 +638,7 @@ void eeprom_serial_base_device::execute_write_command()
write_all(m_shift_register);
set_state(STATE_WAIT_FOR_COMPLETION);
break;
-
+
default:
throw emu_fatalerror("execute_write_command called with invalid command %d\n", m_command);
}
@@ -661,8 +661,8 @@ eeprom_serial_93cxx_device::eeprom_serial_93cxx_device(const machine_config &mco
//-------------------------------------------------
-// parse_command_and_address - extract the
-// command and address from a bitstream
+// parse_command_and_address - extract the
+// command and address from a bitstream
//-------------------------------------------------
void eeprom_serial_93cxx_device::parse_command_and_address()
@@ -670,7 +670,7 @@ void eeprom_serial_93cxx_device::parse_command_and_address()
// set the defaults
m_command = COMMAND_INVALID;
m_address = m_command_address_accum & ((1 << m_command_address_bits) - 1);
-
+
// extract the command portion and handle it
switch (m_command_address_accum >> m_command_address_bits)
{
@@ -678,16 +678,16 @@ void eeprom_serial_93cxx_device::parse_command_and_address()
case 0:
switch (m_address >> (m_command_address_bits - 2))
{
- case 0: m_command = COMMAND_LOCK; break;
- case 1: m_command = COMMAND_WRITEALL; break;
- case 2: m_command = COMMAND_ERASEALL; break;
- case 3: m_command = COMMAND_UNLOCK; break;
+ case 0: m_command = COMMAND_LOCK; break;
+ case 1: m_command = COMMAND_WRITEALL; break;
+ case 2: m_command = COMMAND_ERASEALL; break;
+ case 3: m_command = COMMAND_UNLOCK; break;
}
m_address = 0;
break;
- case 1: m_command = COMMAND_WRITE; break;
- case 2: m_command = COMMAND_READ; break;
- case 3: m_command = COMMAND_ERASE; break;
+ case 1: m_command = COMMAND_WRITE; break;
+ case 2: m_command = COMMAND_READ; break;
+ case 3: m_command = COMMAND_ERASE; break;
}
// warn about out-of-range addresses
@@ -728,8 +728,8 @@ eeprom_serial_er5911_device::eeprom_serial_er5911_device(const machine_config &m
//-------------------------------------------------
-// parse_command_and_address - extract the
-// command and address from a bitstream
+// parse_command_and_address - extract the
+// command and address from a bitstream
//-------------------------------------------------
void eeprom_serial_er5911_device::parse_command_and_address()
@@ -737,7 +737,7 @@ void eeprom_serial_er5911_device::parse_command_and_address()
// set the defaults
m_command = COMMAND_INVALID;
m_address = m_command_address_accum & ((1 << m_command_address_bits) - 1);
-
+
// extract the command portion and handle it
switch (m_command_address_accum >> m_command_address_bits)
{
@@ -745,16 +745,16 @@ void eeprom_serial_er5911_device::parse_command_and_address()
case 0:
switch (m_address >> (m_command_address_bits - 2))
{
- case 0: m_command = COMMAND_LOCK; break;
- case 1: m_command = COMMAND_INVALID; break; // not on ER5911
- case 2: m_command = COMMAND_ERASEALL; break;
- case 3: m_command = COMMAND_UNLOCK; break;
+ case 0: m_command = COMMAND_LOCK; break;
+ case 1: m_command = COMMAND_INVALID; break; // not on ER5911
+ case 2: m_command = COMMAND_ERASEALL; break;
+ case 3: m_command = COMMAND_UNLOCK; break;
}
m_address = 0;
break;
- case 1: m_command = COMMAND_WRITE; break;
- case 2: m_command = COMMAND_READ; break;
- case 3: m_command = COMMAND_WRITE; break; // WRITE instead of ERASE on ER5911
+ case 1: m_command = COMMAND_WRITE; break;
+ case 2: m_command = COMMAND_READ; break;
+ case 3: m_command = COMMAND_WRITE; break; // WRITE instead of ERASE on ER5911
}
// warn about out-of-range addresses
@@ -793,8 +793,7 @@ eeprom_serial_##_lowercase##_##_bits##bit_device::eeprom_serial_##_lowercase##_#
static_set_size(*this, _cells, _bits); \
static_set_address_bits(*this, _addrbits); \
}; \
-const device_type EEPROM_SERIAL_##_uppercase##_##_bits##BIT = &device_creator<eeprom_serial_##_lowercase##_##_bits##bit_device>; \
-
+const device_type EEPROM_SERIAL_##_uppercase##_##_bits##BIT = &device_creator<eeprom_serial_##_lowercase##_##_bits##bit_device>;
// standard 93CX6 class of 16-bit EEPROMs
DEFINE_SERIAL_EEPROM_DEVICE(93cxx, 93c06, 93C06, 16, 16, 6)
DEFINE_SERIAL_EEPROM_DEVICE(93cxx, 93c46, 93C46, 16, 64, 6)
diff --git a/src/emu/machine/eepromser.h b/src/emu/machine/eepromser.h
index 99caeab6b54..8a28d4fbe24 100644
--- a/src/emu/machine/eepromser.h
+++ b/src/emu/machine/eepromser.h
@@ -87,8 +87,7 @@
// optional enable for streaming reads
#define MCFG_EEPROM_SERIAL_ENABLE_STREAMING() \
- eeprom_serial_base_device::static_enable_streaming(*device); \
-
+ eeprom_serial_base_device::static_enable_streaming(*device);
// pass-throughs to the base class for setting default data
#define MCFG_EEPROM_SERIAL_DATA MCFG_EEPROM_DATA
#define MCFG_EEPROM_SERIAL_DEFAULT_VALUE MCFG_EEPROM_DEFAULT_VALUE
@@ -112,14 +111,14 @@ public:
// inline configuration helpers
static void static_set_address_bits(device_t &device, int addrbits);
static void static_enable_streaming(device_t &device);
-
+
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
-
+
// read interfaces differ between implementations
-
+
// commands
enum eeprom_command
{
@@ -143,7 +142,7 @@ protected:
STATE_WAIT_FOR_DATA,
STATE_WAIT_FOR_COMPLETION
};
-
+
// events
enum eeprom_event
{
@@ -158,34 +157,34 @@ protected:
void handle_event(eeprom_event event);
void execute_command();
void execute_write_command();
-
+
// subclass helpers
void base_cs_write(int state);
void base_clk_write(int state);
void base_di_write(int state);
int base_do_read();
int base_ready_read();
-
+
// subclass overrides
virtual void parse_command_and_address() = 0;
// configuration state
- UINT8 m_command_address_bits; // number of address bits in a command
- bool m_streaming_enabled; // true if streaming is enabled
+ UINT8 m_command_address_bits; // number of address bits in a command
+ bool m_streaming_enabled; // true if streaming is enabled
// runtime state
- eeprom_state m_state; // current internal state
- UINT8 m_cs_state; // state of the CS line
- attotime m_last_cs_rising_edge_time; // time of the last CS rising edge
- UINT8 m_oe_state; // state of the OE line
- UINT8 m_clk_state; // state of the CLK line
- UINT8 m_di_state; // state of the DI line
- bool m_locked; // are we locked against writes?
- UINT32 m_bits_accum; // number of bits accumulated
- UINT32 m_command_address_accum; // accumulator of command+address bits
- eeprom_command m_command; // current command
- UINT32 m_address; // current address extracted from command
- UINT32 m_shift_register; // holds data coming in/going out
+ eeprom_state m_state; // current internal state
+ UINT8 m_cs_state; // state of the CS line
+ attotime m_last_cs_rising_edge_time; // time of the last CS rising edge
+ UINT8 m_oe_state; // state of the OE line
+ UINT8 m_clk_state; // state of the CLK line
+ UINT8 m_di_state; // state of the DI line
+ bool m_locked; // are we locked against writes?
+ UINT32 m_bits_accum; // number of bits accumulated
+ UINT32 m_command_address_accum; // accumulator of command+address bits
+ eeprom_command m_command; // current command
+ UINT32 m_address; // current address extracted from command
+ UINT32 m_shift_register; // holds data coming in/going out
};
@@ -200,12 +199,12 @@ protected:
public:
// read handlers
- DECLARE_READ_LINE_MEMBER(do_read); // combined DO+READY/BUSY
+ DECLARE_READ_LINE_MEMBER(do_read); // combined DO+READY/BUSY
// write handlers
- DECLARE_WRITE_LINE_MEMBER(cs_write); // CS signal (active high)
- DECLARE_WRITE_LINE_MEMBER(clk_write); // CLK signal (active high)
- DECLARE_WRITE_LINE_MEMBER(di_write); // DI
+ DECLARE_WRITE_LINE_MEMBER(cs_write); // CS signal (active high)
+ DECLARE_WRITE_LINE_MEMBER(clk_write); // CLK signal (active high)
+ DECLARE_WRITE_LINE_MEMBER(di_write); // DI
protected:
// subclass overrides
@@ -223,13 +222,13 @@ protected:
public:
// read handlers
- DECLARE_READ_LINE_MEMBER(do_read); // DO
- DECLARE_READ_LINE_MEMBER(ready_read); // READY/BUSY only
+ DECLARE_READ_LINE_MEMBER(do_read); // DO
+ DECLARE_READ_LINE_MEMBER(ready_read); // READY/BUSY only
// write handlers
- DECLARE_WRITE_LINE_MEMBER(cs_write); // CS signal (active high)
- DECLARE_WRITE_LINE_MEMBER(clk_write); // CLK signal (active high)
- DECLARE_WRITE_LINE_MEMBER(di_write); // DI
+ DECLARE_WRITE_LINE_MEMBER(cs_write); // CS signal (active high)
+ DECLARE_WRITE_LINE_MEMBER(clk_write); // CLK signal (active high)
+ DECLARE_WRITE_LINE_MEMBER(di_write); // DI
protected:
// subclass overrides
@@ -249,8 +248,7 @@ class eeprom_serial_##_lowercase##_##_bits##bit_device : public eeprom_serial_##
public: \
eeprom_serial_##_lowercase##_##_bits##bit_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); \
}; \
-extern const device_type EEPROM_SERIAL_##_uppercase##_##_bits##BIT; \
-
+extern const device_type EEPROM_SERIAL_##_uppercase##_##_bits##BIT;
// standard 93CX6 class of 16-bit EEPROMs
DECLARE_SERIAL_EEPROM_DEVICE(93cxx, 93c06, 93C06, 16)
DECLARE_SERIAL_EEPROM_DEVICE(93cxx, 93c46, 93C46, 16)
diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c
index 5b7d7267759..28049b5df32 100644
--- a/src/emu/machine/generic.c
+++ b/src/emu/machine/generic.c
@@ -558,4 +558,3 @@ void generic_pulse_irq_line(device_t *device, int irqline, int cycles) { device-
// legacy
INTERRUPT_GEN( irq2_line_hold ) { device->machine().driver_data()->irq2_line_hold(*device); }
-
diff --git a/src/emu/machine/mb87078.h b/src/emu/machine/mb87078.h
index 98d90fec44c..de92cc0c521 100644
--- a/src/emu/machine/mb87078.h
+++ b/src/emu/machine/mb87078.h
@@ -44,7 +44,7 @@ public:
Range from 100 to 0. (100 = 0dB; 50 = -6dB; 0 = -infinity)
This function is designed for use with MAME mixer_xxx() functions. */
int gain_percent_r(int channel);
-
+
void gain_recalc();
protected:
@@ -52,7 +52,7 @@ protected:
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
int m_gain[4]; /* gain index 0-63,64,65 */
diff --git a/src/emu/machine/s2636.c b/src/emu/machine/s2636.c
index fb143e0448d..121ed6e87ca 100644
--- a/src/emu/machine/s2636.c
+++ b/src/emu/machine/s2636.c
@@ -143,13 +143,13 @@ void s2636_device::device_start()
save_pointer(NAME(m_work_ram), m_work_ram_size);
save_item(NAME(*m_bitmap));
save_item(NAME(*m_collision_bitmap));
-
-
+
+
m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate(), this);
save_item(NAME(m_size));
save_item(NAME(m_pos));
save_item(NAME(m_level));
-
+
for (int i = 0; i < 1; i++)
save_item(NAME(m_reg[i]), i);
}
diff --git a/src/emu/machine/s2636.h b/src/emu/machine/s2636.h
index ae49f117ee5..112fe5f9913 100644
--- a/src/emu/machine/s2636.h
+++ b/src/emu/machine/s2636.h
@@ -47,14 +47,14 @@ public:
bitmap_ind16 &update( const rectangle &cliprect );
DECLARE_WRITE8_MEMBER( work_ram_w );
DECLARE_READ8_MEMBER( work_ram_r );
-
+
void soundport_w (int mode, int data);
protected:
// device-level overrides
virtual void device_config_complete();
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);
@@ -63,13 +63,13 @@ private:
UINT8 *m_work_ram;
bitmap_ind16 *m_bitmap;
bitmap_ind16 *m_collision_bitmap;
-
+
sound_stream *m_channel;
UINT8 m_reg[1];
int m_size;
int m_pos;
unsigned m_level;
-
+
int check_collision( int spriteno1, int spriteno2, const rectangle &cliprect );
};
diff --git a/src/emu/machine/smc91c9x.h b/src/emu/machine/smc91c9x.h
index 0295a339b2b..6260a2264b9 100644
--- a/src/emu/machine/smc91c9x.h
+++ b/src/emu/machine/smc91c9x.h
@@ -35,13 +35,13 @@ public:
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
smc91c9x_irq_func m_irq_handler;
@@ -64,7 +64,7 @@ private:
/* counters */
UINT32 m_sent;
UINT32 m_recd;
-
+
void update_ethernet_irq();
void update_stats();
void finish_enqueue(int param);
diff --git a/src/emu/machine/wd_fdc.c b/src/emu/machine/wd_fdc.c
index b30f62ac2b5..76c37444535 100644
--- a/src/emu/machine/wd_fdc.c
+++ b/src/emu/machine/wd_fdc.c
@@ -1466,7 +1466,7 @@ void wd_fdc_t::live_run(attotime limit)
if(cur_live.bit_counter & 15)
break;
int slot = (cur_live.bit_counter >> 4)-1;
- // fprintf(stderr, "%s: slot[%d] = %02x crc = %04x\n", tts(cur_live.tm).cstr(), slot, cur_live.data_reg, cur_live.crc);
+ // fprintf(stderr, "%s: slot[%d] = %02x crc = %04x\n", tts(cur_live.tm).cstr(), slot, cur_live.data_reg, cur_live.crc);
cur_live.idbuf[slot] = cur_live.data_reg;
if(slot == 5) {
live_delay(IDLE);
diff --git a/src/emu/mame.c b/src/emu/mame.c
index e7ada704667..b58aa4b05a8 100644
--- a/src/emu/mame.c
+++ b/src/emu/mame.c
@@ -147,9 +147,9 @@ int mame_execute(emu_options &options, osd_interface &osd)
// loop across multiple hard resets
bool exit_pending = false;
int error = MAMERR_NONE;
-
+
web_engine web(options);
-
+
while (error == MAMERR_NONE && !exit_pending)
{
// if no driver, use the internal empty driver
@@ -187,9 +187,9 @@ int mame_execute(emu_options &options, osd_interface &osd)
// looooong term: remove this
global_machine = &machine;
-
+
web.set_machine(machine);
- web.push_message("update_machine");
+ web.push_message("update_machine");
// run the machine
error = machine.run(firstrun);
firstrun = false;
diff --git a/src/emu/memarray.h b/src/emu/memarray.h
index c1acc53e5c6..39d2b0b54e2 100644
--- a/src/emu/memarray.h
+++ b/src/emu/memarray.h
@@ -37,16 +37,16 @@
****************************************************************************
- A memory array in this case is an array of 8, 16, or 32-bit data
- arranged logically.
-
- A memory array is stored in "natural" order, i.e., read/writes to it
- are done via AM_RAM, or standard COMBINE_DATA, even if the width of
- the CPU is different from the array width.
-
- The read_entry/write_entry functions serve to read/write entries of
- the configured size regardless of the underlay width of the CPU's
- memory system.
+ A memory array in this case is an array of 8, 16, or 32-bit data
+ arranged logically.
+
+ A memory array is stored in "natural" order, i.e., read/writes to it
+ are done via AM_RAM, or standard COMBINE_DATA, even if the width of
+ the CPU is different from the array width.
+
+ The read_entry/write_entry functions serve to read/write entries of
+ the configured size regardless of the underlay width of the CPU's
+ memory system.
***************************************************************************/
diff --git a/src/emu/profiler.h b/src/emu/profiler.h
index e521abf506a..e853bc31561 100644
--- a/src/emu/profiler.h
+++ b/src/emu/profiler.h
@@ -119,7 +119,7 @@ public:
// getters
bool enabled() const
- {
+ {
#ifndef MAME_DEBUG_FAST
return m_filoptr != NULL;
#else
diff --git a/src/emu/screen.h b/src/emu/screen.h
index 1c47e2add0f..ed84c9930c4 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -355,12 +355,12 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre
// SCREEN DEVICE CONFIGURATION MACROS
//**************************************************************************
- // legacy
+ // legacy
#define SCREEN_UPDATE_NAME(name) screen_update_##name
#define SCREEN_UPDATE_IND16(name) UINT32 SCREEN_UPDATE_NAME(name)(device_t *, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
#define SCREEN_UPDATE_RGB32(name) UINT32 SCREEN_UPDATE_NAME(name)(device_t *, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
- // legacy
+ // legacy
#define SCREEN_VBLANK_NAME(name) screen_vblank_##name
#define SCREEN_VBLANK(name) void SCREEN_VBLANK_NAME(name)(device_t *, screen_device &screen, bool vblank_on)
diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c
index d6f679f6441..b62f081c6e3 100644
--- a/src/emu/sound/aica.c
+++ b/src/emu/sound/aica.c
@@ -734,8 +734,8 @@ static void AICA_UpdateReg(aica_state *AICA, address_space &space, int reg)
//case 0x0c:
//case 0x0d:
- // printf("%04x\n",AICA->udata.data[0xc/2]);
- // break;
+ // printf("%04x\n",AICA->udata.data[0xc/2]);
+ // break;
case 0x12:
case 0x13:
diff --git a/src/emu/sound/cdp1864.h b/src/emu/sound/cdp1864.h
index 5cda3291e7a..f3489f95b92 100644
--- a/src/emu/sound/cdp1864.h
+++ b/src/emu/sound/cdp1864.h
@@ -158,7 +158,7 @@ private:
TIMER_DMA,
TIMER_HSYNC
};
-
+
void initialize_palette();
static const int bckgnd[];
diff --git a/src/emu/sound/esqpump.c b/src/emu/sound/esqpump.c
index 0efc4a6d1fa..5d8da22111f 100644
--- a/src/emu/sound/esqpump.c
+++ b/src/emu/sound/esqpump.c
@@ -1,9 +1,9 @@
/***************************************************************************
-
+
esqpump.c - Ensoniq 5505/5506 to 5510 interface.
-
+
By Christian Brunschen
-
+
***************************************************************************/
#include "sound/esqpump.h"
@@ -70,7 +70,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample
for (int i = 0; i < samples; i++)
{
#define SAMPLE_SHIFT 4
- // anything for the 'aux' output?
+ // anything for the 'aux' output?
INT16 l = inputs[0][i] >> SAMPLE_SHIFT;
INT16 r = inputs[1][i] >> SAMPLE_SHIFT;
@@ -108,7 +108,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample
INT32 er = (inputs[3][i]) + (inputs[5][i]) + (inputs[7][i]);
INT32 e_next = el + er;
e[(ei + 0x1d0f) % 0x4000] = e_next;
-
+
if (l != e[ei]) {
fprintf(stderr, "expected (%d) but have (%d)\n", e[ei], l);
}
@@ -166,4 +166,3 @@ void esq_5505_5510_pump::device_timer(emu_timer &timer, device_timer_id id, int
// ecery time there's a new sample period, update the stream!
m_stream->update();
}
-
diff --git a/src/emu/sound/esqpump.h b/src/emu/sound/esqpump.h
index fbead6b485a..eae3cebb32d 100644
--- a/src/emu/sound/esqpump.h
+++ b/src/emu/sound/esqpump.h
@@ -24,10 +24,9 @@ public:
m_esp_halted = esp_halted;
logerror("ESP-halted -> %d\n", m_esp_halted);
if (!esp_halted) {
-
#if PUMP_REPLACE_ESP_PROGRAM
m_esp->write_reg(245, 0x1d0f << 8); // dlength = 0x3fff, 16-sample delay
-
+
int pc = 0;
for (pc = 0; pc < 0xc0; pc++) {
m_esp->write_reg(pc, 0);
@@ -41,7 +40,7 @@ public:
m_esp->_instr(pc++) = 0xffffeea00000; // ADD SER2R, gpr_a0 > gpr_a0
m_esp->_instr(pc ) = 0xffffefa00000; // ADD SER2L, gpr_a0 > gpr_a0; prepare to read from delay 2 instructions from now, offset = 0
- m_esp->write_reg(pc++, 0); //offset into delay
+ m_esp->write_reg(pc++, 0); //offset into delay
m_esp->_instr(pc ) = 0xffffa0a09508; // MOV gpr_a0 > delay + offset
m_esp->write_reg(pc++, 1 << 8); // offset into delay - -1 samples
diff --git a/src/emu/sound/multipcm.h b/src/emu/sound/multipcm.h
index b79e7c81539..b900d77f71d 100644
--- a/src/emu/sound/multipcm.h
+++ b/src/emu/sound/multipcm.h
@@ -94,7 +94,7 @@ private:
//I include these in the chip because they depend on the chip clock
unsigned int m_ARStep[0x40], m_DRStep[0x40]; //Envelope step table
unsigned int m_FNS_Table[0x400]; //Frequency step table
-
+
void EG_Calc(SLOT *slot);
void LFO_ComputeStep(LFO_t *LFO,UINT32 LFOF,UINT32 LFOS,int ALFO);
void WriteSlot(SLOT *slot,int reg,unsigned char data);
diff --git a/src/emu/sound/okim6376.h b/src/emu/sound/okim6376.h
index c9d40fb2f77..91fd971771b 100644
--- a/src/emu/sound/okim6376.h
+++ b/src/emu/sound/okim6376.h
@@ -36,7 +36,7 @@ public:
void set_frequency(int frequency);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -66,7 +66,7 @@ private:
UINT8 m_st_pulses; /* Keep track of attenuation */
UINT8 m_ch2_update; /* Pulse shape */
UINT8 m_st_update;
-
+
void oki_process(int channel, int command);
void generate_adpcm(struct ADPCMVoice *voice, INT16 *buffer, int samples,int channel);
void postload();
diff --git a/src/emu/sound/s14001a.h b/src/emu/sound/s14001a.h
index d7e58cbcbd7..d3bd5b43e94 100644
--- a/src/emu/sound/s14001a.h
+++ b/src/emu/sound/s14001a.h
@@ -24,7 +24,7 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-
+
private:
// internal state
sound_stream * m_stream;
@@ -50,7 +50,7 @@ private:
UINT8 *m_SpeechRom; // array to hold rom contents, mame will not need this, will use a pointer
INT16 m_filtervals[8];
UINT8 m_VSU1000_amp; // amplitude setting on VSU-1000 board
-
+
INT16 audiofilter();
void shiftIntoFilter(INT16 inputvalue);
void PostPhoneme();
diff --git a/src/emu/sound/sound.mak b/src/emu/sound/sound.mak
index e7656a3fe34..04ad4f8e1be 100644
--- a/src/emu/sound/sound.mak
+++ b/src/emu/sound/sound.mak
@@ -727,7 +727,7 @@ endif
#-------------------------------------------------
-# NEC uPD7752
+# NEC uPD7752
#@src/emu/sound/upd7752.h,SOUNDS += UPD7752
#-------------------------------------------------
diff --git a/src/emu/sound/sp0250.c b/src/emu/sound/sp0250.c
index 7f7b364c949..a94707c35a3 100644
--- a/src/emu/sound/sp0250.c
+++ b/src/emu/sound/sp0250.c
@@ -52,7 +52,7 @@ sp0250_device::sp0250_device(const machine_config &mconfig, const char *tag, dev
{
m_fifo[i] = 0;
}
-
+
for (int i = 0; i < 6; i++)
{
m_filter[i].F = 0;
@@ -88,7 +88,7 @@ void sp0250_device::device_config_complete()
void sp0250_device::device_start()
{
const sp0250_interface *intf = reinterpret_cast<const sp0250_interface *>(static_config());
-
+
m_RNG = 1;
m_drq = ( intf!= NULL) ? m_drq_callback : NULL;
if (m_drq != NULL)
@@ -98,7 +98,7 @@ void sp0250_device::device_start()
}
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / CLOCK_DIVIDER, this);
-
+
save_item(NAME(m_amp));
save_item(NAME(m_pitch));
save_item(NAME(m_repeat));
diff --git a/src/emu/sound/sp0250.h b/src/emu/sound/sp0250.h
index 7cb01c97691..1011edd08c2 100644
--- a/src/emu/sound/sp0250.h
+++ b/src/emu/sound/sp0250.h
@@ -19,7 +19,7 @@ public:
DECLARE_WRITE8_MEMBER( write );
UINT8 drq_r();
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -27,7 +27,7 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-
+
private:
// internal state
INT16 m_amp;
@@ -47,7 +47,7 @@ private:
INT16 F, B;
INT16 z1, z2;
} m_filter[6];
-
+
void load_values();
TIMER_CALLBACK_MEMBER( timer_tick );
};
diff --git a/src/emu/sound/t6721a.h b/src/emu/sound/t6721a.h
index 6cc8c24b966..af9a706db76 100644
--- a/src/emu/sound/t6721a.h
+++ b/src/emu/sound/t6721a.h
@@ -65,7 +65,7 @@
// ======================> t6721a_device
class t6721a_device : public device_t,
- public device_sound_interface
+ public device_sound_interface
{
public:
t6721a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c
index 6ae658c72f9..f4d9c194919 100644
--- a/src/emu/sound/tms5220.c
+++ b/src/emu/sound/tms5220.c
@@ -120,7 +120,7 @@ Patent notes (important timing info for interpolation):
01 7 0#3 4 5 6 7 0#3 4 5 6 7 0#3 4 5
10 7 0#5 6 7 0#5 6 7 0#5 6 7 0#5 6 7
11 7 0#7 0#7 0#7 0#7 0#7 0#7 0#7 0#7
- Based on the behavior tested on the CD2501ECD this is assumed to be the same for that chip as well.
+ Based on the behavior tested on the CD2501ECD this is assumed to be the same for that chip as well.
Most of the following is based on figure 8c of 4,331,836, which is the
TMS5100/TMC0280 patent, but the same information applies to the TMS52xx
@@ -219,7 +219,7 @@ serial chips); Street Electronics Corp.'s Apple II 'Echo 2' Speech
synthesizer (early cards only)
CD2501ECD: (1983)
- Home computer: TI 99/8 (prototypes only)
+ Home computer: TI 99/8 (prototypes only)
TMS5220: (mostly on things made between 1981 and 1984-1985)
Arcade: Bally/Midway's 'NFL Football'; Atari's 'Star Wars',
diff --git a/src/emu/sound/upd7752.c b/src/emu/sound/upd7752.c
index 64185f1c9c1..d35fddf2b14 100644
--- a/src/emu/sound/upd7752.c
+++ b/src/emu/sound/upd7752.c
@@ -20,7 +20,7 @@ const device_type UPD7752 = &device_creator<upd7752_device>;
/* TODO: unknown exact size */
static ADDRESS_MAP_START( upd7752_ram, AS_0, 8, upd7752_device )
-// AM_RANGE(0x0000, 0x7fff) AM_ROM
+// AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x0000, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -34,9 +34,9 @@ ADDRESS_MAP_END
upd7752_device::upd7752_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, UPD7752, "uPD7752", tag, owner, clock, "upd7752", __FILE__),
- device_sound_interface(mconfig, *this),
- device_memory_interface(mconfig, *this),
- m_space_config("ram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(upd7752_ram))
+ device_sound_interface(mconfig, *this),
+ device_memory_interface(mconfig, *this),
+ m_space_config("ram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(upd7752_ram))
{
}
@@ -80,7 +80,6 @@ void upd7752_device::device_reset()
void upd7752_device::device_stop()
{
-
}
//-------------------------------------------------
@@ -155,7 +154,7 @@ WRITE8_MEMBER( upd7752_device::write )
[1] xxxx ---- amp Voice source amplitude
---- x--- Fricative Voice data
---- -xxx Pitch
- (repeat for N1 times)
+ (repeat for N1 times)
if [0] & 0xf8 == 0 then command stop
*/
writebyte(m_ram_addr++,data);
diff --git a/src/emu/sound/upd7752.h b/src/emu/sound/upd7752.h
index 71cff7f92d8..cdeb05b3dbd 100644
--- a/src/emu/sound/upd7752.h
+++ b/src/emu/sound/upd7752.h
@@ -30,8 +30,8 @@ Template for skeleton device
// ======================> upd7752_device
class upd7752_device : public device_t,
- public device_sound_interface,
- public device_memory_interface
+ public device_sound_interface,
+ public device_memory_interface
{
public:
// construction/destruction
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index 0d2d1a0827f..e436a6c124b 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -599,7 +599,7 @@ private:
// blitting parameters for rendering
struct blit_parameters
{
- bitmap_ind8 * priority;
+ bitmap_ind8 * priority;
rectangle cliprect;
UINT32 tilemap_priority_code;
UINT8 mask;
diff --git a/src/emu/video/315_5124.h b/src/emu/video/315_5124.h
index 4685e500274..b1a51352787 100644
--- a/src/emu/video/315_5124.h
+++ b/src/emu/video/315_5124.h
@@ -76,7 +76,7 @@ public:
DECLARE_WRITE8_MEMBER( register_write );
DECLARE_READ8_MEMBER( vcount_read );
DECLARE_READ8_MEMBER( hcount_read );
-
+
DECLARE_PALETTE_INIT( sega315_5124 );
void hcount_latch() { hcount_latch_at_hpos( m_screen->hpos() ); };
diff --git a/src/emu/video/dl1416.c b/src/emu/video/dl1416.c
index fe53baad7b8..436e494bea4 100644
--- a/src/emu/video/dl1416.c
+++ b/src/emu/video/dl1416.c
@@ -139,7 +139,7 @@ void dl1416_device::device_start()
save_item(NAME(m_cursor_enable));
save_item(NAME(m_write_enable));
save_item(NAME(m_digit_ram));
-
+
m_update_func.resolve(m_update, *this);
}
diff --git a/src/emu/video/hd63484.h b/src/emu/video/hd63484.h
index 7491311f576..2a154c612ec 100644
--- a/src/emu/video/hd63484.h
+++ b/src/emu/video/hd63484.h
@@ -48,7 +48,7 @@ protected:
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
UINT16 * m_ram;
@@ -64,7 +64,7 @@ private:
INT16 m_cpx, m_cpy;
int m_regno;
-
+
void doclr16( int opcode, UINT16 fill, int *dst, INT16 _ax, INT16 _ay );
void docpy16( int opcode, int src, int *dst, INT16 _ax, INT16 _ay );
int org_first_pixel( int _org_dpd );
@@ -76,9 +76,9 @@ private:
void line( INT16 sx, INT16 sy, INT16 ex, INT16 ey, INT16 col );
void circle( INT16 sx, INT16 sy, UINT16 r, INT16 col );
void paint( int sx, int sy, int col );
-
+
void command_w(UINT16 cmd);
-
+
};
extern ATTR_DEPRECATED const device_type HD63484;
diff --git a/src/emu/video/huc6260.c b/src/emu/video/huc6260.c
index e68a77ae0c3..d2c8af73bfa 100644
--- a/src/emu/video/huc6260.c
+++ b/src/emu/video/huc6260.c
@@ -62,7 +62,7 @@ void huc6260_device::device_config_complete()
huc6260_device::huc6260_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, HUC6260, "HuC6260", tag, owner, clock, "huc6260", __FILE__),
+ : device_t(mconfig, HUC6260, "HuC6260", tag, owner, clock, "huc6260", __FILE__),
device_video_interface(mconfig, *this)
{
}
diff --git a/src/emu/video/huc6261.c b/src/emu/video/huc6261.c
index 3067c4ffa51..cb8b7fd8c07 100644
--- a/src/emu/video/huc6261.c
+++ b/src/emu/video/huc6261.c
@@ -38,7 +38,7 @@ void huc6261_device::device_config_complete()
huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, HUC6261, "HuC6261", tag, owner, clock, "huc6261", __FILE__),
+ : device_t(mconfig, HUC6261, "HuC6261", tag, owner, clock, "huc6261", __FILE__),
device_video_interface(mconfig, *this)
{
// Set up UV lookup table
diff --git a/src/emu/video/i8275.h b/src/emu/video/i8275.h
index 18109ef654a..c343632ebd6 100644
--- a/src/emu/video/i8275.h
+++ b/src/emu/video/i8275.h
@@ -59,7 +59,7 @@ struct i8275_interface
};
-class i8275_device : public device_t,
+class i8275_device : public device_t,
public device_video_interface,
public i8275_interface
{
diff --git a/src/emu/video/i8275x.h b/src/emu/video/i8275x.h
index 741c477b8c1..36f09dc74ef 100644
--- a/src/emu/video/i8275x.h
+++ b/src/emu/video/i8275x.h
@@ -50,11 +50,9 @@
downcast<i8275x_device *>(device)->set_drq_callback(DEVCB2_##_drq);
#define MCFG_I8275_IRQ_CALLBACK(_irq) \
- downcast<i8275x_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
-
+ downcast<i8275x_device *>(device)->set_irq_callback(DEVCB2_##_irq);
#define MCFG_I8275_HRTC_CALLBACK(_hrtc) \
- downcast<i8275x_device *>(device)->set_hrtc_callback(DEVCB2_##_hrtc); \
-
+ downcast<i8275x_device *>(device)->set_hrtc_callback(DEVCB2_##_hrtc);
#define MCFG_I8275_VRTC_CALLBACK(_vrtc) \
downcast<i8275x_device *>(device)->set_vrtc_callback(DEVCB2_##_vrtc);
diff --git a/src/emu/video/polynew.h b/src/emu/video/polynew.h
index 2b51d3f3607..5703db7fc96 100644
--- a/src/emu/video/polynew.h
+++ b/src/emu/video/polynew.h
@@ -249,7 +249,7 @@ private:
// queue management
running_machine & m_machine;
- screen_device * m_screen;
+ screen_device * m_screen;
osd_work_queue * m_queue; // work queue
// arrays
diff --git a/src/emu/video/v9938.h b/src/emu/video/v9938.h
index c1ef73d40e0..4ec6b07262b 100644
--- a/src/emu/video/v9938.h
+++ b/src/emu/video/v9938.h
@@ -55,7 +55,7 @@ extern const device_type V9958;
// ======================> v99x8_device
-class v99x8_device : public device_t,
+class v99x8_device : public device_t,
public device_memory_interface,
public device_video_interface
{
@@ -77,9 +77,9 @@ public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
-
+
DECLARE_PALETTE_INIT(v9938);
-
+
UINT8 vram_r();
UINT8 status_r();
void palette_w(UINT8 data);
@@ -245,7 +245,7 @@ class v9938_device : public v99x8_device
{
public:
v9938_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
protected:
virtual machine_config_constructor device_mconfig_additions() const;
};
@@ -254,9 +254,9 @@ class v9958_device : public v99x8_device
{
public:
v9958_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
- DECLARE_PALETTE_INIT(v9958);
-
+
+ DECLARE_PALETTE_INIT(v9958);
+
protected:
virtual machine_config_constructor device_mconfig_additions() const;
};
diff --git a/src/emu/webengine.c b/src/emu/webengine.c
index 292eb6b0dfc..67cc254ac7e 100644
--- a/src/emu/webengine.c
+++ b/src/emu/webengine.c
@@ -48,18 +48,18 @@
// WEB ENGINE
//**************************************************************************
-void web_engine::websocket_ready_handler(struct mg_connection *conn) {
+void web_engine::websocket_ready_handler(struct mg_connection *conn) {
static const char *message = "update_machine";
mg_websocket_write(conn, WEBSOCKET_OPCODE_TEXT, message, strlen(message));
m_websockets.append(*global_alloc(simple_list_wrapper<mg_connection>(conn)));
-}
+}
// Arguments:
// flags: first byte of websocket frame, see websocket RFC,
// http://tools.ietf.org/html/rfc6455, section 5.2
// data, data_len: payload data. Mask, if any, is already applied.
int web_engine::websocket_data_handler(struct mg_connection *conn, int flags,
- char *data, size_t data_len)
+ char *data, size_t data_len)
{
// just Echo example for now
if ((flags & 0x0f) == WEBSOCKET_OPCODE_TEXT)
@@ -68,15 +68,15 @@ int web_engine::websocket_data_handler(struct mg_connection *conn, int flags,
// Returning zero means stoping websocket conversation.
// Close the conversation if client has sent us "exit" string.
return memcmp(data, "exit", 4);
-}
+}
static void get_qsvar(const struct mg_request_info *request_info,
- const char *name, char *dst, size_t dst_len) {
- const char *qs = request_info->query_string;
- mg_get_var(qs, strlen(qs == NULL ? "" : qs), name, dst, dst_len);
+ const char *name, char *dst, size_t dst_len) {
+ const char *qs = request_info->query_string;
+ mg_get_var(qs, strlen(qs == NULL ? "" : qs), name, dst, dst_len);
}
-int web_engine::json_game_handler(struct mg_connection *conn)
+int web_engine::json_game_handler(struct mg_connection *conn)
{
Json::Value data;
data["name"] = m_machine->system().name;
@@ -103,12 +103,12 @@ int web_engine::json_game_handler(struct mg_connection *conn)
return 1;
}
-int web_engine::json_slider_handler(struct mg_connection *conn)
+int web_engine::json_slider_handler(struct mg_connection *conn)
{
const slider_state *curslider;
astring tempstring;
Json::Value array(Json::arrayValue);
-
+
/* add all sliders */
for (curslider = ui_get_slider_list(); curslider != NULL; curslider = curslider->next)
{
@@ -151,29 +151,29 @@ int web_engine::json_slider_handler(struct mg_connection *conn)
}
// This function will be called by mongoose on every new request.
-int web_engine::begin_request_handler(struct mg_connection *conn)
+int web_engine::begin_request_handler(struct mg_connection *conn)
{
const struct mg_request_info *request_info = mg_get_request_info(conn);
- if (!strncmp(request_info->uri, "/json/",6))
+ if (!strncmp(request_info->uri, "/json/",6))
{
- if (!strcmp(request_info->uri, "/json/game"))
+ if (!strcmp(request_info->uri, "/json/game"))
{
return json_game_handler(conn);
- }
- if (!strcmp(request_info->uri, "/json/slider"))
+ }
+ if (!strcmp(request_info->uri, "/json/slider"))
{
return json_slider_handler(conn);
- }
+ }
}
- else if (!strncmp(request_info->uri, "/cmd",4))
+ else if (!strncmp(request_info->uri, "/cmd",4))
{
char cmd_name[64];
get_qsvar(request_info, "name", cmd_name, sizeof(cmd_name));
-
+
if(!strcmp(cmd_name,"softreset"))
{
m_machine->schedule_soft_reset();
- }
+ }
else if(!strcmp(cmd_name,"hardreset"))
{
m_machine->schedule_hard_reset();
@@ -181,8 +181,8 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
else if(!strcmp(cmd_name,"exit"))
{
m_machine->schedule_exit();
- }
-
+ }
+
// Send HTTP reply to the client
mg_printf(conn,
"HTTP/1.1 200 OK\r\n"
@@ -195,7 +195,7 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
// the client, and mongoose should not send client any more data.
return 1;
}
- else if (!strncmp(request_info->uri, "/slider",7))
+ else if (!strncmp(request_info->uri, "/slider",7))
{
char cmd_id[64];
char cmd_val[64];
@@ -206,17 +206,17 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
const slider_state *curslider;
for (curslider = ui_get_slider_list(); curslider != NULL; curslider = curslider->next)
{
- if (cnt==id)
+ if (cnt==id)
(*curslider->update)(machine(), curslider->arg, NULL, atoi(cmd_val));
cnt++;
}
for (curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next)
{
- if (cnt==id)
+ if (cnt==id)
(*curslider->update)(machine(), curslider->arg, NULL, atoi(cmd_val));
cnt++;
}
-
+
// Send HTTP reply to the client
mg_printf(conn,
"HTTP/1.1 200 OK\r\n"
@@ -229,7 +229,7 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
// the client, and mongoose should not send client any more data.
return 1;
}
- else if (!strncmp(request_info->uri, "/screenshot.png",15))
+ else if (!strncmp(request_info->uri, "/screenshot.png",15))
{
screen_device_iterator iter(m_machine->root_device());
screen_device *screen = iter.first();
@@ -251,25 +251,25 @@ int web_engine::begin_request_handler(struct mg_connection *conn)
m_machine->video().save_snapshot(screen, file);
astring fullpath(file.fullpath());
file.close();
-
+
mg_send_file(conn,fullpath);
return 1;
}
return 0;
-}
+}
-void *web_engine::websocket_keepalive()
+void *web_engine::websocket_keepalive()
{
- while(!m_exiting_core)
+ while(!m_exiting_core)
{
- osd_ticks_t curtime = osd_ticks();
+ osd_ticks_t curtime = osd_ticks();
if ((curtime - m_lastupdatetime) > osd_ticks_per_second() * 5)
{
m_lastupdatetime = curtime;
for (simple_list_wrapper<mg_connection> *curitem = m_websockets.first(); curitem != NULL; curitem = curitem->next())
{
- int status = mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_PING, NULL, 0);
+ int status = mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_PING, NULL, 0);
if (status==0) m_websockets.detach(*curitem); // remove inactive clients
}
}
@@ -284,26 +284,26 @@ void *web_engine::websocket_keepalive()
static void websocket_ready_handler_static(struct mg_connection *conn)
{
const struct mg_request_info *request_info = mg_get_request_info(conn);
- web_engine *engine = static_cast<web_engine *>(request_info->user_data);
+ web_engine *engine = static_cast<web_engine *>(request_info->user_data);
engine->websocket_ready_handler(conn);
}
static int websocket_data_handler_static(struct mg_connection *conn, int flags,
- char *data, size_t data_len)
+ char *data, size_t data_len)
{
const struct mg_request_info *request_info = mg_get_request_info(conn);
- web_engine *engine = static_cast<web_engine *>(request_info->user_data);
+ web_engine *engine = static_cast<web_engine *>(request_info->user_data);
return engine->websocket_data_handler(conn, flags, data, data_len);
}
-static int begin_request_handler_static(struct mg_connection *conn)
+static int begin_request_handler_static(struct mg_connection *conn)
{
- const struct mg_request_info *request_info = mg_get_request_info(conn);
- web_engine *engine = static_cast<web_engine *>(request_info->user_data);
+ const struct mg_request_info *request_info = mg_get_request_info(conn);
+ web_engine *engine = static_cast<web_engine *>(request_info->user_data);
return engine->begin_request_handler(conn);
}
-static void *websocket_keepalive_static(void *thread_func_param)
+static void *websocket_keepalive_static(void *thread_func_param)
{
web_engine *engine = static_cast<web_engine *>(thread_func_param);
return engine->websocket_keepalive();
@@ -315,35 +315,34 @@ static void *websocket_keepalive_static(void *thread_func_param)
web_engine::web_engine(emu_options &options)
: m_options(options),
- m_machine(NULL),
- m_ctx(NULL),
- m_lastupdatetime(0),
- m_exiting_core(false)
-
+ m_machine(NULL),
+ m_ctx(NULL),
+ m_lastupdatetime(0),
+ m_exiting_core(false)
+
{
-
struct mg_callbacks callbacks;
// List of options. Last element must be NULL.
const char *web_options[] = {
- "listening_ports", options.http_port(),
+ "listening_ports", options.http_port(),
"document_root", options.http_path(),
NULL
};
- // Prepare callbacks structure.
+ // Prepare callbacks structure.
memset(&callbacks, 0, sizeof(callbacks));
callbacks.begin_request = begin_request_handler_static;
- callbacks.websocket_ready = websocket_ready_handler_static;
- callbacks.websocket_data = websocket_data_handler_static;
+ callbacks.websocket_ready = websocket_ready_handler_static;
+ callbacks.websocket_data = websocket_data_handler_static;
// Start the web server.
if (m_options.http()) {
m_ctx = mg_start(&callbacks, this, web_options);
-
+
mg_start_thread(websocket_keepalive_static, this);
}
-
+
}
//-------------------------------------------------
@@ -368,7 +367,7 @@ void web_engine::close()
{
mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_CONNECTION_CLOSE, NULL, 0);
}
- // Stop the server.
+ // Stop the server.
mg_stop(m_ctx);
}
@@ -376,7 +375,7 @@ void web_engine::close()
void web_engine::push_message(const char *message)
{
for (simple_list_wrapper<mg_connection> *curitem = m_websockets.first(); curitem != NULL; curitem = curitem->next())
- {
+ {
int status = mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_TEXT, message, strlen(message));
if (status==0) m_websockets.detach(*curitem); // remove inactive clients
}
diff --git a/src/emu/webengine.h b/src/emu/webengine.h
index 1d54646a373..89db9d99c20 100644
--- a/src/emu/webengine.h
+++ b/src/emu/webengine.h
@@ -55,25 +55,25 @@ public:
void push_message(const char *message);
void close();
- void set_machine(running_machine &machine) { m_machine = &machine; }
-
+ void set_machine(running_machine &machine) { m_machine = &machine; }
+
void websocket_ready_handler(struct mg_connection *conn);
int websocket_data_handler(struct mg_connection *conn, int flags, char *data, size_t data_len);
- int begin_request_handler(struct mg_connection *conn);
- void *websocket_keepalive();
+ int begin_request_handler(struct mg_connection *conn);
+ void *websocket_keepalive();
protected:
// getters
running_machine &machine() const { return *m_machine; }
-
+
int json_game_handler(struct mg_connection *conn);
int json_slider_handler(struct mg_connection *conn);
private:
// internal state
- emu_options & m_options;
- running_machine * m_machine;
+ emu_options & m_options;
+ running_machine * m_machine;
struct mg_context * m_ctx;
- osd_ticks_t m_lastupdatetime;
- bool m_exiting_core;
+ osd_ticks_t m_lastupdatetime;
+ bool m_exiting_core;
simple_list<simple_list_wrapper<mg_connection> > m_websockets;
};
diff --git a/src/lib/formats/cpis_dsk.c b/src/lib/formats/cpis_dsk.c
index f42dec457d0..d5c1f5ad6fe 100644
--- a/src/lib/formats/cpis_dsk.c
+++ b/src/lib/formats/cpis_dsk.c
@@ -184,4 +184,3 @@ const cpis_format::format cpis_format::formats[] = {
};
const floppy_format_type FLOPPY_CPIS_FORMAT = &floppy_image_format_creator<cpis_format>;
-
diff --git a/src/lib/formats/g64_dsk.c b/src/lib/formats/g64_dsk.c
index 475e1f45893..42ef8fbac38 100644
--- a/src/lib/formats/g64_dsk.c
+++ b/src/lib/formats/g64_dsk.c
@@ -196,7 +196,7 @@ const floppy_format_type FLOPPY_G64_FORMAT = &floppy_image_format_creator<g64_fo
***************************************************************************/
#define HEADER_LENGTH 0x2ac // standard length for 84 half tracks
-#define MAX_HEADS 2
+#define MAX_HEADS 2
#define MAX_TRACKS 84
/***************************************************************************
@@ -206,11 +206,11 @@ const floppy_format_type FLOPPY_G64_FORMAT = &floppy_image_format_creator<g64_fo
struct g64dsk_tag
{
int version;
- int heads; // number of physical heads
- int tracks; // number of physical tracks
- UINT16 track_size[MAX_HEADS][MAX_TRACKS]; // size of each track
- UINT32 track_offset[MAX_HEADS][MAX_TRACKS]; // offset within data for each track
- UINT32 speed_zone_offset[MAX_HEADS][MAX_TRACKS]; // offset within data for each track
+ int heads; // number of physical heads
+ int tracks; // number of physical tracks
+ UINT16 track_size[MAX_HEADS][MAX_TRACKS]; // size of each track
+ UINT32 track_offset[MAX_HEADS][MAX_TRACKS]; // offset within data for each track
+ UINT32 speed_zone_offset[MAX_HEADS][MAX_TRACKS]; // offset within data for each track
};
/***************************************************************************
@@ -466,7 +466,7 @@ static void read_g64_header(floppy_image_legacy *floppy, struct g64dsk_tag *tag,
for (int i = 0; i < tag->tracks; i++)
{
tag->speed_zone_offset[head][i] = pick_integer_le(header, pos, 4);
-
+
if (tag->speed_zone_offset[head][i] >= 4)
{
tag->speed_zone_offset[head][i] += start_pos;
diff --git a/src/lib/web/json/config.h b/src/lib/web/json/config.h
index 7609d45e7a0..9ca6311c20b 100644
--- a/src/lib/web/json/config.h
+++ b/src/lib/web/json/config.h
@@ -71,23 +71,23 @@
#endif // if !defined(JSONCPP_DEPRECATED)
namespace Json {
- typedef int Int;
- typedef unsigned int UInt;
+ typedef int Int;
+ typedef unsigned int UInt;
# if defined(JSON_NO_INT64)
- typedef int LargestInt;
- typedef unsigned int LargestUInt;
+ typedef int LargestInt;
+ typedef unsigned int LargestUInt;
# undef JSON_HAS_INT64
# else // if defined(JSON_NO_INT64)
- // For Microsoft Visual use specific types as long long is not supported
+ // For Microsoft Visual use specific types as long long is not supported
# if defined(_MSC_VER) // Microsoft Visual Studio
- typedef __int64 Int64;
- typedef unsigned __int64 UInt64;
+ typedef __int64 Int64;
+ typedef unsigned __int64 UInt64;
# else // if defined(_MSC_VER) // Other platforms, use long long
- typedef long long int Int64;
- typedef unsigned long long int UInt64;
+ typedef long long int Int64;
+ typedef unsigned long long int UInt64;
# endif // if defined(_MSC_VER)
- typedef Int64 LargestInt;
- typedef UInt64 LargestUInt;
+ typedef Int64 LargestInt;
+ typedef UInt64 LargestUInt;
# define JSON_HAS_INT64
# endif // if defined(JSON_NO_INT64)
} // end namespace Json
diff --git a/src/lib/web/json/features.h b/src/lib/web/json/features.h
index 4353278446d..8c7eb0f4922 100644
--- a/src/lib/web/json/features.h
+++ b/src/lib/web/json/features.h
@@ -11,38 +11,37 @@
#endif // if !defined(JSON_IS_AMALGAMATION)
namespace Json {
-
- /** \brief Configuration passed to reader and writer.
- * This configuration object can be used to force the Reader or Writer
- * to behave in a standard conforming way.
- */
- class JSON_API Features
- {
- public:
- /** \brief A configuration that allows all features and assumes all strings are UTF-8.
- * - C & C++ comments are allowed
- * - Root object can be any JSON value
- * - Assumes Value strings are encoded in UTF-8
- */
- static Features all();
-
- /** \brief A configuration that is strictly compatible with the JSON specification.
- * - Comments are forbidden.
- * - Root object must be either an array or an object value.
- * - Assumes Value strings are encoded in UTF-8
- */
- static Features strictMode();
-
- /** \brief Initialize the configuration like JsonConfig::allFeatures;
- */
- Features();
-
- /// \c true if comments are allowed. Default: \c true.
- bool allowComments_;
-
- /// \c true if root must be either an array or an object value. Default: \c false.
- bool strictRoot_;
- };
+ /** \brief Configuration passed to reader and writer.
+ * This configuration object can be used to force the Reader or Writer
+ * to behave in a standard conforming way.
+ */
+ class JSON_API Features
+ {
+ public:
+ /** \brief A configuration that allows all features and assumes all strings are UTF-8.
+ * - C & C++ comments are allowed
+ * - Root object can be any JSON value
+ * - Assumes Value strings are encoded in UTF-8
+ */
+ static Features all();
+
+ /** \brief A configuration that is strictly compatible with the JSON specification.
+ * - Comments are forbidden.
+ * - Root object must be either an array or an object value.
+ * - Assumes Value strings are encoded in UTF-8
+ */
+ static Features strictMode();
+
+ /** \brief Initialize the configuration like JsonConfig::allFeatures;
+ */
+ Features();
+
+ /// \c true if comments are allowed. Default: \c true.
+ bool allowComments_;
+
+ /// \c true if root must be either an array or an object value. Default: \c false.
+ bool strictRoot_;
+ };
} // namespace Json
diff --git a/src/lib/web/json/forwards.h b/src/lib/web/json/forwards.h
index ab863da853b..51abad7ce18 100644
--- a/src/lib/web/json/forwards.h
+++ b/src/lib/web/json/forwards.h
@@ -11,31 +11,30 @@
#endif // if !defined(JSON_IS_AMALGAMATION)
namespace Json {
-
- // writer.h
- class FastWriter;
- class StyledWriter;
-
- // reader.h
- class Reader;
-
- // features.h
- class Features;
-
- // value.h
- typedef unsigned int ArrayIndex;
- class StaticString;
- class Path;
- class PathArgument;
- class Value;
- class ValueIteratorBase;
- class ValueIterator;
- class ValueConstIterator;
+ // writer.h
+ class FastWriter;
+ class StyledWriter;
+
+ // reader.h
+ class Reader;
+
+ // features.h
+ class Features;
+
+ // value.h
+ typedef unsigned int ArrayIndex;
+ class StaticString;
+ class Path;
+ class PathArgument;
+ class Value;
+ class ValueIteratorBase;
+ class ValueIterator;
+ class ValueConstIterator;
#ifdef JSON_VALUE_USE_INTERNAL_MAP
- class ValueMapAllocator;
- class ValueInternalLink;
- class ValueInternalArray;
- class ValueInternalMap;
+ class ValueMapAllocator;
+ class ValueInternalLink;
+ class ValueInternalArray;
+ class ValueInternalMap;
#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
} // namespace Json
diff --git a/src/lib/web/json/json_batchallocator.h b/src/lib/web/json/json_batchallocator.h
index 173e2ed2570..0093b8cc413 100644
--- a/src/lib/web/json/json_batchallocator.h
+++ b/src/lib/web/json/json_batchallocator.h
@@ -12,7 +12,6 @@
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
namespace Json {
-
/* Fast memory allocator.
*
* This memory allocator allocates memory for a batch of object (specified by
@@ -21,104 +20,104 @@ namespace Json {
* It does not allow the destruction of a single object. All the allocated objects
* can be destroyed at once. The memory can be either released or reused for future
* allocation.
- *
+ *
* The in-place new operator must be used to construct the object using the pointer
* returned by allocate.
*/
template<typename AllocatedType
- ,const unsigned int objectPerAllocation>
+ ,const unsigned int objectPerAllocation>
class BatchAllocator
{
public:
- typedef AllocatedType Type;
+ typedef AllocatedType Type;
- BatchAllocator( unsigned int objectsPerPage = 255 )
- : freeHead_( 0 )
- , objectsPerPage_( objectsPerPage )
- {
+ BatchAllocator( unsigned int objectsPerPage = 255 )
+ : freeHead_( 0 )
+ , objectsPerPage_( objectsPerPage )
+ {
// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() );
- assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space.
- assert( objectsPerPage >= 16 );
- batches_ = allocateBatch( 0 ); // allocated a dummy page
- currentBatch_ = batches_;
- }
-
- ~BatchAllocator()
- {
- for ( BatchInfo *batch = batches_; batch; )
- {
- BatchInfo *nextBatch = batch->next_;
- free( batch );
- batch = nextBatch;
- }
- }
-
- /// allocate space for an array of objectPerAllocation object.
- /// @warning it is the responsability of the caller to call objects constructors.
- AllocatedType *allocate()
- {
- if ( freeHead_ ) // returns node from free list.
- {
- AllocatedType *object = freeHead_;
- freeHead_ = *(AllocatedType **)object;
- return object;
- }
- if ( currentBatch_->used_ == currentBatch_->end_ )
- {
- currentBatch_ = currentBatch_->next_;
- while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ )
- currentBatch_ = currentBatch_->next_;
-
- if ( !currentBatch_ ) // no free batch found, allocate a new one
- {
- currentBatch_ = allocateBatch( objectsPerPage_ );
- currentBatch_->next_ = batches_; // insert at the head of the list
- batches_ = currentBatch_;
- }
- }
- AllocatedType *allocated = currentBatch_->used_;
- currentBatch_->used_ += objectPerAllocation;
- return allocated;
- }
-
- /// Release the object.
- /// @warning it is the responsability of the caller to actually destruct the object.
- void release( AllocatedType *object )
- {
- assert( object != 0 );
- *(AllocatedType **)object = freeHead_;
- freeHead_ = object;
- }
+ assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space.
+ assert( objectsPerPage >= 16 );
+ batches_ = allocateBatch( 0 ); // allocated a dummy page
+ currentBatch_ = batches_;
+ }
+
+ ~BatchAllocator()
+ {
+ for ( BatchInfo *batch = batches_; batch; )
+ {
+ BatchInfo *nextBatch = batch->next_;
+ free( batch );
+ batch = nextBatch;
+ }
+ }
+
+ /// allocate space for an array of objectPerAllocation object.
+ /// @warning it is the responsability of the caller to call objects constructors.
+ AllocatedType *allocate()
+ {
+ if ( freeHead_ ) // returns node from free list.
+ {
+ AllocatedType *object = freeHead_;
+ freeHead_ = *(AllocatedType **)object;
+ return object;
+ }
+ if ( currentBatch_->used_ == currentBatch_->end_ )
+ {
+ currentBatch_ = currentBatch_->next_;
+ while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ )
+ currentBatch_ = currentBatch_->next_;
+
+ if ( !currentBatch_ ) // no free batch found, allocate a new one
+ {
+ currentBatch_ = allocateBatch( objectsPerPage_ );
+ currentBatch_->next_ = batches_; // insert at the head of the list
+ batches_ = currentBatch_;
+ }
+ }
+ AllocatedType *allocated = currentBatch_->used_;
+ currentBatch_->used_ += objectPerAllocation;
+ return allocated;
+ }
+
+ /// Release the object.
+ /// @warning it is the responsability of the caller to actually destruct the object.
+ void release( AllocatedType *object )
+ {
+ assert( object != 0 );
+ *(AllocatedType **)object = freeHead_;
+ freeHead_ = object;
+ }
private:
- struct BatchInfo
- {
- BatchInfo *next_;
- AllocatedType *used_;
- AllocatedType *end_;
- AllocatedType buffer_[objectPerAllocation];
- };
-
- // disabled copy constructor and assignement operator.
- BatchAllocator( const BatchAllocator & );
- void operator =( const BatchAllocator &);
-
- static BatchInfo *allocateBatch( unsigned int objectsPerPage )
- {
- const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation
- + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage;
- BatchInfo *batch = static_cast<BatchInfo*>( malloc( mallocSize ) );
- batch->next_ = 0;
- batch->used_ = batch->buffer_;
- batch->end_ = batch->buffer_ + objectsPerPage;
- return batch;
- }
-
- BatchInfo *batches_;
- BatchInfo *currentBatch_;
- /// Head of a single linked list within the allocated space of freeed object
- AllocatedType *freeHead_;
- unsigned int objectsPerPage_;
+ struct BatchInfo
+ {
+ BatchInfo *next_;
+ AllocatedType *used_;
+ AllocatedType *end_;
+ AllocatedType buffer_[objectPerAllocation];
+ };
+
+ // disabled copy constructor and assignement operator.
+ BatchAllocator( const BatchAllocator & );
+ void operator =( const BatchAllocator &);
+
+ static BatchInfo *allocateBatch( unsigned int objectsPerPage )
+ {
+ const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation
+ + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage;
+ BatchInfo *batch = static_cast<BatchInfo*>( malloc( mallocSize ) );
+ batch->next_ = 0;
+ batch->used_ = batch->buffer_;
+ batch->end_ = batch->buffer_ + objectsPerPage;
+ return batch;
+ }
+
+ BatchInfo *batches_;
+ BatchInfo *currentBatch_;
+ /// Head of a single linked list within the allocated space of freeed object
+ AllocatedType *freeHead_;
+ unsigned int objectsPerPage_;
};
@@ -127,4 +126,3 @@ private:
# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION
#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED
-
diff --git a/src/lib/web/json/json_tool.h b/src/lib/web/json/json_tool.h
index 658031bbba3..9ad8b0cb95c 100644
--- a/src/lib/web/json/json_tool.h
+++ b/src/lib/web/json/json_tool.h
@@ -13,57 +13,56 @@
*/
namespace Json {
-
/// Converts a unicode code-point to UTF-8.
-static inline std::string
+static inline std::string
codePointToUTF8(unsigned int cp)
{
- std::string result;
-
- // based on description from http://en.wikipedia.org/wiki/UTF-8
+ std::string result;
+
+ // based on description from http://en.wikipedia.org/wiki/UTF-8
- if (cp <= 0x7f)
- {
- result.resize(1);
- result[0] = static_cast<char>(cp);
- }
- else if (cp <= 0x7FF)
- {
- result.resize(2);
- result[1] = static_cast<char>(0x80 | (0x3f & cp));
- result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
- }
- else if (cp <= 0xFFFF)
- {
- result.resize(3);
- result[2] = static_cast<char>(0x80 | (0x3f & cp));
- result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6)));
- result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12)));
- }
- else if (cp <= 0x10FFFF)
- {
- result.resize(4);
- result[3] = static_cast<char>(0x80 | (0x3f & cp));
- result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
- result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
- result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
- }
+ if (cp <= 0x7f)
+ {
+ result.resize(1);
+ result[0] = static_cast<char>(cp);
+ }
+ else if (cp <= 0x7FF)
+ {
+ result.resize(2);
+ result[1] = static_cast<char>(0x80 | (0x3f & cp));
+ result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
+ }
+ else if (cp <= 0xFFFF)
+ {
+ result.resize(3);
+ result[2] = static_cast<char>(0x80 | (0x3f & cp));
+ result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6)));
+ result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12)));
+ }
+ else if (cp <= 0x10FFFF)
+ {
+ result.resize(4);
+ result[3] = static_cast<char>(0x80 | (0x3f & cp));
+ result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
+ result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
+ result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
+ }
- return result;
+ return result;
}
/// Returns true if ch is a control character (in range [0,32[).
-static inline bool
+static inline bool
isControlCharacter(char ch)
{
- return ch > 0 && ch <= 0x1F;
+ return ch > 0 && ch <= 0x1F;
}
-enum {
- /// Constant that specify the size of the buffer that must be passed to uintToString.
- uintToStringBufferSize = 3*sizeof(LargestUInt)+1
+enum {
+ /// Constant that specify the size of the buffer that must be passed to uintToString.
+ uintToStringBufferSize = 3*sizeof(LargestUInt)+1
};
// Defines a char buffer for use with uintToString().
@@ -72,22 +71,21 @@ typedef char UIntToStringBuffer[uintToStringBufferSize];
/** Converts an unsigned integer to string.
* @param value Unsigned interger to convert to string
- * @param current Input/Output string buffer.
+ * @param current Input/Output string buffer.
* Must have at least uintToStringBufferSize chars free.
*/
-static inline void
-uintToString( LargestUInt value,
- char *&current )
+static inline void
+uintToString( LargestUInt value,
+ char *&current )
{
- *--current = 0;
- do
- {
- *--current = char(value % 10) + '0';
- value /= 10;
- }
- while ( value != 0 );
+ *--current = 0;
+ do
+ {
+ *--current = char(value % 10) + '0';
+ value /= 10;
+ }
+ while ( value != 0 );
}
} // namespace Json {
-
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
diff --git a/src/lib/web/json/reader.h b/src/lib/web/json/reader.h
index 0a324dfc5c8..270a0901e04 100644
--- a/src/lib/web/json/reader.h
+++ b/src/lib/web/json/reader.h
@@ -16,198 +16,197 @@
# include <iostream>
namespace Json {
-
- /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
- *
- */
- class JSON_API Reader
- {
- public:
- typedef char Char;
- typedef const Char *Location;
-
- /** \brief Constructs a Reader allowing all features
- * for parsing.
- */
- Reader();
-
- /** \brief Constructs a Reader allowing the specified feature set
- * for parsing.
- */
- Reader( const Features &features );
-
- /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
- * \param document UTF-8 encoded string containing the document to read.
- * \param root [out] Contains the root value of the document if it was
- * successfully parsed.
- * \param collectComments \c true to collect comment and allow writing them back during
- * serialization, \c false to discard comments.
- * This parameter is ignored if Features::allowComments_
- * is \c false.
- * \return \c true if the document was successfully parsed, \c false if an error occurred.
- */
- bool parse( const std::string &document,
- Value &root,
- bool collectComments = true );
-
- /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
- * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read.
- * \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read.
- \ Must be >= beginDoc.
- * \param root [out] Contains the root value of the document if it was
- * successfully parsed.
- * \param collectComments \c true to collect comment and allow writing them back during
- * serialization, \c false to discard comments.
- * This parameter is ignored if Features::allowComments_
- * is \c false.
- * \return \c true if the document was successfully parsed, \c false if an error occurred.
- */
- bool parse( const char *beginDoc, const char *endDoc,
- Value &root,
- bool collectComments = true );
-
- /// \brief Parse from input stream.
- /// \see Json::operator>>(std::istream&, Json::Value&).
- bool parse( std::istream &is,
- Value &root,
- bool collectComments = true );
-
- /** \brief Returns a user friendly string that list errors in the parsed document.
- * \return Formatted error message with the list of errors with their location in
- * the parsed document. An empty string is returned if no error occurred
- * during parsing.
- * \deprecated Use getFormattedErrorMessages() instead (typo fix).
- */
- JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead")
- std::string getFormatedErrorMessages() const;
-
- /** \brief Returns a user friendly string that list errors in the parsed document.
- * \return Formatted error message with the list of errors with their location in
- * the parsed document. An empty string is returned if no error occurred
- * during parsing.
- */
- std::string getFormattedErrorMessages() const;
-
- private:
- enum TokenType
- {
- tokenEndOfStream = 0,
- tokenObjectBegin,
- tokenObjectEnd,
- tokenArrayBegin,
- tokenArrayEnd,
- tokenString,
- tokenNumber,
- tokenTrue,
- tokenFalse,
- tokenNull,
- tokenArraySeparator,
- tokenMemberSeparator,
- tokenComment,
- tokenError
- };
-
- class Token
- {
- public:
- TokenType type_;
- Location start_;
- Location end_;
- };
-
- class ErrorInfo
- {
- public:
- Token token_;
- std::string message_;
- Location extra_;
- };
-
- typedef std::deque<ErrorInfo> Errors;
-
- bool expectToken( TokenType type, Token &token, const char *message );
- bool readToken( Token &token );
- void skipSpaces();
- bool match( Location pattern,
- int patternLength );
- bool readComment();
- bool readCStyleComment();
- bool readCppStyleComment();
- bool readString();
- void readNumber();
- bool readValue();
- bool readObject( Token &token );
- bool readArray( Token &token );
- bool decodeNumber( Token &token );
- bool decodeString( Token &token );
- bool decodeString( Token &token, std::string &decoded );
- bool decodeDouble( Token &token );
- bool decodeUnicodeCodePoint( Token &token,
- Location &current,
- Location end,
- unsigned int &unicode );
- bool decodeUnicodeEscapeSequence( Token &token,
- Location &current,
- Location end,
- unsigned int &unicode );
- bool addError( const std::string &message,
- Token &token,
- Location extra = 0 );
- bool recoverFromError( TokenType skipUntilToken );
- bool addErrorAndRecover( const std::string &message,
- Token &token,
- TokenType skipUntilToken );
- void skipUntilSpace();
- Value &currentValue();
- Char getNextChar();
- void getLocationLineAndColumn( Location location,
- int &line,
- int &column ) const;
- std::string getLocationLineAndColumn( Location location ) const;
- void addComment( Location begin,
- Location end,
- CommentPlacement placement );
- void skipCommentTokens( Token &token );
-
- typedef std::stack<Value *> Nodes;
- Nodes nodes_;
- Errors errors_;
- std::string document_;
- Location begin_;
- Location end_;
- Location current_;
- Location lastValueEnd_;
- Value *lastValue_;
- std::string commentsBefore_;
- Features features_;
- bool collectComments_;
- };
-
- /** \brief Read from 'sin' into 'root'.
-
- Always keep comments from the input JSON.
-
- This can be used to read a file into a particular sub-object.
- For example:
- \code
- Json::Value root;
- cin >> root["dir"]["file"];
- cout << root;
- \endcode
- Result:
- \verbatim
- {
- "dir": {
- "file": {
- // The input stream JSON would be nested here.
- }
- }
- }
- \endverbatim
- \throw std::exception on parse error.
- \see Json::operator<<()
- */
- std::istream& operator>>( std::istream&, Value& );
+ /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
+ *
+ */
+ class JSON_API Reader
+ {
+ public:
+ typedef char Char;
+ typedef const Char *Location;
+
+ /** \brief Constructs a Reader allowing all features
+ * for parsing.
+ */
+ Reader();
+
+ /** \brief Constructs a Reader allowing the specified feature set
+ * for parsing.
+ */
+ Reader( const Features &features );
+
+ /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
+ * \param document UTF-8 encoded string containing the document to read.
+ * \param root [out] Contains the root value of the document if it was
+ * successfully parsed.
+ * \param collectComments \c true to collect comment and allow writing them back during
+ * serialization, \c false to discard comments.
+ * This parameter is ignored if Features::allowComments_
+ * is \c false.
+ * \return \c true if the document was successfully parsed, \c false if an error occurred.
+ */
+ bool parse( const std::string &document,
+ Value &root,
+ bool collectComments = true );
+
+ /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
+ * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read.
+ * \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read.
+ \ Must be >= beginDoc.
+ * \param root [out] Contains the root value of the document if it was
+ * successfully parsed.
+ * \param collectComments \c true to collect comment and allow writing them back during
+ * serialization, \c false to discard comments.
+ * This parameter is ignored if Features::allowComments_
+ * is \c false.
+ * \return \c true if the document was successfully parsed, \c false if an error occurred.
+ */
+ bool parse( const char *beginDoc, const char *endDoc,
+ Value &root,
+ bool collectComments = true );
+
+ /// \brief Parse from input stream.
+ /// \see Json::operator>>(std::istream&, Json::Value&).
+ bool parse( std::istream &is,
+ Value &root,
+ bool collectComments = true );
+
+ /** \brief Returns a user friendly string that list errors in the parsed document.
+ * \return Formatted error message with the list of errors with their location in
+ * the parsed document. An empty string is returned if no error occurred
+ * during parsing.
+ * \deprecated Use getFormattedErrorMessages() instead (typo fix).
+ */
+ JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead")
+ std::string getFormatedErrorMessages() const;
+
+ /** \brief Returns a user friendly string that list errors in the parsed document.
+ * \return Formatted error message with the list of errors with their location in
+ * the parsed document. An empty string is returned if no error occurred
+ * during parsing.
+ */
+ std::string getFormattedErrorMessages() const;
+
+ private:
+ enum TokenType
+ {
+ tokenEndOfStream = 0,
+ tokenObjectBegin,
+ tokenObjectEnd,
+ tokenArrayBegin,
+ tokenArrayEnd,
+ tokenString,
+ tokenNumber,
+ tokenTrue,
+ tokenFalse,
+ tokenNull,
+ tokenArraySeparator,
+ tokenMemberSeparator,
+ tokenComment,
+ tokenError
+ };
+
+ class Token
+ {
+ public:
+ TokenType type_;
+ Location start_;
+ Location end_;
+ };
+
+ class ErrorInfo
+ {
+ public:
+ Token token_;
+ std::string message_;
+ Location extra_;
+ };
+
+ typedef std::deque<ErrorInfo> Errors;
+
+ bool expectToken( TokenType type, Token &token, const char *message );
+ bool readToken( Token &token );
+ void skipSpaces();
+ bool match( Location pattern,
+ int patternLength );
+ bool readComment();
+ bool readCStyleComment();
+ bool readCppStyleComment();
+ bool readString();
+ void readNumber();
+ bool readValue();
+ bool readObject( Token &token );
+ bool readArray( Token &token );
+ bool decodeNumber( Token &token );
+ bool decodeString( Token &token );
+ bool decodeString( Token &token, std::string &decoded );
+ bool decodeDouble( Token &token );
+ bool decodeUnicodeCodePoint( Token &token,
+ Location &current,
+ Location end,
+ unsigned int &unicode );
+ bool decodeUnicodeEscapeSequence( Token &token,
+ Location &current,
+ Location end,
+ unsigned int &unicode );
+ bool addError( const std::string &message,
+ Token &token,
+ Location extra = 0 );
+ bool recoverFromError( TokenType skipUntilToken );
+ bool addErrorAndRecover( const std::string &message,
+ Token &token,
+ TokenType skipUntilToken );
+ void skipUntilSpace();
+ Value &currentValue();
+ Char getNextChar();
+ void getLocationLineAndColumn( Location location,
+ int &line,
+ int &column ) const;
+ std::string getLocationLineAndColumn( Location location ) const;
+ void addComment( Location begin,
+ Location end,
+ CommentPlacement placement );
+ void skipCommentTokens( Token &token );
+
+ typedef std::stack<Value *> Nodes;
+ Nodes nodes_;
+ Errors errors_;
+ std::string document_;
+ Location begin_;
+ Location end_;
+ Location current_;
+ Location lastValueEnd_;
+ Value *lastValue_;
+ std::string commentsBefore_;
+ Features features_;
+ bool collectComments_;
+ };
+
+ /** \brief Read from 'sin' into 'root'.
+
+ Always keep comments from the input JSON.
+
+ This can be used to read a file into a particular sub-object.
+ For example:
+ \code
+ Json::Value root;
+ cin >> root["dir"]["file"];
+ cout << root;
+ \endcode
+ Result:
+ \verbatim
+ {
+ "dir": {
+ "file": {
+ // The input stream JSON would be nested here.
+ }
+ }
+ }
+ \endverbatim
+ \throw std::exception on parse error.
+ \see Json::operator<<()
+ */
+ std::istream& operator>>( std::istream&, Value& );
} // namespace Json
diff --git a/src/lib/web/json/value.h b/src/lib/web/json/value.h
index 32e3455ec6c..2d67c8cf600 100644
--- a/src/lib/web/json/value.h
+++ b/src/lib/web/json/value.h
@@ -24,1077 +24,1076 @@
/** \brief JSON (JavaScript Object Notation).
*/
namespace Json {
-
- /** \brief Type of the value held by a Value object.
- */
- enum ValueType
- {
- nullValue = 0, ///< 'null' value
- intValue, ///< signed integer value
- uintValue, ///< unsigned integer value
- realValue, ///< double value
- stringValue, ///< UTF-8 string value
- booleanValue, ///< bool value
- arrayValue, ///< array value (ordered list)
- objectValue ///< object value (collection of name/value pairs).
- };
-
- enum CommentPlacement
- {
- commentBefore = 0, ///< a comment placed on the line before a value
- commentAfterOnSameLine, ///< a comment just after a value on the same line
- commentAfter, ///< a comment on the line after a value (only make sense for root value)
- numberOfCommentPlacement
- };
+ /** \brief Type of the value held by a Value object.
+ */
+ enum ValueType
+ {
+ nullValue = 0, ///< 'null' value
+ intValue, ///< signed integer value
+ uintValue, ///< unsigned integer value
+ realValue, ///< double value
+ stringValue, ///< UTF-8 string value
+ booleanValue, ///< bool value
+ arrayValue, ///< array value (ordered list)
+ objectValue ///< object value (collection of name/value pairs).
+ };
+
+ enum CommentPlacement
+ {
+ commentBefore = 0, ///< a comment placed on the line before a value
+ commentAfterOnSameLine, ///< a comment just after a value on the same line
+ commentAfter, ///< a comment on the line after a value (only make sense for root value)
+ numberOfCommentPlacement
+ };
//# ifdef JSON_USE_CPPTL
// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
//# endif
- /** \brief Lightweight wrapper to tag static string.
- *
- * Value constructor and objectValue member assignement takes advantage of the
- * StaticString and avoid the cost of string duplication when storing the
- * string or the member name.
- *
- * Example of usage:
- * \code
- * Json::Value aValue( StaticString("some text") );
- * Json::Value object;
- * static const StaticString code("code");
- * object[code] = 1234;
- * \endcode
- */
- class JSON_API StaticString
- {
- public:
- explicit StaticString( const char *czstring )
- : str_( czstring )
- {
- }
-
- operator const char *() const
- {
- return str_;
- }
-
- const char *c_str() const
- {
- return str_;
- }
-
- private:
- const char *str_;
- };
-
- /** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
- *
- * This class is a discriminated union wrapper that can represents a:
- * - signed integer [range: Value::minInt - Value::maxInt]
- * - unsigned integer (range: 0 - Value::maxUInt)
- * - double
- * - UTF-8 string
- * - boolean
- * - 'null'
- * - an ordered list of Value
- * - collection of name/value pairs (javascript object)
- *
- * The type of the held value is represented by a #ValueType and
- * can be obtained using type().
- *
- * values of an #objectValue or #arrayValue can be accessed using operator[]() methods.
- * Non const methods will automatically create the a #nullValue element
- * if it does not exist.
- * The sequence of an #arrayValue will be automatically resize and initialized
- * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
- *
- * The get() methods can be used to obtanis default value in the case the required element
- * does not exist.
- *
- * It is possible to iterate over the list of a #objectValue values using
- * the getMemberNames() method.
- */
- class JSON_API Value
- {
- friend class ValueIteratorBase;
+ /** \brief Lightweight wrapper to tag static string.
+ *
+ * Value constructor and objectValue member assignement takes advantage of the
+ * StaticString and avoid the cost of string duplication when storing the
+ * string or the member name.
+ *
+ * Example of usage:
+ * \code
+ * Json::Value aValue( StaticString("some text") );
+ * Json::Value object;
+ * static const StaticString code("code");
+ * object[code] = 1234;
+ * \endcode
+ */
+ class JSON_API StaticString
+ {
+ public:
+ explicit StaticString( const char *czstring )
+ : str_( czstring )
+ {
+ }
+
+ operator const char *() const
+ {
+ return str_;
+ }
+
+ const char *c_str() const
+ {
+ return str_;
+ }
+
+ private:
+ const char *str_;
+ };
+
+ /** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
+ *
+ * This class is a discriminated union wrapper that can represents a:
+ * - signed integer [range: Value::minInt - Value::maxInt]
+ * - unsigned integer (range: 0 - Value::maxUInt)
+ * - double
+ * - UTF-8 string
+ * - boolean
+ * - 'null'
+ * - an ordered list of Value
+ * - collection of name/value pairs (javascript object)
+ *
+ * The type of the held value is represented by a #ValueType and
+ * can be obtained using type().
+ *
+ * values of an #objectValue or #arrayValue can be accessed using operator[]() methods.
+ * Non const methods will automatically create the a #nullValue element
+ * if it does not exist.
+ * The sequence of an #arrayValue will be automatically resize and initialized
+ * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
+ *
+ * The get() methods can be used to obtanis default value in the case the required element
+ * does not exist.
+ *
+ * It is possible to iterate over the list of a #objectValue values using
+ * the getMemberNames() method.
+ */
+ class JSON_API Value
+ {
+ friend class ValueIteratorBase;
# ifdef JSON_VALUE_USE_INTERNAL_MAP
- friend class ValueInternalLink;
- friend class ValueInternalMap;
+ friend class ValueInternalLink;
+ friend class ValueInternalMap;
# endif
- public:
- typedef std::vector<std::string> Members;
- typedef ValueIterator iterator;
- typedef ValueConstIterator const_iterator;
- typedef Json::UInt UInt;
- typedef Json::Int Int;
+ public:
+ typedef std::vector<std::string> Members;
+ typedef ValueIterator iterator;
+ typedef ValueConstIterator const_iterator;
+ typedef Json::UInt UInt;
+ typedef Json::Int Int;
# if defined(JSON_HAS_INT64)
- typedef Json::UInt64 UInt64;
- typedef Json::Int64 Int64;
+ typedef Json::UInt64 UInt64;
+ typedef Json::Int64 Int64;
#endif // defined(JSON_HAS_INT64)
- typedef Json::LargestInt LargestInt;
- typedef Json::LargestUInt LargestUInt;
- typedef Json::ArrayIndex ArrayIndex;
-
- static const Value null;
- /// Minimum signed integer value that can be stored in a Json::Value.
- static const LargestInt minLargestInt;
- /// Maximum signed integer value that can be stored in a Json::Value.
- static const LargestInt maxLargestInt;
- /// Maximum unsigned integer value that can be stored in a Json::Value.
- static const LargestUInt maxLargestUInt;
-
- /// Minimum signed int value that can be stored in a Json::Value.
- static const Int minInt;
- /// Maximum signed int value that can be stored in a Json::Value.
- static const Int maxInt;
- /// Maximum unsigned int value that can be stored in a Json::Value.
- static const UInt maxUInt;
-
- /// Minimum signed 64 bits int value that can be stored in a Json::Value.
- static const Int64 minInt64;
- /// Maximum signed 64 bits int value that can be stored in a Json::Value.
- static const Int64 maxInt64;
- /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
- static const UInt64 maxUInt64;
-
- private:
+ typedef Json::LargestInt LargestInt;
+ typedef Json::LargestUInt LargestUInt;
+ typedef Json::ArrayIndex ArrayIndex;
+
+ static const Value null;
+ /// Minimum signed integer value that can be stored in a Json::Value.
+ static const LargestInt minLargestInt;
+ /// Maximum signed integer value that can be stored in a Json::Value.
+ static const LargestInt maxLargestInt;
+ /// Maximum unsigned integer value that can be stored in a Json::Value.
+ static const LargestUInt maxLargestUInt;
+
+ /// Minimum signed int value that can be stored in a Json::Value.
+ static const Int minInt;
+ /// Maximum signed int value that can be stored in a Json::Value.
+ static const Int maxInt;
+ /// Maximum unsigned int value that can be stored in a Json::Value.
+ static const UInt maxUInt;
+
+ /// Minimum signed 64 bits int value that can be stored in a Json::Value.
+ static const Int64 minInt64;
+ /// Maximum signed 64 bits int value that can be stored in a Json::Value.
+ static const Int64 maxInt64;
+ /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
+ static const UInt64 maxUInt64;
+
+ private:
#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
# ifndef JSON_VALUE_USE_INTERNAL_MAP
- class CZString
- {
- public:
- enum DuplicationPolicy
- {
- noDuplication = 0,
- duplicate,
- duplicateOnCopy
- };
- CZString( ArrayIndex index );
- CZString( const char *cstr, DuplicationPolicy allocate );
- CZString( const CZString &other );
- ~CZString();
- CZString &operator =( const CZString &other );
- bool operator<( const CZString &other ) const;
- bool operator==( const CZString &other ) const;
- ArrayIndex index() const;
- const char *c_str() const;
- bool isStaticString() const;
- private:
- void swap( CZString &other );
- const char *cstr_;
- ArrayIndex index_;
- };
-
- public:
+ class CZString
+ {
+ public:
+ enum DuplicationPolicy
+ {
+ noDuplication = 0,
+ duplicate,
+ duplicateOnCopy
+ };
+ CZString( ArrayIndex index );
+ CZString( const char *cstr, DuplicationPolicy allocate );
+ CZString( const CZString &other );
+ ~CZString();
+ CZString &operator =( const CZString &other );
+ bool operator<( const CZString &other ) const;
+ bool operator==( const CZString &other ) const;
+ ArrayIndex index() const;
+ const char *c_str() const;
+ bool isStaticString() const;
+ private:
+ void swap( CZString &other );
+ const char *cstr_;
+ ArrayIndex index_;
+ };
+
+ public:
# ifndef JSON_USE_CPPTL_SMALLMAP
- typedef std::map<CZString, Value> ObjectValues;
+ typedef std::map<CZString, Value> ObjectValues;
# else
- typedef CppTL::SmallMap<CZString, Value> ObjectValues;
+ typedef CppTL::SmallMap<CZString, Value> ObjectValues;
# endif // ifndef JSON_USE_CPPTL_SMALLMAP
# endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- public:
- /** \brief Create a default Value of the given type.
-
- This is a very useful constructor.
- To create an empty array, pass arrayValue.
- To create an empty object, pass objectValue.
- Another Value can then be set to this one by assignment.
- This is useful since clear() and resize() will not alter types.
-
- Examples:
- \code
- Json::Value null_value; // null
- Json::Value arr_value(Json::arrayValue); // []
- Json::Value obj_value(Json::objectValue); // {}
- \endcode
- */
- Value( ValueType type = nullValue );
- Value( Int value );
- Value( UInt value );
+ public:
+ /** \brief Create a default Value of the given type.
+
+ This is a very useful constructor.
+ To create an empty array, pass arrayValue.
+ To create an empty object, pass objectValue.
+ Another Value can then be set to this one by assignment.
+ This is useful since clear() and resize() will not alter types.
+
+ Examples:
+ \code
+ Json::Value null_value; // null
+ Json::Value arr_value(Json::arrayValue); // []
+ Json::Value obj_value(Json::objectValue); // {}
+ \endcode
+ */
+ Value( ValueType type = nullValue );
+ Value( Int value );
+ Value( UInt value );
#if defined(JSON_HAS_INT64)
- Value( Int64 value );
- Value( UInt64 value );
+ Value( Int64 value );
+ Value( UInt64 value );
#endif // if defined(JSON_HAS_INT64)
- Value( double value );
- Value( const char *value );
- Value( const char *beginValue, const char *endValue );
- /** \brief Constructs a value from a static string.
-
- * Like other value string constructor but do not duplicate the string for
- * internal storage. The given string must remain alive after the call to this
- * constructor.
- * Example of usage:
- * \code
- * Json::Value aValue( StaticString("some text") );
- * \endcode
- */
- Value( const StaticString &value );
- Value( const std::string &value );
+ Value( double value );
+ Value( const char *value );
+ Value( const char *beginValue, const char *endValue );
+ /** \brief Constructs a value from a static string.
+
+ * Like other value string constructor but do not duplicate the string for
+ * internal storage. The given string must remain alive after the call to this
+ * constructor.
+ * Example of usage:
+ * \code
+ * Json::Value aValue( StaticString("some text") );
+ * \endcode
+ */
+ Value( const StaticString &value );
+ Value( const std::string &value );
# ifdef JSON_USE_CPPTL
- Value( const CppTL::ConstString &value );
+ Value( const CppTL::ConstString &value );
# endif
- Value( bool value );
- Value( const Value &other );
- ~Value();
+ Value( bool value );
+ Value( const Value &other );
+ ~Value();
- Value &operator=( const Value &other );
- /// Swap values.
- /// \note Currently, comments are intentionally not swapped, for
- /// both logic and efficiency.
- void swap( Value &other );
+ Value &operator=( const Value &other );
+ /// Swap values.
+ /// \note Currently, comments are intentionally not swapped, for
+ /// both logic and efficiency.
+ void swap( Value &other );
- ValueType type() const;
+ ValueType type() const;
- bool operator <( const Value &other ) const;
- bool operator <=( const Value &other ) const;
- bool operator >=( const Value &other ) const;
- bool operator >( const Value &other ) const;
+ bool operator <( const Value &other ) const;
+ bool operator <=( const Value &other ) const;
+ bool operator >=( const Value &other ) const;
+ bool operator >( const Value &other ) const;
- bool operator ==( const Value &other ) const;
- bool operator !=( const Value &other ) const;
+ bool operator ==( const Value &other ) const;
+ bool operator !=( const Value &other ) const;
- int compare( const Value &other ) const;
+ int compare( const Value &other ) const;
- const char *asCString() const;
- std::string asString() const;
+ const char *asCString() const;
+ std::string asString() const;
# ifdef JSON_USE_CPPTL
- CppTL::ConstString asConstString() const;
+ CppTL::ConstString asConstString() const;
# endif
- Int asInt() const;
- UInt asUInt() const;
- Int64 asInt64() const;
- UInt64 asUInt64() const;
- LargestInt asLargestInt() const;
- LargestUInt asLargestUInt() const;
- float asFloat() const;
- double asDouble() const;
- bool asBool() const;
-
- bool isNull() const;
- bool isBool() const;
- bool isInt() const;
- bool isUInt() const;
- bool isIntegral() const;
- bool isDouble() const;
- bool isNumeric() const;
- bool isString() const;
- bool isArray() const;
- bool isObject() const;
-
- bool isConvertibleTo( ValueType other ) const;
-
- /// Number of values in array or object
- ArrayIndex size() const;
-
- /// \brief Return true if empty array, empty object, or null;
- /// otherwise, false.
- bool empty() const;
-
- /// Return isNull()
- bool operator!() const;
-
- /// Remove all object members and array elements.
- /// \pre type() is arrayValue, objectValue, or nullValue
- /// \post type() is unchanged
- void clear();
-
- /// Resize the array to size elements.
- /// New elements are initialized to null.
- /// May only be called on nullValue or arrayValue.
- /// \pre type() is arrayValue or nullValue
- /// \post type() is arrayValue
- void resize( ArrayIndex size );
-
- /// Access an array element (zero based index ).
- /// If the array contains less than index element, then null value are inserted
- /// in the array so that its size is index+1.
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- Value &operator[]( ArrayIndex index );
-
- /// Access an array element (zero based index ).
- /// If the array contains less than index element, then null value are inserted
- /// in the array so that its size is index+1.
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- Value &operator[]( int index );
-
- /// Access an array element (zero based index )
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- const Value &operator[]( ArrayIndex index ) const;
-
- /// Access an array element (zero based index )
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- const Value &operator[]( int index ) const;
-
- /// If the array contains at least index+1 elements, returns the element value,
- /// otherwise returns defaultValue.
- Value get( ArrayIndex index,
- const Value &defaultValue ) const;
- /// Return true if index < size().
- bool isValidIndex( ArrayIndex index ) const;
- /// \brief Append value to array at the end.
- ///
- /// Equivalent to jsonvalue[jsonvalue.size()] = value;
- Value &append( const Value &value );
-
- /// Access an object value by name, create a null member if it does not exist.
- Value &operator[]( const char *key );
- /// Access an object value by name, returns null if there is no member with that name.
- const Value &operator[]( const char *key ) const;
- /// Access an object value by name, create a null member if it does not exist.
- Value &operator[]( const std::string &key );
- /// Access an object value by name, returns null if there is no member with that name.
- const Value &operator[]( const std::string &key ) const;
- /** \brief Access an object value by name, create a null member if it does not exist.
-
- * If the object as no entry for that name, then the member name used to store
- * the new entry is not duplicated.
- * Example of use:
- * \code
- * Json::Value object;
- * static const StaticString code("code");
- * object[code] = 1234;
- * \endcode
- */
- Value &operator[]( const StaticString &key );
+ Int asInt() const;
+ UInt asUInt() const;
+ Int64 asInt64() const;
+ UInt64 asUInt64() const;
+ LargestInt asLargestInt() const;
+ LargestUInt asLargestUInt() const;
+ float asFloat() const;
+ double asDouble() const;
+ bool asBool() const;
+
+ bool isNull() const;
+ bool isBool() const;
+ bool isInt() const;
+ bool isUInt() const;
+ bool isIntegral() const;
+ bool isDouble() const;
+ bool isNumeric() const;
+ bool isString() const;
+ bool isArray() const;
+ bool isObject() const;
+
+ bool isConvertibleTo( ValueType other ) const;
+
+ /// Number of values in array or object
+ ArrayIndex size() const;
+
+ /// \brief Return true if empty array, empty object, or null;
+ /// otherwise, false.
+ bool empty() const;
+
+ /// Return isNull()
+ bool operator!() const;
+
+ /// Remove all object members and array elements.
+ /// \pre type() is arrayValue, objectValue, or nullValue
+ /// \post type() is unchanged
+ void clear();
+
+ /// Resize the array to size elements.
+ /// New elements are initialized to null.
+ /// May only be called on nullValue or arrayValue.
+ /// \pre type() is arrayValue or nullValue
+ /// \post type() is arrayValue
+ void resize( ArrayIndex size );
+
+ /// Access an array element (zero based index ).
+ /// If the array contains less than index element, then null value are inserted
+ /// in the array so that its size is index+1.
+ /// (You may need to say 'value[0u]' to get your compiler to distinguish
+ /// this from the operator[] which takes a string.)
+ Value &operator[]( ArrayIndex index );
+
+ /// Access an array element (zero based index ).
+ /// If the array contains less than index element, then null value are inserted
+ /// in the array so that its size is index+1.
+ /// (You may need to say 'value[0u]' to get your compiler to distinguish
+ /// this from the operator[] which takes a string.)
+ Value &operator[]( int index );
+
+ /// Access an array element (zero based index )
+ /// (You may need to say 'value[0u]' to get your compiler to distinguish
+ /// this from the operator[] which takes a string.)
+ const Value &operator[]( ArrayIndex index ) const;
+
+ /// Access an array element (zero based index )
+ /// (You may need to say 'value[0u]' to get your compiler to distinguish
+ /// this from the operator[] which takes a string.)
+ const Value &operator[]( int index ) const;
+
+ /// If the array contains at least index+1 elements, returns the element value,
+ /// otherwise returns defaultValue.
+ Value get( ArrayIndex index,
+ const Value &defaultValue ) const;
+ /// Return true if index < size().
+ bool isValidIndex( ArrayIndex index ) const;
+ /// \brief Append value to array at the end.
+ ///
+ /// Equivalent to jsonvalue[jsonvalue.size()] = value;
+ Value &append( const Value &value );
+
+ /// Access an object value by name, create a null member if it does not exist.
+ Value &operator[]( const char *key );
+ /// Access an object value by name, returns null if there is no member with that name.
+ const Value &operator[]( const char *key ) const;
+ /// Access an object value by name, create a null member if it does not exist.
+ Value &operator[]( const std::string &key );
+ /// Access an object value by name, returns null if there is no member with that name.
+ const Value &operator[]( const std::string &key ) const;
+ /** \brief Access an object value by name, create a null member if it does not exist.
+
+ * If the object as no entry for that name, then the member name used to store
+ * the new entry is not duplicated.
+ * Example of use:
+ * \code
+ * Json::Value object;
+ * static const StaticString code("code");
+ * object[code] = 1234;
+ * \endcode
+ */
+ Value &operator[]( const StaticString &key );
# ifdef JSON_USE_CPPTL
- /// Access an object value by name, create a null member if it does not exist.
- Value &operator[]( const CppTL::ConstString &key );
- /// Access an object value by name, returns null if there is no member with that name.
- const Value &operator[]( const CppTL::ConstString &key ) const;
+ /// Access an object value by name, create a null member if it does not exist.
+ Value &operator[]( const CppTL::ConstString &key );
+ /// Access an object value by name, returns null if there is no member with that name.
+ const Value &operator[]( const CppTL::ConstString &key ) const;
# endif
- /// Return the member named key if it exist, defaultValue otherwise.
- Value get( const char *key,
- const Value &defaultValue ) const;
- /// Return the member named key if it exist, defaultValue otherwise.
- Value get( const std::string &key,
- const Value &defaultValue ) const;
+ /// Return the member named key if it exist, defaultValue otherwise.
+ Value get( const char *key,
+ const Value &defaultValue ) const;
+ /// Return the member named key if it exist, defaultValue otherwise.
+ Value get( const std::string &key,
+ const Value &defaultValue ) const;
# ifdef JSON_USE_CPPTL
- /// Return the member named key if it exist, defaultValue otherwise.
- Value get( const CppTL::ConstString &key,
- const Value &defaultValue ) const;
+ /// Return the member named key if it exist, defaultValue otherwise.
+ Value get( const CppTL::ConstString &key,
+ const Value &defaultValue ) const;
# endif
- /// \brief Remove and return the named member.
- ///
- /// Do nothing if it did not exist.
- /// \return the removed Value, or null.
- /// \pre type() is objectValue or nullValue
- /// \post type() is unchanged
- Value removeMember( const char* key );
- /// Same as removeMember(const char*)
- Value removeMember( const std::string &key );
-
- /// Return true if the object has a member named key.
- bool isMember( const char *key ) const;
- /// Return true if the object has a member named key.
- bool isMember( const std::string &key ) const;
+ /// \brief Remove and return the named member.
+ ///
+ /// Do nothing if it did not exist.
+ /// \return the removed Value, or null.
+ /// \pre type() is objectValue or nullValue
+ /// \post type() is unchanged
+ Value removeMember( const char* key );
+ /// Same as removeMember(const char*)
+ Value removeMember( const std::string &key );
+
+ /// Return true if the object has a member named key.
+ bool isMember( const char *key ) const;
+ /// Return true if the object has a member named key.
+ bool isMember( const std::string &key ) const;
# ifdef JSON_USE_CPPTL
- /// Return true if the object has a member named key.
- bool isMember( const CppTL::ConstString &key ) const;
+ /// Return true if the object has a member named key.
+ bool isMember( const CppTL::ConstString &key ) const;
# endif
- /// \brief Return a list of the member names.
- ///
- /// If null, return an empty list.
- /// \pre type() is objectValue or nullValue
- /// \post if type() was nullValue, it remains nullValue
- Members getMemberNames() const;
+ /// \brief Return a list of the member names.
+ ///
+ /// If null, return an empty list.
+ /// \pre type() is objectValue or nullValue
+ /// \post if type() was nullValue, it remains nullValue
+ Members getMemberNames() const;
//# ifdef JSON_USE_CPPTL
// EnumMemberNames enumMemberNames() const;
// EnumValues enumValues() const;
//# endif
- /// Comments must be //... or /* ... */
- void setComment( const char *comment,
- CommentPlacement placement );
- /// Comments must be //... or /* ... */
- void setComment( const std::string &comment,
- CommentPlacement placement );
- bool hasComment( CommentPlacement placement ) const;
- /// Include delimiters and embedded newlines.
- std::string getComment( CommentPlacement placement ) const;
+ /// Comments must be //... or /* ... */
+ void setComment( const char *comment,
+ CommentPlacement placement );
+ /// Comments must be //... or /* ... */
+ void setComment( const std::string &comment,
+ CommentPlacement placement );
+ bool hasComment( CommentPlacement placement ) const;
+ /// Include delimiters and embedded newlines.
+ std::string getComment( CommentPlacement placement ) const;
- std::string toStyledString() const;
+ std::string toStyledString() const;
- const_iterator begin() const;
- const_iterator end() const;
+ const_iterator begin() const;
+ const_iterator end() const;
- iterator begin();
- iterator end();
+ iterator begin();
+ iterator end();
- private:
- Value &resolveReference( const char *key,
- bool isStatic );
+ private:
+ Value &resolveReference( const char *key,
+ bool isStatic );
# ifdef JSON_VALUE_USE_INTERNAL_MAP
- inline bool isItemAvailable() const
- {
- return itemIsUsed_ == 0;
- }
-
- inline void setItemUsed( bool isUsed = true )
- {
- itemIsUsed_ = isUsed ? 1 : 0;
- }
-
- inline bool isMemberNameStatic() const
- {
- return memberNameIsStatic_ == 0;
- }
-
- inline void setMemberNameIsStatic( bool isStatic )
- {
- memberNameIsStatic_ = isStatic ? 1 : 0;
- }
+ inline bool isItemAvailable() const
+ {
+ return itemIsUsed_ == 0;
+ }
+
+ inline void setItemUsed( bool isUsed = true )
+ {
+ itemIsUsed_ = isUsed ? 1 : 0;
+ }
+
+ inline bool isMemberNameStatic() const
+ {
+ return memberNameIsStatic_ == 0;
+ }
+
+ inline void setMemberNameIsStatic( bool isStatic )
+ {
+ memberNameIsStatic_ = isStatic ? 1 : 0;
+ }
# endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP
- private:
- struct CommentInfo
- {
- CommentInfo();
- ~CommentInfo();
-
- void setComment( const char *text );
-
- char *comment_;
- };
-
- //struct MemberNamesTransform
- //{
- // typedef const char *result_type;
- // const char *operator()( const CZString &name ) const
- // {
- // return name.c_str();
- // }
- //};
-
- union ValueHolder
- {
- LargestInt int_;
- LargestUInt uint_;
- double real_;
- bool bool_;
- char *string_;
+ private:
+ struct CommentInfo
+ {
+ CommentInfo();
+ ~CommentInfo();
+
+ void setComment( const char *text );
+
+ char *comment_;
+ };
+
+ //struct MemberNamesTransform
+ //{
+ // typedef const char *result_type;
+ // const char *operator()( const CZString &name ) const
+ // {
+ // return name.c_str();
+ // }
+ //};
+
+ union ValueHolder
+ {
+ LargestInt int_;
+ LargestUInt uint_;
+ double real_;
+ bool bool_;
+ char *string_;
# ifdef JSON_VALUE_USE_INTERNAL_MAP
- ValueInternalArray *array_;
- ValueInternalMap *map_;
+ ValueInternalArray *array_;
+ ValueInternalMap *map_;
#else
- ObjectValues *map_;
+ ObjectValues *map_;
# endif
- } value_;
- ValueType type_ : 8;
- int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
+ } value_;
+ ValueType type_ : 8;
+ int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
# ifdef JSON_VALUE_USE_INTERNAL_MAP
- unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
- int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
+ unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
+ int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
# endif
- CommentInfo *comments_;
- };
-
-
- /** \brief Experimental and untested: represents an element of the "path" to access a node.
- */
- class PathArgument
- {
- public:
- friend class Path;
-
- PathArgument();
- PathArgument( ArrayIndex index );
- PathArgument( const char *key );
- PathArgument( const std::string &key );
-
- private:
- enum Kind
- {
- kindNone = 0,
- kindIndex,
- kindKey
- };
- std::string key_;
- ArrayIndex index_;
- Kind kind_;
- };
-
- /** \brief Experimental and untested: represents a "path" to access a node.
- *
- * Syntax:
- * - "." => root node
- * - ".[n]" => elements at index 'n' of root node (an array value)
- * - ".name" => member named 'name' of root node (an object value)
- * - ".name1.name2.name3"
- * - ".[0][1][2].name1[3]"
- * - ".%" => member name is provided as parameter
- * - ".[%]" => index is provied as parameter
- */
- class Path
- {
- public:
- Path( const std::string &path,
- const PathArgument &a1 = PathArgument(),
- const PathArgument &a2 = PathArgument(),
- const PathArgument &a3 = PathArgument(),
- const PathArgument &a4 = PathArgument(),
- const PathArgument &a5 = PathArgument() );
-
- const Value &resolve( const Value &root ) const;
- Value resolve( const Value &root,
- const Value &defaultValue ) const;
- /// Creates the "path" to access the specified node and returns a reference on the node.
- Value &make( Value &root ) const;
-
- private:
- typedef std::vector<const PathArgument *> InArgs;
- typedef std::vector<PathArgument> Args;
-
- void makePath( const std::string &path,
- const InArgs &in );
- void addPathInArg( const std::string &path,
- const InArgs &in,
- InArgs::const_iterator &itInArg,
- PathArgument::Kind kind );
- void invalidPath( const std::string &path,
- int location );
-
- Args args_;
- };
+ CommentInfo *comments_;
+ };
+
+
+ /** \brief Experimental and untested: represents an element of the "path" to access a node.
+ */
+ class PathArgument
+ {
+ public:
+ friend class Path;
+
+ PathArgument();
+ PathArgument( ArrayIndex index );
+ PathArgument( const char *key );
+ PathArgument( const std::string &key );
+
+ private:
+ enum Kind
+ {
+ kindNone = 0,
+ kindIndex,
+ kindKey
+ };
+ std::string key_;
+ ArrayIndex index_;
+ Kind kind_;
+ };
+
+ /** \brief Experimental and untested: represents a "path" to access a node.
+ *
+ * Syntax:
+ * - "." => root node
+ * - ".[n]" => elements at index 'n' of root node (an array value)
+ * - ".name" => member named 'name' of root node (an object value)
+ * - ".name1.name2.name3"
+ * - ".[0][1][2].name1[3]"
+ * - ".%" => member name is provided as parameter
+ * - ".[%]" => index is provied as parameter
+ */
+ class Path
+ {
+ public:
+ Path( const std::string &path,
+ const PathArgument &a1 = PathArgument(),
+ const PathArgument &a2 = PathArgument(),
+ const PathArgument &a3 = PathArgument(),
+ const PathArgument &a4 = PathArgument(),
+ const PathArgument &a5 = PathArgument() );
+
+ const Value &resolve( const Value &root ) const;
+ Value resolve( const Value &root,
+ const Value &defaultValue ) const;
+ /// Creates the "path" to access the specified node and returns a reference on the node.
+ Value &make( Value &root ) const;
+
+ private:
+ typedef std::vector<const PathArgument *> InArgs;
+ typedef std::vector<PathArgument> Args;
+
+ void makePath( const std::string &path,
+ const InArgs &in );
+ void addPathInArg( const std::string &path,
+ const InArgs &in,
+ InArgs::const_iterator &itInArg,
+ PathArgument::Kind kind );
+ void invalidPath( const std::string &path,
+ int location );
+
+ Args args_;
+ };
#ifdef JSON_VALUE_USE_INTERNAL_MAP
- /** \brief Allocator to customize Value internal map.
- * Below is an example of a simple implementation (default implementation actually
- * use memory pool for speed).
- * \code
- class DefaultValueMapAllocator : public ValueMapAllocator
- {
- public: // overridden from ValueMapAllocator
- virtual ValueInternalMap *newMap()
- {
- return new ValueInternalMap();
- }
-
- virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
- {
- return new ValueInternalMap( other );
- }
-
- virtual void destructMap( ValueInternalMap *map )
- {
- delete map;
- }
-
- virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
- {
- return new ValueInternalLink[size];
- }
-
- virtual void releaseMapBuckets( ValueInternalLink *links )
- {
- delete [] links;
- }
-
- virtual ValueInternalLink *allocateMapLink()
- {
- return new ValueInternalLink();
- }
-
- virtual void releaseMapLink( ValueInternalLink *link )
- {
- delete link;
- }
- };
- * \endcode
- */
- class JSON_API ValueMapAllocator
- {
- public:
- virtual ~ValueMapAllocator();
- virtual ValueInternalMap *newMap() = 0;
- virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0;
- virtual void destructMap( ValueInternalMap *map ) = 0;
- virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0;
- virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
- virtual ValueInternalLink *allocateMapLink() = 0;
- virtual void releaseMapLink( ValueInternalLink *link ) = 0;
- };
-
- /** \brief ValueInternalMap hash-map bucket chain link (for internal use only).
- * \internal previous_ & next_ allows for bidirectional traversal.
- */
- class JSON_API ValueInternalLink
- {
- public:
- enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
- enum InternalFlags {
- flagAvailable = 0,
- flagUsed = 1
- };
-
- ValueInternalLink();
-
- ~ValueInternalLink();
-
- Value items_[itemPerLink];
- char *keys_[itemPerLink];
- ValueInternalLink *previous_;
- ValueInternalLink *next_;
- };
-
-
- /** \brief A linked page based hash-table implementation used internally by Value.
- * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked
- * list in each bucket to handle collision. There is an addional twist in that
- * each node of the collision linked list is a page containing a fixed amount of
- * value. This provides a better compromise between memory usage and speed.
- *
- * Each bucket is made up of a chained list of ValueInternalLink. The last
- * link of a given bucket can be found in the 'previous_' field of the following bucket.
- * The last link of the last bucket is stored in tailLink_ as it has no following bucket.
- * Only the last link of a bucket may contains 'available' item. The last link always
- * contains at least one element unless is it the bucket one very first link.
- */
- class JSON_API ValueInternalMap
- {
- friend class ValueIteratorBase;
- friend class Value;
- public:
- typedef unsigned int HashKey;
- typedef unsigned int BucketIndex;
+ /** \brief Allocator to customize Value internal map.
+ * Below is an example of a simple implementation (default implementation actually
+ * use memory pool for speed).
+ * \code
+ class DefaultValueMapAllocator : public ValueMapAllocator
+ {
+ public: // overridden from ValueMapAllocator
+ virtual ValueInternalMap *newMap()
+ {
+ return new ValueInternalMap();
+ }
+
+ virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
+ {
+ return new ValueInternalMap( other );
+ }
+
+ virtual void destructMap( ValueInternalMap *map )
+ {
+ delete map;
+ }
+
+ virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
+ {
+ return new ValueInternalLink[size];
+ }
+
+ virtual void releaseMapBuckets( ValueInternalLink *links )
+ {
+ delete [] links;
+ }
+
+ virtual ValueInternalLink *allocateMapLink()
+ {
+ return new ValueInternalLink();
+ }
+
+ virtual void releaseMapLink( ValueInternalLink *link )
+ {
+ delete link;
+ }
+ };
+ * \endcode
+ */
+ class JSON_API ValueMapAllocator
+ {
+ public:
+ virtual ~ValueMapAllocator();
+ virtual ValueInternalMap *newMap() = 0;
+ virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0;
+ virtual void destructMap( ValueInternalMap *map ) = 0;
+ virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0;
+ virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
+ virtual ValueInternalLink *allocateMapLink() = 0;
+ virtual void releaseMapLink( ValueInternalLink *link ) = 0;
+ };
+
+ /** \brief ValueInternalMap hash-map bucket chain link (for internal use only).
+ * \internal previous_ & next_ allows for bidirectional traversal.
+ */
+ class JSON_API ValueInternalLink
+ {
+ public:
+ enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
+ enum InternalFlags {
+ flagAvailable = 0,
+ flagUsed = 1
+ };
+
+ ValueInternalLink();
+
+ ~ValueInternalLink();
+
+ Value items_[itemPerLink];
+ char *keys_[itemPerLink];
+ ValueInternalLink *previous_;
+ ValueInternalLink *next_;
+ };
+
+
+ /** \brief A linked page based hash-table implementation used internally by Value.
+ * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked
+ * list in each bucket to handle collision. There is an addional twist in that
+ * each node of the collision linked list is a page containing a fixed amount of
+ * value. This provides a better compromise between memory usage and speed.
+ *
+ * Each bucket is made up of a chained list of ValueInternalLink. The last
+ * link of a given bucket can be found in the 'previous_' field of the following bucket.
+ * The last link of the last bucket is stored in tailLink_ as it has no following bucket.
+ * Only the last link of a bucket may contains 'available' item. The last link always
+ * contains at least one element unless is it the bucket one very first link.
+ */
+ class JSON_API ValueInternalMap
+ {
+ friend class ValueIteratorBase;
+ friend class Value;
+ public:
+ typedef unsigned int HashKey;
+ typedef unsigned int BucketIndex;
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- struct IteratorState
- {
- IteratorState()
- : map_(0)
- , link_(0)
- , itemIndex_(0)
- , bucketIndex_(0)
- {
- }
- ValueInternalMap *map_;
- ValueInternalLink *link_;
- BucketIndex itemIndex_;
- BucketIndex bucketIndex_;
- };
+ struct IteratorState
+ {
+ IteratorState()
+ : map_(0)
+ , link_(0)
+ , itemIndex_(0)
+ , bucketIndex_(0)
+ {
+ }
+ ValueInternalMap *map_;
+ ValueInternalLink *link_;
+ BucketIndex itemIndex_;
+ BucketIndex bucketIndex_;
+ };
# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- ValueInternalMap();
- ValueInternalMap( const ValueInternalMap &other );
- ValueInternalMap &operator =( const ValueInternalMap &other );
- ~ValueInternalMap();
+ ValueInternalMap();
+ ValueInternalMap( const ValueInternalMap &other );
+ ValueInternalMap &operator =( const ValueInternalMap &other );
+ ~ValueInternalMap();
- void swap( ValueInternalMap &other );
+ void swap( ValueInternalMap &other );
- BucketIndex size() const;
+ BucketIndex size() const;
- void clear();
+ void clear();
- bool reserveDelta( BucketIndex growth );
+ bool reserveDelta( BucketIndex growth );
- bool reserve( BucketIndex newItemCount );
+ bool reserve( BucketIndex newItemCount );
- const Value *find( const char *key ) const;
+ const Value *find( const char *key ) const;
- Value *find( const char *key );
+ Value *find( const char *key );
- Value &resolveReference( const char *key,
- bool isStatic );
+ Value &resolveReference( const char *key,
+ bool isStatic );
- void remove( const char *key );
+ void remove( const char *key );
- void doActualRemove( ValueInternalLink *link,
- BucketIndex index,
- BucketIndex bucketIndex );
+ void doActualRemove( ValueInternalLink *link,
+ BucketIndex index,
+ BucketIndex bucketIndex );
- ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
+ ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
- Value &setNewItem( const char *key,
- bool isStatic,
- ValueInternalLink *link,
- BucketIndex index );
+ Value &setNewItem( const char *key,
+ bool isStatic,
+ ValueInternalLink *link,
+ BucketIndex index );
- Value &unsafeAdd( const char *key,
- bool isStatic,
- HashKey hashedKey );
+ Value &unsafeAdd( const char *key,
+ bool isStatic,
+ HashKey hashedKey );
- HashKey hash( const char *key ) const;
+ HashKey hash( const char *key ) const;
- int compare( const ValueInternalMap &other ) const;
+ int compare( const ValueInternalMap &other ) const;
- private:
- void makeBeginIterator( IteratorState &it ) const;
- void makeEndIterator( IteratorState &it ) const;
- static bool equals( const IteratorState &x, const IteratorState &other );
- static void increment( IteratorState &iterator );
- static void incrementBucket( IteratorState &iterator );
- static void decrement( IteratorState &iterator );
- static const char *key( const IteratorState &iterator );
- static const char *key( const IteratorState &iterator, bool &isStatic );
- static Value &value( const IteratorState &iterator );
- static int distance( const IteratorState &x, const IteratorState &y );
+ private:
+ void makeBeginIterator( IteratorState &it ) const;
+ void makeEndIterator( IteratorState &it ) const;
+ static bool equals( const IteratorState &x, const IteratorState &other );
+ static void increment( IteratorState &iterator );
+ static void incrementBucket( IteratorState &iterator );
+ static void decrement( IteratorState &iterator );
+ static const char *key( const IteratorState &iterator );
+ static const char *key( const IteratorState &iterator, bool &isStatic );
+ static Value &value( const IteratorState &iterator );
+ static int distance( const IteratorState &x, const IteratorState &y );
- private:
- ValueInternalLink *buckets_;
- ValueInternalLink *tailLink_;
- BucketIndex bucketsSize_;
- BucketIndex itemCount_;
- };
+ private:
+ ValueInternalLink *buckets_;
+ ValueInternalLink *tailLink_;
+ BucketIndex bucketsSize_;
+ BucketIndex itemCount_;
+ };
- /** \brief A simplified deque implementation used internally by Value.
- * \internal
- * It is based on a list of fixed "page", each page contains a fixed number of items.
- * Instead of using a linked-list, a array of pointer is used for fast item look-up.
- * Look-up for an element is as follow:
- * - compute page index: pageIndex = itemIndex / itemsPerPage
- * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage]
- *
- * Insertion is amortized constant time (only the array containing the index of pointers
- * need to be reallocated when items are appended).
- */
- class JSON_API ValueInternalArray
- {
- friend class Value;
- friend class ValueIteratorBase;
- public:
- enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo.
- typedef Value::ArrayIndex ArrayIndex;
- typedef unsigned int PageIndex;
+ /** \brief A simplified deque implementation used internally by Value.
+ * \internal
+ * It is based on a list of fixed "page", each page contains a fixed number of items.
+ * Instead of using a linked-list, a array of pointer is used for fast item look-up.
+ * Look-up for an element is as follow:
+ * - compute page index: pageIndex = itemIndex / itemsPerPage
+ * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage]
+ *
+ * Insertion is amortized constant time (only the array containing the index of pointers
+ * need to be reallocated when items are appended).
+ */
+ class JSON_API ValueInternalArray
+ {
+ friend class Value;
+ friend class ValueIteratorBase;
+ public:
+ enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo.
+ typedef Value::ArrayIndex ArrayIndex;
+ typedef unsigned int PageIndex;
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- struct IteratorState // Must be a POD
- {
- IteratorState()
- : array_(0)
- , currentPageIndex_(0)
- , currentItemIndex_(0)
- {
- }
- ValueInternalArray *array_;
- Value **currentPageIndex_;
- unsigned int currentItemIndex_;
- };
+ struct IteratorState // Must be a POD
+ {
+ IteratorState()
+ : array_(0)
+ , currentPageIndex_(0)
+ , currentItemIndex_(0)
+ {
+ }
+ ValueInternalArray *array_;
+ Value **currentPageIndex_;
+ unsigned int currentItemIndex_;
+ };
# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- ValueInternalArray();
- ValueInternalArray( const ValueInternalArray &other );
- ValueInternalArray &operator =( const ValueInternalArray &other );
- ~ValueInternalArray();
- void swap( ValueInternalArray &other );
+ ValueInternalArray();
+ ValueInternalArray( const ValueInternalArray &other );
+ ValueInternalArray &operator =( const ValueInternalArray &other );
+ ~ValueInternalArray();
+ void swap( ValueInternalArray &other );
- void clear();
- void resize( ArrayIndex newSize );
+ void clear();
+ void resize( ArrayIndex newSize );
- Value &resolveReference( ArrayIndex index );
+ Value &resolveReference( ArrayIndex index );
- Value *find( ArrayIndex index ) const;
+ Value *find( ArrayIndex index ) const;
- ArrayIndex size() const;
+ ArrayIndex size() const;
- int compare( const ValueInternalArray &other ) const;
+ int compare( const ValueInternalArray &other ) const;
- private:
- static bool equals( const IteratorState &x, const IteratorState &other );
- static void increment( IteratorState &iterator );
- static void decrement( IteratorState &iterator );
- static Value &dereference( const IteratorState &iterator );
- static Value &unsafeDereference( const IteratorState &iterator );
- static int distance( const IteratorState &x, const IteratorState &y );
- static ArrayIndex indexOf( const IteratorState &iterator );
- void makeBeginIterator( IteratorState &it ) const;
- void makeEndIterator( IteratorState &it ) const;
- void makeIterator( IteratorState &it, ArrayIndex index ) const;
+ private:
+ static bool equals( const IteratorState &x, const IteratorState &other );
+ static void increment( IteratorState &iterator );
+ static void decrement( IteratorState &iterator );
+ static Value &dereference( const IteratorState &iterator );
+ static Value &unsafeDereference( const IteratorState &iterator );
+ static int distance( const IteratorState &x, const IteratorState &y );
+ static ArrayIndex indexOf( const IteratorState &iterator );
+ void makeBeginIterator( IteratorState &it ) const;
+ void makeEndIterator( IteratorState &it ) const;
+ void makeIterator( IteratorState &it, ArrayIndex index ) const;
- void makeIndexValid( ArrayIndex index );
+ void makeIndexValid( ArrayIndex index );
- Value **pages_;
- ArrayIndex size_;
- PageIndex pageCount_;
- };
+ Value **pages_;
+ ArrayIndex size_;
+ PageIndex pageCount_;
+ };
- /** \brief Experimental: do not use. Allocator to customize Value internal array.
- * Below is an example of a simple implementation (actual implementation use
- * memory pool).
- \code
+ /** \brief Experimental: do not use. Allocator to customize Value internal array.
+ * Below is an example of a simple implementation (actual implementation use
+ * memory pool).
+ \code
class DefaultValueArrayAllocator : public ValueArrayAllocator
{
public: // overridden from ValueArrayAllocator
- virtual ~DefaultValueArrayAllocator()
- {
- }
-
- virtual ValueInternalArray *newArray()
- {
- return new ValueInternalArray();
- }
-
- virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
- {
- return new ValueInternalArray( other );
- }
-
- virtual void destruct( ValueInternalArray *array )
- {
- delete array;
- }
-
- virtual void reallocateArrayPageIndex( Value **&indexes,
- ValueInternalArray::PageIndex &indexCount,
- ValueInternalArray::PageIndex minNewIndexCount )
- {
- ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
- if ( minNewIndexCount > newIndexCount )
- newIndexCount = minNewIndexCount;
- void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
- if ( !newIndexes )
- throw std::bad_alloc();
- indexCount = newIndexCount;
- indexes = static_cast<Value **>( newIndexes );
- }
- virtual void releaseArrayPageIndex( Value **indexes,
- ValueInternalArray::PageIndex indexCount )
- {
- if ( indexes )
- free( indexes );
- }
-
- virtual Value *allocateArrayPage()
- {
- return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
- }
-
- virtual void releaseArrayPage( Value *value )
- {
- if ( value )
- free( value );
- }
+ virtual ~DefaultValueArrayAllocator()
+ {
+ }
+
+ virtual ValueInternalArray *newArray()
+ {
+ return new ValueInternalArray();
+ }
+
+ virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
+ {
+ return new ValueInternalArray( other );
+ }
+
+ virtual void destruct( ValueInternalArray *array )
+ {
+ delete array;
+ }
+
+ virtual void reallocateArrayPageIndex( Value **&indexes,
+ ValueInternalArray::PageIndex &indexCount,
+ ValueInternalArray::PageIndex minNewIndexCount )
+ {
+ ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
+ if ( minNewIndexCount > newIndexCount )
+ newIndexCount = minNewIndexCount;
+ void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
+ if ( !newIndexes )
+ throw std::bad_alloc();
+ indexCount = newIndexCount;
+ indexes = static_cast<Value **>( newIndexes );
+ }
+ virtual void releaseArrayPageIndex( Value **indexes,
+ ValueInternalArray::PageIndex indexCount )
+ {
+ if ( indexes )
+ free( indexes );
+ }
+
+ virtual Value *allocateArrayPage()
+ {
+ return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
+ }
+
+ virtual void releaseArrayPage( Value *value )
+ {
+ if ( value )
+ free( value );
+ }
};
- \endcode
- */
- class JSON_API ValueArrayAllocator
- {
- public:
- virtual ~ValueArrayAllocator();
- virtual ValueInternalArray *newArray() = 0;
- virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0;
- virtual void destructArray( ValueInternalArray *array ) = 0;
- /** \brief Reallocate array page index.
- * Reallocates an array of pointer on each page.
- * \param indexes [input] pointer on the current index. May be \c NULL.
- * [output] pointer on the new index of at least
- * \a minNewIndexCount pages.
- * \param indexCount [input] current number of pages in the index.
- * [output] number of page the reallocated index can handle.
- * \b MUST be >= \a minNewIndexCount.
- * \param minNewIndexCount Minimum number of page the new index must be able to
- * handle.
- */
- virtual void reallocateArrayPageIndex( Value **&indexes,
- ValueInternalArray::PageIndex &indexCount,
- ValueInternalArray::PageIndex minNewIndexCount ) = 0;
- virtual void releaseArrayPageIndex( Value **indexes,
- ValueInternalArray::PageIndex indexCount ) = 0;
- virtual Value *allocateArrayPage() = 0;
- virtual void releaseArrayPage( Value *value ) = 0;
- };
+ \endcode
+ */
+ class JSON_API ValueArrayAllocator
+ {
+ public:
+ virtual ~ValueArrayAllocator();
+ virtual ValueInternalArray *newArray() = 0;
+ virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0;
+ virtual void destructArray( ValueInternalArray *array ) = 0;
+ /** \brief Reallocate array page index.
+ * Reallocates an array of pointer on each page.
+ * \param indexes [input] pointer on the current index. May be \c NULL.
+ * [output] pointer on the new index of at least
+ * \a minNewIndexCount pages.
+ * \param indexCount [input] current number of pages in the index.
+ * [output] number of page the reallocated index can handle.
+ * \b MUST be >= \a minNewIndexCount.
+ * \param minNewIndexCount Minimum number of page the new index must be able to
+ * handle.
+ */
+ virtual void reallocateArrayPageIndex( Value **&indexes,
+ ValueInternalArray::PageIndex &indexCount,
+ ValueInternalArray::PageIndex minNewIndexCount ) = 0;
+ virtual void releaseArrayPageIndex( Value **indexes,
+ ValueInternalArray::PageIndex indexCount ) = 0;
+ virtual Value *allocateArrayPage() = 0;
+ virtual void releaseArrayPage( Value *value ) = 0;
+ };
#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
- /** \brief base class for Value iterators.
- *
- */
- class ValueIteratorBase
- {
- public:
- typedef unsigned int size_t;
- typedef int difference_type;
- typedef ValueIteratorBase SelfType;
+ /** \brief base class for Value iterators.
+ *
+ */
+ class ValueIteratorBase
+ {
+ public:
+ typedef unsigned int size_t;
+ typedef int difference_type;
+ typedef ValueIteratorBase SelfType;
- ValueIteratorBase();
+ ValueIteratorBase();
#ifndef JSON_VALUE_USE_INTERNAL_MAP
- explicit ValueIteratorBase( const Value::ObjectValues::iterator &current );
+ explicit ValueIteratorBase( const Value::ObjectValues::iterator &current );
#else
- ValueIteratorBase( const ValueInternalArray::IteratorState &state );
- ValueIteratorBase( const ValueInternalMap::IteratorState &state );
+ ValueIteratorBase( const ValueInternalArray::IteratorState &state );
+ ValueIteratorBase( const ValueInternalMap::IteratorState &state );
#endif
- bool operator ==( const SelfType &other ) const
- {
- return isEqual( other );
- }
+ bool operator ==( const SelfType &other ) const
+ {
+ return isEqual( other );
+ }
- bool operator !=( const SelfType &other ) const
- {
- return !isEqual( other );
- }
+ bool operator !=( const SelfType &other ) const
+ {
+ return !isEqual( other );
+ }
- difference_type operator -( const SelfType &other ) const
- {
- return computeDistance( other );
- }
+ difference_type operator -( const SelfType &other ) const
+ {
+ return computeDistance( other );
+ }
- /// Return either the index or the member name of the referenced value as a Value.
- Value key() const;
+ /// Return either the index or the member name of the referenced value as a Value.
+ Value key() const;
- /// Return the index of the referenced Value. -1 if it is not an arrayValue.
- UInt index() const;
+ /// Return the index of the referenced Value. -1 if it is not an arrayValue.
+ UInt index() const;
- /// Return the member name of the referenced Value. "" if it is not an objectValue.
- const char *memberName() const;
+ /// Return the member name of the referenced Value. "" if it is not an objectValue.
+ const char *memberName() const;
- protected:
- Value &deref() const;
+ protected:
+ Value &deref() const;
- void increment();
+ void increment();
- void decrement();
+ void decrement();
- difference_type computeDistance( const SelfType &other ) const;
+ difference_type computeDistance( const SelfType &other ) const;
- bool isEqual( const SelfType &other ) const;
+ bool isEqual( const SelfType &other ) const;
- void copy( const SelfType &other );
+ void copy( const SelfType &other );
- private:
+ private:
#ifndef JSON_VALUE_USE_INTERNAL_MAP
- Value::ObjectValues::iterator current_;
- // Indicates that iterator is for a null value.
- bool isNull_;
+ Value::ObjectValues::iterator current_;
+ // Indicates that iterator is for a null value.
+ bool isNull_;
#else
- union
- {
- ValueInternalArray::IteratorState array_;
- ValueInternalMap::IteratorState map_;
- } iterator_;
- bool isArray_;
+ union
+ {
+ ValueInternalArray::IteratorState array_;
+ ValueInternalMap::IteratorState map_;
+ } iterator_;
+ bool isArray_;
#endif
- };
-
- /** \brief const iterator for object and array value.
- *
- */
- class ValueConstIterator : public ValueIteratorBase
- {
- friend class Value;
- public:
- typedef unsigned int size_t;
- typedef int difference_type;
- typedef const Value &reference;
- typedef const Value *pointer;
- typedef ValueConstIterator SelfType;
-
- ValueConstIterator();
- private:
- /*! \internal Use by Value to create an iterator.
- */
+ };
+
+ /** \brief const iterator for object and array value.
+ *
+ */
+ class ValueConstIterator : public ValueIteratorBase
+ {
+ friend class Value;
+ public:
+ typedef unsigned int size_t;
+ typedef int difference_type;
+ typedef const Value &reference;
+ typedef const Value *pointer;
+ typedef ValueConstIterator SelfType;
+
+ ValueConstIterator();
+ private:
+ /*! \internal Use by Value to create an iterator.
+ */
#ifndef JSON_VALUE_USE_INTERNAL_MAP
- explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
+ explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
#else
- ValueConstIterator( const ValueInternalArray::IteratorState &state );
- ValueConstIterator( const ValueInternalMap::IteratorState &state );
+ ValueConstIterator( const ValueInternalArray::IteratorState &state );
+ ValueConstIterator( const ValueInternalMap::IteratorState &state );
#endif
- public:
- SelfType &operator =( const ValueIteratorBase &other );
-
- SelfType operator++( int )
- {
- SelfType temp( *this );
- ++*this;
- return temp;
- }
-
- SelfType operator--( int )
- {
- SelfType temp( *this );
- --*this;
- return temp;
- }
-
- SelfType &operator--()
- {
- decrement();
- return *this;
- }
-
- SelfType &operator++()
- {
- increment();
- return *this;
- }
-
- reference operator *() const
- {
- return deref();
- }
- };
-
-
- /** \brief Iterator for object and array value.
- */
- class ValueIterator : public ValueIteratorBase
- {
- friend class Value;
- public:
- typedef unsigned int size_t;
- typedef int difference_type;
- typedef Value &reference;
- typedef Value *pointer;
- typedef ValueIterator SelfType;
-
- ValueIterator();
- ValueIterator( const ValueConstIterator &other );
- ValueIterator( const ValueIterator &other );
- private:
- /*! \internal Use by Value to create an iterator.
- */
+ public:
+ SelfType &operator =( const ValueIteratorBase &other );
+
+ SelfType operator++( int )
+ {
+ SelfType temp( *this );
+ ++*this;
+ return temp;
+ }
+
+ SelfType operator--( int )
+ {
+ SelfType temp( *this );
+ --*this;
+ return temp;
+ }
+
+ SelfType &operator--()
+ {
+ decrement();
+ return *this;
+ }
+
+ SelfType &operator++()
+ {
+ increment();
+ return *this;
+ }
+
+ reference operator *() const
+ {
+ return deref();
+ }
+ };
+
+
+ /** \brief Iterator for object and array value.
+ */
+ class ValueIterator : public ValueIteratorBase
+ {
+ friend class Value;
+ public:
+ typedef unsigned int size_t;
+ typedef int difference_type;
+ typedef Value &reference;
+ typedef Value *pointer;
+ typedef ValueIterator SelfType;
+
+ ValueIterator();
+ ValueIterator( const ValueConstIterator &other );
+ ValueIterator( const ValueIterator &other );
+ private:
+ /*! \internal Use by Value to create an iterator.
+ */
#ifndef JSON_VALUE_USE_INTERNAL_MAP
- explicit ValueIterator( const Value::ObjectValues::iterator &current );
+ explicit ValueIterator( const Value::ObjectValues::iterator &current );
#else
- ValueIterator( const ValueInternalArray::IteratorState &state );
- ValueIterator( const ValueInternalMap::IteratorState &state );
+ ValueIterator( const ValueInternalArray::IteratorState &state );
+ ValueIterator( const ValueInternalMap::IteratorState &state );
#endif
- public:
-
- SelfType &operator =( const SelfType &other );
-
- SelfType operator++( int )
- {
- SelfType temp( *this );
- ++*this;
- return temp;
- }
-
- SelfType operator--( int )
- {
- SelfType temp( *this );
- --*this;
- return temp;
- }
-
- SelfType &operator--()
- {
- decrement();
- return *this;
- }
-
- SelfType &operator++()
- {
- increment();
- return *this;
- }
-
- reference operator *() const
- {
- return deref();
- }
- };
+ public:
+
+ SelfType &operator =( const SelfType &other );
+
+ SelfType operator++( int )
+ {
+ SelfType temp( *this );
+ ++*this;
+ return temp;
+ }
+
+ SelfType operator--( int )
+ {
+ SelfType temp( *this );
+ --*this;
+ return temp;
+ }
+
+ SelfType &operator--()
+ {
+ decrement();
+ return *this;
+ }
+
+ SelfType &operator++()
+ {
+ increment();
+ return *this;
+ }
+
+ reference operator *() const
+ {
+ return deref();
+ }
+ };
} // namespace Json
diff --git a/src/lib/web/json/writer.h b/src/lib/web/json/writer.h
index 478936365a6..fcbd44950e0 100644
--- a/src/lib/web/json/writer.h
+++ b/src/lib/web/json/writer.h
@@ -14,169 +14,168 @@
# include <iostream>
namespace Json {
-
- class Value;
-
- /** \brief Abstract class for writers.
- */
- class JSON_API Writer
- {
- public:
- virtual ~Writer();
-
- virtual std::string write( const Value &root ) = 0;
- };
-
- /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly).
- *
- * The JSON document is written in a single line. It is not intended for 'human' consumption,
- * but may be usefull to support feature such as RPC where bandwith is limited.
- * \sa Reader, Value
- */
- class JSON_API FastWriter : public Writer
- {
- public:
- FastWriter();
- virtual ~FastWriter(){}
-
- void enableYAMLCompatibility();
-
- public: // overridden from Writer
- virtual std::string write( const Value &root );
-
- private:
- void writeValue( const Value &value );
-
- std::string document_;
- bool yamlCompatiblityEnabled_;
- };
-
- /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way.
- *
- * The rules for line break and indent are as follow:
- * - Object value:
- * - if empty then print {} without indent and line break
- * - if not empty the print '{', line break & indent, print one value per line
- * and then unindent and line break and print '}'.
- * - Array value:
- * - if empty then print [] without indent and line break
- * - if the array contains no object value, empty array or some other value types,
- * and all the values fit on one lines, then print the array on a single line.
- * - otherwise, it the values do not fit on one line, or the array contains
- * object or non empty array, then print one value per line.
- *
- * If the Value have comments then they are outputed according to their #CommentPlacement.
- *
- * \sa Reader, Value, Value::setComment()
- */
- class JSON_API StyledWriter: public Writer
- {
- public:
- StyledWriter();
- virtual ~StyledWriter(){}
-
- public: // overridden from Writer
- /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
- * \param root Value to serialize.
- * \return String containing the JSON document that represents the root value.
- */
- virtual std::string write( const Value &root );
-
- private:
- void writeValue( const Value &value );
- void writeArrayValue( const Value &value );
- bool isMultineArray( const Value &value );
- void pushValue( const std::string &value );
- void writeIndent();
- void writeWithIndent( const std::string &value );
- void indent();
- void unindent();
- void writeCommentBeforeValue( const Value &root );
- void writeCommentAfterValueOnSameLine( const Value &root );
- bool hasCommentForValue( const Value &value );
- static std::string normalizeEOL( const std::string &text );
-
- typedef std::vector<std::string> ChildValues;
-
- ChildValues childValues_;
- std::string document_;
- std::string indentString_;
- int rightMargin_;
- int indentSize_;
- bool addChildValues_;
- };
-
- /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way,
- to a stream rather than to a string.
- *
- * The rules for line break and indent are as follow:
- * - Object value:
- * - if empty then print {} without indent and line break
- * - if not empty the print '{', line break & indent, print one value per line
- * and then unindent and line break and print '}'.
- * - Array value:
- * - if empty then print [] without indent and line break
- * - if the array contains no object value, empty array or some other value types,
- * and all the values fit on one lines, then print the array on a single line.
- * - otherwise, it the values do not fit on one line, or the array contains
- * object or non empty array, then print one value per line.
- *
- * If the Value have comments then they are outputed according to their #CommentPlacement.
- *
- * \param indentation Each level will be indented by this amount extra.
- * \sa Reader, Value, Value::setComment()
- */
- class JSON_API StyledStreamWriter
- {
- public:
- StyledStreamWriter( std::string indentation="\t" );
- ~StyledStreamWriter(){}
-
- public:
- /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
- * \param out Stream to write to. (Can be ostringstream, e.g.)
- * \param root Value to serialize.
- * \note There is no point in deriving from Writer, since write() should not return a value.
- */
- void write( std::ostream &out, const Value &root );
-
- private:
- void writeValue( const Value &value );
- void writeArrayValue( const Value &value );
- bool isMultineArray( const Value &value );
- void pushValue( const std::string &value );
- void writeIndent();
- void writeWithIndent( const std::string &value );
- void indent();
- void unindent();
- void writeCommentBeforeValue( const Value &root );
- void writeCommentAfterValueOnSameLine( const Value &root );
- bool hasCommentForValue( const Value &value );
- static std::string normalizeEOL( const std::string &text );
-
- typedef std::vector<std::string> ChildValues;
-
- ChildValues childValues_;
- std::ostream* document_;
- std::string indentString_;
- int rightMargin_;
- std::string indentation_;
- bool addChildValues_;
- };
+ class Value;
+
+ /** \brief Abstract class for writers.
+ */
+ class JSON_API Writer
+ {
+ public:
+ virtual ~Writer();
+
+ virtual std::string write( const Value &root ) = 0;
+ };
+
+ /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly).
+ *
+ * The JSON document is written in a single line. It is not intended for 'human' consumption,
+ * but may be usefull to support feature such as RPC where bandwith is limited.
+ * \sa Reader, Value
+ */
+ class JSON_API FastWriter : public Writer
+ {
+ public:
+ FastWriter();
+ virtual ~FastWriter(){}
+
+ void enableYAMLCompatibility();
+
+ public: // overridden from Writer
+ virtual std::string write( const Value &root );
+
+ private:
+ void writeValue( const Value &value );
+
+ std::string document_;
+ bool yamlCompatiblityEnabled_;
+ };
+
+ /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way.
+ *
+ * The rules for line break and indent are as follow:
+ * - Object value:
+ * - if empty then print {} without indent and line break
+ * - if not empty the print '{', line break & indent, print one value per line
+ * and then unindent and line break and print '}'.
+ * - Array value:
+ * - if empty then print [] without indent and line break
+ * - if the array contains no object value, empty array or some other value types,
+ * and all the values fit on one lines, then print the array on a single line.
+ * - otherwise, it the values do not fit on one line, or the array contains
+ * object or non empty array, then print one value per line.
+ *
+ * If the Value have comments then they are outputed according to their #CommentPlacement.
+ *
+ * \sa Reader, Value, Value::setComment()
+ */
+ class JSON_API StyledWriter: public Writer
+ {
+ public:
+ StyledWriter();
+ virtual ~StyledWriter(){}
+
+ public: // overridden from Writer
+ /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
+ * \param root Value to serialize.
+ * \return String containing the JSON document that represents the root value.
+ */
+ virtual std::string write( const Value &root );
+
+ private:
+ void writeValue( const Value &value );
+ void writeArrayValue( const Value &value );
+ bool isMultineArray( const Value &value );
+ void pushValue( const std::string &value );
+ void writeIndent();
+ void writeWithIndent( const std::string &value );
+ void indent();
+ void unindent();
+ void writeCommentBeforeValue( const Value &root );
+ void writeCommentAfterValueOnSameLine( const Value &root );
+ bool hasCommentForValue( const Value &value );
+ static std::string normalizeEOL( const std::string &text );
+
+ typedef std::vector<std::string> ChildValues;
+
+ ChildValues childValues_;
+ std::string document_;
+ std::string indentString_;
+ int rightMargin_;
+ int indentSize_;
+ bool addChildValues_;
+ };
+
+ /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way,
+ to a stream rather than to a string.
+ *
+ * The rules for line break and indent are as follow:
+ * - Object value:
+ * - if empty then print {} without indent and line break
+ * - if not empty the print '{', line break & indent, print one value per line
+ * and then unindent and line break and print '}'.
+ * - Array value:
+ * - if empty then print [] without indent and line break
+ * - if the array contains no object value, empty array or some other value types,
+ * and all the values fit on one lines, then print the array on a single line.
+ * - otherwise, it the values do not fit on one line, or the array contains
+ * object or non empty array, then print one value per line.
+ *
+ * If the Value have comments then they are outputed according to their #CommentPlacement.
+ *
+ * \param indentation Each level will be indented by this amount extra.
+ * \sa Reader, Value, Value::setComment()
+ */
+ class JSON_API StyledStreamWriter
+ {
+ public:
+ StyledStreamWriter( std::string indentation="\t" );
+ ~StyledStreamWriter(){}
+
+ public:
+ /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
+ * \param out Stream to write to. (Can be ostringstream, e.g.)
+ * \param root Value to serialize.
+ * \note There is no point in deriving from Writer, since write() should not return a value.
+ */
+ void write( std::ostream &out, const Value &root );
+
+ private:
+ void writeValue( const Value &value );
+ void writeArrayValue( const Value &value );
+ bool isMultineArray( const Value &value );
+ void pushValue( const std::string &value );
+ void writeIndent();
+ void writeWithIndent( const std::string &value );
+ void indent();
+ void unindent();
+ void writeCommentBeforeValue( const Value &root );
+ void writeCommentAfterValueOnSameLine( const Value &root );
+ bool hasCommentForValue( const Value &value );
+ static std::string normalizeEOL( const std::string &text );
+
+ typedef std::vector<std::string> ChildValues;
+
+ ChildValues childValues_;
+ std::ostream* document_;
+ std::string indentString_;
+ int rightMargin_;
+ std::string indentation_;
+ bool addChildValues_;
+ };
# if defined(JSON_HAS_INT64)
- std::string JSON_API valueToString( Int value );
- std::string JSON_API valueToString( UInt value );
+ std::string JSON_API valueToString( Int value );
+ std::string JSON_API valueToString( UInt value );
# endif // if defined(JSON_HAS_INT64)
- std::string JSON_API valueToString( LargestInt value );
- std::string JSON_API valueToString( LargestUInt value );
- std::string JSON_API valueToString( double value );
- std::string JSON_API valueToString( bool value );
- std::string JSON_API valueToQuotedString( const char *value );
-
- /// \brief Output using the StyledStreamWriter.
- /// \see Json::operator>>()
- std::ostream& operator<<( std::ostream&, const Value &root );
+ std::string JSON_API valueToString( LargestInt value );
+ std::string JSON_API valueToString( LargestUInt value );
+ std::string JSON_API valueToString( double value );
+ std::string JSON_API valueToString( bool value );
+ std::string JSON_API valueToQuotedString( const char *value );
+
+ /// \brief Output using the StyledStreamWriter.
+ /// \see Json::operator>>()
+ std::ostream& operator<<( std::ostream&, const Value &root );
} // namespace Json
diff --git a/src/lib/web/mongoose.c b/src/lib/web/mongoose.c
index f2e2d6a11ad..1718b2c6faa 100644
--- a/src/lib/web/mongoose.c
+++ b/src/lib/web/mongoose.c
@@ -100,11 +100,11 @@ typedef long off_t;
#endif // _WIN32_WCE
#define MAKEUQUAD(lo, hi) ((uint64_t)(((uint32_t)(lo)) | \
- ((uint64_t)((uint32_t)(hi))) << 32))
+ ((uint64_t)((uint32_t)(hi))) << 32))
#define RATE_DIFF 10000000 // 100 nsecs
#define EPOCH_DIFF MAKEUQUAD(0xd53e8000, 0x019db1de)
#define SYS2UNIX_TIME(lo, hi) \
- (time_t) ((MAKEUQUAD((lo), (hi)) - EPOCH_DIFF) / RATE_DIFF)
+ (time_t) ((MAKEUQUAD((lo), (hi)) - EPOCH_DIFF) / RATE_DIFF)
// Visual Studio 6 does not know __func__ or __FUNCTION__
// The rest of MS compilers use __FUNCTION__, not C99 __func__
@@ -192,20 +192,20 @@ typedef __int64 int64_t;
// POSIX dirent interface
struct dirent {
- char d_name[PATH_MAX];
+ char d_name[PATH_MAX];
};
typedef struct DIR {
- HANDLE handle;
- WIN32_FIND_DATAW info;
- struct dirent result;
+ HANDLE handle;
+ WIN32_FIND_DATAW info;
+ struct dirent result;
} DIR;
#ifndef HAVE_POLL
struct pollfd {
- int fd;
- short events;
- short revents;
+ int fd;
+ short events;
+ short revents;
};
#define POLLIN 1
#endif
@@ -274,7 +274,7 @@ typedef int SOCKET;
static CRITICAL_SECTION global_log_file_lock;
#if !defined(NO_SSL)
static pthread_t pthread_self(void) {
- return GetCurrentThreadId();
+ return GetCurrentThreadId();
}
#endif
#endif // _WIN32
@@ -285,14 +285,14 @@ static pthread_t pthread_self(void) {
#else
#if defined(DEBUG)
#define DEBUG_TRACE(x) do { \
- flockfile(stdout); \
- printf("*** %lu.%p.%s.%d: ", \
- (unsigned long) time(NULL), (void *) pthread_self(), \
- __func__, __LINE__); \
- printf x; \
- putchar('\n'); \
- fflush(stdout); \
- funlockfile(stdout); \
+ flockfile(stdout); \
+ printf("*** %lu.%p.%s.%d: ", \
+ (unsigned long) time(NULL), (void *) pthread_self(), \
+ __func__, __LINE__); \
+ printf x; \
+ putchar('\n'); \
+ fflush(stdout); \
+ funlockfile(stdout); \
} while (0)
#else
#define DEBUG_TRACE(x)
@@ -331,8 +331,8 @@ typedef struct ssl_method_st SSL_METHOD;
typedef struct ssl_ctx_st SSL_CTX;
struct ssl_func {
- const char *name; // SSL function name
- void (*ptr)(void); // Function pointer
+ const char *name; // SSL function name
+ void (*ptr)(void); // Function pointer
};
#define SSL_free (* (void (*)(SSL *)) ssl_sw[0].ptr)
@@ -347,15 +347,15 @@ struct ssl_func {
#define SSLv23_server_method (* (SSL_METHOD * (*)(void)) ssl_sw[9].ptr)
#define SSL_library_init (* (int (*)(void)) ssl_sw[10].ptr)
#define SSL_CTX_use_PrivateKey_file (* (int (*)(SSL_CTX *, \
- const char *, int)) ssl_sw[11].ptr)
+ const char *, int)) ssl_sw[11].ptr)
#define SSL_CTX_use_certificate_file (* (int (*)(SSL_CTX *, \
- const char *, int)) ssl_sw[12].ptr)
+ const char *, int)) ssl_sw[12].ptr)
#define SSL_CTX_set_default_passwd_cb \
- (* (void (*)(SSL_CTX *, mg_callback_t)) ssl_sw[13].ptr)
+ (* (void (*)(SSL_CTX *, mg_callback_t)) ssl_sw[13].ptr)
#define SSL_CTX_free (* (void (*)(SSL_CTX *)) ssl_sw[14].ptr)
#define SSL_load_error_strings (* (void (*)(void)) ssl_sw[15].ptr)
#define SSL_CTX_use_certificate_chain_file \
- (* (int (*)(SSL_CTX *, const char *)) ssl_sw[16].ptr)
+ (* (int (*)(SSL_CTX *, const char *)) ssl_sw[16].ptr)
#define SSLv23_client_method (* (SSL_METHOD * (*)(void)) ssl_sw[17].ptr)
#define SSL_pending (* (int (*)(SSL *)) ssl_sw[18].ptr)
#define SSL_CTX_set_verify (* (void (*)(SSL_CTX *, int, int)) ssl_sw[19].ptr)
@@ -363,9 +363,9 @@ struct ssl_func {
#define CRYPTO_num_locks (* (int (*)(void)) crypto_sw[0].ptr)
#define CRYPTO_set_locking_callback \
- (* (void (*)(void (*)(int, int, const char *, int))) crypto_sw[1].ptr)
+ (* (void (*)(void (*)(int, int, const char *, int))) crypto_sw[1].ptr)
#define CRYPTO_set_id_callback \
- (* (void (*)(unsigned long (*)(void))) crypto_sw[2].ptr)
+ (* (void (*)(unsigned long (*)(void))) crypto_sw[2].ptr)
#define ERR_get_error (* (unsigned long (*)(void)) crypto_sw[3].ptr)
#define ERR_error_string (* (char * (*)(unsigned long,char *)) crypto_sw[4].ptr)
@@ -374,370 +374,370 @@ struct ssl_func {
// of respective functions. The macros above (like SSL_connect()) are really
// just calling these functions indirectly via the pointer.
static struct ssl_func ssl_sw[] = {
- {"SSL_free", NULL},
- {"SSL_accept", NULL},
- {"SSL_connect", NULL},
- {"SSL_read", NULL},
- {"SSL_write", NULL},
- {"SSL_get_error", NULL},
- {"SSL_set_fd", NULL},
- {"SSL_new", NULL},
- {"SSL_CTX_new", NULL},
- {"SSLv23_server_method", NULL},
- {"SSL_library_init", NULL},
- {"SSL_CTX_use_PrivateKey_file", NULL},
- {"SSL_CTX_use_certificate_file",NULL},
- {"SSL_CTX_set_default_passwd_cb",NULL},
- {"SSL_CTX_free", NULL},
- {"SSL_load_error_strings", NULL},
- {"SSL_CTX_use_certificate_chain_file", NULL},
- {"SSLv23_client_method", NULL},
- {"SSL_pending", NULL},
- {"SSL_CTX_set_verify", NULL},
- {"SSL_shutdown", NULL},
- {NULL, NULL}
+ {"SSL_free", NULL},
+ {"SSL_accept", NULL},
+ {"SSL_connect", NULL},
+ {"SSL_read", NULL},
+ {"SSL_write", NULL},
+ {"SSL_get_error", NULL},
+ {"SSL_set_fd", NULL},
+ {"SSL_new", NULL},
+ {"SSL_CTX_new", NULL},
+ {"SSLv23_server_method", NULL},
+ {"SSL_library_init", NULL},
+ {"SSL_CTX_use_PrivateKey_file", NULL},
+ {"SSL_CTX_use_certificate_file",NULL},
+ {"SSL_CTX_set_default_passwd_cb",NULL},
+ {"SSL_CTX_free", NULL},
+ {"SSL_load_error_strings", NULL},
+ {"SSL_CTX_use_certificate_chain_file", NULL},
+ {"SSLv23_client_method", NULL},
+ {"SSL_pending", NULL},
+ {"SSL_CTX_set_verify", NULL},
+ {"SSL_shutdown", NULL},
+ {NULL, NULL}
};
// Similar array as ssl_sw. These functions could be located in different lib.
#if !defined(NO_SSL)
static struct ssl_func crypto_sw[] = {
- {"CRYPTO_num_locks", NULL},
- {"CRYPTO_set_locking_callback", NULL},
- {"CRYPTO_set_id_callback", NULL},
- {"ERR_get_error", NULL},
- {"ERR_error_string", NULL},
- {NULL, NULL}
+ {"CRYPTO_num_locks", NULL},
+ {"CRYPTO_set_locking_callback", NULL},
+ {"CRYPTO_set_id_callback", NULL},
+ {"ERR_get_error", NULL},
+ {"ERR_error_string", NULL},
+ {NULL, NULL}
};
#endif // NO_SSL
#endif // NO_SSL_DL
static const char *month_names[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
// Unified socket address. For IPv6 support, add IPv6 address structure
// in the union u.
union usa {
- struct sockaddr sa;
- struct sockaddr_in sin;
+ struct sockaddr sa;
+ struct sockaddr_in sin;
#if defined(USE_IPV6)
- struct sockaddr_in6 sin6;
+ struct sockaddr_in6 sin6;
#endif
};
// Describes a string (chunk of memory).
struct vec {
- const char *ptr;
- size_t len;
+ const char *ptr;
+ size_t len;
};
struct file {
- int is_directory;
- time_t modification_time;
- int64_t size;
- FILE *fp;
- const char *membuf; // Non-NULL if file data is in memory
- // set to 1 if the content is gzipped
- // in which case we need a content-encoding: gzip header
- int gzipped;
+ int is_directory;
+ time_t modification_time;
+ int64_t size;
+ FILE *fp;
+ const char *membuf; // Non-NULL if file data is in memory
+ // set to 1 if the content is gzipped
+ // in which case we need a content-encoding: gzip header
+ int gzipped;
};
#define STRUCT_FILE_INITIALIZER {0, 0, 0, NULL, NULL, 0}
// Describes listening socket, or socket which was accept()-ed by the master
// thread and queued for future handling by the worker thread.
struct socket {
- SOCKET sock; // Listening socket
- union usa lsa; // Local socket address
- union usa rsa; // Remote socket address
- unsigned is_ssl:1; // Is port SSL-ed
- unsigned ssl_redir:1; // Is port supposed to redirect everything to SSL port
+ SOCKET sock; // Listening socket
+ union usa lsa; // Local socket address
+ union usa rsa; // Remote socket address
+ unsigned is_ssl:1; // Is port SSL-ed
+ unsigned ssl_redir:1; // Is port supposed to redirect everything to SSL port
};
// NOTE(lsm): this enum shoulds be in sync with the config_options below.
enum {
- CGI_EXTENSIONS, CGI_ENVIRONMENT, PUT_DELETE_PASSWORDS_FILE, CGI_INTERPRETER,
- PROTECT_URI, AUTHENTICATION_DOMAIN, SSI_EXTENSIONS, THROTTLE,
- ACCESS_LOG_FILE, ENABLE_DIRECTORY_LISTING, ERROR_LOG_FILE,
- GLOBAL_PASSWORDS_FILE, INDEX_FILES, ENABLE_KEEP_ALIVE, ACCESS_CONTROL_LIST,
- EXTRA_MIME_TYPES, LISTENING_PORTS, DOCUMENT_ROOT, SSL_CERTIFICATE,
- NUM_THREADS, RUN_AS_USER, REWRITE, HIDE_FILES, REQUEST_TIMEOUT,
- NUM_OPTIONS
+ CGI_EXTENSIONS, CGI_ENVIRONMENT, PUT_DELETE_PASSWORDS_FILE, CGI_INTERPRETER,
+ PROTECT_URI, AUTHENTICATION_DOMAIN, SSI_EXTENSIONS, THROTTLE,
+ ACCESS_LOG_FILE, ENABLE_DIRECTORY_LISTING, ERROR_LOG_FILE,
+ GLOBAL_PASSWORDS_FILE, INDEX_FILES, ENABLE_KEEP_ALIVE, ACCESS_CONTROL_LIST,
+ EXTRA_MIME_TYPES, LISTENING_PORTS, DOCUMENT_ROOT, SSL_CERTIFICATE,
+ NUM_THREADS, RUN_AS_USER, REWRITE, HIDE_FILES, REQUEST_TIMEOUT,
+ NUM_OPTIONS
};
static const char *config_options[] = {
- "cgi_pattern", "**.cgi$|**.pl$|**.php$",
- "cgi_environment", NULL,
- "put_delete_auth_file", NULL,
- "cgi_interpreter", NULL,
- "protect_uri", NULL,
- "authentication_domain", "mydomain.com",
- "ssi_pattern", "**.shtml$|**.shtm$",
- "throttle", NULL,
- "access_log_file", NULL,
- "enable_directory_listing", "yes",
- "error_log_file", NULL,
- "global_auth_file", NULL,
- "index_files",
- "index.html,index.htm,index.cgi,index.shtml,index.php,index.lp",
- "enable_keep_alive", "no",
- "access_control_list", NULL,
- "extra_mime_types", NULL,
- "listening_ports", "8080",
- "document_root", ".",
- "ssl_certificate", NULL,
- "num_threads", "50",
- "run_as_user", NULL,
- "url_rewrite_patterns", NULL,
- "hide_files_patterns", NULL,
- "request_timeout_ms", "30000",
- NULL
+ "cgi_pattern", "**.cgi$|**.pl$|**.php$",
+ "cgi_environment", NULL,
+ "put_delete_auth_file", NULL,
+ "cgi_interpreter", NULL,
+ "protect_uri", NULL,
+ "authentication_domain", "mydomain.com",
+ "ssi_pattern", "**.shtml$|**.shtm$",
+ "throttle", NULL,
+ "access_log_file", NULL,
+ "enable_directory_listing", "yes",
+ "error_log_file", NULL,
+ "global_auth_file", NULL,
+ "index_files",
+ "index.html,index.htm,index.cgi,index.shtml,index.php,index.lp",
+ "enable_keep_alive", "no",
+ "access_control_list", NULL,
+ "extra_mime_types", NULL,
+ "listening_ports", "8080",
+ "document_root", ".",
+ "ssl_certificate", NULL,
+ "num_threads", "50",
+ "run_as_user", NULL,
+ "url_rewrite_patterns", NULL,
+ "hide_files_patterns", NULL,
+ "request_timeout_ms", "30000",
+ NULL
};
struct mg_context {
- volatile int stop_flag; // Should we stop event loop
- SSL_CTX *ssl_ctx; // SSL context
- char *config[NUM_OPTIONS]; // Mongoose configuration parameters
- struct mg_callbacks callbacks; // User-defined callback function
- void *user_data; // User-defined data
-
- struct socket *listening_sockets;
- int num_listening_sockets;
-
- volatile int num_threads; // Number of threads
- pthread_mutex_t mutex; // Protects (max|num)_threads
- pthread_cond_t cond; // Condvar for tracking workers terminations
-
- struct socket queue[20]; // Accepted sockets
- volatile int sq_head; // Head of the socket queue
- volatile int sq_tail; // Tail of the socket queue
- pthread_cond_t sq_full; // Signaled when socket is produced
- pthread_cond_t sq_empty; // Signaled when socket is consumed
+ volatile int stop_flag; // Should we stop event loop
+ SSL_CTX *ssl_ctx; // SSL context
+ char *config[NUM_OPTIONS]; // Mongoose configuration parameters
+ struct mg_callbacks callbacks; // User-defined callback function
+ void *user_data; // User-defined data
+
+ struct socket *listening_sockets;
+ int num_listening_sockets;
+
+ volatile int num_threads; // Number of threads
+ pthread_mutex_t mutex; // Protects (max|num)_threads
+ pthread_cond_t cond; // Condvar for tracking workers terminations
+
+ struct socket queue[20]; // Accepted sockets
+ volatile int sq_head; // Head of the socket queue
+ volatile int sq_tail; // Tail of the socket queue
+ pthread_cond_t sq_full; // Signaled when socket is produced
+ pthread_cond_t sq_empty; // Signaled when socket is consumed
};
struct mg_connection {
- struct mg_request_info request_info;
- struct mg_context *ctx;
- SSL *ssl; // SSL descriptor
- SSL_CTX *client_ssl_ctx; // SSL context for client connections
- struct socket client; // Connected client
- time_t birth_time; // Time when request was received
- int64_t num_bytes_sent; // Total bytes sent to client
- int64_t content_len; // Content-Length header value
- int64_t consumed_content; // How many bytes of content have been read
- char *buf; // Buffer for received data
- char *path_info; // PATH_INFO part of the URL
- int must_close; // 1 if connection must be closed
- int buf_size; // Buffer size
- int request_len; // Size of the request + headers in a buffer
- int data_len; // Total size of data in a buffer
- int status_code; // HTTP reply status code, e.g. 200
- int throttle; // Throttling, bytes/sec. <= 0 means no throttle
- time_t last_throttle_time; // Last time throttled data was sent
- int64_t last_throttle_bytes;// Bytes sent this second
+ struct mg_request_info request_info;
+ struct mg_context *ctx;
+ SSL *ssl; // SSL descriptor
+ SSL_CTX *client_ssl_ctx; // SSL context for client connections
+ struct socket client; // Connected client
+ time_t birth_time; // Time when request was received
+ int64_t num_bytes_sent; // Total bytes sent to client
+ int64_t content_len; // Content-Length header value
+ int64_t consumed_content; // How many bytes of content have been read
+ char *buf; // Buffer for received data
+ char *path_info; // PATH_INFO part of the URL
+ int must_close; // 1 if connection must be closed
+ int buf_size; // Buffer size
+ int request_len; // Size of the request + headers in a buffer
+ int data_len; // Total size of data in a buffer
+ int status_code; // HTTP reply status code, e.g. 200
+ int throttle; // Throttling, bytes/sec. <= 0 means no throttle
+ time_t last_throttle_time; // Last time throttled data was sent
+ int64_t last_throttle_bytes;// Bytes sent this second
};
// Directory entry
struct de {
- struct mg_connection *conn;
- char *file_name;
- struct file file;
+ struct mg_connection *conn;
+ char *file_name;
+ struct file file;
};
const char **mg_get_valid_option_names(void) {
- return config_options;
+ return config_options;
}
static int is_file_in_memory(struct mg_connection *conn, const char *path,
- struct file *filep) {
- size_t size = 0;
- if ((filep->membuf = conn->ctx->callbacks.open_file == NULL ? NULL :
- conn->ctx->callbacks.open_file(conn, path, &size)) != NULL) {
- // NOTE: override filep->size only on success. Otherwise, it might break
- // constructs like if (!mg_stat() || !mg_fopen()) ...
- filep->size = size;
- }
- return filep->membuf != NULL;
+ struct file *filep) {
+ size_t size = 0;
+ if ((filep->membuf = conn->ctx->callbacks.open_file == NULL ? NULL :
+ conn->ctx->callbacks.open_file(conn, path, &size)) != NULL) {
+ // NOTE: override filep->size only on success. Otherwise, it might break
+ // constructs like if (!mg_stat() || !mg_fopen()) ...
+ filep->size = size;
+ }
+ return filep->membuf != NULL;
}
static int is_file_opened(const struct file *filep) {
- return filep->membuf != NULL || filep->fp != NULL;
+ return filep->membuf != NULL || filep->fp != NULL;
}
static int mg_fopen(struct mg_connection *conn, const char *path,
- const char *mode, struct file *filep) {
- if (!is_file_in_memory(conn, path, filep)) {
+ const char *mode, struct file *filep) {
+ if (!is_file_in_memory(conn, path, filep)) {
#ifdef _WIN32
- wchar_t wbuf[PATH_MAX], wmode[20];
- to_unicode(path, wbuf, ARRAY_SIZE(wbuf));
- MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, ARRAY_SIZE(wmode));
- filep->fp = _wfopen(wbuf, wmode);
+ wchar_t wbuf[PATH_MAX], wmode[20];
+ to_unicode(path, wbuf, ARRAY_SIZE(wbuf));
+ MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, ARRAY_SIZE(wmode));
+ filep->fp = _wfopen(wbuf, wmode);
#else
- filep->fp = fopen(path, mode);
+ filep->fp = fopen(path, mode);
#endif
- }
+ }
- return is_file_opened(filep);
+ return is_file_opened(filep);
}
static void mg_fclose(struct file *filep) {
- if (filep != NULL && filep->fp != NULL) {
- fclose(filep->fp);
- }
+ if (filep != NULL && filep->fp != NULL) {
+ fclose(filep->fp);
+ }
}
static int get_option_index(const char *name) {
- int i;
+ int i;
- for (i = 0; config_options[i * 2] != NULL; i++) {
- if (strcmp(config_options[i * 2], name) == 0) {
- return i;
- }
- }
- return -1;
+ for (i = 0; config_options[i * 2] != NULL; i++) {
+ if (strcmp(config_options[i * 2], name) == 0) {
+ return i;
+ }
+ }
+ return -1;
}
const char *mg_get_option(const struct mg_context *ctx, const char *name) {
- int i;
- if ((i = get_option_index(name)) == -1) {
- return NULL;
- } else if (ctx->config[i] == NULL) {
- return "";
- } else {
- return ctx->config[i];
- }
+ int i;
+ if ((i = get_option_index(name)) == -1) {
+ return NULL;
+ } else if (ctx->config[i] == NULL) {
+ return "";
+ } else {
+ return ctx->config[i];
+ }
}
static void sockaddr_to_string(char *buf, size_t len,
- const union usa *usa) {
- buf[0] = '\0';
+ const union usa *usa) {
+ buf[0] = '\0';
#if defined(USE_IPV6)
- inet_ntop(usa->sa.sa_family, usa->sa.sa_family == AF_INET ?
- (void *) &usa->sin.sin_addr :
- (void *) &usa->sin6.sin6_addr, buf, len);
+ inet_ntop(usa->sa.sa_family, usa->sa.sa_family == AF_INET ?
+ (void *) &usa->sin.sin_addr :
+ (void *) &usa->sin6.sin6_addr, buf, len);
#elif defined(_WIN32)
- // Only Windoze Vista (and newer) have inet_ntop()
- strncpy(buf, inet_ntoa(usa->sin.sin_addr), len);
+ // Only Windoze Vista (and newer) have inet_ntop()
+ strncpy(buf, inet_ntoa(usa->sin.sin_addr), len);
#else
- inet_ntop(usa->sa.sa_family, (void *) &usa->sin.sin_addr, buf, len);
+ inet_ntop(usa->sa.sa_family, (void *) &usa->sin.sin_addr, buf, len);
#endif
}
static void cry(struct mg_connection *conn,
- PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
+ PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
// Print error message to the opened error log stream.
static void cry(struct mg_connection *conn, const char *fmt, ...) {
- char buf[MG_BUF_LEN], src_addr[IP_ADDR_STR_LEN];
- va_list ap;
- FILE *fp;
- time_t timestamp;
-
- va_start(ap, fmt);
- (void) vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
-
- // Do not lock when getting the callback value, here and below.
- // I suppose this is fine, since function cannot disappear in the
- // same way string option can.
- if (conn->ctx->callbacks.log_message == NULL ||
- conn->ctx->callbacks.log_message(conn, buf) == 0) {
- fp = conn->ctx == NULL || conn->ctx->config[ERROR_LOG_FILE] == NULL ? NULL :
- fopen(conn->ctx->config[ERROR_LOG_FILE], "a+");
-
- if (fp != NULL) {
- flockfile(fp);
- timestamp = time(NULL);
-
- sockaddr_to_string(src_addr, sizeof(src_addr), &conn->client.rsa);
- fprintf(fp, "[%010lu] [error] [client %s] ", (unsigned long) timestamp,
- src_addr);
-
- if (conn->request_info.request_method != NULL) {
- fprintf(fp, "%s %s: ", conn->request_info.request_method,
- conn->request_info.uri);
- }
-
- fprintf(fp, "%s", buf);
- fputc('\n', fp);
- funlockfile(fp);
- fclose(fp);
- }
- }
+ char buf[MG_BUF_LEN], src_addr[IP_ADDR_STR_LEN];
+ va_list ap;
+ FILE *fp;
+ time_t timestamp;
+
+ va_start(ap, fmt);
+ (void) vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+
+ // Do not lock when getting the callback value, here and below.
+ // I suppose this is fine, since function cannot disappear in the
+ // same way string option can.
+ if (conn->ctx->callbacks.log_message == NULL ||
+ conn->ctx->callbacks.log_message(conn, buf) == 0) {
+ fp = conn->ctx == NULL || conn->ctx->config[ERROR_LOG_FILE] == NULL ? NULL :
+ fopen(conn->ctx->config[ERROR_LOG_FILE], "a+");
+
+ if (fp != NULL) {
+ flockfile(fp);
+ timestamp = time(NULL);
+
+ sockaddr_to_string(src_addr, sizeof(src_addr), &conn->client.rsa);
+ fprintf(fp, "[%010lu] [error] [client %s] ", (unsigned long) timestamp,
+ src_addr);
+
+ if (conn->request_info.request_method != NULL) {
+ fprintf(fp, "%s %s: ", conn->request_info.request_method,
+ conn->request_info.uri);
+ }
+
+ fprintf(fp, "%s", buf);
+ fputc('\n', fp);
+ funlockfile(fp);
+ fclose(fp);
+ }
+ }
}
// Return fake connection structure. Used for logging, if connection
// is not applicable at the moment of logging.
static struct mg_connection *fc(struct mg_context *ctx) {
- static struct mg_connection fake_connection;
- fake_connection.ctx = ctx;
- return &fake_connection;
+ static struct mg_connection fake_connection;
+ fake_connection.ctx = ctx;
+ return &fake_connection;
}
const char *mg_version(void) {
- return MONGOOSE_VERSION;
+ return MONGOOSE_VERSION;
}
struct mg_request_info *mg_get_request_info(struct mg_connection *conn) {
- return &conn->request_info;
+ return &conn->request_info;
}
static void mg_strlcpy(register char *dst, register const char *src, size_t n) {
- for (; *src != '\0' && n > 1; n--) {
- *dst++ = *src++;
- }
- *dst = '\0';
+ for (; *src != '\0' && n > 1; n--) {
+ *dst++ = *src++;
+ }
+ *dst = '\0';
}
static int lowercase(const char *s) {
- return tolower(* (const unsigned char *) s);
+ return tolower(* (const unsigned char *) s);
}
static int mg_strncasecmp(const char *s1, const char *s2, size_t len) {
- int diff = 0;
+ int diff = 0;
- if (len > 0)
- do {
- diff = lowercase(s1++) - lowercase(s2++);
- } while (diff == 0 && s1[-1] != '\0' && --len > 0);
+ if (len > 0)
+ do {
+ diff = lowercase(s1++) - lowercase(s2++);
+ } while (diff == 0 && s1[-1] != '\0' && --len > 0);
- return diff;
+ return diff;
}
static int mg_strcasecmp(const char *s1, const char *s2) {
- int diff;
+ int diff;
- do {
- diff = lowercase(s1++) - lowercase(s2++);
- } while (diff == 0 && s1[-1] != '\0');
+ do {
+ diff = lowercase(s1++) - lowercase(s2++);
+ } while (diff == 0 && s1[-1] != '\0');
- return diff;
+ return diff;
}
static char * mg_strndup(const char *ptr, size_t len) {
- char *p;
+ char *p;
- if ((p = (char *) malloc(len + 1)) != NULL) {
- mg_strlcpy(p, ptr, len + 1);
- }
+ if ((p = (char *) malloc(len + 1)) != NULL) {
+ mg_strlcpy(p, ptr, len + 1);
+ }
- return p;
+ return p;
}
static char * mg_strdup(const char *str) {
- return mg_strndup(str, strlen(str));
+ return mg_strndup(str, strlen(str));
}
static const char *mg_strcasestr(const char *big_str, const char *small_str) {
- int i, big_len = strlen(big_str), small_len = strlen(small_str);
+ int i, big_len = strlen(big_str), small_len = strlen(small_str);
- for (i = 0; i <= big_len - small_len; i++) {
- if (mg_strncasecmp(big_str + i, small_str, small_len) == 0) {
- return big_str + i;
- }
- }
+ for (i = 0; i <= big_len - small_len; i++) {
+ if (mg_strncasecmp(big_str + i, small_str, small_len) == 0) {
+ return big_str + i;
+ }
+ }
- return NULL;
+ return NULL;
}
// Like snprintf(), but never returns negative value, or a value
@@ -745,41 +745,41 @@ static const char *mg_strcasestr(const char *big_str, const char *small_str) {
// Thanks to Adam Zeldis to pointing snprintf()-caused vulnerability
// in his audit report.
static int mg_vsnprintf(struct mg_connection *conn, char *buf, size_t buflen,
- const char *fmt, va_list ap) {
- int n;
+ const char *fmt, va_list ap) {
+ int n;
- if (buflen == 0)
- return 0;
+ if (buflen == 0)
+ return 0;
- n = vsnprintf(buf, buflen, fmt, ap);
+ n = vsnprintf(buf, buflen, fmt, ap);
- if (n < 0) {
- cry(conn, "vsnprintf error");
- n = 0;
- } else if (n >= (int) buflen) {
- cry(conn, "truncating vsnprintf buffer: [%.*s]",
- n > 200 ? 200 : n, buf);
- n = (int) buflen - 1;
- }
- buf[n] = '\0';
+ if (n < 0) {
+ cry(conn, "vsnprintf error");
+ n = 0;
+ } else if (n >= (int) buflen) {
+ cry(conn, "truncating vsnprintf buffer: [%.*s]",
+ n > 200 ? 200 : n, buf);
+ n = (int) buflen - 1;
+ }
+ buf[n] = '\0';
- return n;
+ return n;
}
static int mg_snprintf(struct mg_connection *conn, char *buf, size_t buflen,
- PRINTF_FORMAT_STRING(const char *fmt), ...)
- PRINTF_ARGS(4, 5);
+ PRINTF_FORMAT_STRING(const char *fmt), ...)
+ PRINTF_ARGS(4, 5);
static int mg_snprintf(struct mg_connection *conn, char *buf, size_t buflen,
- const char *fmt, ...) {
- va_list ap;
- int n;
+ const char *fmt, ...) {
+ va_list ap;
+ int n;
- va_start(ap, fmt);
- n = mg_vsnprintf(conn, buf, buflen, fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ n = mg_vsnprintf(conn, buf, buflen, fmt, ap);
+ va_end(ap);
- return n;
+ return n;
}
// Skip the characters until one of the delimiters characters found.
@@ -787,68 +787,68 @@ static int mg_snprintf(struct mg_connection *conn, char *buf, size_t buflen,
// Advance pointer to buffer to the next word. Return found 0-terminated word.
// Delimiters can be quoted with quotechar.
static char *skip_quoted(char **buf, const char *delimiters,
- const char *whitespace, char quotechar) {
- char *p, *begin_word, *end_word, *end_whitespace;
-
- begin_word = *buf;
- end_word = begin_word + strcspn(begin_word, delimiters);
-
- // Check for quotechar
- if (end_word > begin_word) {
- p = end_word - 1;
- while (*p == quotechar) {
- // If there is anything beyond end_word, copy it
- if (*end_word == '\0') {
- *p = '\0';
- break;
- } else {
- size_t end_off = strcspn(end_word + 1, delimiters);
- memmove (p, end_word, end_off + 1);
- p += end_off; // p must correspond to end_word - 1
- end_word += end_off + 1;
- }
- }
- for (p++; p < end_word; p++) {
- *p = '\0';
- }
- }
-
- if (*end_word == '\0') {
- *buf = end_word;
- } else {
- end_whitespace = end_word + 1 + strspn(end_word + 1, whitespace);
-
- for (p = end_word; p < end_whitespace; p++) {
- *p = '\0';
- }
-
- *buf = end_whitespace;
- }
-
- return begin_word;
+ const char *whitespace, char quotechar) {
+ char *p, *begin_word, *end_word, *end_whitespace;
+
+ begin_word = *buf;
+ end_word = begin_word + strcspn(begin_word, delimiters);
+
+ // Check for quotechar
+ if (end_word > begin_word) {
+ p = end_word - 1;
+ while (*p == quotechar) {
+ // If there is anything beyond end_word, copy it
+ if (*end_word == '\0') {
+ *p = '\0';
+ break;
+ } else {
+ size_t end_off = strcspn(end_word + 1, delimiters);
+ memmove (p, end_word, end_off + 1);
+ p += end_off; // p must correspond to end_word - 1
+ end_word += end_off + 1;
+ }
+ }
+ for (p++; p < end_word; p++) {
+ *p = '\0';
+ }
+ }
+
+ if (*end_word == '\0') {
+ *buf = end_word;
+ } else {
+ end_whitespace = end_word + 1 + strspn(end_word + 1, whitespace);
+
+ for (p = end_word; p < end_whitespace; p++) {
+ *p = '\0';
+ }
+
+ *buf = end_whitespace;
+ }
+
+ return begin_word;
}
// Simplified version of skip_quoted without quote char
// and whitespace == delimiters
static char *skip(char **buf, const char *delimiters) {
- return skip_quoted(buf, delimiters, delimiters, 0);
+ return skip_quoted(buf, delimiters, delimiters, 0);
}
// Return HTTP header value, or NULL if not found.
static const char *get_header(const struct mg_request_info *ri,
- const char *name) {
- int i;
+ const char *name) {
+ int i;
- for (i = 0; i < ri->num_headers; i++)
- if (!mg_strcasecmp(name, ri->http_headers[i].name))
- return ri->http_headers[i].value;
+ for (i = 0; i < ri->num_headers; i++)
+ if (!mg_strcasecmp(name, ri->http_headers[i].name))
+ return ri->http_headers[i].value;
- return NULL;
+ return NULL;
}
const char *mg_get_header(const struct mg_connection *conn, const char *name) {
- return get_header(&conn->request_info, name);
+ return get_header(&conn->request_info, name);
}
// A helper function for traversing a comma separated list of values.
@@ -858,266 +858,266 @@ const char *mg_get_header(const struct mg_connection *conn, const char *name) {
// vector is initialized to point to the "y" part, and val vector length
// is adjusted to point only to "x".
static const char *next_option(const char *list, struct vec *val,
- struct vec *eq_val) {
- if (list == NULL || *list == '\0') {
- // End of the list
- list = NULL;
- } else {
- val->ptr = list;
- if ((list = strchr(val->ptr, ',')) != NULL) {
- // Comma found. Store length and shift the list ptr
- val->len = list - val->ptr;
- list++;
- } else {
- // This value is the last one
- list = val->ptr + strlen(val->ptr);
- val->len = list - val->ptr;
- }
-
- if (eq_val != NULL) {
- // Value has form "x=y", adjust pointers and lengths
- // so that val points to "x", and eq_val points to "y".
- eq_val->len = 0;
- eq_val->ptr = (const char *) memchr(val->ptr, '=', val->len);
- if (eq_val->ptr != NULL) {
- eq_val->ptr++; // Skip over '=' character
- eq_val->len = val->ptr + val->len - eq_val->ptr;
- val->len = (eq_val->ptr - val->ptr) - 1;
- }
- }
- }
-
- return list;
+ struct vec *eq_val) {
+ if (list == NULL || *list == '\0') {
+ // End of the list
+ list = NULL;
+ } else {
+ val->ptr = list;
+ if ((list = strchr(val->ptr, ',')) != NULL) {
+ // Comma found. Store length and shift the list ptr
+ val->len = list - val->ptr;
+ list++;
+ } else {
+ // This value is the last one
+ list = val->ptr + strlen(val->ptr);
+ val->len = list - val->ptr;
+ }
+
+ if (eq_val != NULL) {
+ // Value has form "x=y", adjust pointers and lengths
+ // so that val points to "x", and eq_val points to "y".
+ eq_val->len = 0;
+ eq_val->ptr = (const char *) memchr(val->ptr, '=', val->len);
+ if (eq_val->ptr != NULL) {
+ eq_val->ptr++; // Skip over '=' character
+ eq_val->len = val->ptr + val->len - eq_val->ptr;
+ val->len = (eq_val->ptr - val->ptr) - 1;
+ }
+ }
+ }
+
+ return list;
}
static int match_prefix(const char *pattern, int pattern_len, const char *str) {
- const char *or_str;
- int i, j, len, res;
-
- if ((or_str = (const char *) memchr(pattern, '|', pattern_len)) != NULL) {
- res = match_prefix(pattern, or_str - pattern, str);
- return res > 0 ? res :
- match_prefix(or_str + 1, (pattern + pattern_len) - (or_str + 1), str);
- }
-
- i = j = 0;
- res = -1;
- for (; i < pattern_len; i++, j++) {
- if (pattern[i] == '?' && str[j] != '\0') {
- continue;
- } else if (pattern[i] == '$') {
- return str[j] == '\0' ? j : -1;
- } else if (pattern[i] == '*') {
- i++;
- if (pattern[i] == '*') {
- i++;
- len = (int) strlen(str + j);
- } else {
- len = (int) strcspn(str + j, "/");
- }
- if (i == pattern_len) {
- return j + len;
- }
- do {
- res = match_prefix(pattern + i, pattern_len - i, str + j + len);
- } while (res == -1 && len-- > 0);
- return res == -1 ? -1 : j + res + len;
- } else if (pattern[i] != str[j]) {
- return -1;
- }
- }
- return j;
+ const char *or_str;
+ int i, j, len, res;
+
+ if ((or_str = (const char *) memchr(pattern, '|', pattern_len)) != NULL) {
+ res = match_prefix(pattern, or_str - pattern, str);
+ return res > 0 ? res :
+ match_prefix(or_str + 1, (pattern + pattern_len) - (or_str + 1), str);
+ }
+
+ i = j = 0;
+ res = -1;
+ for (; i < pattern_len; i++, j++) {
+ if (pattern[i] == '?' && str[j] != '\0') {
+ continue;
+ } else if (pattern[i] == '$') {
+ return str[j] == '\0' ? j : -1;
+ } else if (pattern[i] == '*') {
+ i++;
+ if (pattern[i] == '*') {
+ i++;
+ len = (int) strlen(str + j);
+ } else {
+ len = (int) strcspn(str + j, "/");
+ }
+ if (i == pattern_len) {
+ return j + len;
+ }
+ do {
+ res = match_prefix(pattern + i, pattern_len - i, str + j + len);
+ } while (res == -1 && len-- > 0);
+ return res == -1 ? -1 : j + res + len;
+ } else if (pattern[i] != str[j]) {
+ return -1;
+ }
+ }
+ return j;
}
// HTTP 1.1 assumes keep alive if "Connection:" header is not set
// This function must tolerate situations when connection info is not
// set up, for example if request parsing failed.
static int should_keep_alive(const struct mg_connection *conn) {
- const char *http_version = conn->request_info.http_version;
- const char *header = mg_get_header(conn, "Connection");
- if (conn->must_close ||
- conn->status_code == 401 ||
- mg_strcasecmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes") != 0 ||
- (header != NULL && mg_strcasecmp(header, "keep-alive") != 0) ||
- (header == NULL && http_version && strcmp(http_version, "1.1"))) {
- return 0;
- }
- return 1;
+ const char *http_version = conn->request_info.http_version;
+ const char *header = mg_get_header(conn, "Connection");
+ if (conn->must_close ||
+ conn->status_code == 401 ||
+ mg_strcasecmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes") != 0 ||
+ (header != NULL && mg_strcasecmp(header, "keep-alive") != 0) ||
+ (header == NULL && http_version && strcmp(http_version, "1.1"))) {
+ return 0;
+ }
+ return 1;
}
static const char *suggest_connection_header(const struct mg_connection *conn) {
- return should_keep_alive(conn) ? "keep-alive" : "close";
+ return should_keep_alive(conn) ? "keep-alive" : "close";
}
static void send_http_error(struct mg_connection *, int, const char *,
- PRINTF_FORMAT_STRING(const char *fmt), ...)
- PRINTF_ARGS(4, 5);
+ PRINTF_FORMAT_STRING(const char *fmt), ...)
+ PRINTF_ARGS(4, 5);
static void send_http_error(struct mg_connection *conn, int status,
- const char *reason, const char *fmt, ...) {
- char buf[MG_BUF_LEN];
- va_list ap;
- int len = 0;
-
- conn->status_code = status;
- if (conn->ctx->callbacks.http_error == NULL ||
- conn->ctx->callbacks.http_error(conn, status)) {
- buf[0] = '\0';
-
- // Errors 1xx, 204 and 304 MUST NOT send a body
- if (status > 199 && status != 204 && status != 304) {
- len = mg_snprintf(conn, buf, sizeof(buf), "Error %d: %s", status, reason);
- buf[len++] = '\n';
-
- va_start(ap, fmt);
- len += mg_vsnprintf(conn, buf + len, sizeof(buf) - len, fmt, ap);
- va_end(ap);
- }
- DEBUG_TRACE(("[%s]", buf));
-
- mg_printf(conn, "HTTP/1.1 %d %s\r\n"
- "Content-Length: %d\r\n"
- "Connection: %s\r\n\r\n", status, reason, len,
- suggest_connection_header(conn));
- conn->num_bytes_sent += mg_printf(conn, "%s", buf);
- }
+ const char *reason, const char *fmt, ...) {
+ char buf[MG_BUF_LEN];
+ va_list ap;
+ int len = 0;
+
+ conn->status_code = status;
+ if (conn->ctx->callbacks.http_error == NULL ||
+ conn->ctx->callbacks.http_error(conn, status)) {
+ buf[0] = '\0';
+
+ // Errors 1xx, 204 and 304 MUST NOT send a body
+ if (status > 199 && status != 204 && status != 304) {
+ len = mg_snprintf(conn, buf, sizeof(buf), "Error %d: %s", status, reason);
+ buf[len++] = '\n';
+
+ va_start(ap, fmt);
+ len += mg_vsnprintf(conn, buf + len, sizeof(buf) - len, fmt, ap);
+ va_end(ap);
+ }
+ DEBUG_TRACE(("[%s]", buf));
+
+ mg_printf(conn, "HTTP/1.1 %d %s\r\n"
+ "Content-Length: %d\r\n"
+ "Connection: %s\r\n\r\n", status, reason, len,
+ suggest_connection_header(conn));
+ conn->num_bytes_sent += mg_printf(conn, "%s", buf);
+ }
}
#if defined(_WIN32) && !defined(__SYMBIAN32__)
static int pthread_mutex_init(pthread_mutex_t *mutex, void *unused) {
- (void) unused;
- *mutex = CreateMutex(NULL, FALSE, NULL);
- return *mutex == NULL ? -1 : 0;
+ (void) unused;
+ *mutex = CreateMutex(NULL, FALSE, NULL);
+ return *mutex == NULL ? -1 : 0;
}
static int pthread_mutex_destroy(pthread_mutex_t *mutex) {
- return CloseHandle(*mutex) == 0 ? -1 : 0;
+ return CloseHandle(*mutex) == 0 ? -1 : 0;
}
static int pthread_mutex_lock(pthread_mutex_t *mutex) {
- return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1;
+ return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1;
}
static int pthread_mutex_unlock(pthread_mutex_t *mutex) {
- return ReleaseMutex(*mutex) == 0 ? -1 : 0;
+ return ReleaseMutex(*mutex) == 0 ? -1 : 0;
}
static int pthread_cond_init(pthread_cond_t *cv, const void *unused) {
- (void) unused;
- cv->signal = CreateEvent(NULL, FALSE, FALSE, NULL);
- cv->broadcast = CreateEvent(NULL, TRUE, FALSE, NULL);
- return cv->signal != NULL && cv->broadcast != NULL ? 0 : -1;
+ (void) unused;
+ cv->signal = CreateEvent(NULL, FALSE, FALSE, NULL);
+ cv->broadcast = CreateEvent(NULL, TRUE, FALSE, NULL);
+ return cv->signal != NULL && cv->broadcast != NULL ? 0 : -1;
}
static int pthread_cond_wait(pthread_cond_t *cv, pthread_mutex_t *mutex) {
- HANDLE handles[] = {cv->signal, cv->broadcast};
- ReleaseMutex(*mutex);
- WaitForMultipleObjects(2, handles, FALSE, INFINITE);
- return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1;
+ HANDLE handles[] = {cv->signal, cv->broadcast};
+ ReleaseMutex(*mutex);
+ WaitForMultipleObjects(2, handles, FALSE, INFINITE);
+ return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1;
}
static int pthread_cond_signal(pthread_cond_t *cv) {
- return SetEvent(cv->signal) == 0 ? -1 : 0;
+ return SetEvent(cv->signal) == 0 ? -1 : 0;
}
static int pthread_cond_broadcast(pthread_cond_t *cv) {
- // Implementation with PulseEvent() has race condition, see
- // http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
- return PulseEvent(cv->broadcast) == 0 ? -1 : 0;
+ // Implementation with PulseEvent() has race condition, see
+ // http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
+ return PulseEvent(cv->broadcast) == 0 ? -1 : 0;
}
static int pthread_cond_destroy(pthread_cond_t *cv) {
- return CloseHandle(cv->signal) && CloseHandle(cv->broadcast) ? 0 : -1;
+ return CloseHandle(cv->signal) && CloseHandle(cv->broadcast) ? 0 : -1;
}
// For Windows, change all slashes to backslashes in path names.
static void change_slashes_to_backslashes(char *path) {
- int i;
+ int i;
- for (i = 0; path[i] != '\0'; i++) {
- if (path[i] == '/')
- path[i] = '\\';
- // i > 0 check is to preserve UNC paths, like \\server\file.txt
- if (path[i] == '\\' && i > 0)
- while (path[i + 1] == '\\' || path[i + 1] == '/')
- (void) memmove(path + i + 1,
- path + i + 2, strlen(path + i + 1));
- }
+ for (i = 0; path[i] != '\0'; i++) {
+ if (path[i] == '/')
+ path[i] = '\\';
+ // i > 0 check is to preserve UNC paths, like \\server\file.txt
+ if (path[i] == '\\' && i > 0)
+ while (path[i + 1] == '\\' || path[i + 1] == '/')
+ (void) memmove(path + i + 1,
+ path + i + 2, strlen(path + i + 1));
+ }
}
// Encode 'path' which is assumed UTF-8 string, into UNICODE string.
// wbuf and wbuf_len is a target buffer and its length.
static void to_unicode(const char *path, wchar_t *wbuf, size_t wbuf_len) {
- char buf[PATH_MAX], buf2[PATH_MAX];
+ char buf[PATH_MAX], buf2[PATH_MAX];
- mg_strlcpy(buf, path, sizeof(buf));
- change_slashes_to_backslashes(buf);
+ mg_strlcpy(buf, path, sizeof(buf));
+ change_slashes_to_backslashes(buf);
- // Convert to Unicode and back. If doubly-converted string does not
- // match the original, something is fishy, reject.
- memset(wbuf, 0, wbuf_len * sizeof(wchar_t));
- MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, (int) wbuf_len);
- WideCharToMultiByte(CP_UTF8, 0, wbuf, (int) wbuf_len, buf2, sizeof(buf2),
- NULL, NULL);
- if (strcmp(buf, buf2) != 0) {
- wbuf[0] = L'\0';
- }
+ // Convert to Unicode and back. If doubly-converted string does not
+ // match the original, something is fishy, reject.
+ memset(wbuf, 0, wbuf_len * sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, (int) wbuf_len);
+ WideCharToMultiByte(CP_UTF8, 0, wbuf, (int) wbuf_len, buf2, sizeof(buf2),
+ NULL, NULL);
+ if (strcmp(buf, buf2) != 0) {
+ wbuf[0] = L'\0';
+ }
}
#if defined(_WIN32_WCE)
static time_t time(time_t *ptime) {
- time_t t;
- SYSTEMTIME st;
- FILETIME ft;
+ time_t t;
+ SYSTEMTIME st;
+ FILETIME ft;
- GetSystemTime(&st);
- SystemTimeToFileTime(&st, &ft);
- t = SYS2UNIX_TIME(ft.dwLowDateTime, ft.dwHighDateTime);
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, &ft);
+ t = SYS2UNIX_TIME(ft.dwLowDateTime, ft.dwHighDateTime);
- if (ptime != NULL) {
- *ptime = t;
- }
+ if (ptime != NULL) {
+ *ptime = t;
+ }
- return t;
+ return t;
}
static struct tm *localtime(const time_t *ptime, struct tm *ptm) {
- int64_t t = ((int64_t) *ptime) * RATE_DIFF + EPOCH_DIFF;
- FILETIME ft, lft;
- SYSTEMTIME st;
- TIME_ZONE_INFORMATION tzinfo;
-
- if (ptm == NULL) {
- return NULL;
- }
-
- * (int64_t *) &ft = t;
- FileTimeToLocalFileTime(&ft, &lft);
- FileTimeToSystemTime(&lft, &st);
- ptm->tm_year = st.wYear - 1900;
- ptm->tm_mon = st.wMonth - 1;
- ptm->tm_wday = st.wDayOfWeek;
- ptm->tm_mday = st.wDay;
- ptm->tm_hour = st.wHour;
- ptm->tm_min = st.wMinute;
- ptm->tm_sec = st.wSecond;
- ptm->tm_yday = 0; // hope nobody uses this
- ptm->tm_isdst =
- GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT ? 1 : 0;
-
- return ptm;
+ int64_t t = ((int64_t) *ptime) * RATE_DIFF + EPOCH_DIFF;
+ FILETIME ft, lft;
+ SYSTEMTIME st;
+ TIME_ZONE_INFORMATION tzinfo;
+
+ if (ptm == NULL) {
+ return NULL;
+ }
+
+ * (int64_t *) &ft = t;
+ FileTimeToLocalFileTime(&ft, &lft);
+ FileTimeToSystemTime(&lft, &st);
+ ptm->tm_year = st.wYear - 1900;
+ ptm->tm_mon = st.wMonth - 1;
+ ptm->tm_wday = st.wDayOfWeek;
+ ptm->tm_mday = st.wDay;
+ ptm->tm_hour = st.wHour;
+ ptm->tm_min = st.wMinute;
+ ptm->tm_sec = st.wSecond;
+ ptm->tm_yday = 0; // hope nobody uses this
+ ptm->tm_isdst =
+ GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT ? 1 : 0;
+
+ return ptm;
}
static struct tm *gmtime(const time_t *ptime, struct tm *ptm) {
- // FIXME(lsm): fix this.
- return localtime(ptime, ptm);
+ // FIXME(lsm): fix this.
+ return localtime(ptime, ptm);
}
static size_t strftime(char *dst, size_t dst_size, const char *fmt,
- const struct tm *tm) {
- (void) snprintf(dst, dst_size, "implement strftime() for WinCE");
- return 0;
+ const struct tm *tm) {
+ (void) snprintf(dst, dst_size, "implement strftime() for WinCE");
+ return 0;
}
#endif
@@ -1126,737 +1126,735 @@ static size_t strftime(char *dst, size_t dst_size, const char *fmt,
// "a.cgi", despite one would expect an error back.
// This function returns non-0 if path ends with some garbage.
static int path_cannot_disclose_cgi(const char *path) {
- static const char *allowed_last_characters = "_-";
- int last = path[strlen(path) - 1];
- return isalnum(last) || strchr(allowed_last_characters, last) != NULL;
+ static const char *allowed_last_characters = "_-";
+ int last = path[strlen(path) - 1];
+ return isalnum(last) || strchr(allowed_last_characters, last) != NULL;
}
static int mg_stat(struct mg_connection *conn, const char *path,
- struct file *filep) {
- wchar_t wbuf[PATH_MAX];
- WIN32_FILE_ATTRIBUTE_DATA info;
-
- if (!is_file_in_memory(conn, path, filep)) {
- to_unicode(path, wbuf, ARRAY_SIZE(wbuf));
- if (GetFileAttributesExW(wbuf, GetFileExInfoStandard, &info) != 0) {
- filep->size = MAKEUQUAD(info.nFileSizeLow, info.nFileSizeHigh);
- filep->modification_time = SYS2UNIX_TIME(
- info.ftLastWriteTime.dwLowDateTime,
- info.ftLastWriteTime.dwHighDateTime);
- filep->is_directory = info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
- // If file name is fishy, reset the file structure and return error.
- // Note it is important to reset, not just return the error, cause
- // functions like is_file_opened() check the struct.
- if (!filep->is_directory && !path_cannot_disclose_cgi(path)) {
- memset(filep, 0, sizeof(*filep));
- }
- }
- }
-
- return filep->membuf != NULL || filep->modification_time != 0;
+ struct file *filep) {
+ wchar_t wbuf[PATH_MAX];
+ WIN32_FILE_ATTRIBUTE_DATA info;
+
+ if (!is_file_in_memory(conn, path, filep)) {
+ to_unicode(path, wbuf, ARRAY_SIZE(wbuf));
+ if (GetFileAttributesExW(wbuf, GetFileExInfoStandard, &info) != 0) {
+ filep->size = MAKEUQUAD(info.nFileSizeLow, info.nFileSizeHigh);
+ filep->modification_time = SYS2UNIX_TIME(
+ info.ftLastWriteTime.dwLowDateTime,
+ info.ftLastWriteTime.dwHighDateTime);
+ filep->is_directory = info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+ // If file name is fishy, reset the file structure and return error.
+ // Note it is important to reset, not just return the error, cause
+ // functions like is_file_opened() check the struct.
+ if (!filep->is_directory && !path_cannot_disclose_cgi(path)) {
+ memset(filep, 0, sizeof(*filep));
+ }
+ }
+ }
+
+ return filep->membuf != NULL || filep->modification_time != 0;
}
static int mg_remove(const char *path) {
- wchar_t wbuf[PATH_MAX];
- to_unicode(path, wbuf, ARRAY_SIZE(wbuf));
- return DeleteFileW(wbuf) ? 0 : -1;
+ wchar_t wbuf[PATH_MAX];
+ to_unicode(path, wbuf, ARRAY_SIZE(wbuf));
+ return DeleteFileW(wbuf) ? 0 : -1;
}
static int mg_mkdir(const char *path, int mode) {
- char buf[PATH_MAX];
- wchar_t wbuf[PATH_MAX];
+ char buf[PATH_MAX];
+ wchar_t wbuf[PATH_MAX];
- (void) mode;
- mg_strlcpy(buf, path, sizeof(buf));
- change_slashes_to_backslashes(buf);
+ (void) mode;
+ mg_strlcpy(buf, path, sizeof(buf));
+ change_slashes_to_backslashes(buf);
- (void) MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, ARRAY_SIZE(wbuf));
+ (void) MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, ARRAY_SIZE(wbuf));
- return CreateDirectoryW(wbuf, NULL) ? 0 : -1;
+ return CreateDirectoryW(wbuf, NULL) ? 0 : -1;
}
// Implementation of POSIX opendir/closedir/readdir for Windows.
static DIR * opendir(const char *name) {
- DIR *dir = NULL;
- wchar_t wpath[PATH_MAX];
- DWORD attrs;
-
- if (name == NULL) {
- SetLastError(ERROR_BAD_ARGUMENTS);
- } else if ((dir = (DIR *) malloc(sizeof(*dir))) == NULL) {
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- } else {
- to_unicode(name, wpath, ARRAY_SIZE(wpath));
- attrs = GetFileAttributesW(wpath);
- if (attrs != 0xFFFFFFFF &&
- ((attrs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) {
- (void) wcscat(wpath, L"\\*");
- dir->handle = FindFirstFileW(wpath, &dir->info);
- dir->result.d_name[0] = '\0';
- } else {
- free(dir);
- dir = NULL;
- }
- }
-
- return dir;
+ DIR *dir = NULL;
+ wchar_t wpath[PATH_MAX];
+ DWORD attrs;
+
+ if (name == NULL) {
+ SetLastError(ERROR_BAD_ARGUMENTS);
+ } else if ((dir = (DIR *) malloc(sizeof(*dir))) == NULL) {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ } else {
+ to_unicode(name, wpath, ARRAY_SIZE(wpath));
+ attrs = GetFileAttributesW(wpath);
+ if (attrs != 0xFFFFFFFF &&
+ ((attrs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) {
+ (void) wcscat(wpath, L"\\*");
+ dir->handle = FindFirstFileW(wpath, &dir->info);
+ dir->result.d_name[0] = '\0';
+ } else {
+ free(dir);
+ dir = NULL;
+ }
+ }
+
+ return dir;
}
static int closedir(DIR *dir) {
- int result = 0;
+ int result = 0;
- if (dir != NULL) {
- if (dir->handle != INVALID_HANDLE_VALUE)
- result = FindClose(dir->handle) ? 0 : -1;
+ if (dir != NULL) {
+ if (dir->handle != INVALID_HANDLE_VALUE)
+ result = FindClose(dir->handle) ? 0 : -1;
- free(dir);
- } else {
- result = -1;
- SetLastError(ERROR_BAD_ARGUMENTS);
- }
+ free(dir);
+ } else {
+ result = -1;
+ SetLastError(ERROR_BAD_ARGUMENTS);
+ }
- return result;
+ return result;
}
static struct dirent *readdir(DIR *dir) {
- struct dirent *result = 0;
+ struct dirent *result = 0;
- if (dir) {
- if (dir->handle != INVALID_HANDLE_VALUE) {
- result = &dir->result;
- (void) WideCharToMultiByte(CP_UTF8, 0,
- dir->info.cFileName, -1, result->d_name,
- sizeof(result->d_name), NULL, NULL);
+ if (dir) {
+ if (dir->handle != INVALID_HANDLE_VALUE) {
+ result = &dir->result;
+ (void) WideCharToMultiByte(CP_UTF8, 0,
+ dir->info.cFileName, -1, result->d_name,
+ sizeof(result->d_name), NULL, NULL);
- if (!FindNextFileW(dir->handle, &dir->info)) {
- (void) FindClose(dir->handle);
- dir->handle = INVALID_HANDLE_VALUE;
- }
+ if (!FindNextFileW(dir->handle, &dir->info)) {
+ (void) FindClose(dir->handle);
+ dir->handle = INVALID_HANDLE_VALUE;
+ }
- } else {
- SetLastError(ERROR_FILE_NOT_FOUND);
- }
- } else {
- SetLastError(ERROR_BAD_ARGUMENTS);
- }
+ } else {
+ SetLastError(ERROR_FILE_NOT_FOUND);
+ }
+ } else {
+ SetLastError(ERROR_BAD_ARGUMENTS);
+ }
- return result;
+ return result;
}
#ifndef HAVE_POLL
static int poll(struct pollfd *pfd, int n, int milliseconds) {
- struct timeval tv;
- fd_set set;
- int i, result, maxfd = 0;
+ struct timeval tv;
+ fd_set set;
+ int i, result, maxfd = 0;
- tv.tv_sec = milliseconds / 1000;
- tv.tv_usec = (milliseconds % 1000) * 1000;
- FD_ZERO(&set);
+ tv.tv_sec = milliseconds / 1000;
+ tv.tv_usec = (milliseconds % 1000) * 1000;
+ FD_ZERO(&set);
- for (i = 0; i < n; i++) {
- FD_SET((SOCKET) pfd[i].fd, &set);
- pfd[i].revents = 0;
+ for (i = 0; i < n; i++) {
+ FD_SET((SOCKET) pfd[i].fd, &set);
+ pfd[i].revents = 0;
- if (pfd[i].fd > maxfd) {
- maxfd = pfd[i].fd;
- }
- }
+ if (pfd[i].fd > maxfd) {
+ maxfd = pfd[i].fd;
+ }
+ }
- if ((result = select(maxfd + 1, &set, NULL, NULL, &tv)) > 0) {
- for (i = 0; i < n; i++) {
- if (FD_ISSET(pfd[i].fd, &set)) {
- pfd[i].revents = POLLIN;
- }
- }
- }
+ if ((result = select(maxfd + 1, &set, NULL, NULL, &tv)) > 0) {
+ for (i = 0; i < n; i++) {
+ if (FD_ISSET(pfd[i].fd, &set)) {
+ pfd[i].revents = POLLIN;
+ }
+ }
+ }
- return result;
+ return result;
}
#endif // HAVE_POLL
#define set_close_on_exec(x) // No FD_CLOEXEC on Windows
int mg_start_thread(mg_thread_func_t f, void *p) {
- return (long)_beginthread((void (__cdecl *)(void *)) f, 0, p) == -1L ? -1 : 0;
+ return (long)_beginthread((void (__cdecl *)(void *)) f, 0, p) == -1L ? -1 : 0;
}
#if !defined(NO_SSL)
static HANDLE dlopen(const char *dll_name, int flags) {
- wchar_t wbuf[PATH_MAX];
- (void) flags;
- to_unicode(dll_name, wbuf, ARRAY_SIZE(wbuf));
- return LoadLibraryW(wbuf);
+ wchar_t wbuf[PATH_MAX];
+ (void) flags;
+ to_unicode(dll_name, wbuf, ARRAY_SIZE(wbuf));
+ return LoadLibraryW(wbuf);
}
#endif
#if !defined(NO_CGI)
#define SIGKILL 0
static int kill(pid_t pid, int sig_num) {
- (void) TerminateProcess(pid, sig_num);
- (void) CloseHandle(pid);
- return 0;
+ (void) TerminateProcess(pid, sig_num);
+ (void) CloseHandle(pid);
+ return 0;
}
static void trim_trailing_whitespaces(char *s) {
- char *e = s + strlen(s) - 1;
- while (e > s && isspace(* (unsigned char *) e)) {
- *e-- = '\0';
- }
+ char *e = s + strlen(s) - 1;
+ while (e > s && isspace(* (unsigned char *) e)) {
+ *e-- = '\0';
+ }
}
static pid_t spawn_process(struct mg_connection *conn, const char *prog,
- char *envblk, char *envp[], int fd_stdin,
- int fd_stdout, const char *dir) {
- HANDLE me;
- char *p, *interp, full_interp[PATH_MAX], full_dir[PATH_MAX],
- cmdline[PATH_MAX], buf[PATH_MAX];
- struct file file = STRUCT_FILE_INITIALIZER;
- STARTUPINFOA si;
- PROCESS_INFORMATION pi = { 0 };
-
- (void) envp;
-
- memset(&si, 0, sizeof(si));
- si.cb = sizeof(si);
-
- // TODO(lsm): redirect CGI errors to the error log file
- si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_HIDE;
-
- me = GetCurrentProcess();
- DuplicateHandle(me, (HANDLE) _get_osfhandle(fd_stdin), me,
- &si.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS);
- DuplicateHandle(me, (HANDLE) _get_osfhandle(fd_stdout), me,
- &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS);
-
- // If CGI file is a script, try to read the interpreter line
- interp = conn->ctx->config[CGI_INTERPRETER];
- if (interp == NULL) {
- buf[0] = buf[1] = '\0';
-
- // Read the first line of the script into the buffer
- snprintf(cmdline, sizeof(cmdline), "%s%c%s", dir, '/', prog);
- if (mg_fopen(conn, cmdline, "r", &file)) {
- p = (char *) file.membuf;
- mg_fgets(buf, sizeof(buf), &file, &p);
- mg_fclose(&file);
- buf[sizeof(buf) - 1] = '\0';
- }
-
- if (buf[0] == '#' && buf[1] == '!') {
- trim_trailing_whitespaces(buf + 2);
- } else {
- buf[2] = '\0';
- }
- interp = buf + 2;
- }
-
- if (interp[0] != '\0') {
- GetFullPathNameA(interp, sizeof(full_interp), full_interp, NULL);
- interp = full_interp;
- }
- GetFullPathNameA(dir, sizeof(full_dir), full_dir, NULL);
-
- mg_snprintf(conn, cmdline, sizeof(cmdline), "%s%s%s\\%s",
- interp, interp[0] == '\0' ? "" : " ", full_dir, prog);
-
- DEBUG_TRACE(("Running [%s]", cmdline));
- if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE,
- CREATE_NEW_PROCESS_GROUP, envblk, NULL, &si, &pi) == 0) {
- cry(conn, "%s: CreateProcess(%s): %ld",
- __func__, cmdline, ERRNO);
- pi.hProcess = (pid_t) -1;
- }
-
- // Always close these to prevent handle leakage.
- (void) close(fd_stdin);
- (void) close(fd_stdout);
-
- (void) CloseHandle(si.hStdOutput);
- (void) CloseHandle(si.hStdInput);
- (void) CloseHandle(pi.hThread);
-
- return (pid_t) pi.hProcess;
+ char *envblk, char *envp[], int fd_stdin,
+ int fd_stdout, const char *dir) {
+ HANDLE me;
+ char *p, *interp, full_interp[PATH_MAX], full_dir[PATH_MAX],
+ cmdline[PATH_MAX], buf[PATH_MAX];
+ struct file file = STRUCT_FILE_INITIALIZER;
+ STARTUPINFOA si;
+ PROCESS_INFORMATION pi = { 0 };
+
+ (void) envp;
+
+ memset(&si, 0, sizeof(si));
+ si.cb = sizeof(si);
+
+ // TODO(lsm): redirect CGI errors to the error log file
+ si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ si.wShowWindow = SW_HIDE;
+
+ me = GetCurrentProcess();
+ DuplicateHandle(me, (HANDLE) _get_osfhandle(fd_stdin), me,
+ &si.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS);
+ DuplicateHandle(me, (HANDLE) _get_osfhandle(fd_stdout), me,
+ &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS);
+
+ // If CGI file is a script, try to read the interpreter line
+ interp = conn->ctx->config[CGI_INTERPRETER];
+ if (interp == NULL) {
+ buf[0] = buf[1] = '\0';
+
+ // Read the first line of the script into the buffer
+ snprintf(cmdline, sizeof(cmdline), "%s%c%s", dir, '/', prog);
+ if (mg_fopen(conn, cmdline, "r", &file)) {
+ p = (char *) file.membuf;
+ mg_fgets(buf, sizeof(buf), &file, &p);
+ mg_fclose(&file);
+ buf[sizeof(buf) - 1] = '\0';
+ }
+
+ if (buf[0] == '#' && buf[1] == '!') {
+ trim_trailing_whitespaces(buf + 2);
+ } else {
+ buf[2] = '\0';
+ }
+ interp = buf + 2;
+ }
+
+ if (interp[0] != '\0') {
+ GetFullPathNameA(interp, sizeof(full_interp), full_interp, NULL);
+ interp = full_interp;
+ }
+ GetFullPathNameA(dir, sizeof(full_dir), full_dir, NULL);
+
+ mg_snprintf(conn, cmdline, sizeof(cmdline), "%s%s%s\\%s",
+ interp, interp[0] == '\0' ? "" : " ", full_dir, prog);
+
+ DEBUG_TRACE(("Running [%s]", cmdline));
+ if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE,
+ CREATE_NEW_PROCESS_GROUP, envblk, NULL, &si, &pi) == 0) {
+ cry(conn, "%s: CreateProcess(%s): %ld",
+ __func__, cmdline, ERRNO);
+ pi.hProcess = (pid_t) -1;
+ }
+
+ // Always close these to prevent handle leakage.
+ (void) close(fd_stdin);
+ (void) close(fd_stdout);
+
+ (void) CloseHandle(si.hStdOutput);
+ (void) CloseHandle(si.hStdInput);
+ (void) CloseHandle(pi.hThread);
+
+ return (pid_t) pi.hProcess;
}
#endif // !NO_CGI
static int set_non_blocking_mode(SOCKET sock) {
- unsigned long on = 1;
- return ioctlsocket(sock, FIONBIO, &on);
+ unsigned long on = 1;
+ return ioctlsocket(sock, FIONBIO, &on);
}
#else
static int mg_stat(struct mg_connection *conn, const char *path,
- struct file *filep) {
- struct stat st;
+ struct file *filep) {
+ struct stat st;
- if (!is_file_in_memory(conn, path, filep) && !stat(path, &st)) {
- filep->size = st.st_size;
- filep->modification_time = st.st_mtime;
- filep->is_directory = S_ISDIR(st.st_mode);
- } else {
- filep->modification_time = (time_t) 0;
- }
+ if (!is_file_in_memory(conn, path, filep) && !stat(path, &st)) {
+ filep->size = st.st_size;
+ filep->modification_time = st.st_mtime;
+ filep->is_directory = S_ISDIR(st.st_mode);
+ } else {
+ filep->modification_time = (time_t) 0;
+ }
- return filep->membuf != NULL || filep->modification_time != (time_t) 0;
+ return filep->membuf != NULL || filep->modification_time != (time_t) 0;
}
static void set_close_on_exec(int fd) {
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
}
int mg_start_thread(mg_thread_func_t func, void *param) {
- pthread_t thread_id;
- pthread_attr_t attr;
- int result;
+ pthread_t thread_id;
+ pthread_attr_t attr;
+ int result;
- (void) pthread_attr_init(&attr);
- (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- // TODO(lsm): figure out why mongoose dies on Linux if next line is enabled
- // (void) pthread_attr_setstacksize(&attr, sizeof(struct mg_connection) * 5);
+ (void) pthread_attr_init(&attr);
+ (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ // TODO(lsm): figure out why mongoose dies on Linux if next line is enabled
+ // (void) pthread_attr_setstacksize(&attr, sizeof(struct mg_connection) * 5);
- result = pthread_create(&thread_id, &attr, func, param);
- pthread_attr_destroy(&attr);
+ result = pthread_create(&thread_id, &attr, func, param);
+ pthread_attr_destroy(&attr);
- return result;
+ return result;
}
#ifndef NO_CGI
static pid_t spawn_process(struct mg_connection *conn, const char *prog,
- char *envblk, char *envp[], int fd_stdin,
- int fd_stdout, const char *dir) {
- pid_t pid;
- const char *interp;
-
- (void) envblk;
-
- if ((pid = fork()) == -1) {
- // Parent
- send_http_error(conn, 500, http_500_error, "fork(): %s", strerror(ERRNO));
- } else if (pid == 0) {
- // Child
- if (chdir(dir) != 0) {
- cry(conn, "%s: chdir(%s): %s", __func__, dir, strerror(ERRNO));
- } else if (dup2(fd_stdin, 0) == -1) {
- cry(conn, "%s: dup2(%d, 0): %s", __func__, fd_stdin, strerror(ERRNO));
- } else if (dup2(fd_stdout, 1) == -1) {
- cry(conn, "%s: dup2(%d, 1): %s", __func__, fd_stdout, strerror(ERRNO));
- } else {
- // Not redirecting stderr to stdout, to avoid output being littered
- // with the error messages.
- (void) close(fd_stdin);
- (void) close(fd_stdout);
-
- // After exec, all signal handlers are restored to their default values,
- // with one exception of SIGCHLD. According to POSIX.1-2001 and Linux's
- // implementation, SIGCHLD's handler will leave unchanged after exec
- // if it was set to be ignored. Restore it to default action.
- signal(SIGCHLD, SIG_DFL);
-
- interp = conn->ctx->config[CGI_INTERPRETER];
- if (interp == NULL) {
- (void) execle(prog, prog, NULL, envp);
- cry(conn, "%s: execle(%s): %s", __func__, prog, strerror(ERRNO));
- } else {
- (void) execle(interp, interp, prog, NULL, envp);
- cry(conn, "%s: execle(%s %s): %s", __func__, interp, prog,
- strerror(ERRNO));
- }
- }
- exit(EXIT_FAILURE);
- }
-
- // Parent. Close stdio descriptors
- (void) close(fd_stdin);
- (void) close(fd_stdout);
-
- return pid;
+ char *envblk, char *envp[], int fd_stdin,
+ int fd_stdout, const char *dir) {
+ pid_t pid;
+ const char *interp;
+
+ (void) envblk;
+
+ if ((pid = fork()) == -1) {
+ // Parent
+ send_http_error(conn, 500, http_500_error, "fork(): %s", strerror(ERRNO));
+ } else if (pid == 0) {
+ // Child
+ if (chdir(dir) != 0) {
+ cry(conn, "%s: chdir(%s): %s", __func__, dir, strerror(ERRNO));
+ } else if (dup2(fd_stdin, 0) == -1) {
+ cry(conn, "%s: dup2(%d, 0): %s", __func__, fd_stdin, strerror(ERRNO));
+ } else if (dup2(fd_stdout, 1) == -1) {
+ cry(conn, "%s: dup2(%d, 1): %s", __func__, fd_stdout, strerror(ERRNO));
+ } else {
+ // Not redirecting stderr to stdout, to avoid output being littered
+ // with the error messages.
+ (void) close(fd_stdin);
+ (void) close(fd_stdout);
+
+ // After exec, all signal handlers are restored to their default values,
+ // with one exception of SIGCHLD. According to POSIX.1-2001 and Linux's
+ // implementation, SIGCHLD's handler will leave unchanged after exec
+ // if it was set to be ignored. Restore it to default action.
+ signal(SIGCHLD, SIG_DFL);
+
+ interp = conn->ctx->config[CGI_INTERPRETER];
+ if (interp == NULL) {
+ (void) execle(prog, prog, NULL, envp);
+ cry(conn, "%s: execle(%s): %s", __func__, prog, strerror(ERRNO));
+ } else {
+ (void) execle(interp, interp, prog, NULL, envp);
+ cry(conn, "%s: execle(%s %s): %s", __func__, interp, prog,
+ strerror(ERRNO));
+ }
+ }
+ exit(EXIT_FAILURE);
+ }
+
+ // Parent. Close stdio descriptors
+ (void) close(fd_stdin);
+ (void) close(fd_stdout);
+
+ return pid;
}
#endif // !NO_CGI
static int set_non_blocking_mode(SOCKET sock) {
- int flags;
+ int flags;
- flags = fcntl(sock, F_GETFL, 0);
- (void) fcntl(sock, F_SETFL, flags | O_NONBLOCK);
+ flags = fcntl(sock, F_GETFL, 0);
+ (void) fcntl(sock, F_SETFL, flags | O_NONBLOCK);
- return 0;
+ return 0;
}
#endif // _WIN32
// Write data to the IO channel - opened file descriptor, socket or SSL
// descriptor. Return number of bytes written.
static int64_t push(FILE *fp, SOCKET sock, SSL *ssl, const char *buf,
- int64_t len) {
- int64_t sent;
- int n, k;
+ int64_t len) {
+ int64_t sent;
+ int n, k;
- (void) ssl; // Get rid of warning
- sent = 0;
- while (sent < len) {
-
- // How many bytes we send in this iteration
- k = len - sent > INT_MAX ? INT_MAX : (int) (len - sent);
+ (void) ssl; // Get rid of warning
+ sent = 0;
+ while (sent < len) {
+ // How many bytes we send in this iteration
+ k = len - sent > INT_MAX ? INT_MAX : (int) (len - sent);
#ifndef NO_SSL
- if (ssl != NULL) {
- n = SSL_write(ssl, buf + sent, k);
- } else
+ if (ssl != NULL) {
+ n = SSL_write(ssl, buf + sent, k);
+ } else
#endif
- if (fp != NULL) {
- n = (int) fwrite(buf + sent, 1, (size_t) k, fp);
- if (ferror(fp))
- n = -1;
- } else {
- n = send(sock, buf + sent, (size_t) k, MSG_NOSIGNAL);
- }
+ if (fp != NULL) {
+ n = (int) fwrite(buf + sent, 1, (size_t) k, fp);
+ if (ferror(fp))
+ n = -1;
+ } else {
+ n = send(sock, buf + sent, (size_t) k, MSG_NOSIGNAL);
+ }
- if (n <= 0)
- break;
+ if (n <= 0)
+ break;
- sent += n;
- }
+ sent += n;
+ }
- return sent;
+ return sent;
}
// Read from IO channel - opened file descriptor, socket, or SSL descriptor.
// Return negative value on error, or number of bytes read on success.
static int pull(FILE *fp, struct mg_connection *conn, char *buf, int len) {
- int nread;
+ int nread;
- if (fp != NULL) {
- // Use read() instead of fread(), because if we're reading from the CGI
- // pipe, fread() may block until IO buffer is filled up. We cannot afford
- // to block and must pass all read bytes immediately to the client.
- nread = read(fileno(fp), buf, (size_t) len);
+ if (fp != NULL) {
+ // Use read() instead of fread(), because if we're reading from the CGI
+ // pipe, fread() may block until IO buffer is filled up. We cannot afford
+ // to block and must pass all read bytes immediately to the client.
+ nread = read(fileno(fp), buf, (size_t) len);
#ifndef NO_SSL
- } else if (conn->ssl != NULL) {
- nread = SSL_read(conn->ssl, buf, len);
+ } else if (conn->ssl != NULL) {
+ nread = SSL_read(conn->ssl, buf, len);
#endif
- } else {
- nread = recv(conn->client.sock, buf, (size_t) len, 0);
- }
+ } else {
+ nread = recv(conn->client.sock, buf, (size_t) len, 0);
+ }
- return conn->ctx->stop_flag ? -1 : nread;
+ return conn->ctx->stop_flag ? -1 : nread;
}
static int pull_all(FILE *fp, struct mg_connection *conn, char *buf, int len) {
- int n, nread = 0;
+ int n, nread = 0;
- while (len > 0) {
- n = pull(fp, conn, buf + nread, len);
- if (n < 0) {
- nread = n; // Propagate the error
- break;
- } else if (n == 0) {
- break; // No more data to read
- } else {
- conn->consumed_content += n;
- nread += n;
- len -= n;
- }
- }
+ while (len > 0) {
+ n = pull(fp, conn, buf + nread, len);
+ if (n < 0) {
+ nread = n; // Propagate the error
+ break;
+ } else if (n == 0) {
+ break; // No more data to read
+ } else {
+ conn->consumed_content += n;
+ nread += n;
+ len -= n;
+ }
+ }
- return nread;
+ return nread;
}
int mg_read(struct mg_connection *conn, void *buf, size_t len) {
- int n, buffered_len, nread;
- const char *body;
-
- // If Content-Length is not set, read until socket is closed
- if (conn->consumed_content == 0 && conn->content_len == 0) {
- conn->content_len = INT64_MAX;
- conn->must_close = 1;
- }
-
- nread = 0;
- if (conn->consumed_content < conn->content_len) {
- // Adjust number of bytes to read.
- int64_t to_read = conn->content_len - conn->consumed_content;
- if (to_read < (int64_t) len) {
- len = (size_t) to_read;
- }
-
- // Return buffered data
- body = conn->buf + conn->request_len + conn->consumed_content;
- buffered_len = &conn->buf[conn->data_len] - body;
- if (buffered_len > 0) {
- if (len < (size_t) buffered_len) {
- buffered_len = (int) len;
- }
- memcpy(buf, body, (size_t) buffered_len);
- len -= buffered_len;
- conn->consumed_content += buffered_len;
- nread += buffered_len;
- buf = (char *) buf + buffered_len;
- }
-
- // We have returned all buffered data. Read new data from the remote socket.
- n = pull_all(NULL, conn, (char *) buf, (int) len);
- nread = n >= 0 ? nread + n : n;
- }
- return nread;
+ int n, buffered_len, nread;
+ const char *body;
+
+ // If Content-Length is not set, read until socket is closed
+ if (conn->consumed_content == 0 && conn->content_len == 0) {
+ conn->content_len = INT64_MAX;
+ conn->must_close = 1;
+ }
+
+ nread = 0;
+ if (conn->consumed_content < conn->content_len) {
+ // Adjust number of bytes to read.
+ int64_t to_read = conn->content_len - conn->consumed_content;
+ if (to_read < (int64_t) len) {
+ len = (size_t) to_read;
+ }
+
+ // Return buffered data
+ body = conn->buf + conn->request_len + conn->consumed_content;
+ buffered_len = &conn->buf[conn->data_len] - body;
+ if (buffered_len > 0) {
+ if (len < (size_t) buffered_len) {
+ buffered_len = (int) len;
+ }
+ memcpy(buf, body, (size_t) buffered_len);
+ len -= buffered_len;
+ conn->consumed_content += buffered_len;
+ nread += buffered_len;
+ buf = (char *) buf + buffered_len;
+ }
+
+ // We have returned all buffered data. Read new data from the remote socket.
+ n = pull_all(NULL, conn, (char *) buf, (int) len);
+ nread = n >= 0 ? nread + n : n;
+ }
+ return nread;
}
int mg_write(struct mg_connection *conn, const void *buf, size_t len) {
- time_t now;
- int64_t n, total, allowed;
-
- if (conn->throttle > 0) {
- if ((now = time(NULL)) != conn->last_throttle_time) {
- conn->last_throttle_time = now;
- conn->last_throttle_bytes = 0;
- }
- allowed = conn->throttle - conn->last_throttle_bytes;
- if (allowed > (int64_t) len) {
- allowed = len;
- }
- if ((total = push(NULL, conn->client.sock, conn->ssl, (const char *) buf,
- (int64_t) allowed)) == allowed) {
- buf = (char *) buf + total;
- conn->last_throttle_bytes += total;
- while (total < (int64_t) len && conn->ctx->stop_flag == 0) {
- allowed = conn->throttle > (int64_t) len - total ?
- (int64_t) len - total : conn->throttle;
- if ((n = push(NULL, conn->client.sock, conn->ssl, (const char *) buf,
- (int64_t) allowed)) != allowed) {
- break;
- }
- sleep(1);
- conn->last_throttle_bytes = allowed;
- conn->last_throttle_time = time(NULL);
- buf = (char *) buf + n;
- total += n;
- }
- }
- } else {
- total = push(NULL, conn->client.sock, conn->ssl, (const char *) buf,
- (int64_t) len);
- }
- return (int) total;
+ time_t now;
+ int64_t n, total, allowed;
+
+ if (conn->throttle > 0) {
+ if ((now = time(NULL)) != conn->last_throttle_time) {
+ conn->last_throttle_time = now;
+ conn->last_throttle_bytes = 0;
+ }
+ allowed = conn->throttle - conn->last_throttle_bytes;
+ if (allowed > (int64_t) len) {
+ allowed = len;
+ }
+ if ((total = push(NULL, conn->client.sock, conn->ssl, (const char *) buf,
+ (int64_t) allowed)) == allowed) {
+ buf = (char *) buf + total;
+ conn->last_throttle_bytes += total;
+ while (total < (int64_t) len && conn->ctx->stop_flag == 0) {
+ allowed = conn->throttle > (int64_t) len - total ?
+ (int64_t) len - total : conn->throttle;
+ if ((n = push(NULL, conn->client.sock, conn->ssl, (const char *) buf,
+ (int64_t) allowed)) != allowed) {
+ break;
+ }
+ sleep(1);
+ conn->last_throttle_bytes = allowed;
+ conn->last_throttle_time = time(NULL);
+ buf = (char *) buf + n;
+ total += n;
+ }
+ }
+ } else {
+ total = push(NULL, conn->client.sock, conn->ssl, (const char *) buf,
+ (int64_t) len);
+ }
+ return (int) total;
}
// Print message to buffer. If buffer is large enough to hold the message,
// return buffer. If buffer is to small, allocate large enough buffer on heap,
// and return allocated buffer.
static int alloc_vprintf(char **buf, size_t size, const char *fmt, va_list ap) {
- va_list ap_copy;
- int len;
+ va_list ap_copy;
+ int len;
- // Windows is not standard-compliant, and vsnprintf() returns -1 if
- // buffer is too small. Also, older versions of msvcrt.dll do not have
- // _vscprintf(). However, if size is 0, vsnprintf() behaves correctly.
- // Therefore, we make two passes: on first pass, get required message length.
- // On second pass, actually print the message.
- va_copy(ap_copy, ap);
- len = vsnprintf(NULL, 0, fmt, ap_copy);
+ // Windows is not standard-compliant, and vsnprintf() returns -1 if
+ // buffer is too small. Also, older versions of msvcrt.dll do not have
+ // _vscprintf(). However, if size is 0, vsnprintf() behaves correctly.
+ // Therefore, we make two passes: on first pass, get required message length.
+ // On second pass, actually print the message.
+ va_copy(ap_copy, ap);
+ len = vsnprintf(NULL, 0, fmt, ap_copy);
- if (len > (int) size &&
- (size = len + 1) > 0 &&
- (*buf = (char *) malloc(size)) == NULL) {
- len = -1; // Allocation failed, mark failure
- } else {
- va_copy(ap_copy, ap);
- vsnprintf(*buf, size, fmt, ap_copy);
- }
+ if (len > (int) size &&
+ (size = len + 1) > 0 &&
+ (*buf = (char *) malloc(size)) == NULL) {
+ len = -1; // Allocation failed, mark failure
+ } else {
+ va_copy(ap_copy, ap);
+ vsnprintf(*buf, size, fmt, ap_copy);
+ }
- return len;
+ return len;
}
int mg_vprintf(struct mg_connection *conn, const char *fmt, va_list ap) {
- char mem[MG_BUF_LEN], *buf = mem;
- int len;
+ char mem[MG_BUF_LEN], *buf = mem;
+ int len;
- if ((len = alloc_vprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
- len = mg_write(conn, buf, (size_t) len);
- }
- if (buf != mem && buf != NULL) {
- free(buf);
- }
+ if ((len = alloc_vprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
+ len = mg_write(conn, buf, (size_t) len);
+ }
+ if (buf != mem && buf != NULL) {
+ free(buf);
+ }
- return len;
+ return len;
}
int mg_printf(struct mg_connection *conn, const char *fmt, ...) {
- va_list ap;
- va_start(ap, fmt);
- return mg_vprintf(conn, fmt, ap);
+ va_list ap;
+ va_start(ap, fmt);
+ return mg_vprintf(conn, fmt, ap);
}
int mg_url_decode(const char *src, int src_len, char *dst,
- int dst_len, int is_form_url_encoded) {
- int i, j, a, b;
+ int dst_len, int is_form_url_encoded) {
+ int i, j, a, b;
#define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W')
- for (i = j = 0; i < src_len && j < dst_len - 1; i++, j++) {
- if (src[i] == '%' && i < src_len - 2 &&
- isxdigit(* (const unsigned char *) (src + i + 1)) &&
- isxdigit(* (const unsigned char *) (src + i + 2))) {
- a = tolower(* (const unsigned char *) (src + i + 1));
- b = tolower(* (const unsigned char *) (src + i + 2));
- dst[j] = (char) ((HEXTOI(a) << 4) | HEXTOI(b));
- i += 2;
- } else if (is_form_url_encoded && src[i] == '+') {
- dst[j] = ' ';
- } else {
- dst[j] = src[i];
- }
- }
+ for (i = j = 0; i < src_len && j < dst_len - 1; i++, j++) {
+ if (src[i] == '%' && i < src_len - 2 &&
+ isxdigit(* (const unsigned char *) (src + i + 1)) &&
+ isxdigit(* (const unsigned char *) (src + i + 2))) {
+ a = tolower(* (const unsigned char *) (src + i + 1));
+ b = tolower(* (const unsigned char *) (src + i + 2));
+ dst[j] = (char) ((HEXTOI(a) << 4) | HEXTOI(b));
+ i += 2;
+ } else if (is_form_url_encoded && src[i] == '+') {
+ dst[j] = ' ';
+ } else {
+ dst[j] = src[i];
+ }
+ }
- dst[j] = '\0'; // Null-terminate the destination
+ dst[j] = '\0'; // Null-terminate the destination
- return i >= src_len ? j : -1;
+ return i >= src_len ? j : -1;
}
int mg_get_var(const char *data, size_t data_len, const char *name,
- char *dst, size_t dst_len) {
- const char *p, *e, *s;
- size_t name_len;
- int len;
-
- if (dst == NULL || dst_len == 0) {
- len = -2;
- } else if (data == NULL || name == NULL || data_len == 0) {
- len = -1;
- dst[0] = '\0';
- } else {
- name_len = strlen(name);
- e = data + data_len;
- len = -1;
- dst[0] = '\0';
-
- // data is "var1=val1&var2=val2...". Find variable first
- for (p = data; p + name_len < e; p++) {
- if ((p == data || p[-1] == '&') && p[name_len] == '=' &&
- !mg_strncasecmp(name, p, name_len)) {
-
- // Point p to variable value
- p += name_len + 1;
-
- // Point s to the end of the value
- s = (const char *) memchr(p, '&', (size_t)(e - p));
- if (s == NULL) {
- s = e;
- }
- assert(s >= p);
-
- // Decode variable into destination buffer
- len = mg_url_decode(p, (size_t)(s - p), dst, dst_len, 1);
-
- // Redirect error code from -1 to -2 (destination buffer too small).
- if (len == -1) {
- len = -2;
- }
- break;
- }
- }
- }
-
- return len;
+ char *dst, size_t dst_len) {
+ const char *p, *e, *s;
+ size_t name_len;
+ int len;
+
+ if (dst == NULL || dst_len == 0) {
+ len = -2;
+ } else if (data == NULL || name == NULL || data_len == 0) {
+ len = -1;
+ dst[0] = '\0';
+ } else {
+ name_len = strlen(name);
+ e = data + data_len;
+ len = -1;
+ dst[0] = '\0';
+
+ // data is "var1=val1&var2=val2...". Find variable first
+ for (p = data; p + name_len < e; p++) {
+ if ((p == data || p[-1] == '&') && p[name_len] == '=' &&
+ !mg_strncasecmp(name, p, name_len)) {
+ // Point p to variable value
+ p += name_len + 1;
+
+ // Point s to the end of the value
+ s = (const char *) memchr(p, '&', (size_t)(e - p));
+ if (s == NULL) {
+ s = e;
+ }
+ assert(s >= p);
+
+ // Decode variable into destination buffer
+ len = mg_url_decode(p, (size_t)(s - p), dst, dst_len, 1);
+
+ // Redirect error code from -1 to -2 (destination buffer too small).
+ if (len == -1) {
+ len = -2;
+ }
+ break;
+ }
+ }
+ }
+
+ return len;
}
int mg_get_cookie(const char *cookie_header, const char *var_name,
- char *dst, size_t dst_size) {
- const char *s, *p, *end;
- int name_len, len = -1;
-
- if (dst == NULL || dst_size == 0) {
- len = -2;
- } else if (var_name == NULL || (s = cookie_header) == NULL) {
- len = -1;
- dst[0] = '\0';
- } else {
- name_len = (int) strlen(var_name);
- end = s + strlen(s);
- dst[0] = '\0';
-
- for (; (s = mg_strcasestr(s, var_name)) != NULL; s += name_len) {
- if (s[name_len] == '=') {
- s += name_len + 1;
- if ((p = strchr(s, ' ')) == NULL)
- p = end;
- if (p[-1] == ';')
- p--;
- if (*s == '"' && p[-1] == '"' && p > s + 1) {
- s++;
- p--;
- }
- if ((size_t) (p - s) < dst_size) {
- len = p - s;
- mg_strlcpy(dst, s, (size_t) len + 1);
- } else {
- len = -3;
- }
- break;
- }
- }
- }
- return len;
+ char *dst, size_t dst_size) {
+ const char *s, *p, *end;
+ int name_len, len = -1;
+
+ if (dst == NULL || dst_size == 0) {
+ len = -2;
+ } else if (var_name == NULL || (s = cookie_header) == NULL) {
+ len = -1;
+ dst[0] = '\0';
+ } else {
+ name_len = (int) strlen(var_name);
+ end = s + strlen(s);
+ dst[0] = '\0';
+
+ for (; (s = mg_strcasestr(s, var_name)) != NULL; s += name_len) {
+ if (s[name_len] == '=') {
+ s += name_len + 1;
+ if ((p = strchr(s, ' ')) == NULL)
+ p = end;
+ if (p[-1] == ';')
+ p--;
+ if (*s == '"' && p[-1] == '"' && p > s + 1) {
+ s++;
+ p--;
+ }
+ if ((size_t) (p - s) < dst_size) {
+ len = p - s;
+ mg_strlcpy(dst, s, (size_t) len + 1);
+ } else {
+ len = -3;
+ }
+ break;
+ }
+ }
+ }
+ return len;
}
static void convert_uri_to_file_name(struct mg_connection *conn, char *buf,
- size_t buf_len, struct file *filep) {
- struct vec a, b;
- const char *rewrite, *uri = conn->request_info.uri;
- char *p;
- int match_len;
- char gz_path[PATH_MAX];
- char const* accept_encoding;
-
- // Using buf_len - 1 because memmove() for PATH_INFO may shift part
- // of the path one byte on the right.
- mg_snprintf(conn, buf, buf_len - 1, "%s%s", conn->ctx->config[DOCUMENT_ROOT],
- uri);
-
- rewrite = conn->ctx->config[REWRITE];
- while ((rewrite = next_option(rewrite, &a, &b)) != NULL) {
- if ((match_len = match_prefix(a.ptr, a.len, uri)) > 0) {
- mg_snprintf(conn, buf, buf_len - 1, "%.*s%s", (int) b.len, b.ptr,
- uri + match_len);
- break;
- }
- }
-
- if (mg_stat(conn, buf, filep)) return;
-
- // if we can't find the actual file, look for the file
- // with the same name but a .gz extension. If we find it,
- // use that and set the gzipped flag in the file struct
- // to indicate that the response need to have the content-
- // encoding: gzip header
- // we can only do this if the browser declares support
- if ((accept_encoding = mg_get_header(conn, "Accept-Encoding")) != NULL) {
- if (strstr(accept_encoding,"gzip") != NULL) {
- snprintf(gz_path, sizeof(gz_path), "%s.gz", buf);
- if (mg_stat(conn, gz_path, filep)) {
- filep->gzipped = 1;
- return;
- }
- }
- }
-
- // Support PATH_INFO for CGI scripts.
- for (p = buf + strlen(buf); p > buf + 1; p--) {
- if (*p == '/') {
- *p = '\0';
- if (match_prefix(conn->ctx->config[CGI_EXTENSIONS],
- strlen(conn->ctx->config[CGI_EXTENSIONS]), buf) > 0 &&
- mg_stat(conn, buf, filep)) {
- // Shift PATH_INFO block one character right, e.g.
- // "/x.cgi/foo/bar\x00" => "/x.cgi\x00/foo/bar\x00"
- // conn->path_info is pointing to the local variable "path" declared
- // in handle_request(), so PATH_INFO is not valid after
- // handle_request returns.
- conn->path_info = p + 1;
- memmove(p + 2, p + 1, strlen(p + 1) + 1); // +1 is for trailing \0
- p[1] = '/';
- break;
- } else {
- *p = '/';
- }
- }
- }
+ size_t buf_len, struct file *filep) {
+ struct vec a, b;
+ const char *rewrite, *uri = conn->request_info.uri;
+ char *p;
+ int match_len;
+ char gz_path[PATH_MAX];
+ char const* accept_encoding;
+
+ // Using buf_len - 1 because memmove() for PATH_INFO may shift part
+ // of the path one byte on the right.
+ mg_snprintf(conn, buf, buf_len - 1, "%s%s", conn->ctx->config[DOCUMENT_ROOT],
+ uri);
+
+ rewrite = conn->ctx->config[REWRITE];
+ while ((rewrite = next_option(rewrite, &a, &b)) != NULL) {
+ if ((match_len = match_prefix(a.ptr, a.len, uri)) > 0) {
+ mg_snprintf(conn, buf, buf_len - 1, "%.*s%s", (int) b.len, b.ptr,
+ uri + match_len);
+ break;
+ }
+ }
+
+ if (mg_stat(conn, buf, filep)) return;
+
+ // if we can't find the actual file, look for the file
+ // with the same name but a .gz extension. If we find it,
+ // use that and set the gzipped flag in the file struct
+ // to indicate that the response need to have the content-
+ // encoding: gzip header
+ // we can only do this if the browser declares support
+ if ((accept_encoding = mg_get_header(conn, "Accept-Encoding")) != NULL) {
+ if (strstr(accept_encoding,"gzip") != NULL) {
+ snprintf(gz_path, sizeof(gz_path), "%s.gz", buf);
+ if (mg_stat(conn, gz_path, filep)) {
+ filep->gzipped = 1;
+ return;
+ }
+ }
+ }
+
+ // Support PATH_INFO for CGI scripts.
+ for (p = buf + strlen(buf); p > buf + 1; p--) {
+ if (*p == '/') {
+ *p = '\0';
+ if (match_prefix(conn->ctx->config[CGI_EXTENSIONS],
+ strlen(conn->ctx->config[CGI_EXTENSIONS]), buf) > 0 &&
+ mg_stat(conn, buf, filep)) {
+ // Shift PATH_INFO block one character right, e.g.
+ // "/x.cgi/foo/bar\x00" => "/x.cgi\x00/foo/bar\x00"
+ // conn->path_info is pointing to the local variable "path" declared
+ // in handle_request(), so PATH_INFO is not valid after
+ // handle_request returns.
+ conn->path_info = p + 1;
+ memmove(p + 2, p + 1, strlen(p + 1) + 1); // +1 is for trailing \0
+ p[1] = '/';
+ break;
+ } else {
+ *p = '/';
+ }
+ }
+ }
}
// Check whether full request is buffered. Return:
@@ -1864,214 +1862,214 @@ static void convert_uri_to_file_name(struct mg_connection *conn, char *buf,
// 0 if request is not yet fully buffered
// >0 actual request length, including last \r\n\r\n
static int get_request_len(const char *buf, int buflen) {
- const char *s, *e;
- int len = 0;
-
- for (s = buf, e = s + buflen - 1; len <= 0 && s < e; s++)
- // Control characters are not allowed but >=128 is.
- if (!isprint(* (const unsigned char *) s) && *s != '\r' &&
- *s != '\n' && * (const unsigned char *) s < 128) {
- len = -1;
- break; // [i_a] abort scan as soon as one malformed character is found;
- // don't let subsequent \r\n\r\n win us over anyhow
- } else if (s[0] == '\n' && s[1] == '\n') {
- len = (int) (s - buf) + 2;
- } else if (s[0] == '\n' && &s[1] < e &&
- s[1] == '\r' && s[2] == '\n') {
- len = (int) (s - buf) + 3;
- }
-
- return len;
+ const char *s, *e;
+ int len = 0;
+
+ for (s = buf, e = s + buflen - 1; len <= 0 && s < e; s++)
+ // Control characters are not allowed but >=128 is.
+ if (!isprint(* (const unsigned char *) s) && *s != '\r' &&
+ *s != '\n' && * (const unsigned char *) s < 128) {
+ len = -1;
+ break; // [i_a] abort scan as soon as one malformed character is found;
+ // don't let subsequent \r\n\r\n win us over anyhow
+ } else if (s[0] == '\n' && s[1] == '\n') {
+ len = (int) (s - buf) + 2;
+ } else if (s[0] == '\n' && &s[1] < e &&
+ s[1] == '\r' && s[2] == '\n') {
+ len = (int) (s - buf) + 3;
+ }
+
+ return len;
}
// Convert month to the month number. Return -1 on error, or month number
static int get_month_index(const char *s) {
- size_t i;
+ size_t i;
- for (i = 0; i < ARRAY_SIZE(month_names); i++)
- if (!strcmp(s, month_names[i]))
- return (int) i;
+ for (i = 0; i < ARRAY_SIZE(month_names); i++)
+ if (!strcmp(s, month_names[i]))
+ return (int) i;
- return -1;
+ return -1;
}
static int num_leap_years(int year) {
- return year / 4 - year / 100 + year / 400;
+ return year / 4 - year / 100 + year / 400;
}
// Parse UTC date-time string, and return the corresponding time_t value.
static time_t parse_date_string(const char *datetime) {
- static const unsigned short days_before_month[] = {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
- };
- char month_str[32];
- int second, minute, hour, day, month, year, leap_days, days;
- time_t result = (time_t) 0;
-
- if (((sscanf(datetime, "%d/%3s/%d %d:%d:%d",
- &day, month_str, &year, &hour, &minute, &second) == 6) ||
- (sscanf(datetime, "%d %3s %d %d:%d:%d",
- &day, month_str, &year, &hour, &minute, &second) == 6) ||
- (sscanf(datetime, "%*3s, %d %3s %d %d:%d:%d",
- &day, month_str, &year, &hour, &minute, &second) == 6) ||
- (sscanf(datetime, "%d-%3s-%d %d:%d:%d",
- &day, month_str, &year, &hour, &minute, &second) == 6)) &&
- year > 1970 &&
- (month = get_month_index(month_str)) != -1) {
- leap_days = num_leap_years(year) - num_leap_years(1970);
- year -= 1970;
- days = year * 365 + days_before_month[month] + (day - 1) + leap_days;
- result = days * 24 * 3600 + hour * 3600 + minute * 60 + second;
- }
-
- return result;
+ static const unsigned short days_before_month[] = {
+ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
+ };
+ char month_str[32];
+ int second, minute, hour, day, month, year, leap_days, days;
+ time_t result = (time_t) 0;
+
+ if (((sscanf(datetime, "%d/%3s/%d %d:%d:%d",
+ &day, month_str, &year, &hour, &minute, &second) == 6) ||
+ (sscanf(datetime, "%d %3s %d %d:%d:%d",
+ &day, month_str, &year, &hour, &minute, &second) == 6) ||
+ (sscanf(datetime, "%*3s, %d %3s %d %d:%d:%d",
+ &day, month_str, &year, &hour, &minute, &second) == 6) ||
+ (sscanf(datetime, "%d-%3s-%d %d:%d:%d",
+ &day, month_str, &year, &hour, &minute, &second) == 6)) &&
+ year > 1970 &&
+ (month = get_month_index(month_str)) != -1) {
+ leap_days = num_leap_years(year) - num_leap_years(1970);
+ year -= 1970;
+ days = year * 365 + days_before_month[month] + (day - 1) + leap_days;
+ result = days * 24 * 3600 + hour * 3600 + minute * 60 + second;
+ }
+
+ return result;
}
// Protect against directory disclosure attack by removing '..',
// excessive '/' and '\' characters
static void remove_double_dots_and_double_slashes(char *s) {
- char *p = s;
-
- while (*s != '\0') {
- *p++ = *s++;
- if (s[-1] == '/' || s[-1] == '\\') {
- // Skip all following slashes, backslashes and double-dots
- while (s[0] != '\0') {
- if (s[0] == '/' || s[0] == '\\') {
- s++;
- } else if (s[0] == '.' && s[1] == '.') {
- s += 2;
- } else {
- break;
- }
- }
- }
- }
- *p = '\0';
+ char *p = s;
+
+ while (*s != '\0') {
+ *p++ = *s++;
+ if (s[-1] == '/' || s[-1] == '\\') {
+ // Skip all following slashes, backslashes and double-dots
+ while (s[0] != '\0') {
+ if (s[0] == '/' || s[0] == '\\') {
+ s++;
+ } else if (s[0] == '.' && s[1] == '.') {
+ s += 2;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ *p = '\0';
}
static const struct {
- const char *extension;
- size_t ext_len;
- const char *mime_type;
+ const char *extension;
+ size_t ext_len;
+ const char *mime_type;
} builtin_mime_types[] = {
- {".html", 5, "text/html"},
- {".htm", 4, "text/html"},
- {".shtm", 5, "text/html"},
- {".shtml", 6, "text/html"},
- {".css", 4, "text/css"},
- {".js", 3, "application/x-javascript"},
- {".ico", 4, "image/x-icon"},
- {".gif", 4, "image/gif"},
- {".jpg", 4, "image/jpeg"},
- {".jpeg", 5, "image/jpeg"},
- {".png", 4, "image/png"},
- {".svg", 4, "image/svg+xml"},
- {".txt", 4, "text/plain"},
- {".torrent", 8, "application/x-bittorrent"},
- {".wav", 4, "audio/x-wav"},
- {".mp3", 4, "audio/x-mp3"},
- {".mid", 4, "audio/mid"},
- {".m3u", 4, "audio/x-mpegurl"},
- {".ogg", 4, "audio/ogg"},
- {".ram", 4, "audio/x-pn-realaudio"},
- {".xml", 4, "text/xml"},
- {".json", 5, "text/json"},
- {".xslt", 5, "application/xml"},
- {".xsl", 4, "application/xml"},
- {".ra", 3, "audio/x-pn-realaudio"},
- {".doc", 4, "application/msword"},
- {".exe", 4, "application/octet-stream"},
- {".zip", 4, "application/x-zip-compressed"},
- {".xls", 4, "application/excel"},
- {".tgz", 4, "application/x-tar-gz"},
- {".tar", 4, "application/x-tar"},
- {".gz", 3, "application/x-gunzip"},
- {".arj", 4, "application/x-arj-compressed"},
- {".rar", 4, "application/x-arj-compressed"},
- {".rtf", 4, "application/rtf"},
- {".pdf", 4, "application/pdf"},
- {".swf", 4, "application/x-shockwave-flash"},
- {".mpg", 4, "video/mpeg"},
- {".webm", 5, "video/webm"},
- {".mpeg", 5, "video/mpeg"},
- {".mov", 4, "video/quicktime"},
- {".mp4", 4, "video/mp4"},
- {".m4v", 4, "video/x-m4v"},
- {".asf", 4, "video/x-ms-asf"},
- {".avi", 4, "video/x-msvideo"},
- {".bmp", 4, "image/bmp"},
- {".ttf", 4, "application/x-font-ttf"},
- {NULL, 0, NULL}
+ {".html", 5, "text/html"},
+ {".htm", 4, "text/html"},
+ {".shtm", 5, "text/html"},
+ {".shtml", 6, "text/html"},
+ {".css", 4, "text/css"},
+ {".js", 3, "application/x-javascript"},
+ {".ico", 4, "image/x-icon"},
+ {".gif", 4, "image/gif"},
+ {".jpg", 4, "image/jpeg"},
+ {".jpeg", 5, "image/jpeg"},
+ {".png", 4, "image/png"},
+ {".svg", 4, "image/svg+xml"},
+ {".txt", 4, "text/plain"},
+ {".torrent", 8, "application/x-bittorrent"},
+ {".wav", 4, "audio/x-wav"},
+ {".mp3", 4, "audio/x-mp3"},
+ {".mid", 4, "audio/mid"},
+ {".m3u", 4, "audio/x-mpegurl"},
+ {".ogg", 4, "audio/ogg"},
+ {".ram", 4, "audio/x-pn-realaudio"},
+ {".xml", 4, "text/xml"},
+ {".json", 5, "text/json"},
+ {".xslt", 5, "application/xml"},
+ {".xsl", 4, "application/xml"},
+ {".ra", 3, "audio/x-pn-realaudio"},
+ {".doc", 4, "application/msword"},
+ {".exe", 4, "application/octet-stream"},
+ {".zip", 4, "application/x-zip-compressed"},
+ {".xls", 4, "application/excel"},
+ {".tgz", 4, "application/x-tar-gz"},
+ {".tar", 4, "application/x-tar"},
+ {".gz", 3, "application/x-gunzip"},
+ {".arj", 4, "application/x-arj-compressed"},
+ {".rar", 4, "application/x-arj-compressed"},
+ {".rtf", 4, "application/rtf"},
+ {".pdf", 4, "application/pdf"},
+ {".swf", 4, "application/x-shockwave-flash"},
+ {".mpg", 4, "video/mpeg"},
+ {".webm", 5, "video/webm"},
+ {".mpeg", 5, "video/mpeg"},
+ {".mov", 4, "video/quicktime"},
+ {".mp4", 4, "video/mp4"},
+ {".m4v", 4, "video/x-m4v"},
+ {".asf", 4, "video/x-ms-asf"},
+ {".avi", 4, "video/x-msvideo"},
+ {".bmp", 4, "image/bmp"},
+ {".ttf", 4, "application/x-font-ttf"},
+ {NULL, 0, NULL}
};
const char *mg_get_builtin_mime_type(const char *path) {
- const char *ext;
- size_t i, path_len;
+ const char *ext;
+ size_t i, path_len;
- path_len = strlen(path);
+ path_len = strlen(path);
- for (i = 0; builtin_mime_types[i].extension != NULL; i++) {
- ext = path + (path_len - builtin_mime_types[i].ext_len);
- if (path_len > builtin_mime_types[i].ext_len &&
- mg_strcasecmp(ext, builtin_mime_types[i].extension) == 0) {
- return builtin_mime_types[i].mime_type;
- }
- }
+ for (i = 0; builtin_mime_types[i].extension != NULL; i++) {
+ ext = path + (path_len - builtin_mime_types[i].ext_len);
+ if (path_len > builtin_mime_types[i].ext_len &&
+ mg_strcasecmp(ext, builtin_mime_types[i].extension) == 0) {
+ return builtin_mime_types[i].mime_type;
+ }
+ }
- return "text/plain";
+ return "text/plain";
}
// Look at the "path" extension and figure what mime type it has.
// Store mime type in the vector.
static void get_mime_type(struct mg_context *ctx, const char *path,
- struct vec *vec) {
- struct vec ext_vec, mime_vec;
- const char *list, *ext;
- size_t path_len;
+ struct vec *vec) {
+ struct vec ext_vec, mime_vec;
+ const char *list, *ext;
+ size_t path_len;
- path_len = strlen(path);
+ path_len = strlen(path);
- // Scan user-defined mime types first, in case user wants to
- // override default mime types.
- list = ctx->config[EXTRA_MIME_TYPES];
- while ((list = next_option(list, &ext_vec, &mime_vec)) != NULL) {
- // ext now points to the path suffix
- ext = path + path_len - ext_vec.len;
- if (mg_strncasecmp(ext, ext_vec.ptr, ext_vec.len) == 0) {
- *vec = mime_vec;
- return;
- }
- }
+ // Scan user-defined mime types first, in case user wants to
+ // override default mime types.
+ list = ctx->config[EXTRA_MIME_TYPES];
+ while ((list = next_option(list, &ext_vec, &mime_vec)) != NULL) {
+ // ext now points to the path suffix
+ ext = path + path_len - ext_vec.len;
+ if (mg_strncasecmp(ext, ext_vec.ptr, ext_vec.len) == 0) {
+ *vec = mime_vec;
+ return;
+ }
+ }
- vec->ptr = mg_get_builtin_mime_type(path);
- vec->len = strlen(vec->ptr);
+ vec->ptr = mg_get_builtin_mime_type(path);
+ vec->len = strlen(vec->ptr);
}
static int is_big_endian(void) {
- static const int n = 1;
- return ((char *) &n)[0] == 0;
+ static const int n = 1;
+ return ((char *) &n)[0] == 0;
}
#ifndef HAVE_MD5
typedef struct MD5Context {
- uint32_t buf[4];
- uint32_t bits[2];
- unsigned char in[64];
+ uint32_t buf[4];
+ uint32_t bits[2];
+ unsigned char in[64];
} MD5_CTX;
static void byteReverse(unsigned char *buf, unsigned longs) {
- uint32_t t;
+ uint32_t t;
- // Forrest: MD5 expect LITTLE_ENDIAN, swap if BIG_ENDIAN
- if (is_big_endian()) {
- do {
- t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
- ((unsigned) buf[1] << 8 | buf[0]);
- * (uint32_t *) buf = t;
- buf += 4;
- } while (--longs);
- }
+ // Forrest: MD5 expect LITTLE_ENDIAN, swap if BIG_ENDIAN
+ if (is_big_endian()) {
+ do {
+ t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+ ((unsigned) buf[1] << 8 | buf[0]);
+ * (uint32_t *) buf = t;
+ buf += 4;
+ } while (--longs);
+ }
}
#define F1(x, y, z) (z ^ (x & (y ^ z)))
@@ -2080,570 +2078,570 @@ static void byteReverse(unsigned char *buf, unsigned longs) {
#define F4(x, y, z) (y ^ (x | ~z))
#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
+ ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
// Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
// initialization constants.
static void MD5Init(MD5_CTX *ctx) {
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
+ ctx->bits[0] = 0;
+ ctx->bits[1] = 0;
}
static void MD5Transform(uint32_t buf[4], uint32_t const in[16]) {
- register uint32_t a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
+ register uint32_t a, b, c, d;
+
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
+
+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
+
+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
+
+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
}
static void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len) {
- uint32_t t;
+ uint32_t t;
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
- ctx->bits[1]++;
- ctx->bits[1] += len >> 29;
+ t = ctx->bits[0];
+ if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
+ ctx->bits[1]++;
+ ctx->bits[1] += len >> 29;
- t = (t >> 3) & 0x3f;
+ t = (t >> 3) & 0x3f;
- if (t) {
- unsigned char *p = (unsigned char *) ctx->in + t;
+ if (t) {
+ unsigned char *p = (unsigned char *) ctx->in + t;
- t = 64 - t;
- if (len < t) {
- memcpy(p, buf, len);
- return;
- }
- memcpy(p, buf, t);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32_t *) ctx->in);
- buf += t;
- len -= t;
- }
+ t = 64 - t;
+ if (len < t) {
+ memcpy(p, buf, len);
+ return;
+ }
+ memcpy(p, buf, t);
+ byteReverse(ctx->in, 16);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+ buf += t;
+ len -= t;
+ }
- while (len >= 64) {
- memcpy(ctx->in, buf, 64);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32_t *) ctx->in);
- buf += 64;
- len -= 64;
- }
+ while (len >= 64) {
+ memcpy(ctx->in, buf, 64);
+ byteReverse(ctx->in, 16);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+ buf += 64;
+ len -= 64;
+ }
- memcpy(ctx->in, buf, len);
+ memcpy(ctx->in, buf, len);
}
static void MD5Final(unsigned char digest[16], MD5_CTX *ctx) {
- unsigned count;
- unsigned char *p;
- uint32_t *a;
-
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- p = ctx->in + count;
- *p++ = 0x80;
- count = 64 - 1 - count;
- if (count < 8) {
- memset(p, 0, count);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32_t *) ctx->in);
- memset(ctx->in, 0, 56);
- } else {
- memset(p, 0, count - 8);
- }
- byteReverse(ctx->in, 14);
-
- a = (uint32_t *)ctx->in;
- a[14] = ctx->bits[0];
- a[15] = ctx->bits[1];
-
- MD5Transform(ctx->buf, (uint32_t *) ctx->in);
- byteReverse((unsigned char *) ctx->buf, 4);
- memcpy(digest, ctx->buf, 16);
- memset((char *) ctx, 0, sizeof(*ctx));
+ unsigned count;
+ unsigned char *p;
+ uint32_t *a;
+
+ count = (ctx->bits[0] >> 3) & 0x3F;
+
+ p = ctx->in + count;
+ *p++ = 0x80;
+ count = 64 - 1 - count;
+ if (count < 8) {
+ memset(p, 0, count);
+ byteReverse(ctx->in, 16);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+ memset(ctx->in, 0, 56);
+ } else {
+ memset(p, 0, count - 8);
+ }
+ byteReverse(ctx->in, 14);
+
+ a = (uint32_t *)ctx->in;
+ a[14] = ctx->bits[0];
+ a[15] = ctx->bits[1];
+
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+ byteReverse((unsigned char *) ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+ memset((char *) ctx, 0, sizeof(*ctx));
}
#endif // !HAVE_MD5
// Stringify binary data. Output buffer must be twice as big as input,
// because each byte takes 2 bytes in string representation
static void bin2str(char *to, const unsigned char *p, size_t len) {
- static const char *hex = "0123456789abcdef";
+ static const char *hex = "0123456789abcdef";
- for (; len--; p++) {
- *to++ = hex[p[0] >> 4];
- *to++ = hex[p[0] & 0x0f];
- }
- *to = '\0';
+ for (; len--; p++) {
+ *to++ = hex[p[0] >> 4];
+ *to++ = hex[p[0] & 0x0f];
+ }
+ *to = '\0';
}
// Return stringified MD5 hash for list of strings. Buffer must be 33 bytes.
char *mg_md5(char buf[33], ...) {
- unsigned char hash[16];
- const char *p;
- va_list ap;
- MD5_CTX ctx;
+ unsigned char hash[16];
+ const char *p;
+ va_list ap;
+ MD5_CTX ctx;
- MD5Init(&ctx);
+ MD5Init(&ctx);
- va_start(ap, buf);
- while ((p = va_arg(ap, const char *)) != NULL) {
- MD5Update(&ctx, (const unsigned char *) p, (unsigned) strlen(p));
- }
- va_end(ap);
+ va_start(ap, buf);
+ while ((p = va_arg(ap, const char *)) != NULL) {
+ MD5Update(&ctx, (const unsigned char *) p, (unsigned) strlen(p));
+ }
+ va_end(ap);
- MD5Final(hash, &ctx);
- bin2str(buf, hash, sizeof(hash));
- return buf;
+ MD5Final(hash, &ctx);
+ bin2str(buf, hash, sizeof(hash));
+ return buf;
}
// Check the user's password, return 1 if OK
static int check_password(const char *method, const char *ha1, const char *uri,
- const char *nonce, const char *nc, const char *cnonce,
- const char *qop, const char *response) {
- char ha2[32 + 1], expected_response[32 + 1];
+ const char *nonce, const char *nc, const char *cnonce,
+ const char *qop, const char *response) {
+ char ha2[32 + 1], expected_response[32 + 1];
- // Some of the parameters may be NULL
- if (method == NULL || nonce == NULL || nc == NULL || cnonce == NULL ||
- qop == NULL || response == NULL) {
- return 0;
- }
+ // Some of the parameters may be NULL
+ if (method == NULL || nonce == NULL || nc == NULL || cnonce == NULL ||
+ qop == NULL || response == NULL) {
+ return 0;
+ }
- // NOTE(lsm): due to a bug in MSIE, we do not compare the URI
- // TODO(lsm): check for authentication timeout
- if (// strcmp(dig->uri, c->ouri) != 0 ||
- strlen(response) != 32
- // || now - strtoul(dig->nonce, NULL, 10) > 3600
- ) {
- return 0;
- }
+ // NOTE(lsm): due to a bug in MSIE, we do not compare the URI
+ // TODO(lsm): check for authentication timeout
+ if (// strcmp(dig->uri, c->ouri) != 0 ||
+ strlen(response) != 32
+ // || now - strtoul(dig->nonce, NULL, 10) > 3600
+ ) {
+ return 0;
+ }
- mg_md5(ha2, method, ":", uri, NULL);
- mg_md5(expected_response, ha1, ":", nonce, ":", nc,
- ":", cnonce, ":", qop, ":", ha2, NULL);
+ mg_md5(ha2, method, ":", uri, NULL);
+ mg_md5(expected_response, ha1, ":", nonce, ":", nc,
+ ":", cnonce, ":", qop, ":", ha2, NULL);
- return mg_strcasecmp(response, expected_response) == 0;
+ return mg_strcasecmp(response, expected_response) == 0;
}
// Use the global passwords file, if specified by auth_gpass option,
// or search for .htpasswd in the requested directory.
static void open_auth_file(struct mg_connection *conn, const char *path,
- struct file *filep) {
- char name[PATH_MAX];
- const char *p, *e, *gpass = conn->ctx->config[GLOBAL_PASSWORDS_FILE];
- struct file file = STRUCT_FILE_INITIALIZER;
-
- if (gpass != NULL) {
- // Use global passwords file
- if (!mg_fopen(conn, gpass, "r", filep)) {
- cry(conn, "fopen(%s): %s", gpass, strerror(ERRNO));
- }
- // Important: using local struct file to test path for is_directory flag.
- // If filep is used, mg_stat() makes it appear as if auth file was opened.
- } else if (mg_stat(conn, path, &file) && file.is_directory) {
- mg_snprintf(conn, name, sizeof(name), "%s%c%s",
- path, '/', PASSWORDS_FILE_NAME);
- mg_fopen(conn, name, "r", filep);
- } else {
- // Try to find .htpasswd in requested directory.
- for (p = path, e = p + strlen(p) - 1; e > p; e--)
- if (e[0] == '/')
- break;
- mg_snprintf(conn, name, sizeof(name), "%.*s%c%s",
- (int) (e - p), p, '/', PASSWORDS_FILE_NAME);
- mg_fopen(conn, name, "r", filep);
- }
+ struct file *filep) {
+ char name[PATH_MAX];
+ const char *p, *e, *gpass = conn->ctx->config[GLOBAL_PASSWORDS_FILE];
+ struct file file = STRUCT_FILE_INITIALIZER;
+
+ if (gpass != NULL) {
+ // Use global passwords file
+ if (!mg_fopen(conn, gpass, "r", filep)) {
+ cry(conn, "fopen(%s): %s", gpass, strerror(ERRNO));
+ }
+ // Important: using local struct file to test path for is_directory flag.
+ // If filep is used, mg_stat() makes it appear as if auth file was opened.
+ } else if (mg_stat(conn, path, &file) && file.is_directory) {
+ mg_snprintf(conn, name, sizeof(name), "%s%c%s",
+ path, '/', PASSWORDS_FILE_NAME);
+ mg_fopen(conn, name, "r", filep);
+ } else {
+ // Try to find .htpasswd in requested directory.
+ for (p = path, e = p + strlen(p) - 1; e > p; e--)
+ if (e[0] == '/')
+ break;
+ mg_snprintf(conn, name, sizeof(name), "%.*s%c%s",
+ (int) (e - p), p, '/', PASSWORDS_FILE_NAME);
+ mg_fopen(conn, name, "r", filep);
+ }
}
// Parsed Authorization header
struct ah {
- char *user, *uri, *cnonce, *response, *qop, *nc, *nonce;
+ char *user, *uri, *cnonce, *response, *qop, *nc, *nonce;
};
// Return 1 on success. Always initializes the ah structure.
static int parse_auth_header(struct mg_connection *conn, char *buf,
- size_t buf_size, struct ah *ah) {
- char *name, *value, *s;
- const char *auth_header;
-
- (void) memset(ah, 0, sizeof(*ah));
- if ((auth_header = mg_get_header(conn, "Authorization")) == NULL ||
- mg_strncasecmp(auth_header, "Digest ", 7) != 0) {
- return 0;
- }
-
- // Make modifiable copy of the auth header
- (void) mg_strlcpy(buf, auth_header + 7, buf_size);
- s = buf;
-
- // Parse authorization header
- for (;;) {
- // Gobble initial spaces
- while (isspace(* (unsigned char *) s)) {
- s++;
- }
- name = skip_quoted(&s, "=", " ", 0);
- // Value is either quote-delimited, or ends at first comma or space.
- if (s[0] == '\"') {
- s++;
- value = skip_quoted(&s, "\"", " ", '\\');
- if (s[0] == ',') {
- s++;
- }
- } else {
- value = skip_quoted(&s, ", ", " ", 0); // IE uses commas, FF uses spaces
- }
- if (*name == '\0') {
- break;
- }
-
- if (!strcmp(name, "username")) {
- ah->user = value;
- } else if (!strcmp(name, "cnonce")) {
- ah->cnonce = value;
- } else if (!strcmp(name, "response")) {
- ah->response = value;
- } else if (!strcmp(name, "uri")) {
- ah->uri = value;
- } else if (!strcmp(name, "qop")) {
- ah->qop = value;
- } else if (!strcmp(name, "nc")) {
- ah->nc = value;
- } else if (!strcmp(name, "nonce")) {
- ah->nonce = value;
- }
- }
-
- // CGI needs it as REMOTE_USER
- if (ah->user != NULL) {
- conn->request_info.remote_user = mg_strdup(ah->user);
- } else {
- return 0;
- }
-
- return 1;
+ size_t buf_size, struct ah *ah) {
+ char *name, *value, *s;
+ const char *auth_header;
+
+ (void) memset(ah, 0, sizeof(*ah));
+ if ((auth_header = mg_get_header(conn, "Authorization")) == NULL ||
+ mg_strncasecmp(auth_header, "Digest ", 7) != 0) {
+ return 0;
+ }
+
+ // Make modifiable copy of the auth header
+ (void) mg_strlcpy(buf, auth_header + 7, buf_size);
+ s = buf;
+
+ // Parse authorization header
+ for (;;) {
+ // Gobble initial spaces
+ while (isspace(* (unsigned char *) s)) {
+ s++;
+ }
+ name = skip_quoted(&s, "=", " ", 0);
+ // Value is either quote-delimited, or ends at first comma or space.
+ if (s[0] == '\"') {
+ s++;
+ value = skip_quoted(&s, "\"", " ", '\\');
+ if (s[0] == ',') {
+ s++;
+ }
+ } else {
+ value = skip_quoted(&s, ", ", " ", 0); // IE uses commas, FF uses spaces
+ }
+ if (*name == '\0') {
+ break;
+ }
+
+ if (!strcmp(name, "username")) {
+ ah->user = value;
+ } else if (!strcmp(name, "cnonce")) {
+ ah->cnonce = value;
+ } else if (!strcmp(name, "response")) {
+ ah->response = value;
+ } else if (!strcmp(name, "uri")) {
+ ah->uri = value;
+ } else if (!strcmp(name, "qop")) {
+ ah->qop = value;
+ } else if (!strcmp(name, "nc")) {
+ ah->nc = value;
+ } else if (!strcmp(name, "nonce")) {
+ ah->nonce = value;
+ }
+ }
+
+ // CGI needs it as REMOTE_USER
+ if (ah->user != NULL) {
+ conn->request_info.remote_user = mg_strdup(ah->user);
+ } else {
+ return 0;
+ }
+
+ return 1;
}
static char *mg_fgets(char *buf, size_t size, struct file *filep, char **p) {
- char *eof;
- size_t len;
-
- if (filep->membuf != NULL && *p != NULL) {
- eof = (char*)memchr(*p, '\n', &filep->membuf[filep->size] - *p);
- len = (size_t) (eof - *p) > size - 1 ? size - 1 : (size_t) (eof - *p);
- memcpy(buf, *p, len);
- buf[len] = '\0';
- *p = eof;
- return eof;
- } else if (filep->fp != NULL) {
- return fgets(buf, size, filep->fp);
- } else {
- return NULL;
- }
+ char *eof;
+ size_t len;
+
+ if (filep->membuf != NULL && *p != NULL) {
+ eof = (char*)memchr(*p, '\n', &filep->membuf[filep->size] - *p);
+ len = (size_t) (eof - *p) > size - 1 ? size - 1 : (size_t) (eof - *p);
+ memcpy(buf, *p, len);
+ buf[len] = '\0';
+ *p = eof;
+ return eof;
+ } else if (filep->fp != NULL) {
+ return fgets(buf, size, filep->fp);
+ } else {
+ return NULL;
+ }
}
// Authorize against the opened passwords file. Return 1 if authorized.
static int authorize(struct mg_connection *conn, struct file *filep) {
- struct ah ah;
- char line[256], f_user[256], ha1[256], f_domain[256], buf[MG_BUF_LEN], *p;
+ struct ah ah;
+ char line[256], f_user[256], ha1[256], f_domain[256], buf[MG_BUF_LEN], *p;
- if (!parse_auth_header(conn, buf, sizeof(buf), &ah)) {
- return 0;
- }
+ if (!parse_auth_header(conn, buf, sizeof(buf), &ah)) {
+ return 0;
+ }
- // Loop over passwords file
- p = (char *) filep->membuf;
- while (mg_fgets(line, sizeof(line), filep, &p) != NULL) {
- if (sscanf(line, "%[^:]:%[^:]:%s", f_user, f_domain, ha1) != 3) {
- continue;
- }
+ // Loop over passwords file
+ p = (char *) filep->membuf;
+ while (mg_fgets(line, sizeof(line), filep, &p) != NULL) {
+ if (sscanf(line, "%[^:]:%[^:]:%s", f_user, f_domain, ha1) != 3) {
+ continue;
+ }
- if (!strcmp(ah.user, f_user) &&
- !strcmp(conn->ctx->config[AUTHENTICATION_DOMAIN], f_domain))
- return check_password(conn->request_info.request_method, ha1, ah.uri,
- ah.nonce, ah.nc, ah.cnonce, ah.qop, ah.response);
- }
+ if (!strcmp(ah.user, f_user) &&
+ !strcmp(conn->ctx->config[AUTHENTICATION_DOMAIN], f_domain))
+ return check_password(conn->request_info.request_method, ha1, ah.uri,
+ ah.nonce, ah.nc, ah.cnonce, ah.qop, ah.response);
+ }
- return 0;
+ return 0;
}
// Return 1 if request is authorised, 0 otherwise.
static int check_authorization(struct mg_connection *conn, const char *path) {
- char fname[PATH_MAX];
- struct vec uri_vec, filename_vec;
- const char *list;
- struct file file = STRUCT_FILE_INITIALIZER;
- int authorized = 1;
-
- list = conn->ctx->config[PROTECT_URI];
- while ((list = next_option(list, &uri_vec, &filename_vec)) != NULL) {
- if (!memcmp(conn->request_info.uri, uri_vec.ptr, uri_vec.len)) {
- mg_snprintf(conn, fname, sizeof(fname), "%.*s",
- (int) filename_vec.len, filename_vec.ptr);
- if (!mg_fopen(conn, fname, "r", &file)) {
- cry(conn, "%s: cannot open %s: %s", __func__, fname, strerror(errno));
- }
- break;
- }
- }
-
- if (!is_file_opened(&file)) {
- open_auth_file(conn, path, &file);
- }
-
- if (is_file_opened(&file)) {
- authorized = authorize(conn, &file);
- mg_fclose(&file);
- }
-
- return authorized;
+ char fname[PATH_MAX];
+ struct vec uri_vec, filename_vec;
+ const char *list;
+ struct file file = STRUCT_FILE_INITIALIZER;
+ int authorized = 1;
+
+ list = conn->ctx->config[PROTECT_URI];
+ while ((list = next_option(list, &uri_vec, &filename_vec)) != NULL) {
+ if (!memcmp(conn->request_info.uri, uri_vec.ptr, uri_vec.len)) {
+ mg_snprintf(conn, fname, sizeof(fname), "%.*s",
+ (int) filename_vec.len, filename_vec.ptr);
+ if (!mg_fopen(conn, fname, "r", &file)) {
+ cry(conn, "%s: cannot open %s: %s", __func__, fname, strerror(errno));
+ }
+ break;
+ }
+ }
+
+ if (!is_file_opened(&file)) {
+ open_auth_file(conn, path, &file);
+ }
+
+ if (is_file_opened(&file)) {
+ authorized = authorize(conn, &file);
+ mg_fclose(&file);
+ }
+
+ return authorized;
}
static void send_authorization_request(struct mg_connection *conn) {
- conn->status_code = 401;
- mg_printf(conn,
- "HTTP/1.1 401 Unauthorized\r\n"
- "Content-Length: 0\r\n"
- "WWW-Authenticate: Digest qop=\"auth\", "
- "realm=\"%s\", nonce=\"%lu\"\r\n\r\n",
- conn->ctx->config[AUTHENTICATION_DOMAIN],
- (unsigned long) time(NULL));
+ conn->status_code = 401;
+ mg_printf(conn,
+ "HTTP/1.1 401 Unauthorized\r\n"
+ "Content-Length: 0\r\n"
+ "WWW-Authenticate: Digest qop=\"auth\", "
+ "realm=\"%s\", nonce=\"%lu\"\r\n\r\n",
+ conn->ctx->config[AUTHENTICATION_DOMAIN],
+ (unsigned long) time(NULL));
}
static int is_authorized_for_put(struct mg_connection *conn) {
- struct file file = STRUCT_FILE_INITIALIZER;
- const char *passfile = conn->ctx->config[PUT_DELETE_PASSWORDS_FILE];
- int ret = 0;
+ struct file file = STRUCT_FILE_INITIALIZER;
+ const char *passfile = conn->ctx->config[PUT_DELETE_PASSWORDS_FILE];
+ int ret = 0;
- if (passfile != NULL && mg_fopen(conn, passfile, "r", &file)) {
- ret = authorize(conn, &file);
- mg_fclose(&file);
- }
+ if (passfile != NULL && mg_fopen(conn, passfile, "r", &file)) {
+ ret = authorize(conn, &file);
+ mg_fclose(&file);
+ }
- return ret;
+ return ret;
}
int mg_modify_passwords_file(const char *fname, const char *domain,
- const char *user, const char *pass) {
- int found;
- char line[512], u[512], d[512], ha1[33], tmp[PATH_MAX];
- FILE *fp, *fp2;
-
- found = 0;
- fp = fp2 = NULL;
-
- // Regard empty password as no password - remove user record.
- if (pass != NULL && pass[0] == '\0') {
- pass = NULL;
- }
-
- (void) snprintf(tmp, sizeof(tmp), "%s.tmp", fname);
-
- // Create the file if does not exist
- if ((fp = fopen(fname, "a+")) != NULL) {
- (void) fclose(fp);
- }
-
- // Open the given file and temporary file
- if ((fp = fopen(fname, "r")) == NULL) {
- return 0;
- } else if ((fp2 = fopen(tmp, "w+")) == NULL) {
- fclose(fp);
- return 0;
- }
-
- // Copy the stuff to temporary file
- while (fgets(line, sizeof(line), fp) != NULL) {
- if (sscanf(line, "%[^:]:%[^:]:%*s", u, d) != 2) {
- continue;
- }
-
- if (!strcmp(u, user) && !strcmp(d, domain)) {
- found++;
- if (pass != NULL) {
- mg_md5(ha1, user, ":", domain, ":", pass, NULL);
- fprintf(fp2, "%s:%s:%s\n", user, domain, ha1);
- }
- } else {
- fprintf(fp2, "%s", line);
- }
- }
-
- // If new user, just add it
- if (!found && pass != NULL) {
- mg_md5(ha1, user, ":", domain, ":", pass, NULL);
- fprintf(fp2, "%s:%s:%s\n", user, domain, ha1);
- }
-
- // Close files
- fclose(fp);
- fclose(fp2);
-
- // Put the temp file in place of real file
- remove(fname);
- rename(tmp, fname);
-
- return 1;
+ const char *user, const char *pass) {
+ int found;
+ char line[512], u[512], d[512], ha1[33], tmp[PATH_MAX];
+ FILE *fp, *fp2;
+
+ found = 0;
+ fp = fp2 = NULL;
+
+ // Regard empty password as no password - remove user record.
+ if (pass != NULL && pass[0] == '\0') {
+ pass = NULL;
+ }
+
+ (void) snprintf(tmp, sizeof(tmp), "%s.tmp", fname);
+
+ // Create the file if does not exist
+ if ((fp = fopen(fname, "a+")) != NULL) {
+ (void) fclose(fp);
+ }
+
+ // Open the given file and temporary file
+ if ((fp = fopen(fname, "r")) == NULL) {
+ return 0;
+ } else if ((fp2 = fopen(tmp, "w+")) == NULL) {
+ fclose(fp);
+ return 0;
+ }
+
+ // Copy the stuff to temporary file
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ if (sscanf(line, "%[^:]:%[^:]:%*s", u, d) != 2) {
+ continue;
+ }
+
+ if (!strcmp(u, user) && !strcmp(d, domain)) {
+ found++;
+ if (pass != NULL) {
+ mg_md5(ha1, user, ":", domain, ":", pass, NULL);
+ fprintf(fp2, "%s:%s:%s\n", user, domain, ha1);
+ }
+ } else {
+ fprintf(fp2, "%s", line);
+ }
+ }
+
+ // If new user, just add it
+ if (!found && pass != NULL) {
+ mg_md5(ha1, user, ":", domain, ":", pass, NULL);
+ fprintf(fp2, "%s:%s:%s\n", user, domain, ha1);
+ }
+
+ // Close files
+ fclose(fp);
+ fclose(fp2);
+
+ // Put the temp file in place of real file
+ remove(fname);
+ rename(tmp, fname);
+
+ return 1;
}
static int conn2(const char *host, int port, int use_ssl,
- char *ebuf, size_t ebuf_len) {
- struct sockaddr_in sin;
- struct hostent *he;
- SOCKET sock = INVALID_SOCKET;
-
- if (host == NULL) {
- snprintf(ebuf, ebuf_len, "%s", "NULL host");
- } else if (use_ssl && SSLv23_client_method == NULL) {
- snprintf(ebuf, ebuf_len, "%s", "SSL is not initialized");
- // TODO(lsm): use something threadsafe instead of gethostbyname()
- } else if ((he = gethostbyname(host)) == NULL) {
- snprintf(ebuf, ebuf_len, "gethostbyname(%s): %s", host, strerror(ERRNO));
- } else if ((sock = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
- snprintf(ebuf, ebuf_len, "socket(): %s", strerror(ERRNO));
- } else {
- sin.sin_family = AF_INET;
- sin.sin_port = htons((uint16_t) port);
- sin.sin_addr = * (struct in_addr *) he->h_addr_list[0];
- if (connect(sock, (struct sockaddr *) &sin, sizeof(sin)) != 0) {
- snprintf(ebuf, ebuf_len, "connect(%s:%d): %s",
- host, port, strerror(ERRNO));
- closesocket(sock);
- sock = INVALID_SOCKET;
- }
- }
- return sock;
+ char *ebuf, size_t ebuf_len) {
+ struct sockaddr_in sin;
+ struct hostent *he;
+ SOCKET sock = INVALID_SOCKET;
+
+ if (host == NULL) {
+ snprintf(ebuf, ebuf_len, "%s", "NULL host");
+ } else if (use_ssl && SSLv23_client_method == NULL) {
+ snprintf(ebuf, ebuf_len, "%s", "SSL is not initialized");
+ // TODO(lsm): use something threadsafe instead of gethostbyname()
+ } else if ((he = gethostbyname(host)) == NULL) {
+ snprintf(ebuf, ebuf_len, "gethostbyname(%s): %s", host, strerror(ERRNO));
+ } else if ((sock = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
+ snprintf(ebuf, ebuf_len, "socket(): %s", strerror(ERRNO));
+ } else {
+ sin.sin_family = AF_INET;
+ sin.sin_port = htons((uint16_t) port);
+ sin.sin_addr = * (struct in_addr *) he->h_addr_list[0];
+ if (connect(sock, (struct sockaddr *) &sin, sizeof(sin)) != 0) {
+ snprintf(ebuf, ebuf_len, "connect(%s:%d): %s",
+ host, port, strerror(ERRNO));
+ closesocket(sock);
+ sock = INVALID_SOCKET;
+ }
+ }
+ return sock;
}
void mg_url_encode(const char *src, char *dst, size_t dst_len) {
- static const char *dont_escape = "._-$,;~()";
- static const char *hex = "0123456789abcdef";
- const char *end = dst + dst_len - 1;
+ static const char *dont_escape = "._-$,;~()";
+ static const char *hex = "0123456789abcdef";
+ const char *end = dst + dst_len - 1;
- for (; *src != '\0' && dst < end; src++, dst++) {
- if (isalnum(*(const unsigned char *) src) ||
- strchr(dont_escape, * (const unsigned char *) src) != NULL) {
- *dst = *src;
- } else if (dst + 2 < end) {
- dst[0] = '%';
- dst[1] = hex[(* (const unsigned char *) src) >> 4];
- dst[2] = hex[(* (const unsigned char *) src) & 0xf];
- dst += 2;
- }
- }
+ for (; *src != '\0' && dst < end; src++, dst++) {
+ if (isalnum(*(const unsigned char *) src) ||
+ strchr(dont_escape, * (const unsigned char *) src) != NULL) {
+ *dst = *src;
+ } else if (dst + 2 < end) {
+ dst[0] = '%';
+ dst[1] = hex[(* (const unsigned char *) src) >> 4];
+ dst[2] = hex[(* (const unsigned char *) src) & 0xf];
+ dst += 2;
+ }
+ }
- *dst = '\0';
+ *dst = '\0';
}
static void print_dir_entry(struct de *de) {
- char size[64], mod[64], href[PATH_MAX];
-
- if (de->file.is_directory) {
- mg_snprintf(de->conn, size, sizeof(size), "%s", "[DIRECTORY]");
- } else {
- // We use (signed) cast below because MSVC 6 compiler cannot
- // convert unsigned __int64 to double. Sigh.
- if (de->file.size < 1024) {
- mg_snprintf(de->conn, size, sizeof(size), "%d", (int) de->file.size);
- } else if (de->file.size < 0x100000) {
- mg_snprintf(de->conn, size, sizeof(size),
- "%.1fk", (double) de->file.size / 1024.0);
- } else if (de->file.size < 0x40000000) {
- mg_snprintf(de->conn, size, sizeof(size),
- "%.1fM", (double) de->file.size / 1048576);
- } else {
- mg_snprintf(de->conn, size, sizeof(size),
- "%.1fG", (double) de->file.size / 1073741824);
- }
- }
- strftime(mod, sizeof(mod), "%d-%b-%Y %H:%M",
- localtime(&de->file.modification_time));
- mg_url_encode(de->file_name, href, sizeof(href));
- de->conn->num_bytes_sent += mg_printf(de->conn,
- "<tr><td><a href=\"%s%s%s\">%s%s</a></td>"
- "<td>&nbsp;%s</td><td>&nbsp;&nbsp;%s</td></tr>\n",
- de->conn->request_info.uri, href, de->file.is_directory ? "/" : "",
- de->file_name, de->file.is_directory ? "/" : "", mod, size);
+ char size[64], mod[64], href[PATH_MAX];
+
+ if (de->file.is_directory) {
+ mg_snprintf(de->conn, size, sizeof(size), "%s", "[DIRECTORY]");
+ } else {
+ // We use (signed) cast below because MSVC 6 compiler cannot
+ // convert unsigned __int64 to double. Sigh.
+ if (de->file.size < 1024) {
+ mg_snprintf(de->conn, size, sizeof(size), "%d", (int) de->file.size);
+ } else if (de->file.size < 0x100000) {
+ mg_snprintf(de->conn, size, sizeof(size),
+ "%.1fk", (double) de->file.size / 1024.0);
+ } else if (de->file.size < 0x40000000) {
+ mg_snprintf(de->conn, size, sizeof(size),
+ "%.1fM", (double) de->file.size / 1048576);
+ } else {
+ mg_snprintf(de->conn, size, sizeof(size),
+ "%.1fG", (double) de->file.size / 1073741824);
+ }
+ }
+ strftime(mod, sizeof(mod), "%d-%b-%Y %H:%M",
+ localtime(&de->file.modification_time));
+ mg_url_encode(de->file_name, href, sizeof(href));
+ de->conn->num_bytes_sent += mg_printf(de->conn,
+ "<tr><td><a href=\"%s%s%s\">%s%s</a></td>"
+ "<td>&nbsp;%s</td><td>&nbsp;&nbsp;%s</td></tr>\n",
+ de->conn->request_info.uri, href, de->file.is_directory ? "/" : "",
+ de->file_name, de->file.is_directory ? "/" : "", mod, size);
}
// This function is called from send_directory() and used for
@@ -2651,409 +2649,409 @@ static void print_dir_entry(struct de *de) {
// On windows, __cdecl specification is needed in case if project is built
// with __stdcall convention. qsort always requires __cdels callback.
static int WINCDECL compare_dir_entries(const void *p1, const void *p2) {
- const struct de *a = (const struct de *) p1, *b = (const struct de *) p2;
- const char *query_string = a->conn->request_info.query_string;
- int cmp_result = 0;
-
- if (query_string == NULL) {
- query_string = "na";
- }
-
- if (a->file.is_directory && !b->file.is_directory) {
- return -1; // Always put directories on top
- } else if (!a->file.is_directory && b->file.is_directory) {
- return 1; // Always put directories on top
- } else if (*query_string == 'n') {
- cmp_result = strcmp(a->file_name, b->file_name);
- } else if (*query_string == 's') {
- cmp_result = a->file.size == b->file.size ? 0 :
- a->file.size > b->file.size ? 1 : -1;
- } else if (*query_string == 'd') {
- cmp_result = a->file.modification_time == b->file.modification_time ? 0 :
- a->file.modification_time > b->file.modification_time ? 1 : -1;
- }
-
- return query_string[1] == 'd' ? -cmp_result : cmp_result;
+ const struct de *a = (const struct de *) p1, *b = (const struct de *) p2;
+ const char *query_string = a->conn->request_info.query_string;
+ int cmp_result = 0;
+
+ if (query_string == NULL) {
+ query_string = "na";
+ }
+
+ if (a->file.is_directory && !b->file.is_directory) {
+ return -1; // Always put directories on top
+ } else if (!a->file.is_directory && b->file.is_directory) {
+ return 1; // Always put directories on top
+ } else if (*query_string == 'n') {
+ cmp_result = strcmp(a->file_name, b->file_name);
+ } else if (*query_string == 's') {
+ cmp_result = a->file.size == b->file.size ? 0 :
+ a->file.size > b->file.size ? 1 : -1;
+ } else if (*query_string == 'd') {
+ cmp_result = a->file.modification_time == b->file.modification_time ? 0 :
+ a->file.modification_time > b->file.modification_time ? 1 : -1;
+ }
+
+ return query_string[1] == 'd' ? -cmp_result : cmp_result;
}
static int must_hide_file(struct mg_connection *conn, const char *path) {
- const char *pw_pattern = "**" PASSWORDS_FILE_NAME "$";
- const char *pattern = conn->ctx->config[HIDE_FILES];
- return match_prefix(pw_pattern, strlen(pw_pattern), path) > 0 ||
- (pattern != NULL && match_prefix(pattern, strlen(pattern), path) > 0);
+ const char *pw_pattern = "**" PASSWORDS_FILE_NAME "$";
+ const char *pattern = conn->ctx->config[HIDE_FILES];
+ return match_prefix(pw_pattern, strlen(pw_pattern), path) > 0 ||
+ (pattern != NULL && match_prefix(pattern, strlen(pattern), path) > 0);
}
static int scan_directory(struct mg_connection *conn, const char *dir,
- void *data, void (*cb)(struct de *, void *)) {
- char path[PATH_MAX];
- struct dirent *dp;
- DIR *dirp;
- struct de de;
-
- if ((dirp = opendir(dir)) == NULL) {
- return 0;
- } else {
- de.conn = conn;
-
- while ((dp = readdir(dirp)) != NULL) {
- // Do not show current dir and hidden files
- if (!strcmp(dp->d_name, ".") ||
- !strcmp(dp->d_name, "..") ||
- must_hide_file(conn, dp->d_name)) {
- continue;
- }
-
- mg_snprintf(conn, path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
-
- // If we don't memset stat structure to zero, mtime will have
- // garbage and strftime() will segfault later on in
- // print_dir_entry(). memset is required only if mg_stat()
- // fails. For more details, see
- // http://code.google.com/p/mongoose/issues/detail?id=79
- memset(&de.file, 0, sizeof(de.file));
- mg_stat(conn, path, &de.file);
-
- de.file_name = dp->d_name;
- cb(&de, data);
- }
- (void) closedir(dirp);
- }
- return 1;
+ void *data, void (*cb)(struct de *, void *)) {
+ char path[PATH_MAX];
+ struct dirent *dp;
+ DIR *dirp;
+ struct de de;
+
+ if ((dirp = opendir(dir)) == NULL) {
+ return 0;
+ } else {
+ de.conn = conn;
+
+ while ((dp = readdir(dirp)) != NULL) {
+ // Do not show current dir and hidden files
+ if (!strcmp(dp->d_name, ".") ||
+ !strcmp(dp->d_name, "..") ||
+ must_hide_file(conn, dp->d_name)) {
+ continue;
+ }
+
+ mg_snprintf(conn, path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
+
+ // If we don't memset stat structure to zero, mtime will have
+ // garbage and strftime() will segfault later on in
+ // print_dir_entry(). memset is required only if mg_stat()
+ // fails. For more details, see
+ // http://code.google.com/p/mongoose/issues/detail?id=79
+ memset(&de.file, 0, sizeof(de.file));
+ mg_stat(conn, path, &de.file);
+
+ de.file_name = dp->d_name;
+ cb(&de, data);
+ }
+ (void) closedir(dirp);
+ }
+ return 1;
}
static int remove_directory(struct mg_connection *conn, const char *dir) {
- char path[PATH_MAX];
- struct dirent *dp;
- DIR *dirp;
- struct de de;
-
- if ((dirp = opendir(dir)) == NULL) {
- return 0;
- } else {
- de.conn = conn;
-
- while ((dp = readdir(dirp)) != NULL) {
- // Do not show current dir (but show hidden files as they will also be removed)
- if (!strcmp(dp->d_name, ".") ||
- !strcmp(dp->d_name, "..")) {
- continue;
- }
-
- mg_snprintf(conn, path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
-
- // If we don't memset stat structure to zero, mtime will have
- // garbage and strftime() will segfault later on in
- // print_dir_entry(). memset is required only if mg_stat()
- // fails. For more details, see
- // http://code.google.com/p/mongoose/issues/detail?id=79
- memset(&de.file, 0, sizeof(de.file));
- mg_stat(conn, path, &de.file);
- if(de.file.modification_time) {
- if(de.file.is_directory) {
- remove_directory(conn, path);
- } else {
- mg_remove(path);
- }
- }
-
- }
- (void) closedir(dirp);
-
- rmdir(dir);
- }
-
- return 1;
+ char path[PATH_MAX];
+ struct dirent *dp;
+ DIR *dirp;
+ struct de de;
+
+ if ((dirp = opendir(dir)) == NULL) {
+ return 0;
+ } else {
+ de.conn = conn;
+
+ while ((dp = readdir(dirp)) != NULL) {
+ // Do not show current dir (but show hidden files as they will also be removed)
+ if (!strcmp(dp->d_name, ".") ||
+ !strcmp(dp->d_name, "..")) {
+ continue;
+ }
+
+ mg_snprintf(conn, path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
+
+ // If we don't memset stat structure to zero, mtime will have
+ // garbage and strftime() will segfault later on in
+ // print_dir_entry(). memset is required only if mg_stat()
+ // fails. For more details, see
+ // http://code.google.com/p/mongoose/issues/detail?id=79
+ memset(&de.file, 0, sizeof(de.file));
+ mg_stat(conn, path, &de.file);
+ if(de.file.modification_time) {
+ if(de.file.is_directory) {
+ remove_directory(conn, path);
+ } else {
+ mg_remove(path);
+ }
+ }
+
+ }
+ (void) closedir(dirp);
+
+ rmdir(dir);
+ }
+
+ return 1;
}
struct dir_scan_data {
- struct de *entries;
- int num_entries;
- int arr_size;
+ struct de *entries;
+ int num_entries;
+ int arr_size;
};
// Behaves like realloc(), but frees original pointer on failure
static void *realloc2(void *ptr, size_t size) {
- void *new_ptr = realloc(ptr, size);
- if (new_ptr == NULL) {
- free(ptr);
- }
- return new_ptr;
+ void *new_ptr = realloc(ptr, size);
+ if (new_ptr == NULL) {
+ free(ptr);
+ }
+ return new_ptr;
}
static void dir_scan_callback(struct de *de, void *data) {
- struct dir_scan_data *dsd = (struct dir_scan_data *) data;
-
- if (dsd->entries == NULL || dsd->num_entries >= dsd->arr_size) {
- dsd->arr_size *= 2;
- dsd->entries = (struct de *) realloc2(dsd->entries, dsd->arr_size *
- sizeof(dsd->entries[0]));
- }
- if (dsd->entries == NULL) {
- // TODO(lsm): propagate an error to the caller
- dsd->num_entries = 0;
- } else {
- dsd->entries[dsd->num_entries].file_name = mg_strdup(de->file_name);
- dsd->entries[dsd->num_entries].file = de->file;
- dsd->entries[dsd->num_entries].conn = de->conn;
- dsd->num_entries++;
- }
+ struct dir_scan_data *dsd = (struct dir_scan_data *) data;
+
+ if (dsd->entries == NULL || dsd->num_entries >= dsd->arr_size) {
+ dsd->arr_size *= 2;
+ dsd->entries = (struct de *) realloc2(dsd->entries, dsd->arr_size *
+ sizeof(dsd->entries[0]));
+ }
+ if (dsd->entries == NULL) {
+ // TODO(lsm): propagate an error to the caller
+ dsd->num_entries = 0;
+ } else {
+ dsd->entries[dsd->num_entries].file_name = mg_strdup(de->file_name);
+ dsd->entries[dsd->num_entries].file = de->file;
+ dsd->entries[dsd->num_entries].conn = de->conn;
+ dsd->num_entries++;
+ }
}
static void handle_directory_request(struct mg_connection *conn,
- const char *dir) {
- int i, sort_direction;
- struct dir_scan_data data = { NULL, 0, 128 };
-
- if (!scan_directory(conn, dir, &data, dir_scan_callback)) {
- send_http_error(conn, 500, "Cannot open directory",
- "Error: opendir(%s): %s", dir, strerror(ERRNO));
- return;
- }
-
- sort_direction = conn->request_info.query_string != NULL &&
- conn->request_info.query_string[1] == 'd' ? 'a' : 'd';
-
- conn->must_close = 1;
- mg_printf(conn, "%s",
- "HTTP/1.1 200 OK\r\n"
- "Connection: close\r\n"
- "Content-Type: text/html; charset=utf-8\r\n\r\n");
-
- conn->num_bytes_sent += mg_printf(conn,
- "<html><head><title>Index of %s</title>"
- "<style>th {text-align: left;}</style></head>"
- "<body><h1>Index of %s</h1><pre><table cellpadding=\"0\">"
- "<tr><th><a href=\"?n%c\">Name</a></th>"
- "<th><a href=\"?d%c\">Modified</a></th>"
- "<th><a href=\"?s%c\">Size</a></th></tr>"
- "<tr><td colspan=\"3\"><hr></td></tr>",
- conn->request_info.uri, conn->request_info.uri,
- sort_direction, sort_direction, sort_direction);
-
- // Print first entry - link to a parent directory
- conn->num_bytes_sent += mg_printf(conn,
- "<tr><td><a href=\"%s%s\">%s</a></td>"
- "<td>&nbsp;%s</td><td>&nbsp;&nbsp;%s</td></tr>\n",
- conn->request_info.uri, "..", "Parent directory", "-", "-");
-
- // Sort and print directory entries
- qsort(data.entries, (size_t) data.num_entries, sizeof(data.entries[0]),
- compare_dir_entries);
- for (i = 0; i < data.num_entries; i++) {
- print_dir_entry(&data.entries[i]);
- free(data.entries[i].file_name);
- }
- free(data.entries);
-
- conn->num_bytes_sent += mg_printf(conn, "%s", "</table></body></html>");
- conn->status_code = 200;
+ const char *dir) {
+ int i, sort_direction;
+ struct dir_scan_data data = { NULL, 0, 128 };
+
+ if (!scan_directory(conn, dir, &data, dir_scan_callback)) {
+ send_http_error(conn, 500, "Cannot open directory",
+ "Error: opendir(%s): %s", dir, strerror(ERRNO));
+ return;
+ }
+
+ sort_direction = conn->request_info.query_string != NULL &&
+ conn->request_info.query_string[1] == 'd' ? 'a' : 'd';
+
+ conn->must_close = 1;
+ mg_printf(conn, "%s",
+ "HTTP/1.1 200 OK\r\n"
+ "Connection: close\r\n"
+ "Content-Type: text/html; charset=utf-8\r\n\r\n");
+
+ conn->num_bytes_sent += mg_printf(conn,
+ "<html><head><title>Index of %s</title>"
+ "<style>th {text-align: left;}</style></head>"
+ "<body><h1>Index of %s</h1><pre><table cellpadding=\"0\">"
+ "<tr><th><a href=\"?n%c\">Name</a></th>"
+ "<th><a href=\"?d%c\">Modified</a></th>"
+ "<th><a href=\"?s%c\">Size</a></th></tr>"
+ "<tr><td colspan=\"3\"><hr></td></tr>",
+ conn->request_info.uri, conn->request_info.uri,
+ sort_direction, sort_direction, sort_direction);
+
+ // Print first entry - link to a parent directory
+ conn->num_bytes_sent += mg_printf(conn,
+ "<tr><td><a href=\"%s%s\">%s</a></td>"
+ "<td>&nbsp;%s</td><td>&nbsp;&nbsp;%s</td></tr>\n",
+ conn->request_info.uri, "..", "Parent directory", "-", "-");
+
+ // Sort and print directory entries
+ qsort(data.entries, (size_t) data.num_entries, sizeof(data.entries[0]),
+ compare_dir_entries);
+ for (i = 0; i < data.num_entries; i++) {
+ print_dir_entry(&data.entries[i]);
+ free(data.entries[i].file_name);
+ }
+ free(data.entries);
+
+ conn->num_bytes_sent += mg_printf(conn, "%s", "</table></body></html>");
+ conn->status_code = 200;
}
// Send len bytes from the opened file to the client.
static void send_file_data(struct mg_connection *conn, struct file *filep,
- int64_t offset, int64_t len) {
- char buf[MG_BUF_LEN];
- int to_read, num_read, num_written;
-
- // Sanity check the offset
- offset = offset < 0 ? 0 : offset > filep->size ? filep->size : offset;
-
- if (len > 0 && filep->membuf != NULL && filep->size > 0) {
- if (len > filep->size - offset) {
- len = filep->size - offset;
- }
- mg_write(conn, filep->membuf + offset, (size_t) len);
- } else if (len > 0 && filep->fp != NULL) {
- fseeko(filep->fp, offset, SEEK_SET);
- while (len > 0) {
- // Calculate how much to read from the file in the buffer
- to_read = sizeof(buf);
- if ((int64_t) to_read > len) {
- to_read = (int) len;
- }
-
- // Read from file, exit the loop on error
- if ((num_read = fread(buf, 1, (size_t) to_read, filep->fp)) <= 0) {
- break;
- }
-
- // Send read bytes to the client, exit the loop on error
- if ((num_written = mg_write(conn, buf, (size_t) num_read)) != num_read) {
- break;
- }
-
- // Both read and were successful, adjust counters
- conn->num_bytes_sent += num_written;
- len -= num_written;
- }
- }
+ int64_t offset, int64_t len) {
+ char buf[MG_BUF_LEN];
+ int to_read, num_read, num_written;
+
+ // Sanity check the offset
+ offset = offset < 0 ? 0 : offset > filep->size ? filep->size : offset;
+
+ if (len > 0 && filep->membuf != NULL && filep->size > 0) {
+ if (len > filep->size - offset) {
+ len = filep->size - offset;
+ }
+ mg_write(conn, filep->membuf + offset, (size_t) len);
+ } else if (len > 0 && filep->fp != NULL) {
+ fseeko(filep->fp, offset, SEEK_SET);
+ while (len > 0) {
+ // Calculate how much to read from the file in the buffer
+ to_read = sizeof(buf);
+ if ((int64_t) to_read > len) {
+ to_read = (int) len;
+ }
+
+ // Read from file, exit the loop on error
+ if ((num_read = fread(buf, 1, (size_t) to_read, filep->fp)) <= 0) {
+ break;
+ }
+
+ // Send read bytes to the client, exit the loop on error
+ if ((num_written = mg_write(conn, buf, (size_t) num_read)) != num_read) {
+ break;
+ }
+
+ // Both read and were successful, adjust counters
+ conn->num_bytes_sent += num_written;
+ len -= num_written;
+ }
+ }
}
static int parse_range_header(const char *header, int64_t *a, int64_t *b) {
- return sscanf(header, "bytes=%" INT64_FMT "-%" INT64_FMT, a, b);
+ return sscanf(header, "bytes=%" INT64_FMT "-%" INT64_FMT, a, b);
}
static void gmt_time_string(char *buf, size_t buf_len, time_t *t) {
- strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S GMT", gmtime(t));
+ strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S GMT", gmtime(t));
}
static void construct_etag(char *buf, size_t buf_len,
- const struct file *filep) {
- snprintf(buf, buf_len, "\"%lx.%" INT64_FMT "\"",
- (unsigned long) filep->modification_time, filep->size);
+ const struct file *filep) {
+ snprintf(buf, buf_len, "\"%lx.%" INT64_FMT "\"",
+ (unsigned long) filep->modification_time, filep->size);
}
static void fclose_on_exec(struct file *filep) {
- if (filep != NULL && filep->fp != NULL) {
+ if (filep != NULL && filep->fp != NULL) {
#ifndef _WIN32
- fcntl(fileno(filep->fp), F_SETFD, FD_CLOEXEC);
+ fcntl(fileno(filep->fp), F_SETFD, FD_CLOEXEC);
#endif
- }
+ }
}
static void handle_file_request(struct mg_connection *conn, const char *path,
- struct file *filep) {
- char date[64], lm[64], etag[64], range[64];
- const char *msg = "OK", *hdr;
- time_t curtime = time(NULL);
- int64_t cl, r1, r2;
- struct vec mime_vec;
- int n;
- char gz_path[PATH_MAX];
- char const* encoding = "";
-
- get_mime_type(conn->ctx, path, &mime_vec);
- cl = filep->size;
- conn->status_code = 200;
- range[0] = '\0';
-
- // if this file is in fact a pre-gzipped file, rewrite its filename
- // it's important to rewrite the filename after resolving
- // the mime type from it, to preserve the actual file's type
- if (filep->gzipped) {
- snprintf(gz_path, sizeof(gz_path), "%s.gz", path);
- path = gz_path;
- encoding = "Content-Encoding: gzip\r\n";
- }
-
- if (!mg_fopen(conn, path, "rb", filep)) {
- send_http_error(conn, 500, http_500_error,
- "fopen(%s): %s", path, strerror(ERRNO));
- return;
- }
-
- fclose_on_exec(filep);
-
- // If Range: header specified, act accordingly
- r1 = r2 = 0;
- hdr = mg_get_header(conn, "Range");
- if (hdr != NULL && (n = parse_range_header(hdr, &r1, &r2)) > 0 &&
- r1 >= 0 && r2 >= 0) {
- // actually, range requests don't play well with a pre-gzipped
- // file (since the range is specified in the uncmpressed space)
- if (filep->gzipped) {
- send_http_error(conn, 501, "Not Implemented", "range requests in gzipped files are not supported");
- return;
- }
- conn->status_code = 206;
- cl = n == 2 ? (r2 > cl ? cl : r2) - r1 + 1: cl - r1;
- mg_snprintf(conn, range, sizeof(range),
- "Content-Range: bytes "
- "%" INT64_FMT "-%"
- INT64_FMT "/%" INT64_FMT "\r\n",
- r1, r1 + cl - 1, filep->size);
- msg = "Partial Content";
- }
-
- // Prepare Etag, Date, Last-Modified headers. Must be in UTC, according to
- // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
- gmt_time_string(date, sizeof(date), &curtime);
- gmt_time_string(lm, sizeof(lm), &filep->modification_time);
- construct_etag(etag, sizeof(etag), filep);
-
- (void) mg_printf(conn,
- "HTTP/1.1 %d %s\r\n"
- "Date: %s\r\n"
- "Last-Modified: %s\r\n"
- "Etag: %s\r\n"
- "Content-Type: %.*s\r\n"
- "Content-Length: %" INT64_FMT "\r\n"
- "Connection: %s\r\n"
- "Accept-Ranges: bytes\r\n"
- "%s%s\r\n",
- conn->status_code, msg, date, lm, etag, (int) mime_vec.len,
- mime_vec.ptr, cl, suggest_connection_header(conn), range, encoding);
-
- if (strcmp(conn->request_info.request_method, "HEAD") != 0) {
- send_file_data(conn, filep, r1, cl);
- }
- mg_fclose(filep);
+ struct file *filep) {
+ char date[64], lm[64], etag[64], range[64];
+ const char *msg = "OK", *hdr;
+ time_t curtime = time(NULL);
+ int64_t cl, r1, r2;
+ struct vec mime_vec;
+ int n;
+ char gz_path[PATH_MAX];
+ char const* encoding = "";
+
+ get_mime_type(conn->ctx, path, &mime_vec);
+ cl = filep->size;
+ conn->status_code = 200;
+ range[0] = '\0';
+
+ // if this file is in fact a pre-gzipped file, rewrite its filename
+ // it's important to rewrite the filename after resolving
+ // the mime type from it, to preserve the actual file's type
+ if (filep->gzipped) {
+ snprintf(gz_path, sizeof(gz_path), "%s.gz", path);
+ path = gz_path;
+ encoding = "Content-Encoding: gzip\r\n";
+ }
+
+ if (!mg_fopen(conn, path, "rb", filep)) {
+ send_http_error(conn, 500, http_500_error,
+ "fopen(%s): %s", path, strerror(ERRNO));
+ return;
+ }
+
+ fclose_on_exec(filep);
+
+ // If Range: header specified, act accordingly
+ r1 = r2 = 0;
+ hdr = mg_get_header(conn, "Range");
+ if (hdr != NULL && (n = parse_range_header(hdr, &r1, &r2)) > 0 &&
+ r1 >= 0 && r2 >= 0) {
+ // actually, range requests don't play well with a pre-gzipped
+ // file (since the range is specified in the uncmpressed space)
+ if (filep->gzipped) {
+ send_http_error(conn, 501, "Not Implemented", "range requests in gzipped files are not supported");
+ return;
+ }
+ conn->status_code = 206;
+ cl = n == 2 ? (r2 > cl ? cl : r2) - r1 + 1: cl - r1;
+ mg_snprintf(conn, range, sizeof(range),
+ "Content-Range: bytes "
+ "%" INT64_FMT "-%"
+ INT64_FMT "/%" INT64_FMT "\r\n",
+ r1, r1 + cl - 1, filep->size);
+ msg = "Partial Content";
+ }
+
+ // Prepare Etag, Date, Last-Modified headers. Must be in UTC, according to
+ // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
+ gmt_time_string(date, sizeof(date), &curtime);
+ gmt_time_string(lm, sizeof(lm), &filep->modification_time);
+ construct_etag(etag, sizeof(etag), filep);
+
+ (void) mg_printf(conn,
+ "HTTP/1.1 %d %s\r\n"
+ "Date: %s\r\n"
+ "Last-Modified: %s\r\n"
+ "Etag: %s\r\n"
+ "Content-Type: %.*s\r\n"
+ "Content-Length: %" INT64_FMT "\r\n"
+ "Connection: %s\r\n"
+ "Accept-Ranges: bytes\r\n"
+ "%s%s\r\n",
+ conn->status_code, msg, date, lm, etag, (int) mime_vec.len,
+ mime_vec.ptr, cl, suggest_connection_header(conn), range, encoding);
+
+ if (strcmp(conn->request_info.request_method, "HEAD") != 0) {
+ send_file_data(conn, filep, r1, cl);
+ }
+ mg_fclose(filep);
}
void mg_send_file(struct mg_connection *conn, const char *path) {
- struct file file = STRUCT_FILE_INITIALIZER;
- if (mg_stat(conn, path, &file)) {
- handle_file_request(conn, path, &file);
- } else {
- send_http_error(conn, 404, "Not Found", "%s", "File not found");
- }
+ struct file file = STRUCT_FILE_INITIALIZER;
+ if (mg_stat(conn, path, &file)) {
+ handle_file_request(conn, path, &file);
+ } else {
+ send_http_error(conn, 404, "Not Found", "%s", "File not found");
+ }
}
// Parse HTTP headers from the given buffer, advance buffer to the point
// where parsing stopped.
static void parse_http_headers(char **buf, struct mg_request_info *ri) {
- int i;
+ int i;
- for (i = 0; i < (int) ARRAY_SIZE(ri->http_headers); i++) {
- ri->http_headers[i].name = skip_quoted(buf, ":", " ", 0);
- ri->http_headers[i].value = skip(buf, "\r\n");
- if (ri->http_headers[i].name[0] == '\0')
- break;
- ri->num_headers = i + 1;
- }
+ for (i = 0; i < (int) ARRAY_SIZE(ri->http_headers); i++) {
+ ri->http_headers[i].name = skip_quoted(buf, ":", " ", 0);
+ ri->http_headers[i].value = skip(buf, "\r\n");
+ if (ri->http_headers[i].name[0] == '\0')
+ break;
+ ri->num_headers = i + 1;
+ }
}
static int is_valid_http_method(const char *method) {
- return !strcmp(method, "GET") || !strcmp(method, "POST") ||
- !strcmp(method, "HEAD") || !strcmp(method, "CONNECT") ||
- !strcmp(method, "PUT") || !strcmp(method, "DELETE") ||
- !strcmp(method, "OPTIONS") || !strcmp(method, "PROPFIND")
- || !strcmp(method, "MKCOL")
- ;
+ return !strcmp(method, "GET") || !strcmp(method, "POST") ||
+ !strcmp(method, "HEAD") || !strcmp(method, "CONNECT") ||
+ !strcmp(method, "PUT") || !strcmp(method, "DELETE") ||
+ !strcmp(method, "OPTIONS") || !strcmp(method, "PROPFIND")
+ || !strcmp(method, "MKCOL")
+ ;
}
// Parse HTTP request, fill in mg_request_info structure.
// This function modifies the buffer by NUL-terminating
// HTTP request components, header names and header values.
static int parse_http_message(char *buf, int len, struct mg_request_info *ri) {
- int is_request, request_length = get_request_len(buf, len);
- if (request_length > 0) {
- // Reset attributes. DO NOT TOUCH is_ssl, remote_ip, remote_port
- ri->remote_user = ri->request_method = ri->uri = ri->http_version = NULL;
- ri->num_headers = 0;
-
- buf[request_length - 1] = '\0';
-
- // RFC says that all initial whitespaces should be ingored
- while (*buf != '\0' && isspace(* (unsigned char *) buf)) {
- buf++;
- }
- ri->request_method = skip(&buf, " ");
- ri->uri = skip(&buf, " ");
- ri->http_version = skip(&buf, "\r\n");
- if (((is_request = is_valid_http_method(ri->request_method)) &&
- memcmp(ri->http_version, "HTTP/", 5) != 0) ||
- (!is_request && memcmp(ri->request_method, "HTTP/", 5)) != 0) {
- request_length = -1;
- } else {
- if (is_request) {
- ri->http_version += 5;
- }
- parse_http_headers(&buf, ri);
- }
- }
- return request_length;
+ int is_request, request_length = get_request_len(buf, len);
+ if (request_length > 0) {
+ // Reset attributes. DO NOT TOUCH is_ssl, remote_ip, remote_port
+ ri->remote_user = ri->request_method = ri->uri = ri->http_version = NULL;
+ ri->num_headers = 0;
+
+ buf[request_length - 1] = '\0';
+
+ // RFC says that all initial whitespaces should be ingored
+ while (*buf != '\0' && isspace(* (unsigned char *) buf)) {
+ buf++;
+ }
+ ri->request_method = skip(&buf, " ");
+ ri->uri = skip(&buf, " ");
+ ri->http_version = skip(&buf, "\r\n");
+ if (((is_request = is_valid_http_method(ri->request_method)) &&
+ memcmp(ri->http_version, "HTTP/", 5) != 0) ||
+ (!is_request && memcmp(ri->request_method, "HTTP/", 5)) != 0) {
+ request_length = -1;
+ } else {
+ if (is_request) {
+ ri->http_version += 5;
+ }
+ parse_http_headers(&buf, ri);
+ }
+ }
+ return request_length;
}
// Keep reading the input (either opened file descriptor fd, or socket sock,
@@ -3062,133 +3060,132 @@ static int parse_http_message(char *buf, int len, struct mg_request_info *ri) {
// have some data. The length of the data is stored in nread.
// Upon every read operation, increase nread by the number of bytes read.
static int read_request(FILE *fp, struct mg_connection *conn,
- char *buf, int bufsiz, int *nread) {
- int request_len, n = 0;
+ char *buf, int bufsiz, int *nread) {
+ int request_len, n = 0;
- request_len = get_request_len(buf, *nread);
- while (*nread < bufsiz && request_len == 0 &&
- (n = pull(fp, conn, buf + *nread, bufsiz - *nread)) > 0) {
- *nread += n;
- assert(*nread <= bufsiz);
- request_len = get_request_len(buf, *nread);
- }
+ request_len = get_request_len(buf, *nread);
+ while (*nread < bufsiz && request_len == 0 &&
+ (n = pull(fp, conn, buf + *nread, bufsiz - *nread)) > 0) {
+ *nread += n;
+ assert(*nread <= bufsiz);
+ request_len = get_request_len(buf, *nread);
+ }
- return request_len <= 0 && n <= 0 ? -1 : request_len;
+ return request_len <= 0 && n <= 0 ? -1 : request_len;
}
// For given directory path, substitute it to valid index file.
// Return 0 if index file has been found, -1 if not found.
// If the file is found, it's stats is returned in stp.
static int substitute_index_file(struct mg_connection *conn, char *path,
- size_t path_len, struct file *filep) {
- const char *list = conn->ctx->config[INDEX_FILES];
- struct file file = STRUCT_FILE_INITIALIZER;
- struct vec filename_vec;
- size_t n = strlen(path);
- int found = 0;
-
- // The 'path' given to us points to the directory. Remove all trailing
- // directory separator characters from the end of the path, and
- // then append single directory separator character.
- while (n > 0 && path[n - 1] == '/') {
- n--;
- }
- path[n] = '/';
-
- // Traverse index files list. For each entry, append it to the given
- // path and see if the file exists. If it exists, break the loop
- while ((list = next_option(list, &filename_vec, NULL)) != NULL) {
-
- // Ignore too long entries that may overflow path buffer
- if (filename_vec.len > path_len - (n + 2))
- continue;
-
- // Prepare full path to the index file
- mg_strlcpy(path + n + 1, filename_vec.ptr, filename_vec.len + 1);
-
- // Does it exist?
- if (mg_stat(conn, path, &file)) {
- // Yes it does, break the loop
- *filep = file;
- found = 1;
- break;
- }
- }
-
- // If no index file exists, restore directory path
- if (!found) {
- path[n] = '\0';
- }
-
- return found;
+ size_t path_len, struct file *filep) {
+ const char *list = conn->ctx->config[INDEX_FILES];
+ struct file file = STRUCT_FILE_INITIALIZER;
+ struct vec filename_vec;
+ size_t n = strlen(path);
+ int found = 0;
+
+ // The 'path' given to us points to the directory. Remove all trailing
+ // directory separator characters from the end of the path, and
+ // then append single directory separator character.
+ while (n > 0 && path[n - 1] == '/') {
+ n--;
+ }
+ path[n] = '/';
+
+ // Traverse index files list. For each entry, append it to the given
+ // path and see if the file exists. If it exists, break the loop
+ while ((list = next_option(list, &filename_vec, NULL)) != NULL) {
+ // Ignore too long entries that may overflow path buffer
+ if (filename_vec.len > path_len - (n + 2))
+ continue;
+
+ // Prepare full path to the index file
+ mg_strlcpy(path + n + 1, filename_vec.ptr, filename_vec.len + 1);
+
+ // Does it exist?
+ if (mg_stat(conn, path, &file)) {
+ // Yes it does, break the loop
+ *filep = file;
+ found = 1;
+ break;
+ }
+ }
+
+ // If no index file exists, restore directory path
+ if (!found) {
+ path[n] = '\0';
+ }
+
+ return found;
}
// Return True if we should reply 304 Not Modified.
static int is_not_modified(const struct mg_connection *conn,
- const struct file *filep) {
- char etag[64];
- const char *ims = mg_get_header(conn, "If-Modified-Since");
- const char *inm = mg_get_header(conn, "If-None-Match");
- construct_etag(etag, sizeof(etag), filep);
- return (inm != NULL && !mg_strcasecmp(etag, inm)) ||
- (ims != NULL && filep->modification_time <= parse_date_string(ims));
+ const struct file *filep) {
+ char etag[64];
+ const char *ims = mg_get_header(conn, "If-Modified-Since");
+ const char *inm = mg_get_header(conn, "If-None-Match");
+ construct_etag(etag, sizeof(etag), filep);
+ return (inm != NULL && !mg_strcasecmp(etag, inm)) ||
+ (ims != NULL && filep->modification_time <= parse_date_string(ims));
}
static int forward_body_data(struct mg_connection *conn, FILE *fp,
- SOCKET sock, SSL *ssl) {
- const char *expect, *body;
- char buf[MG_BUF_LEN];
- int to_read, nread, buffered_len, success = 0;
-
- expect = mg_get_header(conn, "Expect");
- assert(fp != NULL);
-
- if (conn->content_len == -1) {
- send_http_error(conn, 411, "Length Required", "%s", "");
- } else if (expect != NULL && mg_strcasecmp(expect, "100-continue")) {
- send_http_error(conn, 417, "Expectation Failed", "%s", "");
- } else {
- if (expect != NULL) {
- (void) mg_printf(conn, "%s", "HTTP/1.1 100 Continue\r\n\r\n");
- }
-
- body = conn->buf + conn->request_len + conn->consumed_content;
- buffered_len = &conn->buf[conn->data_len] - body;
- assert(buffered_len >= 0);
- assert(conn->consumed_content == 0);
-
- if (buffered_len > 0) {
- if ((int64_t) buffered_len > conn->content_len) {
- buffered_len = (int) conn->content_len;
- }
- push(fp, sock, ssl, body, (int64_t) buffered_len);
- conn->consumed_content += buffered_len;
- }
-
- nread = 0;
- while (conn->consumed_content < conn->content_len) {
- to_read = sizeof(buf);
- if ((int64_t) to_read > conn->content_len - conn->consumed_content) {
- to_read = (int) (conn->content_len - conn->consumed_content);
- }
- nread = pull(NULL, conn, buf, to_read);
- if (nread <= 0 || push(fp, sock, ssl, buf, nread) != nread) {
- break;
- }
- conn->consumed_content += nread;
- }
-
- if (conn->consumed_content == conn->content_len) {
- success = nread >= 0;
- }
-
- // Each error code path in this function must send an error
- if (!success) {
- send_http_error(conn, 577, http_500_error, "%s", "");
- }
- }
-
- return success;
+ SOCKET sock, SSL *ssl) {
+ const char *expect, *body;
+ char buf[MG_BUF_LEN];
+ int to_read, nread, buffered_len, success = 0;
+
+ expect = mg_get_header(conn, "Expect");
+ assert(fp != NULL);
+
+ if (conn->content_len == -1) {
+ send_http_error(conn, 411, "Length Required", "%s", "");
+ } else if (expect != NULL && mg_strcasecmp(expect, "100-continue")) {
+ send_http_error(conn, 417, "Expectation Failed", "%s", "");
+ } else {
+ if (expect != NULL) {
+ (void) mg_printf(conn, "%s", "HTTP/1.1 100 Continue\r\n\r\n");
+ }
+
+ body = conn->buf + conn->request_len + conn->consumed_content;
+ buffered_len = &conn->buf[conn->data_len] - body;
+ assert(buffered_len >= 0);
+ assert(conn->consumed_content == 0);
+
+ if (buffered_len > 0) {
+ if ((int64_t) buffered_len > conn->content_len) {
+ buffered_len = (int) conn->content_len;
+ }
+ push(fp, sock, ssl, body, (int64_t) buffered_len);
+ conn->consumed_content += buffered_len;
+ }
+
+ nread = 0;
+ while (conn->consumed_content < conn->content_len) {
+ to_read = sizeof(buf);
+ if ((int64_t) to_read > conn->content_len - conn->consumed_content) {
+ to_read = (int) (conn->content_len - conn->consumed_content);
+ }
+ nread = pull(NULL, conn, buf, to_read);
+ if (nread <= 0 || push(fp, sock, ssl, buf, nread) != nread) {
+ break;
+ }
+ conn->consumed_content += nread;
+ }
+
+ if (conn->consumed_content == conn->content_len) {
+ success = nread >= 0;
+ }
+
+ // Each error code path in this function must send an error
+ if (!success) {
+ send_http_error(conn, 577, http_500_error, "%s", "");
+ }
+ }
+
+ return success;
}
#if !defined(NO_CGI)
@@ -3201,307 +3198,307 @@ static int forward_body_data(struct mg_connection *conn, FILE *fp,
// We satisfy both worlds: we create an envp array (which is vars), all
// entries are actually pointers inside buf.
struct cgi_env_block {
- struct mg_connection *conn;
- char buf[CGI_ENVIRONMENT_SIZE]; // Environment buffer
- int len; // Space taken
- char *vars[MAX_CGI_ENVIR_VARS]; // char **envp
- int nvars; // Number of variables
+ struct mg_connection *conn;
+ char buf[CGI_ENVIRONMENT_SIZE]; // Environment buffer
+ int len; // Space taken
+ char *vars[MAX_CGI_ENVIR_VARS]; // char **envp
+ int nvars; // Number of variables
};
static char *addenv(struct cgi_env_block *block,
- PRINTF_FORMAT_STRING(const char *fmt), ...)
- PRINTF_ARGS(2, 3);
+ PRINTF_FORMAT_STRING(const char *fmt), ...)
+ PRINTF_ARGS(2, 3);
// Append VARIABLE=VALUE\0 string to the buffer, and add a respective
// pointer into the vars array.
static char *addenv(struct cgi_env_block *block, const char *fmt, ...) {
- int n, space;
- char *added;
- va_list ap;
+ int n, space;
+ char *added;
+ va_list ap;
- // Calculate how much space is left in the buffer
- space = sizeof(block->buf) - block->len - 2;
- assert(space >= 0);
+ // Calculate how much space is left in the buffer
+ space = sizeof(block->buf) - block->len - 2;
+ assert(space >= 0);
- // Make a pointer to the free space int the buffer
- added = block->buf + block->len;
+ // Make a pointer to the free space int the buffer
+ added = block->buf + block->len;
- // Copy VARIABLE=VALUE\0 string into the free space
- va_start(ap, fmt);
- n = mg_vsnprintf(block->conn, added, (size_t) space, fmt, ap);
- va_end(ap);
+ // Copy VARIABLE=VALUE\0 string into the free space
+ va_start(ap, fmt);
+ n = mg_vsnprintf(block->conn, added, (size_t) space, fmt, ap);
+ va_end(ap);
- // Make sure we do not overflow buffer and the envp array
- if (n > 0 && n + 1 < space &&
- block->nvars < (int) ARRAY_SIZE(block->vars) - 2) {
- // Append a pointer to the added string into the envp array
- block->vars[block->nvars++] = added;
- // Bump up used length counter. Include \0 terminator
- block->len += n + 1;
- } else {
- cry(block->conn, "%s: CGI env buffer truncated for [%s]", __func__, fmt);
- }
+ // Make sure we do not overflow buffer and the envp array
+ if (n > 0 && n + 1 < space &&
+ block->nvars < (int) ARRAY_SIZE(block->vars) - 2) {
+ // Append a pointer to the added string into the envp array
+ block->vars[block->nvars++] = added;
+ // Bump up used length counter. Include \0 terminator
+ block->len += n + 1;
+ } else {
+ cry(block->conn, "%s: CGI env buffer truncated for [%s]", __func__, fmt);
+ }
- return added;
+ return added;
}
static void prepare_cgi_environment(struct mg_connection *conn,
- const char *prog,
- struct cgi_env_block *blk) {
- const char *s, *slash;
- struct vec var_vec;
- char *p, src_addr[IP_ADDR_STR_LEN];
- int i;
-
- blk->len = blk->nvars = 0;
- blk->conn = conn;
- sockaddr_to_string(src_addr, sizeof(src_addr), &conn->client.rsa);
-
- addenv(blk, "SERVER_NAME=%s", conn->ctx->config[AUTHENTICATION_DOMAIN]);
- addenv(blk, "SERVER_ROOT=%s", conn->ctx->config[DOCUMENT_ROOT]);
- addenv(blk, "DOCUMENT_ROOT=%s", conn->ctx->config[DOCUMENT_ROOT]);
-
- // Prepare the environment block
- addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1");
- addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1");
- addenv(blk, "%s", "REDIRECT_STATUS=200"); // For PHP
-
- // TODO(lsm): fix this for IPv6 case
- addenv(blk, "SERVER_PORT=%d", ntohs(conn->client.lsa.sin.sin_port));
-
- addenv(blk, "REQUEST_METHOD=%s", conn->request_info.request_method);
- addenv(blk, "REMOTE_ADDR=%s", src_addr);
- addenv(blk, "REMOTE_PORT=%d", conn->request_info.remote_port);
- addenv(blk, "REQUEST_URI=%s", conn->request_info.uri);
-
- // SCRIPT_NAME
- assert(conn->request_info.uri[0] == '/');
- slash = strrchr(conn->request_info.uri, '/');
- if ((s = strrchr(prog, '/')) == NULL)
- s = prog;
- addenv(blk, "SCRIPT_NAME=%.*s%s", (int) (slash - conn->request_info.uri),
- conn->request_info.uri, s);
-
- addenv(blk, "SCRIPT_FILENAME=%s", prog);
- addenv(blk, "PATH_TRANSLATED=%s", prog);
- addenv(blk, "HTTPS=%s", conn->ssl == NULL ? "off" : "on");
-
- if ((s = mg_get_header(conn, "Content-Type")) != NULL)
- addenv(blk, "CONTENT_TYPE=%s", s);
-
- if (conn->request_info.query_string != NULL)
- addenv(blk, "QUERY_STRING=%s", conn->request_info.query_string);
-
- if ((s = mg_get_header(conn, "Content-Length")) != NULL)
- addenv(blk, "CONTENT_LENGTH=%s", s);
-
- if ((s = getenv("PATH")) != NULL)
- addenv(blk, "PATH=%s", s);
-
- if (conn->path_info != NULL) {
- addenv(blk, "PATH_INFO=%s", conn->path_info);
- }
+ const char *prog,
+ struct cgi_env_block *blk) {
+ const char *s, *slash;
+ struct vec var_vec;
+ char *p, src_addr[IP_ADDR_STR_LEN];
+ int i;
+
+ blk->len = blk->nvars = 0;
+ blk->conn = conn;
+ sockaddr_to_string(src_addr, sizeof(src_addr), &conn->client.rsa);
+
+ addenv(blk, "SERVER_NAME=%s", conn->ctx->config[AUTHENTICATION_DOMAIN]);
+ addenv(blk, "SERVER_ROOT=%s", conn->ctx->config[DOCUMENT_ROOT]);
+ addenv(blk, "DOCUMENT_ROOT=%s", conn->ctx->config[DOCUMENT_ROOT]);
+
+ // Prepare the environment block
+ addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1");
+ addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1");
+ addenv(blk, "%s", "REDIRECT_STATUS=200"); // For PHP
+
+ // TODO(lsm): fix this for IPv6 case
+ addenv(blk, "SERVER_PORT=%d", ntohs(conn->client.lsa.sin.sin_port));
+
+ addenv(blk, "REQUEST_METHOD=%s", conn->request_info.request_method);
+ addenv(blk, "REMOTE_ADDR=%s", src_addr);
+ addenv(blk, "REMOTE_PORT=%d", conn->request_info.remote_port);
+ addenv(blk, "REQUEST_URI=%s", conn->request_info.uri);
+
+ // SCRIPT_NAME
+ assert(conn->request_info.uri[0] == '/');
+ slash = strrchr(conn->request_info.uri, '/');
+ if ((s = strrchr(prog, '/')) == NULL)
+ s = prog;
+ addenv(blk, "SCRIPT_NAME=%.*s%s", (int) (slash - conn->request_info.uri),
+ conn->request_info.uri, s);
+
+ addenv(blk, "SCRIPT_FILENAME=%s", prog);
+ addenv(blk, "PATH_TRANSLATED=%s", prog);
+ addenv(blk, "HTTPS=%s", conn->ssl == NULL ? "off" : "on");
+
+ if ((s = mg_get_header(conn, "Content-Type")) != NULL)
+ addenv(blk, "CONTENT_TYPE=%s", s);
+
+ if (conn->request_info.query_string != NULL)
+ addenv(blk, "QUERY_STRING=%s", conn->request_info.query_string);
+
+ if ((s = mg_get_header(conn, "Content-Length")) != NULL)
+ addenv(blk, "CONTENT_LENGTH=%s", s);
+
+ if ((s = getenv("PATH")) != NULL)
+ addenv(blk, "PATH=%s", s);
+
+ if (conn->path_info != NULL) {
+ addenv(blk, "PATH_INFO=%s", conn->path_info);
+ }
#if defined(_WIN32)
- if ((s = getenv("COMSPEC")) != NULL) {
- addenv(blk, "COMSPEC=%s", s);
- }
- if ((s = getenv("SYSTEMROOT")) != NULL) {
- addenv(blk, "SYSTEMROOT=%s", s);
- }
- if ((s = getenv("SystemDrive")) != NULL) {
- addenv(blk, "SystemDrive=%s", s);
- }
- if ((s = getenv("ProgramFiles")) != NULL) {
- addenv(blk, "ProgramFiles=%s", s);
- }
- if ((s = getenv("ProgramFiles(x86)")) != NULL) {
- addenv(blk, "ProgramFiles(x86)=%s", s);
- }
+ if ((s = getenv("COMSPEC")) != NULL) {
+ addenv(blk, "COMSPEC=%s", s);
+ }
+ if ((s = getenv("SYSTEMROOT")) != NULL) {
+ addenv(blk, "SYSTEMROOT=%s", s);
+ }
+ if ((s = getenv("SystemDrive")) != NULL) {
+ addenv(blk, "SystemDrive=%s", s);
+ }
+ if ((s = getenv("ProgramFiles")) != NULL) {
+ addenv(blk, "ProgramFiles=%s", s);
+ }
+ if ((s = getenv("ProgramFiles(x86)")) != NULL) {
+ addenv(blk, "ProgramFiles(x86)=%s", s);
+ }
#else
- if ((s = getenv("LD_LIBRARY_PATH")) != NULL)
- addenv(blk, "LD_LIBRARY_PATH=%s", s);
+ if ((s = getenv("LD_LIBRARY_PATH")) != NULL)
+ addenv(blk, "LD_LIBRARY_PATH=%s", s);
#endif // _WIN32
- if ((s = getenv("PERLLIB")) != NULL)
- addenv(blk, "PERLLIB=%s", s);
+ if ((s = getenv("PERLLIB")) != NULL)
+ addenv(blk, "PERLLIB=%s", s);
- if (conn->request_info.remote_user != NULL) {
- addenv(blk, "REMOTE_USER=%s", conn->request_info.remote_user);
- addenv(blk, "%s", "AUTH_TYPE=Digest");
- }
+ if (conn->request_info.remote_user != NULL) {
+ addenv(blk, "REMOTE_USER=%s", conn->request_info.remote_user);
+ addenv(blk, "%s", "AUTH_TYPE=Digest");
+ }
- // Add all headers as HTTP_* variables
- for (i = 0; i < conn->request_info.num_headers; i++) {
- p = addenv(blk, "HTTP_%s=%s",
- conn->request_info.http_headers[i].name,
- conn->request_info.http_headers[i].value);
+ // Add all headers as HTTP_* variables
+ for (i = 0; i < conn->request_info.num_headers; i++) {
+ p = addenv(blk, "HTTP_%s=%s",
+ conn->request_info.http_headers[i].name,
+ conn->request_info.http_headers[i].value);
- // Convert variable name into uppercase, and change - to _
- for (; *p != '=' && *p != '\0'; p++) {
- if (*p == '-')
- *p = '_';
- *p = (char) toupper(* (unsigned char *) p);
- }
- }
+ // Convert variable name into uppercase, and change - to _
+ for (; *p != '=' && *p != '\0'; p++) {
+ if (*p == '-')
+ *p = '_';
+ *p = (char) toupper(* (unsigned char *) p);
+ }
+ }
- // Add user-specified variables
- s = conn->ctx->config[CGI_ENVIRONMENT];
- while ((s = next_option(s, &var_vec, NULL)) != NULL) {
- addenv(blk, "%.*s", (int) var_vec.len, var_vec.ptr);
- }
+ // Add user-specified variables
+ s = conn->ctx->config[CGI_ENVIRONMENT];
+ while ((s = next_option(s, &var_vec, NULL)) != NULL) {
+ addenv(blk, "%.*s", (int) var_vec.len, var_vec.ptr);
+ }
- blk->vars[blk->nvars++] = NULL;
- blk->buf[blk->len++] = '\0';
+ blk->vars[blk->nvars++] = NULL;
+ blk->buf[blk->len++] = '\0';
- assert(blk->nvars < (int) ARRAY_SIZE(blk->vars));
- assert(blk->len > 0);
- assert(blk->len < (int) sizeof(blk->buf));
+ assert(blk->nvars < (int) ARRAY_SIZE(blk->vars));
+ assert(blk->len > 0);
+ assert(blk->len < (int) sizeof(blk->buf));
}
static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
- int headers_len, data_len, i, fd_stdin[2], fd_stdout[2];
- const char *status, *status_text;
- char buf[16384], *pbuf, dir[PATH_MAX], *p;
- struct mg_request_info ri;
- struct cgi_env_block blk;
- FILE *in, *out;
- struct file fout = STRUCT_FILE_INITIALIZER;
- pid_t pid;
- ri.mg_request_info::num_headers = 0;
-
- prepare_cgi_environment(conn, prog, &blk);
-
- // CGI must be executed in its own directory. 'dir' must point to the
- // directory containing executable program, 'p' must point to the
- // executable program name relative to 'dir'.
- (void) mg_snprintf(conn, dir, sizeof(dir), "%s", prog);
- if ((p = strrchr(dir, '/')) != NULL) {
- *p++ = '\0';
- } else {
- dir[0] = '.', dir[1] = '\0';
- p = (char *) prog;
- }
-
- pid = (pid_t) -1;
- fd_stdin[0] = fd_stdin[1] = fd_stdout[0] = fd_stdout[1] = -1;
- in = out = NULL;
-
- if (pipe(fd_stdin) != 0 || pipe(fd_stdout) != 0) {
- send_http_error(conn, 500, http_500_error,
- "Cannot create CGI pipe: %s", strerror(ERRNO));
- goto done;
- }
-
- pid = spawn_process(conn, p, blk.buf, blk.vars, fd_stdin[0], fd_stdout[1],
- dir);
- // spawn_process() must close those!
- // If we don't mark them as closed, close() attempt before
- // return from this function throws an exception on Windows.
- // Windows does not like when closed descriptor is closed again.
- fd_stdin[0] = fd_stdout[1] = -1;
-
- if (pid == (pid_t) -1) {
- send_http_error(conn, 500, http_500_error,
- "Cannot spawn CGI process [%s]: %s", prog, strerror(ERRNO));
- goto done;
- }
-
- if ((in = fdopen(fd_stdin[1], "wb")) == NULL ||
- (out = fdopen(fd_stdout[0], "rb")) == NULL) {
- send_http_error(conn, 500, http_500_error,
- "fopen: %s", strerror(ERRNO));
- goto done;
- }
-
- setbuf(in, NULL);
- setbuf(out, NULL);
- fout.fp = out;
-
- // Send POST data to the CGI process if needed
- if (!strcmp(conn->request_info.request_method, "POST") &&
- !forward_body_data(conn, in, INVALID_SOCKET, NULL)) {
- goto done;
- }
-
- // Close so child gets an EOF.
- fclose(in);
- in = NULL;
- fd_stdin[1] = -1;
-
- // Now read CGI reply into a buffer. We need to set correct
- // status code, thus we need to see all HTTP headers first.
- // Do not send anything back to client, until we buffer in all
- // HTTP headers.
- data_len = 0;
- headers_len = read_request(out, conn, buf, sizeof(buf), &data_len);
- if (headers_len <= 0) {
- send_http_error(conn, 500, http_500_error,
- "CGI program sent malformed or too big (>%u bytes) "
- "HTTP headers: [%.*s]",
- (unsigned) sizeof(buf), data_len, buf);
- goto done;
- }
- pbuf = buf;
- buf[headers_len - 1] = '\0';
- parse_http_headers(&pbuf, &ri);
-
- // Make up and send the status line
- status_text = "OK";
- if ((status = get_header(&ri, "Status")) != NULL) {
- conn->status_code = atoi(status);
- status_text = status;
- while (isdigit(* (unsigned char *) status_text) || *status_text == ' ') {
- status_text++;
- }
- } else if (get_header(&ri, "Location") != NULL) {
- conn->status_code = 302;
- } else {
- conn->status_code = 200;
- }
- if (get_header(&ri, "Connection") != NULL &&
- !mg_strcasecmp(get_header(&ri, "Connection"), "keep-alive")) {
- conn->must_close = 1;
- }
- (void) mg_printf(conn, "HTTP/1.1 %d %s\r\n", conn->status_code,
- status_text);
-
- // Send headers
- for (i = 0; i < ri.num_headers; i++) {
- mg_printf(conn, "%s: %s\r\n",
- ri.http_headers[i].name, ri.http_headers[i].value);
- }
- mg_write(conn, "\r\n", 2);
-
- // Send chunk of data that may have been read after the headers
- conn->num_bytes_sent += mg_write(conn, buf + headers_len,
- (size_t)(data_len - headers_len));
-
- // Read the rest of CGI output and send to the client
- send_file_data(conn, &fout, 0, INT64_MAX);
+ int headers_len, data_len, i, fd_stdin[2], fd_stdout[2];
+ const char *status, *status_text;
+ char buf[16384], *pbuf, dir[PATH_MAX], *p;
+ struct mg_request_info ri;
+ struct cgi_env_block blk;
+ FILE *in, *out;
+ struct file fout = STRUCT_FILE_INITIALIZER;
+ pid_t pid;
+ ri.mg_request_info::num_headers = 0;
+
+ prepare_cgi_environment(conn, prog, &blk);
+
+ // CGI must be executed in its own directory. 'dir' must point to the
+ // directory containing executable program, 'p' must point to the
+ // executable program name relative to 'dir'.
+ (void) mg_snprintf(conn, dir, sizeof(dir), "%s", prog);
+ if ((p = strrchr(dir, '/')) != NULL) {
+ *p++ = '\0';
+ } else {
+ dir[0] = '.', dir[1] = '\0';
+ p = (char *) prog;
+ }
+
+ pid = (pid_t) -1;
+ fd_stdin[0] = fd_stdin[1] = fd_stdout[0] = fd_stdout[1] = -1;
+ in = out = NULL;
+
+ if (pipe(fd_stdin) != 0 || pipe(fd_stdout) != 0) {
+ send_http_error(conn, 500, http_500_error,
+ "Cannot create CGI pipe: %s", strerror(ERRNO));
+ goto done;
+ }
+
+ pid = spawn_process(conn, p, blk.buf, blk.vars, fd_stdin[0], fd_stdout[1],
+ dir);
+ // spawn_process() must close those!
+ // If we don't mark them as closed, close() attempt before
+ // return from this function throws an exception on Windows.
+ // Windows does not like when closed descriptor is closed again.
+ fd_stdin[0] = fd_stdout[1] = -1;
+
+ if (pid == (pid_t) -1) {
+ send_http_error(conn, 500, http_500_error,
+ "Cannot spawn CGI process [%s]: %s", prog, strerror(ERRNO));
+ goto done;
+ }
+
+ if ((in = fdopen(fd_stdin[1], "wb")) == NULL ||
+ (out = fdopen(fd_stdout[0], "rb")) == NULL) {
+ send_http_error(conn, 500, http_500_error,
+ "fopen: %s", strerror(ERRNO));
+ goto done;
+ }
+
+ setbuf(in, NULL);
+ setbuf(out, NULL);
+ fout.fp = out;
+
+ // Send POST data to the CGI process if needed
+ if (!strcmp(conn->request_info.request_method, "POST") &&
+ !forward_body_data(conn, in, INVALID_SOCKET, NULL)) {
+ goto done;
+ }
+
+ // Close so child gets an EOF.
+ fclose(in);
+ in = NULL;
+ fd_stdin[1] = -1;
+
+ // Now read CGI reply into a buffer. We need to set correct
+ // status code, thus we need to see all HTTP headers first.
+ // Do not send anything back to client, until we buffer in all
+ // HTTP headers.
+ data_len = 0;
+ headers_len = read_request(out, conn, buf, sizeof(buf), &data_len);
+ if (headers_len <= 0) {
+ send_http_error(conn, 500, http_500_error,
+ "CGI program sent malformed or too big (>%u bytes) "
+ "HTTP headers: [%.*s]",
+ (unsigned) sizeof(buf), data_len, buf);
+ goto done;
+ }
+ pbuf = buf;
+ buf[headers_len - 1] = '\0';
+ parse_http_headers(&pbuf, &ri);
+
+ // Make up and send the status line
+ status_text = "OK";
+ if ((status = get_header(&ri, "Status")) != NULL) {
+ conn->status_code = atoi(status);
+ status_text = status;
+ while (isdigit(* (unsigned char *) status_text) || *status_text == ' ') {
+ status_text++;
+ }
+ } else if (get_header(&ri, "Location") != NULL) {
+ conn->status_code = 302;
+ } else {
+ conn->status_code = 200;
+ }
+ if (get_header(&ri, "Connection") != NULL &&
+ !mg_strcasecmp(get_header(&ri, "Connection"), "keep-alive")) {
+ conn->must_close = 1;
+ }
+ (void) mg_printf(conn, "HTTP/1.1 %d %s\r\n", conn->status_code,
+ status_text);
+
+ // Send headers
+ for (i = 0; i < ri.num_headers; i++) {
+ mg_printf(conn, "%s: %s\r\n",
+ ri.http_headers[i].name, ri.http_headers[i].value);
+ }
+ mg_write(conn, "\r\n", 2);
+
+ // Send chunk of data that may have been read after the headers
+ conn->num_bytes_sent += mg_write(conn, buf + headers_len,
+ (size_t)(data_len - headers_len));
+
+ // Read the rest of CGI output and send to the client
+ send_file_data(conn, &fout, 0, INT64_MAX);
done:
- if (pid != (pid_t) -1) {
- kill(pid, SIGKILL);
- }
- if (fd_stdin[0] != -1) {
- close(fd_stdin[0]);
- }
- if (fd_stdout[1] != -1) {
- close(fd_stdout[1]);
- }
-
- if (in != NULL) {
- fclose(in);
- } else if (fd_stdin[1] != -1) {
- close(fd_stdin[1]);
- }
-
- if (out != NULL) {
- fclose(out);
- } else if (fd_stdout[0] != -1) {
- close(fd_stdout[0]);
- }
+ if (pid != (pid_t) -1) {
+ kill(pid, SIGKILL);
+ }
+ if (fd_stdin[0] != -1) {
+ close(fd_stdin[0]);
+ }
+ if (fd_stdout[1] != -1) {
+ close(fd_stdout[1]);
+ }
+
+ if (in != NULL) {
+ fclose(in);
+ } else if (fd_stdin[1] != -1) {
+ close(fd_stdin[1]);
+ }
+
+ if (out != NULL) {
+ fclose(out);
+ } else if (fd_stdout[0] != -1) {
+ close(fd_stdout[0]);
+ }
}
#endif // !NO_CGI
@@ -3509,327 +3506,327 @@ done:
// for given path. Return 0 if the path itself is a directory,
// or -1 on error, 1 if OK.
static int put_dir(struct mg_connection *conn, const char *path) {
- char buf[PATH_MAX];
- const char *s, *p;
- struct file file = STRUCT_FILE_INITIALIZER;
- int len, res = 1;
-
- for (s = p = path + 2; (p = strchr(s, '/')) != NULL; s = ++p) {
- len = p - path;
- if (len >= (int) sizeof(buf)) {
- res = -1;
- break;
- }
- memcpy(buf, path, len);
- buf[len] = '\0';
-
- // Try to create intermediate directory
- DEBUG_TRACE(("mkdir(%s)", buf));
- if (!mg_stat(conn, buf, &file) && mg_mkdir(buf, 0755) != 0) {
- res = -1;
- break;
- }
-
- // Is path itself a directory?
- if (p[1] == '\0') {
- res = 0;
- }
- }
-
- return res;
+ char buf[PATH_MAX];
+ const char *s, *p;
+ struct file file = STRUCT_FILE_INITIALIZER;
+ int len, res = 1;
+
+ for (s = p = path + 2; (p = strchr(s, '/')) != NULL; s = ++p) {
+ len = p - path;
+ if (len >= (int) sizeof(buf)) {
+ res = -1;
+ break;
+ }
+ memcpy(buf, path, len);
+ buf[len] = '\0';
+
+ // Try to create intermediate directory
+ DEBUG_TRACE(("mkdir(%s)", buf));
+ if (!mg_stat(conn, buf, &file) && mg_mkdir(buf, 0755) != 0) {
+ res = -1;
+ break;
+ }
+
+ // Is path itself a directory?
+ if (p[1] == '\0') {
+ res = 0;
+ }
+ }
+
+ return res;
}
static void mkcol(struct mg_connection *conn, const char *path) {
- int rc, body_len;
- struct de de;
- memset(&de.file, 0, sizeof(de.file));
- mg_stat(conn, path, &de.file);
-
- if(de.file.modification_time) {
- send_http_error(conn, 405, "Method Not Allowed",
- "mkcol(%s): %s", path, strerror(ERRNO));
- return;
- }
-
- body_len = conn->data_len - conn->request_len;
- if(body_len > 0) {
- send_http_error(conn, 415, "Unsupported media type",
- "mkcol(%s): %s", path, strerror(ERRNO));
- return;
- }
-
- rc = mg_mkdir(path, 0755);
-
- if (rc == 0) {
- conn->status_code = 201;
- mg_printf(conn, "HTTP/1.1 %d Created\r\n\r\n", conn->status_code);
- } else if (rc == -1) {
- if(errno == EEXIST)
- send_http_error(conn, 405, "Method Not Allowed",
- "mkcol(%s): %s", path, strerror(ERRNO));
- else if(errno == EACCES)
- send_http_error(conn, 403, "Forbidden",
- "mkcol(%s): %s", path, strerror(ERRNO));
- else if(errno == ENOENT)
- send_http_error(conn, 409, "Conflict",
- "mkcol(%s): %s", path, strerror(ERRNO));
- else
- send_http_error(conn, 500, http_500_error,
- "fopen(%s): %s", path, strerror(ERRNO));
- }
+ int rc, body_len;
+ struct de de;
+ memset(&de.file, 0, sizeof(de.file));
+ mg_stat(conn, path, &de.file);
+
+ if(de.file.modification_time) {
+ send_http_error(conn, 405, "Method Not Allowed",
+ "mkcol(%s): %s", path, strerror(ERRNO));
+ return;
+ }
+
+ body_len = conn->data_len - conn->request_len;
+ if(body_len > 0) {
+ send_http_error(conn, 415, "Unsupported media type",
+ "mkcol(%s): %s", path, strerror(ERRNO));
+ return;
+ }
+
+ rc = mg_mkdir(path, 0755);
+
+ if (rc == 0) {
+ conn->status_code = 201;
+ mg_printf(conn, "HTTP/1.1 %d Created\r\n\r\n", conn->status_code);
+ } else if (rc == -1) {
+ if(errno == EEXIST)
+ send_http_error(conn, 405, "Method Not Allowed",
+ "mkcol(%s): %s", path, strerror(ERRNO));
+ else if(errno == EACCES)
+ send_http_error(conn, 403, "Forbidden",
+ "mkcol(%s): %s", path, strerror(ERRNO));
+ else if(errno == ENOENT)
+ send_http_error(conn, 409, "Conflict",
+ "mkcol(%s): %s", path, strerror(ERRNO));
+ else
+ send_http_error(conn, 500, http_500_error,
+ "fopen(%s): %s", path, strerror(ERRNO));
+ }
}
static void put_file(struct mg_connection *conn, const char *path) {
- struct file file = STRUCT_FILE_INITIALIZER;
- const char *range;
- int64_t r1, r2;
- int rc;
-
- conn->status_code = mg_stat(conn, path, &file) ? 200 : 201;
-
- if ((rc = put_dir(conn, path)) == 0) {
- mg_printf(conn, "HTTP/1.1 %d OK\r\n\r\n", conn->status_code);
- } else if (rc == -1) {
- send_http_error(conn, 500, http_500_error,
- "put_dir(%s): %s", path, strerror(ERRNO));
- } else if (!mg_fopen(conn, path, "wb+", &file) || file.fp == NULL) {
- mg_fclose(&file);
- send_http_error(conn, 500, http_500_error,
- "fopen(%s): %s", path, strerror(ERRNO));
- } else {
- fclose_on_exec(&file);
- range = mg_get_header(conn, "Content-Range");
- r1 = r2 = 0;
- if (range != NULL && parse_range_header(range, &r1, &r2) > 0) {
- conn->status_code = 206;
- fseeko(file.fp, r1, SEEK_SET);
- }
- if (forward_body_data(conn, file.fp, INVALID_SOCKET, NULL)) {
- mg_printf(conn, "HTTP/1.1 %d OK\r\n\r\n", conn->status_code);
- }
- mg_fclose(&file);
- }
+ struct file file = STRUCT_FILE_INITIALIZER;
+ const char *range;
+ int64_t r1, r2;
+ int rc;
+
+ conn->status_code = mg_stat(conn, path, &file) ? 200 : 201;
+
+ if ((rc = put_dir(conn, path)) == 0) {
+ mg_printf(conn, "HTTP/1.1 %d OK\r\n\r\n", conn->status_code);
+ } else if (rc == -1) {
+ send_http_error(conn, 500, http_500_error,
+ "put_dir(%s): %s", path, strerror(ERRNO));
+ } else if (!mg_fopen(conn, path, "wb+", &file) || file.fp == NULL) {
+ mg_fclose(&file);
+ send_http_error(conn, 500, http_500_error,
+ "fopen(%s): %s", path, strerror(ERRNO));
+ } else {
+ fclose_on_exec(&file);
+ range = mg_get_header(conn, "Content-Range");
+ r1 = r2 = 0;
+ if (range != NULL && parse_range_header(range, &r1, &r2) > 0) {
+ conn->status_code = 206;
+ fseeko(file.fp, r1, SEEK_SET);
+ }
+ if (forward_body_data(conn, file.fp, INVALID_SOCKET, NULL)) {
+ mg_printf(conn, "HTTP/1.1 %d OK\r\n\r\n", conn->status_code);
+ }
+ mg_fclose(&file);
+ }
}
static void send_ssi_file(struct mg_connection *, const char *,
- struct file *, int);
+ struct file *, int);
static void do_ssi_include(struct mg_connection *conn, const char *ssi,
- char *tag, int include_level) {
- char file_name[MG_BUF_LEN], path[PATH_MAX], *p;
- struct file file = STRUCT_FILE_INITIALIZER;
-
- // sscanf() is safe here, since send_ssi_file() also uses buffer
- // of size MG_BUF_LEN to get the tag. So strlen(tag) is always < MG_BUF_LEN.
- if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) {
- // File name is relative to the webserver root
- (void) mg_snprintf(conn, path, sizeof(path), "%s%c%s",
- conn->ctx->config[DOCUMENT_ROOT], '/', file_name);
- } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1) {
- // File name is relative to the webserver working directory
- // or it is absolute system path
- (void) mg_snprintf(conn, path, sizeof(path), "%s", file_name);
- } else if (sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
- // File name is relative to the currect document
- (void) mg_snprintf(conn, path, sizeof(path), "%s", ssi);
- if ((p = strrchr(path, '/')) != NULL) {
- p[1] = '\0';
- }
- (void) mg_snprintf(conn, path + strlen(path),
- sizeof(path) - strlen(path), "%s", file_name);
- } else {
- cry(conn, "Bad SSI #include: [%s]", tag);
- return;
- }
-
- if (!mg_fopen(conn, path, "rb", &file)) {
- cry(conn, "Cannot open SSI #include: [%s]: fopen(%s): %s",
- tag, path, strerror(ERRNO));
- } else {
- fclose_on_exec(&file);
- if (match_prefix(conn->ctx->config[SSI_EXTENSIONS],
- strlen(conn->ctx->config[SSI_EXTENSIONS]), path) > 0) {
- send_ssi_file(conn, path, &file, include_level + 1);
- } else {
- send_file_data(conn, &file, 0, INT64_MAX);
- }
- mg_fclose(&file);
- }
+ char *tag, int include_level) {
+ char file_name[MG_BUF_LEN], path[PATH_MAX], *p;
+ struct file file = STRUCT_FILE_INITIALIZER;
+
+ // sscanf() is safe here, since send_ssi_file() also uses buffer
+ // of size MG_BUF_LEN to get the tag. So strlen(tag) is always < MG_BUF_LEN.
+ if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) {
+ // File name is relative to the webserver root
+ (void) mg_snprintf(conn, path, sizeof(path), "%s%c%s",
+ conn->ctx->config[DOCUMENT_ROOT], '/', file_name);
+ } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1) {
+ // File name is relative to the webserver working directory
+ // or it is absolute system path
+ (void) mg_snprintf(conn, path, sizeof(path), "%s", file_name);
+ } else if (sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
+ // File name is relative to the currect document
+ (void) mg_snprintf(conn, path, sizeof(path), "%s", ssi);
+ if ((p = strrchr(path, '/')) != NULL) {
+ p[1] = '\0';
+ }
+ (void) mg_snprintf(conn, path + strlen(path),
+ sizeof(path) - strlen(path), "%s", file_name);
+ } else {
+ cry(conn, "Bad SSI #include: [%s]", tag);
+ return;
+ }
+
+ if (!mg_fopen(conn, path, "rb", &file)) {
+ cry(conn, "Cannot open SSI #include: [%s]: fopen(%s): %s",
+ tag, path, strerror(ERRNO));
+ } else {
+ fclose_on_exec(&file);
+ if (match_prefix(conn->ctx->config[SSI_EXTENSIONS],
+ strlen(conn->ctx->config[SSI_EXTENSIONS]), path) > 0) {
+ send_ssi_file(conn, path, &file, include_level + 1);
+ } else {
+ send_file_data(conn, &file, 0, INT64_MAX);
+ }
+ mg_fclose(&file);
+ }
}
#if !defined(NO_POPEN)
static void do_ssi_exec(struct mg_connection *conn, char *tag) {
- char cmd[MG_BUF_LEN];
- struct file file = STRUCT_FILE_INITIALIZER;
-
- if (sscanf(tag, " \"%[^\"]\"", cmd) != 1) {
- cry(conn, "Bad SSI #exec: [%s]", tag);
- } else if ((file.fp = popen(cmd, "r")) == NULL) {
- cry(conn, "Cannot SSI #exec: [%s]: %s", cmd, strerror(ERRNO));
- } else {
- send_file_data(conn, &file, 0, INT64_MAX);
- pclose(file.fp);
- }
+ char cmd[MG_BUF_LEN];
+ struct file file = STRUCT_FILE_INITIALIZER;
+
+ if (sscanf(tag, " \"%[^\"]\"", cmd) != 1) {
+ cry(conn, "Bad SSI #exec: [%s]", tag);
+ } else if ((file.fp = popen(cmd, "r")) == NULL) {
+ cry(conn, "Cannot SSI #exec: [%s]: %s", cmd, strerror(ERRNO));
+ } else {
+ send_file_data(conn, &file, 0, INT64_MAX);
+ pclose(file.fp);
+ }
}
#endif // !NO_POPEN
static int mg_fgetc(struct file *filep, int offset) {
- if (filep->membuf != NULL && offset >=0 && offset < filep->size) {
- return ((unsigned char *) filep->membuf)[offset];
- } else if (filep->fp != NULL) {
- return fgetc(filep->fp);
- } else {
- return EOF;
- }
+ if (filep->membuf != NULL && offset >=0 && offset < filep->size) {
+ return ((unsigned char *) filep->membuf)[offset];
+ } else if (filep->fp != NULL) {
+ return fgetc(filep->fp);
+ } else {
+ return EOF;
+ }
}
static void send_ssi_file(struct mg_connection *conn, const char *path,
- struct file *filep, int include_level) {
- char buf[MG_BUF_LEN];
- int ch, offset, len, in_ssi_tag;
-
- if (include_level > 10) {
- cry(conn, "SSI #include level is too deep (%s)", path);
- return;
- }
-
- in_ssi_tag = len = offset = 0;
- while ((ch = mg_fgetc(filep, offset)) != EOF) {
- if (in_ssi_tag && ch == '>') {
- in_ssi_tag = 0;
- buf[len++] = (char) ch;
- buf[len] = '\0';
- assert(len <= (int) sizeof(buf));
- if (len < 6 || memcmp(buf, "<!--#", 5) != 0) {
- // Not an SSI tag, pass it
- (void) mg_write(conn, buf, (size_t) len);
- } else {
- if (!memcmp(buf + 5, "include", 7)) {
- do_ssi_include(conn, path, buf + 12, include_level);
+ struct file *filep, int include_level) {
+ char buf[MG_BUF_LEN];
+ int ch, offset, len, in_ssi_tag;
+
+ if (include_level > 10) {
+ cry(conn, "SSI #include level is too deep (%s)", path);
+ return;
+ }
+
+ in_ssi_tag = len = offset = 0;
+ while ((ch = mg_fgetc(filep, offset)) != EOF) {
+ if (in_ssi_tag && ch == '>') {
+ in_ssi_tag = 0;
+ buf[len++] = (char) ch;
+ buf[len] = '\0';
+ assert(len <= (int) sizeof(buf));
+ if (len < 6 || memcmp(buf, "<!--#", 5) != 0) {
+ // Not an SSI tag, pass it
+ (void) mg_write(conn, buf, (size_t) len);
+ } else {
+ if (!memcmp(buf + 5, "include", 7)) {
+ do_ssi_include(conn, path, buf + 12, include_level);
#if !defined(NO_POPEN)
- } else if (!memcmp(buf + 5, "exec", 4)) {
- do_ssi_exec(conn, buf + 9);
+ } else if (!memcmp(buf + 5, "exec", 4)) {
+ do_ssi_exec(conn, buf + 9);
#endif // !NO_POPEN
- } else {
- cry(conn, "%s: unknown SSI " "command: \"%s\"", path, buf);
- }
- }
- len = 0;
- } else if (in_ssi_tag) {
- if (len == 5 && memcmp(buf, "<!--#", 5) != 0) {
- // Not an SSI tag
- in_ssi_tag = 0;
- } else if (len == (int) sizeof(buf) - 2) {
- cry(conn, "%s: SSI tag is too large", path);
- len = 0;
- }
- buf[len++] = ch & 0xff;
- } else if (ch == '<') {
- in_ssi_tag = 1;
- if (len > 0) {
- mg_write(conn, buf, (size_t) len);
- }
- len = 0;
- buf[len++] = ch & 0xff;
- } else {
- buf[len++] = ch & 0xff;
- if (len == (int) sizeof(buf)) {
- mg_write(conn, buf, (size_t) len);
- len = 0;
- }
- }
- }
-
- // Send the rest of buffered data
- if (len > 0) {
- mg_write(conn, buf, (size_t) len);
- }
+ } else {
+ cry(conn, "%s: unknown SSI " "command: \"%s\"", path, buf);
+ }
+ }
+ len = 0;
+ } else if (in_ssi_tag) {
+ if (len == 5 && memcmp(buf, "<!--#", 5) != 0) {
+ // Not an SSI tag
+ in_ssi_tag = 0;
+ } else if (len == (int) sizeof(buf) - 2) {
+ cry(conn, "%s: SSI tag is too large", path);
+ len = 0;
+ }
+ buf[len++] = ch & 0xff;
+ } else if (ch == '<') {
+ in_ssi_tag = 1;
+ if (len > 0) {
+ mg_write(conn, buf, (size_t) len);
+ }
+ len = 0;
+ buf[len++] = ch & 0xff;
+ } else {
+ buf[len++] = ch & 0xff;
+ if (len == (int) sizeof(buf)) {
+ mg_write(conn, buf, (size_t) len);
+ len = 0;
+ }
+ }
+ }
+
+ // Send the rest of buffered data
+ if (len > 0) {
+ mg_write(conn, buf, (size_t) len);
+ }
}
static void handle_ssi_file_request(struct mg_connection *conn,
- const char *path) {
- struct file file = STRUCT_FILE_INITIALIZER;
-
- if (!mg_fopen(conn, path, "rb", &file)) {
- send_http_error(conn, 500, http_500_error, "fopen(%s): %s", path,
- strerror(ERRNO));
- } else {
- conn->must_close = 1;
- fclose_on_exec(&file);
- mg_printf(conn, "HTTP/1.1 200 OK\r\n"
- "Content-Type: text/html\r\nConnection: %s\r\n\r\n",
- suggest_connection_header(conn));
- send_ssi_file(conn, path, &file, 0);
- mg_fclose(&file);
- }
+ const char *path) {
+ struct file file = STRUCT_FILE_INITIALIZER;
+
+ if (!mg_fopen(conn, path, "rb", &file)) {
+ send_http_error(conn, 500, http_500_error, "fopen(%s): %s", path,
+ strerror(ERRNO));
+ } else {
+ conn->must_close = 1;
+ fclose_on_exec(&file);
+ mg_printf(conn, "HTTP/1.1 200 OK\r\n"
+ "Content-Type: text/html\r\nConnection: %s\r\n\r\n",
+ suggest_connection_header(conn));
+ send_ssi_file(conn, path, &file, 0);
+ mg_fclose(&file);
+ }
}
static void send_options(struct mg_connection *conn) {
- conn->status_code = 200;
+ conn->status_code = 200;
- mg_printf(conn, "%s", "HTTP/1.1 200 OK\r\n"
- "Allow: GET, POST, HEAD, CONNECT, PUT, DELETE, OPTIONS, PROPFIND, MKCOL\r\n"
- "DAV: 1\r\n\r\n");
+ mg_printf(conn, "%s", "HTTP/1.1 200 OK\r\n"
+ "Allow: GET, POST, HEAD, CONNECT, PUT, DELETE, OPTIONS, PROPFIND, MKCOL\r\n"
+ "DAV: 1\r\n\r\n");
}
// Writes PROPFIND properties for a collection element
static void print_props(struct mg_connection *conn, const char* uri,
- struct file *filep) {
- char mtime[64];
- gmt_time_string(mtime, sizeof(mtime), &filep->modification_time);
- conn->num_bytes_sent += mg_printf(conn,
- "<d:response>"
- "<d:href>%s</d:href>"
- "<d:propstat>"
- "<d:prop>"
- "<d:resourcetype>%s</d:resourcetype>"
- "<d:getcontentlength>%" INT64_FMT "</d:getcontentlength>"
- "<d:getlastmodified>%s</d:getlastmodified>"
- "</d:prop>"
- "<d:status>HTTP/1.1 200 OK</d:status>"
- "</d:propstat>"
- "</d:response>\n",
- uri,
- filep->is_directory ? "<d:collection/>" : "",
- filep->size,
- mtime);
+ struct file *filep) {
+ char mtime[64];
+ gmt_time_string(mtime, sizeof(mtime), &filep->modification_time);
+ conn->num_bytes_sent += mg_printf(conn,
+ "<d:response>"
+ "<d:href>%s</d:href>"
+ "<d:propstat>"
+ "<d:prop>"
+ "<d:resourcetype>%s</d:resourcetype>"
+ "<d:getcontentlength>%" INT64_FMT "</d:getcontentlength>"
+ "<d:getlastmodified>%s</d:getlastmodified>"
+ "</d:prop>"
+ "<d:status>HTTP/1.1 200 OK</d:status>"
+ "</d:propstat>"
+ "</d:response>\n",
+ uri,
+ filep->is_directory ? "<d:collection/>" : "",
+ filep->size,
+ mtime);
}
static void print_dav_dir_entry(struct de *de, void *data) {
- char href[PATH_MAX];
- char href_encoded[PATH_MAX];
- struct mg_connection *conn = (struct mg_connection *) data;
- mg_snprintf(conn, href, sizeof(href), "%s%s",
- conn->request_info.uri, de->file_name);
- mg_url_encode(href, href_encoded, PATH_MAX-1);
- print_props(conn, href_encoded, &de->file);
+ char href[PATH_MAX];
+ char href_encoded[PATH_MAX];
+ struct mg_connection *conn = (struct mg_connection *) data;
+ mg_snprintf(conn, href, sizeof(href), "%s%s",
+ conn->request_info.uri, de->file_name);
+ mg_url_encode(href, href_encoded, PATH_MAX-1);
+ print_props(conn, href_encoded, &de->file);
}
static void handle_propfind(struct mg_connection *conn, const char *path,
- struct file *filep) {
- const char *depth = mg_get_header(conn, "Depth");
+ struct file *filep) {
+ const char *depth = mg_get_header(conn, "Depth");
- conn->must_close = 1;
- conn->status_code = 207;
- mg_printf(conn, "HTTP/1.1 207 Multi-Status\r\n"
- "Connection: close\r\n"
- "Content-Type: text/xml; charset=utf-8\r\n\r\n");
+ conn->must_close = 1;
+ conn->status_code = 207;
+ mg_printf(conn, "HTTP/1.1 207 Multi-Status\r\n"
+ "Connection: close\r\n"
+ "Content-Type: text/xml; charset=utf-8\r\n\r\n");
- conn->num_bytes_sent += mg_printf(conn,
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
- "<d:multistatus xmlns:d='DAV:'>\n");
+ conn->num_bytes_sent += mg_printf(conn,
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<d:multistatus xmlns:d='DAV:'>\n");
- // Print properties for the requested resource itself
- print_props(conn, conn->request_info.uri, filep);
+ // Print properties for the requested resource itself
+ print_props(conn, conn->request_info.uri, filep);
- // If it is a directory, print directory entries too if Depth is not 0
- if (filep->is_directory &&
- !mg_strcasecmp(conn->ctx->config[ENABLE_DIRECTORY_LISTING], "yes") &&
- (depth == NULL || strcmp(depth, "0") != 0)) {
- scan_directory(conn, path, conn, &print_dav_dir_entry);
- }
+ // If it is a directory, print directory entries too if Depth is not 0
+ if (filep->is_directory &&
+ !mg_strcasecmp(conn->ctx->config[ENABLE_DIRECTORY_LISTING], "yes") &&
+ (depth == NULL || strcmp(depth, "0") != 0)) {
+ scan_directory(conn, path, conn, &print_dav_dir_entry);
+ }
- conn->num_bytes_sent += mg_printf(conn, "%s\n", "</d:multistatus>");
+ conn->num_bytes_sent += mg_printf(conn, "%s\n", "</d:multistatus>");
}
#if defined(USE_WEBSOCKET)
@@ -3846,16 +3843,16 @@ union char64long16 { unsigned char c[64]; uint32_t l[16]; };
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
static uint32_t blk0(union char64long16 *block, int i) {
- // Forrest: SHA expect BIG_ENDIAN, swap if LITTLE_ENDIAN
- if (!is_big_endian()) {
- block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) |
- (rol(block->l[i], 8) & 0x00FF00FF);
- }
- return block->l[i];
+ // Forrest: SHA expect BIG_ENDIAN, swap if LITTLE_ENDIAN
+ if (!is_big_endian()) {
+ block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) |
+ (rol(block->l[i], 8) & 0x00FF00FF);
+ }
+ return block->l[i];
}
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
- ^block->l[(i+2)&15]^block->l[i&15],1))
+ ^block->l[(i+2)&15]^block->l[i&15],1))
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(block, i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
@@ -3863,374 +3860,374 @@ static uint32_t blk0(union char64long16 *block, int i) {
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
typedef struct {
- uint32_t state[5];
- uint32_t count[2];
- unsigned char buffer[64];
+ uint32_t state[5];
+ uint32_t count[2];
+ unsigned char buffer[64];
} SHA1_CTX;
static void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]) {
- uint32_t a, b, c, d, e;
- union char64long16 block[1];
-
- memcpy(block, buffer, 64);
- a = state[0];
- b = state[1];
- c = state[2];
- d = state[3];
- e = state[4];
- R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
- R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
- R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
- R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
- R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
- R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
- R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
- R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
- R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
- R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
- R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
- R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
- R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
- R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
- R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
- R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
- R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
- R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
- R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
- R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
- state[4] += e;
- a = b = c = d = e = 0;
- memset(block, '\0', sizeof(block));
+ uint32_t a, b, c, d, e;
+ union char64long16 block[1];
+
+ memcpy(block, buffer, 64);
+ a = state[0];
+ b = state[1];
+ c = state[2];
+ d = state[3];
+ e = state[4];
+ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
+ R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
+ R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
+ R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
+ R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
+ R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
+ R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
+ R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
+ R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
+ R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
+ R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
+ R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
+ R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
+ R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
+ R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
+ R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
+ R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
+ R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
+ R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
+ R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ state[4] += e;
+ a = b = c = d = e = 0;
+ memset(block, '\0', sizeof(block));
}
static void SHA1Init(SHA1_CTX* context) {
- context->state[0] = 0x67452301;
- context->state[1] = 0xEFCDAB89;
- context->state[2] = 0x98BADCFE;
- context->state[3] = 0x10325476;
- context->state[4] = 0xC3D2E1F0;
- context->count[0] = context->count[1] = 0;
+ context->state[0] = 0x67452301;
+ context->state[1] = 0xEFCDAB89;
+ context->state[2] = 0x98BADCFE;
+ context->state[3] = 0x10325476;
+ context->state[4] = 0xC3D2E1F0;
+ context->count[0] = context->count[1] = 0;
}
static void SHA1Update(SHA1_CTX* context, const unsigned char* data,
- uint32_t len) {
- uint32_t i, j;
-
- j = context->count[0];
- if ((context->count[0] += len << 3) < j)
- context->count[1]++;
- context->count[1] += (len>>29);
- j = (j >> 3) & 63;
- if ((j + len) > 63) {
- memcpy(&context->buffer[j], data, (i = 64-j));
- SHA1Transform(context->state, context->buffer);
- for ( ; i + 63 < len; i += 64) {
- SHA1Transform(context->state, &data[i]);
- }
- j = 0;
- }
- else i = 0;
- memcpy(&context->buffer[j], &data[i], len - i);
+ uint32_t len) {
+ uint32_t i, j;
+
+ j = context->count[0];
+ if ((context->count[0] += len << 3) < j)
+ context->count[1]++;
+ context->count[1] += (len>>29);
+ j = (j >> 3) & 63;
+ if ((j + len) > 63) {
+ memcpy(&context->buffer[j], data, (i = 64-j));
+ SHA1Transform(context->state, context->buffer);
+ for ( ; i + 63 < len; i += 64) {
+ SHA1Transform(context->state, &data[i]);
+ }
+ j = 0;
+ }
+ else i = 0;
+ memcpy(&context->buffer[j], &data[i], len - i);
}
static void SHA1Final(unsigned char digest[20], SHA1_CTX* context) {
- unsigned i;
- unsigned char finalcount[8], c;
-
- for (i = 0; i < 8; i++) {
- finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
- >> ((3-(i & 3)) * 8) ) & 255);
- }
- c = 0200;
- SHA1Update(context, &c, 1);
- while ((context->count[0] & 504) != 448) {
- c = 0000;
- SHA1Update(context, &c, 1);
- }
- SHA1Update(context, finalcount, 8);
- for (i = 0; i < 20; i++) {
- digest[i] = (unsigned char)
- ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
- }
- memset(context, '\0', sizeof(*context));
- memset(&finalcount, '\0', sizeof(finalcount));
+ unsigned i;
+ unsigned char finalcount[8], c;
+
+ for (i = 0; i < 8; i++) {
+ finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
+ >> ((3-(i & 3)) * 8) ) & 255);
+ }
+ c = 0200;
+ SHA1Update(context, &c, 1);
+ while ((context->count[0] & 504) != 448) {
+ c = 0000;
+ SHA1Update(context, &c, 1);
+ }
+ SHA1Update(context, finalcount, 8);
+ for (i = 0; i < 20; i++) {
+ digest[i] = (unsigned char)
+ ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+ }
+ memset(context, '\0', sizeof(*context));
+ memset(&finalcount, '\0', sizeof(finalcount));
}
// END OF SHA1 CODE
static void base64_encode(const unsigned char *src, int src_len, char *dst) {
- static const char *b64 =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- int i, j, a, b, c;
-
- for (i = j = 0; i < src_len; i += 3) {
- a = src[i];
- b = i + 1 >= src_len ? 0 : src[i + 1];
- c = i + 2 >= src_len ? 0 : src[i + 2];
-
- dst[j++] = b64[a >> 2];
- dst[j++] = b64[((a & 3) << 4) | (b >> 4)];
- if (i + 1 < src_len) {
- dst[j++] = b64[(b & 15) << 2 | (c >> 6)];
- }
- if (i + 2 < src_len) {
- dst[j++] = b64[c & 63];
- }
- }
- while (j % 4 != 0) {
- dst[j++] = '=';
- }
- dst[j++] = '\0';
+ static const char *b64 =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ int i, j, a, b, c;
+
+ for (i = j = 0; i < src_len; i += 3) {
+ a = src[i];
+ b = i + 1 >= src_len ? 0 : src[i + 1];
+ c = i + 2 >= src_len ? 0 : src[i + 2];
+
+ dst[j++] = b64[a >> 2];
+ dst[j++] = b64[((a & 3) << 4) | (b >> 4)];
+ if (i + 1 < src_len) {
+ dst[j++] = b64[(b & 15) << 2 | (c >> 6)];
+ }
+ if (i + 2 < src_len) {
+ dst[j++] = b64[c & 63];
+ }
+ }
+ while (j % 4 != 0) {
+ dst[j++] = '=';
+ }
+ dst[j++] = '\0';
}
static void send_websocket_handshake(struct mg_connection *conn) {
- static const char *magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
- char buf[100], sha[20], b64_sha[sizeof(sha) * 2];
- SHA1_CTX sha_ctx;
-
- mg_snprintf(conn, buf, sizeof(buf), "%s%s",
- mg_get_header(conn, "Sec-WebSocket-Key"), magic);
- SHA1Init(&sha_ctx);
- SHA1Update(&sha_ctx, (unsigned char *) buf, strlen(buf));
- SHA1Final((unsigned char *) sha, &sha_ctx);
- base64_encode((unsigned char *) sha, sizeof(sha), b64_sha);
- mg_printf(conn, "%s%s%s",
- "HTTP/1.1 101 Switching Protocols\r\n"
- "Upgrade: websocket\r\n"
- "Connection: Upgrade\r\n"
- "Sec-WebSocket-Accept: ", b64_sha, "\r\n\r\n");
+ static const char *magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+ char buf[100], sha[20], b64_sha[sizeof(sha) * 2];
+ SHA1_CTX sha_ctx;
+
+ mg_snprintf(conn, buf, sizeof(buf), "%s%s",
+ mg_get_header(conn, "Sec-WebSocket-Key"), magic);
+ SHA1Init(&sha_ctx);
+ SHA1Update(&sha_ctx, (unsigned char *) buf, strlen(buf));
+ SHA1Final((unsigned char *) sha, &sha_ctx);
+ base64_encode((unsigned char *) sha, sizeof(sha), b64_sha);
+ mg_printf(conn, "%s%s%s",
+ "HTTP/1.1 101 Switching Protocols\r\n"
+ "Upgrade: websocket\r\n"
+ "Connection: Upgrade\r\n"
+ "Sec-WebSocket-Accept: ", b64_sha, "\r\n\r\n");
}
static void read_websocket(struct mg_connection *conn) {
- // Pointer to the beginning of the portion of the incoming websocket message
- // queue. The original websocket upgrade request is never removed,
- // so the queue begins after it.
- unsigned char *buf = (unsigned char *) conn->buf + conn->request_len;
- int bits, n, stop = 0;
- size_t i, len, mask_len, data_len, header_len, body_len;
- // data points to the place where the message is stored when passed to the
- // websocket_data callback. This is either mem on the stack,
- // or a dynamically allocated buffer if it is too large.
- char mem[4 * 1024], mask[4], *data;
-
- assert(conn->content_len == 0);
-
- // Loop continuously, reading messages from the socket, invoking the callback,
- // and waiting repeatedly until an error occurs.
- while (!stop) {
- header_len = 0;
- // body_len is the length of the entire queue in bytes
- // len is the length of the current message
- // data_len is the length of the current message's data payload
- // header_len is the length of the current message's header
- if ((body_len = conn->data_len - conn->request_len) >= 2) {
- len = buf[1] & 127;
- mask_len = buf[1] & 128 ? 4 : 0;
- if (len < 126 && body_len >= mask_len) {
- data_len = len;
- header_len = 2 + mask_len;
- } else if (len == 126 && body_len >= 4 + mask_len) {
- header_len = 4 + mask_len;
- data_len = ((((int) buf[2]) << 8) + buf[3]);
- } else if (body_len >= 10 + mask_len) {
- header_len = 10 + mask_len;
- data_len = (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) +
- htonl(* (uint32_t *) &buf[6]);
- }
- }
-
- // Data layout is as follows:
- // conn->buf buf
- // v v frame1 | frame2
- // |---------------------|----------------|--------------|-------
- // | |<--header_len-->|<--data_len-->|
- // |<-conn->request_len->|<-----body_len----------->|
- // |<-------------------conn->data_len------------->|
-
- if (header_len > 0) {
- // Allocate space to hold websocket payload
- data = mem;
- if (data_len > sizeof(mem) && (data = (char*)malloc(data_len)) == NULL) {
- // Allocation failed, exit the loop and then close the connection
- // TODO: notify user about the failure
- break;
- }
-
- // Save mask and bits, otherwise it may be clobbered by memmove below
- bits = buf[0];
- memcpy(mask, buf + header_len - mask_len, mask_len);
-
- // Read frame payload into the allocated buffer.
- assert(body_len >= header_len);
- if (data_len + header_len > body_len) {
- len = body_len - header_len;
- memcpy(data, buf + header_len, len);
- // TODO: handle pull error
- pull_all(NULL, conn, data + len, data_len - len);
- conn->data_len = conn->request_len;
- } else {
- len = data_len + header_len;
- memcpy(data, buf + header_len, data_len);
- memmove(buf, buf + len, body_len - len);
- conn->data_len -= len;
- }
-
- // Apply mask if necessary
- if (mask_len > 0) {
- for (i = 0; i < data_len; i++) {
- data[i] ^= mask[i % 4];
- }
- }
-
- // Exit the loop if callback signalled to exit,
- // or "connection close" opcode received.
- if ((conn->ctx->callbacks.websocket_data != NULL &&
- !conn->ctx->callbacks.websocket_data(conn, bits, data, data_len)) ||
- (bits & 0xf) == 8) { // Opcode == 8, connection close
- stop = 1;
- }
-
- if (data != mem) {
- free(data);
- }
- // Not breaking the loop, process next websocket frame.
- } else {
- // Buffering websocket request
- if ((n = pull(NULL, conn, conn->buf + conn->data_len,
- conn->buf_size - conn->data_len)) <= 0) {
- break;
- }
- conn->data_len += n;
- }
- }
+ // Pointer to the beginning of the portion of the incoming websocket message
+ // queue. The original websocket upgrade request is never removed,
+ // so the queue begins after it.
+ unsigned char *buf = (unsigned char *) conn->buf + conn->request_len;
+ int bits, n, stop = 0;
+ size_t i, len, mask_len, data_len, header_len, body_len;
+ // data points to the place where the message is stored when passed to the
+ // websocket_data callback. This is either mem on the stack,
+ // or a dynamically allocated buffer if it is too large.
+ char mem[4 * 1024], mask[4], *data;
+
+ assert(conn->content_len == 0);
+
+ // Loop continuously, reading messages from the socket, invoking the callback,
+ // and waiting repeatedly until an error occurs.
+ while (!stop) {
+ header_len = 0;
+ // body_len is the length of the entire queue in bytes
+ // len is the length of the current message
+ // data_len is the length of the current message's data payload
+ // header_len is the length of the current message's header
+ if ((body_len = conn->data_len - conn->request_len) >= 2) {
+ len = buf[1] & 127;
+ mask_len = buf[1] & 128 ? 4 : 0;
+ if (len < 126 && body_len >= mask_len) {
+ data_len = len;
+ header_len = 2 + mask_len;
+ } else if (len == 126 && body_len >= 4 + mask_len) {
+ header_len = 4 + mask_len;
+ data_len = ((((int) buf[2]) << 8) + buf[3]);
+ } else if (body_len >= 10 + mask_len) {
+ header_len = 10 + mask_len;
+ data_len = (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) +
+ htonl(* (uint32_t *) &buf[6]);
+ }
+ }
+
+ // Data layout is as follows:
+ // conn->buf buf
+ // v v frame1 | frame2
+ // |---------------------|----------------|--------------|-------
+ // | |<--header_len-->|<--data_len-->|
+ // |<-conn->request_len->|<-----body_len----------->|
+ // |<-------------------conn->data_len------------->|
+
+ if (header_len > 0) {
+ // Allocate space to hold websocket payload
+ data = mem;
+ if (data_len > sizeof(mem) && (data = (char*)malloc(data_len)) == NULL) {
+ // Allocation failed, exit the loop and then close the connection
+ // TODO: notify user about the failure
+ break;
+ }
+
+ // Save mask and bits, otherwise it may be clobbered by memmove below
+ bits = buf[0];
+ memcpy(mask, buf + header_len - mask_len, mask_len);
+
+ // Read frame payload into the allocated buffer.
+ assert(body_len >= header_len);
+ if (data_len + header_len > body_len) {
+ len = body_len - header_len;
+ memcpy(data, buf + header_len, len);
+ // TODO: handle pull error
+ pull_all(NULL, conn, data + len, data_len - len);
+ conn->data_len = conn->request_len;
+ } else {
+ len = data_len + header_len;
+ memcpy(data, buf + header_len, data_len);
+ memmove(buf, buf + len, body_len - len);
+ conn->data_len -= len;
+ }
+
+ // Apply mask if necessary
+ if (mask_len > 0) {
+ for (i = 0; i < data_len; i++) {
+ data[i] ^= mask[i % 4];
+ }
+ }
+
+ // Exit the loop if callback signalled to exit,
+ // or "connection close" opcode received.
+ if ((conn->ctx->callbacks.websocket_data != NULL &&
+ !conn->ctx->callbacks.websocket_data(conn, bits, data, data_len)) ||
+ (bits & 0xf) == 8) { // Opcode == 8, connection close
+ stop = 1;
+ }
+
+ if (data != mem) {
+ free(data);
+ }
+ // Not breaking the loop, process next websocket frame.
+ } else {
+ // Buffering websocket request
+ if ((n = pull(NULL, conn, conn->buf + conn->data_len,
+ conn->buf_size - conn->data_len)) <= 0) {
+ break;
+ }
+ conn->data_len += n;
+ }
+ }
}
int mg_websocket_write(struct mg_connection* conn, int opcode,
- const char *data, size_t data_len) {
- unsigned char *copy;
- size_t copy_len = 0;
- int retval = -1;
-
- if ((copy = (unsigned char *) malloc(data_len + 10)) == NULL) {
- return -1;
- }
-
- copy[0] = 0x80 + (opcode & 0x0f);
-
- // Frame format: http://tools.ietf.org/html/rfc6455#section-5.2
- if (data_len < 126) {
- // Inline 7-bit length field
- copy[1] = data_len;
- memcpy(copy + 2, data, data_len);
- copy_len = 2 + data_len;
- } else if (data_len <= 0xFFFF) {
- // 16-bit length field
- copy[1] = 126;
- * (uint16_t *) (copy + 2) = htons(data_len);
- memcpy(copy + 4, data, data_len);
- copy_len = 4 + data_len;
- } else {
- // 64-bit length field
- copy[1] = 127;
- * (uint32_t *) (copy + 2) = htonl((uint64_t) data_len >> 32);
- * (uint32_t *) (copy + 6) = htonl(data_len & 0xffffffff);
- memcpy(copy + 10, data, data_len);
- copy_len = 10 + data_len;
- }
-
- // Not thread safe
- if (copy_len > 0) {
- retval = mg_write(conn, copy, copy_len);
- }
- free(copy);
-
- return retval;
+ const char *data, size_t data_len) {
+ unsigned char *copy;
+ size_t copy_len = 0;
+ int retval = -1;
+
+ if ((copy = (unsigned char *) malloc(data_len + 10)) == NULL) {
+ return -1;
+ }
+
+ copy[0] = 0x80 + (opcode & 0x0f);
+
+ // Frame format: http://tools.ietf.org/html/rfc6455#section-5.2
+ if (data_len < 126) {
+ // Inline 7-bit length field
+ copy[1] = data_len;
+ memcpy(copy + 2, data, data_len);
+ copy_len = 2 + data_len;
+ } else if (data_len <= 0xFFFF) {
+ // 16-bit length field
+ copy[1] = 126;
+ * (uint16_t *) (copy + 2) = htons(data_len);
+ memcpy(copy + 4, data, data_len);
+ copy_len = 4 + data_len;
+ } else {
+ // 64-bit length field
+ copy[1] = 127;
+ * (uint32_t *) (copy + 2) = htonl((uint64_t) data_len >> 32);
+ * (uint32_t *) (copy + 6) = htonl(data_len & 0xffffffff);
+ memcpy(copy + 10, data, data_len);
+ copy_len = 10 + data_len;
+ }
+
+ // Not thread safe
+ if (copy_len > 0) {
+ retval = mg_write(conn, copy, copy_len);
+ }
+ free(copy);
+
+ return retval;
}
static void handle_websocket_request(struct mg_connection *conn) {
- const char *version = mg_get_header(conn, "Sec-WebSocket-Version");
- if (version == NULL || strcmp(version, "13") != 0) {
- send_http_error(conn, 426, "Upgrade Required", "%s", "Upgrade Required");
- } else if (conn->ctx->callbacks.websocket_connect != NULL &&
- conn->ctx->callbacks.websocket_connect(conn) != 0) {
- // Callback has returned non-zero, do not proceed with handshake
- } else {
- send_websocket_handshake(conn);
- if (conn->ctx->callbacks.websocket_ready != NULL) {
- conn->ctx->callbacks.websocket_ready(conn);
- }
- read_websocket(conn);
- }
+ const char *version = mg_get_header(conn, "Sec-WebSocket-Version");
+ if (version == NULL || strcmp(version, "13") != 0) {
+ send_http_error(conn, 426, "Upgrade Required", "%s", "Upgrade Required");
+ } else if (conn->ctx->callbacks.websocket_connect != NULL &&
+ conn->ctx->callbacks.websocket_connect(conn) != 0) {
+ // Callback has returned non-zero, do not proceed with handshake
+ } else {
+ send_websocket_handshake(conn);
+ if (conn->ctx->callbacks.websocket_ready != NULL) {
+ conn->ctx->callbacks.websocket_ready(conn);
+ }
+ read_websocket(conn);
+ }
}
static int is_websocket_request(const struct mg_connection *conn) {
- const char *host, *upgrade, *connection, *version, *key;
+ const char *host, *upgrade, *connection, *version, *key;
- host = mg_get_header(conn, "Host");
- upgrade = mg_get_header(conn, "Upgrade");
- connection = mg_get_header(conn, "Connection");
- key = mg_get_header(conn, "Sec-WebSocket-Key");
- version = mg_get_header(conn, "Sec-WebSocket-Version");
+ host = mg_get_header(conn, "Host");
+ upgrade = mg_get_header(conn, "Upgrade");
+ connection = mg_get_header(conn, "Connection");
+ key = mg_get_header(conn, "Sec-WebSocket-Key");
+ version = mg_get_header(conn, "Sec-WebSocket-Version");
- return host != NULL && upgrade != NULL && connection != NULL &&
- key != NULL && version != NULL &&
- mg_strcasestr(upgrade, "websocket") != NULL &&
- mg_strcasestr(connection, "Upgrade") != NULL;
+ return host != NULL && upgrade != NULL && connection != NULL &&
+ key != NULL && version != NULL &&
+ mg_strcasestr(upgrade, "websocket") != NULL &&
+ mg_strcasestr(connection, "Upgrade") != NULL;
}
#endif // !USE_WEBSOCKET
static int isbyte(int n) {
- return n >= 0 && n <= 255;
+ return n >= 0 && n <= 255;
}
static int parse_net(const char *spec, uint32_t *net, uint32_t *mask) {
- int n, a, b, c, d, slash = 32, len = 0;
+ int n, a, b, c, d, slash = 32, len = 0;
- if ((sscanf(spec, "%d.%d.%d.%d/%d%n", &a, &b, &c, &d, &slash, &n) == 5 ||
- sscanf(spec, "%d.%d.%d.%d%n", &a, &b, &c, &d, &n) == 4) &&
- isbyte(a) && isbyte(b) && isbyte(c) && isbyte(d) &&
- slash >= 0 && slash < 33) {
- len = n;
- *net = ((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | d;
- *mask = slash ? 0xffffffffU << (32 - slash) : 0;
- }
+ if ((sscanf(spec, "%d.%d.%d.%d/%d%n", &a, &b, &c, &d, &slash, &n) == 5 ||
+ sscanf(spec, "%d.%d.%d.%d%n", &a, &b, &c, &d, &n) == 4) &&
+ isbyte(a) && isbyte(b) && isbyte(c) && isbyte(d) &&
+ slash >= 0 && slash < 33) {
+ len = n;
+ *net = ((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | d;
+ *mask = slash ? 0xffffffffU << (32 - slash) : 0;
+ }
- return len;
+ return len;
}
static int set_throttle(const char *spec, uint32_t remote_ip, const char *uri) {
- int throttle = 0;
- struct vec vec, val;
- uint32_t net, mask;
- char mult;
- double v;
-
- while ((spec = next_option(spec, &vec, &val)) != NULL) {
- mult = ',';
- if (sscanf(val.ptr, "%lf%c", &v, &mult) < 1 || v < 0 ||
- (lowercase(&mult) != 'k' && lowercase(&mult) != 'm' && mult != ',')) {
- continue;
- }
- v *= lowercase(&mult) == 'k' ? 1024 : lowercase(&mult) == 'm' ? 1048576 : 1;
- if (vec.len == 1 && vec.ptr[0] == '*') {
- throttle = (int) v;
- } else if (parse_net(vec.ptr, &net, &mask) > 0) {
- if ((remote_ip & mask) == net) {
- throttle = (int) v;
- }
- } else if (match_prefix(vec.ptr, vec.len, uri) > 0) {
- throttle = (int) v;
- }
- }
-
- return throttle;
+ int throttle = 0;
+ struct vec vec, val;
+ uint32_t net, mask;
+ char mult;
+ double v;
+
+ while ((spec = next_option(spec, &vec, &val)) != NULL) {
+ mult = ',';
+ if (sscanf(val.ptr, "%lf%c", &v, &mult) < 1 || v < 0 ||
+ (lowercase(&mult) != 'k' && lowercase(&mult) != 'm' && mult != ',')) {
+ continue;
+ }
+ v *= lowercase(&mult) == 'k' ? 1024 : lowercase(&mult) == 'm' ? 1048576 : 1;
+ if (vec.len == 1 && vec.ptr[0] == '*') {
+ throttle = (int) v;
+ } else if (parse_net(vec.ptr, &net, &mask) > 0) {
+ if ((remote_ip & mask) == net) {
+ throttle = (int) v;
+ }
+ } else if (match_prefix(vec.ptr, vec.len, uri) > 0) {
+ throttle = (int) v;
+ }
+ }
+
+ return throttle;
}
static uint32_t get_remote_ip(const struct mg_connection *conn) {
- return ntohl(* (uint32_t *) &conn->client.rsa.sin.sin_addr);
+ return ntohl(* (uint32_t *) &conn->client.rsa.sin.sin_addr);
}
#ifdef USE_LUA
@@ -4238,146 +4235,146 @@ static uint32_t get_remote_ip(const struct mg_connection *conn) {
#endif // USE_LUA
int mg_upload(struct mg_connection *conn, const char *destination_dir) {
- const char *content_type_header, *boundary_start;
- char buf[MG_BUF_LEN], path[PATH_MAX], fname[1024], boundary[100], *s;
- FILE *fp;
- int bl, n, i, j, headers_len, boundary_len, eof,
- len = 0, num_uploaded_files = 0;
-
- // Request looks like this:
- //
- // POST /upload HTTP/1.1
- // Host: 127.0.0.1:8080
- // Content-Length: 244894
- // Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryRVr
- //
- // ------WebKitFormBoundaryRVr
- // Content-Disposition: form-data; name="file"; filename="accum.png"
- // Content-Type: image/png
- //
- // <89>PNG
- // <PNG DATA>
- // ------WebKitFormBoundaryRVr
-
- // Extract boundary string from the Content-Type header
- if ((content_type_header = mg_get_header(conn, "Content-Type")) == NULL ||
- (boundary_start = mg_strcasestr(content_type_header,
- "boundary=")) == NULL ||
- (sscanf(boundary_start, "boundary=\"%99[^\"]\"", boundary) == 0 &&
- sscanf(boundary_start, "boundary=%99s", boundary) == 0) ||
- boundary[0] == '\0') {
- return num_uploaded_files;
- }
-
- boundary_len = strlen(boundary);
- bl = boundary_len + 4; // \r\n--<boundary>
- for (;;) {
- // Pull in headers
- assert(len >= 0 && len <= (int) sizeof(buf));
- while ((n = mg_read(conn, buf + len, sizeof(buf) - len)) > 0) {
- len += n;
- }
- if ((headers_len = get_request_len(buf, len)) <= 0) {
- break;
- }
-
- // Fetch file name.
- fname[0] = '\0';
- for (i = j = 0; i < headers_len; i++) {
- if (buf[i] == '\r' && buf[i + 1] == '\n') {
- buf[i] = buf[i + 1] = '\0';
- // TODO(lsm): don't expect filename to be the 3rd field,
- // parse the header properly instead.
- sscanf(&buf[j], "Content-Disposition: %*s %*s filename=\"%1023[^\"]",
- fname);
- j = i + 2;
- }
- }
-
- // Give up if the headers are not what we expect
- if (fname[0] == '\0') {
- break;
- }
-
- // Move data to the beginning of the buffer
- assert(len >= headers_len);
- memmove(buf, &buf[headers_len], len - headers_len);
- len -= headers_len;
-
- // We open the file with exclusive lock held. This guarantee us
- // there is no other thread can save into the same file simultaneously.
- fp = NULL;
- // Construct destination file name. Do not allow paths to have slashes.
- if ((s = strrchr(fname, '/')) == NULL &&
+ const char *content_type_header, *boundary_start;
+ char buf[MG_BUF_LEN], path[PATH_MAX], fname[1024], boundary[100], *s;
+ FILE *fp;
+ int bl, n, i, j, headers_len, boundary_len, eof,
+ len = 0, num_uploaded_files = 0;
+
+ // Request looks like this:
+ //
+ // POST /upload HTTP/1.1
+ // Host: 127.0.0.1:8080
+ // Content-Length: 244894
+ // Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryRVr
+ //
+ // ------WebKitFormBoundaryRVr
+ // Content-Disposition: form-data; name="file"; filename="accum.png"
+ // Content-Type: image/png
+ //
+ // <89>PNG
+ // <PNG DATA>
+ // ------WebKitFormBoundaryRVr
+
+ // Extract boundary string from the Content-Type header
+ if ((content_type_header = mg_get_header(conn, "Content-Type")) == NULL ||
+ (boundary_start = mg_strcasestr(content_type_header,
+ "boundary=")) == NULL ||
+ (sscanf(boundary_start, "boundary=\"%99[^\"]\"", boundary) == 0 &&
+ sscanf(boundary_start, "boundary=%99s", boundary) == 0) ||
+ boundary[0] == '\0') {
+ return num_uploaded_files;
+ }
+
+ boundary_len = strlen(boundary);
+ bl = boundary_len + 4; // \r\n--<boundary>
+ for (;;) {
+ // Pull in headers
+ assert(len >= 0 && len <= (int) sizeof(buf));
+ while ((n = mg_read(conn, buf + len, sizeof(buf) - len)) > 0) {
+ len += n;
+ }
+ if ((headers_len = get_request_len(buf, len)) <= 0) {
+ break;
+ }
+
+ // Fetch file name.
+ fname[0] = '\0';
+ for (i = j = 0; i < headers_len; i++) {
+ if (buf[i] == '\r' && buf[i + 1] == '\n') {
+ buf[i] = buf[i + 1] = '\0';
+ // TODO(lsm): don't expect filename to be the 3rd field,
+ // parse the header properly instead.
+ sscanf(&buf[j], "Content-Disposition: %*s %*s filename=\"%1023[^\"]",
+ fname);
+ j = i + 2;
+ }
+ }
+
+ // Give up if the headers are not what we expect
+ if (fname[0] == '\0') {
+ break;
+ }
+
+ // Move data to the beginning of the buffer
+ assert(len >= headers_len);
+ memmove(buf, &buf[headers_len], len - headers_len);
+ len -= headers_len;
+
+ // We open the file with exclusive lock held. This guarantee us
+ // there is no other thread can save into the same file simultaneously.
+ fp = NULL;
+ // Construct destination file name. Do not allow paths to have slashes.
+ if ((s = strrchr(fname, '/')) == NULL &&
(s = strrchr(fname, '\\')) == NULL) {
- s = fname;
- }
-
- // Open file in binary mode. TODO: set an exclusive lock.
- snprintf(path, sizeof(path), "%s/%s", destination_dir, s);
- if ((fp = fopen(path, "wb")) == NULL) {
- break;
- }
-
- // Read POST data, write into file until boundary is found.
- eof = n = 0;
- do {
- len += n;
- for (i = 0; i < len - bl; i++) {
- if (!memcmp(&buf[i], "\r\n--", 4) &&
- !memcmp(&buf[i + 4], boundary, boundary_len)) {
- // Found boundary, that's the end of file data.
- fwrite(buf, 1, i, fp);
- eof = 1;
- memmove(buf, &buf[i + bl], len - (i + bl));
- len -= i + bl;
- break;
- }
- }
- if (!eof && len > bl) {
- fwrite(buf, 1, len - bl, fp);
- memmove(buf, &buf[len - bl], bl);
- len = bl;
- }
- } while (!eof && (n = mg_read(conn, buf + len, sizeof(buf) - len)) > 0);
- fclose(fp);
- if (eof) {
- num_uploaded_files++;
- if (conn->ctx->callbacks.upload != NULL) {
- conn->ctx->callbacks.upload(conn, path);
- }
- }
- }
-
- return num_uploaded_files;
+ s = fname;
+ }
+
+ // Open file in binary mode. TODO: set an exclusive lock.
+ snprintf(path, sizeof(path), "%s/%s", destination_dir, s);
+ if ((fp = fopen(path, "wb")) == NULL) {
+ break;
+ }
+
+ // Read POST data, write into file until boundary is found.
+ eof = n = 0;
+ do {
+ len += n;
+ for (i = 0; i < len - bl; i++) {
+ if (!memcmp(&buf[i], "\r\n--", 4) &&
+ !memcmp(&buf[i + 4], boundary, boundary_len)) {
+ // Found boundary, that's the end of file data.
+ fwrite(buf, 1, i, fp);
+ eof = 1;
+ memmove(buf, &buf[i + bl], len - (i + bl));
+ len -= i + bl;
+ break;
+ }
+ }
+ if (!eof && len > bl) {
+ fwrite(buf, 1, len - bl, fp);
+ memmove(buf, &buf[len - bl], bl);
+ len = bl;
+ }
+ } while (!eof && (n = mg_read(conn, buf + len, sizeof(buf) - len)) > 0);
+ fclose(fp);
+ if (eof) {
+ num_uploaded_files++;
+ if (conn->ctx->callbacks.upload != NULL) {
+ conn->ctx->callbacks.upload(conn, path);
+ }
+ }
+ }
+
+ return num_uploaded_files;
}
static int is_put_or_delete_request(const struct mg_connection *conn) {
- const char *s = conn->request_info.request_method;
- return s != NULL && (!strcmp(s, "PUT") || !strcmp(s, "DELETE") || !strcmp(s, "MKCOL"));
+ const char *s = conn->request_info.request_method;
+ return s != NULL && (!strcmp(s, "PUT") || !strcmp(s, "DELETE") || !strcmp(s, "MKCOL"));
}
static int get_first_ssl_listener_index(const struct mg_context *ctx) {
- int i, index = -1;
- for (i = 0; index == -1 && i < ctx->num_listening_sockets; i++) {
- index = ctx->listening_sockets[i].is_ssl ? i : -1;
- }
- return index;
+ int i, index = -1;
+ for (i = 0; index == -1 && i < ctx->num_listening_sockets; i++) {
+ index = ctx->listening_sockets[i].is_ssl ? i : -1;
+ }
+ return index;
}
static void redirect_to_https_port(struct mg_connection *conn, int ssl_index) {
- char host[1025];
- const char *host_header;
+ char host[1025];
+ const char *host_header;
- if ((host_header = mg_get_header(conn, "Host")) == NULL ||
- sscanf(host_header, "%1024[^:]", host) == 0) {
- // Cannot get host from the Host: header. Fallback to our IP address.
- sockaddr_to_string(host, sizeof(host), &conn->client.lsa);
- }
+ if ((host_header = mg_get_header(conn, "Host")) == NULL ||
+ sscanf(host_header, "%1024[^:]", host) == 0) {
+ // Cannot get host from the Host: header. Fallback to our IP address.
+ sockaddr_to_string(host, sizeof(host), &conn->client.lsa);
+ }
- mg_printf(conn, "HTTP/1.1 302 Found\r\nLocation: https://%s:%d%s\r\n\r\n",
- host, (int) ntohs(conn->ctx->listening_sockets[ssl_index].
- lsa.sin.sin_port), conn->request_info.uri);
+ mg_printf(conn, "HTTP/1.1 302 Found\r\nLocation: https://%s:%d%s\r\n\r\n",
+ host, (int) ntohs(conn->ctx->listening_sockets[ssl_index].
+ lsa.sin.sin_port), conn->request_info.uri);
}
// This is the heart of the Mongoose's logic.
@@ -4385,303 +4382,303 @@ static void redirect_to_https_port(struct mg_connection *conn, int ssl_index) {
// and Mongoose must decide what action to take: serve a file, or
// a directory, or call embedded function, etcetera.
static void handle_request(struct mg_connection *conn) {
- struct mg_request_info *ri = &conn->request_info;
- char path[PATH_MAX];
- int uri_len, ssl_index;
- struct file file = STRUCT_FILE_INITIALIZER;
-
- if ((conn->request_info.query_string = strchr(ri->uri, '?')) != NULL) {
- * ((char *) conn->request_info.query_string++) = '\0';
- }
- uri_len = (int) strlen(ri->uri);
- mg_url_decode(ri->uri, uri_len, (char *) ri->uri, uri_len + 1, 0);
- remove_double_dots_and_double_slashes((char *) ri->uri);
- convert_uri_to_file_name(conn, path, sizeof(path), &file);
- conn->throttle = set_throttle(conn->ctx->config[THROTTLE],
- get_remote_ip(conn), ri->uri);
-
- DEBUG_TRACE(("%s", ri->uri));
- // Perform redirect and auth checks before calling begin_request() handler.
- // Otherwise, begin_request() would need to perform auth checks and redirects.
- if (!conn->client.is_ssl && conn->client.ssl_redir &&
- (ssl_index = get_first_ssl_listener_index(conn->ctx)) > -1) {
- redirect_to_https_port(conn, ssl_index);
- } else if (!is_put_or_delete_request(conn) &&
- !check_authorization(conn, path)) {
- send_authorization_request(conn);
- } else if (conn->ctx->callbacks.begin_request != NULL &&
- conn->ctx->callbacks.begin_request(conn)) {
- // Do nothing, callback has served the request
+ struct mg_request_info *ri = &conn->request_info;
+ char path[PATH_MAX];
+ int uri_len, ssl_index;
+ struct file file = STRUCT_FILE_INITIALIZER;
+
+ if ((conn->request_info.query_string = strchr(ri->uri, '?')) != NULL) {
+ * ((char *) conn->request_info.query_string++) = '\0';
+ }
+ uri_len = (int) strlen(ri->uri);
+ mg_url_decode(ri->uri, uri_len, (char *) ri->uri, uri_len + 1, 0);
+ remove_double_dots_and_double_slashes((char *) ri->uri);
+ convert_uri_to_file_name(conn, path, sizeof(path), &file);
+ conn->throttle = set_throttle(conn->ctx->config[THROTTLE],
+ get_remote_ip(conn), ri->uri);
+
+ DEBUG_TRACE(("%s", ri->uri));
+ // Perform redirect and auth checks before calling begin_request() handler.
+ // Otherwise, begin_request() would need to perform auth checks and redirects.
+ if (!conn->client.is_ssl && conn->client.ssl_redir &&
+ (ssl_index = get_first_ssl_listener_index(conn->ctx)) > -1) {
+ redirect_to_https_port(conn, ssl_index);
+ } else if (!is_put_or_delete_request(conn) &&
+ !check_authorization(conn, path)) {
+ send_authorization_request(conn);
+ } else if (conn->ctx->callbacks.begin_request != NULL &&
+ conn->ctx->callbacks.begin_request(conn)) {
+ // Do nothing, callback has served the request
#if defined(USE_WEBSOCKET)
- } else if (is_websocket_request(conn)) {
- handle_websocket_request(conn);
+ } else if (is_websocket_request(conn)) {
+ handle_websocket_request(conn);
#endif
- } else if (!strcmp(ri->request_method, "OPTIONS")) {
- send_options(conn);
- } else if (conn->ctx->config[DOCUMENT_ROOT] == NULL) {
- send_http_error(conn, 404, "Not Found", "Not Found");
- } else if (is_put_or_delete_request(conn) &&
- (is_authorized_for_put(conn) != 1)) {
- send_authorization_request(conn);
- } else if (!strcmp(ri->request_method, "PUT")) {
- put_file(conn, path);
- } else if (!strcmp(ri->request_method, "MKCOL")) {
- mkcol(conn, path);
- } else if (!strcmp(ri->request_method, "DELETE")) {
- struct de de;
- memset(&de.file, 0, sizeof(de.file));
- if(!mg_stat(conn, path, &de.file)) {
- send_http_error(conn, 404, "Not Found", "%s", "File not found");
- } else {
- if(de.file.modification_time) {
- if(de.file.is_directory) {
- remove_directory(conn, path);
- send_http_error(conn, 204, "No Content", "%s", "");
- } else if (mg_remove(path) == 0) {
- send_http_error(conn, 204, "No Content", "%s", "");
- } else {
- send_http_error(conn, 423, "Locked", "remove(%s): %s", path,
- strerror(ERRNO));
- }
- }
- else {
- send_http_error(conn, 500, http_500_error, "remove(%s): %s", path,
- strerror(ERRNO));
- }
- }
- } else if ((file.membuf == NULL && file.modification_time == (time_t) 0) ||
- must_hide_file(conn, path)) {
- send_http_error(conn, 404, "Not Found", "%s", "File not found");
- } else if (file.is_directory && ri->uri[uri_len - 1] != '/') {
- mg_printf(conn, "HTTP/1.1 301 Moved Permanently\r\n"
- "Location: %s/\r\n\r\n", ri->uri);
- } else if (!strcmp(ri->request_method, "PROPFIND")) {
- handle_propfind(conn, path, &file);
- } else if (file.is_directory &&
- !substitute_index_file(conn, path, sizeof(path), &file)) {
- if (!mg_strcasecmp(conn->ctx->config[ENABLE_DIRECTORY_LISTING], "yes")) {
- handle_directory_request(conn, path);
- } else {
- send_http_error(conn, 403, "Directory Listing Denied",
- "Directory listing denied");
- }
+ } else if (!strcmp(ri->request_method, "OPTIONS")) {
+ send_options(conn);
+ } else if (conn->ctx->config[DOCUMENT_ROOT] == NULL) {
+ send_http_error(conn, 404, "Not Found", "Not Found");
+ } else if (is_put_or_delete_request(conn) &&
+ (is_authorized_for_put(conn) != 1)) {
+ send_authorization_request(conn);
+ } else if (!strcmp(ri->request_method, "PUT")) {
+ put_file(conn, path);
+ } else if (!strcmp(ri->request_method, "MKCOL")) {
+ mkcol(conn, path);
+ } else if (!strcmp(ri->request_method, "DELETE")) {
+ struct de de;
+ memset(&de.file, 0, sizeof(de.file));
+ if(!mg_stat(conn, path, &de.file)) {
+ send_http_error(conn, 404, "Not Found", "%s", "File not found");
+ } else {
+ if(de.file.modification_time) {
+ if(de.file.is_directory) {
+ remove_directory(conn, path);
+ send_http_error(conn, 204, "No Content", "%s", "");
+ } else if (mg_remove(path) == 0) {
+ send_http_error(conn, 204, "No Content", "%s", "");
+ } else {
+ send_http_error(conn, 423, "Locked", "remove(%s): %s", path,
+ strerror(ERRNO));
+ }
+ }
+ else {
+ send_http_error(conn, 500, http_500_error, "remove(%s): %s", path,
+ strerror(ERRNO));
+ }
+ }
+ } else if ((file.membuf == NULL && file.modification_time == (time_t) 0) ||
+ must_hide_file(conn, path)) {
+ send_http_error(conn, 404, "Not Found", "%s", "File not found");
+ } else if (file.is_directory && ri->uri[uri_len - 1] != '/') {
+ mg_printf(conn, "HTTP/1.1 301 Moved Permanently\r\n"
+ "Location: %s/\r\n\r\n", ri->uri);
+ } else if (!strcmp(ri->request_method, "PROPFIND")) {
+ handle_propfind(conn, path, &file);
+ } else if (file.is_directory &&
+ !substitute_index_file(conn, path, sizeof(path), &file)) {
+ if (!mg_strcasecmp(conn->ctx->config[ENABLE_DIRECTORY_LISTING], "yes")) {
+ handle_directory_request(conn, path);
+ } else {
+ send_http_error(conn, 403, "Directory Listing Denied",
+ "Directory listing denied");
+ }
#ifdef USE_LUA
- } else if (match_prefix("**.lp$", 6, path) > 0) {
- handle_lsp_request(conn, path, &file, NULL);
+ } else if (match_prefix("**.lp$", 6, path) > 0) {
+ handle_lsp_request(conn, path, &file, NULL);
#endif
#if !defined(NO_CGI)
- } else if (match_prefix(conn->ctx->config[CGI_EXTENSIONS],
- strlen(conn->ctx->config[CGI_EXTENSIONS]),
- path) > 0) {
- if (strcmp(ri->request_method, "POST") &&
- strcmp(ri->request_method, "HEAD") &&
- strcmp(ri->request_method, "GET")) {
- send_http_error(conn, 501, "Not Implemented",
- "Method %s is not implemented", ri->request_method);
- } else {
- handle_cgi_request(conn, path);
- }
+ } else if (match_prefix(conn->ctx->config[CGI_EXTENSIONS],
+ strlen(conn->ctx->config[CGI_EXTENSIONS]),
+ path) > 0) {
+ if (strcmp(ri->request_method, "POST") &&
+ strcmp(ri->request_method, "HEAD") &&
+ strcmp(ri->request_method, "GET")) {
+ send_http_error(conn, 501, "Not Implemented",
+ "Method %s is not implemented", ri->request_method);
+ } else {
+ handle_cgi_request(conn, path);
+ }
#endif // !NO_CGI
- } else if (match_prefix(conn->ctx->config[SSI_EXTENSIONS],
- strlen(conn->ctx->config[SSI_EXTENSIONS]),
- path) > 0) {
- handle_ssi_file_request(conn, path);
- } else if (is_not_modified(conn, &file)) {
- send_http_error(conn, 304, "Not Modified", "%s", "");
- } else {
- handle_file_request(conn, path, &file);
- }
+ } else if (match_prefix(conn->ctx->config[SSI_EXTENSIONS],
+ strlen(conn->ctx->config[SSI_EXTENSIONS]),
+ path) > 0) {
+ handle_ssi_file_request(conn, path);
+ } else if (is_not_modified(conn, &file)) {
+ send_http_error(conn, 304, "Not Modified", "%s", "");
+ } else {
+ handle_file_request(conn, path, &file);
+ }
}
static void close_all_listening_sockets(struct mg_context *ctx) {
- int i;
- for (i = 0; i < ctx->num_listening_sockets; i++) {
- closesocket(ctx->listening_sockets[i].sock);
- }
- free(ctx->listening_sockets);
+ int i;
+ for (i = 0; i < ctx->num_listening_sockets; i++) {
+ closesocket(ctx->listening_sockets[i].sock);
+ }
+ free(ctx->listening_sockets);
}
// Valid listening port specification is: [ip_address:]port[s]
// Examples: 80, 443s, 127.0.0.1:3128, 1.2.3.4:8080s
// TODO(lsm): add parsing of the IPv6 address
static int parse_port_string(const struct vec *vec, struct socket *so) {
- int a, b, c, d, port, len;
-
- // MacOS needs that. If we do not zero it, subsequent bind() will fail.
- // Also, all-zeroes in the socket address means binding to all addresses
- // for both IPv4 and IPv6 (INADDR_ANY and IN6ADDR_ANY_INIT).
- memset(so, 0, sizeof(*so));
-
- if (sscanf(vec->ptr, "%d.%d.%d.%d:%d%n", &a, &b, &c, &d, &port, &len) == 5) {
- // Bind to a specific IPv4 address
- so->lsa.sin.sin_addr.s_addr = htonl((a << 24) | (b << 16) | (c << 8) | d);
- } else if (sscanf(vec->ptr, "%d%n", &port, &len) != 1 ||
- len <= 0 ||
- len > (int) vec->len ||
- port < 1 ||
- port > 65535 ||
- (vec->ptr[len] && vec->ptr[len] != 's' &&
- vec->ptr[len] != 'r' && vec->ptr[len] != ',')) {
- return 0;
- }
-
- so->is_ssl = vec->ptr[len] == 's';
- so->ssl_redir = vec->ptr[len] == 'r';
+ int a, b, c, d, port, len;
+
+ // MacOS needs that. If we do not zero it, subsequent bind() will fail.
+ // Also, all-zeroes in the socket address means binding to all addresses
+ // for both IPv4 and IPv6 (INADDR_ANY and IN6ADDR_ANY_INIT).
+ memset(so, 0, sizeof(*so));
+
+ if (sscanf(vec->ptr, "%d.%d.%d.%d:%d%n", &a, &b, &c, &d, &port, &len) == 5) {
+ // Bind to a specific IPv4 address
+ so->lsa.sin.sin_addr.s_addr = htonl((a << 24) | (b << 16) | (c << 8) | d);
+ } else if (sscanf(vec->ptr, "%d%n", &port, &len) != 1 ||
+ len <= 0 ||
+ len > (int) vec->len ||
+ port < 1 ||
+ port > 65535 ||
+ (vec->ptr[len] && vec->ptr[len] != 's' &&
+ vec->ptr[len] != 'r' && vec->ptr[len] != ',')) {
+ return 0;
+ }
+
+ so->is_ssl = vec->ptr[len] == 's';
+ so->ssl_redir = vec->ptr[len] == 'r';
#if defined(USE_IPV6)
- so->lsa.sin6.sin6_family = AF_INET6;
- so->lsa.sin6.sin6_port = htons((uint16_t) port);
+ so->lsa.sin6.sin6_family = AF_INET6;
+ so->lsa.sin6.sin6_port = htons((uint16_t) port);
#else
- so->lsa.sin.sin_family = AF_INET;
- so->lsa.sin.sin_port = htons((uint16_t) port);
+ so->lsa.sin.sin_family = AF_INET;
+ so->lsa.sin.sin_port = htons((uint16_t) port);
#endif
- return 1;
+ return 1;
}
static int set_ports_option(struct mg_context *ctx) {
- const char *list = ctx->config[LISTENING_PORTS];
- int on = 1, success = 1;
+ const char *list = ctx->config[LISTENING_PORTS];
+ int on = 1, success = 1;
#if defined(USE_IPV6)
- int off = 0;
+ int off = 0;
#endif
- struct vec vec;
- struct socket so, *ptr;
-
- while (success && (list = next_option(list, &vec, NULL)) != NULL) {
- if (!parse_port_string(&vec, &so)) {
- cry(fc(ctx), "%s: %.*s: invalid port spec. Expecting list of: %s",
- __func__, (int) vec.len, vec.ptr, "[IP_ADDRESS:]PORT[s|p]");
- success = 0;
- } else if (so.is_ssl && ctx->ssl_ctx == NULL) {
- cry(fc(ctx), "Cannot add SSL socket, is -ssl_certificate option set?");
- success = 0;
- } else if ((so.sock = socket(so.lsa.sa.sa_family, SOCK_STREAM, 6)) ==
- INVALID_SOCKET ||
- // On Windows, SO_REUSEADDR is recommended only for
- // broadcast UDP sockets
- setsockopt(so.sock, SOL_SOCKET, SO_REUSEADDR,
- (SETSOCKOPT_CAST) &on, sizeof(on)) != 0 ||
+ struct vec vec;
+ struct socket so, *ptr;
+
+ while (success && (list = next_option(list, &vec, NULL)) != NULL) {
+ if (!parse_port_string(&vec, &so)) {
+ cry(fc(ctx), "%s: %.*s: invalid port spec. Expecting list of: %s",
+ __func__, (int) vec.len, vec.ptr, "[IP_ADDRESS:]PORT[s|p]");
+ success = 0;
+ } else if (so.is_ssl && ctx->ssl_ctx == NULL) {
+ cry(fc(ctx), "Cannot add SSL socket, is -ssl_certificate option set?");
+ success = 0;
+ } else if ((so.sock = socket(so.lsa.sa.sa_family, SOCK_STREAM, 6)) ==
+ INVALID_SOCKET ||
+ // On Windows, SO_REUSEADDR is recommended only for
+ // broadcast UDP sockets
+ setsockopt(so.sock, SOL_SOCKET, SO_REUSEADDR,
+ (SETSOCKOPT_CAST) &on, sizeof(on)) != 0 ||
#if defined(USE_IPV6)
- setsockopt(so.sock, IPPROTO_IPV6, IPV6_V6ONLY, (SETSOCKOPT_CAST) &off,
- sizeof(off)) != 0 ||
+ setsockopt(so.sock, IPPROTO_IPV6, IPV6_V6ONLY, (SETSOCKOPT_CAST) &off,
+ sizeof(off)) != 0 ||
#endif
- bind(so.sock, &so.lsa.sa, sizeof(so.lsa)) != 0 ||
- listen(so.sock, SOMAXCONN) != 0) {
- cry(fc(ctx), "%s: cannot bind to %.*s: %s", __func__,
- (int) vec.len, vec.ptr, strerror(ERRNO));
- closesocket(so.sock);
- success = 0;
- } else if ((ptr = (struct socket*)realloc(ctx->listening_sockets,
- (ctx->num_listening_sockets + 1) *
- sizeof(ctx->listening_sockets[0]))) == NULL) {
- closesocket(so.sock);
- success = 0;
- } else {
- set_close_on_exec(so.sock);
- ctx->listening_sockets = ptr;
- ctx->listening_sockets[ctx->num_listening_sockets] = so;
- ctx->num_listening_sockets++;
- }
- }
-
- if (!success) {
- close_all_listening_sockets(ctx);
- }
-
- return success;
+ bind(so.sock, &so.lsa.sa, sizeof(so.lsa)) != 0 ||
+ listen(so.sock, SOMAXCONN) != 0) {
+ cry(fc(ctx), "%s: cannot bind to %.*s: %s", __func__,
+ (int) vec.len, vec.ptr, strerror(ERRNO));
+ closesocket(so.sock);
+ success = 0;
+ } else if ((ptr = (struct socket*)realloc(ctx->listening_sockets,
+ (ctx->num_listening_sockets + 1) *
+ sizeof(ctx->listening_sockets[0]))) == NULL) {
+ closesocket(so.sock);
+ success = 0;
+ } else {
+ set_close_on_exec(so.sock);
+ ctx->listening_sockets = ptr;
+ ctx->listening_sockets[ctx->num_listening_sockets] = so;
+ ctx->num_listening_sockets++;
+ }
+ }
+
+ if (!success) {
+ close_all_listening_sockets(ctx);
+ }
+
+ return success;
}
static void log_header(const struct mg_connection *conn, const char *header,
- FILE *fp) {
- const char *header_value;
+ FILE *fp) {
+ const char *header_value;
- if ((header_value = mg_get_header(conn, header)) == NULL) {
- (void) fprintf(fp, "%s", " -");
- } else {
- (void) fprintf(fp, " \"%s\"", header_value);
- }
+ if ((header_value = mg_get_header(conn, header)) == NULL) {
+ (void) fprintf(fp, "%s", " -");
+ } else {
+ (void) fprintf(fp, " \"%s\"", header_value);
+ }
}
static void log_access(const struct mg_connection *conn) {
- const struct mg_request_info *ri;
- FILE *fp;
- char date[64], src_addr[IP_ADDR_STR_LEN];
+ const struct mg_request_info *ri;
+ FILE *fp;
+ char date[64], src_addr[IP_ADDR_STR_LEN];
- fp = conn->ctx->config[ACCESS_LOG_FILE] == NULL ? NULL :
- fopen(conn->ctx->config[ACCESS_LOG_FILE], "a+");
+ fp = conn->ctx->config[ACCESS_LOG_FILE] == NULL ? NULL :
+ fopen(conn->ctx->config[ACCESS_LOG_FILE], "a+");
- if (fp == NULL)
- return;
+ if (fp == NULL)
+ return;
- strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S %z",
- localtime(&conn->birth_time));
+ strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S %z",
+ localtime(&conn->birth_time));
- ri = &conn->request_info;
- flockfile(fp);
+ ri = &conn->request_info;
+ flockfile(fp);
- sockaddr_to_string(src_addr, sizeof(src_addr), &conn->client.rsa);
- fprintf(fp, "%s - %s [%s] \"%s %s HTTP/%s\" %d %" INT64_FMT,
- src_addr, ri->remote_user == NULL ? "-" : ri->remote_user, date,
- ri->request_method ? ri->request_method : "-",
- ri->uri ? ri->uri : "-", ri->http_version,
- conn->status_code, conn->num_bytes_sent);
- log_header(conn, "Referer", fp);
- log_header(conn, "User-Agent", fp);
- fputc('\n', fp);
- fflush(fp);
+ sockaddr_to_string(src_addr, sizeof(src_addr), &conn->client.rsa);
+ fprintf(fp, "%s - %s [%s] \"%s %s HTTP/%s\" %d %" INT64_FMT,
+ src_addr, ri->remote_user == NULL ? "-" : ri->remote_user, date,
+ ri->request_method ? ri->request_method : "-",
+ ri->uri ? ri->uri : "-", ri->http_version,
+ conn->status_code, conn->num_bytes_sent);
+ log_header(conn, "Referer", fp);
+ log_header(conn, "User-Agent", fp);
+ fputc('\n', fp);
+ fflush(fp);
- funlockfile(fp);
- fclose(fp);
+ funlockfile(fp);
+ fclose(fp);
}
// Verify given socket address against the ACL.
// Return -1 if ACL is malformed, 0 if address is disallowed, 1 if allowed.
static int check_acl(struct mg_context *ctx, uint32_t remote_ip) {
- int allowed, flag;
- uint32_t net, mask;
- struct vec vec;
- const char *list = ctx->config[ACCESS_CONTROL_LIST];
+ int allowed, flag;
+ uint32_t net, mask;
+ struct vec vec;
+ const char *list = ctx->config[ACCESS_CONTROL_LIST];
- // If any ACL is set, deny by default
- allowed = list == NULL ? '+' : '-';
+ // If any ACL is set, deny by default
+ allowed = list == NULL ? '+' : '-';
- while ((list = next_option(list, &vec, NULL)) != NULL) {
- flag = vec.ptr[0];
- if ((flag != '+' && flag != '-') ||
- parse_net(&vec.ptr[1], &net, &mask) == 0) {
- cry(fc(ctx), "%s: subnet must be [+|-]x.x.x.x[/x]", __func__);
- return -1;
- }
+ while ((list = next_option(list, &vec, NULL)) != NULL) {
+ flag = vec.ptr[0];
+ if ((flag != '+' && flag != '-') ||
+ parse_net(&vec.ptr[1], &net, &mask) == 0) {
+ cry(fc(ctx), "%s: subnet must be [+|-]x.x.x.x[/x]", __func__);
+ return -1;
+ }
- if (net == (remote_ip & mask)) {
- allowed = flag;
- }
- }
+ if (net == (remote_ip & mask)) {
+ allowed = flag;
+ }
+ }
- return allowed == '+';
+ return allowed == '+';
}
#if !defined(_WIN32)
static int set_uid_option(struct mg_context *ctx) {
- struct passwd *pw;
- const char *uid = ctx->config[RUN_AS_USER];
- int success = 0;
-
- if (uid == NULL) {
- success = 1;
- } else {
- if ((pw = getpwnam(uid)) == NULL) {
- cry(fc(ctx), "%s: unknown user [%s]", __func__, uid);
- } else if (setgid(pw->pw_gid) == -1) {
- cry(fc(ctx), "%s: setgid(%s): %s", __func__, uid, strerror(errno));
- } else if (setuid(pw->pw_uid) == -1) {
- cry(fc(ctx), "%s: setuid(%s): %s", __func__, uid, strerror(errno));
- } else {
- success = 1;
- }
- }
-
- return success;
+ struct passwd *pw;
+ const char *uid = ctx->config[RUN_AS_USER];
+ int success = 0;
+
+ if (uid == NULL) {
+ success = 1;
+ } else {
+ if ((pw = getpwnam(uid)) == NULL) {
+ cry(fc(ctx), "%s: unknown user [%s]", __func__, uid);
+ } else if (setgid(pw->pw_gid) == -1) {
+ cry(fc(ctx), "%s: setgid(%s): %s", __func__, uid, strerror(errno));
+ } else if (setuid(pw->pw_uid) == -1) {
+ cry(fc(ctx), "%s: setuid(%s): %s", __func__, uid, strerror(errno));
+ } else {
+ success = 1;
+ }
+ }
+
+ return success;
}
#endif // !_WIN32
@@ -4689,714 +4686,714 @@ static int set_uid_option(struct mg_context *ctx) {
static pthread_mutex_t *ssl_mutexes;
static int sslize(struct mg_connection *conn, SSL_CTX *s, int (*func)(SSL *)) {
- return (conn->ssl = SSL_new(s)) != NULL &&
- SSL_set_fd(conn->ssl, conn->client.sock) == 1 &&
- func(conn->ssl) == 1;
+ return (conn->ssl = SSL_new(s)) != NULL &&
+ SSL_set_fd(conn->ssl, conn->client.sock) == 1 &&
+ func(conn->ssl) == 1;
}
// Return OpenSSL error message
static const char *ssl_error(void) {
- unsigned long err;
- err = ERR_get_error();
- return err == 0 ? "" : ERR_error_string(err, NULL);
+ unsigned long err;
+ err = ERR_get_error();
+ return err == 0 ? "" : ERR_error_string(err, NULL);
}
static void ssl_locking_callback(int mode, int mutex_num, const char *file,
- int line) {
- (void) line;
- (void) file;
+ int line) {
+ (void) line;
+ (void) file;
- if (mode & 1) { // 1 is CRYPTO_LOCK
- (void) pthread_mutex_lock(&ssl_mutexes[mutex_num]);
- } else {
- (void) pthread_mutex_unlock(&ssl_mutexes[mutex_num]);
- }
+ if (mode & 1) { // 1 is CRYPTO_LOCK
+ (void) pthread_mutex_lock(&ssl_mutexes[mutex_num]);
+ } else {
+ (void) pthread_mutex_unlock(&ssl_mutexes[mutex_num]);
+ }
}
static unsigned long ssl_id_callback(void) {
- return (unsigned long) pthread_self();
+ return (unsigned long) pthread_self();
}
#if !defined(NO_SSL_DL)
static int load_dll(struct mg_context *ctx, const char *dll_name,
- struct ssl_func *sw) {
- union {void *p; void (*fp)(void);} u;
- void *dll_handle;
- struct ssl_func *fp;
+ struct ssl_func *sw) {
+ union {void *p; void (*fp)(void);} u;
+ void *dll_handle;
+ struct ssl_func *fp;
- if ((dll_handle = dlopen(dll_name, RTLD_LAZY)) == NULL) {
- cry(fc(ctx), "%s: cannot load %s", __func__, dll_name);
- return 0;
- }
+ if ((dll_handle = dlopen(dll_name, RTLD_LAZY)) == NULL) {
+ cry(fc(ctx), "%s: cannot load %s", __func__, dll_name);
+ return 0;
+ }
- for (fp = sw; fp->name != NULL; fp++) {
+ for (fp = sw; fp->name != NULL; fp++) {
#ifdef _WIN32
- // GetProcAddress() returns pointer to function
- u.fp = (void (*)(void)) dlsym(dll_handle, fp->name);
+ // GetProcAddress() returns pointer to function
+ u.fp = (void (*)(void)) dlsym(dll_handle, fp->name);
#else
- // dlsym() on UNIX returns void *. ISO C forbids casts of data pointers to
- // function pointers. We need to use a union to make a cast.
- u.p = dlsym(dll_handle, fp->name);
+ // dlsym() on UNIX returns void *. ISO C forbids casts of data pointers to
+ // function pointers. We need to use a union to make a cast.
+ u.p = dlsym(dll_handle, fp->name);
#endif // _WIN32
- if (u.fp == NULL) {
- cry(fc(ctx), "%s: %s: cannot find %s", __func__, dll_name, fp->name);
- return 0;
- } else {
- fp->ptr = u.fp;
- }
- }
+ if (u.fp == NULL) {
+ cry(fc(ctx), "%s: %s: cannot find %s", __func__, dll_name, fp->name);
+ return 0;
+ } else {
+ fp->ptr = u.fp;
+ }
+ }
- return 1;
+ return 1;
}
#endif // NO_SSL_DL
// Dynamically load SSL library. Set up ctx->ssl_ctx pointer.
static int set_ssl_option(struct mg_context *ctx) {
- int i, size;
- const char *pem;
+ int i, size;
+ const char *pem;
- // If PEM file is not specified, skip SSL initialization.
- if ((pem = ctx->config[SSL_CERTIFICATE]) == NULL) {
- return 1;
- }
+ // If PEM file is not specified, skip SSL initialization.
+ if ((pem = ctx->config[SSL_CERTIFICATE]) == NULL) {
+ return 1;
+ }
#if !defined(NO_SSL_DL)
- if (!load_dll(ctx, SSL_LIB, ssl_sw) ||
- !load_dll(ctx, CRYPTO_LIB, crypto_sw)) {
- return 0;
- }
+ if (!load_dll(ctx, SSL_LIB, ssl_sw) ||
+ !load_dll(ctx, CRYPTO_LIB, crypto_sw)) {
+ return 0;
+ }
#endif // NO_SSL_DL
- // Initialize SSL library
- SSL_library_init();
- SSL_load_error_strings();
+ // Initialize SSL library
+ SSL_library_init();
+ SSL_load_error_strings();
- if ((ctx->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) {
- cry(fc(ctx), "SSL_CTX_new (server) error: %s", ssl_error());
- return 0;
- }
+ if ((ctx->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) {
+ cry(fc(ctx), "SSL_CTX_new (server) error: %s", ssl_error());
+ return 0;
+ }
- // If user callback returned non-NULL, that means that user callback has
- // set up certificate itself. In this case, skip sertificate setting.
- if ((ctx->callbacks.init_ssl == NULL ||
- !ctx->callbacks.init_ssl(ctx->ssl_ctx, ctx->user_data)) &&
- (SSL_CTX_use_certificate_file(ctx->ssl_ctx, pem, 1) == 0 ||
- SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, pem, 1) == 0)) {
- cry(fc(ctx), "%s: cannot open %s: %s", __func__, pem, ssl_error());
- return 0;
- }
+ // If user callback returned non-NULL, that means that user callback has
+ // set up certificate itself. In this case, skip sertificate setting.
+ if ((ctx->callbacks.init_ssl == NULL ||
+ !ctx->callbacks.init_ssl(ctx->ssl_ctx, ctx->user_data)) &&
+ (SSL_CTX_use_certificate_file(ctx->ssl_ctx, pem, 1) == 0 ||
+ SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, pem, 1) == 0)) {
+ cry(fc(ctx), "%s: cannot open %s: %s", __func__, pem, ssl_error());
+ return 0;
+ }
- if (pem != NULL) {
- (void) SSL_CTX_use_certificate_chain_file(ctx->ssl_ctx, pem);
- }
+ if (pem != NULL) {
+ (void) SSL_CTX_use_certificate_chain_file(ctx->ssl_ctx, pem);
+ }
- // Initialize locking callbacks, needed for thread safety.
- // http://www.openssl.org/support/faq.html#PROG1
- size = sizeof(pthread_mutex_t) * CRYPTO_num_locks();
- if ((ssl_mutexes = (pthread_mutex_t *) malloc((size_t)size)) == NULL) {
- cry(fc(ctx), "%s: cannot allocate mutexes: %s", __func__, ssl_error());
- return 0;
- }
+ // Initialize locking callbacks, needed for thread safety.
+ // http://www.openssl.org/support/faq.html#PROG1
+ size = sizeof(pthread_mutex_t) * CRYPTO_num_locks();
+ if ((ssl_mutexes = (pthread_mutex_t *) malloc((size_t)size)) == NULL) {
+ cry(fc(ctx), "%s: cannot allocate mutexes: %s", __func__, ssl_error());
+ return 0;
+ }
- for (i = 0; i < CRYPTO_num_locks(); i++) {
- pthread_mutex_init(&ssl_mutexes[i], NULL);
- }
+ for (i = 0; i < CRYPTO_num_locks(); i++) {
+ pthread_mutex_init(&ssl_mutexes[i], NULL);
+ }
- CRYPTO_set_locking_callback(&ssl_locking_callback);
- CRYPTO_set_id_callback(&ssl_id_callback);
+ CRYPTO_set_locking_callback(&ssl_locking_callback);
+ CRYPTO_set_id_callback(&ssl_id_callback);
- return 1;
+ return 1;
}
static void uninitialize_ssl(struct mg_context *ctx) {
- int i;
- if (ctx->ssl_ctx != NULL) {
- CRYPTO_set_locking_callback(NULL);
- for (i = 0; i < CRYPTO_num_locks(); i++) {
- pthread_mutex_destroy(&ssl_mutexes[i]);
- }
- CRYPTO_set_locking_callback(NULL);
- CRYPTO_set_id_callback(NULL);
- }
+ int i;
+ if (ctx->ssl_ctx != NULL) {
+ CRYPTO_set_locking_callback(NULL);
+ for (i = 0; i < CRYPTO_num_locks(); i++) {
+ pthread_mutex_destroy(&ssl_mutexes[i]);
+ }
+ CRYPTO_set_locking_callback(NULL);
+ CRYPTO_set_id_callback(NULL);
+ }
}
#endif // !NO_SSL
static int set_gpass_option(struct mg_context *ctx) {
- struct file file = STRUCT_FILE_INITIALIZER;
- const char *path = ctx->config[GLOBAL_PASSWORDS_FILE];
- if (path != NULL && !mg_stat(fc(ctx), path, &file)) {
- cry(fc(ctx), "Cannot open %s: %s", path, strerror(ERRNO));
- return 0;
- }
- return 1;
+ struct file file = STRUCT_FILE_INITIALIZER;
+ const char *path = ctx->config[GLOBAL_PASSWORDS_FILE];
+ if (path != NULL && !mg_stat(fc(ctx), path, &file)) {
+ cry(fc(ctx), "Cannot open %s: %s", path, strerror(ERRNO));
+ return 0;
+ }
+ return 1;
}
static int set_acl_option(struct mg_context *ctx) {
- return check_acl(ctx, (uint32_t) 0x7f000001UL) != -1;
+ return check_acl(ctx, (uint32_t) 0x7f000001UL) != -1;
}
static void reset_per_request_attributes(struct mg_connection *conn) {
- conn->path_info = NULL;
- conn->num_bytes_sent = conn->consumed_content = 0;
- conn->status_code = -1;
- conn->must_close = conn->request_len = conn->throttle = 0;
+ conn->path_info = NULL;
+ conn->num_bytes_sent = conn->consumed_content = 0;
+ conn->status_code = -1;
+ conn->must_close = conn->request_len = conn->throttle = 0;
}
static void close_socket_gracefully(struct mg_connection *conn) {
#if defined(_WIN32)
- char buf[MG_BUF_LEN];
- int n;
+ char buf[MG_BUF_LEN];
+ int n;
#endif
- struct linger linger;
+ struct linger linger;
- // Set linger option to avoid socket hanging out after close. This prevent
- // ephemeral port exhaust problem under high QPS.
- linger.l_onoff = 1;
- linger.l_linger = 1;
- setsockopt(conn->client.sock, SOL_SOCKET, SO_LINGER,
- (char *) &linger, sizeof(linger));
+ // Set linger option to avoid socket hanging out after close. This prevent
+ // ephemeral port exhaust problem under high QPS.
+ linger.l_onoff = 1;
+ linger.l_linger = 1;
+ setsockopt(conn->client.sock, SOL_SOCKET, SO_LINGER,
+ (char *) &linger, sizeof(linger));
- // Send FIN to the client
- shutdown(conn->client.sock, SHUT_WR);
- set_non_blocking_mode(conn->client.sock);
+ // Send FIN to the client
+ shutdown(conn->client.sock, SHUT_WR);
+ set_non_blocking_mode(conn->client.sock);
#if defined(_WIN32)
- // Read and discard pending incoming data. If we do not do that and close the
- // socket, the data in the send buffer may be discarded. This
- // behaviour is seen on Windows, when client keeps sending data
- // when server decides to close the connection; then when client
- // does recv() it gets no data back.
- do {
- n = pull(NULL, conn, buf, sizeof(buf));
- } while (n > 0);
+ // Read and discard pending incoming data. If we do not do that and close the
+ // socket, the data in the send buffer may be discarded. This
+ // behaviour is seen on Windows, when client keeps sending data
+ // when server decides to close the connection; then when client
+ // does recv() it gets no data back.
+ do {
+ n = pull(NULL, conn, buf, sizeof(buf));
+ } while (n > 0);
#endif
- // Now we know that our FIN is ACK-ed, safe to close
- closesocket(conn->client.sock);
+ // Now we know that our FIN is ACK-ed, safe to close
+ closesocket(conn->client.sock);
}
static void close_connection(struct mg_connection *conn) {
- conn->must_close = 1;
+ conn->must_close = 1;
#ifndef NO_SSL
- if (conn->ssl != NULL) {
- // Run SSL_shutdown twice to ensure completly close SSL connection
- SSL_shutdown(conn->ssl);
- SSL_free(conn->ssl);
- conn->ssl = NULL;
- }
+ if (conn->ssl != NULL) {
+ // Run SSL_shutdown twice to ensure completly close SSL connection
+ SSL_shutdown(conn->ssl);
+ SSL_free(conn->ssl);
+ conn->ssl = NULL;
+ }
#endif
- if (conn->client.sock != INVALID_SOCKET) {
- close_socket_gracefully(conn);
- conn->client.sock = INVALID_SOCKET;
- }
+ if (conn->client.sock != INVALID_SOCKET) {
+ close_socket_gracefully(conn);
+ conn->client.sock = INVALID_SOCKET;
+ }
}
void mg_close_connection(struct mg_connection *conn) {
#ifndef NO_SSL
- if (conn->client_ssl_ctx != NULL) {
- SSL_CTX_free((SSL_CTX *) conn->client_ssl_ctx);
- }
+ if (conn->client_ssl_ctx != NULL) {
+ SSL_CTX_free((SSL_CTX *) conn->client_ssl_ctx);
+ }
#endif
- close_connection(conn);
- free(conn);
+ close_connection(conn);
+ free(conn);
}
struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
- char *ebuf, size_t ebuf_len) {
- static struct mg_context fake_ctx;
- struct mg_connection *conn = NULL;
- SOCKET sock;
-
- if ((sock = conn2(host, port, use_ssl, ebuf, ebuf_len)) == INVALID_SOCKET) {
- } else if ((conn = (struct mg_connection *)
- calloc(1, sizeof(*conn) + MAX_REQUEST_SIZE)) == NULL) {
- snprintf(ebuf, ebuf_len, "calloc(): %s", strerror(ERRNO));
- closesocket(sock);
+ char *ebuf, size_t ebuf_len) {
+ static struct mg_context fake_ctx;
+ struct mg_connection *conn = NULL;
+ SOCKET sock;
+
+ if ((sock = conn2(host, port, use_ssl, ebuf, ebuf_len)) == INVALID_SOCKET) {
+ } else if ((conn = (struct mg_connection *)
+ calloc(1, sizeof(*conn) + MAX_REQUEST_SIZE)) == NULL) {
+ snprintf(ebuf, ebuf_len, "calloc(): %s", strerror(ERRNO));
+ closesocket(sock);
#ifndef NO_SSL
- } else if (use_ssl && (conn->client_ssl_ctx =
- SSL_CTX_new(SSLv23_client_method())) == NULL) {
- snprintf(ebuf, ebuf_len, "SSL_CTX_new error");
- closesocket(sock);
- free(conn);
- conn = NULL;
+ } else if (use_ssl && (conn->client_ssl_ctx =
+ SSL_CTX_new(SSLv23_client_method())) == NULL) {
+ snprintf(ebuf, ebuf_len, "SSL_CTX_new error");
+ closesocket(sock);
+ free(conn);
+ conn = NULL;
#endif // NO_SSL
- } else {
- socklen_t len;
- conn->buf_size = MAX_REQUEST_SIZE;
- conn->buf = (char *) (conn + 1);
- conn->ctx = &fake_ctx;
- conn->client.sock = sock;
- getsockname(sock, &conn->client.rsa.sa, &len);
- conn->client.is_ssl = use_ssl;
+ } else {
+ socklen_t len;
+ conn->buf_size = MAX_REQUEST_SIZE;
+ conn->buf = (char *) (conn + 1);
+ conn->ctx = &fake_ctx;
+ conn->client.sock = sock;
+ getsockname(sock, &conn->client.rsa.sa, &len);
+ conn->client.is_ssl = use_ssl;
#ifndef NO_SSL
- if (use_ssl) {
- // SSL_CTX_set_verify call is needed to switch off server certificate
- // checking, which is off by default in OpenSSL and on in yaSSL.
- SSL_CTX_set_verify(conn->client_ssl_ctx, 0, 0);
- sslize(conn, conn->client_ssl_ctx, SSL_connect);
- }
+ if (use_ssl) {
+ // SSL_CTX_set_verify call is needed to switch off server certificate
+ // checking, which is off by default in OpenSSL and on in yaSSL.
+ SSL_CTX_set_verify(conn->client_ssl_ctx, 0, 0);
+ sslize(conn, conn->client_ssl_ctx, SSL_connect);
+ }
#endif
- }
+ }
- return conn;
+ return conn;
}
static int is_valid_uri(const char *uri) {
- // Conform to http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
- // URI can be an asterisk (*) or should start with slash.
- return uri[0] == '/' || (uri[0] == '*' && uri[1] == '\0');
+ // Conform to http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
+ // URI can be an asterisk (*) or should start with slash.
+ return uri[0] == '/' || (uri[0] == '*' && uri[1] == '\0');
}
static int getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len) {
- const char *cl;
-
- ebuf[0] = '\0';
- reset_per_request_attributes(conn);
- conn->request_len = read_request(NULL, conn, conn->buf, conn->buf_size,
- &conn->data_len);
- assert(conn->request_len < 0 || conn->data_len >= conn->request_len);
-
- if (conn->request_len == 0 && conn->data_len == conn->buf_size) {
- snprintf(ebuf, ebuf_len, "%s", "Request Too Large");
- } else if (conn->request_len <= 0) {
- snprintf(ebuf, ebuf_len, "%s", "Client closed connection");
- } else if (parse_http_message(conn->buf, conn->buf_size,
- &conn->request_info) <= 0) {
- snprintf(ebuf, ebuf_len, "Bad request: [%.*s]", conn->data_len, conn->buf);
- } else {
- // Request is valid
- if ((cl = get_header(&conn->request_info, "Content-Length")) != NULL) {
- conn->content_len = strtoll(cl, NULL, 10);
- } else if (!mg_strcasecmp(conn->request_info.request_method, "POST") ||
- !mg_strcasecmp(conn->request_info.request_method, "PUT")) {
- conn->content_len = -1;
- } else {
- conn->content_len = 0;
- }
- conn->birth_time = time(NULL);
- }
- return ebuf[0] == '\0';
+ const char *cl;
+
+ ebuf[0] = '\0';
+ reset_per_request_attributes(conn);
+ conn->request_len = read_request(NULL, conn, conn->buf, conn->buf_size,
+ &conn->data_len);
+ assert(conn->request_len < 0 || conn->data_len >= conn->request_len);
+
+ if (conn->request_len == 0 && conn->data_len == conn->buf_size) {
+ snprintf(ebuf, ebuf_len, "%s", "Request Too Large");
+ } else if (conn->request_len <= 0) {
+ snprintf(ebuf, ebuf_len, "%s", "Client closed connection");
+ } else if (parse_http_message(conn->buf, conn->buf_size,
+ &conn->request_info) <= 0) {
+ snprintf(ebuf, ebuf_len, "Bad request: [%.*s]", conn->data_len, conn->buf);
+ } else {
+ // Request is valid
+ if ((cl = get_header(&conn->request_info, "Content-Length")) != NULL) {
+ conn->content_len = strtoll(cl, NULL, 10);
+ } else if (!mg_strcasecmp(conn->request_info.request_method, "POST") ||
+ !mg_strcasecmp(conn->request_info.request_method, "PUT")) {
+ conn->content_len = -1;
+ } else {
+ conn->content_len = 0;
+ }
+ conn->birth_time = time(NULL);
+ }
+ return ebuf[0] == '\0';
}
struct mg_connection *mg_download(const char *host, int port, int use_ssl,
- char *ebuf, size_t ebuf_len,
- const char *fmt, ...) {
- struct mg_connection *conn;
- va_list ap;
-
- va_start(ap, fmt);
- ebuf[0] = '\0';
- if ((conn = mg_connect(host, port, use_ssl, ebuf, ebuf_len)) == NULL) {
- } else if (mg_vprintf(conn, fmt, ap) <= 0) {
- snprintf(ebuf, ebuf_len, "%s", "Error sending request");
- } else {
- getreq(conn, ebuf, ebuf_len);
- }
- if (ebuf[0] != '\0' && conn != NULL) {
- mg_close_connection(conn);
- conn = NULL;
- }
-
- return conn;
+ char *ebuf, size_t ebuf_len,
+ const char *fmt, ...) {
+ struct mg_connection *conn;
+ va_list ap;
+
+ va_start(ap, fmt);
+ ebuf[0] = '\0';
+ if ((conn = mg_connect(host, port, use_ssl, ebuf, ebuf_len)) == NULL) {
+ } else if (mg_vprintf(conn, fmt, ap) <= 0) {
+ snprintf(ebuf, ebuf_len, "%s", "Error sending request");
+ } else {
+ getreq(conn, ebuf, ebuf_len);
+ }
+ if (ebuf[0] != '\0' && conn != NULL) {
+ mg_close_connection(conn);
+ conn = NULL;
+ }
+
+ return conn;
}
static void process_new_connection(struct mg_connection *conn) {
- struct mg_request_info *ri = &conn->request_info;
- int keep_alive_enabled, keep_alive, discard_len;
- char ebuf[100];
-
- keep_alive_enabled = !strcmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes");
- keep_alive = 0;
-
- // Important: on new connection, reset the receiving buffer. Credit goes
- // to crule42.
- conn->data_len = 0;
- do {
- if (!getreq(conn, ebuf, sizeof(ebuf))) {
- send_http_error(conn, 500, "Server Error", "%s", ebuf);
- conn->must_close = 1;
- } else if (!is_valid_uri(conn->request_info.uri)) {
- snprintf(ebuf, sizeof(ebuf), "Invalid URI: [%s]", ri->uri);
- send_http_error(conn, 400, "Bad Request", "%s", ebuf);
- } else if (strcmp(ri->http_version, "1.0") &&
- strcmp(ri->http_version, "1.1")) {
- snprintf(ebuf, sizeof(ebuf), "Bad HTTP version: [%s]", ri->http_version);
- send_http_error(conn, 505, "Bad HTTP version", "%s", ebuf);
- }
-
- if (ebuf[0] == '\0') {
- handle_request(conn);
- if (conn->ctx->callbacks.end_request != NULL) {
- conn->ctx->callbacks.end_request(conn, conn->status_code);
- }
- log_access(conn);
- }
- if (ri->remote_user != NULL) {
- free((void *) ri->remote_user);
- // Important! When having connections with and without auth
- // would cause double free and then crash
- ri->remote_user = NULL;
- }
-
- // NOTE(lsm): order is important here. should_keep_alive() call
- // is using parsed request, which will be invalid after memmove's below.
- // Therefore, memorize should_keep_alive() result now for later use
- // in loop exit condition.
- keep_alive = conn->ctx->stop_flag == 0 && keep_alive_enabled &&
- conn->content_len >= 0 && should_keep_alive(conn);
-
- // Discard all buffered data for this request
- discard_len = conn->content_len >= 0 && conn->request_len > 0 &&
- conn->request_len + conn->content_len < (int64_t) conn->data_len ?
- (int) (conn->request_len + conn->content_len) : conn->data_len;
- assert(discard_len >= 0);
- memmove(conn->buf, conn->buf + discard_len, conn->data_len - discard_len);
- conn->data_len -= discard_len;
- assert(conn->data_len >= 0);
- assert(conn->data_len <= conn->buf_size);
- } while (keep_alive);
+ struct mg_request_info *ri = &conn->request_info;
+ int keep_alive_enabled, keep_alive, discard_len;
+ char ebuf[100];
+
+ keep_alive_enabled = !strcmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes");
+ keep_alive = 0;
+
+ // Important: on new connection, reset the receiving buffer. Credit goes
+ // to crule42.
+ conn->data_len = 0;
+ do {
+ if (!getreq(conn, ebuf, sizeof(ebuf))) {
+ send_http_error(conn, 500, "Server Error", "%s", ebuf);
+ conn->must_close = 1;
+ } else if (!is_valid_uri(conn->request_info.uri)) {
+ snprintf(ebuf, sizeof(ebuf), "Invalid URI: [%s]", ri->uri);
+ send_http_error(conn, 400, "Bad Request", "%s", ebuf);
+ } else if (strcmp(ri->http_version, "1.0") &&
+ strcmp(ri->http_version, "1.1")) {
+ snprintf(ebuf, sizeof(ebuf), "Bad HTTP version: [%s]", ri->http_version);
+ send_http_error(conn, 505, "Bad HTTP version", "%s", ebuf);
+ }
+
+ if (ebuf[0] == '\0') {
+ handle_request(conn);
+ if (conn->ctx->callbacks.end_request != NULL) {
+ conn->ctx->callbacks.end_request(conn, conn->status_code);
+ }
+ log_access(conn);
+ }
+ if (ri->remote_user != NULL) {
+ free((void *) ri->remote_user);
+ // Important! When having connections with and without auth
+ // would cause double free and then crash
+ ri->remote_user = NULL;
+ }
+
+ // NOTE(lsm): order is important here. should_keep_alive() call
+ // is using parsed request, which will be invalid after memmove's below.
+ // Therefore, memorize should_keep_alive() result now for later use
+ // in loop exit condition.
+ keep_alive = conn->ctx->stop_flag == 0 && keep_alive_enabled &&
+ conn->content_len >= 0 && should_keep_alive(conn);
+
+ // Discard all buffered data for this request
+ discard_len = conn->content_len >= 0 && conn->request_len > 0 &&
+ conn->request_len + conn->content_len < (int64_t) conn->data_len ?
+ (int) (conn->request_len + conn->content_len) : conn->data_len;
+ assert(discard_len >= 0);
+ memmove(conn->buf, conn->buf + discard_len, conn->data_len - discard_len);
+ conn->data_len -= discard_len;
+ assert(conn->data_len >= 0);
+ assert(conn->data_len <= conn->buf_size);
+ } while (keep_alive);
}
// Worker threads take accepted socket from the queue
static int consume_socket(struct mg_context *ctx, struct socket *sp) {
- (void) pthread_mutex_lock(&ctx->mutex);
- DEBUG_TRACE(("going idle"));
+ (void) pthread_mutex_lock(&ctx->mutex);
+ DEBUG_TRACE(("going idle"));
- // If the queue is empty, wait. We're idle at this point.
- while (ctx->sq_head == ctx->sq_tail && ctx->stop_flag == 0) {
- pthread_cond_wait(&ctx->sq_full, &ctx->mutex);
- }
+ // If the queue is empty, wait. We're idle at this point.
+ while (ctx->sq_head == ctx->sq_tail && ctx->stop_flag == 0) {
+ pthread_cond_wait(&ctx->sq_full, &ctx->mutex);
+ }
- // If we're stopping, sq_head may be equal to sq_tail.
- if (ctx->sq_head > ctx->sq_tail) {
- // Copy socket from the queue and increment tail
- *sp = ctx->queue[ctx->sq_tail % ARRAY_SIZE(ctx->queue)];
- ctx->sq_tail++;
- DEBUG_TRACE(("grabbed socket %d, going busy", sp->sock));
+ // If we're stopping, sq_head may be equal to sq_tail.
+ if (ctx->sq_head > ctx->sq_tail) {
+ // Copy socket from the queue and increment tail
+ *sp = ctx->queue[ctx->sq_tail % ARRAY_SIZE(ctx->queue)];
+ ctx->sq_tail++;
+ DEBUG_TRACE(("grabbed socket %d, going busy", sp->sock));
- // Wrap pointers if needed
- while (ctx->sq_tail > (int) ARRAY_SIZE(ctx->queue)) {
- ctx->sq_tail -= ARRAY_SIZE(ctx->queue);
- ctx->sq_head -= ARRAY_SIZE(ctx->queue);
- }
- }
+ // Wrap pointers if needed
+ while (ctx->sq_tail > (int) ARRAY_SIZE(ctx->queue)) {
+ ctx->sq_tail -= ARRAY_SIZE(ctx->queue);
+ ctx->sq_head -= ARRAY_SIZE(ctx->queue);
+ }
+ }
- (void) pthread_cond_signal(&ctx->sq_empty);
- (void) pthread_mutex_unlock(&ctx->mutex);
+ (void) pthread_cond_signal(&ctx->sq_empty);
+ (void) pthread_mutex_unlock(&ctx->mutex);
- return !ctx->stop_flag;
+ return !ctx->stop_flag;
}
static void *worker_thread(void *thread_func_param) {
- struct mg_context *ctx = (struct mg_context *)thread_func_param;
- struct mg_connection *conn;
-
- conn = (struct mg_connection *) calloc(1, sizeof(*conn) + MAX_REQUEST_SIZE);
- if (conn == NULL) {
- cry(fc(ctx), "%s", "Cannot create new connection struct, OOM");
- } else {
- conn->buf_size = MAX_REQUEST_SIZE;
- conn->buf = (char *) (conn + 1);
- conn->ctx = ctx;
- conn->request_info.user_data = ctx->user_data;
-
- // Call consume_socket() even when ctx->stop_flag > 0, to let it signal
- // sq_empty condvar to wake up the master waiting in produce_socket()
- while (consume_socket(ctx, &conn->client)) {
- conn->birth_time = time(NULL);
-
- // Fill in IP, port info early so even if SSL setup below fails,
- // error handler would have the corresponding info.
- // Thanks to Johannes Winkelmann for the patch.
- // TODO(lsm): Fix IPv6 case
- conn->request_info.remote_port = ntohs(conn->client.rsa.sin.sin_port);
- memcpy(&conn->request_info.remote_ip,
- &conn->client.rsa.sin.sin_addr.s_addr, 4);
- conn->request_info.remote_ip = ntohl(conn->request_info.remote_ip);
- conn->request_info.is_ssl = conn->client.is_ssl;
-
- if (!conn->client.is_ssl
+ struct mg_context *ctx = (struct mg_context *)thread_func_param;
+ struct mg_connection *conn;
+
+ conn = (struct mg_connection *) calloc(1, sizeof(*conn) + MAX_REQUEST_SIZE);
+ if (conn == NULL) {
+ cry(fc(ctx), "%s", "Cannot create new connection struct, OOM");
+ } else {
+ conn->buf_size = MAX_REQUEST_SIZE;
+ conn->buf = (char *) (conn + 1);
+ conn->ctx = ctx;
+ conn->request_info.user_data = ctx->user_data;
+
+ // Call consume_socket() even when ctx->stop_flag > 0, to let it signal
+ // sq_empty condvar to wake up the master waiting in produce_socket()
+ while (consume_socket(ctx, &conn->client)) {
+ conn->birth_time = time(NULL);
+
+ // Fill in IP, port info early so even if SSL setup below fails,
+ // error handler would have the corresponding info.
+ // Thanks to Johannes Winkelmann for the patch.
+ // TODO(lsm): Fix IPv6 case
+ conn->request_info.remote_port = ntohs(conn->client.rsa.sin.sin_port);
+ memcpy(&conn->request_info.remote_ip,
+ &conn->client.rsa.sin.sin_addr.s_addr, 4);
+ conn->request_info.remote_ip = ntohl(conn->request_info.remote_ip);
+ conn->request_info.is_ssl = conn->client.is_ssl;
+
+ if (!conn->client.is_ssl
#ifndef NO_SSL
- || sslize(conn, conn->ctx->ssl_ctx, SSL_accept)
+ || sslize(conn, conn->ctx->ssl_ctx, SSL_accept)
#endif
- ) {
- process_new_connection(conn);
- }
+ ) {
+ process_new_connection(conn);
+ }
- close_connection(conn);
- }
- free(conn);
- }
+ close_connection(conn);
+ }
+ free(conn);
+ }
- // Signal master that we're done with connection and exiting
- (void) pthread_mutex_lock(&ctx->mutex);
- ctx->num_threads--;
- (void) pthread_cond_signal(&ctx->cond);
- assert(ctx->num_threads >= 0);
- (void) pthread_mutex_unlock(&ctx->mutex);
+ // Signal master that we're done with connection and exiting
+ (void) pthread_mutex_lock(&ctx->mutex);
+ ctx->num_threads--;
+ (void) pthread_cond_signal(&ctx->cond);
+ assert(ctx->num_threads >= 0);
+ (void) pthread_mutex_unlock(&ctx->mutex);
- DEBUG_TRACE(("exiting"));
- return NULL;
+ DEBUG_TRACE(("exiting"));
+ return NULL;
}
// Master thread adds accepted socket to a queue
static void produce_socket(struct mg_context *ctx, const struct socket *sp) {
- (void) pthread_mutex_lock(&ctx->mutex);
+ (void) pthread_mutex_lock(&ctx->mutex);
- // If the queue is full, wait
- while (ctx->stop_flag == 0 &&
- ctx->sq_head - ctx->sq_tail >= (int) ARRAY_SIZE(ctx->queue)) {
- (void) pthread_cond_wait(&ctx->sq_empty, &ctx->mutex);
- }
+ // If the queue is full, wait
+ while (ctx->stop_flag == 0 &&
+ ctx->sq_head - ctx->sq_tail >= (int) ARRAY_SIZE(ctx->queue)) {
+ (void) pthread_cond_wait(&ctx->sq_empty, &ctx->mutex);
+ }
- if (ctx->sq_head - ctx->sq_tail < (int) ARRAY_SIZE(ctx->queue)) {
- // Copy socket to the queue and increment head
- ctx->queue[ctx->sq_head % ARRAY_SIZE(ctx->queue)] = *sp;
- ctx->sq_head++;
- DEBUG_TRACE(("queued socket %d", sp->sock));
- }
+ if (ctx->sq_head - ctx->sq_tail < (int) ARRAY_SIZE(ctx->queue)) {
+ // Copy socket to the queue and increment head
+ ctx->queue[ctx->sq_head % ARRAY_SIZE(ctx->queue)] = *sp;
+ ctx->sq_head++;
+ DEBUG_TRACE(("queued socket %d", sp->sock));
+ }
- (void) pthread_cond_signal(&ctx->sq_full);
- (void) pthread_mutex_unlock(&ctx->mutex);
+ (void) pthread_cond_signal(&ctx->sq_full);
+ (void) pthread_mutex_unlock(&ctx->mutex);
}
static int set_sock_timeout(SOCKET sock, int milliseconds) {
#ifdef _WIN32
- DWORD t = milliseconds;
+ DWORD t = milliseconds;
#else
- struct timeval t;
- t.tv_sec = milliseconds / 1000;
- t.tv_usec = (milliseconds * 1000) % 1000000;
+ struct timeval t;
+ t.tv_sec = milliseconds / 1000;
+ t.tv_usec = (milliseconds * 1000) % 1000000;
#endif
- return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (SETSOCKOPT_CAST) &t, sizeof(t)) ||
- setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (SETSOCKOPT_CAST) &t, sizeof(t));
+ return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (SETSOCKOPT_CAST) &t, sizeof(t)) ||
+ setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (SETSOCKOPT_CAST) &t, sizeof(t));
}
static void accept_new_connection(const struct socket *listener,
- struct mg_context *ctx) {
- struct socket so;
- char src_addr[IP_ADDR_STR_LEN];
- socklen_t len = sizeof(so.rsa);
- int on = 1;
-
- if ((so.sock = accept(listener->sock, &so.rsa.sa, &len)) == INVALID_SOCKET) {
- } else if (!check_acl(ctx, ntohl(* (uint32_t *) &so.rsa.sin.sin_addr))) {
- sockaddr_to_string(src_addr, sizeof(src_addr), &so.rsa);
- cry(fc(ctx), "%s: %s is not allowed to connect", __func__, src_addr);
- closesocket(so.sock);
- } else {
- // Put so socket structure into the queue
- DEBUG_TRACE(("Accepted socket %d", (int) so.sock));
- so.is_ssl = listener->is_ssl;
- so.ssl_redir = listener->ssl_redir;
- getsockname(so.sock, &so.lsa.sa, &len);
- // Set TCP keep-alive. This is needed because if HTTP-level keep-alive
- // is enabled, and client resets the connection, server won't get
- // TCP FIN or RST and will keep the connection open forever. With TCP
- // keep-alive, next keep-alive handshake will figure out that the client
- // is down and will close the server end.
- // Thanks to Igor Klopov who suggested the patch.
- setsockopt(so.sock, SOL_SOCKET, SO_KEEPALIVE, (SETSOCKOPT_CAST) &on, sizeof(on));
- set_sock_timeout(so.sock, atoi(ctx->config[REQUEST_TIMEOUT]));
- produce_socket(ctx, &so);
- }
+ struct mg_context *ctx) {
+ struct socket so;
+ char src_addr[IP_ADDR_STR_LEN];
+ socklen_t len = sizeof(so.rsa);
+ int on = 1;
+
+ if ((so.sock = accept(listener->sock, &so.rsa.sa, &len)) == INVALID_SOCKET) {
+ } else if (!check_acl(ctx, ntohl(* (uint32_t *) &so.rsa.sin.sin_addr))) {
+ sockaddr_to_string(src_addr, sizeof(src_addr), &so.rsa);
+ cry(fc(ctx), "%s: %s is not allowed to connect", __func__, src_addr);
+ closesocket(so.sock);
+ } else {
+ // Put so socket structure into the queue
+ DEBUG_TRACE(("Accepted socket %d", (int) so.sock));
+ so.is_ssl = listener->is_ssl;
+ so.ssl_redir = listener->ssl_redir;
+ getsockname(so.sock, &so.lsa.sa, &len);
+ // Set TCP keep-alive. This is needed because if HTTP-level keep-alive
+ // is enabled, and client resets the connection, server won't get
+ // TCP FIN or RST and will keep the connection open forever. With TCP
+ // keep-alive, next keep-alive handshake will figure out that the client
+ // is down and will close the server end.
+ // Thanks to Igor Klopov who suggested the patch.
+ setsockopt(so.sock, SOL_SOCKET, SO_KEEPALIVE, (SETSOCKOPT_CAST) &on, sizeof(on));
+ set_sock_timeout(so.sock, atoi(ctx->config[REQUEST_TIMEOUT]));
+ produce_socket(ctx, &so);
+ }
}
static void *master_thread(void *thread_func_param) {
- struct mg_context *ctx = (struct mg_context *)thread_func_param;
- struct pollfd *pfd;
- int i;
+ struct mg_context *ctx = (struct mg_context *)thread_func_param;
+ struct pollfd *pfd;
+ int i;
- // Increase priority of the master thread
+ // Increase priority of the master thread
#if defined(_WIN32)
- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
#endif
#if defined(ISSUE_317)
- struct sched_param sched_param;
- sched_param.sched_priority = sched_get_priority_max(SCHED_RR);
- pthread_setschedparam(pthread_self(), SCHED_RR, &sched_param);
+ struct sched_param sched_param;
+ sched_param.sched_priority = sched_get_priority_max(SCHED_RR);
+ pthread_setschedparam(pthread_self(), SCHED_RR, &sched_param);
#endif
- pfd = (struct pollfd *)calloc(ctx->num_listening_sockets, sizeof(pfd[0]));
- while (pfd != NULL && ctx->stop_flag == 0) {
- for (i = 0; i < ctx->num_listening_sockets; i++) {
- pfd[i].fd = ctx->listening_sockets[i].sock;
- pfd[i].events = POLLIN;
- }
-
- if (poll(pfd, ctx->num_listening_sockets, 200) > 0) {
- for (i = 0; i < ctx->num_listening_sockets; i++) {
- // NOTE(lsm): on QNX, poll() returns POLLRDNORM after the
- // successfull poll, and POLLIN is defined as (POLLRDNORM | POLLRDBAND)
- // Therefore, we're checking pfd[i].revents & POLLIN, not
- // pfd[i].revents == POLLIN.
- if (ctx->stop_flag == 0 && (pfd[i].revents & POLLIN)) {
- accept_new_connection(&ctx->listening_sockets[i], ctx);
- }
- }
- }
- }
- free(pfd);
- DEBUG_TRACE(("stopping workers"));
-
- // Stop signal received: somebody called mg_stop. Quit.
- close_all_listening_sockets(ctx);
-
- // Wakeup workers that are waiting for connections to handle.
- pthread_cond_broadcast(&ctx->sq_full);
-
- // Wait until all threads finish
- (void) pthread_mutex_lock(&ctx->mutex);
- while (ctx->num_threads > 0) {
- (void) pthread_cond_wait(&ctx->cond, &ctx->mutex);
- }
- (void) pthread_mutex_unlock(&ctx->mutex);
-
- // All threads exited, no sync is needed. Destroy mutex and condvars
- (void) pthread_mutex_destroy(&ctx->mutex);
- (void) pthread_cond_destroy(&ctx->cond);
- (void) pthread_cond_destroy(&ctx->sq_empty);
- (void) pthread_cond_destroy(&ctx->sq_full);
+ pfd = (struct pollfd *)calloc(ctx->num_listening_sockets, sizeof(pfd[0]));
+ while (pfd != NULL && ctx->stop_flag == 0) {
+ for (i = 0; i < ctx->num_listening_sockets; i++) {
+ pfd[i].fd = ctx->listening_sockets[i].sock;
+ pfd[i].events = POLLIN;
+ }
+
+ if (poll(pfd, ctx->num_listening_sockets, 200) > 0) {
+ for (i = 0; i < ctx->num_listening_sockets; i++) {
+ // NOTE(lsm): on QNX, poll() returns POLLRDNORM after the
+ // successfull poll, and POLLIN is defined as (POLLRDNORM | POLLRDBAND)
+ // Therefore, we're checking pfd[i].revents & POLLIN, not
+ // pfd[i].revents == POLLIN.
+ if (ctx->stop_flag == 0 && (pfd[i].revents & POLLIN)) {
+ accept_new_connection(&ctx->listening_sockets[i], ctx);
+ }
+ }
+ }
+ }
+ free(pfd);
+ DEBUG_TRACE(("stopping workers"));
+
+ // Stop signal received: somebody called mg_stop. Quit.
+ close_all_listening_sockets(ctx);
+
+ // Wakeup workers that are waiting for connections to handle.
+ pthread_cond_broadcast(&ctx->sq_full);
+
+ // Wait until all threads finish
+ (void) pthread_mutex_lock(&ctx->mutex);
+ while (ctx->num_threads > 0) {
+ (void) pthread_cond_wait(&ctx->cond, &ctx->mutex);
+ }
+ (void) pthread_mutex_unlock(&ctx->mutex);
+
+ // All threads exited, no sync is needed. Destroy mutex and condvars
+ (void) pthread_mutex_destroy(&ctx->mutex);
+ (void) pthread_cond_destroy(&ctx->cond);
+ (void) pthread_cond_destroy(&ctx->sq_empty);
+ (void) pthread_cond_destroy(&ctx->sq_full);
#if !defined(NO_SSL)
- uninitialize_ssl(ctx);
+ uninitialize_ssl(ctx);
#endif
- DEBUG_TRACE(("exiting"));
+ DEBUG_TRACE(("exiting"));
- // Signal mg_stop() that we're done.
- // WARNING: This must be the very last thing this
- // thread does, as ctx becomes invalid after this line.
- ctx->stop_flag = 2;
- return NULL;
+ // Signal mg_stop() that we're done.
+ // WARNING: This must be the very last thing this
+ // thread does, as ctx becomes invalid after this line.
+ ctx->stop_flag = 2;
+ return NULL;
}
static void free_context(struct mg_context *ctx) {
- int i;
+ int i;
- // Deallocate config parameters
- for (i = 0; i < NUM_OPTIONS; i++) {
- if (ctx->config[i] != NULL)
- free(ctx->config[i]);
- }
+ // Deallocate config parameters
+ for (i = 0; i < NUM_OPTIONS; i++) {
+ if (ctx->config[i] != NULL)
+ free(ctx->config[i]);
+ }
#ifndef NO_SSL
- // Deallocate SSL context
- if (ctx->ssl_ctx != NULL) {
- SSL_CTX_free(ctx->ssl_ctx);
- }
- if (ssl_mutexes != NULL) {
- free(ssl_mutexes);
- ssl_mutexes = NULL;
- }
+ // Deallocate SSL context
+ if (ctx->ssl_ctx != NULL) {
+ SSL_CTX_free(ctx->ssl_ctx);
+ }
+ if (ssl_mutexes != NULL) {
+ free(ssl_mutexes);
+ ssl_mutexes = NULL;
+ }
#endif // !NO_SSL
- // Deallocate context itself
- free(ctx);
+ // Deallocate context itself
+ free(ctx);
}
void mg_stop(struct mg_context *ctx) {
if (!ctx) return;
- ctx->stop_flag = 1;
+ ctx->stop_flag = 1;
- // Wait until mg_fini() stops
- while (ctx->stop_flag != 2) {
- (void) mg_sleep(10);
- }
- free_context(ctx);
+ // Wait until mg_fini() stops
+ while (ctx->stop_flag != 2) {
+ (void) mg_sleep(10);
+ }
+ free_context(ctx);
#if defined(_WIN32) && !defined(__SYMBIAN32__)
- (void) WSACleanup();
+ (void) WSACleanup();
#endif // _WIN32
}
struct mg_context *mg_start(const struct mg_callbacks *callbacks,
- void *user_data,
- const char **options) {
- struct mg_context *ctx;
- const char *name, *value, *default_value;
- int i;
+ void *user_data,
+ const char **options) {
+ struct mg_context *ctx;
+ const char *name, *value, *default_value;
+ int i;
#if defined(_WIN32) && !defined(__SYMBIAN32__)
- WSADATA data;
- WSAStartup(MAKEWORD(2,2), &data);
- InitializeCriticalSection(&global_log_file_lock);
+ WSADATA data;
+ WSAStartup(MAKEWORD(2,2), &data);
+ InitializeCriticalSection(&global_log_file_lock);
#endif // _WIN32
- // Allocate context and initialize reasonable general case defaults.
- // TODO(lsm): do proper error handling here.
- if ((ctx = (struct mg_context *) calloc(1, sizeof(*ctx))) == NULL) {
- return NULL;
- }
- ctx->callbacks = *callbacks;
- ctx->user_data = user_data;
-
- while (options && (name = *options++) != NULL) {
- if ((i = get_option_index(name)) == -1) {
- cry(fc(ctx), "Invalid option: %s", name);
- free_context(ctx);
- return NULL;
- } else if ((value = *options++) == NULL) {
- cry(fc(ctx), "%s: option value cannot be NULL", name);
- free_context(ctx);
- return NULL;
- }
- if (ctx->config[i] != NULL) {
- cry(fc(ctx), "warning: %s: duplicate option", name);
- free(ctx->config[i]);
- }
- ctx->config[i] = mg_strdup(value);
- DEBUG_TRACE(("[%s] -> [%s]", name, value));
- }
-
- // Set default value if needed
- for (i = 0; config_options[i * 2] != NULL; i++) {
- default_value = config_options[i * 2 + 1];
- if (ctx->config[i] == NULL && default_value != NULL) {
- ctx->config[i] = mg_strdup(default_value);
- }
- }
-
- // NOTE(lsm): order is important here. SSL certificates must
- // be initialized before listening ports. UID must be set last.
- if (!set_gpass_option(ctx) ||
+ // Allocate context and initialize reasonable general case defaults.
+ // TODO(lsm): do proper error handling here.
+ if ((ctx = (struct mg_context *) calloc(1, sizeof(*ctx))) == NULL) {
+ return NULL;
+ }
+ ctx->callbacks = *callbacks;
+ ctx->user_data = user_data;
+
+ while (options && (name = *options++) != NULL) {
+ if ((i = get_option_index(name)) == -1) {
+ cry(fc(ctx), "Invalid option: %s", name);
+ free_context(ctx);
+ return NULL;
+ } else if ((value = *options++) == NULL) {
+ cry(fc(ctx), "%s: option value cannot be NULL", name);
+ free_context(ctx);
+ return NULL;
+ }
+ if (ctx->config[i] != NULL) {
+ cry(fc(ctx), "warning: %s: duplicate option", name);
+ free(ctx->config[i]);
+ }
+ ctx->config[i] = mg_strdup(value);
+ DEBUG_TRACE(("[%s] -> [%s]", name, value));
+ }
+
+ // Set default value if needed
+ for (i = 0; config_options[i * 2] != NULL; i++) {
+ default_value = config_options[i * 2 + 1];
+ if (ctx->config[i] == NULL && default_value != NULL) {
+ ctx->config[i] = mg_strdup(default_value);
+ }
+ }
+
+ // NOTE(lsm): order is important here. SSL certificates must
+ // be initialized before listening ports. UID must be set last.
+ if (!set_gpass_option(ctx) ||
#if !defined(NO_SSL)
- !set_ssl_option(ctx) ||
+ !set_ssl_option(ctx) ||
#endif
- !set_ports_option(ctx) ||
+ !set_ports_option(ctx) ||
#if !defined(_WIN32)
- !set_uid_option(ctx) ||
+ !set_uid_option(ctx) ||
#endif
- !set_acl_option(ctx)) {
- free_context(ctx);
- return NULL;
- }
+ !set_acl_option(ctx)) {
+ free_context(ctx);
+ return NULL;
+ }
#if !defined(_WIN32) && !defined(__SYMBIAN32__)
- // Ignore SIGPIPE signal, so if browser cancels the request, it
- // won't kill the whole process.
- (void) signal(SIGPIPE, SIG_IGN);
- // Also ignoring SIGCHLD to let the OS to reap zombies properly.
- (void) signal(SIGCHLD, SIG_IGN);
+ // Ignore SIGPIPE signal, so if browser cancels the request, it
+ // won't kill the whole process.
+ (void) signal(SIGPIPE, SIG_IGN);
+ // Also ignoring SIGCHLD to let the OS to reap zombies properly.
+ (void) signal(SIGCHLD, SIG_IGN);
#endif // !_WIN32
- (void) pthread_mutex_init(&ctx->mutex, NULL);
- (void) pthread_cond_init(&ctx->cond, NULL);
- (void) pthread_cond_init(&ctx->sq_empty, NULL);
- (void) pthread_cond_init(&ctx->sq_full, NULL);
+ (void) pthread_mutex_init(&ctx->mutex, NULL);
+ (void) pthread_cond_init(&ctx->cond, NULL);
+ (void) pthread_cond_init(&ctx->sq_empty, NULL);
+ (void) pthread_cond_init(&ctx->sq_full, NULL);
- // Start master (listening) thread
- mg_start_thread(master_thread, ctx);
+ // Start master (listening) thread
+ mg_start_thread(master_thread, ctx);
- // Start worker threads
- for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) {
- if (mg_start_thread(worker_thread, ctx) != 0) {
- cry(fc(ctx), "Cannot start worker thread: %ld", (long) ERRNO);
- } else {
- ctx->num_threads++;
- }
- }
+ // Start worker threads
+ for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) {
+ if (mg_start_thread(worker_thread, ctx) != 0) {
+ cry(fc(ctx), "Cannot start worker thread: %ld", (long) ERRNO);
+ } else {
+ ctx->num_threads++;
+ }
+ }
- return ctx;
+ return ctx;
}
diff --git a/src/lib/web/mongoose.h b/src/lib/web/mongoose.h
index 851d01801de..64c3a174966 100644
--- a/src/lib/web/mongoose.h
+++ b/src/lib/web/mongoose.h
@@ -34,21 +34,21 @@ struct mg_connection; // Handle for the individual connection
// This structure contains information about the HTTP request.
struct mg_request_info {
- 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 *remote_user; // Authenticated user, or NULL if no auth used
- long remote_ip; // Client's IP address
- int remote_port; // Client's port
- int is_ssl; // 1 if SSL-ed, 0 if not
- void *user_data; // User data pointer passed to mg_start()
-
- int num_headers; // Number of HTTP headers
- struct mg_header {
- const char *name; // HTTP header name
- const char *value; // HTTP header value
- } http_headers[64]; // Maximum 64 headers
+ 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 *remote_user; // Authenticated user, or NULL if no auth used
+ long remote_ip; // Client's IP address
+ int remote_port; // Client's port
+ int is_ssl; // 1 if SSL-ed, 0 if not
+ void *user_data; // User data pointer passed to mg_start()
+
+ int num_headers; // Number of HTTP headers
+ struct mg_header {
+ const char *name; // HTTP header name
+ const char *value; // HTTP header value
+ } http_headers[64]; // Maximum 64 headers
};
@@ -56,73 +56,73 @@ struct mg_request_info {
// which callbacks to invoke. For detailed description, see
// https://github.com/valenok/mongoose/blob/master/UserManual.md
struct mg_callbacks {
- // Called when mongoose has received new HTTP request.
- // If callback returns non-zero,
- // callback must process the request by sending valid HTTP headers and body,
- // and mongoose will not do any further processing.
- // If callback returns 0, mongoose processes the request itself. In this case,
- // callback must not send any data to the client.
- int (*begin_request)(struct mg_connection *);
-
- // Called when mongoose has finished processing request.
- void (*end_request)(const struct mg_connection *, int reply_status_code);
-
- // Called when mongoose is about to log a message. If callback returns
- // non-zero, mongoose does not log anything.
- int (*log_message)(const struct mg_connection *, const char *message);
-
- // Called when mongoose initializes SSL library.
- int (*init_ssl)(void *ssl_context, void *user_data);
-
- // Called when websocket request is received, before websocket handshake.
- // If callback returns 0, mongoose proceeds with handshake, otherwise
- // cinnection is closed immediately.
- int (*websocket_connect)(const struct mg_connection *);
-
- // Called when websocket handshake is successfully completed, and
- // connection is ready for data exchange.
- void (*websocket_ready)(struct mg_connection *);
-
- // Called when data frame has been received from the client.
- // Parameters:
- // bits: first byte of the websocket frame, see websocket RFC at
- // http://tools.ietf.org/html/rfc6455, section 5.2
- // data, data_len: payload, with mask (if any) already applied.
- // Return value:
- // non-0: keep this websocket connection opened.
- // 0: close this websocket connection.
- int (*websocket_data)(struct mg_connection *, int bits,
- char *data, size_t data_len);
-
- // Called when mongoose tries to open a file. Used to intercept file open
- // calls, and serve file data from memory instead.
- // Parameters:
- // path: Full path to the file to open.
- // data_len: Placeholder for the file size, if file is served from memory.
- // Return value:
- // NULL: do not serve file from memory, proceed with normal file open.
- // non-NULL: pointer to the file contents in memory. data_len must be
- // initilized with the size of the memory block.
- const char * (*open_file)(const struct mg_connection *,
- const char *path, size_t *data_len);
-
- // Called when mongoose is about to serve Lua server page (.lp file), if
- // Lua support is enabled.
- // Parameters:
- // lua_context: "lua_State *" pointer.
- void (*init_lua)(struct mg_connection *, void *lua_context);
-
- // Called when mongoose has uploaded a file to a temporary directory as a
- // result of mg_upload() call.
- // Parameters:
- // file_file: full path name to the uploaded file.
- void (*upload)(struct mg_connection *, const char *file_name);
-
- // Called when mongoose is about to send HTTP error to the client.
- // Implementing this callback allows to create custom error pages.
- // Parameters:
- // status: HTTP error status code.
- int (*http_error)(struct mg_connection *, int status);
+ // Called when mongoose has received new HTTP request.
+ // If callback returns non-zero,
+ // callback must process the request by sending valid HTTP headers and body,
+ // and mongoose will not do any further processing.
+ // If callback returns 0, mongoose processes the request itself. In this case,
+ // callback must not send any data to the client.
+ int (*begin_request)(struct mg_connection *);
+
+ // Called when mongoose has finished processing request.
+ void (*end_request)(const struct mg_connection *, int reply_status_code);
+
+ // Called when mongoose is about to log a message. If callback returns
+ // non-zero, mongoose does not log anything.
+ int (*log_message)(const struct mg_connection *, const char *message);
+
+ // Called when mongoose initializes SSL library.
+ int (*init_ssl)(void *ssl_context, void *user_data);
+
+ // Called when websocket request is received, before websocket handshake.
+ // If callback returns 0, mongoose proceeds with handshake, otherwise
+ // cinnection is closed immediately.
+ int (*websocket_connect)(const struct mg_connection *);
+
+ // Called when websocket handshake is successfully completed, and
+ // connection is ready for data exchange.
+ void (*websocket_ready)(struct mg_connection *);
+
+ // Called when data frame has been received from the client.
+ // Parameters:
+ // bits: first byte of the websocket frame, see websocket RFC at
+ // http://tools.ietf.org/html/rfc6455, section 5.2
+ // data, data_len: payload, with mask (if any) already applied.
+ // Return value:
+ // non-0: keep this websocket connection opened.
+ // 0: close this websocket connection.
+ int (*websocket_data)(struct mg_connection *, int bits,
+ char *data, size_t data_len);
+
+ // Called when mongoose tries to open a file. Used to intercept file open
+ // calls, and serve file data from memory instead.
+ // Parameters:
+ // path: Full path to the file to open.
+ // data_len: Placeholder for the file size, if file is served from memory.
+ // Return value:
+ // NULL: do not serve file from memory, proceed with normal file open.
+ // non-NULL: pointer to the file contents in memory. data_len must be
+ // initilized with the size of the memory block.
+ const char * (*open_file)(const struct mg_connection *,
+ const char *path, size_t *data_len);
+
+ // Called when mongoose is about to serve Lua server page (.lp file), if
+ // Lua support is enabled.
+ // Parameters:
+ // lua_context: "lua_State *" pointer.
+ void (*init_lua)(struct mg_connection *, void *lua_context);
+
+ // Called when mongoose has uploaded a file to a temporary directory as a
+ // result of mg_upload() call.
+ // Parameters:
+ // file_file: full path name to the uploaded file.
+ void (*upload)(struct mg_connection *, const char *file_name);
+
+ // Called when mongoose is about to send HTTP error to the client.
+ // Implementing this callback allows to create custom error pages.
+ // Parameters:
+ // status: HTTP error status code.
+ int (*http_error)(struct mg_connection *, int status);
};
// Start web server.
@@ -151,8 +151,8 @@ struct mg_callbacks {
// Return:
// web server context, or NULL on error.
struct mg_context *mg_start(const struct mg_callbacks *callbacks,
- void *user_data,
- const char **configuration_options);
+ void *user_data,
+ const char **configuration_options);
// Stop the web server.
@@ -191,9 +191,9 @@ const char **mg_get_valid_option_names(void);
// Return:
// 1 on success, 0 on error.
int mg_modify_passwords_file(const char *passwords_file_name,
- const char *domain,
- const char *user,
- const char *password);
+ const char *domain,
+ const char *user,
+ const char *password);
// Return information associated with the request.
@@ -217,16 +217,16 @@ int mg_write(struct mg_connection *, const void *buf, size_t len);
// -1 on error
// >0 number of bytes written on success
int mg_websocket_write(struct mg_connection* conn, int opcode,
- const char *data, size_t data_len);
+ const char *data, size_t data_len);
// 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
};
@@ -253,7 +253,7 @@ enum {
//
// Works exactly like mg_write(), but allows to do message formatting.
int mg_printf(struct mg_connection *,
- PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
+ PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
// Send contents of the entire file together with HTTP headers.
@@ -296,7 +296,7 @@ const char *mg_get_header(const struct mg_connection *, const char *name);
// Destination buffer is guaranteed to be '\0' - terminated if it is not
// NULL or zero length.
int mg_get_var(const char *data, size_t data_len,
- const char *var_name, char *dst, size_t dst_len);
+ const char *var_name, char *dst, size_t dst_len);
// Fetch value of certain cookie variable into the destination buffer.
//
@@ -312,7 +312,7 @@ int mg_get_var(const char *data, size_t data_len,
// -2 (destination buffer is NULL, zero length or too small to hold the
// value).
int mg_get_cookie(const char *cookie, const char *var_name,
- char *buf, size_t buf_len);
+ char *buf, size_t buf_len);
// Download data from the remote web server.
@@ -330,9 +330,9 @@ int mg_get_cookie(const char *cookie, const char *var_name,
// conn = mg_download("google.com", 80, 0, ebuf, sizeof(ebuf),
// "%s", "GET / HTTP/1.0\r\nHost: google.com\r\n\r\n");
struct mg_connection *mg_download(const char *host, int port, int use_ssl,
- char *error_buffer, size_t error_buffer_size,
- PRINTF_FORMAT_STRING(const char *request_fmt),
- ...) PRINTF_ARGS(6, 7);
+ char *error_buffer, size_t error_buffer_size,
+ PRINTF_FORMAT_STRING(const char *request_fmt),
+ ...) PRINTF_ARGS(6, 7);
// Close the connection opened by mg_download().
@@ -366,7 +366,7 @@ const char *mg_version(void);
// http://ftp.ics.uci.edu/pub/ietf/html/rfc1866.txt
// Return: length of the decoded data, or -1 if dst buffer is too small.
int mg_url_decode(const char *src, int src_len, char *dst,
- int dst_len, int is_form_url_encoded);
+ int dst_len, int is_form_url_encoded);
// MD5 hash given strings.
// Buffer 'buf' must be 33 bytes long. Varargs is a NULL terminated list of
diff --git a/src/lib/zlib/adler32.c b/src/lib/zlib/adler32.c
index a868f073d8a..e7ab8c3650b 100644
--- a/src/lib/zlib/adler32.c
+++ b/src/lib/zlib/adler32.c
@@ -27,34 +27,34 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
(thank you to John Reiser for pointing this out) */
# define CHOP(a) \
- do { \
- unsigned long tmp = a >> 16; \
- a &= 0xffffUL; \
- a += (tmp << 4) - tmp; \
- } while (0)
+ do { \
+ unsigned long tmp = a >> 16; \
+ a &= 0xffffUL; \
+ a += (tmp << 4) - tmp; \
+ } while (0)
# define MOD28(a) \
- do { \
- CHOP(a); \
- if (a >= BASE) a -= BASE; \
- } while (0)
+ do { \
+ CHOP(a); \
+ if (a >= BASE) a -= BASE; \
+ } while (0)
# define MOD(a) \
- do { \
- CHOP(a); \
- MOD28(a); \
- } while (0)
+ do { \
+ CHOP(a); \
+ MOD28(a); \
+ } while (0)
# define MOD63(a) \
- do { /* this assumes a is not negative */ \
- z_off64_t tmp = a >> 32; \
- a &= 0xffffffffL; \
- a += (tmp << 8) - (tmp << 5) + tmp; \
- tmp = a >> 16; \
- a &= 0xffffL; \
- a += (tmp << 4) - tmp; \
- tmp = a >> 16; \
- a &= 0xffffL; \
- a += (tmp << 4) - tmp; \
- if (a >= BASE) a -= BASE; \
- } while (0)
+ do { /* this assumes a is not negative */ \
+ z_off64_t tmp = a >> 32; \
+ a &= 0xffffffffL; \
+ a += (tmp << 8) - (tmp << 5) + tmp; \
+ tmp = a >> 16; \
+ a &= 0xffffL; \
+ a += (tmp << 4) - tmp; \
+ tmp = a >> 16; \
+ a &= 0xffffL; \
+ a += (tmp << 4) - tmp; \
+ if (a >= BASE) a -= BASE; \
+ } while (0)
#else
# define MOD(a) a %= BASE
# define MOD28(a) a %= BASE
@@ -63,117 +63,117 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
+ uLong adler;
+ const Bytef *buf;
+ uInt len;
{
- unsigned long sum2;
- unsigned n;
-
- /* split Adler-32 into component sums */
- sum2 = (adler >> 16) & 0xffff;
- adler &= 0xffff;
-
- /* in case user likes doing a byte at a time, keep it fast */
- if (len == 1) {
- adler += buf[0];
- if (adler >= BASE)
- adler -= BASE;
- sum2 += adler;
- if (sum2 >= BASE)
- sum2 -= BASE;
- return adler | (sum2 << 16);
- }
-
- /* initial Adler-32 value (deferred check for len == 1 speed) */
- if (buf == Z_NULL)
- return 1L;
-
- /* in case short lengths are provided, keep it somewhat fast */
- if (len < 16) {
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- if (adler >= BASE)
- adler -= BASE;
- MOD28(sum2); /* only added so many BASE's */
- return adler | (sum2 << 16);
- }
-
- /* do length NMAX blocks -- requires just one modulo operation */
- while (len >= NMAX) {
- len -= NMAX;
- n = NMAX / 16; /* NMAX is divisible by 16 */
- do {
- DO16(buf); /* 16 sums unrolled */
- buf += 16;
- } while (--n);
- MOD(adler);
- MOD(sum2);
- }
-
- /* do remaining bytes (less than NMAX, still just one modulo) */
- if (len) { /* avoid modulos if none remaining */
- while (len >= 16) {
- len -= 16;
- DO16(buf);
- buf += 16;
- }
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- MOD(adler);
- MOD(sum2);
- }
-
- /* return recombined sums */
- return adler | (sum2 << 16);
+ unsigned long sum2;
+ unsigned n;
+
+ /* split Adler-32 into component sums */
+ sum2 = (adler >> 16) & 0xffff;
+ adler &= 0xffff;
+
+ /* in case user likes doing a byte at a time, keep it fast */
+ if (len == 1) {
+ adler += buf[0];
+ if (adler >= BASE)
+ adler -= BASE;
+ sum2 += adler;
+ if (sum2 >= BASE)
+ sum2 -= BASE;
+ return adler | (sum2 << 16);
+ }
+
+ /* initial Adler-32 value (deferred check for len == 1 speed) */
+ if (buf == Z_NULL)
+ return 1L;
+
+ /* in case short lengths are provided, keep it somewhat fast */
+ if (len < 16) {
+ while (len--) {
+ adler += *buf++;
+ sum2 += adler;
+ }
+ if (adler >= BASE)
+ adler -= BASE;
+ MOD28(sum2); /* only added so many BASE's */
+ return adler | (sum2 << 16);
+ }
+
+ /* do length NMAX blocks -- requires just one modulo operation */
+ while (len >= NMAX) {
+ len -= NMAX;
+ n = NMAX / 16; /* NMAX is divisible by 16 */
+ do {
+ DO16(buf); /* 16 sums unrolled */
+ buf += 16;
+ } while (--n);
+ MOD(adler);
+ MOD(sum2);
+ }
+
+ /* do remaining bytes (less than NMAX, still just one modulo) */
+ if (len) { /* avoid modulos if none remaining */
+ while (len >= 16) {
+ len -= 16;
+ DO16(buf);
+ buf += 16;
+ }
+ while (len--) {
+ adler += *buf++;
+ sum2 += adler;
+ }
+ MOD(adler);
+ MOD(sum2);
+ }
+
+ /* return recombined sums */
+ return adler | (sum2 << 16);
}
/* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
+ uLong adler1;
+ uLong adler2;
+ z_off64_t len2;
{
- unsigned long sum1;
- unsigned long sum2;
- unsigned rem;
-
- /* for negative len, return invalid adler32 as a clue for debugging */
- if (len2 < 0)
- return 0xffffffffUL;
-
- /* the derivation of this formula is left as an exercise for the reader */
- MOD63(len2); /* assumes len2 >= 0 */
- rem = (unsigned)len2;
- sum1 = adler1 & 0xffff;
- sum2 = rem * sum1;
- MOD(sum2);
- sum1 += (adler2 & 0xffff) + BASE - 1;
- sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
- if (sum1 >= BASE) sum1 -= BASE;
- if (sum1 >= BASE) sum1 -= BASE;
- if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
- if (sum2 >= BASE) sum2 -= BASE;
- return sum1 | (sum2 << 16);
+ unsigned long sum1;
+ unsigned long sum2;
+ unsigned rem;
+
+ /* for negative len, return invalid adler32 as a clue for debugging */
+ if (len2 < 0)
+ return 0xffffffffUL;
+
+ /* the derivation of this formula is left as an exercise for the reader */
+ MOD63(len2); /* assumes len2 >= 0 */
+ rem = (unsigned)len2;
+ sum1 = adler1 & 0xffff;
+ sum2 = rem * sum1;
+ MOD(sum2);
+ sum1 += (adler2 & 0xffff) + BASE - 1;
+ sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
+ if (sum1 >= BASE) sum1 -= BASE;
+ if (sum1 >= BASE) sum1 -= BASE;
+ if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
+ if (sum2 >= BASE) sum2 -= BASE;
+ return sum1 | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off_t len2;
+ uLong adler1;
+ uLong adler2;
+ z_off_t len2;
{
- return adler32_combine_(adler1, adler2, len2);
+ return adler32_combine_(adler1, adler2, len2);
}
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
+ uLong adler1;
+ uLong adler2;
+ z_off64_t len2;
{
- return adler32_combine_(adler1, adler2, len2);
+ return adler32_combine_(adler1, adler2, len2);
}
diff --git a/src/lib/zlib/compress.c b/src/lib/zlib/compress.c
index 6e9762676a0..c0b65181802 100644
--- a/src/lib/zlib/compress.c
+++ b/src/lib/zlib/compress.c
@@ -20,52 +20,52 @@
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+ int level;
{
- z_stream stream;
- int err;
+ z_stream stream;
+ int err;
- stream.next_in = (z_const Bytef *)source;
- stream.avail_in = (uInt)sourceLen;
+ stream.next_in = (z_const Bytef *)source;
+ stream.avail_in = (uInt)sourceLen;
#ifdef MAXSEG_64K
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
#endif
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+ stream.opaque = (voidpf)0;
- err = deflateInit(&stream, level);
- if (err != Z_OK) return err;
+ err = deflateInit(&stream, level);
+ if (err != Z_OK) return err;
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
+ err = deflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ deflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
- err = deflateEnd(&stream);
- return err;
+ err = deflateEnd(&stream);
+ return err;
}
/* ===========================================================================
*/
int ZEXPORT compress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
{
- return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+ return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
/* ===========================================================================
@@ -73,8 +73,8 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
this function needs to be updated.
*/
uLong ZEXPORT compressBound (sourceLen)
- uLong sourceLen;
+ uLong sourceLen;
{
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
- (sourceLen >> 25) + 13;
+ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
+ (sourceLen >> 25) + 13;
}
diff --git a/src/lib/zlib/crc32.c b/src/lib/zlib/crc32.c
index 979a7190a3c..c423ba9cb1e 100644
--- a/src/lib/zlib/crc32.c
+++ b/src/lib/zlib/crc32.c
@@ -37,10 +37,10 @@
# define BYFOUR
#endif
#ifdef BYFOUR
- local unsigned long crc32_little OF((unsigned long,
- const unsigned char FAR *, unsigned));
- local unsigned long crc32_big OF((unsigned long,
- const unsigned char FAR *, unsigned));
+ local unsigned long crc32_little OF((unsigned long,
+ const unsigned char FAR *, unsigned));
+ local unsigned long crc32_big OF((unsigned long,
+ const unsigned char FAR *, unsigned));
# define TBLS 8
#else
# define TBLS 1
@@ -48,7 +48,7 @@
/* Local functions for crc concatenation */
local unsigned long gf2_matrix_times OF((unsigned long *mat,
- unsigned long vec));
+ unsigned long vec));
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
@@ -59,7 +59,7 @@ local volatile int crc_table_empty = 1;
local z_crc_t FAR crc_table[TBLS][256];
local void make_crc_table OF((void));
#ifdef MAKECRCH
- local void write_table OF((FILE *, const z_crc_t FAR *));
+ local void write_table OF((FILE *, const z_crc_t FAR *));
#endif /* MAKECRCH */
/*
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
@@ -89,91 +89,91 @@ local void make_crc_table OF((void));
*/
local void make_crc_table()
{
- z_crc_t c;
- int n, k;
- z_crc_t poly; /* polynomial exclusive-or pattern */
- /* terms of polynomial defining this crc (except x^32): */
- static volatile int first = 1; /* flag to limit concurrent making */
- static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
-
- /* See if another task is already doing this (not thread-safe, but better
- than nothing -- significantly reduces duration of vulnerability in
- case the advice about DYNAMIC_CRC_TABLE is ignored) */
- if (first) {
- first = 0;
-
- /* make exclusive-or pattern from polynomial (0xedb88320UL) */
- poly = 0;
- for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
- poly |= (z_crc_t)1 << (31 - p[n]);
-
- /* generate a crc for every 8-bit value */
- for (n = 0; n < 256; n++) {
- c = (z_crc_t)n;
- for (k = 0; k < 8; k++)
- c = c & 1 ? poly ^ (c >> 1) : c >> 1;
- crc_table[0][n] = c;
- }
+ z_crc_t c;
+ int n, k;
+ z_crc_t poly; /* polynomial exclusive-or pattern */
+ /* terms of polynomial defining this crc (except x^32): */
+ static volatile int first = 1; /* flag to limit concurrent making */
+ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+ /* See if another task is already doing this (not thread-safe, but better
+ than nothing -- significantly reduces duration of vulnerability in
+ case the advice about DYNAMIC_CRC_TABLE is ignored) */
+ if (first) {
+ first = 0;
+
+ /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+ poly = 0;
+ for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
+ poly |= (z_crc_t)1 << (31 - p[n]);
+
+ /* generate a crc for every 8-bit value */
+ for (n = 0; n < 256; n++) {
+ c = (z_crc_t)n;
+ for (k = 0; k < 8; k++)
+ c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+ crc_table[0][n] = c;
+ }
#ifdef BYFOUR
- /* generate crc for each value followed by one, two, and three zeros,
- and then the byte reversal of those as well as the first table */
- for (n = 0; n < 256; n++) {
- c = crc_table[0][n];
- crc_table[4][n] = ZSWAP32(c);
- for (k = 1; k < 4; k++) {
- c = crc_table[0][c & 0xff] ^ (c >> 8);
- crc_table[k][n] = c;
- crc_table[k + 4][n] = ZSWAP32(c);
- }
- }
+ /* generate crc for each value followed by one, two, and three zeros,
+ and then the byte reversal of those as well as the first table */
+ for (n = 0; n < 256; n++) {
+ c = crc_table[0][n];
+ crc_table[4][n] = ZSWAP32(c);
+ for (k = 1; k < 4; k++) {
+ c = crc_table[0][c & 0xff] ^ (c >> 8);
+ crc_table[k][n] = c;
+ crc_table[k + 4][n] = ZSWAP32(c);
+ }
+ }
#endif /* BYFOUR */
- crc_table_empty = 0;
- }
- else { /* not first */
- /* wait for the other guy to finish (not efficient, but rare) */
- while (crc_table_empty)
- ;
- }
+ crc_table_empty = 0;
+ }
+ else { /* not first */
+ /* wait for the other guy to finish (not efficient, but rare) */
+ while (crc_table_empty)
+ ;
+ }
#ifdef MAKECRCH
- /* write out CRC tables to crc32.h */
- {
- FILE *out;
-
- out = fopen("crc32.h", "w");
- if (out == NULL) return;
- fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
- fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
- fprintf(out, "local const z_crc_t FAR ");
- fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
- write_table(out, crc_table[0]);
+ /* write out CRC tables to crc32.h */
+ {
+ FILE *out;
+
+ out = fopen("crc32.h", "w");
+ if (out == NULL) return;
+ fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
+ fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
+ fprintf(out, "local const z_crc_t FAR ");
+ fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
+ write_table(out, crc_table[0]);
# ifdef BYFOUR
- fprintf(out, "#ifdef BYFOUR\n");
- for (k = 1; k < 8; k++) {
- fprintf(out, " },\n {\n");
- write_table(out, crc_table[k]);
- }
- fprintf(out, "#endif\n");
+ fprintf(out, "#ifdef BYFOUR\n");
+ for (k = 1; k < 8; k++) {
+ fprintf(out, " },\n {\n");
+ write_table(out, crc_table[k]);
+ }
+ fprintf(out, "#endif\n");
# endif /* BYFOUR */
- fprintf(out, " }\n};\n");
- fclose(out);
- }
+ fprintf(out, " }\n};\n");
+ fclose(out);
+ }
#endif /* MAKECRCH */
}
#ifdef MAKECRCH
local void write_table(out, table)
- FILE *out;
- const z_crc_t FAR *table;
+ FILE *out;
+ const z_crc_t FAR *table;
{
- int n;
+ int n;
- for (n = 0; n < 256; n++)
- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
- (unsigned long)(table[n]),
- n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
+ for (n = 0; n < 256; n++)
+ fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
+ (unsigned long)(table[n]),
+ n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
}
#endif /* MAKECRCH */
@@ -190,10 +190,10 @@ local void write_table(out, table)
const z_crc_t FAR * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
+ if (crc_table_empty)
+ make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */
- return (const z_crc_t FAR *)crc_table;
+ return (const z_crc_t FAR *)crc_table;
}
/* ========================================================================= */
@@ -202,121 +202,121 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
/* ========================================================================= */
unsigned long ZEXPORT crc32(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- uInt len;
+ unsigned long crc;
+ const unsigned char FAR *buf;
+ uInt len;
{
- if (buf == Z_NULL) return 0UL;
+ if (buf == Z_NULL) return 0UL;
#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
+ if (crc_table_empty)
+ make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */
#ifdef BYFOUR
- if (sizeof(void *) == sizeof(ptrdiff_t)) {
- z_crc_t endian;
-
- endian = 1;
- if (*((unsigned char *)(&endian)))
- return crc32_little(crc, buf, len);
- else
- return crc32_big(crc, buf, len);
- }
+ if (sizeof(void *) == sizeof(ptrdiff_t)) {
+ z_crc_t endian;
+
+ endian = 1;
+ if (*((unsigned char *)(&endian)))
+ return crc32_little(crc, buf, len);
+ else
+ return crc32_big(crc, buf, len);
+ }
#endif /* BYFOUR */
- crc = crc ^ 0xffffffffUL;
- while (len >= 8) {
- DO8;
- len -= 8;
- }
- if (len) do {
- DO1;
- } while (--len);
- return crc ^ 0xffffffffUL;
+ crc = crc ^ 0xffffffffUL;
+ while (len >= 8) {
+ DO8;
+ len -= 8;
+ }
+ if (len) do {
+ DO1;
+ } while (--len);
+ return crc ^ 0xffffffffUL;
}
#ifdef BYFOUR
/* ========================================================================= */
#define DOLIT4 c ^= *buf4++; \
- c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
- crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
+ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
+ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
/* ========================================================================= */
local unsigned long crc32_little(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
+ unsigned long crc;
+ const unsigned char FAR *buf;
+ unsigned len;
{
- register z_crc_t c;
- register const z_crc_t FAR *buf4;
-
- c = (z_crc_t)crc;
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- len--;
- }
-
- buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
- while (len >= 32) {
- DOLIT32;
- len -= 32;
- }
- while (len >= 4) {
- DOLIT4;
- len -= 4;
- }
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- } while (--len);
- c = ~c;
- return (unsigned long)c;
+ register z_crc_t c;
+ register const z_crc_t FAR *buf4;
+
+ c = (z_crc_t)crc;
+ c = ~c;
+ while (len && ((ptrdiff_t)buf & 3)) {
+ c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+ len--;
+ }
+
+ buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
+ while (len >= 32) {
+ DOLIT32;
+ len -= 32;
+ }
+ while (len >= 4) {
+ DOLIT4;
+ len -= 4;
+ }
+ buf = (const unsigned char FAR *)buf4;
+
+ if (len) do {
+ c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+ } while (--len);
+ c = ~c;
+ return (unsigned long)c;
}
/* ========================================================================= */
#define DOBIG4 c ^= *++buf4; \
- c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
- crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
+ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
+ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
/* ========================================================================= */
local unsigned long crc32_big(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
+ unsigned long crc;
+ const unsigned char FAR *buf;
+ unsigned len;
{
- register z_crc_t c;
- register const z_crc_t FAR *buf4;
-
- c = ZSWAP32((z_crc_t)crc);
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- len--;
- }
-
- buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
- buf4--;
- while (len >= 32) {
- DOBIG32;
- len -= 32;
- }
- while (len >= 4) {
- DOBIG4;
- len -= 4;
- }
- buf4++;
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- } while (--len);
- c = ~c;
- return (unsigned long)(ZSWAP32(c));
+ register z_crc_t c;
+ register const z_crc_t FAR *buf4;
+
+ c = ZSWAP32((z_crc_t)crc);
+ c = ~c;
+ while (len && ((ptrdiff_t)buf & 3)) {
+ c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+ len--;
+ }
+
+ buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
+ buf4--;
+ while (len >= 32) {
+ DOBIG32;
+ len -= 32;
+ }
+ while (len >= 4) {
+ DOBIG4;
+ len -= 4;
+ }
+ buf4++;
+ buf = (const unsigned char FAR *)buf4;
+
+ if (len) do {
+ c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+ } while (--len);
+ c = ~c;
+ return (unsigned long)(ZSWAP32(c));
}
#endif /* BYFOUR */
@@ -325,101 +325,101 @@ local unsigned long crc32_big(crc, buf, len)
/* ========================================================================= */
local unsigned long gf2_matrix_times(mat, vec)
- unsigned long *mat;
- unsigned long vec;
+ unsigned long *mat;
+ unsigned long vec;
{
- unsigned long sum;
-
- sum = 0;
- while (vec) {
- if (vec & 1)
- sum ^= *mat;
- vec >>= 1;
- mat++;
- }
- return sum;
+ unsigned long sum;
+
+ sum = 0;
+ while (vec) {
+ if (vec & 1)
+ sum ^= *mat;
+ vec >>= 1;
+ mat++;
+ }
+ return sum;
}
/* ========================================================================= */
local void gf2_matrix_square(square, mat)
- unsigned long *square;
- unsigned long *mat;
+ unsigned long *square;
+ unsigned long *mat;
{
- int n;
+ int n;
- for (n = 0; n < GF2_DIM; n++)
- square[n] = gf2_matrix_times(mat, mat[n]);
+ for (n = 0; n < GF2_DIM; n++)
+ square[n] = gf2_matrix_times(mat, mat[n]);
}
/* ========================================================================= */
local uLong crc32_combine_(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off64_t len2;
+ uLong crc1;
+ uLong crc2;
+ z_off64_t len2;
{
- int n;
- unsigned long row;
- unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
- unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
-
- /* degenerate case (also disallow negative lengths) */
- if (len2 <= 0)
- return crc1;
-
- /* put operator for one zero bit in odd */
- odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
- row = 1;
- for (n = 1; n < GF2_DIM; n++) {
- odd[n] = row;
- row <<= 1;
- }
-
- /* put operator for two zero bits in even */
- gf2_matrix_square(even, odd);
-
- /* put operator for four zero bits in odd */
- gf2_matrix_square(odd, even);
-
- /* apply len2 zeros to crc1 (first square will put the operator for one
- zero byte, eight zero bits, in even) */
- do {
- /* apply zeros operator for this bit of len2 */
- gf2_matrix_square(even, odd);
- if (len2 & 1)
- crc1 = gf2_matrix_times(even, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- if (len2 == 0)
- break;
-
- /* another iteration of the loop with odd and even swapped */
- gf2_matrix_square(odd, even);
- if (len2 & 1)
- crc1 = gf2_matrix_times(odd, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- } while (len2 != 0);
-
- /* return combined crc */
- crc1 ^= crc2;
- return crc1;
+ int n;
+ unsigned long row;
+ unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
+ unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
+
+ /* degenerate case (also disallow negative lengths) */
+ if (len2 <= 0)
+ return crc1;
+
+ /* put operator for one zero bit in odd */
+ odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
+ row = 1;
+ for (n = 1; n < GF2_DIM; n++) {
+ odd[n] = row;
+ row <<= 1;
+ }
+
+ /* put operator for two zero bits in even */
+ gf2_matrix_square(even, odd);
+
+ /* put operator for four zero bits in odd */
+ gf2_matrix_square(odd, even);
+
+ /* apply len2 zeros to crc1 (first square will put the operator for one
+ zero byte, eight zero bits, in even) */
+ do {
+ /* apply zeros operator for this bit of len2 */
+ gf2_matrix_square(even, odd);
+ if (len2 & 1)
+ crc1 = gf2_matrix_times(even, crc1);
+ len2 >>= 1;
+
+ /* if no more bits set, then done */
+ if (len2 == 0)
+ break;
+
+ /* another iteration of the loop with odd and even swapped */
+ gf2_matrix_square(odd, even);
+ if (len2 & 1)
+ crc1 = gf2_matrix_times(odd, crc1);
+ len2 >>= 1;
+
+ /* if no more bits set, then done */
+ } while (len2 != 0);
+
+ /* return combined crc */
+ crc1 ^= crc2;
+ return crc1;
}
/* ========================================================================= */
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
+ uLong crc1;
+ uLong crc2;
+ z_off_t len2;
{
- return crc32_combine_(crc1, crc2, len2);
+ return crc32_combine_(crc1, crc2, len2);
}
uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off64_t len2;
+ uLong crc1;
+ uLong crc2;
+ z_off64_t len2;
{
- return crc32_combine_(crc1, crc2, len2);
+ return crc32_combine_(crc1, crc2, len2);
}
diff --git a/src/lib/zlib/crc32.h b/src/lib/zlib/crc32.h
index 9e0c7781025..0408f0be026 100644
--- a/src/lib/zlib/crc32.h
+++ b/src/lib/zlib/crc32.h
@@ -4,438 +4,438 @@
local const z_crc_t FAR crc_table[TBLS][256] =
{
- {
- 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
- 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
- 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
- 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
- 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
- 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
- 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
- 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
- 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
- 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
- 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
- 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
- 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
- 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
- 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
- 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
- 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
- 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
- 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
- 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
- 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
- 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
- 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
- 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
- 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
- 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
- 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
- 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
- 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
- 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
- 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
- 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
- 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
- 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
- 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
- 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
- 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
- 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
- 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
- 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
- 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
- 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
- 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
- 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
- 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
- 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
- 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
- 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
- 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
- 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
- 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
- 0x2d02ef8dUL
+ {
+ 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+ 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+ 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+ 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+ 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+ 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+ 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+ 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+ 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+ 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+ 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+ 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+ 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+ 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+ 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+ 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+ 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+ 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+ 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+ 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+ 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+ 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+ 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+ 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+ 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+ 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+ 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+ 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+ 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+ 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+ 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+ 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+ 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+ 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+ 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+ 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+ 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+ 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+ 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+ 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+ 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+ 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+ 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+ 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+ 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+ 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+ 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+ 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+ 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+ 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+ 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+ 0x2d02ef8dUL
#ifdef BYFOUR
- },
- {
- 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
- 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
- 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
- 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
- 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
- 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
- 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
- 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
- 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
- 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
- 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
- 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
- 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
- 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
- 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
- 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
- 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
- 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
- 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
- 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
- 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
- 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
- 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
- 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
- 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
- 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
- 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
- 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
- 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
- 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
- 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
- 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
- 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
- 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
- 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
- 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
- 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
- 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
- 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
- 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
- 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
- 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
- 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
- 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
- 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
- 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
- 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
- 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
- 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
- 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
- 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
- 0x9324fd72UL
- },
- {
- 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
- 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
- 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
- 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
- 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
- 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
- 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
- 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
- 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
- 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
- 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
- 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
- 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
- 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
- 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
- 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
- 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
- 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
- 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
- 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
- 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
- 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
- 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
- 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
- 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
- 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
- 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
- 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
- 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
- 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
- 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
- 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
- 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
- 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
- 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
- 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
- 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
- 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
- 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
- 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
- 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
- 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
- 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
- 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
- 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
- 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
- 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
- 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
- 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
- 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
- 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
- 0xbe9834edUL
- },
- {
- 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
- 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
- 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
- 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
- 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
- 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
- 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
- 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
- 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
- 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
- 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
- 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
- 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
- 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
- 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
- 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
- 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
- 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
- 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
- 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
- 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
- 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
- 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
- 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
- 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
- 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
- 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
- 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
- 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
- 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
- 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
- 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
- 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
- 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
- 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
- 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
- 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
- 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
- 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
- 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
- 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
- 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
- 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
- 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
- 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
- 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
- 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
- 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
- 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
- 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
- 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
- 0xde0506f1UL
- },
- {
- 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
- 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
- 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
- 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
- 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
- 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
- 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
- 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
- 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
- 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
- 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
- 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
- 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
- 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
- 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
- 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
- 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
- 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
- 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
- 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
- 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
- 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
- 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
- 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
- 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
- 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
- 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
- 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
- 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
- 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
- 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
- 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
- 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
- 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
- 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
- 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
- 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
- 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
- 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
- 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
- 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
- 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
- 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
- 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
- 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
- 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
- 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
- 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
- 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
- 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
- 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
- 0x8def022dUL
- },
- {
- 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
- 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
- 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
- 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
- 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
- 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
- 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
- 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
- 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
- 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
- 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
- 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
- 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
- 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
- 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
- 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
- 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
- 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
- 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
- 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
- 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
- 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
- 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
- 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
- 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
- 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
- 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
- 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
- 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
- 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
- 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
- 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
- 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
- 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
- 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
- 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
- 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
- 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
- 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
- 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
- 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
- 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
- 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
- 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
- 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
- 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
- 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
- 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
- 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
- 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
- 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
- 0x72fd2493UL
- },
- {
- 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
- 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
- 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
- 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
- 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
- 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
- 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
- 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
- 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
- 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
- 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
- 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
- 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
- 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
- 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
- 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
- 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
- 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
- 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
- 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
- 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
- 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
- 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
- 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
- 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
- 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
- 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
- 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
- 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
- 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
- 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
- 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
- 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
- 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
- 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
- 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
- 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
- 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
- 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
- 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
- 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
- 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
- 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
- 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
- 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
- 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
- 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
- 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
- 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
- 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
- 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
- 0xed3498beUL
- },
- {
- 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
- 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
- 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
- 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
- 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
- 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
- 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
- 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
- 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
- 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
- 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
- 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
- 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
- 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
- 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
- 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
- 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
- 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
- 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
- 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
- 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
- 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
- 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
- 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
- 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
- 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
- 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
- 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
- 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
- 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
- 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
- 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
- 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
- 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
- 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
- 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
- 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
- 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
- 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
- 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
- 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
- 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
- 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
- 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
- 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
- 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
- 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
- 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
- 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
- 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
- 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
- 0xf10605deUL
+ },
+ {
+ 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
+ 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
+ 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
+ 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
+ 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
+ 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
+ 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
+ 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
+ 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
+ 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
+ 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
+ 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
+ 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
+ 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
+ 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
+ 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
+ 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
+ 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
+ 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
+ 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
+ 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
+ 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
+ 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
+ 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
+ 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
+ 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
+ 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
+ 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
+ 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
+ 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
+ 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
+ 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
+ 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
+ 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
+ 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
+ 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
+ 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
+ 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
+ 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
+ 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
+ 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
+ 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
+ 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
+ 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
+ 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
+ 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
+ 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
+ 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
+ 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
+ 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
+ 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
+ 0x9324fd72UL
+ },
+ {
+ 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
+ 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
+ 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
+ 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
+ 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
+ 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
+ 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
+ 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
+ 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
+ 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
+ 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
+ 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
+ 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
+ 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
+ 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
+ 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
+ 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
+ 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
+ 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
+ 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
+ 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
+ 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
+ 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
+ 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
+ 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
+ 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
+ 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
+ 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
+ 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
+ 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
+ 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
+ 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
+ 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
+ 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
+ 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
+ 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
+ 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
+ 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
+ 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
+ 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
+ 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
+ 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
+ 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
+ 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
+ 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
+ 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
+ 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
+ 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
+ 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
+ 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
+ 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
+ 0xbe9834edUL
+ },
+ {
+ 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
+ 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
+ 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
+ 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
+ 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
+ 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
+ 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
+ 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
+ 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
+ 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
+ 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
+ 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
+ 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
+ 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
+ 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
+ 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
+ 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
+ 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
+ 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
+ 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
+ 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
+ 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
+ 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
+ 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
+ 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
+ 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
+ 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
+ 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
+ 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
+ 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
+ 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
+ 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
+ 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
+ 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
+ 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
+ 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
+ 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
+ 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
+ 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
+ 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
+ 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
+ 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
+ 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
+ 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
+ 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
+ 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
+ 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
+ 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
+ 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
+ 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
+ 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
+ 0xde0506f1UL
+ },
+ {
+ 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
+ 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
+ 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
+ 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
+ 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
+ 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
+ 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
+ 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
+ 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
+ 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
+ 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
+ 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
+ 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
+ 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
+ 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
+ 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
+ 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
+ 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
+ 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
+ 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
+ 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
+ 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
+ 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
+ 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
+ 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
+ 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
+ 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
+ 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
+ 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
+ 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
+ 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
+ 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
+ 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
+ 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
+ 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
+ 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
+ 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
+ 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
+ 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
+ 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
+ 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
+ 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
+ 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
+ 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
+ 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
+ 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
+ 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
+ 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
+ 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
+ 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
+ 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
+ 0x8def022dUL
+ },
+ {
+ 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
+ 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
+ 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
+ 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
+ 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
+ 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
+ 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
+ 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
+ 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
+ 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
+ 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
+ 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
+ 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
+ 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
+ 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
+ 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
+ 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
+ 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
+ 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
+ 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
+ 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
+ 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
+ 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
+ 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
+ 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
+ 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
+ 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
+ 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
+ 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
+ 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
+ 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
+ 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
+ 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
+ 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
+ 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
+ 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
+ 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
+ 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
+ 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
+ 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
+ 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
+ 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
+ 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
+ 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
+ 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
+ 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
+ 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
+ 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
+ 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
+ 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
+ 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
+ 0x72fd2493UL
+ },
+ {
+ 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
+ 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
+ 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
+ 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
+ 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
+ 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
+ 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
+ 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
+ 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
+ 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
+ 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
+ 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
+ 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
+ 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
+ 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
+ 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
+ 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
+ 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
+ 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
+ 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
+ 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
+ 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
+ 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
+ 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
+ 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
+ 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
+ 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
+ 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
+ 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
+ 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
+ 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
+ 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
+ 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
+ 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
+ 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
+ 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
+ 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
+ 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
+ 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
+ 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
+ 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
+ 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
+ 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
+ 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
+ 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
+ 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
+ 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
+ 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
+ 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
+ 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
+ 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
+ 0xed3498beUL
+ },
+ {
+ 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
+ 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
+ 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
+ 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
+ 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
+ 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
+ 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
+ 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
+ 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
+ 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
+ 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
+ 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
+ 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
+ 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
+ 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
+ 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
+ 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
+ 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
+ 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
+ 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
+ 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
+ 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
+ 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
+ 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
+ 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
+ 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
+ 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
+ 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
+ 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
+ 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
+ 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
+ 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
+ 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
+ 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
+ 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
+ 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
+ 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
+ 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
+ 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
+ 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
+ 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
+ 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
+ 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
+ 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
+ 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
+ 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
+ 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
+ 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
+ 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
+ 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
+ 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
+ 0xf10605deUL
#endif
- }
+ }
};
diff --git a/src/lib/zlib/deflate.c b/src/lib/zlib/deflate.c
index 696957705b7..51d7770f987 100644
--- a/src/lib/zlib/deflate.c
+++ b/src/lib/zlib/deflate.c
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
+ " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -64,10 +64,10 @@ const char deflate_copyright[] =
* Function prototypes.
*/
typedef enum {
- need_more, /* block not completed, need more input or more output */
- block_done, /* block flush performed */
- finish_started, /* finish started, need only more output at next deflate */
- finish_done /* finish done, accept no more input or output */
+ need_more, /* block not completed, need more input or more output */
+ block_done, /* block flush performed */
+ finish_started, /* finish started, need only more output at next deflate */
+ finish_done /* finish done, accept no more input or output */
} block_state;
typedef block_state (*compress_func) OF((deflate_state *s, int flush));
@@ -86,15 +86,15 @@ local void putShortMSB OF((deflate_state *s, uInt b));
local void flush_pending OF((z_streamp strm));
local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
#ifdef ASMV
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
+ void match_init OF((void)); /* asm code initialization */
+ uInt longest_match OF((deflate_state *s, IPos cur_match));
#else
local uInt longest_match OF((deflate_state *s, IPos cur_match));
#endif
#ifdef DEBUG
local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
+ int length));
#endif
/* ===========================================================================
@@ -115,11 +115,11 @@ local void check_match OF((deflate_state *s, IPos start, IPos match,
* found for specific files.
*/
typedef struct config_s {
- ush good_length; /* reduce lazy search above this match length */
- ush max_lazy; /* do not perform lazy search above this match length */
- ush nice_length; /* quit search above this match length */
- ush max_chain;
- compress_func func;
+ ush good_length; /* reduce lazy search above this match length */
+ ush max_lazy; /* do not perform lazy search above this match length */
+ ush nice_length; /* quit search above this match length */
+ ush max_chain;
+ compress_func func;
} config;
#ifdef FASTEST
@@ -179,14 +179,14 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
*/
#ifdef FASTEST
#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
+ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+ match_head = s->head[s->ins_h], \
+ s->head[s->ins_h] = (Pos)(str))
#else
#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
+ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+ match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
+ s->head[s->ins_h] = (Pos)(str))
#endif
/* ===========================================================================
@@ -194,356 +194,356 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
* prev[] will be initialized on the fly.
*/
#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+ s->head[s->hash_size-1] = NIL; \
+ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
/* ========================================================================= */
int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
+ z_streamp strm;
+ int level;
+ const char *version;
+ int stream_size;
{
- return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
- Z_DEFAULT_STRATEGY, version, stream_size);
- /* To do: ignore strm->next_in if we use it as window */
+ return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+ Z_DEFAULT_STRATEGY, version, stream_size);
+ /* To do: ignore strm->next_in if we use it as window */
}
/* ========================================================================= */
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
+ version, stream_size)
+ z_streamp strm;
+ int level;
+ int method;
+ int windowBits;
+ int memLevel;
+ int strategy;
+ const char *version;
+ int stream_size;
{
- deflate_state *s;
- int wrap = 1;
- static const char my_version[] = ZLIB_VERSION;
-
- ushf *overlay;
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
- * output size for (length,distance) codes is <= 24 bits.
- */
-
- if (version == Z_NULL || version[0] != my_version[0] ||
- stream_size != sizeof(z_stream)) {
- return Z_VERSION_ERROR;
- }
- if (strm == Z_NULL) return Z_STREAM_ERROR;
-
- strm->msg = Z_NULL;
- if (strm->zalloc == (alloc_func)0) {
+ deflate_state *s;
+ int wrap = 1;
+ static const char my_version[] = ZLIB_VERSION;
+
+ ushf *overlay;
+ /* We overlay pending_buf and d_buf+l_buf. This works since the average
+ * output size for (length,distance) codes is <= 24 bits.
+ */
+
+ if (version == Z_NULL || version[0] != my_version[0] ||
+ stream_size != sizeof(z_stream)) {
+ return Z_VERSION_ERROR;
+ }
+ if (strm == Z_NULL) return Z_STREAM_ERROR;
+
+ strm->msg = Z_NULL;
+ if (strm->zalloc == (alloc_func)0) {
#ifdef Z_SOLO
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
#endif
- }
- if (strm->zfree == (free_func)0)
+ }
+ if (strm->zfree == (free_func)0)
#ifdef Z_SOLO
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- strm->zfree = zcfree;
+ strm->zfree = zcfree;
#endif
#ifdef FASTEST
- if (level != 0) level = 1;
+ if (level != 0) level = 1;
#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
+ if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif
- if (windowBits < 0) { /* suppress zlib wrapper */
- wrap = 0;
- windowBits = -windowBits;
- }
+ if (windowBits < 0) { /* suppress zlib wrapper */
+ wrap = 0;
+ windowBits = -windowBits;
+ }
#ifdef GZIP
- else if (windowBits > 15) {
- wrap = 2; /* write gzip wrapper instead */
- windowBits -= 16;
- }
+ else if (windowBits > 15) {
+ wrap = 2; /* write gzip wrapper instead */
+ windowBits -= 16;
+ }
#endif
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
- strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
- s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
- if (s == Z_NULL) return Z_MEM_ERROR;
- strm->state = (struct internal_state FAR *)s;
- s->strm = strm;
-
- s->wrap = wrap;
- s->gzhead = Z_NULL;
- s->w_bits = windowBits;
- s->w_size = 1 << s->w_bits;
- s->w_mask = s->w_size - 1;
-
- s->hash_bits = memLevel + 7;
- s->hash_size = 1 << s->hash_bits;
- s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
-
- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
- s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
- s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
-
- s->high_water = 0; /* nothing written to s->window yet */
-
- s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
-
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
- s->pending_buf = (uchf *) overlay;
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
-
- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
- s->pending_buf == Z_NULL) {
- s->status = FINISH_STATE;
- strm->msg = ERR_MSG(Z_MEM_ERROR);
- deflateEnd (strm);
- return Z_MEM_ERROR;
- }
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
-
- s->level = level;
- s->strategy = strategy;
- s->method = (Byte)method;
-
- return deflateReset(strm);
+ if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+ windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+ strategy < 0 || strategy > Z_FIXED) {
+ return Z_STREAM_ERROR;
+ }
+ if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
+ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+ if (s == Z_NULL) return Z_MEM_ERROR;
+ strm->state = (struct internal_state FAR *)s;
+ s->strm = strm;
+
+ s->wrap = wrap;
+ s->gzhead = Z_NULL;
+ s->w_bits = windowBits;
+ s->w_size = 1 << s->w_bits;
+ s->w_mask = s->w_size - 1;
+
+ s->hash_bits = memLevel + 7;
+ s->hash_size = 1 << s->hash_bits;
+ s->hash_mask = s->hash_size - 1;
+ s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+
+ s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+ s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
+ s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
+
+ s->high_water = 0; /* nothing written to s->window yet */
+
+ s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+
+ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+ s->pending_buf = (uchf *) overlay;
+ s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+
+ if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+ s->pending_buf == Z_NULL) {
+ s->status = FINISH_STATE;
+ strm->msg = ERR_MSG(Z_MEM_ERROR);
+ deflateEnd (strm);
+ return Z_MEM_ERROR;
+ }
+ s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+ s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+
+ s->level = level;
+ s->strategy = strategy;
+ s->method = (Byte)method;
+
+ return deflateReset(strm);
}
/* ========================================================================= */
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
+ z_streamp strm;
+ const Bytef *dictionary;
+ uInt dictLength;
{
- deflate_state *s;
- uInt str, n;
- int wrap;
- unsigned avail;
- z_const unsigned char *next;
-
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
- return Z_STREAM_ERROR;
- s = strm->state;
- wrap = s->wrap;
- if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
- return Z_STREAM_ERROR;
-
- /* when using zlib wrappers, compute Adler-32 for provided dictionary */
- if (wrap == 1)
- strm->adler = adler32(strm->adler, dictionary, dictLength);
- s->wrap = 0; /* avoid computing Adler-32 in read_buf */
-
- /* if dictionary would fill window, just replace the history */
- if (dictLength >= s->w_size) {
- if (wrap == 0) { /* already empty otherwise */
- CLEAR_HASH(s);
- s->strstart = 0;
- s->block_start = 0L;
- s->insert = 0;
- }
- dictionary += dictLength - s->w_size; /* use the tail */
- dictLength = s->w_size;
- }
-
- /* insert dictionary into window and hash */
- avail = strm->avail_in;
- next = strm->next_in;
- strm->avail_in = dictLength;
- strm->next_in = (z_const Bytef *)dictionary;
- fill_window(s);
- while (s->lookahead >= MIN_MATCH) {
- str = s->strstart;
- n = s->lookahead - (MIN_MATCH-1);
- do {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
+ deflate_state *s;
+ uInt str, n;
+ int wrap;
+ unsigned avail;
+ z_const unsigned char *next;
+
+ if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
+ return Z_STREAM_ERROR;
+ s = strm->state;
+ wrap = s->wrap;
+ if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
+ return Z_STREAM_ERROR;
+
+ /* when using zlib wrappers, compute Adler-32 for provided dictionary */
+ if (wrap == 1)
+ strm->adler = adler32(strm->adler, dictionary, dictLength);
+ s->wrap = 0; /* avoid computing Adler-32 in read_buf */
+
+ /* if dictionary would fill window, just replace the history */
+ if (dictLength >= s->w_size) {
+ if (wrap == 0) { /* already empty otherwise */
+ CLEAR_HASH(s);
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->insert = 0;
+ }
+ dictionary += dictLength - s->w_size; /* use the tail */
+ dictLength = s->w_size;
+ }
+
+ /* insert dictionary into window and hash */
+ avail = strm->avail_in;
+ next = strm->next_in;
+ strm->avail_in = dictLength;
+ strm->next_in = (z_const Bytef *)dictionary;
+ fill_window(s);
+ while (s->lookahead >= MIN_MATCH) {
+ str = s->strstart;
+ n = s->lookahead - (MIN_MATCH-1);
+ do {
+ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
+ s->prev[str & s->w_mask] = s->head[s->ins_h];
#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- } while (--n);
- s->strstart = str;
- s->lookahead = MIN_MATCH-1;
- fill_window(s);
- }
- s->strstart += s->lookahead;
- s->block_start = (long)s->strstart;
- s->insert = s->lookahead;
- s->lookahead = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- strm->next_in = next;
- strm->avail_in = avail;
- s->wrap = wrap;
- return Z_OK;
+ s->head[s->ins_h] = (Pos)str;
+ str++;
+ } while (--n);
+ s->strstart = str;
+ s->lookahead = MIN_MATCH-1;
+ fill_window(s);
+ }
+ s->strstart += s->lookahead;
+ s->block_start = (long)s->strstart;
+ s->insert = s->lookahead;
+ s->lookahead = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ strm->next_in = next;
+ strm->avail_in = avail;
+ s->wrap = wrap;
+ return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflateResetKeep (strm)
- z_streamp strm;
+ z_streamp strm;
{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
- return Z_STREAM_ERROR;
- }
-
- strm->total_in = strm->total_out = 0;
- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
- strm->data_type = Z_UNKNOWN;
-
- s = (deflate_state *)strm->state;
- s->pending = 0;
- s->pending_out = s->pending_buf;
-
- if (s->wrap < 0) {
- s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
- }
- s->status = s->wrap ? INIT_STATE : BUSY_STATE;
- strm->adler =
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL ||
+ strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
+ return Z_STREAM_ERROR;
+ }
+
+ strm->total_in = strm->total_out = 0;
+ strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+ strm->data_type = Z_UNKNOWN;
+
+ s = (deflate_state *)strm->state;
+ s->pending = 0;
+ s->pending_out = s->pending_buf;
+
+ if (s->wrap < 0) {
+ s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
+ }
+ s->status = s->wrap ? INIT_STATE : BUSY_STATE;
+ strm->adler =
#ifdef GZIP
- s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
+ s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
#endif
- adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
+ adler32(0L, Z_NULL, 0);
+ s->last_flush = Z_NO_FLUSH;
- _tr_init(s);
+ _tr_init(s);
- return Z_OK;
+ return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflateReset (strm)
- z_streamp strm;
+ z_streamp strm;
{
- int ret;
+ int ret;
- ret = deflateResetKeep(strm);
- if (ret == Z_OK)
- lm_init(strm->state);
- return ret;
+ ret = deflateResetKeep(strm);
+ if (ret == Z_OK)
+ lm_init(strm->state);
+ return ret;
}
/* ========================================================================= */
int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
- gz_headerp head;
+ z_streamp strm;
+ gz_headerp head;
{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (strm->state->wrap != 2) return Z_STREAM_ERROR;
- strm->state->gzhead = head;
- return Z_OK;
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ if (strm->state->wrap != 2) return Z_STREAM_ERROR;
+ strm->state->gzhead = head;
+ return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflatePending (strm, pending, bits)
- unsigned *pending;
- int *bits;
- z_streamp strm;
+ unsigned *pending;
+ int *bits;
+ z_streamp strm;
{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (pending != Z_NULL)
- *pending = strm->state->pending;
- if (bits != Z_NULL)
- *bits = strm->state->bi_valid;
- return Z_OK;
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ if (pending != Z_NULL)
+ *pending = strm->state->pending;
+ if (bits != Z_NULL)
+ *bits = strm->state->bi_valid;
+ return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
+ z_streamp strm;
+ int bits;
+ int value;
{
- deflate_state *s;
- int put;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
- return Z_BUF_ERROR;
- do {
- put = Buf_size - s->bi_valid;
- if (put > bits)
- put = bits;
- s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
- s->bi_valid += put;
- _tr_flush_bits(s);
- value >>= put;
- bits -= put;
- } while (bits);
- return Z_OK;
+ deflate_state *s;
+ int put;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ s = strm->state;
+ if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
+ return Z_BUF_ERROR;
+ do {
+ put = Buf_size - s->bi_valid;
+ if (put > bits)
+ put = bits;
+ s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
+ s->bi_valid += put;
+ _tr_flush_bits(s);
+ value >>= put;
+ bits -= put;
+ } while (bits);
+ return Z_OK;
}
/* ========================================================================= */
int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
+ z_streamp strm;
+ int level;
+ int strategy;
{
- deflate_state *s;
- compress_func func;
- int err = Z_OK;
+ deflate_state *s;
+ compress_func func;
+ int err = Z_OK;
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ s = strm->state;
#ifdef FASTEST
- if (level != 0) level = 1;
+ if (level != 0) level = 1;
#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
+ if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif
- if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- func = configuration_table[s->level].func;
-
- if ((strategy != s->strategy || func != configuration_table[level].func) &&
- strm->total_in != 0) {
- /* Flush the last buffer: */
- err = deflate(strm, Z_BLOCK);
- if (err == Z_BUF_ERROR && s->pending == 0)
- err = Z_OK;
- }
- if (s->level != level) {
- s->level = level;
- s->max_lazy_match = configuration_table[level].max_lazy;
- s->good_match = configuration_table[level].good_length;
- s->nice_match = configuration_table[level].nice_length;
- s->max_chain_length = configuration_table[level].max_chain;
- }
- s->strategy = strategy;
- return err;
+ if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
+ return Z_STREAM_ERROR;
+ }
+ func = configuration_table[s->level].func;
+
+ if ((strategy != s->strategy || func != configuration_table[level].func) &&
+ strm->total_in != 0) {
+ /* Flush the last buffer: */
+ err = deflate(strm, Z_BLOCK);
+ if (err == Z_BUF_ERROR && s->pending == 0)
+ err = Z_OK;
+ }
+ if (s->level != level) {
+ s->level = level;
+ s->max_lazy_match = configuration_table[level].max_lazy;
+ s->good_match = configuration_table[level].good_length;
+ s->nice_match = configuration_table[level].nice_length;
+ s->max_chain_length = configuration_table[level].max_chain;
+ }
+ s->strategy = strategy;
+ return err;
}
/* ========================================================================= */
int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
- int good_length;
- int max_lazy;
- int nice_length;
- int max_chain;
+ z_streamp strm;
+ int good_length;
+ int max_lazy;
+ int nice_length;
+ int max_chain;
{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- s->good_match = good_length;
- s->max_lazy_match = max_lazy;
- s->nice_match = nice_length;
- s->max_chain_length = max_chain;
- return Z_OK;
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ s = strm->state;
+ s->good_match = good_length;
+ s->max_lazy_match = max_lazy;
+ s->nice_match = nice_length;
+ s->max_chain_length = max_chain;
+ return Z_OK;
}
/* =========================================================================
@@ -564,60 +564,60 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
* allocation.
*/
uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
- uLong sourceLen;
+ z_streamp strm;
+ uLong sourceLen;
{
- deflate_state *s;
- uLong complen, wraplen;
- Bytef *str;
-
- /* conservative upper bound for compressed data */
- complen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
-
- /* if can't get parameters, return conservative bound plus zlib wrapper */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return complen + 6;
-
- /* compute wrapper length */
- s = strm->state;
- switch (s->wrap) {
- case 0: /* raw deflate */
- wraplen = 0;
- break;
- case 1: /* zlib wrapper */
- wraplen = 6 + (s->strstart ? 4 : 0);
- break;
- case 2: /* gzip wrapper */
- wraplen = 18;
- if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
- if (s->gzhead->extra != Z_NULL)
- wraplen += 2 + s->gzhead->extra_len;
- str = s->gzhead->name;
- if (str != Z_NULL)
- do {
- wraplen++;
- } while (*str++);
- str = s->gzhead->comment;
- if (str != Z_NULL)
- do {
- wraplen++;
- } while (*str++);
- if (s->gzhead->hcrc)
- wraplen += 2;
- }
- break;
- default: /* for compiler happiness */
- wraplen = 6;
- }
-
- /* if not default parameters, return conservative bound */
- if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return complen + wraplen;
-
- /* default settings: return tight bound for that case */
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
- (sourceLen >> 25) + 13 - 6 + wraplen;
+ deflate_state *s;
+ uLong complen, wraplen;
+ Bytef *str;
+
+ /* conservative upper bound for compressed data */
+ complen = sourceLen +
+ ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
+
+ /* if can't get parameters, return conservative bound plus zlib wrapper */
+ if (strm == Z_NULL || strm->state == Z_NULL)
+ return complen + 6;
+
+ /* compute wrapper length */
+ s = strm->state;
+ switch (s->wrap) {
+ case 0: /* raw deflate */
+ wraplen = 0;
+ break;
+ case 1: /* zlib wrapper */
+ wraplen = 6 + (s->strstart ? 4 : 0);
+ break;
+ case 2: /* gzip wrapper */
+ wraplen = 18;
+ if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
+ if (s->gzhead->extra != Z_NULL)
+ wraplen += 2 + s->gzhead->extra_len;
+ str = s->gzhead->name;
+ if (str != Z_NULL)
+ do {
+ wraplen++;
+ } while (*str++);
+ str = s->gzhead->comment;
+ if (str != Z_NULL)
+ do {
+ wraplen++;
+ } while (*str++);
+ if (s->gzhead->hcrc)
+ wraplen += 2;
+ }
+ break;
+ default: /* for compiler happiness */
+ wraplen = 6;
+ }
+
+ /* if not default parameters, return conservative bound */
+ if (s->w_bits != 15 || s->hash_bits != 8 + 7)
+ return complen + wraplen;
+
+ /* default settings: return tight bound for that case */
+ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
+ (sourceLen >> 25) + 13 - 6 + wraplen;
}
/* =========================================================================
@@ -626,11 +626,11 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
* pending_buf.
*/
local void putShortMSB (s, b)
- deflate_state *s;
- uInt b;
+ deflate_state *s;
+ uInt b;
{
- put_byte(s, (Byte)(b >> 8));
- put_byte(s, (Byte)(b & 0xff));
+ put_byte(s, (Byte)(b >> 8));
+ put_byte(s, (Byte)(b & 0xff));
}
/* =========================================================================
@@ -640,370 +640,370 @@ local void putShortMSB (s, b)
* (See also read_buf()).
*/
local void flush_pending(strm)
- z_streamp strm;
+ z_streamp strm;
{
- unsigned len;
- deflate_state *s = strm->state;
-
- _tr_flush_bits(s);
- len = s->pending;
- if (len > strm->avail_out) len = strm->avail_out;
- if (len == 0) return;
-
- zmemcpy(strm->next_out, s->pending_out, len);
- strm->next_out += len;
- s->pending_out += len;
- strm->total_out += len;
- strm->avail_out -= len;
- s->pending -= len;
- if (s->pending == 0) {
- s->pending_out = s->pending_buf;
- }
+ unsigned len;
+ deflate_state *s = strm->state;
+
+ _tr_flush_bits(s);
+ len = s->pending;
+ if (len > strm->avail_out) len = strm->avail_out;
+ if (len == 0) return;
+
+ zmemcpy(strm->next_out, s->pending_out, len);
+ strm->next_out += len;
+ s->pending_out += len;
+ strm->total_out += len;
+ strm->avail_out -= len;
+ s->pending -= len;
+ if (s->pending == 0) {
+ s->pending_out = s->pending_buf;
+ }
}
/* ========================================================================= */
int ZEXPORT deflate (strm, flush)
- z_streamp strm;
- int flush;
+ z_streamp strm;
+ int flush;
{
- int old_flush; /* value of flush param for previous deflate call */
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- flush > Z_BLOCK || flush < 0) {
- return Z_STREAM_ERROR;
- }
- s = strm->state;
-
- if (strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0) ||
- (s->status == FINISH_STATE && flush != Z_FINISH)) {
- ERR_RETURN(strm, Z_STREAM_ERROR);
- }
- if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
-
- s->strm = strm; /* just in case */
- old_flush = s->last_flush;
- s->last_flush = flush;
-
- /* Write the header */
- if (s->status == INIT_STATE) {
+ int old_flush; /* value of flush param for previous deflate call */
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL ||
+ flush > Z_BLOCK || flush < 0) {
+ return Z_STREAM_ERROR;
+ }
+ s = strm->state;
+
+ if (strm->next_out == Z_NULL ||
+ (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+ (s->status == FINISH_STATE && flush != Z_FINISH)) {
+ ERR_RETURN(strm, Z_STREAM_ERROR);
+ }
+ if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+
+ s->strm = strm; /* just in case */
+ old_flush = s->last_flush;
+ s->last_flush = flush;
+
+ /* Write the header */
+ if (s->status == INIT_STATE) {
#ifdef GZIP
- if (s->wrap == 2) {
- strm->adler = crc32(0L, Z_NULL, 0);
- put_byte(s, 31);
- put_byte(s, 139);
- put_byte(s, 8);
- if (s->gzhead == Z_NULL) {
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, OS_CODE);
- s->status = BUSY_STATE;
- }
- else {
- put_byte(s, (s->gzhead->text ? 1 : 0) +
- (s->gzhead->hcrc ? 2 : 0) +
- (s->gzhead->extra == Z_NULL ? 0 : 4) +
- (s->gzhead->name == Z_NULL ? 0 : 8) +
- (s->gzhead->comment == Z_NULL ? 0 : 16)
- );
- put_byte(s, (Byte)(s->gzhead->time & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, s->gzhead->os & 0xff);
- if (s->gzhead->extra != Z_NULL) {
- put_byte(s, s->gzhead->extra_len & 0xff);
- put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
- }
- if (s->gzhead->hcrc)
- strm->adler = crc32(strm->adler, s->pending_buf,
- s->pending);
- s->gzindex = 0;
- s->status = EXTRA_STATE;
- }
- }
- else
+ if (s->wrap == 2) {
+ strm->adler = crc32(0L, Z_NULL, 0);
+ put_byte(s, 31);
+ put_byte(s, 139);
+ put_byte(s, 8);
+ if (s->gzhead == Z_NULL) {
+ put_byte(s, 0);
+ put_byte(s, 0);
+ put_byte(s, 0);
+ put_byte(s, 0);
+ put_byte(s, 0);
+ put_byte(s, s->level == 9 ? 2 :
+ (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
+ 4 : 0));
+ put_byte(s, OS_CODE);
+ s->status = BUSY_STATE;
+ }
+ else {
+ put_byte(s, (s->gzhead->text ? 1 : 0) +
+ (s->gzhead->hcrc ? 2 : 0) +
+ (s->gzhead->extra == Z_NULL ? 0 : 4) +
+ (s->gzhead->name == Z_NULL ? 0 : 8) +
+ (s->gzhead->comment == Z_NULL ? 0 : 16)
+ );
+ put_byte(s, (Byte)(s->gzhead->time & 0xff));
+ put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
+ put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
+ put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
+ put_byte(s, s->level == 9 ? 2 :
+ (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
+ 4 : 0));
+ put_byte(s, s->gzhead->os & 0xff);
+ if (s->gzhead->extra != Z_NULL) {
+ put_byte(s, s->gzhead->extra_len & 0xff);
+ put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
+ }
+ if (s->gzhead->hcrc)
+ strm->adler = crc32(strm->adler, s->pending_buf,
+ s->pending);
+ s->gzindex = 0;
+ s->status = EXTRA_STATE;
+ }
+ }
+ else
#endif
- {
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
- uInt level_flags;
-
- if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
- level_flags = 0;
- else if (s->level < 6)
- level_flags = 1;
- else if (s->level == 6)
- level_flags = 2;
- else
- level_flags = 3;
- header |= (level_flags << 6);
- if (s->strstart != 0) header |= PRESET_DICT;
- header += 31 - (header % 31);
-
- s->status = BUSY_STATE;
- putShortMSB(s, header);
-
- /* Save the adler32 of the preset dictionary: */
- if (s->strstart != 0) {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- strm->adler = adler32(0L, Z_NULL, 0);
- }
- }
+ {
+ uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+ uInt level_flags;
+
+ if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
+ level_flags = 0;
+ else if (s->level < 6)
+ level_flags = 1;
+ else if (s->level == 6)
+ level_flags = 2;
+ else
+ level_flags = 3;
+ header |= (level_flags << 6);
+ if (s->strstart != 0) header |= PRESET_DICT;
+ header += 31 - (header % 31);
+
+ s->status = BUSY_STATE;
+ putShortMSB(s, header);
+
+ /* Save the adler32 of the preset dictionary: */
+ if (s->strstart != 0) {
+ putShortMSB(s, (uInt)(strm->adler >> 16));
+ putShortMSB(s, (uInt)(strm->adler & 0xffff));
+ }
+ strm->adler = adler32(0L, Z_NULL, 0);
+ }
+ }
#ifdef GZIP
- if (s->status == EXTRA_STATE) {
- if (s->gzhead->extra != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
-
- while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size)
- break;
- }
- put_byte(s, s->gzhead->extra[s->gzindex]);
- s->gzindex++;
- }
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (s->gzindex == s->gzhead->extra_len) {
- s->gzindex = 0;
- s->status = NAME_STATE;
- }
- }
- else
- s->status = NAME_STATE;
- }
- if (s->status == NAME_STATE) {
- if (s->gzhead->name != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->name[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0) {
- s->gzindex = 0;
- s->status = COMMENT_STATE;
- }
- }
- else
- s->status = COMMENT_STATE;
- }
- if (s->status == COMMENT_STATE) {
- if (s->gzhead->comment != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->comment[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0)
- s->status = HCRC_STATE;
- }
- else
- s->status = HCRC_STATE;
- }
- if (s->status == HCRC_STATE) {
- if (s->gzhead->hcrc) {
- if (s->pending + 2 > s->pending_buf_size)
- flush_pending(strm);
- if (s->pending + 2 <= s->pending_buf_size) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- strm->adler = crc32(0L, Z_NULL, 0);
- s->status = BUSY_STATE;
- }
- }
- else
- s->status = BUSY_STATE;
- }
+ if (s->status == EXTRA_STATE) {
+ if (s->gzhead->extra != Z_NULL) {
+ uInt beg = s->pending; /* start of bytes to update crc */
+
+ while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
+ if (s->pending == s->pending_buf_size) {
+ if (s->gzhead->hcrc && s->pending > beg)
+ strm->adler = crc32(strm->adler, s->pending_buf + beg,
+ s->pending - beg);
+ flush_pending(strm);
+ beg = s->pending;
+ if (s->pending == s->pending_buf_size)
+ break;
+ }
+ put_byte(s, s->gzhead->extra[s->gzindex]);
+ s->gzindex++;
+ }
+ if (s->gzhead->hcrc && s->pending > beg)
+ strm->adler = crc32(strm->adler, s->pending_buf + beg,
+ s->pending - beg);
+ if (s->gzindex == s->gzhead->extra_len) {
+ s->gzindex = 0;
+ s->status = NAME_STATE;
+ }
+ }
+ else
+ s->status = NAME_STATE;
+ }
+ if (s->status == NAME_STATE) {
+ if (s->gzhead->name != Z_NULL) {
+ uInt beg = s->pending; /* start of bytes to update crc */
+ int val;
+
+ do {
+ if (s->pending == s->pending_buf_size) {
+ if (s->gzhead->hcrc && s->pending > beg)
+ strm->adler = crc32(strm->adler, s->pending_buf + beg,
+ s->pending - beg);
+ flush_pending(strm);
+ beg = s->pending;
+ if (s->pending == s->pending_buf_size) {
+ val = 1;
+ break;
+ }
+ }
+ val = s->gzhead->name[s->gzindex++];
+ put_byte(s, val);
+ } while (val != 0);
+ if (s->gzhead->hcrc && s->pending > beg)
+ strm->adler = crc32(strm->adler, s->pending_buf + beg,
+ s->pending - beg);
+ if (val == 0) {
+ s->gzindex = 0;
+ s->status = COMMENT_STATE;
+ }
+ }
+ else
+ s->status = COMMENT_STATE;
+ }
+ if (s->status == COMMENT_STATE) {
+ if (s->gzhead->comment != Z_NULL) {
+ uInt beg = s->pending; /* start of bytes to update crc */
+ int val;
+
+ do {
+ if (s->pending == s->pending_buf_size) {
+ if (s->gzhead->hcrc && s->pending > beg)
+ strm->adler = crc32(strm->adler, s->pending_buf + beg,
+ s->pending - beg);
+ flush_pending(strm);
+ beg = s->pending;
+ if (s->pending == s->pending_buf_size) {
+ val = 1;
+ break;
+ }
+ }
+ val = s->gzhead->comment[s->gzindex++];
+ put_byte(s, val);
+ } while (val != 0);
+ if (s->gzhead->hcrc && s->pending > beg)
+ strm->adler = crc32(strm->adler, s->pending_buf + beg,
+ s->pending - beg);
+ if (val == 0)
+ s->status = HCRC_STATE;
+ }
+ else
+ s->status = HCRC_STATE;
+ }
+ if (s->status == HCRC_STATE) {
+ if (s->gzhead->hcrc) {
+ if (s->pending + 2 > s->pending_buf_size)
+ flush_pending(strm);
+ if (s->pending + 2 <= s->pending_buf_size) {
+ put_byte(s, (Byte)(strm->adler & 0xff));
+ put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
+ strm->adler = crc32(0L, Z_NULL, 0);
+ s->status = BUSY_STATE;
+ }
+ }
+ else
+ s->status = BUSY_STATE;
+ }
#endif
- /* Flush as much pending output as possible */
- if (s->pending != 0) {
- flush_pending(strm);
- if (strm->avail_out == 0) {
- /* Since avail_out is 0, deflate will be called again with
- * more output space, but possibly with both pending and
- * avail_in equal to zero. There won't be anything to do,
- * but this is not an error situation so make sure we
- * return OK instead of BUF_ERROR at next call of deflate:
- */
- s->last_flush = -1;
- return Z_OK;
- }
-
- /* Make sure there is something to do and avoid duplicate consecutive
- * flushes. For repeated and useless calls with Z_FINISH, we keep
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
- */
- } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
- flush != Z_FINISH) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* User must not provide more input after the first FINISH: */
- if (s->status == FINISH_STATE && strm->avail_in != 0) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* Start a new block or continue the current one.
- */
- if (strm->avail_in != 0 || s->lookahead != 0 ||
- (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
- block_state bstate;
-
- bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
- (s->strategy == Z_RLE ? deflate_rle(s, flush) :
- (*(configuration_table[s->level].func))(s, flush));
-
- if (bstate == finish_started || bstate == finish_done) {
- s->status = FINISH_STATE;
- }
- if (bstate == need_more || bstate == finish_started) {
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
- }
- return Z_OK;
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
- * of deflate should use the same flush parameter to make sure
- * that the flush is complete. So we don't have to output an
- * empty block here, this will be done at next call. This also
- * ensures that for a very small output buffer, we emit at most
- * one empty block.
- */
- }
- if (bstate == block_done) {
- if (flush == Z_PARTIAL_FLUSH) {
- _tr_align(s);
- } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
- /* For a full flush, this empty block will be recognized
- * as a special marker by inflate_sync().
- */
- if (flush == Z_FULL_FLUSH) {
- CLEAR_HASH(s); /* forget history */
- if (s->lookahead == 0) {
- s->strstart = 0;
- s->block_start = 0L;
- s->insert = 0;
- }
- }
- }
- flush_pending(strm);
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
- return Z_OK;
- }
- }
- }
- Assert(strm->avail_out > 0, "bug2");
-
- if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
-
- /* Write the trailer */
+ /* Flush as much pending output as possible */
+ if (s->pending != 0) {
+ flush_pending(strm);
+ if (strm->avail_out == 0) {
+ /* Since avail_out is 0, deflate will be called again with
+ * more output space, but possibly with both pending and
+ * avail_in equal to zero. There won't be anything to do,
+ * but this is not an error situation so make sure we
+ * return OK instead of BUF_ERROR at next call of deflate:
+ */
+ s->last_flush = -1;
+ return Z_OK;
+ }
+
+ /* Make sure there is something to do and avoid duplicate consecutive
+ * flushes. For repeated and useless calls with Z_FINISH, we keep
+ * returning Z_STREAM_END instead of Z_BUF_ERROR.
+ */
+ } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
+ flush != Z_FINISH) {
+ ERR_RETURN(strm, Z_BUF_ERROR);
+ }
+
+ /* User must not provide more input after the first FINISH: */
+ if (s->status == FINISH_STATE && strm->avail_in != 0) {
+ ERR_RETURN(strm, Z_BUF_ERROR);
+ }
+
+ /* Start a new block or continue the current one.
+ */
+ if (strm->avail_in != 0 || s->lookahead != 0 ||
+ (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+ block_state bstate;
+
+ bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
+ (s->strategy == Z_RLE ? deflate_rle(s, flush) :
+ (*(configuration_table[s->level].func))(s, flush));
+
+ if (bstate == finish_started || bstate == finish_done) {
+ s->status = FINISH_STATE;
+ }
+ if (bstate == need_more || bstate == finish_started) {
+ if (strm->avail_out == 0) {
+ s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+ }
+ return Z_OK;
+ /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+ * of deflate should use the same flush parameter to make sure
+ * that the flush is complete. So we don't have to output an
+ * empty block here, this will be done at next call. This also
+ * ensures that for a very small output buffer, we emit at most
+ * one empty block.
+ */
+ }
+ if (bstate == block_done) {
+ if (flush == Z_PARTIAL_FLUSH) {
+ _tr_align(s);
+ } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
+ _tr_stored_block(s, (char*)0, 0L, 0);
+ /* For a full flush, this empty block will be recognized
+ * as a special marker by inflate_sync().
+ */
+ if (flush == Z_FULL_FLUSH) {
+ CLEAR_HASH(s); /* forget history */
+ if (s->lookahead == 0) {
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->insert = 0;
+ }
+ }
+ }
+ flush_pending(strm);
+ if (strm->avail_out == 0) {
+ s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+ return Z_OK;
+ }
+ }
+ }
+ Assert(strm->avail_out > 0, "bug2");
+
+ if (flush != Z_FINISH) return Z_OK;
+ if (s->wrap <= 0) return Z_STREAM_END;
+
+ /* Write the trailer */
#ifdef GZIP
- if (s->wrap == 2) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
- put_byte(s, (Byte)(strm->total_in & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
- }
- else
+ if (s->wrap == 2) {
+ put_byte(s, (Byte)(strm->adler & 0xff));
+ put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
+ put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
+ put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
+ put_byte(s, (Byte)(strm->total_in & 0xff));
+ put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
+ put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
+ put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
+ }
+ else
#endif
- {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- flush_pending(strm);
- /* If avail_out is zero, the application will call deflate again
- * to flush the rest.
- */
- if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
+ {
+ putShortMSB(s, (uInt)(strm->adler >> 16));
+ putShortMSB(s, (uInt)(strm->adler & 0xffff));
+ }
+ flush_pending(strm);
+ /* If avail_out is zero, the application will call deflate again
+ * to flush the rest.
+ */
+ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
+ return s->pending != 0 ? Z_OK : Z_STREAM_END;
}
/* ========================================================================= */
int ZEXPORT deflateEnd (strm)
- z_streamp strm;
+ z_streamp strm;
{
- int status;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
-
- status = strm->state->status;
- if (status != INIT_STATE &&
- status != EXTRA_STATE &&
- status != NAME_STATE &&
- status != COMMENT_STATE &&
- status != HCRC_STATE &&
- status != BUSY_STATE &&
- status != FINISH_STATE) {
- return Z_STREAM_ERROR;
- }
-
- /* Deallocate in reverse order of allocations: */
- TRY_FREE(strm, strm->state->pending_buf);
- TRY_FREE(strm, strm->state->head);
- TRY_FREE(strm, strm->state->prev);
- TRY_FREE(strm, strm->state->window);
-
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
-
- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+ int status;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+
+ status = strm->state->status;
+ if (status != INIT_STATE &&
+ status != EXTRA_STATE &&
+ status != NAME_STATE &&
+ status != COMMENT_STATE &&
+ status != HCRC_STATE &&
+ status != BUSY_STATE &&
+ status != FINISH_STATE) {
+ return Z_STREAM_ERROR;
+ }
+
+ /* Deallocate in reverse order of allocations: */
+ TRY_FREE(strm, strm->state->pending_buf);
+ TRY_FREE(strm, strm->state->head);
+ TRY_FREE(strm, strm->state->prev);
+ TRY_FREE(strm, strm->state->window);
+
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+
+ return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
}
/* =========================================================================
@@ -1012,57 +1012,57 @@ int ZEXPORT deflateEnd (strm)
* doesn't have enough memory anyway to duplicate compression states).
*/
int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
+ z_streamp dest;
+ z_streamp source;
{
#ifdef MAXSEG_64K
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- deflate_state *ds;
- deflate_state *ss;
- ushf *overlay;
-
-
- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
- return Z_STREAM_ERROR;
- }
-
- ss = source->state;
-
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
-
- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
- if (ds == Z_NULL) return Z_MEM_ERROR;
- dest->state = (struct internal_state FAR *) ds;
- zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
- ds->strm = dest;
-
- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
- ds->pending_buf = (uchf *) overlay;
-
- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
- ds->pending_buf == Z_NULL) {
- deflateEnd (dest);
- return Z_MEM_ERROR;
- }
- /* following zmemcpy do not work for 16-bit MSDOS */
- zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
- zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
- zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
-
- ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
-
- ds->l_desc.dyn_tree = ds->dyn_ltree;
- ds->d_desc.dyn_tree = ds->dyn_dtree;
- ds->bl_desc.dyn_tree = ds->bl_tree;
-
- return Z_OK;
+ deflate_state *ds;
+ deflate_state *ss;
+ ushf *overlay;
+
+
+ if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+ return Z_STREAM_ERROR;
+ }
+
+ ss = source->state;
+
+ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
+
+ ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+ if (ds == Z_NULL) return Z_MEM_ERROR;
+ dest->state = (struct internal_state FAR *) ds;
+ zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
+ ds->strm = dest;
+
+ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+ ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
+ ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
+ overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+ ds->pending_buf = (uchf *) overlay;
+
+ if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+ ds->pending_buf == Z_NULL) {
+ deflateEnd (dest);
+ return Z_MEM_ERROR;
+ }
+ /* following zmemcpy do not work for 16-bit MSDOS */
+ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+ zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
+ zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
+ zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+
+ ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+ ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+ ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+
+ ds->l_desc.dyn_tree = ds->dyn_ltree;
+ ds->d_desc.dyn_tree = ds->dyn_dtree;
+ ds->bl_desc.dyn_tree = ds->bl_tree;
+
+ return Z_OK;
#endif /* MAXSEG_64K */
}
@@ -1074,59 +1074,59 @@ int ZEXPORT deflateCopy (dest, source)
* (See also flush_pending()).
*/
local int read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
+ z_streamp strm;
+ Bytef *buf;
+ unsigned size;
{
- unsigned len = strm->avail_in;
+ unsigned len = strm->avail_in;
- if (len > size) len = size;
- if (len == 0) return 0;
+ if (len > size) len = size;
+ if (len == 0) return 0;
- strm->avail_in -= len;
+ strm->avail_in -= len;
- zmemcpy(buf, strm->next_in, len);
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, buf, len);
- }
+ zmemcpy(buf, strm->next_in, len);
+ if (strm->state->wrap == 1) {
+ strm->adler = adler32(strm->adler, buf, len);
+ }
#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, buf, len);
- }
+ else if (strm->state->wrap == 2) {
+ strm->adler = crc32(strm->adler, buf, len);
+ }
#endif
- strm->next_in += len;
- strm->total_in += len;
+ strm->next_in += len;
+ strm->total_in += len;
- return (int)len;
+ return (int)len;
}
/* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream
*/
local void lm_init (s)
- deflate_state *s;
+ deflate_state *s;
{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->insert = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
+ s->window_size = (ulg)2L*s->w_size;
+
+ CLEAR_HASH(s);
+
+ /* Set the default configuration parameters:
+ */
+ s->max_lazy_match = configuration_table[s->level].max_lazy;
+ s->good_match = configuration_table[s->level].good_length;
+ s->nice_match = configuration_table[s->level].nice_length;
+ s->max_chain_length = configuration_table[s->level].max_chain;
+
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->lookahead = 0;
+ s->insert = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ s->ins_h = 0;
#ifndef FASTEST
#ifdef ASMV
- match_init(); /* initialize the asm code */
+ match_init(); /* initialize the asm code */
#endif
#endif
}
@@ -1146,146 +1146,146 @@ local void lm_init (s)
* match.S. The code will be functionally equivalent.
*/
local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
+ deflate_state *s;
+ IPos cur_match; /* current match */
{
- unsigned chain_length = s->max_chain_length;/* max hash chain length */
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- int best_len = s->prev_length; /* best match length so far */
- int nice_match = s->nice_match; /* stop if match long enough */
- IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
- s->strstart - (IPos)MAX_DIST(s) : NIL;
- /* Stop when cur_match becomes <= limit. To simplify the code,
- * we prevent matches with the string of window index 0.
- */
- Posf *prev = s->prev;
- uInt wmask = s->w_mask;
+ unsigned chain_length = s->max_chain_length;/* max hash chain length */
+ register Bytef *scan = s->window + s->strstart; /* current string */
+ register Bytef *match; /* matched string */
+ register int len; /* length of current match */
+ int best_len = s->prev_length; /* best match length so far */
+ int nice_match = s->nice_match; /* stop if match long enough */
+ IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+ s->strstart - (IPos)MAX_DIST(s) : NIL;
+ /* Stop when cur_match becomes <= limit. To simplify the code,
+ * we prevent matches with the string of window index 0.
+ */
+ Posf *prev = s->prev;
+ uInt wmask = s->w_mask;
#ifdef UNALIGNED_OK
- /* Compare two bytes at a time. Note: this is not always beneficial.
- * Try with and without -DUNALIGNED_OK to check.
- */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
+ /* Compare two bytes at a time. Note: this is not always beneficial.
+ * Try with and without -DUNALIGNED_OK to check.
+ */
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+ register ush scan_start = *(ushf*)scan;
+ register ush scan_end = *(ushf*)(scan+best_len-1);
#else
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
- register Byte scan_end = scan[best_len];
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+ register Byte scan_end1 = scan[best_len-1];
+ register Byte scan_end = scan[best_len];
#endif
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- /* Do not waste too much time if we already have a good match: */
- if (s->prev_length >= s->good_match) {
- chain_length >>= 2;
- }
- /* Do not look for matches beyond the end of the input. This is necessary
- * to make deflate deterministic.
- */
- if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- do {
- Assert(cur_match < s->strstart, "no future");
- match = s->window + cur_match;
-
- /* Skip to next match if the match length cannot increase
- * or if the match length is less than 2. Note that the checks below
- * for insufficient lookahead only occur occasionally for performance
- * reasons. Therefore uninitialized memory will be accessed, and
- * conditional jumps will be made that depend on those values.
- * However the length of the match is limited to the lookahead, so
- * the output of deflate is not affected by the uninitialized values.
- */
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+ /* Do not waste too much time if we already have a good match: */
+ if (s->prev_length >= s->good_match) {
+ chain_length >>= 2;
+ }
+ /* Do not look for matches beyond the end of the input. This is necessary
+ * to make deflate deterministic.
+ */
+ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+ do {
+ Assert(cur_match < s->strstart, "no future");
+ match = s->window + cur_match;
+
+ /* Skip to next match if the match length cannot increase
+ * or if the match length is less than 2. Note that the checks below
+ * for insufficient lookahead only occur occasionally for performance
+ * reasons. Therefore uninitialized memory will be accessed, and
+ * conditional jumps will be made that depend on those values.
+ * However the length of the match is limited to the lookahead, so
+ * the output of deflate is not affected by the uninitialized values.
+ */
#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
- /* This code assumes sizeof(unsigned short) == 2. Do not use
- * UNALIGNED_OK if your compiler uses a different size.
- */
- if (*(ushf*)(match+best_len-1) != scan_end ||
- *(ushf*)match != scan_start) continue;
-
- /* It is not necessary to compare scan[2] and match[2] since they are
- * always equal when the other bytes match, given that the hash keys
- * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
- * lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
- * necessary to put more guard bytes at the end of the window, or
- * to check more often for insufficient lookahead.
- */
- Assert(scan[2] == match[2], "scan[2]?");
- scan++, match++;
- do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- scan < strend);
- /* The funny "do {}" generates better code on most compilers */
-
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
- if (*scan == *match) scan++;
-
- len = (MAX_MATCH - 1) - (int)(strend-scan);
- scan = strend - (MAX_MATCH-1);
+ /* This code assumes sizeof(unsigned short) == 2. Do not use
+ * UNALIGNED_OK if your compiler uses a different size.
+ */
+ if (*(ushf*)(match+best_len-1) != scan_end ||
+ *(ushf*)match != scan_start) continue;
+
+ /* It is not necessary to compare scan[2] and match[2] since they are
+ * always equal when the other bytes match, given that the hash keys
+ * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+ * strstart+3, +5, ... up to strstart+257. We check for insufficient
+ * lookahead only every 4th comparison; the 128th check will be made
+ * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+ * necessary to put more guard bytes at the end of the window, or
+ * to check more often for insufficient lookahead.
+ */
+ Assert(scan[2] == match[2], "scan[2]?");
+ scan++, match++;
+ do {
+ } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ scan < strend);
+ /* The funny "do {}" generates better code on most compilers */
+
+ /* Here, scan <= window+strstart+257 */
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ if (*scan == *match) scan++;
+
+ len = (MAX_MATCH - 1) - (int)(strend-scan);
+ scan = strend - (MAX_MATCH-1);
#else /* UNALIGNED_OK */
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match++;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
- scan = strend - MAX_MATCH;
+ if (match[best_len] != scan_end ||
+ match[best_len-1] != scan_end1 ||
+ *match != *scan ||
+ *++match != scan[1]) continue;
+
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match++;
+ Assert(*scan == *match, "match[2]?");
+
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ scan < strend);
+
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+ len = MAX_MATCH - (int)(strend - scan);
+ scan = strend - MAX_MATCH;
#endif /* UNALIGNED_OK */
- if (len > best_len) {
- s->match_start = cur_match;
- best_len = len;
- if (len >= nice_match) break;
+ if (len > best_len) {
+ s->match_start = cur_match;
+ best_len = len;
+ if (len >= nice_match) break;
#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
+ scan_end = *(ushf*)(scan+best_len-1);
#else
- scan_end1 = scan[best_len-1];
- scan_end = scan[best_len];
+ scan_end1 = scan[best_len-1];
+ scan_end = scan[best_len];
#endif
- }
- } while ((cur_match = prev[cur_match & wmask]) > limit
- && --chain_length != 0);
+ }
+ } while ((cur_match = prev[cur_match & wmask]) > limit
+ && --chain_length != 0);
- if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
- return s->lookahead;
+ if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+ return s->lookahead;
}
#endif /* ASMV */
@@ -1295,56 +1295,56 @@ local uInt longest_match(s, cur_match)
* Optimized version for FASTEST only
*/
local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
+ deflate_state *s;
+ IPos cur_match; /* current match */
{
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+ register Bytef *scan = s->window + s->strstart; /* current string */
+ register Bytef *match; /* matched string */
+ register int len; /* length of current match */
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
- Assert(cur_match < s->strstart, "no future");
+ Assert(cur_match < s->strstart, "no future");
- match = s->window + cur_match;
+ match = s->window + cur_match;
- /* Return failure if the match length is less than 2:
- */
- if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+ /* Return failure if the match length is less than 2:
+ */
+ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match += 2;
- Assert(*scan == *match, "match[2]?");
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match += 2;
+ Assert(*scan == *match, "match[2]?");
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ scan < strend);
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
- len = MAX_MATCH - (int)(strend - scan);
+ len = MAX_MATCH - (int)(strend - scan);
- if (len < MIN_MATCH) return MIN_MATCH - 1;
+ if (len < MIN_MATCH) return MIN_MATCH - 1;
- s->match_start = cur_match;
- return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
+ s->match_start = cur_match;
+ return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
}
#endif /* FASTEST */
@@ -1354,24 +1354,24 @@ local uInt longest_match(s, cur_match)
* Check that the match at match_start is indeed a match.
*/
local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
+ deflate_state *s;
+ IPos start, match;
+ int length;
{
- /* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
- do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
- z_error("invalid match");
- }
- if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
- do { putc(s->window[start++], stderr); } while (--length != 0);
- }
+ /* check that the match is indeed a match */
+ if (zmemcmp(s->window + match,
+ s->window + start, length) != EQUAL) {
+ fprintf(stderr, " start %u, match %u, length %d\n",
+ start, match, length);
+ do {
+ fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
+ } while (--length != 0);
+ z_error("invalid match");
+ }
+ if (z_verbose > 1) {
+ fprintf(stderr,"\\[%d,%d]", start-match, length);
+ do { putc(s->window[start++], stderr); } while (--length != 0);
+ }
}
#else
# define check_match(s, start, match, length)
@@ -1388,147 +1388,146 @@ local void check_match(s, start, match, length)
* option -- not supported here).
*/
local void fill_window(s)
- deflate_state *s;
+ deflate_state *s;
{
- register unsigned n, m;
- register Posf *p;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize+MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
-
- /* Slide the hash table (could be avoided with 32 bit values
- at the expense of memory usage). We slide even when level == 0
- to keep the hash table consistent if we switch back to level > 0
- later. (Using level 0 permanently is not an optimal usage of
- zlib, so we don't care about this pathological case.)
- */
- n = s->hash_size;
- p = &s->head[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- } while (--n);
-
- n = wsize;
+ register unsigned n, m;
+ register Posf *p;
+ unsigned more; /* Amount of free space at the end of the window. */
+ uInt wsize = s->w_size;
+
+ Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
+
+ do {
+ more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+ /* Deal with !@#$% 64K limit: */
+ if (sizeof(int) <= 2) {
+ if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+ more = wsize;
+
+ } else if (more == (unsigned)(-1)) {
+ /* Very unlikely, but possible on 16 bit machine if
+ * strstart == 0 && lookahead == 1 (input done a byte at time)
+ */
+ more--;
+ }
+ }
+
+ /* If the window is almost full and there is insufficient lookahead,
+ * move the upper half to the lower one to make room in the upper half.
+ */
+ if (s->strstart >= wsize+MAX_DIST(s)) {
+ zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+ s->match_start -= wsize;
+ s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
+ s->block_start -= (long) wsize;
+
+ /* Slide the hash table (could be avoided with 32 bit values
+ at the expense of memory usage). We slide even when level == 0
+ to keep the hash table consistent if we switch back to level > 0
+ later. (Using level 0 permanently is not an optimal usage of
+ zlib, so we don't care about this pathological case.)
+ */
+ n = s->hash_size;
+ p = &s->head[n];
+ do {
+ m = *--p;
+ *p = (Pos)(m >= wsize ? m-wsize : NIL);
+ } while (--n);
+
+ n = wsize;
#ifndef FASTEST
- p = &s->prev[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- /* If n is not on any hash chain, prev[n] is garbage but
- * its value will never be used.
- */
- } while (--n);
+ p = &s->prev[n];
+ do {
+ m = *--p;
+ *p = (Pos)(m >= wsize ? m-wsize : NIL);
+ /* If n is not on any hash chain, prev[n] is garbage but
+ * its value will never be used.
+ */
+ } while (--n);
#endif
- more += wsize;
- }
- if (s->strm->avail_in == 0) break;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead + s->insert >= MIN_MATCH) {
- uInt str = s->strstart - s->insert;
- s->ins_h = s->window[str];
- UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
+ more += wsize;
+ }
+ if (s->strm->avail_in == 0) break;
+
+ /* If there was no sliding:
+ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+ * more == window_size - lookahead - strstart
+ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+ * => more >= window_size - 2*WSIZE + 2
+ * In the BIG_MEM or MMAP case (not yet supported),
+ * window_size == input_size + MIN_LOOKAHEAD &&
+ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+ * Otherwise, window_size == 2*WSIZE so more >= 2.
+ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+ */
+ Assert(more >= 2, "more < 2");
+
+ n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ s->lookahead += n;
+
+ /* Initialize the hash value now that we have some input: */
+ if (s->lookahead + s->insert >= MIN_MATCH) {
+ uInt str = s->strstart - s->insert;
+ s->ins_h = s->window[str];
+ UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
+ Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
- while (s->insert) {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
+ while (s->insert) {
+ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
+ s->prev[str & s->w_mask] = s->head[s->ins_h];
#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- s->insert--;
- if (s->lookahead + s->insert < MIN_MATCH)
- break;
- }
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-
- /* If the WIN_INIT bytes after the end of the current data have never been
- * written, then zero those bytes in order to avoid memory check reports of
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
- * the longest match routines. Update the high water mark for the next
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
- */
- if (s->high_water < s->window_size) {
- ulg curr = s->strstart + (ulg)(s->lookahead);
- ulg init;
-
- if (s->high_water < curr) {
- /* Previous high water mark below current data -- zero WIN_INIT
- * bytes or up to end of window, whichever is less.
- */
- init = s->window_size - curr;
- if (init > WIN_INIT)
- init = WIN_INIT;
- zmemzero(s->window + curr, (unsigned)init);
- s->high_water = curr + init;
- }
- else if (s->high_water < (ulg)curr + WIN_INIT) {
- /* High water mark at or above current data, but below current data
- * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
- * to end of window, whichever is less.
- */
- init = (ulg)curr + WIN_INIT - s->high_water;
- if (init > s->window_size - s->high_water)
- init = s->window_size - s->high_water;
- zmemzero(s->window + s->high_water, (unsigned)init);
- s->high_water += init;
- }
- }
-
- Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
- "not enough room for search");
+ s->head[s->ins_h] = (Pos)str;
+ str++;
+ s->insert--;
+ if (s->lookahead + s->insert < MIN_MATCH)
+ break;
+ }
+ }
+ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+ * but this is not important since only literal bytes will be emitted.
+ */
+
+ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+
+ /* If the WIN_INIT bytes after the end of the current data have never been
+ * written, then zero those bytes in order to avoid memory check reports of
+ * the use of uninitialized (or uninitialised as Julian writes) bytes by
+ * the longest match routines. Update the high water mark for the next
+ * time through here. WIN_INIT is set to MAX_MATCH since the longest match
+ * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
+ */
+ if (s->high_water < s->window_size) {
+ ulg curr = s->strstart + (ulg)(s->lookahead);
+ ulg init;
+
+ if (s->high_water < curr) {
+ /* Previous high water mark below current data -- zero WIN_INIT
+ * bytes or up to end of window, whichever is less.
+ */
+ init = s->window_size - curr;
+ if (init > WIN_INIT)
+ init = WIN_INIT;
+ zmemzero(s->window + curr, (unsigned)init);
+ s->high_water = curr + init;
+ }
+ else if (s->high_water < (ulg)curr + WIN_INIT) {
+ /* High water mark at or above current data, but below current data
+ * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
+ * to end of window, whichever is less.
+ */
+ init = (ulg)curr + WIN_INIT - s->high_water;
+ if (init > s->window_size - s->high_water)
+ init = s->window_size - s->high_water;
+ zmemzero(s->window + s->high_water, (unsigned)init);
+ s->high_water += init;
+ }
+ }
+
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "not enough room for search");
}
/* ===========================================================================
@@ -1536,20 +1535,20 @@ local void fill_window(s)
* IN assertion: strstart is set to the end of the current match.
*/
#define FLUSH_BLOCK_ONLY(s, last) { \
- _tr_flush_block(s, (s->block_start >= 0L ? \
- (charf *)&s->window[(unsigned)s->block_start] : \
- (charf *)Z_NULL), \
- (ulg)((long)s->strstart - s->block_start), \
- (last)); \
- s->block_start = s->strstart; \
- flush_pending(s->strm); \
- Tracev((stderr,"[FLUSH]")); \
+ _tr_flush_block(s, (s->block_start >= 0L ? \
+ (charf *)&s->window[(unsigned)s->block_start] : \
+ (charf *)Z_NULL), \
+ (ulg)((long)s->strstart - s->block_start), \
+ (last)); \
+ s->block_start = s->strstart; \
+ flush_pending(s->strm); \
+ Tracev((stderr,"[FLUSH]")); \
}
/* Same but force premature exit if necessary. */
#define FLUSH_BLOCK(s, last) { \
- FLUSH_BLOCK_ONLY(s, last); \
- if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
+ FLUSH_BLOCK_ONLY(s, last); \
+ if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
}
/* ===========================================================================
@@ -1562,60 +1561,59 @@ local void fill_window(s)
* window to pending_buf.
*/
local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
+ deflate_state *s;
+ int flush;
{
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
- * to pending_buf_size, and each stored block has a 5 byte header:
- */
- ulg max_block_size = 0xffff;
- ulg max_start;
-
- if (max_block_size > s->pending_buf_size - 5) {
- max_block_size = s->pending_buf_size - 5;
- }
-
- /* Copy as much as possible from input to output: */
- for (;;) {
- /* Fill the window as much as possible: */
- if (s->lookahead <= 1) {
-
- Assert(s->strstart < s->w_size+MAX_DIST(s) ||
- s->block_start >= (long)s->w_size, "slide too late");
-
- fill_window(s);
- if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
-
- if (s->lookahead == 0) break; /* flush the current block */
- }
- Assert(s->block_start >= 0L, "block gone");
-
- s->strstart += s->lookahead;
- s->lookahead = 0;
-
- /* Emit a stored block if pending_buf will be full: */
- max_start = s->block_start + max_block_size;
- if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
- /* strstart == 0 is possible when wraparound on 16-bit machine */
- s->lookahead = (uInt)(s->strstart - max_start);
- s->strstart = (uInt)max_start;
- FLUSH_BLOCK(s, 0);
- }
- /* Flush if we may have to slide, otherwise block_start may become
- * negative and the data will be gone:
- */
- if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
- FLUSH_BLOCK(s, 0);
- }
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if ((long)s->strstart > s->block_start)
- FLUSH_BLOCK(s, 0);
- return block_done;
+ /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+ * to pending_buf_size, and each stored block has a 5 byte header:
+ */
+ ulg max_block_size = 0xffff;
+ ulg max_start;
+
+ if (max_block_size > s->pending_buf_size - 5) {
+ max_block_size = s->pending_buf_size - 5;
+ }
+
+ /* Copy as much as possible from input to output: */
+ for (;;) {
+ /* Fill the window as much as possible: */
+ if (s->lookahead <= 1) {
+ Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+ s->block_start >= (long)s->w_size, "slide too late");
+
+ fill_window(s);
+ if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+ Assert(s->block_start >= 0L, "block gone");
+
+ s->strstart += s->lookahead;
+ s->lookahead = 0;
+
+ /* Emit a stored block if pending_buf will be full: */
+ max_start = s->block_start + max_block_size;
+ if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+ /* strstart == 0 is possible when wraparound on 16-bit machine */
+ s->lookahead = (uInt)(s->strstart - max_start);
+ s->strstart = (uInt)max_start;
+ FLUSH_BLOCK(s, 0);
+ }
+ /* Flush if we may have to slide, otherwise block_start may become
+ * negative and the data will be gone:
+ */
+ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+ FLUSH_BLOCK(s, 0);
+ }
+ }
+ s->insert = 0;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if ((long)s->strstart > s->block_start)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
/* ===========================================================================
@@ -1626,99 +1624,99 @@ local block_state deflate_stored(s, flush)
* matches. It is used only for the fast compression options.
*/
local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
+ deflate_state *s;
+ int flush;
{
- IPos hash_head; /* head of the hash chain */
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- hash_head = NIL;
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- * At this point we have always match_length < MIN_MATCH
- */
- if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- s->match_length = longest_match (s, hash_head);
- /* longest_match() sets match_start */
- }
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->match_start, s->match_length);
-
- _tr_tally_dist(s, s->strstart - s->match_start,
- s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
-
- /* Insert new strings in the hash table only if the match length
- * is not too large. This saves time but degrades compression.
- */
+ IPos hash_head; /* head of the hash chain */
+ int bflush; /* set if current block must be flushed */
+
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ if (s->lookahead < MIN_LOOKAHEAD) {
+ fill_window(s);
+ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ hash_head = NIL;
+ if (s->lookahead >= MIN_MATCH) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+
+ /* Find the longest match, discarding those <= prev_length.
+ * At this point we have always match_length < MIN_MATCH
+ */
+ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ s->match_length = longest_match (s, hash_head);
+ /* longest_match() sets match_start */
+ }
+ if (s->match_length >= MIN_MATCH) {
+ check_match(s, s->strstart, s->match_start, s->match_length);
+
+ _tr_tally_dist(s, s->strstart - s->match_start,
+ s->match_length - MIN_MATCH, bflush);
+
+ s->lookahead -= s->match_length;
+
+ /* Insert new strings in the hash table only if the match length
+ * is not too large. This saves time but degrades compression.
+ */
#ifndef FASTEST
- if (s->match_length <= s->max_insert_length &&
- s->lookahead >= MIN_MATCH) {
- s->match_length--; /* string at strstart already in table */
- do {
- s->strstart++;
- INSERT_STRING(s, s->strstart, hash_head);
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
- * always MIN_MATCH bytes ahead.
- */
- } while (--s->match_length != 0);
- s->strstart++;
- } else
+ if (s->match_length <= s->max_insert_length &&
+ s->lookahead >= MIN_MATCH) {
+ s->match_length--; /* string at strstart already in table */
+ do {
+ s->strstart++;
+ INSERT_STRING(s, s->strstart, hash_head);
+ /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+ * always MIN_MATCH bytes ahead.
+ */
+ } while (--s->match_length != 0);
+ s->strstart++;
+ } else
#endif
- {
- s->strstart += s->match_length;
- s->match_length = 0;
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+ {
+ s->strstart += s->match_length;
+ s->match_length = 0;
+ s->ins_h = s->window[s->strstart];
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
+ Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
- * matter since it will be recomputed at next deflate call.
- */
- }
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
+ /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+ * matter since it will be recomputed at next deflate call.
+ */
+ }
+ } else {
+ /* No match, output a literal byte */
+ Tracevv((stderr,"%c", s->window[s->strstart]));
+ _tr_tally_lit (s, s->window[s->strstart], bflush);
+ s->lookahead--;
+ s->strstart++;
+ }
+ if (bflush) FLUSH_BLOCK(s, 0);
+ }
+ s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
#ifndef FASTEST
@@ -1728,128 +1726,127 @@ local block_state deflate_fast(s, flush)
* no better match at the next window position.
*/
local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
+ deflate_state *s;
+ int flush;
{
- IPos hash_head; /* head of hash chain */
- int bflush; /* set if current block must be flushed */
-
- /* Process the input block. */
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- hash_head = NIL;
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- */
- s->prev_length = s->match_length, s->prev_match = s->match_start;
- s->match_length = MIN_MATCH-1;
-
- if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
- s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- s->match_length = longest_match (s, hash_head);
- /* longest_match() sets match_start */
-
- if (s->match_length <= 5 && (s->strategy == Z_FILTERED
+ IPos hash_head; /* head of hash chain */
+ int bflush; /* set if current block must be flushed */
+
+ /* Process the input block. */
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ if (s->lookahead < MIN_LOOKAHEAD) {
+ fill_window(s);
+ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ hash_head = NIL;
+ if (s->lookahead >= MIN_MATCH) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+
+ /* Find the longest match, discarding those <= prev_length.
+ */
+ s->prev_length = s->match_length, s->prev_match = s->match_start;
+ s->match_length = MIN_MATCH-1;
+
+ if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+ s->strstart - hash_head <= MAX_DIST(s)) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ s->match_length = longest_match (s, hash_head);
+ /* longest_match() sets match_start */
+
+ if (s->match_length <= 5 && (s->strategy == Z_FILTERED
#if TOO_FAR <= 32767
- || (s->match_length == MIN_MATCH &&
- s->strstart - s->match_start > TOO_FAR)
+ || (s->match_length == MIN_MATCH &&
+ s->strstart - s->match_start > TOO_FAR)
#endif
- )) {
-
- /* If prev_match is also MIN_MATCH, match_start is garbage
- * but we will ignore the current match anyway.
- */
- s->match_length = MIN_MATCH-1;
- }
- }
- /* If there was a match at the previous step and the current
- * match is not better, output the previous match:
- */
- if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
- uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
- /* Do not insert strings in hash table beyond this. */
-
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
-
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
- s->prev_length - MIN_MATCH, bflush);
-
- /* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
- * enough lookahead, the last two strings are not inserted in
- * the hash table.
- */
- s->lookahead -= s->prev_length-1;
- s->prev_length -= 2;
- do {
- if (++s->strstart <= max_insert) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
- } while (--s->prev_length != 0);
- s->match_available = 0;
- s->match_length = MIN_MATCH-1;
- s->strstart++;
-
- if (bflush) FLUSH_BLOCK(s, 0);
-
- } else if (s->match_available) {
- /* If there was no match at the previous position, output a
- * single literal. If there was a match but the current match
- * is longer, truncate the previous match to a single literal.
- */
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- if (bflush) {
- FLUSH_BLOCK_ONLY(s, 0);
- }
- s->strstart++;
- s->lookahead--;
- if (s->strm->avail_out == 0) return need_more;
- } else {
- /* There is no previous match to compare with, wait for
- * the next step to decide.
- */
- s->match_available = 1;
- s->strstart++;
- s->lookahead--;
- }
- }
- Assert (flush != Z_NO_FLUSH, "no flush?");
- if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- s->match_available = 0;
- }
- s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
+ )) {
+ /* If prev_match is also MIN_MATCH, match_start is garbage
+ * but we will ignore the current match anyway.
+ */
+ s->match_length = MIN_MATCH-1;
+ }
+ }
+ /* If there was a match at the previous step and the current
+ * match is not better, output the previous match:
+ */
+ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+ uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+ /* Do not insert strings in hash table beyond this. */
+
+ check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+
+ _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+ s->prev_length - MIN_MATCH, bflush);
+
+ /* Insert in hash table all strings up to the end of the match.
+ * strstart-1 and strstart are already inserted. If there is not
+ * enough lookahead, the last two strings are not inserted in
+ * the hash table.
+ */
+ s->lookahead -= s->prev_length-1;
+ s->prev_length -= 2;
+ do {
+ if (++s->strstart <= max_insert) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+ } while (--s->prev_length != 0);
+ s->match_available = 0;
+ s->match_length = MIN_MATCH-1;
+ s->strstart++;
+
+ if (bflush) FLUSH_BLOCK(s, 0);
+
+ } else if (s->match_available) {
+ /* If there was no match at the previous position, output a
+ * single literal. If there was a match but the current match
+ * is longer, truncate the previous match to a single literal.
+ */
+ Tracevv((stderr,"%c", s->window[s->strstart-1]));
+ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ if (bflush) {
+ FLUSH_BLOCK_ONLY(s, 0);
+ }
+ s->strstart++;
+ s->lookahead--;
+ if (s->strm->avail_out == 0) return need_more;
+ } else {
+ /* There is no previous match to compare with, wait for
+ * the next step to decide.
+ */
+ s->match_available = 1;
+ s->strstart++;
+ s->lookahead--;
+ }
+ }
+ Assert (flush != Z_NO_FLUSH, "no flush?");
+ if (s->match_available) {
+ Tracevv((stderr,"%c", s->window[s->strstart-1]));
+ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ s->match_available = 0;
+ }
+ s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
#endif /* FASTEST */
@@ -1859,72 +1856,72 @@ local block_state deflate_slow(s, flush)
* deflate switches away from Z_RLE.)
*/
local block_state deflate_rle(s, flush)
- deflate_state *s;
- int flush;
+ deflate_state *s;
+ int flush;
{
- int bflush; /* set if current block must be flushed */
- uInt prev; /* byte at distance one to match */
- Bytef *scan, *strend; /* scan goes up to strend for length of run */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the longest run, plus one for the unrolled loop.
- */
- if (s->lookahead <= MAX_MATCH) {
- fill_window(s);
- if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* See how many times the previous byte repeats */
- s->match_length = 0;
- if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
- scan = s->window + s->strstart - 1;
- prev = *scan;
- if (prev == *++scan && prev == *++scan && prev == *++scan) {
- strend = s->window + s->strstart + MAX_MATCH;
- do {
- } while (prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- scan < strend);
- s->match_length = MAX_MATCH - (int)(strend - scan);
- if (s->match_length > s->lookahead)
- s->match_length = s->lookahead;
- }
- Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
- }
-
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->strstart - 1, s->match_length);
-
- _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
- s->strstart += s->match_length;
- s->match_length = 0;
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
+ int bflush; /* set if current block must be flushed */
+ uInt prev; /* byte at distance one to match */
+ Bytef *scan, *strend; /* scan goes up to strend for length of run */
+
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the longest run, plus one for the unrolled loop.
+ */
+ if (s->lookahead <= MAX_MATCH) {
+ fill_window(s);
+ if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* See how many times the previous byte repeats */
+ s->match_length = 0;
+ if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
+ scan = s->window + s->strstart - 1;
+ prev = *scan;
+ if (prev == *++scan && prev == *++scan && prev == *++scan) {
+ strend = s->window + s->strstart + MAX_MATCH;
+ do {
+ } while (prev == *++scan && prev == *++scan &&
+ prev == *++scan && prev == *++scan &&
+ prev == *++scan && prev == *++scan &&
+ prev == *++scan && prev == *++scan &&
+ scan < strend);
+ s->match_length = MAX_MATCH - (int)(strend - scan);
+ if (s->match_length > s->lookahead)
+ s->match_length = s->lookahead;
+ }
+ Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
+ }
+
+ /* Emit match if have run of MIN_MATCH or longer, else emit literal */
+ if (s->match_length >= MIN_MATCH) {
+ check_match(s, s->strstart, s->strstart - 1, s->match_length);
+
+ _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
+
+ s->lookahead -= s->match_length;
+ s->strstart += s->match_length;
+ s->match_length = 0;
+ } else {
+ /* No match, output a literal byte */
+ Tracevv((stderr,"%c", s->window[s->strstart]));
+ _tr_tally_lit (s, s->window[s->strstart], bflush);
+ s->lookahead--;
+ s->strstart++;
+ }
+ if (bflush) FLUSH_BLOCK(s, 0);
+ }
+ s->insert = 0;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
/* ===========================================================================
@@ -1932,36 +1929,36 @@ local block_state deflate_rle(s, flush)
* (It will be regenerated if this run of deflate switches away from Huffman.)
*/
local block_state deflate_huff(s, flush)
- deflate_state *s;
- int flush;
+ deflate_state *s;
+ int flush;
{
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we have a literal to write. */
- if (s->lookahead == 0) {
- fill_window(s);
- if (s->lookahead == 0) {
- if (flush == Z_NO_FLUSH)
- return need_more;
- break; /* flush the current block */
- }
- }
-
- /* Output a literal byte */
- s->match_length = 0;
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
+ int bflush; /* set if current block must be flushed */
+
+ for (;;) {
+ /* Make sure that we have a literal to write. */
+ if (s->lookahead == 0) {
+ fill_window(s);
+ if (s->lookahead == 0) {
+ if (flush == Z_NO_FLUSH)
+ return need_more;
+ break; /* flush the current block */
+ }
+ }
+
+ /* Output a literal byte */
+ s->match_length = 0;
+ Tracevv((stderr,"%c", s->window[s->strstart]));
+ _tr_tally_lit (s, s->window[s->strstart], bflush);
+ s->lookahead--;
+ s->strstart++;
+ if (bflush) FLUSH_BLOCK(s, 0);
+ }
+ s->insert = 0;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
diff --git a/src/lib/zlib/deflate.h b/src/lib/zlib/deflate.h
index ce0299edd19..1a881525866 100644
--- a/src/lib/zlib/deflate.h
+++ b/src/lib/zlib/deflate.h
@@ -63,14 +63,14 @@
/* Data structure describing a single value and its code string. */
typedef struct ct_data_s {
- union {
- ush freq; /* frequency count */
- ush code; /* bit string */
- } fc;
- union {
- ush dad; /* father node in Huffman tree */
- ush len; /* length of bit string */
- } dl;
+ union {
+ ush freq; /* frequency count */
+ ush code; /* bit string */
+ } fc;
+ union {
+ ush dad; /* father node in Huffman tree */
+ ush len; /* length of bit string */
+ } dl;
} FAR ct_data;
#define Freq fc.freq
@@ -81,9 +81,9 @@ typedef struct ct_data_s {
typedef struct static_tree_desc_s static_tree_desc;
typedef struct tree_desc_s {
- ct_data *dyn_tree; /* the dynamic tree */
- int max_code; /* largest code with non zero frequency */
- static_tree_desc *stat_desc; /* the corresponding static tree */
+ ct_data *dyn_tree; /* the dynamic tree */
+ int max_code; /* largest code with non zero frequency */
+ static_tree_desc *stat_desc; /* the corresponding static tree */
} FAR tree_desc;
typedef ush Pos;
@@ -95,180 +95,180 @@ typedef unsigned IPos;
*/
typedef struct internal_state {
- z_streamp strm; /* pointer back to this zlib stream */
- int status; /* as the name implies */
- Bytef *pending_buf; /* output still pending */
- ulg pending_buf_size; /* size of pending_buf */
- Bytef *pending_out; /* next pending byte to output to the stream */
- uInt pending; /* nb of bytes in the pending buffer */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- gz_headerp gzhead; /* gzip header information to write */
- uInt gzindex; /* where in extra, name, or comment */
- Byte method; /* can only be DEFLATED */
- int last_flush; /* value of flush param for previous deflate call */
-
- /* used by deflate.c: */
-
- uInt w_size; /* LZ77 window size (32K by default) */
- uInt w_bits; /* log2(w_size) (8..16) */
- uInt w_mask; /* w_size - 1 */
-
- Bytef *window;
- /* Sliding window. Input bytes are read into the second half of the window,
- * and move to the first half later to keep a dictionary of at least wSize
- * bytes. With this organization, matches are limited to a distance of
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
- * performed with a length multiple of the block size. Also, it limits
- * the window size to 64K, which is quite useful on MSDOS.
- * To do: use the user input buffer as sliding window.
- */
-
- ulg window_size;
- /* Actual size of window: 2*wSize, except when the user input buffer
- * is directly used as sliding window.
- */
-
- Posf *prev;
- /* Link to older string with same hash index. To limit the size of this
- * array to 64K, this link is maintained only for the last 32K strings.
- * An index in this array is thus a window index modulo 32K.
- */
-
- Posf *head; /* Heads of the hash chains or NIL. */
-
- uInt ins_h; /* hash index of string to be inserted */
- uInt hash_size; /* number of elements in hash table */
- uInt hash_bits; /* log2(hash_size) */
- uInt hash_mask; /* hash_size-1 */
-
- uInt hash_shift;
- /* Number of bits by which ins_h must be shifted at each input
- * step. It must be such that after MIN_MATCH steps, the oldest
- * byte no longer takes part in the hash key, that is:
- * hash_shift * MIN_MATCH >= hash_bits
- */
-
- long block_start;
- /* Window position at the beginning of the current output block. Gets
- * negative when the window is moved backwards.
- */
-
- uInt match_length; /* length of best match */
- IPos prev_match; /* previous match */
- int match_available; /* set if previous match exists */
- uInt strstart; /* start of string to insert */
- uInt match_start; /* start of matching string */
- uInt lookahead; /* number of valid bytes ahead in window */
-
- uInt prev_length;
- /* Length of the best match at previous step. Matches not greater than this
- * are discarded. This is used in the lazy match evaluation.
- */
-
- uInt max_chain_length;
- /* To speed up deflation, hash chains are never searched beyond this
- * length. A higher limit improves compression ratio but degrades the
- * speed.
- */
-
- uInt max_lazy_match;
- /* Attempt to find a better match only when the current match is strictly
- * smaller than this value. This mechanism is used only for compression
- * levels >= 4.
- */
+ z_streamp strm; /* pointer back to this zlib stream */
+ int status; /* as the name implies */
+ Bytef *pending_buf; /* output still pending */
+ ulg pending_buf_size; /* size of pending_buf */
+ Bytef *pending_out; /* next pending byte to output to the stream */
+ uInt pending; /* nb of bytes in the pending buffer */
+ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
+ gz_headerp gzhead; /* gzip header information to write */
+ uInt gzindex; /* where in extra, name, or comment */
+ Byte method; /* can only be DEFLATED */
+ int last_flush; /* value of flush param for previous deflate call */
+
+ /* used by deflate.c: */
+
+ uInt w_size; /* LZ77 window size (32K by default) */
+ uInt w_bits; /* log2(w_size) (8..16) */
+ uInt w_mask; /* w_size - 1 */
+
+ Bytef *window;
+ /* Sliding window. Input bytes are read into the second half of the window,
+ * and move to the first half later to keep a dictionary of at least wSize
+ * bytes. With this organization, matches are limited to a distance of
+ * wSize-MAX_MATCH bytes, but this ensures that IO is always
+ * performed with a length multiple of the block size. Also, it limits
+ * the window size to 64K, which is quite useful on MSDOS.
+ * To do: use the user input buffer as sliding window.
+ */
+
+ ulg window_size;
+ /* Actual size of window: 2*wSize, except when the user input buffer
+ * is directly used as sliding window.
+ */
+
+ Posf *prev;
+ /* Link to older string with same hash index. To limit the size of this
+ * array to 64K, this link is maintained only for the last 32K strings.
+ * An index in this array is thus a window index modulo 32K.
+ */
+
+ Posf *head; /* Heads of the hash chains or NIL. */
+
+ uInt ins_h; /* hash index of string to be inserted */
+ uInt hash_size; /* number of elements in hash table */
+ uInt hash_bits; /* log2(hash_size) */
+ uInt hash_mask; /* hash_size-1 */
+
+ uInt hash_shift;
+ /* Number of bits by which ins_h must be shifted at each input
+ * step. It must be such that after MIN_MATCH steps, the oldest
+ * byte no longer takes part in the hash key, that is:
+ * hash_shift * MIN_MATCH >= hash_bits
+ */
+
+ long block_start;
+ /* Window position at the beginning of the current output block. Gets
+ * negative when the window is moved backwards.
+ */
+
+ uInt match_length; /* length of best match */
+ IPos prev_match; /* previous match */
+ int match_available; /* set if previous match exists */
+ uInt strstart; /* start of string to insert */
+ uInt match_start; /* start of matching string */
+ uInt lookahead; /* number of valid bytes ahead in window */
+
+ uInt prev_length;
+ /* Length of the best match at previous step. Matches not greater than this
+ * are discarded. This is used in the lazy match evaluation.
+ */
+
+ uInt max_chain_length;
+ /* To speed up deflation, hash chains are never searched beyond this
+ * length. A higher limit improves compression ratio but degrades the
+ * speed.
+ */
+
+ uInt max_lazy_match;
+ /* Attempt to find a better match only when the current match is strictly
+ * smaller than this value. This mechanism is used only for compression
+ * levels >= 4.
+ */
# define max_insert_length max_lazy_match
- /* Insert new strings in the hash table only if the match length is not
- * greater than this length. This saves time but degrades compression.
- * max_insert_length is used only for compression levels <= 3.
- */
-
- int level; /* compression level (1..9) */
- int strategy; /* favor or force Huffman coding*/
-
- uInt good_match;
- /* Use a faster search when the previous match is longer than this */
-
- int nice_match; /* Stop searching when current match exceeds this */
-
- /* used by trees.c: */
- /* Didn't use ct_data typedef below to suppress compiler warning */
- struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
- struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
- struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
-
- struct tree_desc_s l_desc; /* desc. for literal tree */
- struct tree_desc_s d_desc; /* desc. for distance tree */
- struct tree_desc_s bl_desc; /* desc. for bit length tree */
-
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
- int heap_len; /* number of elements in the heap */
- int heap_max; /* element of largest frequency */
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
- * The same heap array is used to build all trees.
- */
-
- uch depth[2*L_CODES+1];
- /* Depth of each subtree used as tie breaker for trees of equal frequency
- */
-
- uchf *l_buf; /* buffer for literals or lengths */
-
- uInt lit_bufsize;
- /* Size of match buffer for literals/lengths. There are 4 reasons for
- * limiting lit_bufsize to 64K:
- * - frequencies can be kept in 16 bit counters
- * - if compression is not successful for the first block, all input
- * data is still in the window so we can still emit a stored block even
- * when input comes from standard input. (This can also be done for
- * all blocks if lit_bufsize is not greater than 32K.)
- * - if compression is not successful for a file smaller than 64K, we can
- * even emit a stored file instead of a stored block (saving 5 bytes).
- * This is applicable only for zip (not gzip or zlib).
- * - creating new Huffman trees less frequently may not provide fast
- * adaptation to changes in the input data statistics. (Take for
- * example a binary file with poorly compressible code followed by
- * a highly compressible string table.) Smaller buffer sizes give
- * fast adaptation but have of course the overhead of transmitting
- * trees more frequently.
- * - I can't count above 4
- */
-
- uInt last_lit; /* running index in l_buf */
-
- ushf *d_buf;
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
- * the same number of elements. To use different lengths, an extra flag
- * array would be necessary.
- */
-
- ulg opt_len; /* bit length of current block with optimal trees */
- ulg static_len; /* bit length of current block with static trees */
- uInt matches; /* number of string matches in current block */
- uInt insert; /* bytes at end of window left to insert */
+ /* Insert new strings in the hash table only if the match length is not
+ * greater than this length. This saves time but degrades compression.
+ * max_insert_length is used only for compression levels <= 3.
+ */
+
+ int level; /* compression level (1..9) */
+ int strategy; /* favor or force Huffman coding*/
+
+ uInt good_match;
+ /* Use a faster search when the previous match is longer than this */
+
+ int nice_match; /* Stop searching when current match exceeds this */
+
+ /* used by trees.c: */
+ /* Didn't use ct_data typedef below to suppress compiler warning */
+ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
+ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
+
+ struct tree_desc_s l_desc; /* desc. for literal tree */
+ struct tree_desc_s d_desc; /* desc. for distance tree */
+ struct tree_desc_s bl_desc; /* desc. for bit length tree */
+
+ ush bl_count[MAX_BITS+1];
+ /* number of codes at each bit length for an optimal tree */
+
+ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
+ int heap_len; /* number of elements in the heap */
+ int heap_max; /* element of largest frequency */
+ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+ * The same heap array is used to build all trees.
+ */
+
+ uch depth[2*L_CODES+1];
+ /* Depth of each subtree used as tie breaker for trees of equal frequency
+ */
+
+ uchf *l_buf; /* buffer for literals or lengths */
+
+ uInt lit_bufsize;
+ /* Size of match buffer for literals/lengths. There are 4 reasons for
+ * limiting lit_bufsize to 64K:
+ * - frequencies can be kept in 16 bit counters
+ * - if compression is not successful for the first block, all input
+ * data is still in the window so we can still emit a stored block even
+ * when input comes from standard input. (This can also be done for
+ * all blocks if lit_bufsize is not greater than 32K.)
+ * - if compression is not successful for a file smaller than 64K, we can
+ * even emit a stored file instead of a stored block (saving 5 bytes).
+ * This is applicable only for zip (not gzip or zlib).
+ * - creating new Huffman trees less frequently may not provide fast
+ * adaptation to changes in the input data statistics. (Take for
+ * example a binary file with poorly compressible code followed by
+ * a highly compressible string table.) Smaller buffer sizes give
+ * fast adaptation but have of course the overhead of transmitting
+ * trees more frequently.
+ * - I can't count above 4
+ */
+
+ uInt last_lit; /* running index in l_buf */
+
+ ushf *d_buf;
+ /* Buffer for distances. To simplify the code, d_buf and l_buf have
+ * the same number of elements. To use different lengths, an extra flag
+ * array would be necessary.
+ */
+
+ ulg opt_len; /* bit length of current block with optimal trees */
+ ulg static_len; /* bit length of current block with static trees */
+ uInt matches; /* number of string matches in current block */
+ uInt insert; /* bytes at end of window left to insert */
#ifdef DEBUG
- ulg compressed_len; /* total bit length of compressed file mod 2^32 */
- ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
+ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
#endif
- ush bi_buf;
- /* Output buffer. bits are inserted starting at the bottom (least
- * significant bits).
- */
- int bi_valid;
- /* Number of valid bits in bi_buf. All bits above the last valid bit
- * are always zero.
- */
-
- ulg high_water;
- /* High water mark offset in window for initialized bytes -- bytes above
- * this are set to zero in order to avoid memory check warnings when
- * longest match routines access bytes past the input. This is then
- * updated to the new high water mark.
- */
+ ush bi_buf;
+ /* Output buffer. bits are inserted starting at the bottom (least
+ * significant bits).
+ */
+ int bi_valid;
+ /* Number of valid bits in bi_buf. All bits above the last valid bit
+ * are always zero.
+ */
+
+ ulg high_water;
+ /* High water mark offset in window for initialized bytes -- bytes above
+ * this are set to zero in order to avoid memory check warnings when
+ * longest match routines access bytes past the input. This is then
+ * updated to the new high water mark.
+ */
} FAR deflate_state;
@@ -292,18 +292,18 @@ typedef struct internal_state {
/* Number of bytes after end of data in window to initialize in order to avoid
memory checker errors from longest match routines */
- /* in trees.c */
+ /* in trees.c */
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
+ ulg stored_len, int last));
void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
+ ulg stored_len, int last));
#define d_code(dist) \
- ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. _dist_code[256] and _dist_code[257] are never
* used.
@@ -313,34 +313,34 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
/* Inline versions of _tr_tally for speed: */
#if defined(GEN_TREES_H) || !defined(STDC)
- extern uch ZLIB_INTERNAL _length_code[];
- extern uch ZLIB_INTERNAL _dist_code[];
+ extern uch ZLIB_INTERNAL _length_code[];
+ extern uch ZLIB_INTERNAL _dist_code[];
#else
- extern const uch ZLIB_INTERNAL _length_code[];
- extern const uch ZLIB_INTERNAL _dist_code[];
+ extern const uch ZLIB_INTERNAL _length_code[];
+ extern const uch ZLIB_INTERNAL _dist_code[];
#endif
# define _tr_tally_lit(s, c, flush) \
- { uch cc = (c); \
- s->d_buf[s->last_lit] = 0; \
- s->l_buf[s->last_lit++] = cc; \
- s->dyn_ltree[cc].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
+ { uch cc = (c); \
+ s->d_buf[s->last_lit] = 0; \
+ s->l_buf[s->last_lit++] = cc; \
+ s->dyn_ltree[cc].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
# define _tr_tally_dist(s, distance, length, flush) \
- { uch len = (length); \
- ush dist = (distance); \
- s->d_buf[s->last_lit] = dist; \
- s->l_buf[s->last_lit++] = len; \
- dist--; \
- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
- s->dyn_dtree[d_code(dist)].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
+ { uch len = (length); \
+ ush dist = (distance); \
+ s->d_buf[s->last_lit] = dist; \
+ s->l_buf[s->last_lit++] = len; \
+ dist--; \
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_dtree[d_code(dist)].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
- flush = _tr_tally(s, distance, length)
+ flush = _tr_tally(s, distance, length)
#endif
#endif /* DEFLATE_H */
diff --git a/src/lib/zlib/gzclose.c b/src/lib/zlib/gzclose.c
index caeb99a3177..05c10c06547 100644
--- a/src/lib/zlib/gzclose.c
+++ b/src/lib/zlib/gzclose.c
@@ -9,17 +9,17 @@
That way the other gzclose functions can be used instead to avoid linking in
unneeded compression or decompression routines. */
int ZEXPORT gzclose(file)
- gzFile file;
+ gzFile file;
{
#ifndef NO_GZCOMPRESS
- gz_statep state;
+ gz_statep state;
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
+ if (file == NULL)
+ return Z_STREAM_ERROR;
+ state = (gz_statep)file;
- return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
+ return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
#else
- return gzclose_r(file);
+ return gzclose_r(file);
#endif
}
diff --git a/src/lib/zlib/gzguts.h b/src/lib/zlib/gzguts.h
index d87659d0319..c39745e8307 100644
--- a/src/lib/zlib/gzguts.h
+++ b/src/lib/zlib/gzguts.h
@@ -110,8 +110,8 @@
/* gz* functions always use library allocation functions */
#ifndef STDC
- extern voidp malloc OF((uInt size));
- extern void free OF((voidpf ptr));
+ extern voidp malloc OF((uInt size));
+ extern void free OF((voidpf ptr));
#endif
/* get errno and strerror definition */
@@ -129,10 +129,10 @@
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
+ ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
+ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
#endif
/* default memLevel */
@@ -159,36 +159,36 @@
/* internal gzip file state data structure */
typedef struct {
- /* exposed contents for gzgetc() macro */
- struct gzFile_s x; /* "x" for exposed */
- /* x.have: number of bytes available at x.next */
- /* x.next: next output data to deliver or write */
- /* x.pos: current position in uncompressed data */
- /* used for both reading and writing */
- int mode; /* see gzip modes above */
- int fd; /* file descriptor */
- char *path; /* path or fd for error messages */
- unsigned size; /* buffer size, zero if not allocated yet */
- unsigned want; /* requested buffer size, default is GZBUFSIZE */
- unsigned char *in; /* input buffer */
- unsigned char *out; /* output buffer (double-sized when reading) */
- int direct; /* 0 if processing gzip, 1 if transparent */
- /* just for reading */
- int how; /* 0: get header, 1: copy, 2: decompress */
- z_off64_t start; /* where the gzip data started, for rewinding */
- int eof; /* true if end of input file reached */
- int past; /* true if read requested past end */
- /* just for writing */
- int level; /* compression level */
- int strategy; /* compression strategy */
- /* seek request */
- z_off64_t skip; /* amount to skip (already rewound if backwards) */
- int seek; /* true if seek request pending */
- /* error information */
- int err; /* error code */
- char *msg; /* error message */
- /* zlib inflate or deflate stream */
- z_stream strm; /* stream structure in-place (not a pointer) */
+ /* exposed contents for gzgetc() macro */
+ struct gzFile_s x; /* "x" for exposed */
+ /* x.have: number of bytes available at x.next */
+ /* x.next: next output data to deliver or write */
+ /* x.pos: current position in uncompressed data */
+ /* used for both reading and writing */
+ int mode; /* see gzip modes above */
+ int fd; /* file descriptor */
+ char *path; /* path or fd for error messages */
+ unsigned size; /* buffer size, zero if not allocated yet */
+ unsigned want; /* requested buffer size, default is GZBUFSIZE */
+ unsigned char *in; /* input buffer */
+ unsigned char *out; /* output buffer (double-sized when reading) */
+ int direct; /* 0 if processing gzip, 1 if transparent */
+ /* just for reading */
+ int how; /* 0: get header, 1: copy, 2: decompress */
+ z_off64_t start; /* where the gzip data started, for rewinding */
+ int eof; /* true if end of input file reached */
+ int past; /* true if read requested past end */
+ /* just for writing */
+ int level; /* compression level */
+ int strategy; /* compression strategy */
+ /* seek request */
+ z_off64_t skip; /* amount to skip (already rewound if backwards) */
+ int seek; /* true if seek request pending */
+ /* error information */
+ int err; /* error code */
+ char *msg; /* error message */
+ /* zlib inflate or deflate stream */
+ z_stream strm; /* stream structure in-place (not a pointer) */
} gz_state;
typedef gz_state FAR *gz_statep;
diff --git a/src/lib/zlib/gzlib.c b/src/lib/zlib/gzlib.c
index fae202ef890..e4e072f1dc7 100644
--- a/src/lib/zlib/gzlib.c
+++ b/src/lib/zlib/gzlib.c
@@ -31,539 +31,539 @@ local gzFile gz_open OF((const void *, int, const char *));
The gz_strwinerror function does not change the current setting of
GetLastError. */
char ZLIB_INTERNAL *gz_strwinerror (error)
- DWORD error;
+ DWORD error;
{
- static char buf[1024];
-
- wchar_t *msgbuf;
- DWORD lasterr = GetLastError();
- DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER,
- NULL,
- error,
- 0, /* Default language */
- (LPVOID)&msgbuf,
- 0,
- NULL);
- if (chars != 0) {
- /* If there is an \r\n appended, zap it. */
- if (chars >= 2
- && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
- chars -= 2;
- msgbuf[chars] = 0;
- }
-
- if (chars > sizeof (buf) - 1) {
- chars = sizeof (buf) - 1;
- msgbuf[chars] = 0;
- }
-
- wcstombs(buf, msgbuf, chars + 1);
- LocalFree(msgbuf);
- }
- else {
- sprintf(buf, "unknown win32 error (%ld)", error);
- }
-
- SetLastError(lasterr);
- return buf;
+ static char buf[1024];
+
+ wchar_t *msgbuf;
+ DWORD lasterr = GetLastError();
+ DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL,
+ error,
+ 0, /* Default language */
+ (LPVOID)&msgbuf,
+ 0,
+ NULL);
+ if (chars != 0) {
+ /* If there is an \r\n appended, zap it. */
+ if (chars >= 2
+ && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
+ chars -= 2;
+ msgbuf[chars] = 0;
+ }
+
+ if (chars > sizeof (buf) - 1) {
+ chars = sizeof (buf) - 1;
+ msgbuf[chars] = 0;
+ }
+
+ wcstombs(buf, msgbuf, chars + 1);
+ LocalFree(msgbuf);
+ }
+ else {
+ sprintf(buf, "unknown win32 error (%ld)", error);
+ }
+
+ SetLastError(lasterr);
+ return buf;
}
#endif /* UNDER_CE */
/* Reset gzip file state */
local void gz_reset(state)
- gz_statep state;
+ gz_statep state;
{
- state->x.have = 0; /* no output data available */
- if (state->mode == GZ_READ) { /* for reading ... */
- state->eof = 0; /* not at end of file */
- state->past = 0; /* have not read past end yet */
- state->how = LOOK; /* look for gzip header */
- }
- state->seek = 0; /* no seek request pending */
- gz_error(state, Z_OK, NULL); /* clear error */
- state->x.pos = 0; /* no uncompressed data yet */
- state->strm.avail_in = 0; /* no input data yet */
+ state->x.have = 0; /* no output data available */
+ if (state->mode == GZ_READ) { /* for reading ... */
+ state->eof = 0; /* not at end of file */
+ state->past = 0; /* have not read past end yet */
+ state->how = LOOK; /* look for gzip header */
+ }
+ state->seek = 0; /* no seek request pending */
+ gz_error(state, Z_OK, NULL); /* clear error */
+ state->x.pos = 0; /* no uncompressed data yet */
+ state->strm.avail_in = 0; /* no input data yet */
}
/* Open a gzip file either by name or file descriptor. */
local gzFile gz_open(path, fd, mode)
- const void *path;
- int fd;
- const char *mode;
+ const void *path;
+ int fd;
+ const char *mode;
{
- gz_statep state;
- size_t len;
- int oflag;
+ gz_statep state;
+ size_t len;
+ int oflag;
#ifdef O_CLOEXEC
- int cloexec = 0;
+ int cloexec = 0;
#endif
#ifdef O_EXCL
- int exclusive = 0;
+ int exclusive = 0;
#endif
- /* check input */
- if (path == NULL)
- return NULL;
-
- /* allocate gzFile structure to return */
- state = (gz_statep)malloc(sizeof(gz_state));
- if (state == NULL)
- return NULL;
- state->size = 0; /* no buffers allocated yet */
- state->want = GZBUFSIZE; /* requested buffer size */
- state->msg = NULL; /* no error message yet */
-
- /* interpret mode */
- state->mode = GZ_NONE;
- state->level = Z_DEFAULT_COMPRESSION;
- state->strategy = Z_DEFAULT_STRATEGY;
- state->direct = 0;
- while (*mode) {
- if (*mode >= '0' && *mode <= '9')
- state->level = *mode - '0';
- else
- switch (*mode) {
- case 'r':
- state->mode = GZ_READ;
- break;
+ /* check input */
+ if (path == NULL)
+ return NULL;
+
+ /* allocate gzFile structure to return */
+ state = (gz_statep)malloc(sizeof(gz_state));
+ if (state == NULL)
+ return NULL;
+ state->size = 0; /* no buffers allocated yet */
+ state->want = GZBUFSIZE; /* requested buffer size */
+ state->msg = NULL; /* no error message yet */
+
+ /* interpret mode */
+ state->mode = GZ_NONE;
+ state->level = Z_DEFAULT_COMPRESSION;
+ state->strategy = Z_DEFAULT_STRATEGY;
+ state->direct = 0;
+ while (*mode) {
+ if (*mode >= '0' && *mode <= '9')
+ state->level = *mode - '0';
+ else
+ switch (*mode) {
+ case 'r':
+ state->mode = GZ_READ;
+ break;
#ifndef NO_GZCOMPRESS
- case 'w':
- state->mode = GZ_WRITE;
- break;
- case 'a':
- state->mode = GZ_APPEND;
- break;
+ case 'w':
+ state->mode = GZ_WRITE;
+ break;
+ case 'a':
+ state->mode = GZ_APPEND;
+ break;
#endif
- case '+': /* can't read and write at the same time */
- free(state);
- return NULL;
- case 'b': /* ignore -- will request binary anyway */
- break;
+ case '+': /* can't read and write at the same time */
+ free(state);
+ return NULL;
+ case 'b': /* ignore -- will request binary anyway */
+ break;
#ifdef O_CLOEXEC
- case 'e':
- cloexec = 1;
- break;
+ case 'e':
+ cloexec = 1;
+ break;
#endif
#ifdef O_EXCL
- case 'x':
- exclusive = 1;
- break;
+ case 'x':
+ exclusive = 1;
+ break;
#endif
- case 'f':
- state->strategy = Z_FILTERED;
- break;
- case 'h':
- state->strategy = Z_HUFFMAN_ONLY;
- break;
- case 'R':
- state->strategy = Z_RLE;
- break;
- case 'F':
- state->strategy = Z_FIXED;
- break;
- case 'T':
- state->direct = 1;
- break;
- default: /* could consider as an error, but just ignore */
- ;
- }
- mode++;
- }
-
- /* must provide an "r", "w", or "a" */
- if (state->mode == GZ_NONE) {
- free(state);
- return NULL;
- }
-
- /* can't force transparent read */
- if (state->mode == GZ_READ) {
- if (state->direct) {
- free(state);
- return NULL;
- }
- state->direct = 1; /* for empty file */
- }
-
- /* save the path name for error messages */
+ case 'f':
+ state->strategy = Z_FILTERED;
+ break;
+ case 'h':
+ state->strategy = Z_HUFFMAN_ONLY;
+ break;
+ case 'R':
+ state->strategy = Z_RLE;
+ break;
+ case 'F':
+ state->strategy = Z_FIXED;
+ break;
+ case 'T':
+ state->direct = 1;
+ break;
+ default: /* could consider as an error, but just ignore */
+ ;
+ }
+ mode++;
+ }
+
+ /* must provide an "r", "w", or "a" */
+ if (state->mode == GZ_NONE) {
+ free(state);
+ return NULL;
+ }
+
+ /* can't force transparent read */
+ if (state->mode == GZ_READ) {
+ if (state->direct) {
+ free(state);
+ return NULL;
+ }
+ state->direct = 1; /* for empty file */
+ }
+
+ /* save the path name for error messages */
#ifdef _WIN32
- if (fd == -2) {
- len = wcstombs(NULL, path, 0);
- if (len == (size_t)-1)
- len = 0;
- }
- else
+ if (fd == -2) {
+ len = wcstombs(NULL, path, 0);
+ if (len == (size_t)-1)
+ len = 0;
+ }
+ else
#endif
- len = strlen((const char *)path);
- state->path = (char *)malloc(len + 1);
- if (state->path == NULL) {
- free(state);
- return NULL;
- }
+ len = strlen((const char *)path);
+ state->path = (char *)malloc(len + 1);
+ if (state->path == NULL) {
+ free(state);
+ return NULL;
+ }
#ifdef _WIN32
- if (fd == -2)
- if (len)
- wcstombs(state->path, path, len + 1);
- else
- *(state->path) = 0;
- else
+ if (fd == -2)
+ if (len)
+ wcstombs(state->path, path, len + 1);
+ else
+ *(state->path) = 0;
+ else
#endif
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(state->path, len + 1, "%s", (const char *)path);
+ snprintf(state->path, len + 1, "%s", (const char *)path);
#else
- strcpy(state->path, path);
+ strcpy(state->path, path);
#endif
- /* compute the flags for open() */
- oflag =
+ /* compute the flags for open() */
+ oflag =
#ifdef O_LARGEFILE
- O_LARGEFILE |
+ O_LARGEFILE |
#endif
#ifdef O_BINARY
- O_BINARY |
+ O_BINARY |
#endif
#ifdef O_CLOEXEC
- (cloexec ? O_CLOEXEC : 0) |
+ (cloexec ? O_CLOEXEC : 0) |
#endif
- (state->mode == GZ_READ ?
- O_RDONLY :
- (O_WRONLY | O_CREAT |
+ (state->mode == GZ_READ ?
+ O_RDONLY :
+ (O_WRONLY | O_CREAT |
#ifdef O_EXCL
- (exclusive ? O_EXCL : 0) |
+ (exclusive ? O_EXCL : 0) |
#endif
- (state->mode == GZ_WRITE ?
- O_TRUNC :
- O_APPEND)));
+ (state->mode == GZ_WRITE ?
+ O_TRUNC :
+ O_APPEND)));
- /* open the file with the appropriate flags (or just use fd) */
- state->fd = fd > -1 ? fd : (
+ /* open the file with the appropriate flags (or just use fd) */
+ state->fd = fd > -1 ? fd : (
#ifdef _WIN32
- fd == -2 ? _wopen(path, oflag, 0666) :
+ fd == -2 ? _wopen(path, oflag, 0666) :
#endif
- open((const char *)path, oflag, 0666));
- if (state->fd == -1) {
- free(state->path);
- free(state);
- return NULL;
- }
- if (state->mode == GZ_APPEND)
- state->mode = GZ_WRITE; /* simplify later checks */
-
- /* save the current position for rewinding (only if reading) */
- if (state->mode == GZ_READ) {
- state->start = LSEEK(state->fd, 0, SEEK_CUR);
- if (state->start == -1) state->start = 0;
- }
-
- /* initialize stream */
- gz_reset(state);
-
- /* return stream */
- return (gzFile)state;
+ open((const char *)path, oflag, 0666));
+ if (state->fd == -1) {
+ free(state->path);
+ free(state);
+ return NULL;
+ }
+ if (state->mode == GZ_APPEND)
+ state->mode = GZ_WRITE; /* simplify later checks */
+
+ /* save the current position for rewinding (only if reading) */
+ if (state->mode == GZ_READ) {
+ state->start = LSEEK(state->fd, 0, SEEK_CUR);
+ if (state->start == -1) state->start = 0;
+ }
+
+ /* initialize stream */
+ gz_reset(state);
+
+ /* return stream */
+ return (gzFile)state;
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzopen(path, mode)
- const char *path;
- const char *mode;
+ const char *path;
+ const char *mode;
{
- return gz_open(path, -1, mode);
+ return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzopen64(path, mode)
- const char *path;
- const char *mode;
+ const char *path;
+ const char *mode;
{
- return gz_open(path, -1, mode);
+ return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzdopen(fd, mode)
- int fd;
- const char *mode;
+ int fd;
+ const char *mode;
{
- char *path; /* identifier for error messages */
- gzFile gz;
+ char *path; /* identifier for error messages */
+ gzFile gz;
- if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
- return NULL;
+ if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
+ return NULL;
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
+ snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
#else
- sprintf(path, "<fd:%d>", fd); /* for debugging */
+ sprintf(path, "<fd:%d>", fd); /* for debugging */
#endif
- gz = gz_open(path, fd, mode);
- free(path);
- return gz;
+ gz = gz_open(path, fd, mode);
+ free(path);
+ return gz;
}
/* -- see zlib.h -- */
#ifdef _WIN32
gzFile ZEXPORT gzopen_w(path, mode)
- const wchar_t *path;
- const char *mode;
+ const wchar_t *path;
+ const char *mode;
{
- return gz_open(path, -2, mode);
+ return gz_open(path, -2, mode);
}
#endif
/* -- see zlib.h -- */
int ZEXPORT gzbuffer(file, size)
- gzFile file;
- unsigned size;
+ gzFile file;
+ unsigned size;
{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* make sure we haven't already allocated memory */
- if (state->size != 0)
- return -1;
-
- /* check and set requested size */
- if (size < 2)
- size = 2; /* need two bytes to check magic header */
- state->want = size;
- return 0;
+ gz_statep state;
+
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return -1;
+
+ /* make sure we haven't already allocated memory */
+ if (state->size != 0)
+ return -1;
+
+ /* check and set requested size */
+ if (size < 2)
+ size = 2; /* need two bytes to check magic header */
+ state->want = size;
+ return 0;
}
/* -- see zlib.h -- */
int ZEXPORT gzrewind(file)
- gzFile file;
+ gzFile file;
{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* back up and start over */
- if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
- return -1;
- gz_reset(state);
- return 0;
+ gz_statep state;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+
+ /* check that we're reading and that there's no error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
+ return -1;
+
+ /* back up and start over */
+ if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
+ return -1;
+ gz_reset(state);
+ return 0;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gzseek64(file, offset, whence)
- gzFile file;
- z_off64_t offset;
- int whence;
+ gzFile file;
+ z_off64_t offset;
+ int whence;
{
- unsigned n;
- z_off64_t ret;
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* check that there's no error */
- if (state->err != Z_OK && state->err != Z_BUF_ERROR)
- return -1;
-
- /* can only seek from start or relative to current position */
- if (whence != SEEK_SET && whence != SEEK_CUR)
- return -1;
-
- /* normalize offset to a SEEK_CUR specification */
- if (whence == SEEK_SET)
- offset -= state->x.pos;
- else if (state->seek)
- offset += state->skip;
- state->seek = 0;
-
- /* if within raw area while reading, just go there */
- if (state->mode == GZ_READ && state->how == COPY &&
- state->x.pos + offset >= 0) {
- ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
- if (ret == -1)
- return -1;
- state->x.have = 0;
- state->eof = 0;
- state->past = 0;
- state->seek = 0;
- gz_error(state, Z_OK, NULL);
- state->strm.avail_in = 0;
- state->x.pos += offset;
- return state->x.pos;
- }
-
- /* calculate skip amount, rewinding if needed for back seek when reading */
- if (offset < 0) {
- if (state->mode != GZ_READ) /* writing -- can't go backwards */
- return -1;
- offset += state->x.pos;
- if (offset < 0) /* before start of file! */
- return -1;
- if (gzrewind(file) == -1) /* rewind, then skip to offset */
- return -1;
- }
-
- /* if reading, skip what's in output buffer (one less gzgetc() check) */
- if (state->mode == GZ_READ) {
- n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
- (unsigned)offset : state->x.have;
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- offset -= n;
- }
-
- /* request skip (if not zero) */
- if (offset) {
- state->seek = 1;
- state->skip = offset;
- }
- return state->x.pos + offset;
+ unsigned n;
+ z_off64_t ret;
+ gz_statep state;
+
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return -1;
+
+ /* check that there's no error */
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR)
+ return -1;
+
+ /* can only seek from start or relative to current position */
+ if (whence != SEEK_SET && whence != SEEK_CUR)
+ return -1;
+
+ /* normalize offset to a SEEK_CUR specification */
+ if (whence == SEEK_SET)
+ offset -= state->x.pos;
+ else if (state->seek)
+ offset += state->skip;
+ state->seek = 0;
+
+ /* if within raw area while reading, just go there */
+ if (state->mode == GZ_READ && state->how == COPY &&
+ state->x.pos + offset >= 0) {
+ ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
+ if (ret == -1)
+ return -1;
+ state->x.have = 0;
+ state->eof = 0;
+ state->past = 0;
+ state->seek = 0;
+ gz_error(state, Z_OK, NULL);
+ state->strm.avail_in = 0;
+ state->x.pos += offset;
+ return state->x.pos;
+ }
+
+ /* calculate skip amount, rewinding if needed for back seek when reading */
+ if (offset < 0) {
+ if (state->mode != GZ_READ) /* writing -- can't go backwards */
+ return -1;
+ offset += state->x.pos;
+ if (offset < 0) /* before start of file! */
+ return -1;
+ if (gzrewind(file) == -1) /* rewind, then skip to offset */
+ return -1;
+ }
+
+ /* if reading, skip what's in output buffer (one less gzgetc() check) */
+ if (state->mode == GZ_READ) {
+ n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
+ (unsigned)offset : state->x.have;
+ state->x.have -= n;
+ state->x.next += n;
+ state->x.pos += n;
+ offset -= n;
+ }
+
+ /* request skip (if not zero) */
+ if (offset) {
+ state->seek = 1;
+ state->skip = offset;
+ }
+ return state->x.pos + offset;
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gzseek(file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
+ gzFile file;
+ z_off_t offset;
+ int whence;
{
- z_off64_t ret;
+ z_off64_t ret;
- ret = gzseek64(file, (z_off64_t)offset, whence);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
+ ret = gzseek64(file, (z_off64_t)offset, whence);
+ return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gztell64(file)
- gzFile file;
+ gzFile file;
{
- gz_statep state;
+ gz_statep state;
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return -1;
- /* return position */
- return state->x.pos + (state->seek ? state->skip : 0);
+ /* return position */
+ return state->x.pos + (state->seek ? state->skip : 0);
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gztell(file)
- gzFile file;
+ gzFile file;
{
- z_off64_t ret;
+ z_off64_t ret;
- ret = gztell64(file);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
+ ret = gztell64(file);
+ return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gzoffset64(file)
- gzFile file;
+ gzFile file;
{
- z_off64_t offset;
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* compute and return effective offset in file */
- offset = LSEEK(state->fd, 0, SEEK_CUR);
- if (offset == -1)
- return -1;
- if (state->mode == GZ_READ) /* reading */
- offset -= state->strm.avail_in; /* don't count buffered input */
- return offset;
+ z_off64_t offset;
+ gz_statep state;
+
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return -1;
+
+ /* compute and return effective offset in file */
+ offset = LSEEK(state->fd, 0, SEEK_CUR);
+ if (offset == -1)
+ return -1;
+ if (state->mode == GZ_READ) /* reading */
+ offset -= state->strm.avail_in; /* don't count buffered input */
+ return offset;
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gzoffset(file)
- gzFile file;
+ gzFile file;
{
- z_off64_t ret;
+ z_off64_t ret;
- ret = gzoffset64(file);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
+ ret = gzoffset64(file);
+ return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
int ZEXPORT gzeof(file)
- gzFile file;
+ gzFile file;
{
- gz_statep state;
+ gz_statep state;
- /* get internal structure and check integrity */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return 0;
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return 0;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return 0;
- /* return end-of-file state */
- return state->mode == GZ_READ ? state->past : 0;
+ /* return end-of-file state */
+ return state->mode == GZ_READ ? state->past : 0;
}
/* -- see zlib.h -- */
const char * ZEXPORT gzerror(file, errnum)
- gzFile file;
- int *errnum;
+ gzFile file;
+ int *errnum;
{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return NULL;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return NULL;
-
- /* return error information */
- if (errnum != NULL)
- *errnum = state->err;
- return state->err == Z_MEM_ERROR ? "out of memory" :
- (state->msg == NULL ? "" : state->msg);
+ gz_statep state;
+
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return NULL;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return NULL;
+
+ /* return error information */
+ if (errnum != NULL)
+ *errnum = state->err;
+ return state->err == Z_MEM_ERROR ? "out of memory" :
+ (state->msg == NULL ? "" : state->msg);
}
/* -- see zlib.h -- */
void ZEXPORT gzclearerr(file)
- gzFile file;
+ gzFile file;
{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return;
-
- /* clear error and end-of-file */
- if (state->mode == GZ_READ) {
- state->eof = 0;
- state->past = 0;
- }
- gz_error(state, Z_OK, NULL);
+ gz_statep state;
+
+ /* get internal structure and check integrity */
+ if (file == NULL)
+ return;
+ state = (gz_statep)file;
+ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
+ return;
+
+ /* clear error and end-of-file */
+ if (state->mode == GZ_READ) {
+ state->eof = 0;
+ state->past = 0;
+ }
+ gz_error(state, Z_OK, NULL);
}
/* Create an error message in allocated memory and set state->err and
@@ -573,45 +573,45 @@ void ZEXPORT gzclearerr(file)
allocation failure constructing the error message, then convert the error to
out of memory. */
void ZLIB_INTERNAL gz_error(state, err, msg)
- gz_statep state;
- int err;
- const char *msg;
+ gz_statep state;
+ int err;
+ const char *msg;
{
- /* free previously allocated message and clear */
- if (state->msg != NULL) {
- if (state->err != Z_MEM_ERROR)
- free(state->msg);
- state->msg = NULL;
- }
-
- /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
- if (err != Z_OK && err != Z_BUF_ERROR)
- state->x.have = 0;
-
- /* set error code, and if no message, then done */
- state->err = err;
- if (msg == NULL)
- return;
-
- /* for an out of memory error, return literal string when requested */
- if (err == Z_MEM_ERROR)
- return;
-
- /* construct error message with path */
- if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
- NULL) {
- state->err = Z_MEM_ERROR;
- return;
- }
+ /* free previously allocated message and clear */
+ if (state->msg != NULL) {
+ if (state->err != Z_MEM_ERROR)
+ free(state->msg);
+ state->msg = NULL;
+ }
+
+ /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
+ if (err != Z_OK && err != Z_BUF_ERROR)
+ state->x.have = 0;
+
+ /* set error code, and if no message, then done */
+ state->err = err;
+ if (msg == NULL)
+ return;
+
+ /* for an out of memory error, return literal string when requested */
+ if (err == Z_MEM_ERROR)
+ return;
+
+ /* construct error message with path */
+ if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
+ NULL) {
+ state->err = Z_MEM_ERROR;
+ return;
+ }
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
- "%s%s%s", state->path, ": ", msg);
+ snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
+ "%s%s%s", state->path, ": ", msg);
#else
- strcpy(state->msg, state->path);
- strcat(state->msg, ": ");
- strcat(state->msg, msg);
+ strcpy(state->msg, state->path);
+ strcat(state->msg, ": ");
+ strcat(state->msg, msg);
#endif
- return;
+ return;
}
#ifndef INT_MAX
@@ -621,14 +621,14 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
otherwise we could just use ((unsigned)-1) >> 1 */
unsigned ZLIB_INTERNAL gz_intmax()
{
- unsigned p, q;
-
- p = 1;
- do {
- q = p;
- p <<= 1;
- p++;
- } while (p > q);
- return q >> 1;
+ unsigned p, q;
+
+ p = 1;
+ do {
+ q = p;
+ p <<= 1;
+ p++;
+ } while (p > q);
+ return q >> 1;
}
#endif
diff --git a/src/lib/zlib/gzread.c b/src/lib/zlib/gzread.c
index bf4538eb274..169ece6065b 100644
--- a/src/lib/zlib/gzread.c
+++ b/src/lib/zlib/gzread.c
@@ -18,27 +18,27 @@ local int gz_skip OF((gz_statep, z_off64_t));
This function needs to loop on read(), since read() is not guaranteed to
read the number of bytes requested, depending on the type of descriptor. */
local int gz_load(state, buf, len, have)
- gz_statep state;
- unsigned char *buf;
- unsigned len;
- unsigned *have;
+ gz_statep state;
+ unsigned char *buf;
+ unsigned len;
+ unsigned *have;
{
- int ret;
-
- *have = 0;
- do {
- ret = read(state->fd, buf + *have, len - *have);
- if (ret <= 0)
- break;
- *have += ret;
- } while (*have < len);
- if (ret < 0) {
- gz_error(state, Z_ERRNO, zstrerror());
- return -1;
- }
- if (ret == 0)
- state->eof = 1;
- return 0;
+ int ret;
+
+ *have = 0;
+ do {
+ ret = read(state->fd, buf + *have, len - *have);
+ if (ret <= 0)
+ break;
+ *have += ret;
+ } while (*have < len);
+ if (ret < 0) {
+ gz_error(state, Z_ERRNO, zstrerror());
+ return -1;
+ }
+ if (ret == 0)
+ state->eof = 1;
+ return 0;
}
/* Load up input buffer and set eof flag if last data loaded -- return -1 on
@@ -49,29 +49,29 @@ local int gz_load(state, buf, len, have)
the input buffer, and then the remainder of the buffer is loaded with the
available data from the input file. */
local int gz_avail(state)
- gz_statep state;
+ gz_statep state;
{
- unsigned got;
- z_streamp strm = &(state->strm);
-
- if (state->err != Z_OK && state->err != Z_BUF_ERROR)
- return -1;
- if (state->eof == 0) {
- if (strm->avail_in) { /* copy what's there to the start */
- unsigned char *p = state->in;
- unsigned const char *q = strm->next_in;
- unsigned n = strm->avail_in;
- do {
- *p++ = *q++;
- } while (--n);
- }
- if (gz_load(state, state->in + strm->avail_in,
- state->size - strm->avail_in, &got) == -1)
- return -1;
- strm->avail_in += got;
- strm->next_in = state->in;
- }
- return 0;
+ unsigned got;
+ z_streamp strm = &(state->strm);
+
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR)
+ return -1;
+ if (state->eof == 0) {
+ if (strm->avail_in) { /* copy what's there to the start */
+ unsigned char *p = state->in;
+ unsigned const char *q = strm->next_in;
+ unsigned n = strm->avail_in;
+ do {
+ *p++ = *q++;
+ } while (--n);
+ }
+ if (gz_load(state, state->in + strm->avail_in,
+ state->size - strm->avail_in, &got) == -1)
+ return -1;
+ strm->avail_in += got;
+ strm->next_in = state->in;
+ }
+ return 0;
}
/* Look for gzip header, set up for inflate or copy. state->x.have must be 0.
@@ -84,84 +84,84 @@ local int gz_avail(state)
a user buffer. If decompressing, the inflate state will be initialized.
gz_look() will return 0 on success or -1 on failure. */
local int gz_look(state)
- gz_statep state;
+ gz_statep state;
{
- z_streamp strm = &(state->strm);
-
- /* allocate read buffers and inflate memory */
- if (state->size == 0) {
- /* allocate buffers */
- state->in = (unsigned char *)malloc(state->want);
- state->out = (unsigned char *)malloc(state->want << 1);
- if (state->in == NULL || state->out == NULL) {
- if (state->out != NULL)
- free(state->out);
- if (state->in != NULL)
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- state->size = state->want;
-
- /* allocate inflate memory */
- state->strm.zalloc = Z_NULL;
- state->strm.zfree = Z_NULL;
- state->strm.opaque = Z_NULL;
- state->strm.avail_in = 0;
- state->strm.next_in = Z_NULL;
- if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
- free(state->out);
- free(state->in);
- state->size = 0;
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- }
-
- /* get at least the magic bytes in the input buffer */
- if (strm->avail_in < 2) {
- if (gz_avail(state) == -1)
- return -1;
- if (strm->avail_in == 0)
- return 0;
- }
-
- /* look for gzip magic bytes -- if there, do gzip decoding (note: there is
- a logical dilemma here when considering the case of a partially written
- gzip file, to wit, if a single 31 byte is written, then we cannot tell
- whether this is a single-byte file, or just a partially written gzip
- file -- for here we assume that if a gzip file is being written, then
- the header will be written in a single operation, so that reading a
- single byte is sufficient indication that it is not a gzip file) */
- if (strm->avail_in > 1 &&
- strm->next_in[0] == 31 && strm->next_in[1] == 139) {
- inflateReset(strm);
- state->how = GZIP;
- state->direct = 0;
- return 0;
- }
-
- /* no gzip header -- if we were decoding gzip before, then this is trailing
- garbage. Ignore the trailing garbage and finish. */
- if (state->direct == 0) {
- strm->avail_in = 0;
- state->eof = 1;
- state->x.have = 0;
- return 0;
- }
-
- /* doing raw i/o, copy any leftover input to output -- this assumes that
- the output buffer is larger than the input buffer, which also assures
- space for gzungetc() */
- state->x.next = state->out;
- if (strm->avail_in) {
- memcpy(state->x.next, strm->next_in, strm->avail_in);
- state->x.have = strm->avail_in;
- strm->avail_in = 0;
- }
- state->how = COPY;
- state->direct = 1;
- return 0;
+ z_streamp strm = &(state->strm);
+
+ /* allocate read buffers and inflate memory */
+ if (state->size == 0) {
+ /* allocate buffers */
+ state->in = (unsigned char *)malloc(state->want);
+ state->out = (unsigned char *)malloc(state->want << 1);
+ if (state->in == NULL || state->out == NULL) {
+ if (state->out != NULL)
+ free(state->out);
+ if (state->in != NULL)
+ free(state->in);
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+ state->size = state->want;
+
+ /* allocate inflate memory */
+ state->strm.zalloc = Z_NULL;
+ state->strm.zfree = Z_NULL;
+ state->strm.opaque = Z_NULL;
+ state->strm.avail_in = 0;
+ state->strm.next_in = Z_NULL;
+ if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
+ free(state->out);
+ free(state->in);
+ state->size = 0;
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+ }
+
+ /* get at least the magic bytes in the input buffer */
+ if (strm->avail_in < 2) {
+ if (gz_avail(state) == -1)
+ return -1;
+ if (strm->avail_in == 0)
+ return 0;
+ }
+
+ /* look for gzip magic bytes -- if there, do gzip decoding (note: there is
+ a logical dilemma here when considering the case of a partially written
+ gzip file, to wit, if a single 31 byte is written, then we cannot tell
+ whether this is a single-byte file, or just a partially written gzip
+ file -- for here we assume that if a gzip file is being written, then
+ the header will be written in a single operation, so that reading a
+ single byte is sufficient indication that it is not a gzip file) */
+ if (strm->avail_in > 1 &&
+ strm->next_in[0] == 31 && strm->next_in[1] == 139) {
+ inflateReset(strm);
+ state->how = GZIP;
+ state->direct = 0;
+ return 0;
+ }
+
+ /* no gzip header -- if we were decoding gzip before, then this is trailing
+ garbage. Ignore the trailing garbage and finish. */
+ if (state->direct == 0) {
+ strm->avail_in = 0;
+ state->eof = 1;
+ state->x.have = 0;
+ return 0;
+ }
+
+ /* doing raw i/o, copy any leftover input to output -- this assumes that
+ the output buffer is larger than the input buffer, which also assures
+ space for gzungetc() */
+ state->x.next = state->out;
+ if (strm->avail_in) {
+ memcpy(state->x.next, strm->next_in, strm->avail_in);
+ state->x.have = strm->avail_in;
+ strm->avail_in = 0;
+ }
+ state->how = COPY;
+ state->direct = 1;
+ return 0;
}
/* Decompress from input to the provided next_out and avail_out in the state.
@@ -170,51 +170,51 @@ local int gz_look(state)
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
on success, -1 on failure. */
local int gz_decomp(state)
- gz_statep state;
+ gz_statep state;
{
- int ret = Z_OK;
- unsigned had;
- z_streamp strm = &(state->strm);
-
- /* fill output buffer up to end of deflate stream */
- had = strm->avail_out;
- do {
- /* get more input for inflate() */
- if (strm->avail_in == 0 && gz_avail(state) == -1)
- return -1;
- if (strm->avail_in == 0) {
- gz_error(state, Z_BUF_ERROR, "unexpected end of file");
- break;
- }
-
- /* decompress and handle errors */
- ret = inflate(strm, Z_NO_FLUSH);
- if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
- gz_error(state, Z_STREAM_ERROR,
- "internal error: inflate stream corrupt");
- return -1;
- }
- if (ret == Z_MEM_ERROR) {
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
- gz_error(state, Z_DATA_ERROR,
- strm->msg == NULL ? "compressed data error" : strm->msg);
- return -1;
- }
- } while (strm->avail_out && ret != Z_STREAM_END);
-
- /* update available output */
- state->x.have = had - strm->avail_out;
- state->x.next = strm->next_out - state->x.have;
-
- /* if the gzip stream completed successfully, look for another */
- if (ret == Z_STREAM_END)
- state->how = LOOK;
-
- /* good decompression */
- return 0;
+ int ret = Z_OK;
+ unsigned had;
+ z_streamp strm = &(state->strm);
+
+ /* fill output buffer up to end of deflate stream */
+ had = strm->avail_out;
+ do {
+ /* get more input for inflate() */
+ if (strm->avail_in == 0 && gz_avail(state) == -1)
+ return -1;
+ if (strm->avail_in == 0) {
+ gz_error(state, Z_BUF_ERROR, "unexpected end of file");
+ break;
+ }
+
+ /* decompress and handle errors */
+ ret = inflate(strm, Z_NO_FLUSH);
+ if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
+ gz_error(state, Z_STREAM_ERROR,
+ "internal error: inflate stream corrupt");
+ return -1;
+ }
+ if (ret == Z_MEM_ERROR) {
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+ if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
+ gz_error(state, Z_DATA_ERROR,
+ strm->msg == NULL ? "compressed data error" : strm->msg);
+ return -1;
+ }
+ } while (strm->avail_out && ret != Z_STREAM_END);
+
+ /* update available output */
+ state->x.have = had - strm->avail_out;
+ state->x.next = strm->next_out - state->x.have;
+
+ /* if the gzip stream completed successfully, look for another */
+ if (ret == Z_STREAM_END)
+ state->how = LOOK;
+
+ /* good decompression */
+ return 0;
}
/* Fetch data and put it in the output buffer. Assumes state->x.have is 0.
@@ -224,158 +224,158 @@ local int gz_decomp(state)
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
end of the input file has been reached and all data has been processed. */
local int gz_fetch(state)
- gz_statep state;
+ gz_statep state;
{
- z_streamp strm = &(state->strm);
-
- do {
- switch(state->how) {
- case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
- if (gz_look(state) == -1)
- return -1;
- if (state->how == LOOK)
- return 0;
- break;
- case COPY: /* -> COPY */
- if (gz_load(state, state->out, state->size << 1, &(state->x.have))
- == -1)
- return -1;
- state->x.next = state->out;
- return 0;
- case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
- strm->avail_out = state->size << 1;
- strm->next_out = state->out;
- if (gz_decomp(state) == -1)
- return -1;
- }
- } while (state->x.have == 0 && (!state->eof || strm->avail_in));
- return 0;
+ z_streamp strm = &(state->strm);
+
+ do {
+ switch(state->how) {
+ case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
+ if (gz_look(state) == -1)
+ return -1;
+ if (state->how == LOOK)
+ return 0;
+ break;
+ case COPY: /* -> COPY */
+ if (gz_load(state, state->out, state->size << 1, &(state->x.have))
+ == -1)
+ return -1;
+ state->x.next = state->out;
+ return 0;
+ case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
+ strm->avail_out = state->size << 1;
+ strm->next_out = state->out;
+ if (gz_decomp(state) == -1)
+ return -1;
+ }
+ } while (state->x.have == 0 && (!state->eof || strm->avail_in));
+ return 0;
}
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
local int gz_skip(state, len)
- gz_statep state;
- z_off64_t len;
+ gz_statep state;
+ z_off64_t len;
{
- unsigned n;
-
- /* skip over len bytes or reach end-of-file, whichever comes first */
- while (len)
- /* skip over whatever is in output buffer */
- if (state->x.have) {
- n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
- (unsigned)len : state->x.have;
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- len -= n;
- }
-
- /* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && state->strm.avail_in == 0)
- break;
-
- /* need more data to skip -- load up output buffer */
- else {
- /* get more output, looking for header if required */
- if (gz_fetch(state) == -1)
- return -1;
- }
- return 0;
+ unsigned n;
+
+ /* skip over len bytes or reach end-of-file, whichever comes first */
+ while (len)
+ /* skip over whatever is in output buffer */
+ if (state->x.have) {
+ n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
+ (unsigned)len : state->x.have;
+ state->x.have -= n;
+ state->x.next += n;
+ state->x.pos += n;
+ len -= n;
+ }
+
+ /* output buffer empty -- return if we're at the end of the input */
+ else if (state->eof && state->strm.avail_in == 0)
+ break;
+
+ /* need more data to skip -- load up output buffer */
+ else {
+ /* get more output, looking for header if required */
+ if (gz_fetch(state) == -1)
+ return -1;
+ }
+ return 0;
}
/* -- see zlib.h -- */
int ZEXPORT gzread(file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
+ gzFile file;
+ voidp buf;
+ unsigned len;
{
- unsigned got, n;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* since an int is returned, make sure len fits in one, otherwise return
- with an error (this avoids the flaw in the interface) */
- if ((int)len < 0) {
- gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
- return -1;
- }
-
- /* if len is zero, avoid unnecessary operations */
- if (len == 0)
- return 0;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return -1;
- }
-
- /* get len bytes to buf, or less than len if at the end */
- got = 0;
- do {
- /* first just try copying data from the output buffer */
- if (state->x.have) {
- n = state->x.have > len ? len : state->x.have;
- memcpy(buf, state->x.next, n);
- state->x.next += n;
- state->x.have -= n;
- }
-
- /* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && strm->avail_in == 0) {
- state->past = 1; /* tried to read past end */
- break;
- }
-
- /* need output data -- for small len or new stream load up our output
- buffer */
- else if (state->how == LOOK || len < (state->size << 1)) {
- /* get more output, looking for header if required */
- if (gz_fetch(state) == -1)
- return -1;
- continue; /* no progress yet -- go back to copy above */
- /* the copy above assures that we will leave with space in the
- output buffer, allowing at least one gzungetc() to succeed */
- }
-
- /* large len -- read directly into user buffer */
- else if (state->how == COPY) { /* read directly */
- if (gz_load(state, (unsigned char *)buf, len, &n) == -1)
- return -1;
- }
-
- /* large len -- decompress directly into user buffer */
- else { /* state->how == GZIP */
- strm->avail_out = len;
- strm->next_out = (unsigned char *)buf;
- if (gz_decomp(state) == -1)
- return -1;
- n = state->x.have;
- state->x.have = 0;
- }
-
- /* update progress */
- len -= n;
- buf = (char *)buf + n;
- got += n;
- state->x.pos += n;
- } while (len);
-
- /* return number of bytes read into user buffer (will fit in int) */
- return (int)got;
+ unsigned got, n;
+ gz_statep state;
+ z_streamp strm;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ strm = &(state->strm);
+
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
+ return -1;
+
+ /* since an int is returned, make sure len fits in one, otherwise return
+ with an error (this avoids the flaw in the interface) */
+ if ((int)len < 0) {
+ gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
+ return -1;
+ }
+
+ /* if len is zero, avoid unnecessary operations */
+ if (len == 0)
+ return 0;
+
+ /* process a skip request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_skip(state, state->skip) == -1)
+ return -1;
+ }
+
+ /* get len bytes to buf, or less than len if at the end */
+ got = 0;
+ do {
+ /* first just try copying data from the output buffer */
+ if (state->x.have) {
+ n = state->x.have > len ? len : state->x.have;
+ memcpy(buf, state->x.next, n);
+ state->x.next += n;
+ state->x.have -= n;
+ }
+
+ /* output buffer empty -- return if we're at the end of the input */
+ else if (state->eof && strm->avail_in == 0) {
+ state->past = 1; /* tried to read past end */
+ break;
+ }
+
+ /* need output data -- for small len or new stream load up our output
+ buffer */
+ else if (state->how == LOOK || len < (state->size << 1)) {
+ /* get more output, looking for header if required */
+ if (gz_fetch(state) == -1)
+ return -1;
+ continue; /* no progress yet -- go back to copy above */
+ /* the copy above assures that we will leave with space in the
+ output buffer, allowing at least one gzungetc() to succeed */
+ }
+
+ /* large len -- read directly into user buffer */
+ else if (state->how == COPY) { /* read directly */
+ if (gz_load(state, (unsigned char *)buf, len, &n) == -1)
+ return -1;
+ }
+
+ /* large len -- decompress directly into user buffer */
+ else { /* state->how == GZIP */
+ strm->avail_out = len;
+ strm->next_out = (unsigned char *)buf;
+ if (gz_decomp(state) == -1)
+ return -1;
+ n = state->x.have;
+ state->x.have = 0;
+ }
+
+ /* update progress */
+ len -= n;
+ buf = (char *)buf + n;
+ got += n;
+ state->x.pos += n;
+ } while (len);
+
+ /* return number of bytes read into user buffer (will fit in int) */
+ return (int)got;
}
/* -- see zlib.h -- */
@@ -385,210 +385,210 @@ int ZEXPORT gzread(file, buf, len)
# undef gzgetc
#endif
int ZEXPORT gzgetc(file)
- gzFile file;
+ gzFile file;
{
- int ret;
- unsigned char buf[1];
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* try output buffer (no need to check for skip request) */
- if (state->x.have) {
- state->x.have--;
- state->x.pos++;
- return *(state->x.next)++;
- }
-
- /* nothing there -- try gzread() */
- ret = gzread(file, buf, 1);
- return ret < 1 ? -1 : buf[0];
+ int ret;
+ unsigned char buf[1];
+ gz_statep state;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
+ return -1;
+
+ /* try output buffer (no need to check for skip request) */
+ if (state->x.have) {
+ state->x.have--;
+ state->x.pos++;
+ return *(state->x.next)++;
+ }
+
+ /* nothing there -- try gzread() */
+ ret = gzread(file, buf, 1);
+ return ret < 1 ? -1 : buf[0];
}
int ZEXPORT gzgetc_(file)
gzFile file;
{
- return gzgetc(file);
+ return gzgetc(file);
}
/* -- see zlib.h -- */
int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
+ int c;
+ gzFile file;
{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return -1;
- }
-
- /* can't push EOF */
- if (c < 0)
- return -1;
-
- /* if output buffer empty, put byte at end (allows more pushing) */
- if (state->x.have == 0) {
- state->x.have = 1;
- state->x.next = state->out + (state->size << 1) - 1;
- state->x.next[0] = c;
- state->x.pos--;
- state->past = 0;
- return c;
- }
-
- /* if no room, give up (must have already done a gzungetc()) */
- if (state->x.have == (state->size << 1)) {
- gz_error(state, Z_DATA_ERROR, "out of room to push characters");
- return -1;
- }
-
- /* slide output data if needed and insert byte before existing data */
- if (state->x.next == state->out) {
- unsigned char *src = state->out + state->x.have;
- unsigned char *dest = state->out + (state->size << 1);
- while (src > state->out)
- *--dest = *--src;
- state->x.next = dest;
- }
- state->x.have++;
- state->x.next--;
- state->x.next[0] = c;
- state->x.pos--;
- state->past = 0;
- return c;
+ gz_statep state;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
+ return -1;
+
+ /* process a skip request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_skip(state, state->skip) == -1)
+ return -1;
+ }
+
+ /* can't push EOF */
+ if (c < 0)
+ return -1;
+
+ /* if output buffer empty, put byte at end (allows more pushing) */
+ if (state->x.have == 0) {
+ state->x.have = 1;
+ state->x.next = state->out + (state->size << 1) - 1;
+ state->x.next[0] = c;
+ state->x.pos--;
+ state->past = 0;
+ return c;
+ }
+
+ /* if no room, give up (must have already done a gzungetc()) */
+ if (state->x.have == (state->size << 1)) {
+ gz_error(state, Z_DATA_ERROR, "out of room to push characters");
+ return -1;
+ }
+
+ /* slide output data if needed and insert byte before existing data */
+ if (state->x.next == state->out) {
+ unsigned char *src = state->out + state->x.have;
+ unsigned char *dest = state->out + (state->size << 1);
+ while (src > state->out)
+ *--dest = *--src;
+ state->x.next = dest;
+ }
+ state->x.have++;
+ state->x.next--;
+ state->x.next[0] = c;
+ state->x.pos--;
+ state->past = 0;
+ return c;
}
/* -- see zlib.h -- */
char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
+ gzFile file;
+ char *buf;
+ int len;
{
- unsigned left, n;
- char *str;
- unsigned char *eol;
- gz_statep state;
-
- /* check parameters and get internal structure */
- if (file == NULL || buf == NULL || len < 1)
- return NULL;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return NULL;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return NULL;
- }
-
- /* copy output bytes up to new line or len - 1, whichever comes first --
- append a terminating zero to the string (we don't check for a zero in
- the contents, let the user worry about that) */
- str = buf;
- left = (unsigned)len - 1;
- if (left) do {
- /* assure that something is in the output buffer */
- if (state->x.have == 0 && gz_fetch(state) == -1)
- return NULL; /* error */
- if (state->x.have == 0) { /* end of file */
- state->past = 1; /* read past end */
- break; /* return what we have */
- }
-
- /* look for end-of-line in current output buffer */
- n = state->x.have > left ? left : state->x.have;
- eol = (unsigned char *)memchr(state->x.next, '\n', n);
- if (eol != NULL)
- n = (unsigned)(eol - state->x.next) + 1;
-
- /* copy through end-of-line, or remainder if not found */
- memcpy(buf, state->x.next, n);
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- left -= n;
- buf += n;
- } while (left && eol == NULL);
-
- /* return terminated string, or if nothing, end of file */
- if (buf == str)
- return NULL;
- buf[0] = 0;
- return str;
+ unsigned left, n;
+ char *str;
+ unsigned char *eol;
+ gz_statep state;
+
+ /* check parameters and get internal structure */
+ if (file == NULL || buf == NULL || len < 1)
+ return NULL;
+ state = (gz_statep)file;
+
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
+ return NULL;
+
+ /* process a skip request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_skip(state, state->skip) == -1)
+ return NULL;
+ }
+
+ /* copy output bytes up to new line or len - 1, whichever comes first --
+ append a terminating zero to the string (we don't check for a zero in
+ the contents, let the user worry about that) */
+ str = buf;
+ left = (unsigned)len - 1;
+ if (left) do {
+ /* assure that something is in the output buffer */
+ if (state->x.have == 0 && gz_fetch(state) == -1)
+ return NULL; /* error */
+ if (state->x.have == 0) { /* end of file */
+ state->past = 1; /* read past end */
+ break; /* return what we have */
+ }
+
+ /* look for end-of-line in current output buffer */
+ n = state->x.have > left ? left : state->x.have;
+ eol = (unsigned char *)memchr(state->x.next, '\n', n);
+ if (eol != NULL)
+ n = (unsigned)(eol - state->x.next) + 1;
+
+ /* copy through end-of-line, or remainder if not found */
+ memcpy(buf, state->x.next, n);
+ state->x.have -= n;
+ state->x.next += n;
+ state->x.pos += n;
+ left -= n;
+ buf += n;
+ } while (left && eol == NULL);
+
+ /* return terminated string, or if nothing, end of file */
+ if (buf == str)
+ return NULL;
+ buf[0] = 0;
+ return str;
}
/* -- see zlib.h -- */
int ZEXPORT gzdirect(file)
- gzFile file;
+ gzFile file;
{
- gz_statep state;
+ gz_statep state;
- /* get internal structure */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
+ /* get internal structure */
+ if (file == NULL)
+ return 0;
+ state = (gz_statep)file;
- /* if the state is not known, but we can find out, then do so (this is
- mainly for right after a gzopen() or gzdopen()) */
- if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
- (void)gz_look(state);
+ /* if the state is not known, but we can find out, then do so (this is
+ mainly for right after a gzopen() or gzdopen()) */
+ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
+ (void)gz_look(state);
- /* return 1 if transparent, 0 if processing a gzip stream */
- return state->direct;
+ /* return 1 if transparent, 0 if processing a gzip stream */
+ return state->direct;
}
/* -- see zlib.h -- */
int ZEXPORT gzclose_r(file)
- gzFile file;
+ gzFile file;
{
- int ret, err;
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- /* check that we're reading */
- if (state->mode != GZ_READ)
- return Z_STREAM_ERROR;
-
- /* free memory and close file */
- if (state->size) {
- inflateEnd(&(state->strm));
- free(state->out);
- free(state->in);
- }
- err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
- gz_error(state, Z_OK, NULL);
- free(state->path);
- ret = close(state->fd);
- free(state);
- return ret ? Z_ERRNO : err;
+ int ret, err;
+ gz_statep state;
+
+ /* get internal structure */
+ if (file == NULL)
+ return Z_STREAM_ERROR;
+ state = (gz_statep)file;
+
+ /* check that we're reading */
+ if (state->mode != GZ_READ)
+ return Z_STREAM_ERROR;
+
+ /* free memory and close file */
+ if (state->size) {
+ inflateEnd(&(state->strm));
+ free(state->out);
+ free(state->in);
+ }
+ err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
+ gz_error(state, Z_OK, NULL);
+ free(state->path);
+ ret = close(state->fd);
+ free(state);
+ return ret ? Z_ERRNO : err;
}
diff --git a/src/lib/zlib/gzwrite.c b/src/lib/zlib/gzwrite.c
index aa767fbf63e..59884210faf 100644
--- a/src/lib/zlib/gzwrite.c
+++ b/src/lib/zlib/gzwrite.c
@@ -13,52 +13,52 @@ local int gz_zero OF((gz_statep, z_off64_t));
/* Initialize state for writing a gzip file. Mark initialization by setting
state->size to non-zero. Return -1 on failure or 0 on success. */
local int gz_init(state)
- gz_statep state;
+ gz_statep state;
{
- int ret;
- z_streamp strm = &(state->strm);
-
- /* allocate input buffer */
- state->in = (unsigned char *)malloc(state->want);
- if (state->in == NULL) {
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
-
- /* only need output buffer and deflate state if compressing */
- if (!state->direct) {
- /* allocate output buffer */
- state->out = (unsigned char *)malloc(state->want);
- if (state->out == NULL) {
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
-
- /* allocate deflate memory, set up for gzip compression */
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
- strm->opaque = Z_NULL;
- ret = deflateInit2(strm, state->level, Z_DEFLATED,
- MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
- if (ret != Z_OK) {
- free(state->out);
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- }
-
- /* mark state as initialized */
- state->size = state->want;
-
- /* initialize write buffer if compressing */
- if (!state->direct) {
- strm->avail_out = state->size;
- strm->next_out = state->out;
- state->x.next = strm->next_out;
- }
- return 0;
+ int ret;
+ z_streamp strm = &(state->strm);
+
+ /* allocate input buffer */
+ state->in = (unsigned char *)malloc(state->want);
+ if (state->in == NULL) {
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+
+ /* only need output buffer and deflate state if compressing */
+ if (!state->direct) {
+ /* allocate output buffer */
+ state->out = (unsigned char *)malloc(state->want);
+ if (state->out == NULL) {
+ free(state->in);
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+
+ /* allocate deflate memory, set up for gzip compression */
+ strm->zalloc = Z_NULL;
+ strm->zfree = Z_NULL;
+ strm->opaque = Z_NULL;
+ ret = deflateInit2(strm, state->level, Z_DEFLATED,
+ MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
+ if (ret != Z_OK) {
+ free(state->out);
+ free(state->in);
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+ }
+
+ /* mark state as initialized */
+ state->size = state->want;
+
+ /* initialize write buffer if compressing */
+ if (!state->direct) {
+ strm->avail_out = state->size;
+ strm->next_out = state->out;
+ state->x.next = strm->next_out;
+ }
+ return 0;
}
/* Compress whatever is at avail_in and next_in and write to the output file.
@@ -68,239 +68,239 @@ local int gz_init(state)
is true, then simply write to the output file without compressing, and
ignore flush. */
local int gz_comp(state, flush)
- gz_statep state;
- int flush;
+ gz_statep state;
+ int flush;
{
- int ret, got;
- unsigned have;
- z_streamp strm = &(state->strm);
-
- /* allocate memory if this is the first time through */
- if (state->size == 0 && gz_init(state) == -1)
- return -1;
-
- /* write directly if requested */
- if (state->direct) {
- got = write(state->fd, strm->next_in, strm->avail_in);
- if (got < 0 || (unsigned)got != strm->avail_in) {
- gz_error(state, Z_ERRNO, zstrerror());
- return -1;
- }
- strm->avail_in = 0;
- return 0;
- }
-
- /* run deflate() on provided input until it produces no more output */
- ret = Z_OK;
- do {
- /* write out current buffer contents if full, or if flushing, but if
- doing Z_FINISH then don't write until we get to Z_STREAM_END */
- if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
- (flush != Z_FINISH || ret == Z_STREAM_END))) {
- have = (unsigned)(strm->next_out - state->x.next);
- if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
- (unsigned)got != have)) {
- gz_error(state, Z_ERRNO, zstrerror());
- return -1;
- }
- if (strm->avail_out == 0) {
- strm->avail_out = state->size;
- strm->next_out = state->out;
- }
- state->x.next = strm->next_out;
- }
-
- /* compress */
- have = strm->avail_out;
- ret = deflate(strm, flush);
- if (ret == Z_STREAM_ERROR) {
- gz_error(state, Z_STREAM_ERROR,
- "internal error: deflate stream corrupt");
- return -1;
- }
- have -= strm->avail_out;
- } while (have);
-
- /* if that completed a deflate stream, allow another to start */
- if (flush == Z_FINISH)
- deflateReset(strm);
-
- /* all done, no errors */
- return 0;
+ int ret, got;
+ unsigned have;
+ z_streamp strm = &(state->strm);
+
+ /* allocate memory if this is the first time through */
+ if (state->size == 0 && gz_init(state) == -1)
+ return -1;
+
+ /* write directly if requested */
+ if (state->direct) {
+ got = write(state->fd, strm->next_in, strm->avail_in);
+ if (got < 0 || (unsigned)got != strm->avail_in) {
+ gz_error(state, Z_ERRNO, zstrerror());
+ return -1;
+ }
+ strm->avail_in = 0;
+ return 0;
+ }
+
+ /* run deflate() on provided input until it produces no more output */
+ ret = Z_OK;
+ do {
+ /* write out current buffer contents if full, or if flushing, but if
+ doing Z_FINISH then don't write until we get to Z_STREAM_END */
+ if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
+ (flush != Z_FINISH || ret == Z_STREAM_END))) {
+ have = (unsigned)(strm->next_out - state->x.next);
+ if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
+ (unsigned)got != have)) {
+ gz_error(state, Z_ERRNO, zstrerror());
+ return -1;
+ }
+ if (strm->avail_out == 0) {
+ strm->avail_out = state->size;
+ strm->next_out = state->out;
+ }
+ state->x.next = strm->next_out;
+ }
+
+ /* compress */
+ have = strm->avail_out;
+ ret = deflate(strm, flush);
+ if (ret == Z_STREAM_ERROR) {
+ gz_error(state, Z_STREAM_ERROR,
+ "internal error: deflate stream corrupt");
+ return -1;
+ }
+ have -= strm->avail_out;
+ } while (have);
+
+ /* if that completed a deflate stream, allow another to start */
+ if (flush == Z_FINISH)
+ deflateReset(strm);
+
+ /* all done, no errors */
+ return 0;
}
/* Compress len zeros to output. Return -1 on error, 0 on success. */
local int gz_zero(state, len)
- gz_statep state;
- z_off64_t len;
+ gz_statep state;
+ z_off64_t len;
{
- int first;
- unsigned n;
- z_streamp strm = &(state->strm);
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return -1;
-
- /* compress len zeros (len guaranteed > 0) */
- first = 1;
- while (len) {
- n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
- (unsigned)len : state->size;
- if (first) {
- memset(state->in, 0, n);
- first = 0;
- }
- strm->avail_in = n;
- strm->next_in = state->in;
- state->x.pos += n;
- if (gz_comp(state, Z_NO_FLUSH) == -1)
- return -1;
- len -= n;
- }
- return 0;
+ int first;
+ unsigned n;
+ z_streamp strm = &(state->strm);
+
+ /* consume whatever's left in the input buffer */
+ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
+ return -1;
+
+ /* compress len zeros (len guaranteed > 0) */
+ first = 1;
+ while (len) {
+ n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
+ (unsigned)len : state->size;
+ if (first) {
+ memset(state->in, 0, n);
+ first = 0;
+ }
+ strm->avail_in = n;
+ strm->next_in = state->in;
+ state->x.pos += n;
+ if (gz_comp(state, Z_NO_FLUSH) == -1)
+ return -1;
+ len -= n;
+ }
+ return 0;
}
/* -- see zlib.h -- */
int ZEXPORT gzwrite(file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
+ gzFile file;
+ voidpc buf;
+ unsigned len;
{
- unsigned put = len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* since an int is returned, make sure len fits in one, otherwise return
- with an error (this avoids the flaw in the interface) */
- if ((int)len < 0) {
- gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
- return 0;
- }
-
- /* if len is zero, avoid unnecessary operations */
- if (len == 0)
- return 0;
-
- /* allocate memory if this is the first time through */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* for small len, copy to input buffer, otherwise compress directly */
- if (len < state->size) {
- /* copy to input buffer, compress when full */
- do {
- unsigned have, copy;
-
- if (strm->avail_in == 0)
- strm->next_in = state->in;
- have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
- copy = state->size - have;
- if (copy > len)
- copy = len;
- memcpy(state->in + have, buf, copy);
- strm->avail_in += copy;
- state->x.pos += copy;
- buf = (const char *)buf + copy;
- len -= copy;
- if (len && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
- } while (len);
- }
- else {
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* directly compress user buffer to file */
- strm->avail_in = len;
- strm->next_in = (z_const Bytef *)buf;
- state->x.pos += len;
- if (gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
- }
-
- /* input was all buffered or compressed (put will fit in int) */
- return (int)put;
+ unsigned put = len;
+ gz_statep state;
+ z_streamp strm;
+
+ /* get internal structure */
+ if (file == NULL)
+ return 0;
+ state = (gz_statep)file;
+ strm = &(state->strm);
+
+ /* check that we're writing and that there's no error */
+ if (state->mode != GZ_WRITE || state->err != Z_OK)
+ return 0;
+
+ /* since an int is returned, make sure len fits in one, otherwise return
+ with an error (this avoids the flaw in the interface) */
+ if ((int)len < 0) {
+ gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
+ return 0;
+ }
+
+ /* if len is zero, avoid unnecessary operations */
+ if (len == 0)
+ return 0;
+
+ /* allocate memory if this is the first time through */
+ if (state->size == 0 && gz_init(state) == -1)
+ return 0;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ return 0;
+ }
+
+ /* for small len, copy to input buffer, otherwise compress directly */
+ if (len < state->size) {
+ /* copy to input buffer, compress when full */
+ do {
+ unsigned have, copy;
+
+ if (strm->avail_in == 0)
+ strm->next_in = state->in;
+ have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
+ copy = state->size - have;
+ if (copy > len)
+ copy = len;
+ memcpy(state->in + have, buf, copy);
+ strm->avail_in += copy;
+ state->x.pos += copy;
+ buf = (const char *)buf + copy;
+ len -= copy;
+ if (len && gz_comp(state, Z_NO_FLUSH) == -1)
+ return 0;
+ } while (len);
+ }
+ else {
+ /* consume whatever's left in the input buffer */
+ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
+ return 0;
+
+ /* directly compress user buffer to file */
+ strm->avail_in = len;
+ strm->next_in = (z_const Bytef *)buf;
+ state->x.pos += len;
+ if (gz_comp(state, Z_NO_FLUSH) == -1)
+ return 0;
+ }
+
+ /* input was all buffered or compressed (put will fit in int) */
+ return (int)put;
}
/* -- see zlib.h -- */
int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
+ gzFile file;
+ int c;
{
- unsigned have;
- unsigned char buf[1];
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return -1;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* try writing to input buffer for speed (state->size == 0 if buffer not
- initialized) */
- if (state->size) {
- if (strm->avail_in == 0)
- strm->next_in = state->in;
- have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
- if (have < state->size) {
- state->in[have] = c;
- strm->avail_in++;
- state->x.pos++;
- return c & 0xff;
- }
- }
-
- /* no room in buffer or not initialized, use gz_write() */
- buf[0] = c;
- if (gzwrite(file, buf, 1) != 1)
- return -1;
- return c & 0xff;
+ unsigned have;
+ unsigned char buf[1];
+ gz_statep state;
+ z_streamp strm;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ strm = &(state->strm);
+
+ /* check that we're writing and that there's no error */
+ if (state->mode != GZ_WRITE || state->err != Z_OK)
+ return -1;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ return -1;
+ }
+
+ /* try writing to input buffer for speed (state->size == 0 if buffer not
+ initialized) */
+ if (state->size) {
+ if (strm->avail_in == 0)
+ strm->next_in = state->in;
+ have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
+ if (have < state->size) {
+ state->in[have] = c;
+ strm->avail_in++;
+ state->x.pos++;
+ return c & 0xff;
+ }
+ }
+
+ /* no room in buffer or not initialized, use gz_write() */
+ buf[0] = c;
+ if (gzwrite(file, buf, 1) != 1)
+ return -1;
+ return c & 0xff;
}
/* -- see zlib.h -- */
int ZEXPORT gzputs(file, str)
- gzFile file;
- const char *str;
+ gzFile file;
+ const char *str;
{
- int ret;
- unsigned len;
+ int ret;
+ unsigned len;
- /* write string */
- len = (unsigned)strlen(str);
- ret = gzwrite(file, str, len);
- return ret == 0 && len != 0 ? -1 : ret;
+ /* write string */
+ len = (unsigned)strlen(str);
+ ret = gzwrite(file, str, len);
+ return ret == 0 && len != 0 ? -1 : ret;
}
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
@@ -309,269 +309,269 @@ int ZEXPORT gzputs(file, str)
/* -- see zlib.h -- */
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
{
- int size, len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
+ int size, len;
+ gz_statep state;
+ z_streamp strm;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ strm = &(state->strm);
+
+ /* check that we're writing and that there's no error */
+ if (state->mode != GZ_WRITE || state->err != Z_OK)
+ return 0;
+
+ /* make sure we have some buffer space */
+ if (state->size == 0 && gz_init(state) == -1)
+ return 0;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ return 0;
+ }
+
+ /* consume whatever's left in the input buffer */
+ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
+ return 0;
+
+ /* do the printf() into the input buffer, put length in len */
+ size = (int)(state->size);
+ state->in[size - 1] = 0;
#ifdef NO_vsnprintf
# ifdef HAS_vsprintf_void
- (void)vsprintf((char *)(state->in), format, va);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
+ (void)vsprintf((char *)(state->in), format, va);
+ for (len = 0; len < size; len++)
+ if (state->in[len] == 0) break;
# else
- len = vsprintf((char *)(state->in), format, va);
+ len = vsprintf((char *)(state->in), format, va);
# endif
#else
# ifdef HAS_vsnprintf_void
- (void)vsnprintf((char *)(state->in), size, format, va);
- len = strlen((char *)(state->in));
+ (void)vsnprintf((char *)(state->in), size, format, va);
+ len = strlen((char *)(state->in));
# else
- len = vsnprintf((char *)(state->in), size, format, va);
+ len = vsnprintf((char *)(state->in), size, format, va);
# endif
#endif
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
+ /* check that printf() results fit in buffer */
+ if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
+ return 0;
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
+ /* update buffer and position, defer compression until needed */
+ strm->avail_in = (unsigned)len;
+ strm->next_in = state->in;
+ state->x.pos += len;
+ return len;
}
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
{
- va_list va;
- int ret;
+ va_list va;
+ int ret;
- va_start(va, format);
- ret = gzvprintf(file, format, va);
- va_end(va);
- return ret;
+ va_start(va, format);
+ ret = gzvprintf(file, format, va);
+ va_end(va);
+ return ret;
}
#else /* !STDC && !Z_HAVE_STDARG_H */
/* -- see zlib.h -- */
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
+ gzFile file;
+ const char *format;
+ int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
{
- int size, len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that can really pass pointer in ints */
- if (sizeof(int) != sizeof(void *))
- return 0;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
+ int size, len;
+ gz_statep state;
+ z_streamp strm;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+ strm = &(state->strm);
+
+ /* check that can really pass pointer in ints */
+ if (sizeof(int) != sizeof(void *))
+ return 0;
+
+ /* check that we're writing and that there's no error */
+ if (state->mode != GZ_WRITE || state->err != Z_OK)
+ return 0;
+
+ /* make sure we have some buffer space */
+ if (state->size == 0 && gz_init(state) == -1)
+ return 0;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ return 0;
+ }
+
+ /* consume whatever's left in the input buffer */
+ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
+ return 0;
+
+ /* do the printf() into the input buffer, put length in len */
+ size = (int)(state->size);
+ state->in[size - 1] = 0;
#ifdef NO_snprintf
# ifdef HAS_sprintf_void
- sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
+ sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+ for (len = 0; len < size; len++)
+ if (state->in[len] == 0) break;
# else
- len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+ len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
# endif
#else
# ifdef HAS_snprintf_void
- snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen((char *)(state->in));
+ snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+ len = strlen((char *)(state->in));
# else
- len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
- a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
- a19, a20);
+ len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
+ a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
+ a19, a20);
# endif
#endif
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
+ /* check that printf() results fit in buffer */
+ if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
+ return 0;
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
+ /* update buffer and position, defer compression until needed */
+ strm->avail_in = (unsigned)len;
+ strm->next_in = state->in;
+ state->x.pos += len;
+ return len;
}
#endif
/* -- see zlib.h -- */
int ZEXPORT gzflush(file, flush)
- gzFile file;
- int flush;
+ gzFile file;
+ int flush;
{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return Z_STREAM_ERROR;
-
- /* check flush parameter */
- if (flush < 0 || flush > Z_FINISH)
- return Z_STREAM_ERROR;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* compress remaining data with requested flush */
- gz_comp(state, flush);
- return state->err;
+ gz_statep state;
+
+ /* get internal structure */
+ if (file == NULL)
+ return -1;
+ state = (gz_statep)file;
+
+ /* check that we're writing and that there's no error */
+ if (state->mode != GZ_WRITE || state->err != Z_OK)
+ return Z_STREAM_ERROR;
+
+ /* check flush parameter */
+ if (flush < 0 || flush > Z_FINISH)
+ return Z_STREAM_ERROR;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ return -1;
+ }
+
+ /* compress remaining data with requested flush */
+ gz_comp(state, flush);
+ return state->err;
}
/* -- see zlib.h -- */
int ZEXPORT gzsetparams(file, level, strategy)
- gzFile file;
- int level;
- int strategy;
+ gzFile file;
+ int level;
+ int strategy;
{
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return Z_STREAM_ERROR;
-
- /* if no change is requested, then do nothing */
- if (level == state->level && strategy == state->strategy)
- return Z_OK;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* change compression parameters for subsequent input */
- if (state->size) {
- /* flush previous input with previous parameters before changing */
- if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
- return state->err;
- deflateParams(strm, level, strategy);
- }
- state->level = level;
- state->strategy = strategy;
- return Z_OK;
+ gz_statep state;
+ z_streamp strm;
+
+ /* get internal structure */
+ if (file == NULL)
+ return Z_STREAM_ERROR;
+ state = (gz_statep)file;
+ strm = &(state->strm);
+
+ /* check that we're writing and that there's no error */
+ if (state->mode != GZ_WRITE || state->err != Z_OK)
+ return Z_STREAM_ERROR;
+
+ /* if no change is requested, then do nothing */
+ if (level == state->level && strategy == state->strategy)
+ return Z_OK;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ return -1;
+ }
+
+ /* change compression parameters for subsequent input */
+ if (state->size) {
+ /* flush previous input with previous parameters before changing */
+ if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
+ return state->err;
+ deflateParams(strm, level, strategy);
+ }
+ state->level = level;
+ state->strategy = strategy;
+ return Z_OK;
}
/* -- see zlib.h -- */
int ZEXPORT gzclose_w(file)
- gzFile file;
+ gzFile file;
{
- int ret = Z_OK;
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- /* check that we're writing */
- if (state->mode != GZ_WRITE)
- return Z_STREAM_ERROR;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- ret = state->err;
- }
-
- /* flush, free memory, and close file */
- if (gz_comp(state, Z_FINISH) == -1)
- ret = state->err;
- if (state->size) {
- if (!state->direct) {
- (void)deflateEnd(&(state->strm));
- free(state->out);
- }
- free(state->in);
- }
- gz_error(state, Z_OK, NULL);
- free(state->path);
- if (close(state->fd) == -1)
- ret = Z_ERRNO;
- free(state);
- return ret;
+ int ret = Z_OK;
+ gz_statep state;
+
+ /* get internal structure */
+ if (file == NULL)
+ return Z_STREAM_ERROR;
+ state = (gz_statep)file;
+
+ /* check that we're writing */
+ if (state->mode != GZ_WRITE)
+ return Z_STREAM_ERROR;
+
+ /* check for seek request */
+ if (state->seek) {
+ state->seek = 0;
+ if (gz_zero(state, state->skip) == -1)
+ ret = state->err;
+ }
+
+ /* flush, free memory, and close file */
+ if (gz_comp(state, Z_FINISH) == -1)
+ ret = state->err;
+ if (state->size) {
+ if (!state->direct) {
+ (void)deflateEnd(&(state->strm));
+ free(state->out);
+ }
+ free(state->in);
+ }
+ gz_error(state, Z_OK, NULL);
+ free(state->path);
+ if (close(state->fd) == -1)
+ ret = Z_ERRNO;
+ free(state);
+ return ret;
}
diff --git a/src/lib/zlib/infback.c b/src/lib/zlib/infback.c
index f3833c2e434..140884ac871 100644
--- a/src/lib/zlib/infback.c
+++ b/src/lib/zlib/infback.c
@@ -32,41 +32,41 @@ unsigned char FAR *window;
const char *version;
int stream_size;
{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL ||
- windowBits < 8 || windowBits > 15)
- return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
+ struct inflate_state FAR *state;
+
+ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+ stream_size != (int)(sizeof(z_stream)))
+ return Z_VERSION_ERROR;
+ if (strm == Z_NULL || window == Z_NULL ||
+ windowBits < 8 || windowBits > 15)
+ return Z_STREAM_ERROR;
+ strm->msg = Z_NULL; /* in case we return an error */
+ if (strm->zalloc == (alloc_func)0) {
#ifdef Z_SOLO
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
#endif
- }
- if (strm->zfree == (free_func)0)
+ }
+ if (strm->zfree == (free_func)0)
#ifdef Z_SOLO
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- strm->zfree = zcfree;
+ strm->zfree = zcfree;
#endif
- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
- sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->dmax = 32768U;
- state->wbits = windowBits;
- state->wsize = 1U << windowBits;
- state->window = window;
- state->wnext = 0;
- state->whave = 0;
- return Z_OK;
+ state = (struct inflate_state FAR *)ZALLOC(strm, 1,
+ sizeof(struct inflate_state));
+ if (state == Z_NULL) return Z_MEM_ERROR;
+ Tracev((stderr, "inflate: allocated\n"));
+ strm->state = (struct internal_state FAR *)state;
+ state->dmax = 32768U;
+ state->wbits = windowBits;
+ state->wsize = 1U << windowBits;
+ state->window = window;
+ state->wnext = 0;
+ state->whave = 0;
+ return Z_OK;
}
/*
@@ -83,142 +83,142 @@ local void fixedtables(state)
struct inflate_state FAR *state;
{
#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
+ static int virgin = 1;
+ static code *lenfix, *distfix;
+ static code fixed[544];
+
+ /* build fixed huffman tables if first call (may not be thread safe) */
+ if (virgin) {
+ unsigned sym, bits;
+ static code *next;
+
+ /* literal/length table */
+ sym = 0;
+ while (sym < 144) state->lens[sym++] = 8;
+ while (sym < 256) state->lens[sym++] = 9;
+ while (sym < 280) state->lens[sym++] = 7;
+ while (sym < 288) state->lens[sym++] = 8;
+ next = fixed;
+ lenfix = next;
+ bits = 9;
+ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+
+ /* distance table */
+ sym = 0;
+ while (sym < 32) state->lens[sym++] = 5;
+ distfix = next;
+ bits = 5;
+ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+
+ /* do this just once */
+ virgin = 0;
+ }
#else /* !BUILDFIXED */
# include "inffixed.h"
#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
+ state->lencode = lenfix;
+ state->lenbits = 9;
+ state->distcode = distfix;
+ state->distbits = 5;
}
/* Macros for inflateBack(): */
/* Load returned state from inflate_fast() */
#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
+ do { \
+ put = strm->next_out; \
+ left = strm->avail_out; \
+ next = strm->next_in; \
+ have = strm->avail_in; \
+ hold = state->hold; \
+ bits = state->bits; \
+ } while (0)
/* Set state from registers for inflate_fast() */
#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
+ do { \
+ strm->next_out = put; \
+ strm->avail_out = left; \
+ strm->next_in = next; \
+ strm->avail_in = have; \
+ state->hold = hold; \
+ state->bits = bits; \
+ } while (0)
/* Clear the input bit accumulator */
#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
+ do { \
+ hold = 0; \
+ bits = 0; \
+ } while (0)
/* Assure that some input is available. If input is requested, but denied,
then return a Z_BUF_ERROR from inflateBack(). */
#define PULL() \
- do { \
- if (have == 0) { \
- have = in(in_desc, &next); \
- if (have == 0) { \
- next = Z_NULL; \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
+ do { \
+ if (have == 0) { \
+ have = in(in_desc, &next); \
+ if (have == 0) { \
+ next = Z_NULL; \
+ ret = Z_BUF_ERROR; \
+ goto inf_leave; \
+ } \
+ } \
+ } while (0)
/* Get a byte of input into the bit accumulator, or return from inflateBack()
with an error if there is no input available. */
#define PULLBYTE() \
- do { \
- PULL(); \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
+ do { \
+ PULL(); \
+ have--; \
+ hold += (unsigned long)(*next++) << bits; \
+ bits += 8; \
+ } while (0)
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflateBack() with
an error. */
#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
+ do { \
+ while (bits < (unsigned)(n)) \
+ PULLBYTE(); \
+ } while (0)
/* Return the low n bits of the bit accumulator (n < 16) */
#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
+ ((unsigned)hold & ((1U << (n)) - 1))
/* Remove n bits from the bit accumulator */
#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
+ do { \
+ hold >>= (n); \
+ bits -= (unsigned)(n); \
+ } while (0)
/* Remove zero to seven bits as needed to go to a byte boundary */
#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
+ do { \
+ hold >>= bits & 7; \
+ bits -= bits & 7; \
+ } while (0)
/* Assure that some output space is available, by writing out the window
if it's full. If the write fails, return from inflateBack() with a
Z_BUF_ERROR. */
#define ROOM() \
- do { \
- if (left == 0) { \
- put = state->window; \
- left = state->wsize; \
- state->whave = left; \
- if (out(out_desc, put, left)) { \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
+ do { \
+ if (left == 0) { \
+ put = state->window; \
+ left = state->wsize; \
+ state->whave = left; \
+ if (out(out_desc, put, left)) { \
+ ret = Z_BUF_ERROR; \
+ goto inf_leave; \
+ } \
+ } \
+ } while (0)
/*
strm provides the memory allocation functions and window buffer on input,
@@ -254,387 +254,387 @@ void FAR *in_desc;
out_func out;
void FAR *out_desc;
{
- struct inflate_state FAR *state;
- z_const unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code here; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- /* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* Reset the state */
- strm->msg = Z_NULL;
- state->mode = TYPE;
- state->last = 0;
- state->whave = 0;
- next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
- hold = 0;
- bits = 0;
- put = state->window;
- left = state->wsize;
-
- /* Inflate until end of block marked as last */
- for (;;)
- switch (state->mode) {
- case TYPE:
- /* determine and dispatch block type */
- if (state->last) {
- BYTEBITS();
- state->mode = DONE;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
-
- case STORED:
- /* get and verify stored block length */
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
-
- /* copy stored block from input to output */
- while (state->length != 0) {
- copy = state->length;
- PULL();
- ROOM();
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
-
- case TABLE:
- /* get dynamic table entries descriptor */
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
+ struct inflate_state FAR *state;
+ z_const unsigned char FAR *next; /* next input */
+ unsigned char FAR *put; /* next output */
+ unsigned have, left; /* available input and output */
+ unsigned long hold; /* bit buffer */
+ unsigned bits; /* bits in bit buffer */
+ unsigned copy; /* number of stored or match bytes to copy */
+ unsigned char FAR *from; /* where to copy match bytes from */
+ code here; /* current decoding table entry */
+ code last; /* parent table entry */
+ unsigned len; /* length to copy for repeats, bits to drop */
+ int ret; /* return code */
+ static const unsigned short order[19] = /* permutation of code lengths */
+ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+ /* Check that the strm exists and that the state was initialized */
+ if (strm == Z_NULL || strm->state == Z_NULL)
+ return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+
+ /* Reset the state */
+ strm->msg = Z_NULL;
+ state->mode = TYPE;
+ state->last = 0;
+ state->whave = 0;
+ next = strm->next_in;
+ have = next != Z_NULL ? strm->avail_in : 0;
+ hold = 0;
+ bits = 0;
+ put = state->window;
+ left = state->wsize;
+
+ /* Inflate until end of block marked as last */
+ for (;;)
+ switch (state->mode) {
+ case TYPE:
+ /* determine and dispatch block type */
+ if (state->last) {
+ BYTEBITS();
+ state->mode = DONE;
+ break;
+ }
+ NEEDBITS(3);
+ state->last = BITS(1);
+ DROPBITS(1);
+ switch (BITS(2)) {
+ case 0: /* stored block */
+ Tracev((stderr, "inflate: stored block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = STORED;
+ break;
+ case 1: /* fixed block */
+ fixedtables(state);
+ Tracev((stderr, "inflate: fixed codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = LEN; /* decode codes */
+ break;
+ case 2: /* dynamic block */
+ Tracev((stderr, "inflate: dynamic codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = TABLE;
+ break;
+ case 3:
+ strm->msg = (char *)"invalid block type";
+ state->mode = BAD;
+ }
+ DROPBITS(2);
+ break;
+
+ case STORED:
+ /* get and verify stored block length */
+ BYTEBITS(); /* go to byte boundary */
+ NEEDBITS(32);
+ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+ strm->msg = (char *)"invalid stored block lengths";
+ state->mode = BAD;
+ break;
+ }
+ state->length = (unsigned)hold & 0xffff;
+ Tracev((stderr, "inflate: stored length %u\n",
+ state->length));
+ INITBITS();
+
+ /* copy stored block from input to output */
+ while (state->length != 0) {
+ copy = state->length;
+ PULL();
+ ROOM();
+ if (copy > have) copy = have;
+ if (copy > left) copy = left;
+ zmemcpy(put, next, copy);
+ have -= copy;
+ next += copy;
+ left -= copy;
+ put += copy;
+ state->length -= copy;
+ }
+ Tracev((stderr, "inflate: stored end\n"));
+ state->mode = TYPE;
+ break;
+
+ case TABLE:
+ /* get dynamic table entries descriptor */
+ NEEDBITS(14);
+ state->nlen = BITS(5) + 257;
+ DROPBITS(5);
+ state->ndist = BITS(5) + 1;
+ DROPBITS(5);
+ state->ncode = BITS(4) + 4;
+ DROPBITS(4);
#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
+ if (state->nlen > 286 || state->ndist > 30) {
+ strm->msg = (char *)"too many length or distance symbols";
+ state->mode = BAD;
+ break;
+ }
#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
-
- /* get code length code lengths (not a typo) */
- state->have = 0;
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
-
- /* get length and distance code code lengths */
- state->have = 0;
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.val < 16) {
- DROPBITS(here.bits);
- state->lens[state->have++] = here.val;
- }
- else {
- if (here.val == 16) {
- NEEDBITS(here.bits + 2);
- DROPBITS(here.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = (unsigned)(state->lens[state->have - 1]);
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (here.val == 17) {
- NEEDBITS(here.bits + 3);
- DROPBITS(here.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(here.bits + 7);
- DROPBITS(here.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* check for end-of-block code (better have one) */
- if (state->lens[256] == 0) {
- strm->msg = (char *)"invalid code -- missing end-of-block";
- state->mode = BAD;
- break;
- }
-
- /* build code tables -- note: do not change the lenbits or distbits
- values here (9 and 6) without reading the comments in inftrees.h
- concerning the ENOUGH constants, which depend on those values */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
-
- case LEN:
- /* use inflate_fast() if we have enough input and output */
- if (have >= 6 && left >= 258) {
- RESTORE();
- if (state->whave < state->wsize)
- state->whave = state->wsize - left;
- inflate_fast(strm, state->wsize);
- LOAD();
- break;
- }
-
- /* get a literal, length, or end-of-block code */
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.op && (here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(here.bits);
- state->length = (unsigned)here.val;
-
- /* process literal */
- if (here.op == 0) {
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- ROOM();
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- }
-
- /* process end of block */
- if (here.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
-
- /* invalid code */
- if (here.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
-
- /* length code -- get extra bits, if any */
- state->extra = (unsigned)(here.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
-
- /* get distance code */
- for (;;) {
- here = state->distcode[BITS(state->distbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if ((here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(here.bits);
- if (here.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)here.val;
-
- /* get distance extra bits, if any */
- state->extra = (unsigned)(here.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
- if (state->offset > state->wsize - (state->whave < state->wsize ?
- left : 0)) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
-
- /* copy match from window to output */
- do {
- ROOM();
- copy = state->wsize - state->offset;
- if (copy < left) {
- from = put + copy;
- copy = left - copy;
- }
- else {
- from = put - state->offset;
- copy = left;
- }
- if (copy > state->length) copy = state->length;
- state->length -= copy;
- left -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- } while (state->length != 0);
- break;
-
- case DONE:
- /* inflate stream terminated properly -- write leftover output */
- ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
- goto inf_leave;
-
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
-
- default: /* can't happen, but makes compilers happy */
- ret = Z_STREAM_ERROR;
- goto inf_leave;
- }
-
- /* Return unused input */
- inf_leave:
- strm->next_in = next;
- strm->avail_in = have;
- return ret;
+ Tracev((stderr, "inflate: table sizes ok\n"));
+
+ /* get code length code lengths (not a typo) */
+ state->have = 0;
+ while (state->have < state->ncode) {
+ NEEDBITS(3);
+ state->lens[order[state->have++]] = (unsigned short)BITS(3);
+ DROPBITS(3);
+ }
+ while (state->have < 19)
+ state->lens[order[state->have++]] = 0;
+ state->next = state->codes;
+ state->lencode = (code const FAR *)(state->next);
+ state->lenbits = 7;
+ ret = inflate_table(CODES, state->lens, 19, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid code lengths set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: code lengths ok\n"));
+
+ /* get length and distance code code lengths */
+ state->have = 0;
+ while (state->have < state->nlen + state->ndist) {
+ for (;;) {
+ here = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (here.val < 16) {
+ DROPBITS(here.bits);
+ state->lens[state->have++] = here.val;
+ }
+ else {
+ if (here.val == 16) {
+ NEEDBITS(here.bits + 2);
+ DROPBITS(here.bits);
+ if (state->have == 0) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ len = (unsigned)(state->lens[state->have - 1]);
+ copy = 3 + BITS(2);
+ DROPBITS(2);
+ }
+ else if (here.val == 17) {
+ NEEDBITS(here.bits + 3);
+ DROPBITS(here.bits);
+ len = 0;
+ copy = 3 + BITS(3);
+ DROPBITS(3);
+ }
+ else {
+ NEEDBITS(here.bits + 7);
+ DROPBITS(here.bits);
+ len = 0;
+ copy = 11 + BITS(7);
+ DROPBITS(7);
+ }
+ if (state->have + copy > state->nlen + state->ndist) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ while (copy--)
+ state->lens[state->have++] = (unsigned short)len;
+ }
+ }
+
+ /* handle error breaks in while */
+ if (state->mode == BAD) break;
+
+ /* check for end-of-block code (better have one) */
+ if (state->lens[256] == 0) {
+ strm->msg = (char *)"invalid code -- missing end-of-block";
+ state->mode = BAD;
+ break;
+ }
+
+ /* build code tables -- note: do not change the lenbits or distbits
+ values here (9 and 6) without reading the comments in inftrees.h
+ concerning the ENOUGH constants, which depend on those values */
+ state->next = state->codes;
+ state->lencode = (code const FAR *)(state->next);
+ state->lenbits = 9;
+ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid literal/lengths set";
+ state->mode = BAD;
+ break;
+ }
+ state->distcode = (code const FAR *)(state->next);
+ state->distbits = 6;
+ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ &(state->next), &(state->distbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid distances set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: codes ok\n"));
+ state->mode = LEN;
+
+ case LEN:
+ /* use inflate_fast() if we have enough input and output */
+ if (have >= 6 && left >= 258) {
+ RESTORE();
+ if (state->whave < state->wsize)
+ state->whave = state->wsize - left;
+ inflate_fast(strm, state->wsize);
+ LOAD();
+ break;
+ }
+
+ /* get a literal, length, or end-of-block code */
+ for (;;) {
+ here = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (here.op && (here.op & 0xf0) == 0) {
+ last = here;
+ for (;;) {
+ here = state->lencode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ }
+ DROPBITS(here.bits);
+ state->length = (unsigned)here.val;
+
+ /* process literal */
+ if (here.op == 0) {
+ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", here.val));
+ ROOM();
+ *put++ = (unsigned char)(state->length);
+ left--;
+ state->mode = LEN;
+ break;
+ }
+
+ /* process end of block */
+ if (here.op & 32) {
+ Tracevv((stderr, "inflate: end of block\n"));
+ state->mode = TYPE;
+ break;
+ }
+
+ /* invalid code */
+ if (here.op & 64) {
+ strm->msg = (char *)"invalid literal/length code";
+ state->mode = BAD;
+ break;
+ }
+
+ /* length code -- get extra bits, if any */
+ state->extra = (unsigned)(here.op) & 15;
+ if (state->extra != 0) {
+ NEEDBITS(state->extra);
+ state->length += BITS(state->extra);
+ DROPBITS(state->extra);
+ }
+ Tracevv((stderr, "inflate: length %u\n", state->length));
+
+ /* get distance code */
+ for (;;) {
+ here = state->distcode[BITS(state->distbits)];
+ if ((unsigned)(here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if ((here.op & 0xf0) == 0) {
+ last = here;
+ for (;;) {
+ here = state->distcode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ }
+ DROPBITS(here.bits);
+ if (here.op & 64) {
+ strm->msg = (char *)"invalid distance code";
+ state->mode = BAD;
+ break;
+ }
+ state->offset = (unsigned)here.val;
+
+ /* get distance extra bits, if any */
+ state->extra = (unsigned)(here.op) & 15;
+ if (state->extra != 0) {
+ NEEDBITS(state->extra);
+ state->offset += BITS(state->extra);
+ DROPBITS(state->extra);
+ }
+ if (state->offset > state->wsize - (state->whave < state->wsize ?
+ left : 0)) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
+ Tracevv((stderr, "inflate: distance %u\n", state->offset));
+
+ /* copy match from window to output */
+ do {
+ ROOM();
+ copy = state->wsize - state->offset;
+ if (copy < left) {
+ from = put + copy;
+ copy = left - copy;
+ }
+ else {
+ from = put - state->offset;
+ copy = left;
+ }
+ if (copy > state->length) copy = state->length;
+ state->length -= copy;
+ left -= copy;
+ do {
+ *put++ = *from++;
+ } while (--copy);
+ } while (state->length != 0);
+ break;
+
+ case DONE:
+ /* inflate stream terminated properly -- write leftover output */
+ ret = Z_STREAM_END;
+ if (left < state->wsize) {
+ if (out(out_desc, state->window, state->wsize - left))
+ ret = Z_BUF_ERROR;
+ }
+ goto inf_leave;
+
+ case BAD:
+ ret = Z_DATA_ERROR;
+ goto inf_leave;
+
+ default: /* can't happen, but makes compilers happy */
+ ret = Z_STREAM_ERROR;
+ goto inf_leave;
+ }
+
+ /* Return unused input */
+ inf_leave:
+ strm->next_in = next;
+ strm->avail_in = have;
+ return ret;
}
int ZEXPORT inflateBackEnd(strm)
z_streamp strm;
{
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+ return Z_STREAM_ERROR;
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+ Tracev((stderr, "inflate: end\n"));
+ return Z_OK;
}
diff --git a/src/lib/zlib/inffast.c b/src/lib/zlib/inffast.c
index bda59ceb6a1..3fb5bf9cf38 100644
--- a/src/lib/zlib/inffast.c
+++ b/src/lib/zlib/inffast.c
@@ -68,259 +68,259 @@ void ZLIB_INTERNAL inflate_fast(strm, start)
z_streamp strm;
unsigned start; /* inflate()'s starting value for strm->avail_out */
{
- struct inflate_state FAR *state;
- z_const unsigned char FAR *in; /* local strm->next_in */
- z_const unsigned char FAR *last; /* have enough input while in < last */
- unsigned char FAR *out; /* local strm->next_out */
- unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
- unsigned char FAR *end; /* while out < end, enough space available */
+ struct inflate_state FAR *state;
+ z_const unsigned char FAR *in; /* local strm->next_in */
+ z_const unsigned char FAR *last; /* have enough input while in < last */
+ unsigned char FAR *out; /* local strm->next_out */
+ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
+ unsigned char FAR *end; /* while out < end, enough space available */
#ifdef INFLATE_STRICT
- unsigned dmax; /* maximum distance from zlib header */
+ unsigned dmax; /* maximum distance from zlib header */
#endif
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned wnext; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
- unsigned long hold; /* local strm->hold */
- unsigned bits; /* local strm->bits */
- code const FAR *lcode; /* local strm->lencode */
- code const FAR *dcode; /* local strm->distcode */
- unsigned lmask; /* mask for first level of length codes */
- unsigned dmask; /* mask for first level of distance codes */
- code here; /* retrieved table entry */
- unsigned op; /* code bits, operation, extra bits, or */
- /* window position, window bytes to copy */
- unsigned len; /* match length, unused bytes */
- unsigned dist; /* match distance */
- unsigned char FAR *from; /* where to copy match from */
+ unsigned wsize; /* window size or zero if not using window */
+ unsigned whave; /* valid bytes in the window */
+ unsigned wnext; /* window write index */
+ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
+ unsigned long hold; /* local strm->hold */
+ unsigned bits; /* local strm->bits */
+ code const FAR *lcode; /* local strm->lencode */
+ code const FAR *dcode; /* local strm->distcode */
+ unsigned lmask; /* mask for first level of length codes */
+ unsigned dmask; /* mask for first level of distance codes */
+ code here; /* retrieved table entry */
+ unsigned op; /* code bits, operation, extra bits, or */
+ /* window position, window bytes to copy */
+ unsigned len; /* match length, unused bytes */
+ unsigned dist; /* match distance */
+ unsigned char FAR *from; /* where to copy match from */
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
- in = strm->next_in - OFF;
- last = in + (strm->avail_in - 5);
- out = strm->next_out - OFF;
- beg = out - (start - strm->avail_out);
- end = out + (strm->avail_out - 257);
+ /* copy state to local variables */
+ state = (struct inflate_state FAR *)strm->state;
+ in = strm->next_in - OFF;
+ last = in + (strm->avail_in - 5);
+ out = strm->next_out - OFF;
+ beg = out - (start - strm->avail_out);
+ end = out + (strm->avail_out - 257);
#ifdef INFLATE_STRICT
- dmax = state->dmax;
+ dmax = state->dmax;
#endif
- wsize = state->wsize;
- whave = state->whave;
- wnext = state->wnext;
- window = state->window;
- hold = state->hold;
- bits = state->bits;
- lcode = state->lencode;
- dcode = state->distcode;
- lmask = (1U << state->lenbits) - 1;
- dmask = (1U << state->distbits) - 1;
+ wsize = state->wsize;
+ whave = state->whave;
+ wnext = state->wnext;
+ window = state->window;
+ hold = state->hold;
+ bits = state->bits;
+ lcode = state->lencode;
+ dcode = state->distcode;
+ lmask = (1U << state->lenbits) - 1;
+ dmask = (1U << state->distbits) - 1;
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
- do {
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- here = lcode[hold & lmask];
- dolen:
- op = (unsigned)(here.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(here.op);
- if (op == 0) { /* literal */
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- PUP(out) = (unsigned char)(here.val);
- }
- else if (op & 16) { /* length base */
- len = (unsigned)(here.val);
- op &= 15; /* number of extra bits */
- if (op) {
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- len += (unsigned)hold & ((1U << op) - 1);
- hold >>= op;
- bits -= op;
- }
- Tracevv((stderr, "inflate: length %u\n", len));
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- here = dcode[hold & dmask];
- dodist:
- op = (unsigned)(here.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(here.op);
- if (op & 16) { /* distance base */
- dist = (unsigned)(here.val);
- op &= 15; /* number of extra bits */
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- }
- dist += (unsigned)hold & ((1U << op) - 1);
+ /* decode literals and length/distances until end-of-block or not enough
+ input data or output space */
+ do {
+ if (bits < 15) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ here = lcode[hold & lmask];
+ dolen:
+ op = (unsigned)(here.bits);
+ hold >>= op;
+ bits -= op;
+ op = (unsigned)(here.op);
+ if (op == 0) { /* literal */
+ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", here.val));
+ PUP(out) = (unsigned char)(here.val);
+ }
+ else if (op & 16) { /* length base */
+ len = (unsigned)(here.val);
+ op &= 15; /* number of extra bits */
+ if (op) {
+ if (bits < op) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ len += (unsigned)hold & ((1U << op) - 1);
+ hold >>= op;
+ bits -= op;
+ }
+ Tracevv((stderr, "inflate: length %u\n", len));
+ if (bits < 15) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ here = dcode[hold & dmask];
+ dodist:
+ op = (unsigned)(here.bits);
+ hold >>= op;
+ bits -= op;
+ op = (unsigned)(here.op);
+ if (op & 16) { /* distance base */
+ dist = (unsigned)(here.val);
+ op &= 15; /* number of extra bits */
+ if (bits < op) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ if (bits < op) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ }
+ dist += (unsigned)hold & ((1U << op) - 1);
#ifdef INFLATE_STRICT
- if (dist > dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
+ if (dist > dmax) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
#endif
- hold >>= op;
- bits -= op;
- Tracevv((stderr, "inflate: distance %u\n", dist));
- op = (unsigned)(out - beg); /* max distance in output */
- if (dist > op) { /* see if copy from window */
- op = dist - op; /* distance back in window */
- if (op > whave) {
- if (state->sane) {
- strm->msg =
- (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
+ hold >>= op;
+ bits -= op;
+ Tracevv((stderr, "inflate: distance %u\n", dist));
+ op = (unsigned)(out - beg); /* max distance in output */
+ if (dist > op) { /* see if copy from window */
+ op = dist - op; /* distance back in window */
+ if (op > whave) {
+ if (state->sane) {
+ strm->msg =
+ (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- if (len <= op - whave) {
- do {
- PUP(out) = 0;
- } while (--len);
- continue;
- }
- len -= op - whave;
- do {
- PUP(out) = 0;
- } while (--op > whave);
- if (op == 0) {
- from = out - dist;
- do {
- PUP(out) = PUP(from);
- } while (--len);
- continue;
- }
+ if (len <= op - whave) {
+ do {
+ PUP(out) = 0;
+ } while (--len);
+ continue;
+ }
+ len -= op - whave;
+ do {
+ PUP(out) = 0;
+ } while (--op > whave);
+ if (op == 0) {
+ from = out - dist;
+ do {
+ PUP(out) = PUP(from);
+ } while (--len);
+ continue;
+ }
#endif
- }
- from = window - OFF;
- if (wnext == 0) { /* very common case */
- from += wsize - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- else if (wnext < op) { /* wrap around window */
- from += wsize + wnext - op;
- op -= wnext;
- if (op < len) { /* some from end of window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = window - OFF;
- if (wnext < len) { /* some from start of window */
- op = wnext;
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- }
- else { /* contiguous in window */
- from += wnext - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- while (len > 2) {
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- }
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- else {
- from = out - dist; /* copy direct from output */
- do { /* minimum length is three */
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- } while (len > 2);
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- }
- else if ((op & 64) == 0) { /* 2nd level distance code */
- here = dcode[here.val + (hold & ((1U << op) - 1))];
- goto dodist;
- }
- else {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- }
- else if ((op & 64) == 0) { /* 2nd level length code */
- here = lcode[here.val + (hold & ((1U << op) - 1))];
- goto dolen;
- }
- else if (op & 32) { /* end-of-block */
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- else {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- } while (in < last && out < end);
+ }
+ from = window - OFF;
+ if (wnext == 0) { /* very common case */
+ from += wsize - op;
+ if (op < len) { /* some from window */
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = out - dist; /* rest from output */
+ }
+ }
+ else if (wnext < op) { /* wrap around window */
+ from += wsize + wnext - op;
+ op -= wnext;
+ if (op < len) { /* some from end of window */
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = window - OFF;
+ if (wnext < len) { /* some from start of window */
+ op = wnext;
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = out - dist; /* rest from output */
+ }
+ }
+ }
+ else { /* contiguous in window */
+ from += wnext - op;
+ if (op < len) { /* some from window */
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = out - dist; /* rest from output */
+ }
+ }
+ while (len > 2) {
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ len -= 3;
+ }
+ if (len) {
+ PUP(out) = PUP(from);
+ if (len > 1)
+ PUP(out) = PUP(from);
+ }
+ }
+ else {
+ from = out - dist; /* copy direct from output */
+ do { /* minimum length is three */
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ len -= 3;
+ } while (len > 2);
+ if (len) {
+ PUP(out) = PUP(from);
+ if (len > 1)
+ PUP(out) = PUP(from);
+ }
+ }
+ }
+ else if ((op & 64) == 0) { /* 2nd level distance code */
+ here = dcode[here.val + (hold & ((1U << op) - 1))];
+ goto dodist;
+ }
+ else {
+ strm->msg = (char *)"invalid distance code";
+ state->mode = BAD;
+ break;
+ }
+ }
+ else if ((op & 64) == 0) { /* 2nd level length code */
+ here = lcode[here.val + (hold & ((1U << op) - 1))];
+ goto dolen;
+ }
+ else if (op & 32) { /* end-of-block */
+ Tracevv((stderr, "inflate: end of block\n"));
+ state->mode = TYPE;
+ break;
+ }
+ else {
+ strm->msg = (char *)"invalid literal/length code";
+ state->mode = BAD;
+ break;
+ }
+ } while (in < last && out < end);
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- len = bits >> 3;
- in -= len;
- bits -= len << 3;
- hold &= (1U << bits) - 1;
+ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
+ len = bits >> 3;
+ in -= len;
+ bits -= len << 3;
+ hold &= (1U << bits) - 1;
- /* update state and return */
- strm->next_in = in + OFF;
- strm->next_out = out + OFF;
- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
- strm->avail_out = (unsigned)(out < end ?
- 257 + (end - out) : 257 - (out - end));
- state->hold = hold;
- state->bits = bits;
- return;
+ /* update state and return */
+ strm->next_in = in + OFF;
+ strm->next_out = out + OFF;
+ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
+ strm->avail_out = (unsigned)(out < end ?
+ 257 + (end - out) : 257 - (out - end));
+ state->hold = hold;
+ state->bits = bits;
+ return;
}
/*
diff --git a/src/lib/zlib/inffixed.h b/src/lib/zlib/inffixed.h
index d6283277694..1ed62d0a6ba 100644
--- a/src/lib/zlib/inffixed.h
+++ b/src/lib/zlib/inffixed.h
@@ -1,94 +1,94 @@
- /* inffixed.h -- table for decoding fixed codes
- * Generated automatically by makefixed().
- */
+ /* inffixed.h -- table for decoding fixed codes
+ * Generated automatically by makefixed().
+ */
- /* WARNING: this file should *not* be used by applications.
- It is part of the implementation of this library and is
- subject to change. Applications should only use zlib.h.
- */
+ /* WARNING: this file should *not* be used by applications.
+ It is part of the implementation of this library and is
+ subject to change. Applications should only use zlib.h.
+ */
- static const code lenfix[512] = {
- {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
- {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
- {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
- {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
- {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
- {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
- {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
- {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
- {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
- {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
- {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
- {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
- {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
- {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
- {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
- {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
- {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
- {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
- {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
- {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
- {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
- {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
- {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
- {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
- {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
- {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
- {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
- {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
- {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
- {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
- {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
- {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
- {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
- {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
- {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
- {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
- {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
- {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
- {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
- {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
- {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
- {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
- {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
- {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
- {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
- {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
- {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
- {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
- {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
- {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
- {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
- {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
- {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
- {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
- {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
- {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
- {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
- {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
- {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
- {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
- {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
- {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
- {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
- {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
- {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
- {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
- {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
- {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
- {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
- {0,9,255}
- };
+ static const code lenfix[512] = {
+ {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
+ {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
+ {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
+ {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
+ {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
+ {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
+ {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
+ {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
+ {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
+ {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
+ {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
+ {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
+ {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
+ {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
+ {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
+ {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
+ {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
+ {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
+ {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
+ {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
+ {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
+ {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
+ {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
+ {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
+ {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
+ {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
+ {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
+ {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
+ {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
+ {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
+ {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
+ {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
+ {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
+ {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
+ {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
+ {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
+ {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
+ {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
+ {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
+ {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
+ {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
+ {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
+ {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
+ {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
+ {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
+ {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
+ {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
+ {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
+ {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
+ {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
+ {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
+ {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
+ {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
+ {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
+ {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
+ {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
+ {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
+ {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
+ {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
+ {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
+ {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
+ {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
+ {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
+ {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
+ {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
+ {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
+ {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
+ {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
+ {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
+ {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
+ {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
+ {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
+ {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
+ {0,9,255}
+ };
- static const code distfix[32] = {
- {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
- {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
- {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
- {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
- {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
- {22,5,193},{64,5,0}
- };
+ static const code distfix[32] = {
+ {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
+ {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
+ {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
+ {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
+ {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
+ {22,5,193},{64,5,0}
+ };
diff --git a/src/lib/zlib/inflate.c b/src/lib/zlib/inflate.c
index 870f89bb4d3..8970183c601 100644
--- a/src/lib/zlib/inflate.c
+++ b/src/lib/zlib/inflate.c
@@ -94,87 +94,87 @@
/* function prototypes */
local void fixedtables OF((struct inflate_state FAR *state));
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
- unsigned copy));
+ unsigned copy));
#ifdef BUILDFIXED
- void makefixed OF((void));
+ void makefixed OF((void));
#endif
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
- unsigned len));
+ unsigned len));
int ZEXPORT inflateResetKeep(strm)
z_streamp strm;
{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- strm->total_in = strm->total_out = state->total = 0;
- strm->msg = Z_NULL;
- if (state->wrap) /* to support ill-conceived Java test suite */
- strm->adler = state->wrap & 1;
- state->mode = HEAD;
- state->last = 0;
- state->havedict = 0;
- state->dmax = 32768U;
- state->head = Z_NULL;
- state->hold = 0;
- state->bits = 0;
- state->lencode = state->distcode = state->next = state->codes;
- state->sane = 1;
- state->back = -1;
- Tracev((stderr, "inflate: reset\n"));
- return Z_OK;
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ strm->total_in = strm->total_out = state->total = 0;
+ strm->msg = Z_NULL;
+ if (state->wrap) /* to support ill-conceived Java test suite */
+ strm->adler = state->wrap & 1;
+ state->mode = HEAD;
+ state->last = 0;
+ state->havedict = 0;
+ state->dmax = 32768U;
+ state->head = Z_NULL;
+ state->hold = 0;
+ state->bits = 0;
+ state->lencode = state->distcode = state->next = state->codes;
+ state->sane = 1;
+ state->back = -1;
+ Tracev((stderr, "inflate: reset\n"));
+ return Z_OK;
}
int ZEXPORT inflateReset(strm)
z_streamp strm;
{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- state->wsize = 0;
- state->whave = 0;
- state->wnext = 0;
- return inflateResetKeep(strm);
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ state->wsize = 0;
+ state->whave = 0;
+ state->wnext = 0;
+ return inflateResetKeep(strm);
}
int ZEXPORT inflateReset2(strm, windowBits)
z_streamp strm;
int windowBits;
{
- int wrap;
- struct inflate_state FAR *state;
-
- /* get the state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* extract wrap request from windowBits parameter */
- if (windowBits < 0) {
- wrap = 0;
- windowBits = -windowBits;
- }
- else {
- wrap = (windowBits >> 4) + 1;
+ int wrap;
+ struct inflate_state FAR *state;
+
+ /* get the state */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+
+ /* extract wrap request from windowBits parameter */
+ if (windowBits < 0) {
+ wrap = 0;
+ windowBits = -windowBits;
+ }
+ else {
+ wrap = (windowBits >> 4) + 1;
#ifdef GUNZIP
- if (windowBits < 48)
- windowBits &= 15;
+ if (windowBits < 48)
+ windowBits &= 15;
#endif
- }
-
- /* set number of window bits, free window if different */
- if (windowBits && (windowBits < 8 || windowBits > 15))
- return Z_STREAM_ERROR;
- if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
- ZFREE(strm, state->window);
- state->window = Z_NULL;
- }
-
- /* update state and reset the rest of it */
- state->wrap = wrap;
- state->wbits = (unsigned)windowBits;
- return inflateReset(strm);
+ }
+
+ /* set number of window bits, free window if different */
+ if (windowBits && (windowBits < 8 || windowBits > 15))
+ return Z_STREAM_ERROR;
+ if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
+ ZFREE(strm, state->window);
+ state->window = Z_NULL;
+ }
+
+ /* update state and reset the rest of it */
+ state->wrap = wrap;
+ state->wbits = (unsigned)windowBits;
+ return inflateReset(strm);
}
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
@@ -183,40 +183,40 @@ int windowBits;
const char *version;
int stream_size;
{
- int ret;
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL) return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
+ int ret;
+ struct inflate_state FAR *state;
+
+ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+ stream_size != (int)(sizeof(z_stream)))
+ return Z_VERSION_ERROR;
+ if (strm == Z_NULL) return Z_STREAM_ERROR;
+ strm->msg = Z_NULL; /* in case we return an error */
+ if (strm->zalloc == (alloc_func)0) {
#ifdef Z_SOLO
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
#endif
- }
- if (strm->zfree == (free_func)0)
+ }
+ if (strm->zfree == (free_func)0)
#ifdef Z_SOLO
- return Z_STREAM_ERROR;
+ return Z_STREAM_ERROR;
#else
- strm->zfree = zcfree;
+ strm->zfree = zcfree;
#endif
- state = (struct inflate_state FAR *)
- ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->window = Z_NULL;
- ret = inflateReset2(strm, windowBits);
- if (ret != Z_OK) {
- ZFREE(strm, state);
- strm->state = Z_NULL;
- }
- return ret;
+ state = (struct inflate_state FAR *)
+ ZALLOC(strm, 1, sizeof(struct inflate_state));
+ if (state == Z_NULL) return Z_MEM_ERROR;
+ Tracev((stderr, "inflate: allocated\n"));
+ strm->state = (struct internal_state FAR *)state;
+ state->window = Z_NULL;
+ ret = inflateReset2(strm, windowBits);
+ if (ret != Z_OK) {
+ ZFREE(strm, state);
+ strm->state = Z_NULL;
+ }
+ return ret;
}
int ZEXPORT inflateInit_(strm, version, stream_size)
@@ -224,7 +224,7 @@ z_streamp strm;
const char *version;
int stream_size;
{
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
+ return inflateInit2_(strm, DEF_WBITS, version, stream_size);
}
int ZEXPORT inflatePrime(strm, bits, value)
@@ -232,20 +232,20 @@ z_streamp strm;
int bits;
int value;
{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (bits < 0) {
- state->hold = 0;
- state->bits = 0;
- return Z_OK;
- }
- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
- value &= (1L << bits) - 1;
- state->hold += value << state->bits;
- state->bits += bits;
- return Z_OK;
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (bits < 0) {
+ state->hold = 0;
+ state->bits = 0;
+ return Z_OK;
+ }
+ if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
+ value &= (1L << bits) - 1;
+ state->hold += value << state->bits;
+ state->bits += bits;
+ return Z_OK;
}
/*
@@ -262,43 +262,43 @@ local void fixedtables(state)
struct inflate_state FAR *state;
{
#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
+ static int virgin = 1;
+ static code *lenfix, *distfix;
+ static code fixed[544];
+
+ /* build fixed huffman tables if first call (may not be thread safe) */
+ if (virgin) {
+ unsigned sym, bits;
+ static code *next;
+
+ /* literal/length table */
+ sym = 0;
+ while (sym < 144) state->lens[sym++] = 8;
+ while (sym < 256) state->lens[sym++] = 9;
+ while (sym < 280) state->lens[sym++] = 7;
+ while (sym < 288) state->lens[sym++] = 8;
+ next = fixed;
+ lenfix = next;
+ bits = 9;
+ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+
+ /* distance table */
+ sym = 0;
+ while (sym < 32) state->lens[sym++] = 5;
+ distfix = next;
+ bits = 5;
+ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+
+ /* do this just once */
+ virgin = 0;
+ }
#else /* !BUILDFIXED */
# include "inffixed.h"
#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
+ state->lencode = lenfix;
+ state->lenbits = 9;
+ state->distcode = distfix;
+ state->distbits = 5;
}
#ifdef MAKEFIXED
@@ -324,41 +324,41 @@ struct inflate_state FAR *state;
*/
void makefixed()
{
- unsigned low, size;
- struct inflate_state state;
-
- fixedtables(&state);
- puts(" /* inffixed.h -- table for decoding fixed codes");
- puts(" * Generated automatically by makefixed().");
- puts(" */");
- puts("");
- puts(" /* WARNING: this file should *not* be used by applications.");
- puts(" It is part of the implementation of this library and is");
- puts(" subject to change. Applications should only use zlib.h.");
- puts(" */");
- puts("");
- size = 1U << 9;
- printf(" static const code lenfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 7) == 0) printf("\n ");
- printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
- state.lencode[low].bits, state.lencode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
- size = 1U << 5;
- printf("\n static const code distfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 6) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
- state.distcode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
+ unsigned low, size;
+ struct inflate_state state;
+
+ fixedtables(&state);
+ puts(" /* inffixed.h -- table for decoding fixed codes");
+ puts(" * Generated automatically by makefixed().");
+ puts(" */");
+ puts("");
+ puts(" /* WARNING: this file should *not* be used by applications.");
+ puts(" It is part of the implementation of this library and is");
+ puts(" subject to change. Applications should only use zlib.h.");
+ puts(" */");
+ puts("");
+ size = 1U << 9;
+ printf(" static const code lenfix[%u] = {", size);
+ low = 0;
+ for (;;) {
+ if ((low % 7) == 0) printf("\n ");
+ printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
+ state.lencode[low].bits, state.lencode[low].val);
+ if (++low == size) break;
+ putchar(',');
+ }
+ puts("\n };");
+ size = 1U << 5;
+ printf("\n static const code distfix[%u] = {", size);
+ low = 0;
+ for (;;) {
+ if ((low % 6) == 0) printf("\n ");
+ printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
+ state.distcode[low].val);
+ if (++low == size) break;
+ putchar(',');
+ }
+ puts("\n };");
}
#endif /* MAKEFIXED */
@@ -381,49 +381,49 @@ z_streamp strm;
const Bytef *end;
unsigned copy;
{
- struct inflate_state FAR *state;
- unsigned dist;
-
- state = (struct inflate_state FAR *)strm->state;
-
- /* if it hasn't been done already, allocate space for the window */
- if (state->window == Z_NULL) {
- state->window = (unsigned char FAR *)
- ZALLOC(strm, 1U << state->wbits,
- sizeof(unsigned char));
- if (state->window == Z_NULL) return 1;
- }
-
- /* if window not in use yet, initialize */
- if (state->wsize == 0) {
- state->wsize = 1U << state->wbits;
- state->wnext = 0;
- state->whave = 0;
- }
-
- /* copy state->wsize or less output bytes into the circular window */
- if (copy >= state->wsize) {
- zmemcpy(state->window, end - state->wsize, state->wsize);
- state->wnext = 0;
- state->whave = state->wsize;
- }
- else {
- dist = state->wsize - state->wnext;
- if (dist > copy) dist = copy;
- zmemcpy(state->window + state->wnext, end - copy, dist);
- copy -= dist;
- if (copy) {
- zmemcpy(state->window, end - copy, copy);
- state->wnext = copy;
- state->whave = state->wsize;
- }
- else {
- state->wnext += dist;
- if (state->wnext == state->wsize) state->wnext = 0;
- if (state->whave < state->wsize) state->whave += dist;
- }
- }
- return 0;
+ struct inflate_state FAR *state;
+ unsigned dist;
+
+ state = (struct inflate_state FAR *)strm->state;
+
+ /* if it hasn't been done already, allocate space for the window */
+ if (state->window == Z_NULL) {
+ state->window = (unsigned char FAR *)
+ ZALLOC(strm, 1U << state->wbits,
+ sizeof(unsigned char));
+ if (state->window == Z_NULL) return 1;
+ }
+
+ /* if window not in use yet, initialize */
+ if (state->wsize == 0) {
+ state->wsize = 1U << state->wbits;
+ state->wnext = 0;
+ state->whave = 0;
+ }
+
+ /* copy state->wsize or less output bytes into the circular window */
+ if (copy >= state->wsize) {
+ zmemcpy(state->window, end - state->wsize, state->wsize);
+ state->wnext = 0;
+ state->whave = state->wsize;
+ }
+ else {
+ dist = state->wsize - state->wnext;
+ if (dist > copy) dist = copy;
+ zmemcpy(state->window + state->wnext, end - copy, dist);
+ copy -= dist;
+ if (copy) {
+ zmemcpy(state->window, end - copy, copy);
+ state->wnext = copy;
+ state->whave = state->wsize;
+ }
+ else {
+ state->wnext += dist;
+ if (state->wnext == state->wsize) state->wnext = 0;
+ if (state->whave < state->wsize) state->whave += dist;
+ }
+ }
+ return 0;
}
/* Macros for inflate(): */
@@ -431,7 +431,7 @@ unsigned copy;
/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
# define UPDATE(check, buf, len) \
- (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
+ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
#else
# define UPDATE(check, buf, len) adler32(check, buf, len)
#endif
@@ -439,86 +439,86 @@ unsigned copy;
/* check macros for header crc */
#ifdef GUNZIP
# define CRC2(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- check = crc32(check, hbuf, 2); \
- } while (0)
+ do { \
+ hbuf[0] = (unsigned char)(word); \
+ hbuf[1] = (unsigned char)((word) >> 8); \
+ check = crc32(check, hbuf, 2); \
+ } while (0)
# define CRC4(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- hbuf[2] = (unsigned char)((word) >> 16); \
- hbuf[3] = (unsigned char)((word) >> 24); \
- check = crc32(check, hbuf, 4); \
- } while (0)
+ do { \
+ hbuf[0] = (unsigned char)(word); \
+ hbuf[1] = (unsigned char)((word) >> 8); \
+ hbuf[2] = (unsigned char)((word) >> 16); \
+ hbuf[3] = (unsigned char)((word) >> 24); \
+ check = crc32(check, hbuf, 4); \
+ } while (0)
#endif
/* Load registers with state in inflate() for speed */
#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
+ do { \
+ put = strm->next_out; \
+ left = strm->avail_out; \
+ next = strm->next_in; \
+ have = strm->avail_in; \
+ hold = state->hold; \
+ bits = state->bits; \
+ } while (0)
/* Restore state from registers in inflate() */
#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
+ do { \
+ strm->next_out = put; \
+ strm->avail_out = left; \
+ strm->next_in = next; \
+ strm->avail_in = have; \
+ state->hold = hold; \
+ state->bits = bits; \
+ } while (0)
/* Clear the input bit accumulator */
#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
+ do { \
+ hold = 0; \
+ bits = 0; \
+ } while (0)
/* Get a byte of input into the bit accumulator, or return from inflate()
if there is no input available. */
#define PULLBYTE() \
- do { \
- if (have == 0) goto inf_leave; \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
+ do { \
+ if (have == 0) goto inf_leave; \
+ have--; \
+ hold += (unsigned long)(*next++) << bits; \
+ bits += 8; \
+ } while (0)
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflate(). */
#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
+ do { \
+ while (bits < (unsigned)(n)) \
+ PULLBYTE(); \
+ } while (0)
/* Return the low n bits of the bit accumulator (n < 16) */
#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
+ ((unsigned)hold & ((1U << (n)) - 1))
/* Remove n bits from the bit accumulator */
#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
+ do { \
+ hold >>= (n); \
+ bits -= (unsigned)(n); \
+ } while (0)
/* Remove zero to seven bits as needed to go to a byte boundary */
#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
+ do { \
+ hold >>= bits & 7; \
+ bits -= bits & 7; \
+ } while (0)
/*
inflate() uses a state machine to process as much input data and generate as
@@ -606,663 +606,663 @@ int ZEXPORT inflate(strm, flush)
z_streamp strm;
int flush;
{
- struct inflate_state FAR *state;
- z_const unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned in, out; /* save starting available input and output */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code here; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
+ struct inflate_state FAR *state;
+ z_const unsigned char FAR *next; /* next input */
+ unsigned char FAR *put; /* next output */
+ unsigned have, left; /* available input and output */
+ unsigned long hold; /* bit buffer */
+ unsigned bits; /* bits in bit buffer */
+ unsigned in, out; /* save starting available input and output */
+ unsigned copy; /* number of stored or match bytes to copy */
+ unsigned char FAR *from; /* where to copy match bytes from */
+ code here; /* current decoding table entry */
+ code last; /* parent table entry */
+ unsigned len; /* length to copy for repeats, bits to drop */
+ int ret; /* return code */
#ifdef GUNZIP
- unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
+ unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
#endif
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0))
- return Z_STREAM_ERROR;
-
- state = (struct inflate_state FAR *)strm->state;
- if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
- LOAD();
- in = have;
- out = left;
- ret = Z_OK;
- for (;;)
- switch (state->mode) {
- case HEAD:
- if (state->wrap == 0) {
- state->mode = TYPEDO;
- break;
- }
- NEEDBITS(16);
+ static const unsigned short order[19] = /* permutation of code lengths */
+ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
+ (strm->next_in == Z_NULL && strm->avail_in != 0))
+ return Z_STREAM_ERROR;
+
+ state = (struct inflate_state FAR *)strm->state;
+ if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
+ LOAD();
+ in = have;
+ out = left;
+ ret = Z_OK;
+ for (;;)
+ switch (state->mode) {
+ case HEAD:
+ if (state->wrap == 0) {
+ state->mode = TYPEDO;
+ break;
+ }
+ NEEDBITS(16);
#ifdef GUNZIP
- if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
- state->check = crc32(0L, Z_NULL, 0);
- CRC2(state->check, hold);
- INITBITS();
- state->mode = FLAGS;
- break;
- }
- state->flags = 0; /* expect zlib header */
- if (state->head != Z_NULL)
- state->head->done = -1;
- if (!(state->wrap & 1) || /* check if zlib header allowed */
+ if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
+ state->check = crc32(0L, Z_NULL, 0);
+ CRC2(state->check, hold);
+ INITBITS();
+ state->mode = FLAGS;
+ break;
+ }
+ state->flags = 0; /* expect zlib header */
+ if (state->head != Z_NULL)
+ state->head->done = -1;
+ if (!(state->wrap & 1) || /* check if zlib header allowed */
#else
- if (
+ if (
#endif
- ((BITS(8) << 8) + (hold >> 8)) % 31) {
- strm->msg = (char *)"incorrect header check";
- state->mode = BAD;
- break;
- }
- if (BITS(4) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- DROPBITS(4);
- len = BITS(4) + 8;
- if (state->wbits == 0)
- state->wbits = len;
- else if (len > state->wbits) {
- strm->msg = (char *)"invalid window size";
- state->mode = BAD;
- break;
- }
- state->dmax = 1U << len;
- Tracev((stderr, "inflate: zlib header ok\n"));
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = hold & 0x200 ? DICTID : TYPE;
- INITBITS();
- break;
+ ((BITS(8) << 8) + (hold >> 8)) % 31) {
+ strm->msg = (char *)"incorrect header check";
+ state->mode = BAD;
+ break;
+ }
+ if (BITS(4) != Z_DEFLATED) {
+ strm->msg = (char *)"unknown compression method";
+ state->mode = BAD;
+ break;
+ }
+ DROPBITS(4);
+ len = BITS(4) + 8;
+ if (state->wbits == 0)
+ state->wbits = len;
+ else if (len > state->wbits) {
+ strm->msg = (char *)"invalid window size";
+ state->mode = BAD;
+ break;
+ }
+ state->dmax = 1U << len;
+ Tracev((stderr, "inflate: zlib header ok\n"));
+ strm->adler = state->check = adler32(0L, Z_NULL, 0);
+ state->mode = hold & 0x200 ? DICTID : TYPE;
+ INITBITS();
+ break;
#ifdef GUNZIP
- case FLAGS:
- NEEDBITS(16);
- state->flags = (int)(hold);
- if ((state->flags & 0xff) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- if (state->flags & 0xe000) {
- strm->msg = (char *)"unknown header flags set";
- state->mode = BAD;
- break;
- }
- if (state->head != Z_NULL)
- state->head->text = (int)((hold >> 8) & 1);
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = TIME;
- case TIME:
- NEEDBITS(32);
- if (state->head != Z_NULL)
- state->head->time = hold;
- if (state->flags & 0x0200) CRC4(state->check, hold);
- INITBITS();
- state->mode = OS;
- case OS:
- NEEDBITS(16);
- if (state->head != Z_NULL) {
- state->head->xflags = (int)(hold & 0xff);
- state->head->os = (int)(hold >> 8);
- }
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = EXLEN;
- case EXLEN:
- if (state->flags & 0x0400) {
- NEEDBITS(16);
- state->length = (unsigned)(hold);
- if (state->head != Z_NULL)
- state->head->extra_len = (unsigned)hold;
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- }
- else if (state->head != Z_NULL)
- state->head->extra = Z_NULL;
- state->mode = EXTRA;
- case EXTRA:
- if (state->flags & 0x0400) {
- copy = state->length;
- if (copy > have) copy = have;
- if (copy) {
- if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
- zmemcpy(state->head->extra + len, next,
- len + copy > state->head->extra_max ?
- state->head->extra_max - len : copy);
- }
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- state->length -= copy;
- }
- if (state->length) goto inf_leave;
- }
- state->length = 0;
- state->mode = NAME;
- case NAME:
- if (state->flags & 0x0800) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->name != Z_NULL &&
- state->length < state->head->name_max)
- state->head->name[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->name = Z_NULL;
- state->length = 0;
- state->mode = COMMENT;
- case COMMENT:
- if (state->flags & 0x1000) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->comment != Z_NULL &&
- state->length < state->head->comm_max)
- state->head->comment[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->comment = Z_NULL;
- state->mode = HCRC;
- case HCRC:
- if (state->flags & 0x0200) {
- NEEDBITS(16);
- if (hold != (state->check & 0xffff)) {
- strm->msg = (char *)"header crc mismatch";
- state->mode = BAD;
- break;
- }
- INITBITS();
- }
- if (state->head != Z_NULL) {
- state->head->hcrc = (int)((state->flags >> 9) & 1);
- state->head->done = 1;
- }
- strm->adler = state->check = crc32(0L, Z_NULL, 0);
- state->mode = TYPE;
- break;
+ case FLAGS:
+ NEEDBITS(16);
+ state->flags = (int)(hold);
+ if ((state->flags & 0xff) != Z_DEFLATED) {
+ strm->msg = (char *)"unknown compression method";
+ state->mode = BAD;
+ break;
+ }
+ if (state->flags & 0xe000) {
+ strm->msg = (char *)"unknown header flags set";
+ state->mode = BAD;
+ break;
+ }
+ if (state->head != Z_NULL)
+ state->head->text = (int)((hold >> 8) & 1);
+ if (state->flags & 0x0200) CRC2(state->check, hold);
+ INITBITS();
+ state->mode = TIME;
+ case TIME:
+ NEEDBITS(32);
+ if (state->head != Z_NULL)
+ state->head->time = hold;
+ if (state->flags & 0x0200) CRC4(state->check, hold);
+ INITBITS();
+ state->mode = OS;
+ case OS:
+ NEEDBITS(16);
+ if (state->head != Z_NULL) {
+ state->head->xflags = (int)(hold & 0xff);
+ state->head->os = (int)(hold >> 8);
+ }
+ if (state->flags & 0x0200) CRC2(state->check, hold);
+ INITBITS();
+ state->mode = EXLEN;
+ case EXLEN:
+ if (state->flags & 0x0400) {
+ NEEDBITS(16);
+ state->length = (unsigned)(hold);
+ if (state->head != Z_NULL)
+ state->head->extra_len = (unsigned)hold;
+ if (state->flags & 0x0200) CRC2(state->check, hold);
+ INITBITS();
+ }
+ else if (state->head != Z_NULL)
+ state->head->extra = Z_NULL;
+ state->mode = EXTRA;
+ case EXTRA:
+ if (state->flags & 0x0400) {
+ copy = state->length;
+ if (copy > have) copy = have;
+ if (copy) {
+ if (state->head != Z_NULL &&
+ state->head->extra != Z_NULL) {
+ len = state->head->extra_len - state->length;
+ zmemcpy(state->head->extra + len, next,
+ len + copy > state->head->extra_max ?
+ state->head->extra_max - len : copy);
+ }
+ if (state->flags & 0x0200)
+ state->check = crc32(state->check, next, copy);
+ have -= copy;
+ next += copy;
+ state->length -= copy;
+ }
+ if (state->length) goto inf_leave;
+ }
+ state->length = 0;
+ state->mode = NAME;
+ case NAME:
+ if (state->flags & 0x0800) {
+ if (have == 0) goto inf_leave;
+ copy = 0;
+ do {
+ len = (unsigned)(next[copy++]);
+ if (state->head != Z_NULL &&
+ state->head->name != Z_NULL &&
+ state->length < state->head->name_max)
+ state->head->name[state->length++] = len;
+ } while (len && copy < have);
+ if (state->flags & 0x0200)
+ state->check = crc32(state->check, next, copy);
+ have -= copy;
+ next += copy;
+ if (len) goto inf_leave;
+ }
+ else if (state->head != Z_NULL)
+ state->head->name = Z_NULL;
+ state->length = 0;
+ state->mode = COMMENT;
+ case COMMENT:
+ if (state->flags & 0x1000) {
+ if (have == 0) goto inf_leave;
+ copy = 0;
+ do {
+ len = (unsigned)(next[copy++]);
+ if (state->head != Z_NULL &&
+ state->head->comment != Z_NULL &&
+ state->length < state->head->comm_max)
+ state->head->comment[state->length++] = len;
+ } while (len && copy < have);
+ if (state->flags & 0x0200)
+ state->check = crc32(state->check, next, copy);
+ have -= copy;
+ next += copy;
+ if (len) goto inf_leave;
+ }
+ else if (state->head != Z_NULL)
+ state->head->comment = Z_NULL;
+ state->mode = HCRC;
+ case HCRC:
+ if (state->flags & 0x0200) {
+ NEEDBITS(16);
+ if (hold != (state->check & 0xffff)) {
+ strm->msg = (char *)"header crc mismatch";
+ state->mode = BAD;
+ break;
+ }
+ INITBITS();
+ }
+ if (state->head != Z_NULL) {
+ state->head->hcrc = (int)((state->flags >> 9) & 1);
+ state->head->done = 1;
+ }
+ strm->adler = state->check = crc32(0L, Z_NULL, 0);
+ state->mode = TYPE;
+ break;
#endif
- case DICTID:
- NEEDBITS(32);
- strm->adler = state->check = ZSWAP32(hold);
- INITBITS();
- state->mode = DICT;
- case DICT:
- if (state->havedict == 0) {
- RESTORE();
- return Z_NEED_DICT;
- }
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = TYPE;
- case TYPE:
- if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
- case TYPEDO:
- if (state->last) {
- BYTEBITS();
- state->mode = CHECK;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN_; /* decode codes */
- if (flush == Z_TREES) {
- DROPBITS(2);
- goto inf_leave;
- }
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
- case STORED:
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
- state->mode = COPY_;
- if (flush == Z_TREES) goto inf_leave;
- case COPY_:
- state->mode = COPY;
- case COPY:
- copy = state->length;
- if (copy) {
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- if (copy == 0) goto inf_leave;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- break;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
- case TABLE:
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
+ case DICTID:
+ NEEDBITS(32);
+ strm->adler = state->check = ZSWAP32(hold);
+ INITBITS();
+ state->mode = DICT;
+ case DICT:
+ if (state->havedict == 0) {
+ RESTORE();
+ return Z_NEED_DICT;
+ }
+ strm->adler = state->check = adler32(0L, Z_NULL, 0);
+ state->mode = TYPE;
+ case TYPE:
+ if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
+ case TYPEDO:
+ if (state->last) {
+ BYTEBITS();
+ state->mode = CHECK;
+ break;
+ }
+ NEEDBITS(3);
+ state->last = BITS(1);
+ DROPBITS(1);
+ switch (BITS(2)) {
+ case 0: /* stored block */
+ Tracev((stderr, "inflate: stored block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = STORED;
+ break;
+ case 1: /* fixed block */
+ fixedtables(state);
+ Tracev((stderr, "inflate: fixed codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = LEN_; /* decode codes */
+ if (flush == Z_TREES) {
+ DROPBITS(2);
+ goto inf_leave;
+ }
+ break;
+ case 2: /* dynamic block */
+ Tracev((stderr, "inflate: dynamic codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = TABLE;
+ break;
+ case 3:
+ strm->msg = (char *)"invalid block type";
+ state->mode = BAD;
+ }
+ DROPBITS(2);
+ break;
+ case STORED:
+ BYTEBITS(); /* go to byte boundary */
+ NEEDBITS(32);
+ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+ strm->msg = (char *)"invalid stored block lengths";
+ state->mode = BAD;
+ break;
+ }
+ state->length = (unsigned)hold & 0xffff;
+ Tracev((stderr, "inflate: stored length %u\n",
+ state->length));
+ INITBITS();
+ state->mode = COPY_;
+ if (flush == Z_TREES) goto inf_leave;
+ case COPY_:
+ state->mode = COPY;
+ case COPY:
+ copy = state->length;
+ if (copy) {
+ if (copy > have) copy = have;
+ if (copy > left) copy = left;
+ if (copy == 0) goto inf_leave;
+ zmemcpy(put, next, copy);
+ have -= copy;
+ next += copy;
+ left -= copy;
+ put += copy;
+ state->length -= copy;
+ break;
+ }
+ Tracev((stderr, "inflate: stored end\n"));
+ state->mode = TYPE;
+ break;
+ case TABLE:
+ NEEDBITS(14);
+ state->nlen = BITS(5) + 257;
+ DROPBITS(5);
+ state->ndist = BITS(5) + 1;
+ DROPBITS(5);
+ state->ncode = BITS(4) + 4;
+ DROPBITS(4);
#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
+ if (state->nlen > 286 || state->ndist > 30) {
+ strm->msg = (char *)"too many length or distance symbols";
+ state->mode = BAD;
+ break;
+ }
#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
- state->have = 0;
- state->mode = LENLENS;
- case LENLENS:
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (const code FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
- state->have = 0;
- state->mode = CODELENS;
- case CODELENS:
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.val < 16) {
- DROPBITS(here.bits);
- state->lens[state->have++] = here.val;
- }
- else {
- if (here.val == 16) {
- NEEDBITS(here.bits + 2);
- DROPBITS(here.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = state->lens[state->have - 1];
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (here.val == 17) {
- NEEDBITS(here.bits + 3);
- DROPBITS(here.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(here.bits + 7);
- DROPBITS(here.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* check for end-of-block code (better have one) */
- if (state->lens[256] == 0) {
- strm->msg = (char *)"invalid code -- missing end-of-block";
- state->mode = BAD;
- break;
- }
-
- /* build code tables -- note: do not change the lenbits or distbits
- values here (9 and 6) without reading the comments in inftrees.h
- concerning the ENOUGH constants, which depend on those values */
- state->next = state->codes;
- state->lencode = (const code FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (const code FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN_;
- if (flush == Z_TREES) goto inf_leave;
- case LEN_:
- state->mode = LEN;
- case LEN:
- if (have >= 6 && left >= 258) {
- RESTORE();
- inflate_fast(strm, out);
- LOAD();
- if (state->mode == TYPE)
- state->back = -1;
- break;
- }
- state->back = 0;
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.op && (here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- state->back += last.bits;
- }
- DROPBITS(here.bits);
- state->back += here.bits;
- state->length = (unsigned)here.val;
- if ((int)(here.op) == 0) {
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- state->mode = LIT;
- break;
- }
- if (here.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->back = -1;
- state->mode = TYPE;
- break;
- }
- if (here.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- state->extra = (unsigned)(here.op) & 15;
- state->mode = LENEXT;
- case LENEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- state->back += state->extra;
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
- state->was = state->length;
- state->mode = DIST;
- case DIST:
- for (;;) {
- here = state->distcode[BITS(state->distbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if ((here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- state->back += last.bits;
- }
- DROPBITS(here.bits);
- state->back += here.bits;
- if (here.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)here.val;
- state->extra = (unsigned)(here.op) & 15;
- state->mode = DISTEXT;
- case DISTEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- state->back += state->extra;
- }
+ Tracev((stderr, "inflate: table sizes ok\n"));
+ state->have = 0;
+ state->mode = LENLENS;
+ case LENLENS:
+ while (state->have < state->ncode) {
+ NEEDBITS(3);
+ state->lens[order[state->have++]] = (unsigned short)BITS(3);
+ DROPBITS(3);
+ }
+ while (state->have < 19)
+ state->lens[order[state->have++]] = 0;
+ state->next = state->codes;
+ state->lencode = (const code FAR *)(state->next);
+ state->lenbits = 7;
+ ret = inflate_table(CODES, state->lens, 19, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid code lengths set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: code lengths ok\n"));
+ state->have = 0;
+ state->mode = CODELENS;
+ case CODELENS:
+ while (state->have < state->nlen + state->ndist) {
+ for (;;) {
+ here = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (here.val < 16) {
+ DROPBITS(here.bits);
+ state->lens[state->have++] = here.val;
+ }
+ else {
+ if (here.val == 16) {
+ NEEDBITS(here.bits + 2);
+ DROPBITS(here.bits);
+ if (state->have == 0) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ len = state->lens[state->have - 1];
+ copy = 3 + BITS(2);
+ DROPBITS(2);
+ }
+ else if (here.val == 17) {
+ NEEDBITS(here.bits + 3);
+ DROPBITS(here.bits);
+ len = 0;
+ copy = 3 + BITS(3);
+ DROPBITS(3);
+ }
+ else {
+ NEEDBITS(here.bits + 7);
+ DROPBITS(here.bits);
+ len = 0;
+ copy = 11 + BITS(7);
+ DROPBITS(7);
+ }
+ if (state->have + copy > state->nlen + state->ndist) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ while (copy--)
+ state->lens[state->have++] = (unsigned short)len;
+ }
+ }
+
+ /* handle error breaks in while */
+ if (state->mode == BAD) break;
+
+ /* check for end-of-block code (better have one) */
+ if (state->lens[256] == 0) {
+ strm->msg = (char *)"invalid code -- missing end-of-block";
+ state->mode = BAD;
+ break;
+ }
+
+ /* build code tables -- note: do not change the lenbits or distbits
+ values here (9 and 6) without reading the comments in inftrees.h
+ concerning the ENOUGH constants, which depend on those values */
+ state->next = state->codes;
+ state->lencode = (const code FAR *)(state->next);
+ state->lenbits = 9;
+ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid literal/lengths set";
+ state->mode = BAD;
+ break;
+ }
+ state->distcode = (const code FAR *)(state->next);
+ state->distbits = 6;
+ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ &(state->next), &(state->distbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid distances set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: codes ok\n"));
+ state->mode = LEN_;
+ if (flush == Z_TREES) goto inf_leave;
+ case LEN_:
+ state->mode = LEN;
+ case LEN:
+ if (have >= 6 && left >= 258) {
+ RESTORE();
+ inflate_fast(strm, out);
+ LOAD();
+ if (state->mode == TYPE)
+ state->back = -1;
+ break;
+ }
+ state->back = 0;
+ for (;;) {
+ here = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (here.op && (here.op & 0xf0) == 0) {
+ last = here;
+ for (;;) {
+ here = state->lencode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ state->back += last.bits;
+ }
+ DROPBITS(here.bits);
+ state->back += here.bits;
+ state->length = (unsigned)here.val;
+ if ((int)(here.op) == 0) {
+ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", here.val));
+ state->mode = LIT;
+ break;
+ }
+ if (here.op & 32) {
+ Tracevv((stderr, "inflate: end of block\n"));
+ state->back = -1;
+ state->mode = TYPE;
+ break;
+ }
+ if (here.op & 64) {
+ strm->msg = (char *)"invalid literal/length code";
+ state->mode = BAD;
+ break;
+ }
+ state->extra = (unsigned)(here.op) & 15;
+ state->mode = LENEXT;
+ case LENEXT:
+ if (state->extra) {
+ NEEDBITS(state->extra);
+ state->length += BITS(state->extra);
+ DROPBITS(state->extra);
+ state->back += state->extra;
+ }
+ Tracevv((stderr, "inflate: length %u\n", state->length));
+ state->was = state->length;
+ state->mode = DIST;
+ case DIST:
+ for (;;) {
+ here = state->distcode[BITS(state->distbits)];
+ if ((unsigned)(here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if ((here.op & 0xf0) == 0) {
+ last = here;
+ for (;;) {
+ here = state->distcode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + here.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ state->back += last.bits;
+ }
+ DROPBITS(here.bits);
+ state->back += here.bits;
+ if (here.op & 64) {
+ strm->msg = (char *)"invalid distance code";
+ state->mode = BAD;
+ break;
+ }
+ state->offset = (unsigned)here.val;
+ state->extra = (unsigned)(here.op) & 15;
+ state->mode = DISTEXT;
+ case DISTEXT:
+ if (state->extra) {
+ NEEDBITS(state->extra);
+ state->offset += BITS(state->extra);
+ DROPBITS(state->extra);
+ state->back += state->extra;
+ }
#ifdef INFLATE_STRICT
- if (state->offset > state->dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
+ if (state->offset > state->dmax) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
#endif
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
- state->mode = MATCH;
- case MATCH:
- if (left == 0) goto inf_leave;
- copy = out - left;
- if (state->offset > copy) { /* copy from window */
- copy = state->offset - copy;
- if (copy > state->whave) {
- if (state->sane) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
+ Tracevv((stderr, "inflate: distance %u\n", state->offset));
+ state->mode = MATCH;
+ case MATCH:
+ if (left == 0) goto inf_leave;
+ copy = out - left;
+ if (state->offset > copy) { /* copy from window */
+ copy = state->offset - copy;
+ if (copy > state->whave) {
+ if (state->sane) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- Trace((stderr, "inflate.c too far\n"));
- copy -= state->whave;
- if (copy > state->length) copy = state->length;
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = 0;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
+ Trace((stderr, "inflate.c too far\n"));
+ copy -= state->whave;
+ if (copy > state->length) copy = state->length;
+ if (copy > left) copy = left;
+ left -= copy;
+ state->length -= copy;
+ do {
+ *put++ = 0;
+ } while (--copy);
+ if (state->length == 0) state->mode = LEN;
+ break;
#endif
- }
- if (copy > state->wnext) {
- copy -= state->wnext;
- from = state->window + (state->wsize - copy);
- }
- else
- from = state->window + (state->wnext - copy);
- if (copy > state->length) copy = state->length;
- }
- else { /* copy from output */
- from = put - state->offset;
- copy = state->length;
- }
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
- case LIT:
- if (left == 0) goto inf_leave;
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- case CHECK:
- if (state->wrap) {
- NEEDBITS(32);
- out -= left;
- strm->total_out += out;
- state->total += out;
- if (out)
- strm->adler = state->check =
- UPDATE(state->check, put - out, out);
- out = left;
- if ((
+ }
+ if (copy > state->wnext) {
+ copy -= state->wnext;
+ from = state->window + (state->wsize - copy);
+ }
+ else
+ from = state->window + (state->wnext - copy);
+ if (copy > state->length) copy = state->length;
+ }
+ else { /* copy from output */
+ from = put - state->offset;
+ copy = state->length;
+ }
+ if (copy > left) copy = left;
+ left -= copy;
+ state->length -= copy;
+ do {
+ *put++ = *from++;
+ } while (--copy);
+ if (state->length == 0) state->mode = LEN;
+ break;
+ case LIT:
+ if (left == 0) goto inf_leave;
+ *put++ = (unsigned char)(state->length);
+ left--;
+ state->mode = LEN;
+ break;
+ case CHECK:
+ if (state->wrap) {
+ NEEDBITS(32);
+ out -= left;
+ strm->total_out += out;
+ state->total += out;
+ if (out)
+ strm->adler = state->check =
+ UPDATE(state->check, put - out, out);
+ out = left;
+ if ((
#ifdef GUNZIP
- state->flags ? hold :
+ state->flags ? hold :
#endif
- ZSWAP32(hold)) != state->check) {
- strm->msg = (char *)"incorrect data check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: check matches trailer\n"));
- }
+ ZSWAP32(hold)) != state->check) {
+ strm->msg = (char *)"incorrect data check";
+ state->mode = BAD;
+ break;
+ }
+ INITBITS();
+ Tracev((stderr, "inflate: check matches trailer\n"));
+ }
#ifdef GUNZIP
- state->mode = LENGTH;
- case LENGTH:
- if (state->wrap && state->flags) {
- NEEDBITS(32);
- if (hold != (state->total & 0xffffffffUL)) {
- strm->msg = (char *)"incorrect length check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: length matches trailer\n"));
- }
+ state->mode = LENGTH;
+ case LENGTH:
+ if (state->wrap && state->flags) {
+ NEEDBITS(32);
+ if (hold != (state->total & 0xffffffffUL)) {
+ strm->msg = (char *)"incorrect length check";
+ state->mode = BAD;
+ break;
+ }
+ INITBITS();
+ Tracev((stderr, "inflate: length matches trailer\n"));
+ }
#endif
- state->mode = DONE;
- case DONE:
- ret = Z_STREAM_END;
- goto inf_leave;
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
- case MEM:
- return Z_MEM_ERROR;
- case SYNC:
- default:
- return Z_STREAM_ERROR;
- }
-
- /*
- Return from inflate(), updating the total counts and the check value.
- If there was no progress during the inflate() call, return a buffer
- error. Call updatewindow() to create and/or update the window state.
- Note: a memory error from inflate() is non-recoverable.
- */
- inf_leave:
- RESTORE();
- if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
- (state->mode < CHECK || flush != Z_FINISH)))
- if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- in -= strm->avail_in;
- out -= strm->avail_out;
- strm->total_in += in;
- strm->total_out += out;
- state->total += out;
- if (state->wrap && out)
- strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
- strm->data_type = state->bits + (state->last ? 64 : 0) +
- (state->mode == TYPE ? 128 : 0) +
- (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
- if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
- ret = Z_BUF_ERROR;
- return ret;
+ state->mode = DONE;
+ case DONE:
+ ret = Z_STREAM_END;
+ goto inf_leave;
+ case BAD:
+ ret = Z_DATA_ERROR;
+ goto inf_leave;
+ case MEM:
+ return Z_MEM_ERROR;
+ case SYNC:
+ default:
+ return Z_STREAM_ERROR;
+ }
+
+ /*
+ Return from inflate(), updating the total counts and the check value.
+ If there was no progress during the inflate() call, return a buffer
+ error. Call updatewindow() to create and/or update the window state.
+ Note: a memory error from inflate() is non-recoverable.
+ */
+ inf_leave:
+ RESTORE();
+ if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
+ (state->mode < CHECK || flush != Z_FINISH)))
+ if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
+ state->mode = MEM;
+ return Z_MEM_ERROR;
+ }
+ in -= strm->avail_in;
+ out -= strm->avail_out;
+ strm->total_in += in;
+ strm->total_out += out;
+ state->total += out;
+ if (state->wrap && out)
+ strm->adler = state->check =
+ UPDATE(state->check, strm->next_out - out, out);
+ strm->data_type = state->bits + (state->last ? 64 : 0) +
+ (state->mode == TYPE ? 128 : 0) +
+ (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
+ if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
+ ret = Z_BUF_ERROR;
+ return ret;
}
int ZEXPORT inflateEnd(strm)
z_streamp strm;
{
- struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->window != Z_NULL) ZFREE(strm, state->window);
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
+ struct inflate_state FAR *state;
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+ return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (state->window != Z_NULL) ZFREE(strm, state->window);
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+ Tracev((stderr, "inflate: end\n"));
+ return Z_OK;
}
int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
@@ -1270,22 +1270,22 @@ z_streamp strm;
Bytef *dictionary;
uInt *dictLength;
{
- struct inflate_state FAR *state;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* copy dictionary */
- if (state->whave && dictionary != Z_NULL) {
- zmemcpy(dictionary, state->window + state->wnext,
- state->whave - state->wnext);
- zmemcpy(dictionary + state->whave - state->wnext,
- state->window, state->wnext);
- }
- if (dictLength != Z_NULL)
- *dictLength = state->whave;
- return Z_OK;
+ struct inflate_state FAR *state;
+
+ /* check state */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+
+ /* copy dictionary */
+ if (state->whave && dictionary != Z_NULL) {
+ zmemcpy(dictionary, state->window + state->wnext,
+ state->whave - state->wnext);
+ zmemcpy(dictionary + state->whave - state->wnext,
+ state->window, state->wnext);
+ }
+ if (dictLength != Z_NULL)
+ *dictLength = state->whave;
+ return Z_OK;
}
int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
@@ -1293,51 +1293,51 @@ z_streamp strm;
const Bytef *dictionary;
uInt dictLength;
{
- struct inflate_state FAR *state;
- unsigned long dictid;
- int ret;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->wrap != 0 && state->mode != DICT)
- return Z_STREAM_ERROR;
-
- /* check for correct dictionary identifier */
- if (state->mode == DICT) {
- dictid = adler32(0L, Z_NULL, 0);
- dictid = adler32(dictid, dictionary, dictLength);
- if (dictid != state->check)
- return Z_DATA_ERROR;
- }
-
- /* copy dictionary to window using updatewindow(), which will amend the
- existing dictionary if appropriate */
- ret = updatewindow(strm, dictionary + dictLength, dictLength);
- if (ret) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- state->havedict = 1;
- Tracev((stderr, "inflate: dictionary set\n"));
- return Z_OK;
+ struct inflate_state FAR *state;
+ unsigned long dictid;
+ int ret;
+
+ /* check state */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (state->wrap != 0 && state->mode != DICT)
+ return Z_STREAM_ERROR;
+
+ /* check for correct dictionary identifier */
+ if (state->mode == DICT) {
+ dictid = adler32(0L, Z_NULL, 0);
+ dictid = adler32(dictid, dictionary, dictLength);
+ if (dictid != state->check)
+ return Z_DATA_ERROR;
+ }
+
+ /* copy dictionary to window using updatewindow(), which will amend the
+ existing dictionary if appropriate */
+ ret = updatewindow(strm, dictionary + dictLength, dictLength);
+ if (ret) {
+ state->mode = MEM;
+ return Z_MEM_ERROR;
+ }
+ state->havedict = 1;
+ Tracev((stderr, "inflate: dictionary set\n"));
+ return Z_OK;
}
int ZEXPORT inflateGetHeader(strm, head)
z_streamp strm;
gz_headerp head;
{
- struct inflate_state FAR *state;
+ struct inflate_state FAR *state;
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
+ /* check state */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
- /* save header structure */
- state->head = head;
- head->done = 0;
- return Z_OK;
+ /* save header structure */
+ state->head = head;
+ head->done = 0;
+ return Z_OK;
}
/*
@@ -1356,65 +1356,65 @@ unsigned FAR *have;
const unsigned char FAR *buf;
unsigned len;
{
- unsigned got;
- unsigned next;
-
- got = *have;
- next = 0;
- while (next < len && got < 4) {
- if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
- got++;
- else if (buf[next])
- got = 0;
- else
- got = 4 - got;
- next++;
- }
- *have = got;
- return next;
+ unsigned got;
+ unsigned next;
+
+ got = *have;
+ next = 0;
+ while (next < len && got < 4) {
+ if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
+ got++;
+ else if (buf[next])
+ got = 0;
+ else
+ got = 4 - got;
+ next++;
+ }
+ *have = got;
+ return next;
}
int ZEXPORT inflateSync(strm)
z_streamp strm;
{
- unsigned len; /* number of bytes to look at or looked at */
- unsigned long in, out; /* temporary to save total_in and total_out */
- unsigned char buf[4]; /* to restore bit buffer to byte string */
- struct inflate_state FAR *state;
-
- /* check parameters */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
-
- /* if first time, start search in bit buffer */
- if (state->mode != SYNC) {
- state->mode = SYNC;
- state->hold <<= state->bits & 7;
- state->bits -= state->bits & 7;
- len = 0;
- while (state->bits >= 8) {
- buf[len++] = (unsigned char)(state->hold);
- state->hold >>= 8;
- state->bits -= 8;
- }
- state->have = 0;
- syncsearch(&(state->have), buf, len);
- }
-
- /* search available input */
- len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
- strm->avail_in -= len;
- strm->next_in += len;
- strm->total_in += len;
-
- /* return no joy or set up to restart inflate() on a new block */
- if (state->have != 4) return Z_DATA_ERROR;
- in = strm->total_in; out = strm->total_out;
- inflateReset(strm);
- strm->total_in = in; strm->total_out = out;
- state->mode = TYPE;
- return Z_OK;
+ unsigned len; /* number of bytes to look at or looked at */
+ unsigned long in, out; /* temporary to save total_in and total_out */
+ unsigned char buf[4]; /* to restore bit buffer to byte string */
+ struct inflate_state FAR *state;
+
+ /* check parameters */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
+
+ /* if first time, start search in bit buffer */
+ if (state->mode != SYNC) {
+ state->mode = SYNC;
+ state->hold <<= state->bits & 7;
+ state->bits -= state->bits & 7;
+ len = 0;
+ while (state->bits >= 8) {
+ buf[len++] = (unsigned char)(state->hold);
+ state->hold >>= 8;
+ state->bits -= 8;
+ }
+ state->have = 0;
+ syncsearch(&(state->have), buf, len);
+ }
+
+ /* search available input */
+ len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
+ strm->avail_in -= len;
+ strm->next_in += len;
+ strm->total_in += len;
+
+ /* return no joy or set up to restart inflate() on a new block */
+ if (state->have != 4) return Z_DATA_ERROR;
+ in = strm->total_in; out = strm->total_out;
+ inflateReset(strm);
+ strm->total_in = in; strm->total_out = out;
+ state->mode = TYPE;
+ return Z_OK;
}
/*
@@ -1428,85 +1428,85 @@ z_streamp strm;
int ZEXPORT inflateSyncPoint(strm)
z_streamp strm;
{
- struct inflate_state FAR *state;
+ struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- return state->mode == STORED && state->bits == 0;
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ return state->mode == STORED && state->bits == 0;
}
int ZEXPORT inflateCopy(dest, source)
z_streamp dest;
z_streamp source;
{
- struct inflate_state FAR *state;
- struct inflate_state FAR *copy;
- unsigned char FAR *window;
- unsigned wsize;
-
- /* check input */
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)source->state;
-
- /* allocate space */
- copy = (struct inflate_state FAR *)
- ZALLOC(source, 1, sizeof(struct inflate_state));
- if (copy == Z_NULL) return Z_MEM_ERROR;
- window = Z_NULL;
- if (state->window != Z_NULL) {
- window = (unsigned char FAR *)
- ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
- if (window == Z_NULL) {
- ZFREE(source, copy);
- return Z_MEM_ERROR;
- }
- }
-
- /* copy state */
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
- zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
- if (state->lencode >= state->codes &&
- state->lencode <= state->codes + ENOUGH - 1) {
- copy->lencode = copy->codes + (state->lencode - state->codes);
- copy->distcode = copy->codes + (state->distcode - state->codes);
- }
- copy->next = copy->codes + (state->next - state->codes);
- if (window != Z_NULL) {
- wsize = 1U << state->wbits;
- zmemcpy(window, state->window, wsize);
- }
- copy->window = window;
- dest->state = (struct internal_state FAR *)copy;
- return Z_OK;
+ struct inflate_state FAR *state;
+ struct inflate_state FAR *copy;
+ unsigned char FAR *window;
+ unsigned wsize;
+
+ /* check input */
+ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
+ source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
+ return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)source->state;
+
+ /* allocate space */
+ copy = (struct inflate_state FAR *)
+ ZALLOC(source, 1, sizeof(struct inflate_state));
+ if (copy == Z_NULL) return Z_MEM_ERROR;
+ window = Z_NULL;
+ if (state->window != Z_NULL) {
+ window = (unsigned char FAR *)
+ ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
+ if (window == Z_NULL) {
+ ZFREE(source, copy);
+ return Z_MEM_ERROR;
+ }
+ }
+
+ /* copy state */
+ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
+ zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
+ if (state->lencode >= state->codes &&
+ state->lencode <= state->codes + ENOUGH - 1) {
+ copy->lencode = copy->codes + (state->lencode - state->codes);
+ copy->distcode = copy->codes + (state->distcode - state->codes);
+ }
+ copy->next = copy->codes + (state->next - state->codes);
+ if (window != Z_NULL) {
+ wsize = 1U << state->wbits;
+ zmemcpy(window, state->window, wsize);
+ }
+ copy->window = window;
+ dest->state = (struct internal_state FAR *)copy;
+ return Z_OK;
}
int ZEXPORT inflateUndermine(strm, subvert)
z_streamp strm;
int subvert;
{
- struct inflate_state FAR *state;
+ struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- state->sane = !subvert;
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ state->sane = !subvert;
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- return Z_OK;
+ return Z_OK;
#else
- state->sane = 1;
- return Z_DATA_ERROR;
+ state->sane = 1;
+ return Z_DATA_ERROR;
#endif
}
long ZEXPORT inflateMark(strm)
z_streamp strm;
{
- struct inflate_state FAR *state;
+ struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
- state = (struct inflate_state FAR *)strm->state;
- return ((long)(state->back) << 16) +
- (state->mode == COPY ? state->length :
- (state->mode == MATCH ? state->was - state->length : 0));
+ if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
+ state = (struct inflate_state FAR *)strm->state;
+ return ((long)(state->back) << 16) +
+ (state->mode == COPY ? state->length :
+ (state->mode == MATCH ? state->was - state->length : 0));
}
diff --git a/src/lib/zlib/inflate.h b/src/lib/zlib/inflate.h
index 95f4986d400..0da501e2ca4 100644
--- a/src/lib/zlib/inflate.h
+++ b/src/lib/zlib/inflate.h
@@ -18,38 +18,38 @@
/* Possible inflate modes between inflate() calls */
typedef enum {
- HEAD, /* i: waiting for magic header */
- FLAGS, /* i: waiting for method and flags (gzip) */
- TIME, /* i: waiting for modification time (gzip) */
- OS, /* i: waiting for extra flags and operating system (gzip) */
- EXLEN, /* i: waiting for extra length (gzip) */
- EXTRA, /* i: waiting for extra bytes (gzip) */
- NAME, /* i: waiting for end of file name (gzip) */
- COMMENT, /* i: waiting for end of comment (gzip) */
- HCRC, /* i: waiting for header crc (gzip) */
- DICTID, /* i: waiting for dictionary check value */
- DICT, /* waiting for inflateSetDictionary() call */
- TYPE, /* i: waiting for type bits, including last-flag bit */
- TYPEDO, /* i: same, but skip check to exit inflate on new block */
- STORED, /* i: waiting for stored size (length and complement) */
- COPY_, /* i/o: same as COPY below, but only first time in */
- COPY, /* i/o: waiting for input or output to copy stored block */
- TABLE, /* i: waiting for dynamic block table lengths */
- LENLENS, /* i: waiting for code length code lengths */
- CODELENS, /* i: waiting for length/lit and distance code lengths */
- LEN_, /* i: same as LEN below, but only first time in */
- LEN, /* i: waiting for length/lit/eob code */
- LENEXT, /* i: waiting for length extra bits */
- DIST, /* i: waiting for distance code */
- DISTEXT, /* i: waiting for distance extra bits */
- MATCH, /* o: waiting for output space to copy string */
- LIT, /* o: waiting for output space to write literal */
- CHECK, /* i: waiting for 32-bit check value */
- LENGTH, /* i: waiting for 32-bit length (gzip) */
- DONE, /* finished check, done -- remain here until reset */
- BAD, /* got a data error -- remain here until reset */
- MEM, /* got an inflate() memory error -- remain here until reset */
- SYNC /* looking for synchronization bytes to restart inflate() */
+ HEAD, /* i: waiting for magic header */
+ FLAGS, /* i: waiting for method and flags (gzip) */
+ TIME, /* i: waiting for modification time (gzip) */
+ OS, /* i: waiting for extra flags and operating system (gzip) */
+ EXLEN, /* i: waiting for extra length (gzip) */
+ EXTRA, /* i: waiting for extra bytes (gzip) */
+ NAME, /* i: waiting for end of file name (gzip) */
+ COMMENT, /* i: waiting for end of comment (gzip) */
+ HCRC, /* i: waiting for header crc (gzip) */
+ DICTID, /* i: waiting for dictionary check value */
+ DICT, /* waiting for inflateSetDictionary() call */
+ TYPE, /* i: waiting for type bits, including last-flag bit */
+ TYPEDO, /* i: same, but skip check to exit inflate on new block */
+ STORED, /* i: waiting for stored size (length and complement) */
+ COPY_, /* i/o: same as COPY below, but only first time in */
+ COPY, /* i/o: waiting for input or output to copy stored block */
+ TABLE, /* i: waiting for dynamic block table lengths */
+ LENLENS, /* i: waiting for code length code lengths */
+ CODELENS, /* i: waiting for length/lit and distance code lengths */
+ LEN_, /* i: same as LEN below, but only first time in */
+ LEN, /* i: waiting for length/lit/eob code */
+ LENEXT, /* i: waiting for length extra bits */
+ DIST, /* i: waiting for distance code */
+ DISTEXT, /* i: waiting for distance extra bits */
+ MATCH, /* o: waiting for output space to copy string */
+ LIT, /* o: waiting for output space to write literal */
+ CHECK, /* i: waiting for 32-bit check value */
+ LENGTH, /* i: waiting for 32-bit length (gzip) */
+ DONE, /* finished check, done -- remain here until reset */
+ BAD, /* got a data error -- remain here until reset */
+ MEM, /* got an inflate() memory error -- remain here until reset */
+ SYNC /* looking for synchronization bytes to restart inflate() */
} inflate_mode;
/*
@@ -79,44 +79,44 @@ typedef enum {
/* state maintained between inflate() calls. Approximately 10K bytes. */
struct inflate_state {
- inflate_mode mode; /* current inflate mode */
- int last; /* true if processing last block */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- int havedict; /* true if dictionary provided */
- int flags; /* gzip header method and flags (0 if zlib) */
- unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
- unsigned long check; /* protected copy of check value */
- unsigned long total; /* protected copy of output count */
- gz_headerp head; /* where to save gzip header information */
- /* sliding window */
- unsigned wbits; /* log base 2 of requested window size */
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned wnext; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- /* bit accumulator */
- unsigned long hold; /* input bit accumulator */
- unsigned bits; /* number of bits in "in" */
- /* for string and stored block copying */
- unsigned length; /* literal or length of data to copy */
- unsigned offset; /* distance back to copy string from */
- /* for table and code decoding */
- unsigned extra; /* extra bits needed */
- /* fixed and dynamic code tables */
- code const FAR *lencode; /* starting table for length/literal codes */
- code const FAR *distcode; /* starting table for distance codes */
- unsigned lenbits; /* index bits for lencode */
- unsigned distbits; /* index bits for distcode */
- /* dynamic table building */
- unsigned ncode; /* number of code length code lengths */
- unsigned nlen; /* number of length code lengths */
- unsigned ndist; /* number of distance code lengths */
- unsigned have; /* number of code lengths in lens[] */
- code FAR *next; /* next available space in codes[] */
- unsigned short lens[320]; /* temporary storage for code lengths */
- unsigned short work[288]; /* work area for code table building */
- code codes[ENOUGH]; /* space for code tables */
- int sane; /* if false, allow invalid distance too far */
- int back; /* bits back of last unprocessed length/lit */
- unsigned was; /* initial length of match */
+ inflate_mode mode; /* current inflate mode */
+ int last; /* true if processing last block */
+ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
+ int havedict; /* true if dictionary provided */
+ int flags; /* gzip header method and flags (0 if zlib) */
+ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
+ unsigned long check; /* protected copy of check value */
+ unsigned long total; /* protected copy of output count */
+ gz_headerp head; /* where to save gzip header information */
+ /* sliding window */
+ unsigned wbits; /* log base 2 of requested window size */
+ unsigned wsize; /* window size or zero if not using window */
+ unsigned whave; /* valid bytes in the window */
+ unsigned wnext; /* window write index */
+ unsigned char FAR *window; /* allocated sliding window, if needed */
+ /* bit accumulator */
+ unsigned long hold; /* input bit accumulator */
+ unsigned bits; /* number of bits in "in" */
+ /* for string and stored block copying */
+ unsigned length; /* literal or length of data to copy */
+ unsigned offset; /* distance back to copy string from */
+ /* for table and code decoding */
+ unsigned extra; /* extra bits needed */
+ /* fixed and dynamic code tables */
+ code const FAR *lencode; /* starting table for length/literal codes */
+ code const FAR *distcode; /* starting table for distance codes */
+ unsigned lenbits; /* index bits for lencode */
+ unsigned distbits; /* index bits for distcode */
+ /* dynamic table building */
+ unsigned ncode; /* number of code length code lengths */
+ unsigned nlen; /* number of length code lengths */
+ unsigned ndist; /* number of distance code lengths */
+ unsigned have; /* number of code lengths in lens[] */
+ code FAR *next; /* next available space in codes[] */
+ unsigned short lens[320]; /* temporary storage for code lengths */
+ unsigned short work[288]; /* work area for code table building */
+ code codes[ENOUGH]; /* space for code tables */
+ int sane; /* if false, allow invalid distance too far */
+ int back; /* bits back of last unprocessed length/lit */
+ unsigned was; /* initial length of match */
};
diff --git a/src/lib/zlib/inftrees.c b/src/lib/zlib/inftrees.c
index 44d89cf24e1..f3c18fcd48f 100644
--- a/src/lib/zlib/inftrees.c
+++ b/src/lib/zlib/inftrees.c
@@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
- " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
+ " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -37,270 +37,270 @@ code FAR * FAR *table;
unsigned FAR *bits;
unsigned short FAR *work;
{
- unsigned len; /* a code's length in bits */
- unsigned sym; /* index of code symbols */
- unsigned min, max; /* minimum and maximum code lengths */
- unsigned root; /* number of index bits for root table */
- unsigned curr; /* number of index bits for current table */
- unsigned drop; /* code bits to drop for sub-table */
- int left; /* number of prefix codes available */
- unsigned used; /* code entries in table used */
- unsigned huff; /* Huffman code */
- unsigned incr; /* for incrementing code, index */
- unsigned fill; /* index for replicating entries */
- unsigned low; /* low bits for current root entry */
- unsigned mask; /* mask for low root bits */
- code here; /* table entry for duplication */
- code FAR *next; /* next available space in table */
- const unsigned short FAR *base; /* base value table to use */
- const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
- unsigned short count[MAXBITS+1]; /* number of codes of each length */
- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
- static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577, 0, 0};
- static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
- 28, 28, 29, 29, 64, 64};
-
- /*
- Process a set of code lengths to create a canonical Huffman code. The
- code lengths are lens[0..codes-1]. Each length corresponds to the
- symbols 0..codes-1. The Huffman code is generated by first sorting the
- symbols by length from short to long, and retaining the symbol order
- for codes with equal lengths. Then the code starts with all zero bits
- for the first code of the shortest length, and the codes are integer
- increments for the same length, and zeros are appended as the length
- increases. For the deflate format, these bits are stored backwards
- from their more natural integer increment ordering, and so when the
- decoding tables are built in the large loop below, the integer codes
- are incremented backwards.
-
- This routine assumes, but does not check, that all of the entries in
- lens[] are in the range 0..MAXBITS. The caller must assure this.
- 1..MAXBITS is interpreted as that code length. zero means that that
- symbol does not occur in this code.
-
- The codes are sorted by computing a count of codes for each length,
- creating from that a table of starting indices for each length in the
- sorted table, and then entering the symbols in order in the sorted
- table. The sorted table is work[], with that space being provided by
- the caller.
-
- The length counts are used for other purposes as well, i.e. finding
- the minimum and maximum length codes, determining if there are any
- codes at all, checking for a valid set of lengths, and looking ahead
- at length counts to determine sub-table sizes when building the
- decoding tables.
- */
-
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
- for (len = 0; len <= MAXBITS; len++)
- count[len] = 0;
- for (sym = 0; sym < codes; sym++)
- count[lens[sym]]++;
-
- /* bound code lengths, force root to be within code lengths */
- root = *bits;
- for (max = MAXBITS; max >= 1; max--)
- if (count[max] != 0) break;
- if (root > max) root = max;
- if (max == 0) { /* no symbols to code at all */
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)1;
- here.val = (unsigned short)0;
- *(*table)++ = here; /* make a table to force an error */
- *(*table)++ = here;
- *bits = 1;
- return 0; /* no symbols, but wait for decoding to report error */
- }
- for (min = 1; min < max; min++)
- if (count[min] != 0) break;
- if (root < min) root = min;
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1;
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1;
- left -= count[len];
- if (left < 0) return -1; /* over-subscribed */
- }
- if (left > 0 && (type == CODES || max != 1))
- return -1; /* incomplete set */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + count[len];
-
- /* sort symbols by length, by symbol order within each length */
- for (sym = 0; sym < codes; sym++)
- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
-
- /*
- Create and fill in decoding tables. In this loop, the table being
- filled is at next and has curr index bits. The code being used is huff
- with length len. That code is converted to an index by dropping drop
- bits off of the bottom. For codes where len is less than drop + curr,
- those top drop + curr - len bits are incremented through all values to
- fill the table with replicated entries.
-
- root is the number of index bits for the root table. When len exceeds
- root, sub-tables are created pointed to by the root entry with an index
- of the low root bits of huff. This is saved in low to check for when a
- new sub-table should be started. drop is zero when the root table is
- being filled, and drop is root when sub-tables are being filled.
-
- When a new sub-table is needed, it is necessary to look ahead in the
- code lengths to determine what size sub-table is needed. The length
- counts are used for this, and so count[] is decremented as codes are
- entered in the tables.
-
- used keeps track of how many table entries have been allocated from the
- provided *table space. It is checked for LENS and DIST tables against
- the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
- the initial root table size constants. See the comments in inftrees.h
- for more information.
-
- sym increments through all symbols, and the loop terminates when
- all codes of length max, i.e. all codes, have been processed. This
- routine permits incomplete codes, so another loop after this one fills
- in the rest of the decoding tables with invalid code markers.
- */
-
- /* set up for code type */
- switch (type) {
- case CODES:
- base = extra = work; /* dummy value--not used */
- end = 19;
- break;
- case LENS:
- base = lbase;
- base -= 257;
- extra = lext;
- extra -= 257;
- end = 256;
- break;
- default: /* DISTS */
- base = dbase;
- extra = dext;
- end = -1;
- }
-
- /* initialize state for loop */
- huff = 0; /* starting code */
- sym = 0; /* starting code symbol */
- len = min; /* starting code length */
- next = *table; /* current table to fill in */
- curr = root; /* current table index bits */
- drop = 0; /* current bits to drop from code for index */
- low = (unsigned)(-1); /* trigger new sub-table when len > root */
- used = 1U << root; /* use root table entries */
- mask = used - 1; /* mask for comparing low */
-
- /* check available table space */
- if ((type == LENS && used > ENOUGH_LENS) ||
- (type == DISTS && used > ENOUGH_DISTS))
- return 1;
-
- /* process all codes and make table entries */
- for (;;) {
- /* create table entry */
- here.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
- here.op = (unsigned char)0;
- here.val = work[sym];
- }
- else if ((int)(work[sym]) > end) {
- here.op = (unsigned char)(extra[work[sym]]);
- here.val = base[work[sym]];
- }
- else {
- here.op = (unsigned char)(32 + 64); /* end of block */
- here.val = 0;
- }
-
- /* replicate for those indices with low len bits equal to huff */
- incr = 1U << (len - drop);
- fill = 1U << curr;
- min = fill; /* save offset to next table */
- do {
- fill -= incr;
- next[(huff >> drop) + fill] = here;
- } while (fill != 0);
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
-
- /* go to next symbol, update count, len */
- sym++;
- if (--(count[len]) == 0) {
- if (len == max) break;
- len = lens[work[sym]];
- }
-
- /* create new sub-table if needed */
- if (len > root && (huff & mask) != low) {
- /* if first time, transition to sub-tables */
- if (drop == 0)
- drop = root;
-
- /* increment past last table */
- next += min; /* here min is 1 << curr */
-
- /* determine length of next table */
- curr = len - drop;
- left = (int)(1 << curr);
- while (curr + drop < max) {
- left -= count[curr + drop];
- if (left <= 0) break;
- curr++;
- left <<= 1;
- }
-
- /* check for enough space */
- used += 1U << curr;
- if ((type == LENS && used > ENOUGH_LENS) ||
- (type == DISTS && used > ENOUGH_DISTS))
- return 1;
-
- /* point entry in root table to sub-table */
- low = huff & mask;
- (*table)[low].op = (unsigned char)curr;
- (*table)[low].bits = (unsigned char)root;
- (*table)[low].val = (unsigned short)(next - *table);
- }
- }
-
- /* fill in remaining table entry if code is incomplete (guaranteed to have
- at most one remaining entry, since if the code is incomplete, the
- maximum code length that was allowed to get this far is one bit) */
- if (huff != 0) {
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)(len - drop);
- here.val = (unsigned short)0;
- next[huff] = here;
- }
-
- /* set return parameters */
- *table += used;
- *bits = root;
- return 0;
+ unsigned len; /* a code's length in bits */
+ unsigned sym; /* index of code symbols */
+ unsigned min, max; /* minimum and maximum code lengths */
+ unsigned root; /* number of index bits for root table */
+ unsigned curr; /* number of index bits for current table */
+ unsigned drop; /* code bits to drop for sub-table */
+ int left; /* number of prefix codes available */
+ unsigned used; /* code entries in table used */
+ unsigned huff; /* Huffman code */
+ unsigned incr; /* for incrementing code, index */
+ unsigned fill; /* index for replicating entries */
+ unsigned low; /* low bits for current root entry */
+ unsigned mask; /* mask for low root bits */
+ code here; /* table entry for duplication */
+ code FAR *next; /* next available space in table */
+ const unsigned short FAR *base; /* base value table to use */
+ const unsigned short FAR *extra; /* extra bits table to use */
+ int end; /* use base and extra for symbol > end */
+ unsigned short count[MAXBITS+1]; /* number of codes of each length */
+ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
+ static const unsigned short lbase[31] = { /* Length codes 257..285 base */
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+ static const unsigned short lext[31] = { /* Length codes 257..285 extra */
+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
+ static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577, 0, 0};
+ static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
+ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
+ 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
+ 28, 28, 29, 29, 64, 64};
+
+ /*
+ Process a set of code lengths to create a canonical Huffman code. The
+ code lengths are lens[0..codes-1]. Each length corresponds to the
+ symbols 0..codes-1. The Huffman code is generated by first sorting the
+ symbols by length from short to long, and retaining the symbol order
+ for codes with equal lengths. Then the code starts with all zero bits
+ for the first code of the shortest length, and the codes are integer
+ increments for the same length, and zeros are appended as the length
+ increases. For the deflate format, these bits are stored backwards
+ from their more natural integer increment ordering, and so when the
+ decoding tables are built in the large loop below, the integer codes
+ are incremented backwards.
+
+ This routine assumes, but does not check, that all of the entries in
+ lens[] are in the range 0..MAXBITS. The caller must assure this.
+ 1..MAXBITS is interpreted as that code length. zero means that that
+ symbol does not occur in this code.
+
+ The codes are sorted by computing a count of codes for each length,
+ creating from that a table of starting indices for each length in the
+ sorted table, and then entering the symbols in order in the sorted
+ table. The sorted table is work[], with that space being provided by
+ the caller.
+
+ The length counts are used for other purposes as well, i.e. finding
+ the minimum and maximum length codes, determining if there are any
+ codes at all, checking for a valid set of lengths, and looking ahead
+ at length counts to determine sub-table sizes when building the
+ decoding tables.
+ */
+
+ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
+ for (len = 0; len <= MAXBITS; len++)
+ count[len] = 0;
+ for (sym = 0; sym < codes; sym++)
+ count[lens[sym]]++;
+
+ /* bound code lengths, force root to be within code lengths */
+ root = *bits;
+ for (max = MAXBITS; max >= 1; max--)
+ if (count[max] != 0) break;
+ if (root > max) root = max;
+ if (max == 0) { /* no symbols to code at all */
+ here.op = (unsigned char)64; /* invalid code marker */
+ here.bits = (unsigned char)1;
+ here.val = (unsigned short)0;
+ *(*table)++ = here; /* make a table to force an error */
+ *(*table)++ = here;
+ *bits = 1;
+ return 0; /* no symbols, but wait for decoding to report error */
+ }
+ for (min = 1; min < max; min++)
+ if (count[min] != 0) break;
+ if (root < min) root = min;
+
+ /* check for an over-subscribed or incomplete set of lengths */
+ left = 1;
+ for (len = 1; len <= MAXBITS; len++) {
+ left <<= 1;
+ left -= count[len];
+ if (left < 0) return -1; /* over-subscribed */
+ }
+ if (left > 0 && (type == CODES || max != 1))
+ return -1; /* incomplete set */
+
+ /* generate offsets into symbol table for each length for sorting */
+ offs[1] = 0;
+ for (len = 1; len < MAXBITS; len++)
+ offs[len + 1] = offs[len] + count[len];
+
+ /* sort symbols by length, by symbol order within each length */
+ for (sym = 0; sym < codes; sym++)
+ if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
+
+ /*
+ Create and fill in decoding tables. In this loop, the table being
+ filled is at next and has curr index bits. The code being used is huff
+ with length len. That code is converted to an index by dropping drop
+ bits off of the bottom. For codes where len is less than drop + curr,
+ those top drop + curr - len bits are incremented through all values to
+ fill the table with replicated entries.
+
+ root is the number of index bits for the root table. When len exceeds
+ root, sub-tables are created pointed to by the root entry with an index
+ of the low root bits of huff. This is saved in low to check for when a
+ new sub-table should be started. drop is zero when the root table is
+ being filled, and drop is root when sub-tables are being filled.
+
+ When a new sub-table is needed, it is necessary to look ahead in the
+ code lengths to determine what size sub-table is needed. The length
+ counts are used for this, and so count[] is decremented as codes are
+ entered in the tables.
+
+ used keeps track of how many table entries have been allocated from the
+ provided *table space. It is checked for LENS and DIST tables against
+ the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
+ the initial root table size constants. See the comments in inftrees.h
+ for more information.
+
+ sym increments through all symbols, and the loop terminates when
+ all codes of length max, i.e. all codes, have been processed. This
+ routine permits incomplete codes, so another loop after this one fills
+ in the rest of the decoding tables with invalid code markers.
+ */
+
+ /* set up for code type */
+ switch (type) {
+ case CODES:
+ base = extra = work; /* dummy value--not used */
+ end = 19;
+ break;
+ case LENS:
+ base = lbase;
+ base -= 257;
+ extra = lext;
+ extra -= 257;
+ end = 256;
+ break;
+ default: /* DISTS */
+ base = dbase;
+ extra = dext;
+ end = -1;
+ }
+
+ /* initialize state for loop */
+ huff = 0; /* starting code */
+ sym = 0; /* starting code symbol */
+ len = min; /* starting code length */
+ next = *table; /* current table to fill in */
+ curr = root; /* current table index bits */
+ drop = 0; /* current bits to drop from code for index */
+ low = (unsigned)(-1); /* trigger new sub-table when len > root */
+ used = 1U << root; /* use root table entries */
+ mask = used - 1; /* mask for comparing low */
+
+ /* check available table space */
+ if ((type == LENS && used > ENOUGH_LENS) ||
+ (type == DISTS && used > ENOUGH_DISTS))
+ return 1;
+
+ /* process all codes and make table entries */
+ for (;;) {
+ /* create table entry */
+ here.bits = (unsigned char)(len - drop);
+ if ((int)(work[sym]) < end) {
+ here.op = (unsigned char)0;
+ here.val = work[sym];
+ }
+ else if ((int)(work[sym]) > end) {
+ here.op = (unsigned char)(extra[work[sym]]);
+ here.val = base[work[sym]];
+ }
+ else {
+ here.op = (unsigned char)(32 + 64); /* end of block */
+ here.val = 0;
+ }
+
+ /* replicate for those indices with low len bits equal to huff */
+ incr = 1U << (len - drop);
+ fill = 1U << curr;
+ min = fill; /* save offset to next table */
+ do {
+ fill -= incr;
+ next[(huff >> drop) + fill] = here;
+ } while (fill != 0);
+
+ /* backwards increment the len-bit code huff */
+ incr = 1U << (len - 1);
+ while (huff & incr)
+ incr >>= 1;
+ if (incr != 0) {
+ huff &= incr - 1;
+ huff += incr;
+ }
+ else
+ huff = 0;
+
+ /* go to next symbol, update count, len */
+ sym++;
+ if (--(count[len]) == 0) {
+ if (len == max) break;
+ len = lens[work[sym]];
+ }
+
+ /* create new sub-table if needed */
+ if (len > root && (huff & mask) != low) {
+ /* if first time, transition to sub-tables */
+ if (drop == 0)
+ drop = root;
+
+ /* increment past last table */
+ next += min; /* here min is 1 << curr */
+
+ /* determine length of next table */
+ curr = len - drop;
+ left = (int)(1 << curr);
+ while (curr + drop < max) {
+ left -= count[curr + drop];
+ if (left <= 0) break;
+ curr++;
+ left <<= 1;
+ }
+
+ /* check for enough space */
+ used += 1U << curr;
+ if ((type == LENS && used > ENOUGH_LENS) ||
+ (type == DISTS && used > ENOUGH_DISTS))
+ return 1;
+
+ /* point entry in root table to sub-table */
+ low = huff & mask;
+ (*table)[low].op = (unsigned char)curr;
+ (*table)[low].bits = (unsigned char)root;
+ (*table)[low].val = (unsigned short)(next - *table);
+ }
+ }
+
+ /* fill in remaining table entry if code is incomplete (guaranteed to have
+ at most one remaining entry, since if the code is incomplete, the
+ maximum code length that was allowed to get this far is one bit) */
+ if (huff != 0) {
+ here.op = (unsigned char)64; /* invalid code marker */
+ here.bits = (unsigned char)(len - drop);
+ here.val = (unsigned short)0;
+ next[huff] = here;
+ }
+
+ /* set return parameters */
+ *table += used;
+ *bits = root;
+ return 0;
}
diff --git a/src/lib/zlib/inftrees.h b/src/lib/zlib/inftrees.h
index baa53a0b1a1..14cf2cf6105 100644
--- a/src/lib/zlib/inftrees.h
+++ b/src/lib/zlib/inftrees.h
@@ -22,9 +22,9 @@
of a literal, the base length or distance, or the offset from
the current table to the next table. Each entry is four bytes. */
typedef struct {
- unsigned char op; /* operation, extra bits, table bits */
- unsigned char bits; /* bits in this part of the code */
- unsigned short val; /* offset in table or code value */
+ unsigned char op; /* operation, extra bits, table bits */
+ unsigned char bits; /* bits in this part of the code */
+ unsigned short val; /* offset in table or code value */
} code;
/* op values as set by inflate_table():
@@ -52,11 +52,11 @@ typedef struct {
/* Type of code to build for inflate_table() */
typedef enum {
- CODES,
- LENS,
- DISTS
+ CODES,
+ LENS,
+ DISTS
} codetype;
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work));
diff --git a/src/lib/zlib/trees.c b/src/lib/zlib/trees.c
index 1fd7759ef00..22a55a30c78 100644
--- a/src/lib/zlib/trees.c
+++ b/src/lib/zlib/trees.c
@@ -60,16 +60,16 @@
/* repeat a zero length 11-138 times (7 bits of repeat count) */
local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
local const int extra_dbits[D_CODES] /* extra bits for each distance code */
- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
+ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
local const uch bl_order[BL_CODES]
- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+ = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
/* The lengths of the bit length codes are sent in order of decreasing
* probability, to avoid transmitting the lengths for unused bit length codes.
*/
@@ -115,11 +115,11 @@ local int base_dist[D_CODES];
#endif /* GEN_TREES_H */
struct static_tree_desc_s {
- const ct_data *static_tree; /* static tree or NULL */
- const intf *extra_bits; /* extra bits for each code or NULL */
- int extra_base; /* base index for extra_bits */
- int elems; /* max number of elements in the tree */
- int max_length; /* max bit length for the codes */
+ const ct_data *static_tree; /* static tree or NULL */
+ const intf *extra_bits; /* extra bits for each code or NULL */
+ int extra_base; /* base index for extra_bits */
+ int elems; /* max number of elements in the tree */
+ int max_length; /* max bit length for the codes */
};
local static_tree_desc static_l_desc =
@@ -145,15 +145,15 @@ local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
local int build_bl_tree OF((deflate_state *s));
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
+ int blcodes));
local void compress_block OF((deflate_state *s, const ct_data *ltree,
- const ct_data *dtree));
+ const ct_data *dtree));
local int detect_data_type OF((deflate_state *s));
local unsigned bi_reverse OF((unsigned value, int length));
local void bi_windup OF((deflate_state *s));
local void bi_flush OF((deflate_state *s));
local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
- int header));
+ int header));
#ifdef GEN_TREES_H
local void gen_trees_header OF((void));
@@ -161,12 +161,12 @@ local void gen_trees_header OF((void));
#ifndef DEBUG
# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
- /* Send a code of the given tree. c and tree must not have side effects */
+ /* Send a code of the given tree. c and tree must not have side effects */
#else /* DEBUG */
# define send_code(s, c, tree) \
- { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
- send_bits(s, tree[c].Code, tree[c].Len); }
+ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
+ send_bits(s, tree[c].Code, tree[c].Len); }
#endif
/* ===========================================================================
@@ -174,8 +174,8 @@ local void gen_trees_header OF((void));
* IN assertion: there is enough room in pendingBuf.
*/
#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
+ put_byte(s, (uch)((w) & 0xff)); \
+ put_byte(s, (uch)((ush)(w) >> 8)); \
}
/* ===========================================================================
@@ -186,42 +186,42 @@ local void gen_trees_header OF((void));
local void send_bits OF((deflate_state *s, int value, int length));
local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
+ deflate_state *s;
+ int value; /* value to send */
+ int length; /* number of bits */
{
- Tracevv((stderr," l %2d v %4x ", length, value));
- Assert(length > 0 && length <= 15, "invalid length");
- s->bits_sent += (ulg)length;
-
- /* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
- * unused bits in value.
- */
- if (s->bi_valid > (int)Buf_size - length) {
- s->bi_buf |= (ush)value << s->bi_valid;
- put_short(s, s->bi_buf);
- s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
- s->bi_valid += length - Buf_size;
- } else {
- s->bi_buf |= (ush)value << s->bi_valid;
- s->bi_valid += length;
- }
+ Tracevv((stderr," l %2d v %4x ", length, value));
+ Assert(length > 0 && length <= 15, "invalid length");
+ s->bits_sent += (ulg)length;
+
+ /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+ * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+ * unused bits in value.
+ */
+ if (s->bi_valid > (int)Buf_size - length) {
+ s->bi_buf |= (ush)value << s->bi_valid;
+ put_short(s, s->bi_buf);
+ s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+ s->bi_valid += length - Buf_size;
+ } else {
+ s->bi_buf |= (ush)value << s->bi_valid;
+ s->bi_valid += length;
+ }
}
#else /* !DEBUG */
#define send_bits(s, value, length) \
{ int len = length;\
- if (s->bi_valid > (int)Buf_size - len) {\
- int val = value;\
- s->bi_buf |= (ush)val << s->bi_valid;\
- put_short(s, s->bi_buf);\
- s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
- s->bi_valid += len - Buf_size;\
- } else {\
- s->bi_buf |= (ush)(value) << s->bi_valid;\
- s->bi_valid += len;\
- }\
+ if (s->bi_valid > (int)Buf_size - len) {\
+ int val = value;\
+ s->bi_buf |= (ush)val << s->bi_valid;\
+ put_short(s, s->bi_buf);\
+ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+ s->bi_valid += len - Buf_size;\
+ } else {\
+ s->bi_buf |= (ush)(value) << s->bi_valid;\
+ s->bi_valid += len;\
+ }\
}
#endif /* DEBUG */
@@ -234,81 +234,81 @@ local void send_bits(s, value, length)
local void tr_static_init()
{
#if defined(GEN_TREES_H) || !defined(STDC)
- static int static_init_done = 0;
- int n; /* iterates over tree elements */
- int bits; /* bit counter */
- int length; /* length value */
- int code; /* code value */
- int dist; /* distance index */
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- if (static_init_done) return;
-
- /* For some embedded targets, global variables are not initialized: */
+ static int static_init_done = 0;
+ int n; /* iterates over tree elements */
+ int bits; /* bit counter */
+ int length; /* length value */
+ int code; /* code value */
+ int dist; /* distance index */
+ ush bl_count[MAX_BITS+1];
+ /* number of codes at each bit length for an optimal tree */
+
+ if (static_init_done) return;
+
+ /* For some embedded targets, global variables are not initialized: */
#ifdef NO_INIT_GLOBAL_POINTERS
- static_l_desc.static_tree = static_ltree;
- static_l_desc.extra_bits = extra_lbits;
- static_d_desc.static_tree = static_dtree;
- static_d_desc.extra_bits = extra_dbits;
- static_bl_desc.extra_bits = extra_blbits;
+ static_l_desc.static_tree = static_ltree;
+ static_l_desc.extra_bits = extra_lbits;
+ static_d_desc.static_tree = static_dtree;
+ static_d_desc.extra_bits = extra_dbits;
+ static_bl_desc.extra_bits = extra_blbits;
#endif
- /* Initialize the mapping length (0..255) -> length code (0..28) */
- length = 0;
- for (code = 0; code < LENGTH_CODES-1; code++) {
- base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
- _length_code[length++] = (uch)code;
- }
- }
- Assert (length == 256, "tr_static_init: length != 256");
- /* Note that the length 255 (match length 258) can be represented
- * in two different ways: code 284 + 5 bits or code 285, so we
- * overwrite length_code[255] to use the best encoding:
- */
- _length_code[length-1] = (uch)code;
-
- /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
- dist = 0;
- for (code = 0 ; code < 16; code++) {
- base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
- _dist_code[dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: dist != 256");
- dist >>= 7; /* from now on, all distances are divided by 128 */
- for ( ; code < D_CODES; code++) {
- base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
- _dist_code[256 + dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
-
- /* Construct the codes of the static literal tree */
- for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
- n = 0;
- while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
- while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
- while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
- while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
- /* Codes 286 and 287 do not exist, but we must include them in the
- * tree construction to get a canonical Huffman tree (longest code
- * all ones)
- */
- gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
-
- /* The static distance tree is trivial: */
- for (n = 0; n < D_CODES; n++) {
- static_dtree[n].Len = 5;
- static_dtree[n].Code = bi_reverse((unsigned)n, 5);
- }
- static_init_done = 1;
+ /* Initialize the mapping length (0..255) -> length code (0..28) */
+ length = 0;
+ for (code = 0; code < LENGTH_CODES-1; code++) {
+ base_length[code] = length;
+ for (n = 0; n < (1<<extra_lbits[code]); n++) {
+ _length_code[length++] = (uch)code;
+ }
+ }
+ Assert (length == 256, "tr_static_init: length != 256");
+ /* Note that the length 255 (match length 258) can be represented
+ * in two different ways: code 284 + 5 bits or code 285, so we
+ * overwrite length_code[255] to use the best encoding:
+ */
+ _length_code[length-1] = (uch)code;
+
+ /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+ dist = 0;
+ for (code = 0 ; code < 16; code++) {
+ base_dist[code] = dist;
+ for (n = 0; n < (1<<extra_dbits[code]); n++) {
+ _dist_code[dist++] = (uch)code;
+ }
+ }
+ Assert (dist == 256, "tr_static_init: dist != 256");
+ dist >>= 7; /* from now on, all distances are divided by 128 */
+ for ( ; code < D_CODES; code++) {
+ base_dist[code] = dist << 7;
+ for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+ _dist_code[256 + dist++] = (uch)code;
+ }
+ }
+ Assert (dist == 256, "tr_static_init: 256+dist != 512");
+
+ /* Construct the codes of the static literal tree */
+ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+ n = 0;
+ while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+ while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+ while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+ while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+ /* Codes 286 and 287 do not exist, but we must include them in the
+ * tree construction to get a canonical Huffman tree (longest code
+ * all ones)
+ */
+ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+
+ /* The static distance tree is trivial: */
+ for (n = 0; n < D_CODES; n++) {
+ static_dtree[n].Len = 5;
+ static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+ }
+ static_init_done = 1;
# ifdef GEN_TREES_H
- gen_trees_header();
+ gen_trees_header();
# endif
#endif /* defined(GEN_TREES_H) || !defined(STDC) */
}
@@ -322,56 +322,56 @@ local void tr_static_init()
# endif
# define SEPARATOR(i, last, width) \
- ((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
+ ((i) == (last)? "\n};\n\n" : \
+ ((i) % (width) == (width)-1 ? ",\n" : ", "))
void gen_trees_header()
{
- FILE *header = fopen("trees.h", "w");
- int i;
-
- Assert (header != NULL, "Can't open trees.h");
- fprintf(header,
- "/* header created automatically with -DGEN_TREES_H */\n\n");
-
- fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
- for (i = 0; i < L_CODES+2; i++) {
- fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
- static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
- }
-
- fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
- static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
- }
-
- fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
- for (i = 0; i < DIST_CODE_LEN; i++) {
- fprintf(header, "%2u%s", _dist_code[i],
- SEPARATOR(i, DIST_CODE_LEN-1, 20));
- }
-
- fprintf(header,
- "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
- for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
- fprintf(header, "%2u%s", _length_code[i],
- SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
- }
-
- fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
- for (i = 0; i < LENGTH_CODES; i++) {
- fprintf(header, "%1u%s", base_length[i],
- SEPARATOR(i, LENGTH_CODES-1, 20));
- }
-
- fprintf(header, "local const int base_dist[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "%5u%s", base_dist[i],
- SEPARATOR(i, D_CODES-1, 10));
- }
-
- fclose(header);
+ FILE *header = fopen("trees.h", "w");
+ int i;
+
+ Assert (header != NULL, "Can't open trees.h");
+ fprintf(header,
+ "/* header created automatically with -DGEN_TREES_H */\n\n");
+
+ fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
+ for (i = 0; i < L_CODES+2; i++) {
+ fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
+ static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+ }
+
+ fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
+ for (i = 0; i < D_CODES; i++) {
+ fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
+ static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+ }
+
+ fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
+ for (i = 0; i < DIST_CODE_LEN; i++) {
+ fprintf(header, "%2u%s", _dist_code[i],
+ SEPARATOR(i, DIST_CODE_LEN-1, 20));
+ }
+
+ fprintf(header,
+ "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+ for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+ fprintf(header, "%2u%s", _length_code[i],
+ SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+ }
+
+ fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
+ for (i = 0; i < LENGTH_CODES; i++) {
+ fprintf(header, "%1u%s", base_length[i],
+ SEPARATOR(i, LENGTH_CODES-1, 20));
+ }
+
+ fprintf(header, "local const int base_dist[D_CODES] = {\n");
+ for (i = 0; i < D_CODES; i++) {
+ fprintf(header, "%5u%s", base_dist[i],
+ SEPARATOR(i, D_CODES-1, 10));
+ }
+
+ fclose(header);
}
#endif /* GEN_TREES_H */
@@ -379,46 +379,46 @@ void gen_trees_header()
* Initialize the tree data structures for a new zlib stream.
*/
void ZLIB_INTERNAL _tr_init(s)
- deflate_state *s;
+ deflate_state *s;
{
- tr_static_init();
+ tr_static_init();
- s->l_desc.dyn_tree = s->dyn_ltree;
- s->l_desc.stat_desc = &static_l_desc;
+ s->l_desc.dyn_tree = s->dyn_ltree;
+ s->l_desc.stat_desc = &static_l_desc;
- s->d_desc.dyn_tree = s->dyn_dtree;
- s->d_desc.stat_desc = &static_d_desc;
+ s->d_desc.dyn_tree = s->dyn_dtree;
+ s->d_desc.stat_desc = &static_d_desc;
- s->bl_desc.dyn_tree = s->bl_tree;
- s->bl_desc.stat_desc = &static_bl_desc;
+ s->bl_desc.dyn_tree = s->bl_tree;
+ s->bl_desc.stat_desc = &static_bl_desc;
- s->bi_buf = 0;
- s->bi_valid = 0;
+ s->bi_buf = 0;
+ s->bi_valid = 0;
#ifdef DEBUG
- s->compressed_len = 0L;
- s->bits_sent = 0L;
+ s->compressed_len = 0L;
+ s->bits_sent = 0L;
#endif
- /* Initialize the first block of the first file: */
- init_block(s);
+ /* Initialize the first block of the first file: */
+ init_block(s);
}
/* ===========================================================================
* Initialize a new block.
*/
local void init_block(s)
- deflate_state *s;
+ deflate_state *s;
{
- int n; /* iterates over tree elements */
+ int n; /* iterates over tree elements */
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+ /* Initialize the trees. */
+ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
+ for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
+ for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->last_lit = s->matches = 0;
+ s->dyn_ltree[END_BLOCK].Freq = 1;
+ s->opt_len = s->static_len = 0L;
+ s->last_lit = s->matches = 0;
}
#define SMALLEST 1
@@ -431,9 +431,9 @@ local void init_block(s)
*/
#define pqremove(s, tree, top) \
{\
- top = s->heap[SMALLEST]; \
- s->heap[SMALLEST] = s->heap[s->heap_len--]; \
- pqdownheap(s, tree, SMALLEST); \
+ top = s->heap[SMALLEST]; \
+ s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+ pqdownheap(s, tree, SMALLEST); \
}
/* ===========================================================================
@@ -441,8 +441,8 @@ local void init_block(s)
* the subtrees have equal frequency. This minimizes the worst case length.
*/
#define smaller(tree, n, m, depth) \
- (tree[n].Freq < tree[m].Freq || \
- (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+ (tree[n].Freq < tree[m].Freq || \
+ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
/* ===========================================================================
* Restore the heap property by moving down the tree starting at node k,
@@ -451,28 +451,28 @@ local void init_block(s)
* two sons).
*/
local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
+ deflate_state *s;
+ ct_data *tree; /* the tree to restore */
+ int k; /* node to move down */
{
- int v = s->heap[k];
- int j = k << 1; /* left son of k */
- while (j <= s->heap_len) {
- /* Set j to the smallest of the two sons: */
- if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
- j++;
- }
- /* Exit if v is smaller than both sons */
- if (smaller(tree, v, s->heap[j], s->depth)) break;
-
- /* Exchange v with the smallest son */
- s->heap[k] = s->heap[j]; k = j;
-
- /* And continue down the tree, setting j to the left son of k */
- j <<= 1;
- }
- s->heap[k] = v;
+ int v = s->heap[k];
+ int j = k << 1; /* left son of k */
+ while (j <= s->heap_len) {
+ /* Set j to the smallest of the two sons: */
+ if (j < s->heap_len &&
+ smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+ j++;
+ }
+ /* Exit if v is smaller than both sons */
+ if (smaller(tree, v, s->heap[j], s->depth)) break;
+
+ /* Exchange v with the smallest son */
+ s->heap[k] = s->heap[j]; k = j;
+
+ /* And continue down the tree, setting j to the left son of k */
+ j <<= 1;
+ }
+ s->heap[k] = v;
}
/* ===========================================================================
@@ -486,82 +486,82 @@ local void pqdownheap(s, tree, k)
* not null.
*/
local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
+ deflate_state *s;
+ tree_desc *desc; /* the tree descriptor */
{
- ct_data *tree = desc->dyn_tree;
- int max_code = desc->max_code;
- const ct_data *stree = desc->stat_desc->static_tree;
- const intf *extra = desc->stat_desc->extra_bits;
- int base = desc->stat_desc->extra_base;
- int max_length = desc->stat_desc->max_length;
- int h; /* heap index */
- int n, m; /* iterate over the tree elements */
- int bits; /* bit length */
- int xbits; /* extra bits */
- ush f; /* frequency */
- int overflow = 0; /* number of elements with bit length too large */
-
- for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
-
- /* In a first pass, compute the optimal bit lengths (which may
- * overflow in the case of the bit length tree).
- */
- tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
-
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
- n = s->heap[h];
- bits = tree[tree[n].Dad].Len + 1;
- if (bits > max_length) bits = max_length, overflow++;
- tree[n].Len = (ush)bits;
- /* We overwrite tree[n].Dad which is no longer needed */
-
- if (n > max_code) continue; /* not a leaf node */
-
- s->bl_count[bits]++;
- xbits = 0;
- if (n >= base) xbits = extra[n-base];
- f = tree[n].Freq;
- s->opt_len += (ulg)f * (bits + xbits);
- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
- }
- if (overflow == 0) return;
-
- Trace((stderr,"\nbit length overflow\n"));
- /* This happens for example on obj2 and pic of the Calgary corpus */
-
- /* Find the first bit length which could increase: */
- do {
- bits = max_length-1;
- while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
- s->bl_count[max_length]--;
- /* The brother of the overflow item also moves one step up,
- * but this does not affect bl_count[max_length]
- */
- overflow -= 2;
- } while (overflow > 0);
-
- /* Now recompute all bit lengths, scanning in increasing frequency.
- * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
- * lengths instead of fixing only the wrong ones. This idea is taken
- * from 'ar' written by Haruhiko Okumura.)
- */
- for (bits = max_length; bits != 0; bits--) {
- n = s->bl_count[bits];
- while (n != 0) {
- m = s->heap[--h];
- if (m > max_code) continue;
- if ((unsigned) tree[m].Len != (unsigned) bits) {
- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
- s->opt_len += ((long)bits - (long)tree[m].Len)
- *(long)tree[m].Freq;
- tree[m].Len = (ush)bits;
- }
- n--;
- }
- }
+ ct_data *tree = desc->dyn_tree;
+ int max_code = desc->max_code;
+ const ct_data *stree = desc->stat_desc->static_tree;
+ const intf *extra = desc->stat_desc->extra_bits;
+ int base = desc->stat_desc->extra_base;
+ int max_length = desc->stat_desc->max_length;
+ int h; /* heap index */
+ int n, m; /* iterate over the tree elements */
+ int bits; /* bit length */
+ int xbits; /* extra bits */
+ ush f; /* frequency */
+ int overflow = 0; /* number of elements with bit length too large */
+
+ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+
+ /* In a first pass, compute the optimal bit lengths (which may
+ * overflow in the case of the bit length tree).
+ */
+ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+
+ for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+ n = s->heap[h];
+ bits = tree[tree[n].Dad].Len + 1;
+ if (bits > max_length) bits = max_length, overflow++;
+ tree[n].Len = (ush)bits;
+ /* We overwrite tree[n].Dad which is no longer needed */
+
+ if (n > max_code) continue; /* not a leaf node */
+
+ s->bl_count[bits]++;
+ xbits = 0;
+ if (n >= base) xbits = extra[n-base];
+ f = tree[n].Freq;
+ s->opt_len += (ulg)f * (bits + xbits);
+ if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+ }
+ if (overflow == 0) return;
+
+ Trace((stderr,"\nbit length overflow\n"));
+ /* This happens for example on obj2 and pic of the Calgary corpus */
+
+ /* Find the first bit length which could increase: */
+ do {
+ bits = max_length-1;
+ while (s->bl_count[bits] == 0) bits--;
+ s->bl_count[bits]--; /* move one leaf down the tree */
+ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+ s->bl_count[max_length]--;
+ /* The brother of the overflow item also moves one step up,
+ * but this does not affect bl_count[max_length]
+ */
+ overflow -= 2;
+ } while (overflow > 0);
+
+ /* Now recompute all bit lengths, scanning in increasing frequency.
+ * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+ * lengths instead of fixing only the wrong ones. This idea is taken
+ * from 'ar' written by Haruhiko Okumura.)
+ */
+ for (bits = max_length; bits != 0; bits--) {
+ n = s->bl_count[bits];
+ while (n != 0) {
+ m = s->heap[--h];
+ if (m > max_code) continue;
+ if ((unsigned) tree[m].Len != (unsigned) bits) {
+ Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
+ s->opt_len += ((long)bits - (long)tree[m].Len)
+ *(long)tree[m].Freq;
+ tree[m].Len = (ush)bits;
+ }
+ n--;
+ }
+ }
}
/* ===========================================================================
@@ -573,37 +573,37 @@ local void gen_bitlen(s, desc)
* zero code length.
*/
local void gen_codes (tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
+ ct_data *tree; /* the tree to decorate */
+ int max_code; /* largest code with non zero frequency */
+ ushf *bl_count; /* number of codes at each bit length */
{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- ush code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
- }
+ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+ ush code = 0; /* running code value */
+ int bits; /* bit index */
+ int n; /* code index */
+
+ /* The distribution counts are first used to generate the code values
+ * without bit reversal.
+ */
+ for (bits = 1; bits <= MAX_BITS; bits++) {
+ next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+ }
+ /* Check that the bit counts in bl_count are consistent. The last code
+ * must be all ones.
+ */
+ Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+ "inconsistent bit counts");
+ Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+
+ for (n = 0; n <= max_code; n++) {
+ int len = tree[n].Len;
+ if (len == 0) continue;
+ /* Now reverse the bits */
+ tree[n].Code = bi_reverse(next_code[len]++, len);
+
+ Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+ }
}
/* ===========================================================================
@@ -615,87 +615,87 @@ local void gen_codes (tree, max_code, bl_count)
* also updated if stree is not null. The field max_code is set.
*/
local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
+ deflate_state *s;
+ tree_desc *desc; /* the tree descriptor */
{
- ct_data *tree = desc->dyn_tree;
- const ct_data *stree = desc->stat_desc->static_tree;
- int elems = desc->stat_desc->elems;
- int n, m; /* iterate over heap elements */
- int max_code = -1; /* largest code with non zero frequency */
- int node; /* new node being created */
-
- /* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
- * heap[0] is not used.
- */
- s->heap_len = 0, s->heap_max = HEAP_SIZE;
-
- for (n = 0; n < elems; n++) {
- if (tree[n].Freq != 0) {
- s->heap[++(s->heap_len)] = max_code = n;
- s->depth[n] = 0;
- } else {
- tree[n].Len = 0;
- }
- }
-
- /* The pkzip format requires that at least one distance code exists,
- * and that at least one bit should be sent even if there is only one
- * possible code. So to avoid special checks later on we force at least
- * two codes of non zero frequency.
- */
- while (s->heap_len < 2) {
- node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
- tree[node].Freq = 1;
- s->depth[node] = 0;
- s->opt_len--; if (stree) s->static_len -= stree[node].Len;
- /* node is 0 or 1 so it does not have extra bits */
- }
- desc->max_code = max_code;
-
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
- * establish sub-heaps of increasing lengths:
- */
- for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
-
- /* Construct the Huffman tree by repeatedly combining the least two
- * frequent nodes.
- */
- node = elems; /* next internal node of the tree */
- do {
- pqremove(s, tree, n); /* n = node of least frequency */
- m = s->heap[SMALLEST]; /* m = node of next least frequency */
-
- s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
- s->heap[--(s->heap_max)] = m;
-
- /* Create a new node father of n and m */
- tree[node].Freq = tree[n].Freq + tree[m].Freq;
- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
- s->depth[n] : s->depth[m]) + 1);
- tree[n].Dad = tree[m].Dad = (ush)node;
+ ct_data *tree = desc->dyn_tree;
+ const ct_data *stree = desc->stat_desc->static_tree;
+ int elems = desc->stat_desc->elems;
+ int n, m; /* iterate over heap elements */
+ int max_code = -1; /* largest code with non zero frequency */
+ int node; /* new node being created */
+
+ /* Construct the initial heap, with least frequent element in
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+ * heap[0] is not used.
+ */
+ s->heap_len = 0, s->heap_max = HEAP_SIZE;
+
+ for (n = 0; n < elems; n++) {
+ if (tree[n].Freq != 0) {
+ s->heap[++(s->heap_len)] = max_code = n;
+ s->depth[n] = 0;
+ } else {
+ tree[n].Len = 0;
+ }
+ }
+
+ /* The pkzip format requires that at least one distance code exists,
+ * and that at least one bit should be sent even if there is only one
+ * possible code. So to avoid special checks later on we force at least
+ * two codes of non zero frequency.
+ */
+ while (s->heap_len < 2) {
+ node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+ tree[node].Freq = 1;
+ s->depth[node] = 0;
+ s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+ /* node is 0 or 1 so it does not have extra bits */
+ }
+ desc->max_code = max_code;
+
+ /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+ * establish sub-heaps of increasing lengths:
+ */
+ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+
+ /* Construct the Huffman tree by repeatedly combining the least two
+ * frequent nodes.
+ */
+ node = elems; /* next internal node of the tree */
+ do {
+ pqremove(s, tree, n); /* n = node of least frequency */
+ m = s->heap[SMALLEST]; /* m = node of next least frequency */
+
+ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+ s->heap[--(s->heap_max)] = m;
+
+ /* Create a new node father of n and m */
+ tree[node].Freq = tree[n].Freq + tree[m].Freq;
+ s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
+ s->depth[n] : s->depth[m]) + 1);
+ tree[n].Dad = tree[m].Dad = (ush)node;
#ifdef DUMP_BL_TREE
- if (tree == s->bl_tree) {
- fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
- node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
- }
+ if (tree == s->bl_tree) {
+ fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
+ node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+ }
#endif
- /* and insert the new node in the heap */
- s->heap[SMALLEST] = node++;
- pqdownheap(s, tree, SMALLEST);
+ /* and insert the new node in the heap */
+ s->heap[SMALLEST] = node++;
+ pqdownheap(s, tree, SMALLEST);
- } while (s->heap_len >= 2);
+ } while (s->heap_len >= 2);
- s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+ s->heap[--(s->heap_max)] = s->heap[SMALLEST];
- /* At this point, the fields freq and dad are set. We can now
- * generate the bit lengths.
- */
- gen_bitlen(s, (tree_desc *)desc);
+ /* At this point, the fields freq and dad are set. We can now
+ * generate the bit lengths.
+ */
+ gen_bitlen(s, (tree_desc *)desc);
- /* The field len is now set, we can generate the bit codes */
- gen_codes ((ct_data *)tree, max_code, s->bl_count);
+ /* The field len is now set, we can generate the bit codes */
+ gen_codes ((ct_data *)tree, max_code, s->bl_count);
}
/* ===========================================================================
@@ -703,44 +703,44 @@ local void build_tree(s, desc)
* in the bit length tree.
*/
local void scan_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
+ deflate_state *s;
+ ct_data *tree; /* the tree to be scanned */
+ int max_code; /* and its largest code of non zero frequency */
{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- s->bl_tree[curlen].Freq += count;
- } else if (curlen != 0) {
- if (curlen != prevlen) s->bl_tree[curlen].Freq++;
- s->bl_tree[REP_3_6].Freq++;
- } else if (count <= 10) {
- s->bl_tree[REPZ_3_10].Freq++;
- } else {
- s->bl_tree[REPZ_11_138].Freq++;
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ if (nextlen == 0) max_count = 138, min_count = 3;
+ tree[max_code+1].Len = (ush)0xffff; /* guard */
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen; nextlen = tree[n+1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ s->bl_tree[curlen].Freq += count;
+ } else if (curlen != 0) {
+ if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+ s->bl_tree[REP_3_6].Freq++;
+ } else if (count <= 10) {
+ s->bl_tree[REPZ_3_10].Freq++;
+ } else {
+ s->bl_tree[REPZ_11_138].Freq++;
+ }
+ count = 0; prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138, min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6, min_count = 3;
+ } else {
+ max_count = 7, min_count = 4;
+ }
+ }
}
/* ===========================================================================
@@ -748,50 +748,50 @@ local void scan_tree (s, tree, max_code)
* bl_tree.
*/
local void send_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
+ deflate_state *s;
+ ct_data *tree; /* the tree to be scanned */
+ int max_code; /* and its largest code of non zero frequency */
{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- /* tree[max_code+1].Len = -1; */ /* guard already set */
- if (nextlen == 0) max_count = 138, min_count = 3;
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
-
- } else if (curlen != 0) {
- if (curlen != prevlen) {
- send_code(s, curlen, s->bl_tree); count--;
- }
- Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
-
- } else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
-
- } else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ /* tree[max_code+1].Len = -1; */ /* guard already set */
+ if (nextlen == 0) max_count = 138, min_count = 3;
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen; nextlen = tree[n+1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+
+ } else if (curlen != 0) {
+ if (curlen != prevlen) {
+ send_code(s, curlen, s->bl_tree); count--;
+ }
+ Assert(count >= 3 && count <= 6, " 3_6?");
+ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+
+ } else if (count <= 10) {
+ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+
+ } else {
+ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+ }
+ count = 0; prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138, min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6, min_count = 3;
+ } else {
+ max_count = 7, min_count = 4;
+ }
+ }
}
/* ===========================================================================
@@ -799,33 +799,33 @@ local void send_tree (s, tree, max_code)
* bl_order of the last bit length code to send.
*/
local int build_bl_tree(s)
- deflate_state *s;
+ deflate_state *s;
{
- int max_blindex; /* index of last bit length code of non zero freq */
-
- /* Determine the bit length frequencies for literal and distance trees */
- scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
- scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
-
- /* Build the bit length tree: */
- build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
- */
-
- /* Determine the number of bit length codes to send. The pkzip format
- * requires that at least 4 bit length codes be sent. (appnote.txt says
- * 3 but the actual value used is 4.)
- */
- for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
- if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
- }
- /* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*(max_blindex+1) + 5+5+4;
- Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
- s->opt_len, s->static_len));
-
- return max_blindex;
+ int max_blindex; /* index of last bit length code of non zero freq */
+
+ /* Determine the bit length frequencies for literal and distance trees */
+ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+ scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+
+ /* Build the bit length tree: */
+ build_tree(s, (tree_desc *)(&(s->bl_desc)));
+ /* opt_len now includes the length of the tree representations, except
+ * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+ */
+
+ /* Determine the number of bit length codes to send. The pkzip format
+ * requires that at least 4 bit length codes be sent. (appnote.txt says
+ * 3 but the actual value used is 4.)
+ */
+ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+ if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+ }
+ /* Update opt_len to include the bit length tree and counts */
+ s->opt_len += 3*(max_blindex+1) + 5+5+4;
+ Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
+ s->opt_len, s->static_len));
+
+ return max_blindex;
}
/* ===========================================================================
@@ -834,55 +834,55 @@ local int build_bl_tree(s)
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
+ deflate_state *s;
+ int lcodes, dcodes, blcodes; /* number of codes for each tree */
{
- int rank; /* index in bl_order */
-
- Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
- Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
- "too many codes");
- Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
- for (rank = 0; rank < blcodes; rank++) {
- Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
- send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
- }
- Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
- Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
- Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
+ int rank; /* index in bl_order */
+
+ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
+ Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+ "too many codes");
+ Tracev((stderr, "\nbl counts: "));
+ send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+ send_bits(s, dcodes-1, 5);
+ send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
+ for (rank = 0; rank < blcodes; rank++) {
+ Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
+ send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+ }
+ Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
+
+ send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
+
+ send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
}
/* ===========================================================================
* Send a stored block
*/
void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
+ deflate_state *s;
+ charf *buf; /* input block */
+ ulg stored_len; /* length of input block */
+ int last; /* one if this is the last block for a file */
{
- send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
+ send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
#ifdef DEBUG
- s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
- s->compressed_len += (stored_len + 4) << 3;
+ s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+ s->compressed_len += (stored_len + 4) << 3;
#endif
- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+ copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
}
/* ===========================================================================
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/
void ZLIB_INTERNAL _tr_flush_bits(s)
- deflate_state *s;
+ deflate_state *s;
{
- bi_flush(s);
+ bi_flush(s);
}
/* ===========================================================================
@@ -890,14 +890,14 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
* This takes 10 bits, of which 7 may remain in the bit buffer.
*/
void ZLIB_INTERNAL _tr_align(s)
- deflate_state *s;
+ deflate_state *s;
{
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
+ send_bits(s, STATIC_TREES<<1, 3);
+ send_code(s, END_BLOCK, static_ltree);
#ifdef DEBUG
- s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+ s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
#endif
- bi_flush(s);
+ bi_flush(s);
}
/* ===========================================================================
@@ -905,102 +905,101 @@ void ZLIB_INTERNAL _tr_align(s)
* trees or store, and output the encoded block to the zip file.
*/
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
+ deflate_state *s;
+ charf *buf; /* input block, or NULL if too old */
+ ulg stored_len; /* length of input block */
+ int last; /* one if this is the last block for a file */
{
- ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
- int max_blindex = 0; /* index of last bit length code of non zero freq */
-
- /* Build the Huffman trees unless a stored block is forced */
- if (s->level > 0) {
-
- /* Check if the file is binary or text */
- if (s->strm->data_type == Z_UNKNOWN)
- s->strm->data_type = detect_data_type(s);
-
- /* Construct the literal and distance trees */
- build_tree(s, (tree_desc *)(&(s->l_desc)));
- Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
-
- build_tree(s, (tree_desc *)(&(s->d_desc)));
- Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
- /* At this point, opt_len and static_len are the total bit lengths of
- * the compressed block data, excluding the tree representations.
- */
-
- /* Build the bit length tree for the above two trees, and get the index
- * in bl_order of the last bit length code to send.
- */
- max_blindex = build_bl_tree(s);
-
- /* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
-
- Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
- opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
- s->last_lit));
-
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
-
- } else {
- Assert(buf != (char*)0, "lost buf");
- opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
- }
+ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+ int max_blindex = 0; /* index of last bit length code of non zero freq */
+
+ /* Build the Huffman trees unless a stored block is forced */
+ if (s->level > 0) {
+ /* Check if the file is binary or text */
+ if (s->strm->data_type == Z_UNKNOWN)
+ s->strm->data_type = detect_data_type(s);
+
+ /* Construct the literal and distance trees */
+ build_tree(s, (tree_desc *)(&(s->l_desc)));
+ Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
+ s->static_len));
+
+ build_tree(s, (tree_desc *)(&(s->d_desc)));
+ Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
+ s->static_len));
+ /* At this point, opt_len and static_len are the total bit lengths of
+ * the compressed block data, excluding the tree representations.
+ */
+
+ /* Build the bit length tree for the above two trees, and get the index
+ * in bl_order of the last bit length code to send.
+ */
+ max_blindex = build_bl_tree(s);
+
+ /* Determine the best encoding. Compute the block lengths in bytes. */
+ opt_lenb = (s->opt_len+3+7)>>3;
+ static_lenb = (s->static_len+3+7)>>3;
+
+ Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+ opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+ s->last_lit));
+
+ if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+
+ } else {
+ Assert(buf != (char*)0, "lost buf");
+ opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+ }
#ifdef FORCE_STORED
- if (buf != (char*)0) { /* force stored block */
+ if (buf != (char*)0) { /* force stored block */
#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
- /* 4: two words for the lengths */
+ if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+ /* 4: two words for the lengths */
#endif
- /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
- * Otherwise we can't have processed more than WSIZE input bytes since
- * the last block flush, because compression would have been
- * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
- * transform a block into a stored block.
- */
- _tr_stored_block(s, buf, stored_len, last);
+ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+ * Otherwise we can't have processed more than WSIZE input bytes since
+ * the last block flush, because compression would have been
+ * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+ * transform a block into a stored block.
+ */
+ _tr_stored_block(s, buf, stored_len, last);
#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
+ } else if (static_lenb >= 0) { /* force static trees */
#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
+ } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
#endif
- send_bits(s, (STATIC_TREES<<1)+last, 3);
- compress_block(s, (const ct_data *)static_ltree,
- (const ct_data *)static_dtree);
+ send_bits(s, (STATIC_TREES<<1)+last, 3);
+ compress_block(s, (const ct_data *)static_ltree,
+ (const ct_data *)static_dtree);
#ifdef DEBUG
- s->compressed_len += 3 + s->static_len;
+ s->compressed_len += 3 + s->static_len;
#endif
- } else {
- send_bits(s, (DYN_TREES<<1)+last, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
- compress_block(s, (const ct_data *)s->dyn_ltree,
- (const ct_data *)s->dyn_dtree);
+ } else {
+ send_bits(s, (DYN_TREES<<1)+last, 3);
+ send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+ max_blindex+1);
+ compress_block(s, (const ct_data *)s->dyn_ltree,
+ (const ct_data *)s->dyn_dtree);
#ifdef DEBUG
- s->compressed_len += 3 + s->opt_len;
+ s->compressed_len += 3 + s->opt_len;
#endif
- }
- Assert (s->compressed_len == s->bits_sent, "bad compressed size");
- /* The above check is made mod 2^32, for files larger than 512 MB
- * and uLong implemented on 32 bits.
- */
- init_block(s);
-
- if (last) {
- bi_windup(s);
+ }
+ Assert (s->compressed_len == s->bits_sent, "bad compressed size");
+ /* The above check is made mod 2^32, for files larger than 512 MB
+ * and uLong implemented on 32 bits.
+ */
+ init_block(s);
+
+ if (last) {
+ bi_windup(s);
#ifdef DEBUG
- s->compressed_len += 7; /* align on byte boundary */
+ s->compressed_len += 7; /* align on byte boundary */
#endif
- }
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*last));
+ }
+ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+ s->compressed_len-7*last));
}
/* ===========================================================================
@@ -1008,100 +1007,100 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
* the current block must be flushed.
*/
int ZLIB_INTERNAL _tr_tally (s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
+ deflate_state *s;
+ unsigned dist; /* distance of matched string */
+ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
{
- s->d_buf[s->last_lit] = (ush)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
- if (dist == 0) {
- /* lc is the unmatched char */
- s->dyn_ltree[lc].Freq++;
- } else {
- s->matches++;
- /* Here, lc is the match length - MIN_MATCH */
- dist--; /* dist = match distance - 1 */
- Assert((ush)dist < (ush)MAX_DIST(s) &&
- (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
- (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
-
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
- s->dyn_dtree[d_code(dist)].Freq++;
- }
+ s->d_buf[s->last_lit] = (ush)dist;
+ s->l_buf[s->last_lit++] = (uch)lc;
+ if (dist == 0) {
+ /* lc is the unmatched char */
+ s->dyn_ltree[lc].Freq++;
+ } else {
+ s->matches++;
+ /* Here, lc is the match length - MIN_MATCH */
+ dist--; /* dist = match distance - 1 */
+ Assert((ush)dist < (ush)MAX_DIST(s) &&
+ (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+ (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
+
+ s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+ s->dyn_dtree[d_code(dist)].Freq++;
+ }
#ifdef TRUNCATE_BLOCK
- /* Try to guess if it is profitable to stop the current block here */
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
- /* Compute an upper bound for the compressed length */
- ulg out_length = (ulg)s->last_lit*8L;
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
- int dcode;
- for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
- (5L+extra_dbits[dcode]);
- }
- out_length >>= 3;
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
- s->last_lit, in_length, out_length,
- 100L - out_length*100L/in_length));
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
- }
+ /* Try to guess if it is profitable to stop the current block here */
+ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+ /* Compute an upper bound for the compressed length */
+ ulg out_length = (ulg)s->last_lit*8L;
+ ulg in_length = (ulg)((long)s->strstart - s->block_start);
+ int dcode;
+ for (dcode = 0; dcode < D_CODES; dcode++) {
+ out_length += (ulg)s->dyn_dtree[dcode].Freq *
+ (5L+extra_dbits[dcode]);
+ }
+ out_length >>= 3;
+ Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+ s->last_lit, in_length, out_length,
+ 100L - out_length*100L/in_length));
+ if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+ }
#endif
- return (s->last_lit == s->lit_bufsize-1);
- /* We avoid equality with lit_bufsize because of wraparound at 64K
- * on 16 bit machines and because stored blocks are restricted to
- * 64K-1 bytes.
- */
+ return (s->last_lit == s->lit_bufsize-1);
+ /* We avoid equality with lit_bufsize because of wraparound at 64K
+ * on 16 bit machines and because stored blocks are restricted to
+ * 64K-1 bytes.
+ */
}
/* ===========================================================================
* Send the block data compressed using the given Huffman trees
*/
local void compress_block(s, ltree, dtree)
- deflate_state *s;
- const ct_data *ltree; /* literal tree */
- const ct_data *dtree; /* distance tree */
+ deflate_state *s;
+ const ct_data *ltree; /* literal tree */
+ const ct_data *dtree; /* distance tree */
{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned lx = 0; /* running index in l_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->last_lit != 0) do {
- dist = s->d_buf[lx];
- lc = s->l_buf[lx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
- "pendingBuf overflow");
-
- } while (lx < s->last_lit);
-
- send_code(s, END_BLOCK, ltree);
+ unsigned dist; /* distance of matched string */
+ int lc; /* match length or unmatched char (if dist == 0) */
+ unsigned lx = 0; /* running index in l_buf */
+ unsigned code; /* the code to send */
+ int extra; /* number of extra bits to send */
+
+ if (s->last_lit != 0) do {
+ dist = s->d_buf[lx];
+ lc = s->l_buf[lx++];
+ if (dist == 0) {
+ send_code(s, lc, ltree); /* send a literal byte */
+ Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ code = _length_code[lc];
+ send_code(s, code+LITERALS+1, ltree); /* send the length code */
+ extra = extra_lbits[code];
+ if (extra != 0) {
+ lc -= base_length[code];
+ send_bits(s, lc, extra); /* send the extra length bits */
+ }
+ dist--; /* dist is now the match distance - 1 */
+ code = d_code(dist);
+ Assert (code < D_CODES, "bad d_code");
+
+ send_code(s, code, dtree); /* send the distance code */
+ extra = extra_dbits[code];
+ if (extra != 0) {
+ dist -= base_dist[code];
+ send_bits(s, dist, extra); /* send the extra distance bits */
+ }
+ } /* literal or match pair ? */
+
+ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+ Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
+ "pendingBuf overflow");
+
+ } while (lx < s->last_lit);
+
+ send_code(s, END_BLOCK, ltree);
}
/* ===========================================================================
@@ -1118,32 +1117,32 @@ local void compress_block(s, ltree, dtree)
* IN assertion: the fields Freq of dyn_ltree are set.
*/
local int detect_data_type(s)
- deflate_state *s;
+ deflate_state *s;
{
- /* black_mask is the bit mask of black-listed bytes
- * set bits 0..6, 14..25, and 28..31
- * 0xf3ffc07f = binary 11110011111111111100000001111111
- */
- unsigned long black_mask = 0xf3ffc07fUL;
- int n;
-
- /* Check for non-textual ("black-listed") bytes. */
- for (n = 0; n <= 31; n++, black_mask >>= 1)
- if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
- return Z_BINARY;
-
- /* Check for textual ("white-listed") bytes. */
- if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
- || s->dyn_ltree[13].Freq != 0)
- return Z_TEXT;
- for (n = 32; n < LITERALS; n++)
- if (s->dyn_ltree[n].Freq != 0)
- return Z_TEXT;
-
- /* There are no "black-listed" or "white-listed" bytes:
- * this stream either is empty or has tolerated ("gray-listed") bytes only.
- */
- return Z_BINARY;
+ /* black_mask is the bit mask of black-listed bytes
+ * set bits 0..6, 14..25, and 28..31
+ * 0xf3ffc07f = binary 11110011111111111100000001111111
+ */
+ unsigned long black_mask = 0xf3ffc07fUL;
+ int n;
+
+ /* Check for non-textual ("black-listed") bytes. */
+ for (n = 0; n <= 31; n++, black_mask >>= 1)
+ if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
+ return Z_BINARY;
+
+ /* Check for textual ("white-listed") bytes. */
+ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
+ || s->dyn_ltree[13].Freq != 0)
+ return Z_TEXT;
+ for (n = 32; n < LITERALS; n++)
+ if (s->dyn_ltree[n].Freq != 0)
+ return Z_TEXT;
+
+ /* There are no "black-listed" or "white-listed" bytes:
+ * this stream either is empty or has tolerated ("gray-listed") bytes only.
+ */
+ return Z_BINARY;
}
/* ===========================================================================
@@ -1152,49 +1151,49 @@ local int detect_data_type(s)
* IN assertion: 1 <= len <= 15
*/
local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
+ unsigned code; /* the value to invert */
+ int len; /* its bit length */
{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
+ register unsigned res = 0;
+ do {
+ res |= code & 1;
+ code >>= 1, res <<= 1;
+ } while (--len > 0);
+ return res >> 1;
}
/* ===========================================================================
* Flush the bit buffer, keeping at most 7 bits in it.
*/
local void bi_flush(s)
- deflate_state *s;
+ deflate_state *s;
{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
+ if (s->bi_valid == 16) {
+ put_short(s, s->bi_buf);
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ } else if (s->bi_valid >= 8) {
+ put_byte(s, (Byte)s->bi_buf);
+ s->bi_buf >>= 8;
+ s->bi_valid -= 8;
+ }
}
/* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary
*/
local void bi_windup(s)
- deflate_state *s;
+ deflate_state *s;
{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
+ if (s->bi_valid > 8) {
+ put_short(s, s->bi_buf);
+ } else if (s->bi_valid > 0) {
+ put_byte(s, (Byte)s->bi_buf);
+ }
+ s->bi_buf = 0;
+ s->bi_valid = 0;
#ifdef DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
+ s->bits_sent = (s->bits_sent+7) & ~7;
#endif
}
@@ -1203,24 +1202,24 @@ local void bi_windup(s)
* one's complement if requested.
*/
local void copy_block(s, buf, len, header)
- deflate_state *s;
- charf *buf; /* the input data */
- unsigned len; /* its length */
- int header; /* true if block header must be written */
+ deflate_state *s;
+ charf *buf; /* the input data */
+ unsigned len; /* its length */
+ int header; /* true if block header must be written */
{
- bi_windup(s); /* align on byte boundary */
+ bi_windup(s); /* align on byte boundary */
- if (header) {
- put_short(s, (ush)len);
- put_short(s, (ush)~len);
+ if (header) {
+ put_short(s, (ush)len);
+ put_short(s, (ush)~len);
#ifdef DEBUG
- s->bits_sent += 2*16;
+ s->bits_sent += 2*16;
#endif
- }
+ }
#ifdef DEBUG
- s->bits_sent += (ulg)len<<3;
+ s->bits_sent += (ulg)len<<3;
#endif
- while (len--) {
- put_byte(s, *buf++);
- }
+ while (len--) {
+ put_byte(s, *buf++);
+ }
}
diff --git a/src/lib/zlib/trees.h b/src/lib/zlib/trees.h
index d35639d82a2..70e9baf4f8b 100644
--- a/src/lib/zlib/trees.h
+++ b/src/lib/zlib/trees.h
@@ -71,8 +71,8 @@ local const ct_data static_dtree[D_CODES] = {
};
const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
+ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
@@ -100,7 +100,7 @@ const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
};
const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
@@ -121,8 +121,7 @@ local const int base_length[LENGTH_CODES] = {
};
local const int base_dist[D_CODES] = {
- 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
- 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
- 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
+ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
+ 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
+ 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
};
-
diff --git a/src/lib/zlib/uncompr.c b/src/lib/zlib/uncompr.c
index 242e9493dff..6aa445ee978 100644
--- a/src/lib/zlib/uncompr.c
+++ b/src/lib/zlib/uncompr.c
@@ -22,38 +22,38 @@
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
int ZEXPORT uncompress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
{
- z_stream stream;
- int err;
-
- stream.next_in = (z_const Bytef *)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
+ z_stream stream;
+ int err;
+
+ stream.next_in = (z_const Bytef *)source;
+ stream.avail_in = (uInt)sourceLen;
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+
+ err = inflateInit(&stream);
+ if (err != Z_OK) return err;
+
+ err = inflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
+ return Z_DATA_ERROR;
+ return err;
+ }
+ *destLen = stream.total_out;
+
+ err = inflateEnd(&stream);
+ return err;
}
diff --git a/src/lib/zlib/zconf.h b/src/lib/zlib/zconf.h
index 9987a775530..c9cf0c15618 100644
--- a/src/lib/zlib/zconf.h
+++ b/src/lib/zlib/zconf.h
@@ -260,7 +260,7 @@
for small objects.
*/
- /* Type declarations */
+ /* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
@@ -286,7 +286,7 @@
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
+ /* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
@@ -295,7 +295,7 @@
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
+ /* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
@@ -306,9 +306,9 @@
#endif
#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
+ /* If building or using zlib as a DLL, define ZLIB_DLL.
+ * This is not mandatory, but it offers a little performance increase.
+ */
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
@@ -318,17 +318,17 @@
# endif
# endif
# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
+ /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+ * define ZLIB_WINAPI.
+ * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+ */
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+ /* No need for _export, use ZLIB.DEF instead. */
+ /* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
@@ -371,10 +371,10 @@ typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
- typedef Byte FAR Bytef;
+ typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
@@ -382,13 +382,13 @@ typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
+ typedef void const *voidpc;
+ typedef void FAR *voidpf;
+ typedef void *voidp;
#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
+ typedef Byte const *voidpc;
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
@@ -403,9 +403,9 @@ typedef uLong FAR uLongf;
#endif
#ifdef Z_U4
- typedef Z_U4 z_crc_t;
+ typedef Z_U4 z_crc_t;
#else
- typedef unsigned long z_crc_t;
+ typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
@@ -493,19 +493,19 @@ typedef uLong FAR uLongf;
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
- #pragma map(deflateInit_,"DEIN")
- #pragma map(deflateInit2_,"DEIN2")
- #pragma map(deflateEnd,"DEEND")
- #pragma map(deflateBound,"DEBND")
- #pragma map(inflateInit_,"ININ")
- #pragma map(inflateInit2_,"ININ2")
- #pragma map(inflateEnd,"INEND")
- #pragma map(inflateSync,"INSY")
- #pragma map(inflateSetDictionary,"INSEDI")
- #pragma map(compressBound,"CMBND")
- #pragma map(inflate_table,"INTABL")
- #pragma map(inflate_fast,"INFA")
- #pragma map(inflate_copyright,"INCOPY")
+ #pragma map(deflateInit_,"DEIN")
+ #pragma map(deflateInit2_,"DEIN2")
+ #pragma map(deflateEnd,"DEEND")
+ #pragma map(deflateBound,"DEBND")
+ #pragma map(inflateInit_,"ININ")
+ #pragma map(inflateInit2_,"ININ2")
+ #pragma map(inflateEnd,"INEND")
+ #pragma map(inflateSync,"INSY")
+ #pragma map(inflateSetDictionary,"INSEDI")
+ #pragma map(compressBound,"CMBND")
+ #pragma map(inflate_table,"INTABL")
+ #pragma map(inflate_fast,"INFA")
+ #pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */
diff --git a/src/lib/zlib/zlib.h b/src/lib/zlib/zlib.h
index 3e0c7672ac5..e3d32d4f92d 100644
--- a/src/lib/zlib/zlib.h
+++ b/src/lib/zlib/zlib.h
@@ -83,24 +83,24 @@ typedef void (*free_func) OF((voidpf opaque, voidpf address));
struct internal_state;
typedef struct z_stream_s {
- z_const Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total number of input bytes read so far */
+ z_const Bytef *next_in; /* next input byte */
+ uInt avail_in; /* number of bytes available at next_in */
+ uLong total_in; /* total number of input bytes read so far */
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total number of bytes output so far */
+ Bytef *next_out; /* next output byte should be put there */
+ uInt avail_out; /* remaining free space at next_out */
+ uLong total_out; /* total number of bytes output so far */
- z_const char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
+ z_const char *msg; /* last error message, NULL if no error */
+ struct internal_state FAR *state; /* not visible by applications */
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
+ alloc_func zalloc; /* used to allocate the internal state */
+ free_func zfree; /* used to free the internal state */
+ voidpf opaque; /* private data object passed to zalloc and zfree */
- int data_type; /* best guess about the data type: binary or text */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
+ int data_type; /* best guess about the data type: binary or text */
+ uLong adler; /* adler32 value of the uncompressed data */
+ uLong reserved; /* reserved for future use */
} z_stream;
typedef z_stream FAR *z_streamp;
@@ -110,19 +110,19 @@ typedef z_stream FAR *z_streamp;
for more details on the meanings of these fields.
*/
typedef struct gz_header_s {
- int text; /* true if compressed data believed to be text */
- uLong time; /* modification time */
- int xflags; /* extra flags (not used when writing a gzip file) */
- int os; /* operating system */
- Bytef *extra; /* pointer to extra field or Z_NULL if none */
- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
- uInt extra_max; /* space at extra (only when reading header) */
- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
- uInt name_max; /* space at name (only when reading header) */
- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
- uInt comm_max; /* space at comment (only when reading header) */
- int hcrc; /* true if there was or will be a header crc */
- int done; /* true when done reading gzip header (not used
+ int text; /* true if compressed data believed to be text */
+ uLong time; /* modification time */
+ int xflags; /* extra flags (not used when writing a gzip file) */
+ int os; /* operating system */
+ Bytef *extra; /* pointer to extra field or Z_NULL if none */
+ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
+ uInt extra_max; /* space at extra (only when reading header) */
+ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
+ uInt name_max; /* space at name (only when reading header) */
+ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
+ uInt comm_max; /* space at comment (only when reading header) */
+ int hcrc; /* true if there was or will be a header crc */
+ int done; /* true when done reading gzip header (not used
when writing a gzip file) */
} gz_header;
@@ -159,7 +159,7 @@ typedef gz_header FAR *gz_headerp;
if the decompressor wants to decompress everything in a single step).
*/
- /* constants */
+ /* constants */
#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1
@@ -211,7 +211,7 @@ typedef gz_header FAR *gz_headerp;
/* for compatibility with versions < 1.0.2 */
- /* basic functions */
+ /* basic functions */
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
@@ -517,7 +517,7 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
*/
- /* Advanced functions */
+ /* Advanced functions */
/*
The following functions are needed only in some special applications.
@@ -585,8 +585,8 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
+ const Bytef *dictionary,
+ uInt dictLength));
/*
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. When using the zlib format, this
@@ -629,7 +629,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
+ z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
@@ -658,8 +658,8 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
*/
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
+ int level,
+ int strategy));
/*
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2. This can be
@@ -679,10 +679,10 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
+ int good_length,
+ int max_lazy,
+ int nice_length,
+ int max_chain));
/*
Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for
@@ -696,7 +696,7 @@ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
*/
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
+ uLong sourceLen));
/*
deflateBound() returns an upper bound on the compressed size after
deflation of sourceLen bytes. It must be called after deflateInit() or
@@ -711,8 +711,8 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
- unsigned *pending,
- int *bits));
+ unsigned *pending,
+ int *bits));
/*
deflatePending() returns the number of bytes and bits of output that have
been generated, but not yet provided in the available output. The bytes not
@@ -726,8 +726,8 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
+ int bits,
+ int value));
/*
deflatePrime() inserts bits in the deflate output stream. The intent
is that this function is used to start off the deflate output with the bits
@@ -743,7 +743,7 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
+ gz_headerp head));
/*
deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called
@@ -817,8 +817,8 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
+ const Bytef *dictionary,
+ uInt dictLength));
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate,
@@ -840,8 +840,8 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
- Bytef *dictionary,
- uInt *dictLength));
+ Bytef *dictionary,
+ uInt *dictLength));
/*
Returns the sliding dictionary being maintained by inflate. dictLength is
set to the number of bytes in the dictionary, and that many bytes are copied
@@ -874,7 +874,7 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
*/
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
+ z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
@@ -900,7 +900,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
*/
ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
- int windowBits));
+ int windowBits));
/*
This function is the same as inflateReset, but it also permits changing
the wrap and window size requests. The windowBits parameter is interpreted
@@ -912,8 +912,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
*/
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
+ int bits,
+ int value));
/*
This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the
@@ -961,7 +961,7 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
*/
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
+ gz_headerp head));
/*
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
@@ -1023,12 +1023,12 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
*/
typedef unsigned (*in_func) OF((void FAR *,
- z_const unsigned char FAR * FAR *));
+ z_const unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
+ in_func in, void FAR *in_desc,
+ out_func out, void FAR *out_desc));
/*
inflateBack() does a raw inflate with a single call using a call-back
interface for input and output. This is potentially more efficient than
@@ -1147,7 +1147,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
#ifndef Z_SOLO
- /* utility functions */
+ /* utility functions */
/*
The following utility functions are implemented on top of the basic
@@ -1158,7 +1158,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
*/
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
+ const Bytef *source, uLong sourceLen));
/*
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
@@ -1172,8 +1172,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
*/
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
+ const Bytef *source, uLong sourceLen,
+ int level));
/*
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
@@ -1195,7 +1195,7 @@ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
*/
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
+ const Bytef *source, uLong sourceLen));
/*
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
@@ -1212,7 +1212,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
buffer with the uncompressed data up to that point.
*/
- /* gzip file access functions */
+ /* gzip file access functions */
/*
This library supports reading and writing files in gzip (.gz) format with
@@ -1339,7 +1339,7 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
*/
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
+ voidpc buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of uncompressed bytes written or 0 in case of
@@ -1558,7 +1558,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
#endif /* !Z_SOLO */
- /* checksum functions */
+ /* checksum functions */
/*
These functions are not related to compression but are exported
@@ -1625,38 +1625,38 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
*/
- /* various hacks, don't look :) */
+ /* various hacks, don't look :) */
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
+ const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
+ const char *version, int stream_size));
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
+ const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
+ unsigned char FAR *window,
+ const char *version,
+ int stream_size));
#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
- (int)sizeof(z_stream))
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
+ (int)sizeof(z_stream))
#define inflateBackInit(strm, windowBits, window) \
- inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, (int)sizeof(z_stream))
+ inflateBackInit_((strm), (windowBits), (window), \
+ ZLIB_VERSION, (int)sizeof(z_stream))
#ifndef Z_SOLO
@@ -1668,18 +1668,18 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
* only be used by the gzgetc() macro. You have been warned.
*/
struct gzFile_s {
- unsigned have;
- unsigned char *next;
- z_off64_t pos;
+ unsigned have;
+ unsigned char *next;
+ z_off64_t pos;
};
ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
#ifdef Z_PREFIX_SET
# undef z_gzgetc
# define z_gzgetc(g) \
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
#else
# define gzgetc(g) \
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
#endif
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
@@ -1689,12 +1689,12 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
* without large file support, _LFS64_LARGEFILE must also be true
*/
#ifdef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
+ ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
+ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
#endif
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
@@ -1714,32 +1714,32 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
# define crc32_combine crc32_combine64
# endif
# ifndef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
+ ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
+ ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
# endif
#else
- ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+ ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
+ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
+ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
+ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif
#else /* Z_SOLO */
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif /* !Z_SOLO */
/* hack for buggy compilers */
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;};
+ struct internal_state {int dummy;};
#endif
/* undocumented functions */
@@ -1751,13 +1751,13 @@ ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#if defined(_WIN32) && !defined(Z_SOLO)
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
- const char *mode));
+ const char *mode));
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
- const char *format,
- va_list va));
+ const char *format,
+ va_list va));
# endif
#endif
diff --git a/src/lib/zlib/zutil.c b/src/lib/zlib/zutil.c
index 23d2ebef008..7c65df43b3e 100644
--- a/src/lib/zlib/zutil.c
+++ b/src/lib/zlib/zutil.c
@@ -29,90 +29,90 @@ z_const char * const z_errmsg[10] = {
const char * ZEXPORT zlibVersion()
{
- return ZLIB_VERSION;
+ return ZLIB_VERSION;
}
uLong ZEXPORT zlibCompileFlags()
{
- uLong flags;
-
- flags = 0;
- switch ((int)(sizeof(uInt))) {
- case 2: break;
- case 4: flags += 1; break;
- case 8: flags += 2; break;
- default: flags += 3;
- }
- switch ((int)(sizeof(uLong))) {
- case 2: break;
- case 4: flags += 1 << 2; break;
- case 8: flags += 2 << 2; break;
- default: flags += 3 << 2;
- }
- switch ((int)(sizeof(voidpf))) {
- case 2: break;
- case 4: flags += 1 << 4; break;
- case 8: flags += 2 << 4; break;
- default: flags += 3 << 4;
- }
- switch ((int)(sizeof(z_off_t))) {
- case 2: break;
- case 4: flags += 1 << 6; break;
- case 8: flags += 2 << 6; break;
- default: flags += 3 << 6;
- }
+ uLong flags;
+
+ flags = 0;
+ switch ((int)(sizeof(uInt))) {
+ case 2: break;
+ case 4: flags += 1; break;
+ case 8: flags += 2; break;
+ default: flags += 3;
+ }
+ switch ((int)(sizeof(uLong))) {
+ case 2: break;
+ case 4: flags += 1 << 2; break;
+ case 8: flags += 2 << 2; break;
+ default: flags += 3 << 2;
+ }
+ switch ((int)(sizeof(voidpf))) {
+ case 2: break;
+ case 4: flags += 1 << 4; break;
+ case 8: flags += 2 << 4; break;
+ default: flags += 3 << 4;
+ }
+ switch ((int)(sizeof(z_off_t))) {
+ case 2: break;
+ case 4: flags += 1 << 6; break;
+ case 8: flags += 2 << 6; break;
+ default: flags += 3 << 6;
+ }
#ifdef DEBUG
- flags += 1 << 8;
+ flags += 1 << 8;
#endif
#if defined(ASMV) || defined(ASMINF)
- flags += 1 << 9;
+ flags += 1 << 9;
#endif
#ifdef ZLIB_WINAPI
- flags += 1 << 10;
+ flags += 1 << 10;
#endif
#ifdef BUILDFIXED
- flags += 1 << 12;
+ flags += 1 << 12;
#endif
#ifdef DYNAMIC_CRC_TABLE
- flags += 1 << 13;
+ flags += 1 << 13;
#endif
#ifdef NO_GZCOMPRESS
- flags += 1L << 16;
+ flags += 1L << 16;
#endif
#ifdef NO_GZIP
- flags += 1L << 17;
+ flags += 1L << 17;
#endif
#ifdef PKZIP_BUG_WORKAROUND
- flags += 1L << 20;
+ flags += 1L << 20;
#endif
#ifdef FASTEST
- flags += 1L << 21;
+ flags += 1L << 21;
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifdef NO_vsnprintf
- flags += 1L << 25;
+ flags += 1L << 25;
# ifdef HAS_vsprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# endif
#else
- flags += 1L << 24;
+ flags += 1L << 24;
# ifdef NO_snprintf
- flags += 1L << 25;
+ flags += 1L << 25;
# ifdef HAS_sprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# endif
#endif
- return flags;
+ return flags;
}
#ifdef DEBUG
@@ -123,10 +123,10 @@ uLong ZEXPORT zlibCompileFlags()
int ZLIB_INTERNAL z_verbose = verbose;
void ZLIB_INTERNAL z_error (m)
- char *m;
+ char *m;
{
- fprintf(stderr, "%s\n", m);
- exit(1);
+ fprintf(stderr, "%s\n", m);
+ exit(1);
}
#endif
@@ -134,53 +134,53 @@ void ZLIB_INTERNAL z_error (m)
* uncompress()
*/
const char * ZEXPORT zError(err)
- int err;
+ int err;
{
- return ERR_MSG(err);
+ return ERR_MSG(err);
}
#if defined(_WIN32_WCE)
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used.
- */
- int errno = 0;
+ /* The Microsoft C Run-Time Library for Windows CE doesn't have
+ * errno. We define it as a global variable to simplify porting.
+ * Its value is always 0 and should not be used.
+ */
+ int errno = 0;
#endif
#ifndef HAVE_MEMCPY
void ZLIB_INTERNAL zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
+ Bytef* dest;
+ const Bytef* source;
+ uInt len;
{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
+ if (len == 0) return;
+ do {
+ *dest++ = *source++; /* ??? to be unrolled */
+ } while (--len != 0);
}
int ZLIB_INTERNAL zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
+ const Bytef* s1;
+ const Bytef* s2;
+ uInt len;
{
- uInt j;
+ uInt j;
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
+ for (j = 0; j < len; j++) {
+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+ }
+ return 0;
}
void ZLIB_INTERNAL zmemzero(dest, len)
- Bytef* dest;
- uInt len;
+ Bytef* dest;
+ uInt len;
{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
+ if (len == 0) return;
+ do {
+ *dest++ = 0; /* ??? to be unrolled */
+ } while (--len != 0);
}
#endif
@@ -205,8 +205,8 @@ void ZLIB_INTERNAL zmemzero(dest, len)
local int next_ptr = 0;
typedef struct ptr_table_s {
- voidpf org_ptr;
- voidpf new_ptr;
+ voidpf org_ptr;
+ voidpf new_ptr;
} ptr_table;
local ptr_table table[MAX_PTR];
@@ -219,48 +219,48 @@ local ptr_table table[MAX_PTR];
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
{
- voidpf buf = opaque; /* just to make some compilers happy */
- ulg bsize = (ulg)items*size;
-
- /* If we allocate less than 65520 bytes, we assume that farmalloc
- * will return a usable pointer which doesn't have to be normalized.
- */
- if (bsize < 65520L) {
- buf = farmalloc(bsize);
- if (*(ush*)&buf != 0) return buf;
- } else {
- buf = farmalloc(bsize + 16L);
- }
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
- table[next_ptr].org_ptr = buf;
-
- /* Normalize the pointer to seg:0 */
- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
- *(ush*)&buf = 0;
- table[next_ptr++].new_ptr = buf;
- return buf;
+ voidpf buf = opaque; /* just to make some compilers happy */
+ ulg bsize = (ulg)items*size;
+
+ /* If we allocate less than 65520 bytes, we assume that farmalloc
+ * will return a usable pointer which doesn't have to be normalized.
+ */
+ if (bsize < 65520L) {
+ buf = farmalloc(bsize);
+ if (*(ush*)&buf != 0) return buf;
+ } else {
+ buf = farmalloc(bsize + 16L);
+ }
+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+ table[next_ptr].org_ptr = buf;
+
+ /* Normalize the pointer to seg:0 */
+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+ *(ush*)&buf = 0;
+ table[next_ptr++].new_ptr = buf;
+ return buf;
}
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
{
- int n;
- if (*(ush*)&ptr != 0) { /* object < 64K */
- farfree(ptr);
- return;
- }
- /* Find the original pointer */
- for (n = 0; n < next_ptr; n++) {
- if (ptr != table[n].new_ptr) continue;
-
- farfree(table[n].org_ptr);
- while (++n < next_ptr) {
- table[n-1] = table[n];
- }
- next_ptr--;
- return;
- }
- ptr = opaque; /* just to make some compilers happy */
- Assert(0, "zcfree: ptr not found");
+ int n;
+ if (*(ush*)&ptr != 0) { /* object < 64K */
+ farfree(ptr);
+ return;
+ }
+ /* Find the original pointer */
+ for (n = 0; n < next_ptr; n++) {
+ if (ptr != table[n].new_ptr) continue;
+
+ farfree(table[n].org_ptr);
+ while (++n < next_ptr) {
+ table[n-1] = table[n];
+ }
+ next_ptr--;
+ return;
+ }
+ ptr = opaque; /* just to make some compilers happy */
+ Assert(0, "zcfree: ptr not found");
}
#endif /* __TURBOC__ */
@@ -278,14 +278,14 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
{
- if (opaque) opaque = 0; /* to make compiler happy */
- return _halloc((long)items, size);
+ if (opaque) opaque = 0; /* to make compiler happy */
+ return _halloc((long)items, size);
}
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
{
- if (opaque) opaque = 0; /* to make compiler happy */
- _hfree(ptr);
+ if (opaque) opaque = 0; /* to make compiler happy */
+ _hfree(ptr);
}
#endif /* M_I86 */
@@ -302,21 +302,21 @@ extern void free OF((voidpf ptr));
#endif
voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
+ voidpf opaque;
+ unsigned items;
+ unsigned size;
{
- if (opaque) items += size - size; /* make compiler happy */
- return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
- (voidpf)calloc(items, size);
+ if (opaque) items += size - size; /* make compiler happy */
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+ (voidpf)calloc(items, size);
}
void ZLIB_INTERNAL zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
+ voidpf opaque;
+ voidpf ptr;
{
- free(ptr);
- if (opaque) return; /* make compiler happy */
+ free(ptr);
+ if (opaque) return; /* make compiler happy */
}
#endif /* MY_ZCALLOC */
diff --git a/src/lib/zlib/zutil.h b/src/lib/zlib/zutil.h
index 24ab06b1cf6..de13b808937 100644
--- a/src/lib/zlib/zutil.h
+++ b/src/lib/zlib/zutil.h
@@ -30,7 +30,7 @@
#endif
#ifdef Z_SOLO
- typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
+ typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
#endif
#ifndef local
@@ -50,10 +50,10 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define ERR_RETURN(strm,err) \
- return (strm->msg = ERR_MSG(err), (err))
+ return (strm->msg = ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */
- /* common constants */
+ /* common constants */
#ifndef DEF_WBITS
# define DEF_WBITS MAX_WBITS
@@ -78,16 +78,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
- /* target dependencies */
+ /* target dependencies */
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
# define OS_CODE 0x00
# ifndef Z_SOLO
# if defined(__TURBOC__) || defined(__BORLANDC__)
# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
- /* Allow compilation with ANSI keywords only enabled */
- void _Cdecl farfree( void *block );
- void *_Cdecl farmalloc( unsigned long nbytes );
+ /* Allow compilation with ANSI keywords only enabled */
+ void _Cdecl farfree( void *block );
+ void *_Cdecl farmalloc( unsigned long nbytes );
# else
# include <alloc.h>
# endif
@@ -104,7 +104,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#if defined(VAXC) || defined(VMS)
# define OS_CODE 0x02
# define F_OPEN(name, mode) \
- fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif
#if defined(ATARI) || defined(atarist)
@@ -153,7 +153,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL /* No fdopen() */
# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
+ typedef int ptrdiff_t;
# define _PTRDIFF_T_DEFINED
# endif
# else
@@ -162,19 +162,19 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#endif
#if defined(__BORLANDC__) && !defined(MSDOS)
- #pragma warn -8004
- #pragma warn -8008
- #pragma warn -8066
+ #pragma warn -8004
+ #pragma warn -8008
+ #pragma warn -8066
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
- (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
#endif
- /* common defaults */
+ /* common defaults */
#ifndef OS_CODE
# define OS_CODE 0x03 /* assume Unix */
@@ -184,16 +184,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define F_OPEN(name, mode) fopen((name), (mode))
#endif
- /* functions */
+ /* functions */
#if defined(pyr) || defined(Z_SOLO)
# define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
- * You may have to use the same strategy for Borland C (untested).
- * The __SC__ check is for Symantec.
- */
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+ * You may have to use the same strategy for Borland C (untested).
+ * The __SC__ check is for Symantec.
+ */
# define NO_MEMCPY
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
@@ -210,16 +210,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
+ void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+ int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+ void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
#endif
/* Diagnostic functions */
#ifdef DEBUG
# include <stdio.h>
- extern int ZLIB_INTERNAL z_verbose;
- extern void ZLIB_INTERNAL z_error OF((char *m));
+ extern int ZLIB_INTERNAL z_verbose;
+ extern void ZLIB_INTERNAL z_error OF((char *m));
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
@@ -236,18 +236,18 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#endif
#ifndef Z_SOLO
- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
- unsigned size));
- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
+ voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
+ unsigned size));
+ void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
#endif
#define ZALLOC(strm, items, size) \
- (*((strm)->zalloc))((strm)->opaque, (items), (size))
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
/* Reverse the bytes in a 32-bit value */
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
+ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
#endif /* ZUTIL_H */
diff --git a/src/mame/audio/decobsmt.h b/src/mame/audio/decobsmt.h
index 16b05a751ee..7bca00d1c20 100644
--- a/src/mame/audio/decobsmt.h
+++ b/src/mame/audio/decobsmt.h
@@ -30,7 +30,7 @@ public:
DECLARE_WRITE8_MEMBER(bsmt_comms_w);
DECLARE_WRITE_LINE_MEMBER(bsmt_reset_line);
-
+
INTERRUPT_GEN_MEMBER(decobsmt_firq_interrupt);
required_device<cpu_device> m_ourcpu;
diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c
index 3893b7231ed..64c206508df 100644
--- a/src/mame/audio/exidy.c
+++ b/src/mame/audio/exidy.c
@@ -764,7 +764,7 @@ void venture_sound_device::device_reset()
m_pia0->reset();
//machine().device("pia1")->reset();
m_pia1->reset();
-
+
/* 6532 */
m_riot->reset();
@@ -999,7 +999,7 @@ void victory_sound_device::device_start()
save_item(NAME(m_riot_irq_state));
sh8253_register_state_globals();
-
+
m_tms = machine().device<tms5220_device>("tms");
}
diff --git a/src/mame/audio/exidy.h b/src/mame/audio/exidy.h
index 476fc4fe00d..2d31bd9a038 100644
--- a/src/mame/audio/exidy.h
+++ b/src/mame/audio/exidy.h
@@ -42,55 +42,55 @@ public:
DECLARE_READ8_MEMBER( sh6840_r );
DECLARE_WRITE8_MEMBER( sh6840_w );
DECLARE_WRITE8_MEMBER( sfxctrl_w );
-
+
DECLARE_WRITE_LINE_MEMBER( update_irq_state );
-
+
DECLARE_WRITE8_MEMBER( r6532_porta_w );
DECLARE_READ8_MEMBER( r6532_porta_r );
DECLARE_WRITE8_MEMBER( r6532_portb_w );
DECLARE_READ8_MEMBER( r6532_portb_r );
void r6532_irq(int state);
-
+
DECLARE_WRITE8_MEMBER( sh8253_w );
DECLARE_READ8_MEMBER( sh8253_r );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
void common_sh_start();
void common_sh_reset();
-
+
void sh6840_register_state_globals();
void sh8253_register_state_globals();
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-
+
cpu_device *m_maincpu;
-
+
/* 6532 variables */
riot6532_device *m_riot;
-
+
/* IRQ variable */
UINT8 m_riot_irq_state;
-
+
/* 8253 variables */
int m_has_sh8253;
struct sh8253_timer_channel m_sh8253_timer[3];
-
+
/* 5220/CVSD variables */
hc55516_device *m_cvsd;
tms5220_device *m_tms;
pia6821_device *m_pia0;
pia6821_device *m_pia1;
-
+
/* sound streaming variables */
sound_stream *m_stream;
double m_freq_to_step;
-
+
private:
// internal state
struct sh6840_timer_channel m_sh6840_timer[3];
@@ -116,12 +116,12 @@ class venture_sound_device : public exidy_sound_device
{
public:
venture_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
DECLARE_WRITE8_MEMBER( mtrap_voiceio_w );
DECLARE_READ8_MEMBER( mtrap_voiceio_r );
-
+
DECLARE_WRITE8_MEMBER( filter_w );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -130,7 +130,7 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-
+
private:
// internal state
};
@@ -141,13 +141,13 @@ class victory_sound_device : public exidy_sound_device
{
public:
victory_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
DECLARE_READ8_MEMBER( response_r );
DECLARE_READ8_MEMBER( status_r );
DECLARE_WRITE8_MEMBER( command_w );
DECLARE_WRITE8_MEMBER( irq_clear_w );
DECLARE_WRITE8_MEMBER( main_ack_w );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -156,12 +156,12 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-
+
private:
// internal state
UINT8 m_victory_sound_response_ack_clk; /* 7474 @ F4 */
-
- TIMER_CALLBACK_MEMBER( delayed_command_w );
+
+ TIMER_CALLBACK_MEMBER( delayed_command_w );
};
extern const device_type EXIDY_VICTORY;
diff --git a/src/mame/audio/exidy440.c b/src/mame/audio/exidy440.c
index 7924844b1ea..ae12eff7314 100644
--- a/src/mame/audio/exidy440.c
+++ b/src/mame/audio/exidy440.c
@@ -62,7 +62,7 @@ exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, cons
m_stream(NULL)
{
m_sound_banks[0] = m_sound_banks[1] = m_sound_banks[2] = m_sound_banks[3] = 0;
-
+
for (int i = 0; i < 4; i++)
{
m_sound_channel[i].base = NULL;
@@ -108,7 +108,7 @@ void exidy440_sound_device::device_start()
save_item(NAME(m_m6844_priority));
save_item(NAME(m_m6844_interrupt));
save_item(NAME(m_m6844_chain));
-
+
m_channel_frequency[0] = clock(); /* channels 0 and 1 are run by FCLK */
m_channel_frequency[1] = clock();
m_channel_frequency[2] = clock()/2; /* channels 2 and 3 are run by SCLK */
diff --git a/src/mame/audio/galaxian.c b/src/mame/audio/galaxian.c
index bb3926bca0b..8c574cf7904 100644
--- a/src/mame/audio/galaxian.c
+++ b/src/mame/audio/galaxian.c
@@ -411,9 +411,9 @@ void galaxian_sound_device::device_config_complete()
void galaxian_sound_device::device_start()
{
m_lfo_val = 0;
-
+
m_discrete = machine().device<discrete_device>(GAL_AUDIO);
-
+
save_item(NAME(m_lfo_val));
}
@@ -508,7 +508,7 @@ MACHINE_CONFIG_FRAGMENT( galaxian_audio )
MCFG_SOUND_ADD("cust", GALAXIAN, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.4)
-
+
MCFG_SOUND_ADD(GAL_AUDIO, DISCRETE, 0)
MCFG_SOUND_CONFIG_DISCRETE(galaxian)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
@@ -518,7 +518,7 @@ MACHINE_CONFIG_FRAGMENT( mooncrst_audio )
MCFG_SOUND_ADD("cust", GALAXIAN, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.4)
-
+
MCFG_SOUND_ADD(GAL_AUDIO, DISCRETE, 0)
MCFG_SOUND_CONFIG_DISCRETE(mooncrst)
diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c
index 13b7634a261..5bdc07e8cec 100644
--- a/src/mame/audio/leland.c
+++ b/src/mame/audio/leland.c
@@ -632,7 +632,7 @@ READ16_MEMBER( leland_80186_sound_device::peripheral_r )
case 0:
/* we have to return 0 periodically so that they handle interrupts */
//if ((++m_clock_tick & 7) == 0)
- // return 0;
+ // return 0;
/* if we've filled up all the active channels, we can give this CPU a reset */
/* until the next interrupt */
diff --git a/src/mame/audio/segam1audio.c b/src/mame/audio/segam1audio.c
index 3e66f4e09f4..cd58ae3e05b 100644
--- a/src/mame/audio/segam1audio.c
+++ b/src/mame/audio/segam1audio.c
@@ -1,6 +1,6 @@
/***************************************************************************
- Sega Model 1 sound board (68000 + 2x 315-5560 "MultiPCM")
+ Sega Model 1 sound board (68000 + 2x 315-5560 "MultiPCM")
used for Model 1 and early Model 2 games
@@ -8,10 +8,10 @@
#include "audio/segam1audio.h"
-#define M68000_TAG "m1sndcpu"
+#define M68000_TAG "m1sndcpu"
#define MULTIPCM_1_TAG "m1pcm1"
#define MULTIPCM_2_TAG "m1pcm2"
-#define YM3438_TAG "m1ym"
+#define YM3438_TAG "m1ym"
static ADDRESS_MAP_START( segam1audio_map, AS_PROGRAM, 16, segam1audio_device )
AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_REGION(":m1sndcpu", 0)
@@ -172,4 +172,3 @@ void segam1audio_device::write_fifo(UINT8 data)
// signal the 68000 that there's data waiting
m_audiocpu->set_input_line(2, HOLD_LINE);
}
-
diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c
index fcf1ef2d1f7..5b374290585 100644
--- a/src/mame/audio/seibu.c
+++ b/src/mame/audio/seibu.c
@@ -43,7 +43,7 @@
/***************************************************************************
- Seibu Sound System
+ Seibu Sound System
***************************************************************************/
/*
@@ -100,13 +100,13 @@ void seibu_sound_device::device_start()
{
m_main2sub[0] = m_main2sub[1] = 0;
m_sub2main[0] = m_sub2main[1] = 0;
-
+
save_item(NAME(m_main2sub_pending));
save_item(NAME(m_sub2main_pending));
-
+
save_item(NAME(m_main2sub));
save_item(NAME(m_sub2main));
-
+
for (int i = 0; i < 2; i++)
{
save_item(NAME(m_main2sub[i]), i);
@@ -222,8 +222,8 @@ void seibu_sound_device::update_irq_lines(int param)
m_sound_cpu->execute().set_input_line_and_vector(0,ASSERT_LINE,irq1 & irq2);
else
return;
- }
-
+ }
+
WRITE8_MEMBER( seibu_sound_device::irq_clear_w )
{
@@ -497,7 +497,7 @@ ADDRESS_MAP_START( seibu3_adpcm_sound_map, AS_PROGRAM, 8, driver_device )
ADDRESS_MAP_END
/***************************************************************************
- Seibu ADPCM device
+ Seibu ADPCM device
***************************************************************************/
const device_type SEIBU_ADPCM = &device_creator<seibu_adpcm_device>;
diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h
index 138be763ba7..6d82277d8f6 100644
--- a/src/mame/audio/seibu.h
+++ b/src/mame/audio/seibu.h
@@ -64,7 +64,7 @@ public:
DECLARE_WRITE8_MEMBER( pending_w );
void decrypt(const char *cpu,int length);
void update_irq_lines(int param);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -77,8 +77,8 @@ protected:
UINT8 m_main2sub[2];
UINT8 m_sub2main[2];
int m_main2sub_pending;
- int m_sub2main_pending;
-
+ int m_sub2main_pending;
+
enum
{
VECTOR_INIT,
@@ -112,7 +112,7 @@ public:
void decrypt(const char *region);
DECLARE_WRITE8_MEMBER( adr_w );
DECLARE_WRITE8_MEMBER( ctl_w );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -142,7 +142,7 @@ extern const seibu_adpcm_interface seibu_adpcm2_intf;
/**************************************************************************/
#define MCFG_SEIBU_SOUND_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, SEIBU_SOUND, 0)
+ MCFG_DEVICE_ADD(_tag, SEIBU_SOUND, 0)
#define SEIBU_COIN_INPUTS \
PORT_START("COIN") \
@@ -159,39 +159,39 @@ extern const seibu_adpcm_interface seibu_adpcm2_intf;
#define SEIBU_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+ MCFG_CPU_PROGRAM_MAP(seibu_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
+
#define SEIBU2_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu2_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+ MCFG_CPU_PROGRAM_MAP(seibu2_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
+
#define SEIBU2_AIRRAID_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu2_airraid_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
+ MCFG_CPU_PROGRAM_MAP(seibu2_airraid_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
#define SEIBU2_RAIDEN2_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu2_raiden2_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+ MCFG_CPU_PROGRAM_MAP(seibu2_raiden2_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
+
#define SEIBU_NEWZEROTEAM_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu_newzeroteam_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+ MCFG_CPU_PROGRAM_MAP(seibu_newzeroteam_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
+
#define SEIBU3_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu3_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+ MCFG_CPU_PROGRAM_MAP(seibu3_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
+
#define SEIBU3A_SOUND_SYSTEM_CPU(freq) \
MCFG_CPU_ADD("audiocpu", Z80, freq) \
- MCFG_CPU_PROGRAM_MAP(seibu3_adpcm_sound_map) \
- MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+ MCFG_CPU_PROGRAM_MAP(seibu3_adpcm_sound_map) \
+ MCFG_SEIBU_SOUND_ADD("seibu_sound")
+
#define SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(freq1,freq2) \
MCFG_SPEAKER_STANDARD_MONO("mono") \
\
diff --git a/src/mame/audio/t5182.c b/src/mame/audio/t5182.c
index 1e2b35d07ff..e7a3f45dc65 100644
--- a/src/mame/audio/t5182.c
+++ b/src/mame/audio/t5182.c
@@ -177,12 +177,12 @@ void t5182_device::device_config_complete()
void t5182_device::device_start()
{
m_t5182_sharedram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("t5182_sharedram")->ptr());
-
+
save_pointer(NAME(m_t5182_sharedram), sizeof(UINT8));
save_item(NAME(m_irqstate));
save_item(NAME(m_semaphore_main));
save_item(NAME(m_semaphore_snd));
-
+
m_ourcpu = machine().device<cpu_device>("t5182_z80");
}
@@ -220,7 +220,7 @@ TIMER_CALLBACK_MEMBER( t5182_device::setirq_callback )
m_irqstate &= ~2;
break;
}
-
+
if (m_ourcpu == NULL)
return;
diff --git a/src/mame/audio/t5182.h b/src/mame/audio/t5182.h
index 19218e479d7..21ee3e05074 100644
--- a/src/mame/audio/t5182.h
+++ b/src/mame/audio/t5182.h
@@ -32,7 +32,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(ym2151_irq_handler);
DECLARE_WRITE8_MEMBER(ym2151_irq_ack_w);
DECLARE_WRITE8_MEMBER(cpu_irq_ack_w);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -45,7 +45,7 @@ private:
int m_irqstate;
int m_semaphore_main;
int m_semaphore_snd;
-
+
TIMER_CALLBACK_MEMBER( setirq_callback );
};
diff --git a/src/mame/audio/taito_en.c b/src/mame/audio/taito_en.c
index 05ade241a60..a6d51e85ad8 100644
--- a/src/mame/audio/taito_en.c
+++ b/src/mame/audio/taito_en.c
@@ -141,7 +141,7 @@ WRITE16_MEMBER( taito_en_device::en_volume_w )
*************************************/
//todo: hook up cpu/es5510
-
+
READ16_MEMBER( taito_en_device::es5510_dsp_r )
{
// logerror("%06x: DSP read offset %04x (data is %04x)\n",space.device().safe_pc(),offset,m_es5510_dsp_ram[offset]);
diff --git a/src/mame/audio/taito_en.h b/src/mame/audio/taito_en.h
index d5f93a05f0b..efd5ef4565d 100644
--- a/src/mame/audio/taito_en.h
+++ b/src/mame/audio/taito_en.h
@@ -7,16 +7,16 @@ class taito_en_device : public device_t
public:
taito_en_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~taito_en_device() {}
-
+
DECLARE_READ16_MEMBER( en_68000_share_r );
DECLARE_WRITE16_MEMBER( en_68000_share_w );
DECLARE_WRITE16_MEMBER( en_es5505_bank_w );
DECLARE_WRITE16_MEMBER( en_volume_w );
-
+
//todo: hook up cpu/es5510
DECLARE_READ16_MEMBER( es5510_dsp_r );
DECLARE_WRITE16_MEMBER( es5510_dsp_w );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -35,9 +35,9 @@ private:
UINT32 m_es5510_dadr_latch;
UINT32 m_es5510_gpr_latch;
UINT8 m_es5510_ram_sel;
-
+
UINT32 *m_snd_shared_ram;
-
+
};
extern const device_type TAITO_EN;
diff --git a/src/mame/audio/taitosnd.c b/src/mame/audio/taitosnd.c
index 61131bb24df..e380535df70 100644
--- a/src/mame/audio/taitosnd.c
+++ b/src/mame/audio/taitosnd.c
@@ -1,10 +1,10 @@
/**********************************************************************************************
- Taito TC0140SYT
-
- TODO:
- - Add pinout and description
- - Create a separate implementation for the PC060HA
+ Taito TC0140SYT
+
+ TODO:
+ - Add pinout and description
+ - Create a separate implementation for the PC060HA
**********************************************************************************************/
diff --git a/src/mame/audio/targ.c b/src/mame/audio/targ.c
index 3d9365f14ad..12986ea6e80 100644
--- a/src/mame/audio/targ.c
+++ b/src/mame/audio/targ.c
@@ -148,7 +148,7 @@ static SAMPLES_START( spectar_audio_start )
{
running_machine &machine = device.machine();
exidy_state *state = machine.driver_data<exidy_state>();
-
+
state->common_audio_start(SPECTAR_MAXFREQ);
}
@@ -157,7 +157,7 @@ static SAMPLES_START( targ_audio_start )
{
running_machine &machine = device.machine();
exidy_state *state = machine.driver_data<exidy_state>();
-
+
state->common_audio_start(TARG_MAXFREQ);
state->m_tone_pointer = 0;
diff --git a/src/mame/drivers/20pacgal.c b/src/mame/drivers/20pacgal.c
index 99e7869b587..db12ab34b4e 100644
--- a/src/mame/drivers/20pacgal.c
+++ b/src/mame/drivers/20pacgal.c
@@ -215,12 +215,12 @@ static ADDRESS_MAP_START( 25pacman_map, AS_PROGRAM, 8, _25pacman_state )
AM_RANGE(0x04800, 0x05fff) AM_RAM
AM_RANGE(0x06000, 0x06fff) AM_WRITEONLY AM_SHARE("char_gfx_ram")
AM_RANGE(0x0a000, 0x0bfff) AM_WRITE(sprite_gfx_w)
-// AM_RANGE(0x0fffe, 0x0ffff) AM_WRITENOP
+// AM_RANGE(0x0fffe, 0x0ffff) AM_WRITENOP
-// AM_RANGE(0x0c000, 0x0dfff) // is this the sound waveforms in a different format?
+// AM_RANGE(0x0c000, 0x0dfff) // is this the sound waveforms in a different format?
AM_RANGE(0x07000, 0x0717f) AM_WRITE(sprite_ram_w)
-// AM_RANGE(0x00000, 0x3ffff) AM_DEVREADWRITE("flash", sst_39vf020_device, read, write ) // (always fall through if nothing else is mapped?)
+// AM_RANGE(0x00000, 0x3ffff) AM_DEVREADWRITE("flash", sst_39vf020_device, read, write ) // (always fall through if nothing else is mapped?)
ADDRESS_MAP_END
@@ -255,7 +255,7 @@ READ8_MEMBER( _25pacman_state::_25pacman_io_87_r )
return 0xff;
}
- static ADDRESS_MAP_START( 25pacman_io_map, AS_IO, 8, _25pacman_state )
+ static ADDRESS_MAP_START( 25pacman_io_map, AS_IO, 8, _25pacman_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x3f) AM_NOP /* Z180 internal registers */
AM_RANGE(0x40, 0x7f) AM_NOP /* Z180 internal registers */
@@ -265,7 +265,7 @@ READ8_MEMBER( _25pacman_state::_25pacman_io_87_r )
AM_RANGE(0x80, 0x80) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x81, 0x81) AM_WRITE(timer_pulse_w) /* ??? pulsed by the timer irq */
AM_RANGE(0x82, 0x82) AM_WRITE(irqack_w)
-// AM_RANGE(0x84, 0x84) AM_NOP /* ?? */
+// AM_RANGE(0x84, 0x84) AM_NOP /* ?? */
AM_RANGE(0x85, 0x86) AM_WRITEONLY AM_SHARE("stars_seed") /* stars: rng seed (lo/hi) */
AM_RANGE(0x87, 0x87) AM_READ( _25pacman_io_87_r ) // not eeprom on this
AM_RANGE(0x88, 0x88) AM_WRITE(ram_bank_select_w)
@@ -339,7 +339,7 @@ static INPUT_PORTS_START( 20pacgal )
PORT_START( "EEPROMOUT" )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write) /* bit 5 is cs (active high) */
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write) /* bit 6 is clock (active high) */
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write) /* bit 6 is clock (active high) */
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write) /* bit 7 is data */
INPUT_PORTS_END
@@ -449,7 +449,7 @@ ROM_END
// guzuta v2.2 PCB
// this uses the main FLASH rom to save things instead of eeprom (type is AM29LV20)
// different memory map.. no palette rom
-ROM_START( 25pacman ) /* Revision 3.00 */
+ROM_START( 25pacman ) /* Revision 3.00 */
ROM_REGION( 0x40000, "flash", 0 )
ROM_LOAD( "pacman25ver3.u1", 0x00000, 0x40000, CRC(55b0076e) SHA1(4544cc193bdd22bfc88d096083ccc4069cac4607) ) /* program says Rev 3.00 */
ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASE00 )
diff --git a/src/mame/drivers/3x3puzzl.c b/src/mame/drivers/3x3puzzl.c
index ec15caca37e..ccaa9675baa 100644
--- a/src/mame/drivers/3x3puzzl.c
+++ b/src/mame/drivers/3x3puzzl.c
@@ -82,7 +82,7 @@ public:
TILE_GET_INFO_MEMBER(get_tile3_info);
int m_oki_bank;
- UINT16 m_gfx_control;
+ UINT16 m_gfx_control;
DECLARE_WRITE16_HANDLER(gfx_ctrl_w);
DECLARE_WRITE16_HANDLER(tilemap1_scrollx_w);
@@ -177,8 +177,6 @@ void _3x3puzzle_state::video_start()
UINT32 _3x3puzzle_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
-
-
m_tilemap1->draw(screen, bitmap, cliprect, 0, 1);
m_tilemap2->draw(screen, bitmap, cliprect, 0, 2);
m_tilemap3->draw(screen, bitmap, cliprect, 0, 3);
@@ -241,7 +239,7 @@ static INPUT_PORTS_START( _3x3puzzle )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
-
+
PORT_START("SYS")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
@@ -308,22 +306,22 @@ static INPUT_PORTS_START( casanova )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
PORT_MODIFY("DSW01") /* Do NOT trust "DIP INFO" for correct settings! At least Coinage is WRONG! */
- PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2")
+ PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) /* Dip info shows 2 Coins / Credit */
PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) /* Dip info shows 3 Coins / Credit */
PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) /* Dip info shows 5 Coins / Credit */
- PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
+ PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) )
- PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5")
+ PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "SW1:6" )
PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "SW1:7" )
- PORT_DIPNAME( 0x0080, 0x0080, "Dip Info" ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPNAME( 0x0080, 0x0080, "Dip Info" ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "SW2:1" ) /* DSW2 bank, not used? */
@@ -480,7 +478,7 @@ ROM_START( casanova )
ROM_LOAD32_BYTE( "casanova.u81", 0x200000, 0x80000, CRC(9eafd37d) SHA1(bc9e7a035849f23da48c9d923188c61188d93c43) )
ROM_LOAD32_BYTE( "casanova.u83", 0x200001, 0x80000, CRC(9d4ce407) SHA1(949c7f329bd348beff4f14ac7b506c8aef212ad8) )
ROM_LOAD32_BYTE( "casanova.u85", 0x200002, 0x80000, CRC(113c6e3a) SHA1(e90d78c4415d244004734a481501f8040f8aa468) )
- ROM_LOAD32_BYTE( "casanova.u87", 0x200003, 0x80000, CRC(61bd80f8) SHA1(13b93f2638c37a5dec5b4016c058f486f9cbadae) )
+ ROM_LOAD32_BYTE( "casanova.u87", 0x200003, 0x80000, CRC(61bd80f8) SHA1(13b93f2638c37a5dec5b4016c058f486f9cbadae) )
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD32_BYTE( "casanova.u39", 0x000003, 0x80000, CRC(97d4095a) SHA1(4b1fde984025fae240bf64f812d67bc9cbf3a60c) )
diff --git a/src/mame/drivers/arcadecl.c b/src/mame/drivers/arcadecl.c
index 6a7423346b9..dbfd1f7fd3d 100644
--- a/src/mame/drivers/arcadecl.c
+++ b/src/mame/drivers/arcadecl.c
@@ -327,7 +327,7 @@ static MACHINE_CONFIG_START( arcadecl, arcadecl_state )
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
MCFG_GFXDECODE(arcadecl)
MCFG_PALETTE_LENGTH(512)
-
+
MCFG_ATARI_MOTION_OBJECTS_ADD("mob", "screen", arcadecl_state::s_mob_config)
MCFG_SCREEN_ADD("screen", RASTER)
@@ -348,7 +348,7 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( sparkz, arcadecl )
MCFG_DEVICE_REMOVE("mob")
MACHINE_CONFIG_END
-
+
/*************************************
diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c
index 80e0476b966..8bb466ae5bf 100644
--- a/src/mame/drivers/atarig42.c
+++ b/src/mame/drivers/atarig42.c
@@ -542,7 +542,7 @@ static MACHINE_CONFIG_START( atarig42, atarig42_state )
MCFG_MACHINE_START_OVERRIDE(atarig42_state,atarig42)
MCFG_MACHINE_RESET_OVERRIDE(atarig42_state,atarig42)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c
index c501d26363c..ed8e35af238 100644
--- a/src/mame/drivers/atarigt.c
+++ b/src/mame/drivers/atarigt.c
@@ -824,7 +824,7 @@ static MACHINE_CONFIG_START( atarigt, atarigt_state )
MCFG_CPU_PERIODIC_INT_DRIVER(atarigen_state, scanline_int_gen, 250)
MCFG_MACHINE_RESET_OVERRIDE(atarigt_state,atarigt)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c
index 78788c734d5..334a0ce1773 100644
--- a/src/mame/drivers/atarigx2.c
+++ b/src/mame/drivers/atarigx2.c
@@ -1406,7 +1406,7 @@ static MACHINE_CONFIG_START( atarigx2, atarigx2_state )
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
MCFG_MACHINE_RESET_OVERRIDE(atarigx2_state,atarigx2)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/atarisy1.c b/src/mame/drivers/atarisy1.c
index f1f7ba5d6f4..542b1d55526 100644
--- a/src/mame/drivers/atarisy1.c
+++ b/src/mame/drivers/atarisy1.c
@@ -731,7 +731,7 @@ static MACHINE_CONFIG_START( atarisy1, atarisy1_state )
MCFG_MACHINE_START_OVERRIDE(atarisy1_state,atarisy1)
MCFG_MACHINE_RESET_OVERRIDE(atarisy1_state,atarisy1)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
MCFG_TIMER_DRIVER_ADD("joystick_timer", atarisy1_state, delayed_joystick_int)
@@ -746,7 +746,7 @@ static MACHINE_CONFIG_START( atarisy1, atarisy1_state )
MCFG_TILEMAP_ADD_STANDARD("playfield", 2, atarisy1_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarisy1_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
-
+
MCFG_ATARI_MOTION_OBJECTS_ADD("mob", "screen", atarisy1_state::s_mob_config)
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c
index 40611a0659c..2c6fd518889 100644
--- a/src/mame/drivers/atarisy2.c
+++ b/src/mame/drivers/atarisy2.c
@@ -1235,7 +1235,7 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state )
MCFG_MACHINE_START_OVERRIDE(atarisy2_state,atarisy2)
MCFG_MACHINE_RESET_OVERRIDE(atarisy2_state,atarisy2)
-
+
MCFG_EEPROM_2804_ADD("eeprom")
/* video hardware */
@@ -1245,7 +1245,7 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state )
MCFG_TILEMAP_ADD_STANDARD("playfield", 2, atarisy2_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 128,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, atarisy2_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,48, 0)
-
+
MCFG_ATARI_MOTION_OBJECTS_ADD("mob", "screen", atarisy2_state::s_mob_config)
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/badlands.c b/src/mame/drivers/badlands.c
index 03cde476e7c..648bc83f4d9 100644
--- a/src/mame/drivers/badlands.c
+++ b/src/mame/drivers/badlands.c
@@ -503,7 +503,7 @@ static MACHINE_CONFIG_START( badlands, badlands_state )
MCFG_MACHINE_START_OVERRIDE(badlands_state,badlands)
MCFG_MACHINE_RESET_OVERRIDE(badlands_state,badlands)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
@@ -656,7 +656,7 @@ static ADDRESS_MAP_START( bootleg_map, AS_PROGRAM, 16, badlands_state )
ADDRESS_MAP_END
static INPUT_PORTS_START( badlandsb )
-
+
PORT_INCLUDE( badlands )
PORT_MODIFY("AUDIO") /* audio port */
@@ -705,7 +705,7 @@ static MACHINE_CONFIG_START( badlandsb, badlands_state )
MCFG_MACHINE_START_OVERRIDE(badlands_state,badlands)
MCFG_MACHINE_RESET_OVERRIDE(badlands_state,badlandsb)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/batman.c b/src/mame/drivers/batman.c
index 52b56c73e06..226bc207cd8 100644
--- a/src/mame/drivers/batman.c
+++ b/src/mame/drivers/batman.c
@@ -200,7 +200,7 @@ static MACHINE_CONFIG_START( batman, batman_state )
MCFG_MACHINE_START_OVERRIDE(batman_state,batman)
MCFG_MACHINE_RESET_OVERRIDE(batman_state,batman)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/berzerk.c b/src/mame/drivers/berzerk.c
index 7009de472ee..006acb78463 100644
--- a/src/mame/drivers/berzerk.c
+++ b/src/mame/drivers/berzerk.c
@@ -33,13 +33,13 @@ public:
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
-
+
required_device<cpu_device> m_maincpu;
required_device<s14001a_device> m_s14001a;
required_device<ttl74181_device> m_ls181_10c;
required_device<ttl74181_device> m_ls181_12c;
required_device<exidy_sound_device> m_custom;
-
+
UINT8 m_magicram_control;
UINT8 m_last_shift_data;
UINT8 m_intercept;
diff --git a/src/mame/drivers/bfm_sc1.c b/src/mame/drivers/bfm_sc1.c
index c30855d80fd..a3a0e44a188 100644
--- a/src/mame/drivers/bfm_sc1.c
+++ b/src/mame/drivers/bfm_sc1.c
@@ -182,7 +182,7 @@ public:
int Scorpion1_GetSwitchState(int strobe, int data);
int sc1_find_project_string( );
required_device<cpu_device> m_maincpu;
- optional_device<upd7759_device> m_upd7759;
+ optional_device<upd7759_device> m_upd7759;
};
#define VFD_RESET 0x20
@@ -1092,7 +1092,7 @@ static MACHINE_CONFIG_DERIVED( scorpion1_adder2, scorpion1 )
MCFG_CPU_PROGRAM_MAP(sc1_adder2) // setup read and write memorymap
MCFG_DEFAULT_LAYOUT(layout_sc1_vid)
-
+
MCFG_BFM_ADDER2_ADD("adder2")
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/blstroid.c b/src/mame/drivers/blstroid.c
index 8102be5525a..68a0208105a 100644
--- a/src/mame/drivers/blstroid.c
+++ b/src/mame/drivers/blstroid.c
@@ -176,7 +176,7 @@ static MACHINE_CONFIG_START( blstroid, blstroid_state )
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
MCFG_MACHINE_RESET_OVERRIDE(blstroid_state,blstroid)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c
index b71555ab8bd..20d8edd92ba 100644
--- a/src/mame/drivers/cabal.c
+++ b/src/mame/drivers/cabal.c
@@ -494,7 +494,7 @@ static MACHINE_CONFIG_START( cabal, cabal_state )
/* sound hardware */
MCFG_SEIBU_SOUND_ADD("seibu_sound")
-
+
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* verified on pcb */
diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c
index f97df32d366..1ee8d813430 100644
--- a/src/mame/drivers/cave.c
+++ b/src/mame/drivers/cave.c
@@ -808,13 +808,13 @@ UINT16 cave_state::ppsatan_touch_r(int player)
UINT16 x = ioport(player ? "TOUCH2_X" : "TOUCH1_X")->read();
UINT16 y = ioport(player ? "TOUCH2_Y" : "TOUCH1_Y")->read();
- if (x & 0x8000) // touching
+ if (x & 0x8000) // touching
{
x &= 0x7fff;
// x
int slot_x = floor( ((320.0f - 1 - x) - 12) / 20 );
-
+
if (slot_x < 0)
slot_x = 0;
else if (slot_x > 14)
@@ -834,7 +834,7 @@ UINT16 cave_state::ppsatan_touch_r(int player)
if ( ((m_ppsatan_io_mux >> 2) & (1 << slot_y)) || ((m_ppsatan_io_mux << 6) & (1 << slot_y)) )
ret_y |= 1 << (slot_y % 6);
-// if (!player) popmessage("TOUCH %03x %03x -> %f -> %d", x, y, ((320.0f - 1 - x) - 12) / 20, slot_x);
+// if (!player) popmessage("TOUCH %03x %03x -> %f -> %d", x, y, ((320.0f - 1 - x) - 12) / 20, slot_x);
}
return ret_x | (ret_y << 8);
@@ -864,13 +864,13 @@ WRITE16_MEMBER(cave_state::ppsatan_out_w)
{
set_led_status(machine(), 4, data & 0x0100);
set_led_status(machine(), 5, data & 0x0200);
- set_led_status(machine(), 6, data & 0x0400); // not tested in service mode
- set_led_status(machine(), 7, data & 0x0800); // not tested in service mode
+ set_led_status(machine(), 6, data & 0x0400); // not tested in service mode
+ set_led_status(machine(), 7, data & 0x0800); // not tested in service mode
m_oki->set_bank_base((data & 0x8000) ? 0x40000 : 0);
}
-// popmessage("OUT %04x", data);
+// popmessage("OUT %04x", data);
}
static ADDRESS_MAP_START( ppsatan_map, AS_PROGRAM, 16, cave_state )
@@ -880,8 +880,8 @@ static ADDRESS_MAP_START( ppsatan_map, AS_PROGRAM, 16, cave_state )
// Left Screen (Player 2)
AM_RANGE(0x080000, 0x080005) AM_RAM AM_SHARE("vctrl.1") // Layer Control
AM_RANGE(0x100000, 0x107fff) AM_RAM_WRITE(cave_vram_1_w) AM_SHARE("vram.1") // Layer
-// AM_RANGE(0x180000, 0x1803ff) AM_RAM // Palette (Tilemaps)
-// AM_RANGE(0x187800, 0x188fff) AM_RAM AM_SHARE("paletteram.1") // Palette (Sprites)
+// AM_RANGE(0x180000, 0x1803ff) AM_RAM // Palette (Tilemaps)
+// AM_RANGE(0x187800, 0x188fff) AM_RAM AM_SHARE("paletteram.1") // Palette (Sprites)
AM_RANGE(0x180000, 0x188fff) AM_RAM AM_SHARE("paletteram.1") // Palette
AM_RANGE(0x1c0000, 0x1c7fff) AM_RAM AM_SHARE("spriteram.1") // Sprites
AM_RANGE(0x200000, 0x200001) AM_READ_PORT("SYSTEM" ) // DSW + (unused) EEPROM
@@ -898,8 +898,8 @@ static ADDRESS_MAP_START( ppsatan_map, AS_PROGRAM, 16, cave_state )
// Right Screen (Player 1)
AM_RANGE(0x480000, 0x480005) AM_RAM AM_SHARE("vctrl.2") // Layer Control
AM_RANGE(0x500000, 0x507fff) AM_RAM_WRITE(cave_vram_2_w) AM_SHARE("vram.2") // Layer
-// AM_RANGE(0x580000, 0x5803ff) AM_RAM // Palette (Tilemaps)
-// AM_RANGE(0x587800, 0x588fff) AM_RAM //AM_SHARE("paletteram.2") // Palette (Sprites)
+// AM_RANGE(0x580000, 0x5803ff) AM_RAM // Palette (Tilemaps)
+// AM_RANGE(0x587800, 0x588fff) AM_RAM //AM_SHARE("paletteram.2") // Palette (Sprites)
AM_RANGE(0x580000, 0x588fff) AM_RAM AM_SHARE("paletteram.2") // Palette
AM_RANGE(0x5c0000, 0x5c7fff) AM_RAM AM_SHARE("spriteram.2") // Sprites
AM_RANGE(0x6c0000, 0x6c007f) AM_WRITEONLY AM_SHARE("videoregs.2") // Video Regs
@@ -907,8 +907,8 @@ static ADDRESS_MAP_START( ppsatan_map, AS_PROGRAM, 16, cave_state )
// Top Screen
AM_RANGE(0x880000, 0x880005) AM_RAM AM_SHARE("vctrl.0") // Layer Control
AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(cave_vram_0_w) AM_SHARE("vram.0") // Layer
-// AM_RANGE(0x980000, 0x9803ff) AM_RAM // Palette (Tilemaps)
-// AM_RANGE(0x987800, 0x988fff) AM_RAM AM_SHARE("paletteram.0") // Palette (Sprites)
+// AM_RANGE(0x980000, 0x9803ff) AM_RAM // Palette (Tilemaps)
+// AM_RANGE(0x987800, 0x988fff) AM_RAM AM_SHARE("paletteram.0") // Palette (Sprites)
AM_RANGE(0x980000, 0x988fff) AM_RAM AM_SHARE("paletteram.0") // Palette
AM_RANGE(0x9c0000, 0x9c7fff) AM_RAM AM_SHARE("spriteram.0") // Sprites
AM_RANGE(0xac0000, 0xac007f) AM_WRITEONLY AM_SHARE("videoregs.0") // Video Regs
@@ -1660,7 +1660,7 @@ static INPUT_PORTS_START( ppsatan )
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) // service coin
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 ) // advance in service mode
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 ) // advance in service mode
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1678,7 +1678,7 @@ static INPUT_PORTS_START( ppsatan )
PORT_DIPSETTING( 0x3000, DEF_STR( Normal ) ) // 20 hits
PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) // 25 hits
PORT_DIPSETTING( 0x2000, "Hard (duplicate)" )
- PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") // Jingle after "warning" screen (every 3 demo loops)
+ PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") // Jingle after "warning" screen (every 3 demo loops)
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x4000, DEF_STR( On ) )
PORT_SERVICE(0x8000, IP_ACTIVE_LOW) PORT_DIPLOCATION("SW1:8")
@@ -2473,7 +2473,7 @@ static MACHINE_CONFIG_START( pacslot, cave_state )
MCFG_MACHINE_START_OVERRIDE(cave_state,cave)
MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave)
-
+
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
MCFG_EEPROM_SERIAL_ENABLE_STREAMING()
@@ -2513,7 +2513,7 @@ MACHINE_CONFIG_END
TIMER_DEVICE_CALLBACK_MEMBER( cave_state::timer_lev2_cb )
{
- m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); // ppsatan: read touch screens
+ m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); // ppsatan: read touch screens
}
static MACHINE_CONFIG_START( ppsatan, cave_state )
@@ -2532,7 +2532,7 @@ static MACHINE_CONFIG_START( ppsatan, cave_state )
MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_lev2", cave_state, timer_lev2_cb, attotime::from_hz(60))
/* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER) // Top
+ MCFG_SCREEN_ADD("screen", RASTER) // Top
MCFG_SCREEN_REFRESH_RATE(15625/271.5)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(320, 240)
diff --git a/src/mame/drivers/cdi.c b/src/mame/drivers/cdi.c
index 0feeb7283aa..509211b763f 100644
--- a/src/mame/drivers/cdi.c
+++ b/src/mame/drivers/cdi.c
@@ -327,7 +327,7 @@ static MACHINE_CONFIG_START( cdi, cdi_state )
MCFG_MCD212_ADD("mcd212")
MCFG_MCD212_SET_SCREEN("screen")
-
+
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c
index 0b6e83f4e05..e5e45361572 100644
--- a/src/mame/drivers/crystal.c
+++ b/src/mame/drivers/crystal.c
@@ -583,7 +583,7 @@ void crystal_state::machine_start()
int i;
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(crystal_state::icallback),this));
-
+
for (i = 0; i < 4; i++)
m_Timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(crystal_state::Timercb),this), (void*)(FPTR)i);
diff --git a/src/mame/drivers/cupidon.c b/src/mame/drivers/cupidon.c
index 57278f9ee90..00dcfce3a39 100644
--- a/src/mame/drivers/cupidon.c
+++ b/src/mame/drivers/cupidon.c
@@ -4,7 +4,7 @@
seems to be Kupidon in the ROMs?
these act a bit like the pluto5 ones but with a video system, possibly a variant on that?
-
+
needs 68340 peripherals (irq controller + timer at least) to be fleshed out.
video might be vga-like?
@@ -46,16 +46,12 @@ protected:
UINT32 cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
-
int count = 0;
for (int ytile=0;ytile<16;ytile++)
{
-
-
for (int xtile=0;xtile<32;xtile++)
{
-
for (int y=0;y<16;y++)
{
UINT16* destline = &bitmap.pix16(ytile*16 + y);
@@ -79,20 +75,20 @@ UINT32 cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16
// could be pumped through the get_cs function (if they use the memory protection features we might have to) but that's slow...
static ADDRESS_MAP_START( cupidon_map, AS_PROGRAM, 32, cupidon_state )
- AM_RANGE(0x0000000, 0x07fffff) AM_ROM AM_MIRROR(0x1000000)
+ AM_RANGE(0x0000000, 0x07fffff) AM_ROM AM_MIRROR(0x1000000)
AM_RANGE(0x1000000, 0x100ffff) AM_RAM
AM_RANGE(0x1800000, 0x1800003) AM_READ(cupidon_return_ffffffff)
AM_RANGE(0x2000074, 0x2000077) AM_RAM // port
-// AM_RANGE(0x2000040, 0x200004f) AM_RAM
+// AM_RANGE(0x2000040, 0x200004f) AM_RAM
// might just be 4mb of VRAM
AM_RANGE(0x3000000, 0x33bffff) AM_RAM
AM_RANGE(0x33c0000, 0x33fffff) AM_RAM AM_SHARE("gfxram") // seems to upload graphics to here, tiles etc. if you skip the loop after the romtest in funnyfm
-// AM_RANGE(0x3400000, 0x3400fff) AM_RAM
-// AM_RANGE(0x3F80000, 0x3F80003) AM_RAM
+// AM_RANGE(0x3400000, 0x3400fff) AM_RAM
+// AM_RANGE(0x3F80000, 0x3F80003) AM_RAM
AM_RANGE(0x3FF0400, 0x3FF0403) AM_RAM // register? gangrose likes to read this?
ADDRESS_MAP_END
diff --git a/src/mame/drivers/cyberbal.c b/src/mame/drivers/cyberbal.c
index 3742476e3eb..38c9d0b5288 100644
--- a/src/mame/drivers/cyberbal.c
+++ b/src/mame/drivers/cyberbal.c
@@ -403,7 +403,7 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state )
MCFG_MACHINE_START_OVERRIDE(cyberbal_state,cyberbal)
MCFG_MACHINE_RESET_OVERRIDE(cyberbal_state,cyberbal)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
@@ -465,7 +465,7 @@ static MACHINE_CONFIG_START( cyberbal2p, cyberbal_state )
MCFG_MACHINE_START_OVERRIDE(cyberbal_state,cyberbal)
MCFG_MACHINE_RESET_OVERRIDE(cyberbal_state,cyberbal2p)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/dambustr.c b/src/mame/drivers/dambustr.c
index 32891caf70c..58cf4dce62c 100644
--- a/src/mame/drivers/dambustr.c
+++ b/src/mame/drivers/dambustr.c
@@ -62,7 +62,7 @@ public:
m_custom(*this, "cust") { }
required_device<galaxian_sound_device> m_custom;
-
+
int m_noise_data;
DECLARE_WRITE8_MEMBER(dambustr_noise_enable_w);
DECLARE_DRIVER_INIT(dambustr);
diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c
index a5b6b2f9d46..0c06a20aa57 100644
--- a/src/mame/drivers/dblewing.c
+++ b/src/mame/drivers/dblewing.c
@@ -1,7 +1,7 @@
/*
Double Wings
-Mitchell 1993
+Mitchell 1993
This game runs on Data East hardware.
@@ -302,7 +302,7 @@ static INPUT_PORTS_START( dblewing )
PORT_DIPSETTING( 0x0200, "1" )
PORT_DIPSETTING( 0x0100, "2" )
PORT_DIPSETTING( 0x0300, "3" )
- PORT_DIPSETTING( 0x0000, "5" )
+ PORT_DIPSETTING( 0x0000, "5" )
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) )
diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c
index 3c1b20d63dd..a69b4557769 100644
--- a/src/mame/drivers/ddealer.c
+++ b/src/mame/drivers/ddealer.c
@@ -521,9 +521,9 @@ static INPUT_PORTS_START( ddealer )
/*bits 0-7 are almost surely to be coinage.*/
PORT_START("DSW1")
- PORT_DIPUNUSED_DIPLOC( 0x0001, IP_ACTIVE_LOW, "SW1:8" ) /* Listed as "Always Off" */
- PORT_DIPUNUSED_DIPLOC( 0x0002, IP_ACTIVE_LOW, "SW1:7" ) /* Listed as "Always Off" */
- PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4")
+ PORT_DIPUNUSED_DIPLOC( 0x0001, IP_ACTIVE_LOW, "SW1:8" ) /* Listed as "Always Off" */
+ PORT_DIPUNUSED_DIPLOC( 0x0002, IP_ACTIVE_LOW, "SW1:7" ) /* Listed as "Always Off" */
+ PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
@@ -532,7 +532,7 @@ static INPUT_PORTS_START( ddealer )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1")
+ PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
@@ -541,25 +541,25 @@ static INPUT_PORTS_START( ddealer )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) /* Not listed in "dips" text, but current effect is FREE PLAY. Is this correct? */
- PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
+ PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
+ PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:6")
+ PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Japanese ) )
PORT_DIPSETTING( 0x0000, DEF_STR( English ) )
- PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,4")
+ PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,4")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
- PORT_DIPNAME( 0x2000, 0x2000, "Lady Stripping" ) PORT_DIPLOCATION("SW2:3")
+ PORT_DIPNAME( 0x2000, 0x2000, "Lady Stripping" ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x2000, DEF_STR( On ) )
- PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:2" ) /* Listed as "Always Off" */
- PORT_DIPUNUSED_DIPLOC( 0x8000, IP_ACTIVE_LOW, "SW2:1" ) /* Listed as "Always Off" */
+ PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:2" ) /* Listed as "Always Off" */
+ PORT_DIPUNUSED_DIPLOC( 0x8000, IP_ACTIVE_LOW, "SW2:1" ) /* Listed as "Always Off" */
PORT_START("UNK")
INPUT_PORTS_END
diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c
index 2ef48fe148c..67dcdddb719 100644
--- a/src/mame/drivers/ddragon.c
+++ b/src/mame/drivers/ddragon.c
@@ -62,10 +62,10 @@ Dip locations verified with manual for ddragon & ddragon2
#include "includes/ddragon.h"
-#define MAIN_CLOCK XTAL_12MHz
-#define SOUND_CLOCK XTAL_3_579545MHz
-#define MCU_CLOCK MAIN_CLOCK / 3
-#define PIXEL_CLOCK MAIN_CLOCK / 2
+#define MAIN_CLOCK XTAL_12MHz
+#define SOUND_CLOCK XTAL_3_579545MHz
+#define MCU_CLOCK MAIN_CLOCK / 3
+#define PIXEL_CLOCK MAIN_CLOCK / 2
/*************************************
@@ -164,13 +164,13 @@ MACHINE_RESET_MEMBER(ddragon_state,ddragon)
WRITE8_MEMBER(ddragon_state::ddragon_bankswitch_w)
{
/*
- 76543210
- .......x X-scroll D9 (H9BT)
- ......x. Y-scroll D9 (V9BT)
- .....x.. /Screen flip (*1P/2P)
- ....x... /Sub CPU reset (*RESET)
- ...x.... /Sub CPU halt (*HALT)
- xxx..... ROM bank (*BANK)
+ 76543210
+ .......x X-scroll D9 (H9BT)
+ ......x. Y-scroll D9 (V9BT)
+ .....x.. /Screen flip (*1P/2P)
+ ....x... /Sub CPU reset (*RESET)
+ ...x.... /Sub CPU halt (*HALT)
+ xxx..... ROM bank (*BANK)
*/
m_scrollx_hi = data & 0x01;
m_scrolly_hi = (data & 0x02) >> 1;
@@ -1682,7 +1682,7 @@ ROM_START( ddragon2 )
ROM_LOAD( "26j7-0.bin", 0x20000, 0x20000, CRC(bc6a48d5) SHA1(04c434f8cd42a8f82a263548183569396f9b684d) )
ROM_REGION( 0x0200, "proms", 0 )
- ROM_LOAD( "prom.16", 0x0000, 0x0200, CRC(46339529) SHA1(64f4c42a826d67b7cbaa8a23a45ebc4eb6248891) ) /* sprite timing (same as ddragon) */
+ ROM_LOAD( "prom.16", 0x0000, 0x0200, CRC(46339529) SHA1(64f4c42a826d67b7cbaa8a23a45ebc4eb6248891) ) /* sprite timing (same as ddragon) */
ROM_END
ROM_START( ddragon2u )
diff --git a/src/mame/drivers/de_3.c b/src/mame/drivers/de_3.c
index 65be1457a00..12ed8c83d84 100644
--- a/src/mame/drivers/de_3.c
+++ b/src/mame/drivers/de_3.c
@@ -67,8 +67,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(audio_nmi);
DECLARE_READ8_MEMBER(dmd_status_r);
-// DECLARE_READ8_MEMBER(sound_latch_r);
-// DECLARE_WRITE8_MEMBER(sample_bank_w);
+// DECLARE_READ8_MEMBER(sound_latch_r);
+// DECLARE_WRITE8_MEMBER(sample_bank_w);
required_device<decobsmt_device> m_decobsmt;
bool m_nmi_enable;
@@ -83,8 +83,8 @@ protected:
// driver_device overrides
virtual void machine_reset();
private:
-// UINT32 m_segment1;
-// UINT32 m_segment2;
+// UINT32 m_segment1;
+// UINT32 m_segment2;
UINT8 m_strobe;
UINT8 m_kbdrow;
UINT8 m_diag;
@@ -197,27 +197,27 @@ WRITE8_MEMBER( de_3_state::lamp0_w )
// 6821 PIA at 0x2800
WRITE8_MEMBER( de_3_state::dig0_w )
{
-// static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x58, 0x4c, 0x62, 0x69, 0x78, 0 }; // 7447
-// data &= 0x7f;
-// m_strobe = data & 15;
-// m_diag = (data & 0x70) >> 4;
-// output_set_digit_value(60, patterns[data>>4]); // diag digit
-// m_segment1 = 0;
-// m_segment2 = 0;
+// static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x58, 0x4c, 0x62, 0x69, 0x78, 0 }; // 7447
+// data &= 0x7f;
+// m_strobe = data & 15;
+// m_diag = (data & 0x70) >> 4;
+// output_set_digit_value(60, patterns[data>>4]); // diag digit
+// m_segment1 = 0;
+// m_segment2 = 0;
}
WRITE8_MEMBER( de_3_state::dig1_w )
{
-// m_segment2 |= data;
-// m_segment2 |= 0x30000;
-// if ((m_segment2 & 0x70000) == 0x30000)
-// {
-// if(m_is_alpha3) // Alphanumeric type 2 uses 7 segment LEDs on the bottom row, type 3 uses 14 segment LEDs
-// output_set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
-// else
-// output_set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
-// m_segment2 |= 0x40000;
-// }
+// m_segment2 |= data;
+// m_segment2 |= 0x30000;
+// if ((m_segment2 & 0x70000) == 0x30000)
+// {
+// if(m_is_alpha3) // Alphanumeric type 2 uses 7 segment LEDs on the bottom row, type 3 uses 14 segment LEDs
+// output_set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// else
+// output_set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
+// m_segment2 |= 0x40000;
+// }
}
READ8_MEMBER( de_3_state::pia28_w7_r )
@@ -244,13 +244,13 @@ WRITE8_MEMBER( de_3_state::pia2c_pa_w )
m_dmdtype1->data_w(space,offset,data);
logerror("DMD: Data write %02x\n", data);
}
-// m_segment1 |= (data<<8);
-// m_segment1 |= 0x10000;
-// if ((m_segment1 & 0x70000) == 0x30000)
-// {
-// output_set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
-// m_segment1 |= 0x40000;
-// }
+// m_segment1 |= (data<<8);
+// m_segment1 |= 0x10000;
+// if ((m_segment1 & 0x70000) == 0x30000)
+// {
+// output_set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// m_segment1 |= 0x40000;
+// }
}
READ8_MEMBER( de_3_state::pia2c_pb_r )
@@ -276,13 +276,13 @@ WRITE8_MEMBER( de_3_state::pia2c_pb_w )
logerror("DMD: Control write %02x\n", data);
}
-// m_segment1 |= data;
-// m_segment1 |= 0x20000;
-// if ((m_segment1 & 0x70000) == 0x30000)
-// {
-// output_set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
-// m_segment1 |= 0x40000;
-// }
+// m_segment1 |= data;
+// m_segment1 |= 0x20000;
+// if ((m_segment1 & 0x70000) == 0x30000)
+// {
+// output_set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// m_segment1 |= 0x40000;
+// }
}
@@ -310,13 +310,13 @@ WRITE8_MEMBER( de_3_state::switch_w )
WRITE8_MEMBER( de_3_state::pia34_pa_w )
{
// Not connected?
-// m_segment2 |= (data<<8);
-// m_segment2 |= 0x10000;
-// if ((m_segment2 & 0x70000) == 0x30000)
-// {
-// output_set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
-// m_segment2 |= 0x40000;
-// }
+// m_segment2 |= (data<<8);
+// m_segment2 |= 0x10000;
+// if ((m_segment2 & 0x70000) == 0x30000)
+// {
+// output_set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// m_segment2 |= 0x40000;
+// }
}
READ8_MEMBER( de_3_state::dmd_status_r )
diff --git a/src/mame/drivers/de_3b.c b/src/mame/drivers/de_3b.c
index cdad42eb506..888de9877e8 100644
--- a/src/mame/drivers/de_3b.c
+++ b/src/mame/drivers/de_3b.c
@@ -184,7 +184,7 @@ READ8_MEMBER(de_3b_state::display_r)
switch(offset)
{
case 0:
-// ret = pia28_w7_r(space,0);
+// ret = pia28_w7_r(space,0);
break;
case 3:
ret = pia2c_pb_r(space,0);
@@ -199,10 +199,10 @@ WRITE8_MEMBER(de_3b_state::display_w)
switch(offset)
{
case 0:
-// dig0_w(space,0,data);
+// dig0_w(space,0,data);
break;
case 1:
-// dig1_w(space,0,data);
+// dig1_w(space,0,data);
break;
case 2:
pia2c_pa_w(space,0,data);
@@ -211,7 +211,7 @@ WRITE8_MEMBER(de_3b_state::display_w)
pia2c_pb_w(space,0,data);
break;
case 4:
-// pia34_pa_w(space,0,data);
+// pia34_pa_w(space,0,data);
break;
}
}
diff --git a/src/mame/drivers/eprom.c b/src/mame/drivers/eprom.c
index 006040f4349..27cc60ae553 100644
--- a/src/mame/drivers/eprom.c
+++ b/src/mame/drivers/eprom.c
@@ -390,7 +390,7 @@ static MACHINE_CONFIG_START( eprom, eprom_state )
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
MCFG_MACHINE_RESET_OVERRIDE(eprom_state,eprom)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
@@ -430,7 +430,7 @@ static MACHINE_CONFIG_START( klaxp, eprom_state )
MCFG_QUANTUM_TIME(attotime::from_hz(600))
MCFG_MACHINE_RESET_OVERRIDE(eprom_state,eprom)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
@@ -469,7 +469,7 @@ static MACHINE_CONFIG_START( guts, eprom_state )
MCFG_QUANTUM_TIME(attotime::from_hz(600))
MCFG_MACHINE_RESET_OVERRIDE(eprom_state,eprom)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/exprraid.c b/src/mame/drivers/exprraid.c
index 69927a7d4dc..d2c634f8e6a 100644
--- a/src/mame/drivers/exprraid.c
+++ b/src/mame/drivers/exprraid.c
@@ -224,10 +224,10 @@ READ8_MEMBER(exprraid_state::exprraid_prot_data_r)
READ8_MEMBER(exprraid_state::exprraid_prot_status_r)
{
/*
- 76543210
- .......x ?
- ......x. Device data available
- .....x.. CPU data available (cleared by device)
+ 76543210
+ .......x ?
+ ......x. Device data available
+ .....x.. CPU data available (cleared by device)
*/
return 0x02;
diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c
index 3dd15bf53c7..855bb2bc37a 100644
--- a/src/mame/drivers/firebeat.c
+++ b/src/mame/drivers/firebeat.c
@@ -1783,10 +1783,10 @@ static MACHINE_CONFIG_START( firebeat, firebeat_state )
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
-// TODO: Hookup cdrom audio
-// MCFG_SOUND_MODIFY("scsi1:cdda")
-// MCFG_SOUND_ROUTE(0, "^^lspeaker", 1.0)
-// MCFG_SOUND_ROUTE(1, "^^rspeaker", 1.0)
+// TODO: Hookup cdrom audio
+// MCFG_SOUND_MODIFY("scsi1:cdda")
+// MCFG_SOUND_ROUTE(0, "^^lspeaker", 1.0)
+// MCFG_SOUND_ROUTE(1, "^^rspeaker", 1.0)
MCFG_PC16552D_ADD("duart_com", firebeat_com0_interface, firebeat_com1_interface, XTAL_19_6608MHz) // pgmd to 9600baud
MCFG_PC16552D_ADD("duart_midi", firebeat_midi0_interface, firebeat_midi1_interface, XTAL_24MHz) // in all memory maps, pgmd to 31250baud
diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c
index 54a3b0dd045..a698071b29f 100644
--- a/src/mame/drivers/freekick.c
+++ b/src/mame/drivers/freekick.c
@@ -439,7 +439,7 @@ static INPUT_PORTS_START( freekck )
PORT_DIPSETTING( 0x80, "1 Coin/50 Credits" )
PORT_START("DSW3")
- PORT_DIPNAME( 0x01, 0x00, "Manufacturer" ) PORT_DIPLOCATION("SW3:1") /* Set to "Sega" to show Japanese text on the "Continue" screen */
+ PORT_DIPNAME( 0x01, 0x00, "Manufacturer" ) PORT_DIPLOCATION("SW3:1") /* Set to "Sega" to show Japanese text on the "Continue" screen */
PORT_DIPSETTING( 0x00, "Nihon System" )
PORT_DIPSETTING( 0x01, "Sega/Nihon System" )
PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" )
diff --git a/src/mame/drivers/galaxia.c b/src/mame/drivers/galaxia.c
index 6ab745aed0f..dae5eadbccc 100644
--- a/src/mame/drivers/galaxia.c
+++ b/src/mame/drivers/galaxia.c
@@ -316,7 +316,7 @@ static MACHINE_CONFIG_START( galaxia, galaxia_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_S2636_ADD("s2636_2", galaxia_s2636_config[2])
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
-
+
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c
index 20c95999590..2465d8777f1 100644
--- a/src/mame/drivers/galaxold.c
+++ b/src/mame/drivers/galaxold.c
@@ -2853,7 +2853,7 @@ DRIVER_INIT_MEMBER(galaxold_state,ckonggx)
memcpy(buffer+i*0x100, rom+ckonggx_remap[i], 0x100);
}
-
+
memcpy(rom, buffer, 0x5800);
auto_free(machine(), buffer);
}
@@ -2864,7 +2864,7 @@ DRIVER_INIT_MEMBER(galaxold_state,ckonggx)
ROM_START( ckonggx )
ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "kk1.bin", 0x0000, 0x0800, CRC(615c1ddb) SHA1(68e8393da9041cf94692fc4b53b58c17086e4ebc) )
+ ROM_LOAD( "kk1.bin", 0x0000, 0x0800, CRC(615c1ddb) SHA1(68e8393da9041cf94692fc4b53b58c17086e4ebc) )
ROM_LOAD( "kk2.bin", 0x0800, 0x0800, CRC(72f259bc) SHA1(0afa349926f70b6c35da1dbb380ad2018f003d56) )
ROM_LOAD( "kk3.bin", 0x1000, 0x0800, CRC(17f5e9ac) SHA1(17218ca3582ff4498e0b2684781db24d528bff71) )
ROM_LOAD( "kk4.bin", 0x1800, 0x0800, CRC(7aeafd74) SHA1(b9382322367b3953498e8fbbe81b26b18cd7a745) )
@@ -2958,7 +2958,7 @@ ROM_START( ckongis )
ROM_LOAD( "dk5.bin", 0x3000, 0x1000, CRC(d8df2ec4) SHA1(bef1d4b404cddb8a5f9d4e3f30ee09915c602f56) )
ROM_LOAD( "dk6.bin", 0x4000, 0x1000, CRC(9ddcc06f) SHA1(63bc77d8b3273681ca4e681105a117d19a0f23a5) )
-// ROM_LOAD( "kk8.bin", 0x5000, 0x0800, CRC(8cd4bc17) SHA1(43c3f2575182c8f5233b9c6160aa9f41d772bb9d) ) // works if you use this rom from ckonggx but it's definitely not on the PCB
+// ROM_LOAD( "kk8.bin", 0x5000, 0x0800, CRC(8cd4bc17) SHA1(43c3f2575182c8f5233b9c6160aa9f41d772bb9d) ) // works if you use this rom from ckonggx but it's definitely not on the PCB
ROM_REGION( 0x2000, "gfx1", 0 )
ROM_LOAD( "1h.bin", 0x0000, 0x1000, CRC(7866d2cb) SHA1(62dd8b80bc0459c7337d8a8cb83e53b999e7f4a9) )
diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c
index 1bf85d36d43..83a4671d900 100644
--- a/src/mame/drivers/galpani2.c
+++ b/src/mame/drivers/galpani2.c
@@ -61,16 +61,16 @@ Z04G2-004
| 6116 6116 G003K5.U63 |------| |
|--------------------------------------------------------------------|
Notes:
- * - These ROMs not populated. Korean-specific ROMs have a K as part of the label text
- 68000 - Clock 13.500MHz [27/2]
- M6295 - Clock 2.000MHz [16/8]. Pin 7 HIGH
- V-080D - Custom Kaneko RGB DAC
- MC-1091 - Custom Kaneko I/O module
- LFP-6K - Custom Kaneko sound filter/DAC
- PX4460 - Custom Kaneko sound filter/DAC
- PISCES - NEC uPD78324 series MCU with 32k internal rom. Clock 13.500MHz [27/2] on pins 51 & 52
- VSync - 59.1856Hz
- HSync - 15.625kHz
+ * - These ROMs not populated. Korean-specific ROMs have a K as part of the label text
+ 68000 - Clock 13.500MHz [27/2]
+ M6295 - Clock 2.000MHz [16/8]. Pin 7 HIGH
+ V-080D - Custom Kaneko RGB DAC
+ MC-1091 - Custom Kaneko I/O module
+ LFP-6K - Custom Kaneko sound filter/DAC
+ PX4460 - Custom Kaneko sound filter/DAC
+ PISCES - NEC uPD78324 series MCU with 32k internal rom. Clock 13.500MHz [27/2] on pins 51 & 52
+ VSync - 59.1856Hz
+ HSync - 15.625kHz
***************************************************************************/
@@ -426,7 +426,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( galpani2 )
PORT_START("DSW1_P1") /* 780000.w */
- PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW B:8,7,6")
+ PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW B:8,7,6")
PORT_DIPSETTING( 0x0007, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0006, DEF_STR( Very_Easy ) )
PORT_DIPSETTING( 0x0005, DEF_STR( Easy ) )
@@ -435,15 +435,15 @@ static INPUT_PORTS_START( galpani2 )
PORT_DIPSETTING( 0x0002, DEF_STR( Very_Hard ) )
PORT_DIPSETTING( 0x0001, "Ultra Hard" )
PORT_DIPSETTING( 0x0000, "God Hands" )
- PORT_DIPNAME( 0x0008, 0x0008, "Picture Mode" ) PORT_DIPLOCATION("SW B:5")
+ PORT_DIPNAME( 0x0008, 0x0008, "Picture Mode" ) PORT_DIPLOCATION("SW B:5")
PORT_DIPSETTING( 0x0008, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0000, "Adult" )
- PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW B:4,3")
+ PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW B:4,3")
PORT_DIPSETTING( 0x0030, "3" )
PORT_DIPSETTING( 0x0020, "1" )
PORT_DIPSETTING( 0x0010, "4" )
PORT_DIPSETTING( 0x0000, "5" )
- PORT_DIPNAME( 0x00c0, 0x00c0, "Max Unit of Players" ) PORT_DIPLOCATION("SW B:2,1")
+ PORT_DIPNAME( 0x00c0, 0x00c0, "Max Unit of Players" ) PORT_DIPLOCATION("SW B:2,1")
PORT_DIPSETTING( 0x00c0, "9" )
PORT_DIPSETTING( 0x0080, "1" )
PORT_DIPSETTING( 0x0040, "4" )
@@ -459,7 +459,7 @@ static INPUT_PORTS_START( galpani2 )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
PORT_START("DSW2_P2") /* 780002.w */
- PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW A:8,7,6,5")
+ PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW A:8,7,6,5")
PORT_DIPSETTING( 0x000f, "1 Coin/1 Credit 1/1" )
PORT_DIPSETTING( 0x000e, "2 Coin/1 Credit 2/1" )
PORT_DIPSETTING( 0x000d, "3 Coin/1 Credit 3/1" )
@@ -476,13 +476,13 @@ static INPUT_PORTS_START( galpani2 )
PORT_DIPSETTING( 0x0002, "1 Coin/2 Credit 1/2" )
PORT_DIPSETTING( 0x0001, "1 Coin/3 Credit 1/3" )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x0010, 0x0010, "Card Dispenser" ) PORT_DIPLOCATION("SW A:4")
+ PORT_DIPNAME( 0x0010, 0x0010, "Card Dispenser" ) PORT_DIPLOCATION("SW A:4")
PORT_DIPSETTING( 0x0010, "Used" )
PORT_DIPSETTING( 0x0000, DEF_STR( Unused ) )
- PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW A:3")
+ PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW A:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:2")
+ PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:2")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0040, DEF_STR( On ) )
PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "SW A:1" )
@@ -528,7 +528,7 @@ static INPUT_PORTS_START( gp2se )
PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW B:5" ) // picture mode is "normal fix" and cannot be changed
PORT_MODIFY("DSW2_P2") /* 780002.w */
- PORT_DIPNAME( 0x0010, 0x0010, "Card Dispenser" ) PORT_DIPLOCATION("SW A:4") // Reversed compared to other sets.
+ PORT_DIPNAME( 0x0010, 0x0010, "Card Dispenser" ) PORT_DIPLOCATION("SW A:4") // Reversed compared to other sets.
PORT_DIPSETTING( 0x0000, "Used" )
PORT_DIPSETTING( 0x0010, DEF_STR( Unused ) )
diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c
index 9186f708018..f6fcff6f0ef 100644
--- a/src/mame/drivers/galpani3.c
+++ b/src/mame/drivers/galpani3.c
@@ -404,20 +404,20 @@ static INPUT_PORTS_START( galpani3 )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSW1") /* provided by the MCU - $200386.b <- $400200 */
- PORT_DIPNAME( 0x0100, 0x0100, "Test Mode" ) PORT_DIPLOCATION("DSW:1")
+ PORT_DIPNAME( 0x0100, 0x0100, "Test Mode" ) PORT_DIPLOCATION("DSW:1")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSW:2")
+ PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSW:2")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW:3")
+ PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW:3")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0400, DEF_STR( On ) )
PORT_DIPUNUSED_DIPLOC( 0x0800, IP_ACTIVE_LOW, "DSW:4" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x1000, IP_ACTIVE_LOW, "DSW:5" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x2000, IP_ACTIVE_LOW, "DSW:6" ) /* Listed as "Unused" */
PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "DSW:7" ) /* Listed as "Unused" */
- PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW:8") // unused ?
+ PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW:8") // unused ?
PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
INPUT_PORTS_END
diff --git a/src/mame/drivers/galpanic.c b/src/mame/drivers/galpanic.c
index 98afd5bebb6..608b188e214 100644
--- a/src/mame/drivers/galpanic.c
+++ b/src/mame/drivers/galpanic.c
@@ -796,7 +796,7 @@ ROM_START( newfant )
ROM_LOAD16_BYTE( "iscr7.06", 0x400001, 0x80000, CRC(2dee0c31) SHA1(1097006e6e5d16b24fb71615b6c0754fe0ecbe33) )
ROM_REGION( 0x80000, "gfx1", 0 ) /* sprites */
- ROM_LOAD( "nf95obj1.13", 0x00000, 0x80000, CRC(e6d1bc71) SHA1(df0b6c1742c01991196659bab2691230323e7b8d) )
+ ROM_LOAD( "nf95obj1.13", 0x00000, 0x80000, CRC(e6d1bc71) SHA1(df0b6c1742c01991196659bab2691230323e7b8d) )
ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */
/* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */
@@ -806,26 +806,26 @@ ROM_START( newfant )
ROM_END
ROM_START( newfanta )
- ROM_REGION( 0x500000, "maincpu", 0 ) /* 68000 code */
- ROM_LOAD16_BYTE( "prog2.12", 0x000000, 0x80000, CRC(de43a457) SHA1(91db13f63b46146131c58e775119ea3b073ca409) )
- ROM_LOAD16_BYTE( "prog1.07", 0x000001, 0x80000, CRC(370b45be) SHA1(775873df9d3af803dbd1a392a45cad5f37b1b1c7) )
- ROM_LOAD16_BYTE( "iscr2.10", 0x100000, 0x80000, CRC(4f2da2eb) SHA1(4f0b72327d1bdfad24d822953f45218bfae29cff) )
- ROM_LOAD16_BYTE( "iscr1.05", 0x100001, 0x80000, CRC(63c6894f) SHA1(213544da570a167f3411357308c576805f6882f3) )
- ROM_LOAD16_BYTE( "iscr4.09", 0x200000, 0x80000, CRC(725741ec) SHA1(3455cf0aed9653c66b8b2f905ad683687d517419) )
- ROM_LOAD16_BYTE( "iscr3.04", 0x200001, 0x80000, CRC(51d6b362) SHA1(bcd57643ac9d79c150714ec6b6a2bb8a24acf7a5) )
- ROM_LOAD16_BYTE( "iscr6.08", 0x300000, 0x80000, CRC(178b2ef3) SHA1(d3c092a282278968a319e06731481570f217d404) )
- ROM_LOAD16_BYTE( "iscr5.03", 0x300001, 0x80000, CRC(d2b5c5fa) SHA1(80fde69bc5f4e958b5d57a5179b6e601192780f4) )
- ROM_LOAD16_BYTE( "iscr8.11", 0x400000, 0x80000, CRC(f4148528) SHA1(4e27fff0b7ead068a159b3ed80c5793a6166fc4e) )
- ROM_LOAD16_BYTE( "iscr7.06", 0x400001, 0x80000, CRC(2dee0c31) SHA1(1097006e6e5d16b24fb71615b6c0754fe0ecbe33) )
-
- ROM_REGION( 0x80000, "gfx1", 0 ) /* sprites */
+ ROM_REGION( 0x500000, "maincpu", 0 ) /* 68000 code */
+ ROM_LOAD16_BYTE( "prog2.12", 0x000000, 0x80000, CRC(de43a457) SHA1(91db13f63b46146131c58e775119ea3b073ca409) )
+ ROM_LOAD16_BYTE( "prog1.07", 0x000001, 0x80000, CRC(370b45be) SHA1(775873df9d3af803dbd1a392a45cad5f37b1b1c7) )
+ ROM_LOAD16_BYTE( "iscr2.10", 0x100000, 0x80000, CRC(4f2da2eb) SHA1(4f0b72327d1bdfad24d822953f45218bfae29cff) )
+ ROM_LOAD16_BYTE( "iscr1.05", 0x100001, 0x80000, CRC(63c6894f) SHA1(213544da570a167f3411357308c576805f6882f3) )
+ ROM_LOAD16_BYTE( "iscr4.09", 0x200000, 0x80000, CRC(725741ec) SHA1(3455cf0aed9653c66b8b2f905ad683687d517419) )
+ ROM_LOAD16_BYTE( "iscr3.04", 0x200001, 0x80000, CRC(51d6b362) SHA1(bcd57643ac9d79c150714ec6b6a2bb8a24acf7a5) )
+ ROM_LOAD16_BYTE( "iscr6.08", 0x300000, 0x80000, CRC(178b2ef3) SHA1(d3c092a282278968a319e06731481570f217d404) )
+ ROM_LOAD16_BYTE( "iscr5.03", 0x300001, 0x80000, CRC(d2b5c5fa) SHA1(80fde69bc5f4e958b5d57a5179b6e601192780f4) )
+ ROM_LOAD16_BYTE( "iscr8.11", 0x400000, 0x80000, CRC(f4148528) SHA1(4e27fff0b7ead068a159b3ed80c5793a6166fc4e) )
+ ROM_LOAD16_BYTE( "iscr7.06", 0x400001, 0x80000, CRC(2dee0c31) SHA1(1097006e6e5d16b24fb71615b6c0754fe0ecbe33) )
+
+ ROM_REGION( 0x80000, "gfx1", 0 ) /* sprites */
ROM_LOAD( "obj1.13", 0x00000, 0x80000, CRC(832cd451) SHA1(29dfab1d4b7a15f3fe9fbedef41d405a40235a77) )
- ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */
- /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */
- ROM_LOAD( "musc1.01", 0x00000, 0x80000, CRC(10347fce) SHA1(f5fbe8ef363fe18b7104be5d2fa92943d1a5d7a2) )
- ROM_RELOAD( 0x40000, 0x80000 )
- ROM_LOAD( "musc2.02", 0xc0000, 0x80000, CRC(b9646a8c) SHA1(e9432261ac86e4251a2c97301c6d014c05110a9c) )
+ ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */
+ /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */
+ ROM_LOAD( "musc1.01", 0x00000, 0x80000, CRC(10347fce) SHA1(f5fbe8ef363fe18b7104be5d2fa92943d1a5d7a2) )
+ ROM_RELOAD( 0x40000, 0x80000 )
+ ROM_LOAD( "musc2.02", 0xc0000, 0x80000, CRC(b9646a8c) SHA1(e9432261ac86e4251a2c97301c6d014c05110a9c) )
ROM_END
ROM_START( missw96 )
diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c
index 82ae42c8b1e..fab3ad83363 100644
--- a/src/mame/drivers/gticlub.c
+++ b/src/mame/drivers/gticlub.c
@@ -289,7 +289,7 @@ public:
DECLARE_MACHINE_RESET(hangplt);
DECLARE_VIDEO_START(gticlub);
INTERRUPT_GEN_MEMBER(gticlub_vblank);
-
+
UINT32 screen_update_gticlub(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_hangplt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -297,8 +297,8 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
private:
void gticlub_led_setreg(int offset, UINT8 data);
-
- UINT8 gticlub_led_reg[2];
+
+ UINT8 gticlub_led_reg[2];
};
diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c
index 84f3527539d..80b3d55446b 100644
--- a/src/mame/drivers/harddriv.c
+++ b/src/mame/drivers/harddriv.c
@@ -1350,7 +1350,7 @@ static MACHINE_CONFIG_START( driver_nomsp, harddriv_state )
MCFG_MACHINE_START_OVERRIDE(harddriv_state,harddriv)
MCFG_MACHINE_RESET_OVERRIDE(harddriv_state,harddriv)
-// TODO: ZRAM is really an MK48T02 MCFG_MK48T02_ADD("zram")
+// TODO: ZRAM is really an MK48T02 MCFG_MK48T02_ADD("zram")
MCFG_NVRAM_ADD_1FILL("zram")
MCFG_DUARTN68681_ADD("duartn68681", XTAL_3_6864MHz, duart_config)
diff --git a/src/mame/drivers/klax.c b/src/mame/drivers/klax.c
index 5308fbddd39..c314cead2f5 100644
--- a/src/mame/drivers/klax.c
+++ b/src/mame/drivers/klax.c
@@ -162,7 +162,7 @@ static MACHINE_CONFIG_START( klax, klax_state )
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
MCFG_MACHINE_RESET_OVERRIDE(klax_state,klax)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c
index fff961fd51d..548a8691cef 100644
--- a/src/mame/drivers/ksys573.c
+++ b/src/mame/drivers/ksys573.c
@@ -760,7 +760,7 @@ TIMER_CALLBACK_MEMBER(ksys573_state::atapi_xfer_end)
{
UINT32 d = m_ata->read_cs0(space, (UINT32) 0, (UINT32) 0xffff) << 0;
d |= m_ata->read_cs0(space, (UINT32) 0, (UINT32) 0xffff) << 16;
-
+
m_p_n_psxram[ m_atapi_xferbase / 4 ] = d;
m_atapi_xferbase += 4;
m_atapi_xfersize--;
diff --git a/src/mame/drivers/laserbas.c b/src/mame/drivers/laserbas.c
index 8841d2a6866..6ab66630890 100644
--- a/src/mame/drivers/laserbas.c
+++ b/src/mame/drivers/laserbas.c
@@ -99,14 +99,14 @@ UINT32 laserbas_state::screen_update_laserbas(screen_device &screen, bitmap_ind1
if (m_flipscreen)
{
delta = -1;
- x0 = 256-1; x1 = -1;
- y0 = 256-1; y1 = -1;
+ x0 = 256-1; x1 = -1;
+ y0 = 256-1; y1 = -1;
}
else
{
delta = 1;
- x0 = 0; x1 = 256;
- y0 = 0; y1 = 256;
+ x0 = 0; x1 = 256;
+ y0 = 0; y1 = 256;
}
int pixaddr = 0;
@@ -114,10 +114,10 @@ UINT32 laserbas_state::screen_update_laserbas(screen_device &screen, bitmap_ind1
{
for (x = x0; x != x1; x += delta)
{
- UINT8 p1 = m_vram1[pixaddr/2];
- UINT8 p2 = m_vram2[pixaddr/2];
- UINT8 mask = (pixaddr & 1) ? 0xf0 : 0x0f;
- UINT8 shift = (pixaddr & 1) ? 4 : 0;
+ UINT8 p1 = m_vram1[pixaddr/2];
+ UINT8 p2 = m_vram2[pixaddr/2];
+ UINT8 mask = (pixaddr & 1) ? 0xf0 : 0x0f;
+ UINT8 shift = (pixaddr & 1) ? 4 : 0;
if (p2 & mask)
bitmap.pix16(y, x) = (p2 & mask) >> shift;
@@ -164,14 +164,14 @@ WRITE8_MEMBER(laserbas_state::vrambank_w)
READ8_MEMBER(laserbas_state::protram_r)
{
UINT8 prot = m_protram[offset];
-// prot = machine().rand();
-// logerror("%s: Z1 read %03x = %02x\n", machine().describe_context(), offset, prot);
+// prot = machine().rand();
+// logerror("%s: Z1 read %03x = %02x\n", machine().describe_context(), offset, prot);
return prot;
}
WRITE8_MEMBER(laserbas_state::protram_w)
{
-// logerror("%s: Z1 write %03x = %02x\n", machine().describe_context(), offset, data);
+// logerror("%s: Z1 write %03x = %02x\n", machine().describe_context(), offset, data);
m_protram[offset] = data;
}
@@ -222,41 +222,41 @@ static ADDRESS_MAP_START( laserbas_io, AS_IO, 8, laserbas_state )
ADDRESS_MAP_END
static INPUT_PORTS_START( laserbas )
- PORT_START("DSW") // $20
- PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPNAME( 0x02, 0x02, DEF_STR( Difficulty ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x04, "10k" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x00, "30k" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x08, DEF_STR( On ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_B ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_A ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x40, DEF_STR( 1C_3C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
- PORT_DIPSETTING( 0x00, DEF_STR( 1C_6C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_START("DSW") // $20
+ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPNAME( 0x02, 0x02, DEF_STR( Difficulty ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x04, "10k" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x00, "30k" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x08, DEF_STR( On ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_B ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_A ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x40, DEF_STR( 1C_3C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
+ PORT_DIPSETTING( 0x00, DEF_STR( 1C_6C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20)
// To do: split into separate switches (easier to debug as it is now though)
- PORT_DIPNAME( 0xff, 0xfe, "Service Mode Test" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0xfe, "S RAM CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0xfd, "D RAM CHECK F" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0xfb, "D RAM CHECK B" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0xf7, "ROM CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0xef, "CRT INVERT CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00) // press start 2
- PORT_DIPSETTING( 0xdf, "SWITCH CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0xbf, "COLOR CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
- PORT_DIPSETTING( 0x7f, "SOUND CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
-
- PORT_START("INPUTS") // $21
+ PORT_DIPNAME( 0xff, 0xfe, "Service Mode Test" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0xfe, "S RAM CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0xfd, "D RAM CHECK F" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0xfb, "D RAM CHECK B" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0xf7, "ROM CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0xef, "CRT INVERT CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00) // press start 2
+ PORT_DIPSETTING( 0xdf, "SWITCH CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0xbf, "COLOR CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+ PORT_DIPSETTING( 0x7f, "SOUND CHECK" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x00)
+
+ PORT_START("INPUTS") // $21
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
@@ -264,7 +264,7 @@ static INPUT_PORTS_START( laserbas )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // service coin
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // service coin
PORT_START("TRACK_X")
PORT_BIT( 0x1f, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_RESET
@@ -350,7 +350,7 @@ static MACHINE_CONFIG_START( laserbas, laserbas_state )
MCFG_CPU_PROGRAM_MAP(laserbas_memory)
MCFG_CPU_IO_MAP(laserbas_io)
MCFG_CPU_VBLANK_INT_DRIVER("screen", laserbas_state, irq0_line_hold)
-// MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi", laserbas_state, nmi_line_pulse, attotime::from_hz(60))
+// MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi", laserbas_state, nmi_line_pulse, attotime::from_hz(60))
MCFG_PIT8253_ADD("pit0", laserbas_pit8253_intf_0)
MCFG_PIT8253_ADD("pit1", laserbas_pit8253_intf_1)
diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c
index bf609cf7bc9..325b294ea72 100644
--- a/src/mame/drivers/malzak.c
+++ b/src/mame/drivers/malzak.c
@@ -364,7 +364,7 @@ static MACHINE_CONFIG_START( malzak, malzak_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_S2636_ADD("s2636_1", malzac_s2636_1_config)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
-
+
MCFG_SAA5050_ADD("saa5050", 6000000, malzac_saa5050_intf)
/* sound hardware */
diff --git a/src/mame/drivers/maygay1b.c b/src/mame/drivers/maygay1b.c
index af3f24e00a1..d55a6b42134 100644
--- a/src/mame/drivers/maygay1b.c
+++ b/src/mame/drivers/maygay1b.c
@@ -68,8 +68,8 @@
3x trimmer
- TODO: Convert to stock i8279 implementation, as currently inputs aren't read.
- Fix meter reading (possibly related to above)
+ TODO: Convert to stock i8279 implementation, as currently inputs aren't read.
+ Fix meter reading (possibly related to above)
******************************************************************************************/
#include "emu.h"
#include "includes/maygay1b.h"
@@ -741,7 +741,7 @@ WRITE8_MEMBER(maygay1b_state::m1_meter_w)
int i;
for (i=0; i<8; i++)
{
- if ( data & (1 << i) )
+ if ( data & (1 << i) )
{
MechMtr_update(i, data & (1 << i) );
m_meter = data;
@@ -804,7 +804,7 @@ READ8_MEMBER(maygay1b_state::m1_meter_r)
{
//ay8910_device *ay8910 = machine().device<ay8910_device>("aysnd");
//return ay8910->data_r(space, offset);
-
+
//TODO: Game should read the meter state through Port A of the AY chip, but our timings aren't good enough (?)
return m_meter;
}
diff --git a/src/mame/drivers/mjkjidai.c b/src/mame/drivers/mjkjidai.c
index c51afcb8883..f05d91a8d6c 100644
--- a/src/mame/drivers/mjkjidai.c
+++ b/src/mame/drivers/mjkjidai.c
@@ -63,7 +63,7 @@ void mjkjidai_adpcm_device::device_start()
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock(), this);
m_base = machine().root_device().memregion("adpcm")->base();
m_adpcm.reset();
-
+
save_item(NAME(m_current));
save_item(NAME(m_end));
save_item(NAME(m_nibble));
diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c
index 5cb45a6621e..c8cfe731587 100644
--- a/src/mame/drivers/mlanding.c
+++ b/src/mame/drivers/mlanding.c
@@ -97,25 +97,25 @@ public:
required_device<msm5205_device> m_msm2;
required_device<z80ctc_device> m_ctc;
- required_memory_bank m_dma_bank;
- required_memory_region m_msm1_rom;
- required_memory_region m_msm2_rom;
-
- required_shared_ptr<UINT16> m_g_ram;
- required_shared_ptr<UINT16> m_cha_ram;
- required_shared_ptr<UINT16> m_dot_ram;
- required_shared_ptr<UINT8> m_power_ram;
-
- UINT16 *m_dma_ram;
- UINT8 m_dma_cpu_bank;
- UINT8 m_dma_busy;
- UINT16 m_dsp_hold_signal;
-
- UINT32 m_msm_pos[2];
- UINT8 m_msm_reset[2];
- UINT8 m_msm_nibble[2];
- UINT8 m_msm2_vck;
- UINT8 m_msm2_vck2;
+ required_memory_bank m_dma_bank;
+ required_memory_region m_msm1_rom;
+ required_memory_region m_msm2_rom;
+
+ required_shared_ptr<UINT16> m_g_ram;
+ required_shared_ptr<UINT16> m_cha_ram;
+ required_shared_ptr<UINT16> m_dot_ram;
+ required_shared_ptr<UINT8> m_power_ram;
+
+ UINT16 *m_dma_ram;
+ UINT8 m_dma_cpu_bank;
+ UINT8 m_dma_busy;
+ UINT16 m_dsp_hold_signal;
+
+ UINT32 m_msm_pos[2];
+ UINT8 m_msm_reset[2];
+ UINT8 m_msm_nibble[2];
+ UINT8 m_msm2_vck;
+ UINT8 m_msm2_vck2;
virtual void machine_start();
virtual void machine_reset();
@@ -261,21 +261,21 @@ WRITE16_MEMBER(mlanding_state::dma_stop_w)
/*
- FEDCBA9876543210
+ FEDCBA9876543210
- 0 ...xxxxx xxxxxxxx Tile index
- ..x..... ........ Clear mode
- .x...... ........ Clear pixel/palette data
- x....... ........ Transparent/opaque mode
+ 0 ...xxxxx xxxxxxxx Tile index
+ ..x..... ........ Clear mode
+ .x...... ........ Clear pixel/palette data
+ x....... ........ Transparent/opaque mode
- 1 .......x xxxxxxxx X Coordinate
- xxxxx... ........ Width in 8x8 tiles
+ 1 .......x xxxxxxxx X Coordinate
+ xxxxx... ........ Width in 8x8 tiles
- 2 .......x xxxxxxxx Y Coordinate
- .....xx. ........ Unused
- xxxxx... ........ Height in 8x8 tiles
+ 2 .......x xxxxxxxx Y Coordinate
+ .....xx. ........ Unused
+ xxxxx... ........ Height in 8x8 tiles
- 3 ........ ....xxxx Colour
+ 3 ........ ....xxxx Colour
*/
UINT32 mlanding_state::exec_dma()
{
@@ -414,10 +414,10 @@ void mlanding_state::device_timer(emu_timer &timer, device_timer_id id, int para
READ16_MEMBER(mlanding_state::input_r)
{
/*
- FEDCBA98 76543210
- ........ xxxxxxxx DSWA
- .xxxxxxx ........ DSWB
- x....... ........ DMA busy
+ FEDCBA98 76543210
+ ........ xxxxxxxx DSWA
+ .xxxxxxx ........ DSWB
+ x....... ........ DMA busy
*/
UINT8 dswa = ioport("DSWA")->read();
@@ -429,15 +429,15 @@ READ16_MEMBER(mlanding_state::input_r)
WRITE16_MEMBER(mlanding_state::output_w)
{
/*
- 76543210
- x....... Start lamp?
- .x...... /Mecha CPU reset
- ..x..... ? (Briefly transitions from 1 to 0 at $5040, after pressing start)
- ...x.... /Sub CPU reset
- ....x... Coin counter B
- .....x.. Coin counter A
- ......x. /Coin lockout B
- .......x /Coin lockout A
+ 76543210
+ x....... Start lamp?
+ .x...... /Mecha CPU reset
+ ..x..... ? (Briefly transitions from 1 to 0 at $5040, after pressing start)
+ ...x.... /Sub CPU reset
+ ....x... Coin counter B
+ .....x.. Coin counter A
+ ......x. /Coin lockout B
+ .......x /Coin lockout A
*/
m_subcpu->set_input_line(INPUT_LINE_RESET, data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
m_mechacpu->set_input_line(INPUT_LINE_RESET, data & 0x40 ? CLEAR_LINE : ASSERT_LINE);
@@ -472,11 +472,11 @@ READ16_MEMBER(mlanding_state::analog3_msb_r)
READ16_MEMBER(mlanding_state::analog1_lsb_r)
{
/*
- 76543210
- ....xxxx Counter 1 bits 3-0
- ...x.... Handle left
- ..x..... Slot down
- .x...... Slot up
+ 76543210
+ ....xxxx Counter 1 bits 3-0
+ ...x.... Handle left
+ ..x..... Slot down
+ .x...... Slot up
*/
UINT16 throttle = ioport("THROTTLE")->read();
UINT16 x = ioport("STICK_X")->read();
@@ -498,8 +498,8 @@ READ16_MEMBER(mlanding_state::analog1_lsb_r)
READ16_MEMBER(mlanding_state::analog2_lsb_r)
{
/*
- 76543210
- ....xxxx Counter 2 bits 3-0
+ 76543210
+ ....xxxx Counter 2 bits 3-0
*/
return ioport("STICK_X")->read() & 0x0f;
}
@@ -508,11 +508,11 @@ READ16_MEMBER(mlanding_state::analog2_lsb_r)
READ16_MEMBER(mlanding_state::analog3_lsb_r)
{
/*
- 76543210
- ....xxxx Counter 3 bits 3-0
- ...x.... Handle up
- ..x..... Handle right
- .x...... Handle down
+ 76543210
+ ....xxxx Counter 3 bits 3-0
+ ...x.... Handle up
+ ..x..... Handle right
+ .x...... Handle down
*/
UINT16 x = ioport("STICK_X")->read();
UINT16 y = ioport("STICK_Y")->read();
@@ -546,8 +546,8 @@ READ16_MEMBER(mlanding_state::dsp_hold_signal_r)
WRITE16_MEMBER(mlanding_state::dsp_control_w)
{
/*
- 1 after zeroing 'dot' RAM
- 3 after uploading DSP program
+ 1 after zeroing 'dot' RAM
+ 3 after uploading DSP program
*/
m_dsp->set_input_line(INPUT_LINE_RESET, data & 0x2 ? CLEAR_LINE : ASSERT_LINE);
}
@@ -692,16 +692,16 @@ WRITE16_MEMBER(mlanding_state::power_ram_w)
READ8_MEMBER(mlanding_state::motor_r)
{
/*
- 9001: RIGHT MOTOR: 1F=UP, 00=STOP, 2F=DOWN
- 9003: LEFT MOTOR: 1F=UP, 00=STOP, 2F=DOWN
-
- 9800: xxxx .... - Counter R 3-0
- 9801: .... xxxx - Counter R 7-4
- ...x .... - SW R
- 9802: xxxx .... - Counter L 3-0
- 9803: .... xxxx - Counter L 7-4
- 9804: .... .... -
- 9805: ...x .... - SW L
+ 9001: RIGHT MOTOR: 1F=UP, 00=STOP, 2F=DOWN
+ 9003: LEFT MOTOR: 1F=UP, 00=STOP, 2F=DOWN
+
+ 9800: xxxx .... - Counter R 3-0
+ 9801: .... xxxx - Counter R 7-4
+ ...x .... - SW R
+ 9802: xxxx .... - Counter L 3-0
+ 9803: .... xxxx - Counter L 7-4
+ 9804: .... .... -
+ 9805: ...x .... - SW L
*/
return 0x10;
@@ -928,24 +928,24 @@ static const tc0140syt_interface mlanding_tc0140syt_intf =
static Z80CTC_INTERFACE( ctc_intf )
{
- DEVCB_NULL, // Interrupt handler
+ DEVCB_NULL, // Interrupt handler
DEVCB_DRIVER_LINE_MEMBER(mlanding_state, z80ctc_to0), // ZC/TO0 callback
DEVCB_NULL, // ZC/TO1 callback
- DEVCB_NULL // ZC/TO2 callback
+ DEVCB_NULL // ZC/TO2 callback
};
static const msm5205_interface msm5205_1_config =
{
DEVCB_DRIVER_LINE_MEMBER(mlanding_state, msm5205_1_vck), // VCK function
- MSM5205_S48_4B // 8 kHz, 4-bit
+ MSM5205_S48_4B // 8 kHz, 4-bit
};
static const msm5205_interface msm5205_2_config =
{
- DEVCB_NULL, // VCK function
- MSM5205_SEX_4B // Slave mode, 4-bit
+ DEVCB_NULL, // VCK function
+ MSM5205_SEX_4B // Slave mode, 4-bit
};
diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c
index bf2dcd655d3..c6aa69dc1f7 100644
--- a/src/mame/drivers/model2.c
+++ b/src/mame/drivers/model2.c
@@ -290,7 +290,7 @@ WRITE32_MEMBER(model2_state::copro_tgp_fifoout_push)
return;
}
-// logerror("COPRO FIFOOUT PUSH %08X, %f, %d\n", data, *(float*)&data,m_copro_fifoout_num);
+// logerror("COPRO FIFOOUT PUSH %08X, %f, %d\n", data, *(float*)&data,m_copro_fifoout_num);
m_copro_fifoout_data[m_copro_fifoout_wpos++] = data;
if (m_copro_fifoout_wpos == COPRO_FIFOOUT_SIZE)
diff --git a/src/mame/drivers/mpu5hw.c b/src/mame/drivers/mpu5hw.c
index 9d0a07179ad..1f49319c272 100644
--- a/src/mame/drivers/mpu5hw.c
+++ b/src/mame/drivers/mpu5hw.c
@@ -92,7 +92,6 @@ READ32_MEMBER(mpu5_state::mpu5_mem_r)
switch ( cs )
{
-
case 2:
if ((addr & 0xf0) == 0xf0)
{
@@ -144,7 +143,6 @@ WRITE32_MEMBER(mpu5_state::mpu5_mem_w)
switch ( cs )
{
-
case 2:
if ((addr & 0xf0) == 0xf0)
{
diff --git a/src/mame/drivers/mustache.c b/src/mame/drivers/mustache.c
index 94c260af16e..a4c36e52aff 100644
--- a/src/mame/drivers/mustache.c
+++ b/src/mame/drivers/mustache.c
@@ -174,7 +174,7 @@ static MACHINE_CONFIG_START( mustache, mustache_state )
MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK)
MCFG_CPU_PROGRAM_MAP(memmap)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mustache_state, mustache_scanline, "screen", 0, 1)
-
+
MCFG_T5182_ADD("t5182")
MCFG_FRAGMENT_ADD(t5182)
@@ -192,9 +192,9 @@ static MACHINE_CONFIG_START( mustache, mustache_state )
/* sound hardware */
MCFG_SEIBU_SOUND_ADD("seibu_sound") // for seibu_sound_decrypt on the MAIN cpu (not sound)
-
+
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_YM2151_ADD("ymsnd", YM_CLOCK)
MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("t5182", t5182_device, ym2151_irq_handler))
MCFG_SOUND_ROUTE(0, "mono", 1.0)
diff --git a/src/mame/drivers/namcond1.c b/src/mame/drivers/namcond1.c
index dac6159d764..620f820abbb 100644
--- a/src/mame/drivers/namcond1.c
+++ b/src/mame/drivers/namcond1.c
@@ -323,7 +323,7 @@ static MACHINE_CONFIG_START( namcond1, namcond1_state )
MCFG_SOUND_ROUTE(3, "lspeaker", 1.00)
MCFG_AT28C16_ADD( "at28c16", NULL )
-
+
MCFG_YGV608_ADD("ygv608")
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c
index 5c2e6bd8934..a41988b2892 100644
--- a/src/mame/drivers/namcos22.c
+++ b/src/mame/drivers/namcos22.c
@@ -138,8 +138,8 @@
* RR1.GAM (for Ridge Racer 1/2, Rave Racer)
**********************************************************************************************************
*
- *Namco Super System 22 Hardware Overview (last updated 21st
- *December 2012 at 7:15pm)
+ *Namco Super System 22 Hardware Overview (last updated 21st
+ *December 2012 at 7:15pm)
*---------------------------------------
*
*This document covers all the known Namco Super System 22 games, including....
@@ -883,8 +883,8 @@
*
*Game ROMs populated (All Intel E28F016SA TSOP56 16M FlashROMs)
*-----------------------------------------------------------------
- *Armadillo Racing F1E, F1J, F2E, F2J - CCRL/CCRH
- *ROMs (prototype or
+ *Armadillo Racing F1E, F1J, F2E, F2J - CCRL/CCRH
+ *ROMs (prototype or
*early test version)F4E, F4J, F5E, F5J, F6E, F6J, \
* F7E, F7J, F8E, F8J, F9E, F9J, \ CGx ROMs
* F11E, F11J, F12E, F12J /
@@ -1292,7 +1292,7 @@ WRITE8_MEMBER(namcos22_state::namcos22s_system_controller_w)
}
break;
}
-
+
// acknowledge irqs
case 0x04: // vblank
case 0x05: // hblank
@@ -1304,16 +1304,16 @@ WRITE8_MEMBER(namcos22_state::namcos22s_system_controller_w)
m_maincpu->set_input_line(m_syscontrol[offset-4] & 7, CLEAR_LINE);
break;
}
-
+
// watchdog
case 0x14:
break;
-
+
// reset mcu
case 0x16:
m_mcu->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE);
break;
-
+
// dsp control
case 0x1c:
if (data != m_syscontrol[0x1c])
@@ -1341,12 +1341,12 @@ WRITE8_MEMBER(namcos22_state::namcos22s_system_controller_w)
}
}
break;
-
+
// other regs: unknown
default:
break;
}
-
+
m_syscontrol[offset] = data;
}
@@ -1436,7 +1436,7 @@ WRITE8_MEMBER(namcos22_state::namcos22_system_controller_w)
}
break;
}
-
+
// acknowledge irqs
case 0x05: // unknown
case 0x06: // ?
@@ -1449,11 +1449,11 @@ WRITE8_MEMBER(namcos22_state::namcos22_system_controller_w)
m_maincpu->set_input_line(m_syscontrol[offset-5] & 7, CLEAR_LINE);
break;
}
-
+
// watchdog
case 0x16:
break;
-
+
// reset mcu
case 0x18:
m_mcu->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE);
@@ -1661,7 +1661,7 @@ WRITE32_MEMBER(namcos22_state::namcos22s_chipselect_w)
// other bits: no clue
if (ACCESSING_BITS_16_23)
m_chipselect = data >> 16;
-
+
// 8-bit access? (see alpinerd)
else if (ACCESSING_BITS_24_31)
m_chipselect = data >> 24;
@@ -1987,7 +1987,7 @@ void namcos22_state::slave_enable()
READ16_MEMBER(namcos22_state::namcos22_dspram16_r)
{
UINT32 value = m_polygonram[offset];
-
+
switch (m_dspram_bank)
{
case 0:
@@ -2006,7 +2006,7 @@ READ16_MEMBER(namcos22_state::namcos22_dspram16_r)
default:
break;
}
-
+
return (UINT16)value;
}
@@ -2034,7 +2034,7 @@ WRITE16_MEMBER(namcos22_state::namcos22_dspram16_w)
default:
break;
}
-
+
m_polygonram[offset] = (hi << 16) | lo;
}
@@ -2246,7 +2246,7 @@ READ16_MEMBER(namcos22_state::pdp_begin_r)
}
}
}
-
+
return 0;
}
@@ -3681,7 +3681,7 @@ void namcos22_state::machine_reset()
m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
-
+
m_poly->reset();
}
@@ -3799,7 +3799,7 @@ static MACHINE_CONFIG_DERIVED( alpine, namcos22s )
/* basic machine hardware */
MCFG_CPU_MODIFY("mcu")
MCFG_CPU_IO_MAP(alpine_io_map)
-
+
MCFG_TIMER_DRIVER_ADD("motor_timer", namcos22_state, alpine_steplock_callback)
MACHINE_CONFIG_END
@@ -3822,7 +3822,7 @@ static MACHINE_CONFIG_DERIVED( propcycl, namcos22s )
/* basic machine hardware */
MCFG_CPU_MODIFY("mcu")
MCFG_CPU_IO_MAP(propcycl_io_map)
-
+
MCFG_TIMER_DRIVER_ADD_PERIODIC("pc_p_upd", namcos22_state, propcycl_pedal_update, attotime::from_msec(20))
MCFG_TIMER_DRIVER_ADD("pc_p_int", namcos22_state, propcycl_pedal_interrupt)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c
index 7b3b93d32ce..d4319763489 100644
--- a/src/mame/drivers/naomi.c
+++ b/src/mame/drivers/naomi.c
@@ -67,8 +67,8 @@ TODO (general):
TODO (game-specific):
- 18 Wheeler Deluxe: "MOTOR NETWORK ERR IN 01 OUT FF" msg pops up during gameplay;
- Airline Pilots Deluxe: returns error 03
- - Capcom vs. SNK Pro: doesn't accept start input (REGRESSION)
- - Derby Owner Club: if you try to start a game, it moans about something and enters into some kind of JP test mode, pretty bogus behaviour;
+ - Capcom vs. SNK Pro: doesn't accept start input (REGRESSION)
+ - Derby Owner Club: if you try to start a game, it moans about something and enters into some kind of JP test mode, pretty bogus behaviour;
- Ferrari 355 Challenge: dies at the network check;
- Giant Gram 2: no VMU emulation;
- Gun Survivor 2: crashes during game loading;
diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c
index eda167c82aa..6424f93c545 100644
--- a/src/mame/drivers/nmk16.c
+++ b/src/mame/drivers/nmk16.c
@@ -3683,7 +3683,7 @@ static MACHINE_CONFIG_START( mustang, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
@@ -3757,7 +3757,7 @@ static MACHINE_CONFIG_START( bioship, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, BIOSHIP_CRYSTAL2 / 8) /* 1.5 Mhz (verified) */
@@ -3799,7 +3799,7 @@ static MACHINE_CONFIG_START( vandyke, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/8) /* verified on pcb */
@@ -3844,7 +3844,7 @@ static MACHINE_CONFIG_START( vandykeb, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_OKIM6295_ADD("oki1", 16000000/4, OKIM6295_PIN7_LOW)
@@ -3875,7 +3875,7 @@ static MACHINE_CONFIG_START( acrobatm, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) /* (verified on pcb) */
@@ -3949,7 +3949,7 @@ static MACHINE_CONFIG_START( tdragon, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/8) /* verified on pcb */
@@ -4024,7 +4024,7 @@ static MACHINE_CONFIG_START( strahl, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
@@ -4067,7 +4067,7 @@ static MACHINE_CONFIG_START( hachamf, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
@@ -4109,7 +4109,7 @@ static MACHINE_CONFIG_START( macross, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
@@ -4151,7 +4151,7 @@ static MACHINE_CONFIG_START( blkheart, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/8 ) /* verified on pcb */
@@ -4193,7 +4193,7 @@ static MACHINE_CONFIG_START( gunnail, nmk16_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
-
+
MCFG_NMK004_ADD("nmk004")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
diff --git a/src/mame/drivers/offtwall.c b/src/mame/drivers/offtwall.c
index 300c783f0a7..d9a6425066b 100644
--- a/src/mame/drivers/offtwall.c
+++ b/src/mame/drivers/offtwall.c
@@ -362,7 +362,7 @@ static MACHINE_CONFIG_START( offtwall, offtwall_state )
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_MACHINE_RESET_OVERRIDE(offtwall_state,offtwall)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/panicr.c b/src/mame/drivers/panicr.c
index f1be175d0cc..08d44f4e85f 100644
--- a/src/mame/drivers/panicr.c
+++ b/src/mame/drivers/panicr.c
@@ -74,7 +74,7 @@ public:
m_textram(*this, "textram"),
m_spritebank(*this, "spritebank"),
m_maincpu(*this, "maincpu"),
- m_t5182(*this, "t5182") { }
+ m_t5182(*this, "t5182") { }
required_shared_ptr<UINT8> m_mainram;
required_shared_ptr<UINT8> m_spriteram;
@@ -289,8 +289,8 @@ UINT32 panicr_state::screen_update_panicr(screen_device &screen, bitmap_ind16 &b
m_bgtilemap->set_scrollx(0, m_scrollx);
m_bgtilemap->draw(screen, *m_temprender, m_tempbitmap_clip, 0,0);
-// m_infotilemap_2->set_scrollx(0, m_scrollx);
-// m_infotilemap_2->draw(screen, *m_temprender, m_tempbitmap_clip, 0,0);
+// m_infotilemap_2->set_scrollx(0, m_scrollx);
+// m_infotilemap_2->draw(screen, *m_temprender, m_tempbitmap_clip, 0,0);
bitmap.fill(get_black_pen(machine()), cliprect);
@@ -619,7 +619,7 @@ static MACHINE_CONFIG_START( panicr, panicr_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(32*8, 32*8)
-// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
+// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(panicr_state, screen_update_panicr)
diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c
index 2de16eaedb0..02ef7a224f8 100644
--- a/src/mame/drivers/polepos.c
+++ b/src/mame/drivers/polepos.c
@@ -537,7 +537,7 @@ static INPUT_PORTS_START( polepos )
PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
PORT_START("DSWA")
- PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
+ PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
@@ -546,17 +546,17 @@ static INPUT_PORTS_START( polepos )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_6C ) )
- PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5")
+ PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5")
PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
- PORT_DIPNAME( 0x60, 0x60, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW1:6,7")
+ PORT_DIPNAME( 0x60, 0x60, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW1:6,7")
PORT_DIPSETTING( 0x60, "90 secs." )
PORT_DIPSETTING( 0x20, "100 secs." )
PORT_DIPSETTING( 0x40, "110 secs." )
PORT_DIPSETTING( 0x00, "120 secs." )
- PORT_DIPNAME( 0x80, 0x80, "Racing Laps" ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPNAME( 0x80, 0x80, "Racing Laps" ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, "3" ) /* Manufacturer's recommended settings for Upright cabinet */
PORT_DIPSETTING( 0x00, "4" ) /* Manufacturer's recommended settings for Sit-Down cabinet */
@@ -564,7 +564,7 @@ static INPUT_PORTS_START( polepos )
PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA")
PORT_START("DSWB")
- PORT_DIPNAME( 0x07, 0x03, "Extended Rank" ) PORT_DIPLOCATION("SW2:1,2,3")
+ PORT_DIPNAME( 0x07, 0x03, "Extended Rank" ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x07, "A" )
PORT_DIPSETTING( 0x03, "B" )
PORT_DIPSETTING( 0x05, "C" )
@@ -573,7 +573,7 @@ static INPUT_PORTS_START( polepos )
PORT_DIPSETTING( 0x02, "F" )
PORT_DIPSETTING( 0x04, "G" )
PORT_DIPSETTING( 0x00, "H" )
- PORT_DIPNAME( 0x38, 0x28, "Practice Rank" ) PORT_DIPLOCATION("SW2:4,5,6")
+ PORT_DIPNAME( 0x38, 0x28, "Practice Rank" ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x38, "A" )
PORT_DIPSETTING( 0x18, "B" )
PORT_DIPSETTING( 0x28, "C" )
@@ -582,10 +582,10 @@ static INPUT_PORTS_START( polepos )
PORT_DIPSETTING( 0x10, "F" )
PORT_DIPSETTING( 0x20, "G" )
PORT_DIPSETTING( 0x00, "H" )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") /* Is MPH or Km/H for "English" regions, but only Km/H for Japan ;-) */
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") /* Is MPH or Km/H for "English" regions, but only Km/H for Japan ;-) */
PORT_DIPSETTING( 0x40, DEF_STR( Off) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8")
+ PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ))
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -607,7 +607,7 @@ static INPUT_PORTS_START( poleposa )
PORT_INCLUDE( polepos )
PORT_MODIFY("DSWA")
- PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
+ PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
PORT_DIPSETTING( 0xc0, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_2C ) )
@@ -616,22 +616,22 @@ static INPUT_PORTS_START( poleposa )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5")
+ PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5")
PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
- PORT_DIPNAME( 0x06, 0x06, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW1:6,7")
+ PORT_DIPNAME( 0x06, 0x06, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW1:6,7")
PORT_DIPSETTING( 0x06, "90 secs." )
PORT_DIPSETTING( 0x02, "100 secs." )
PORT_DIPSETTING( 0x04, "110 secs." )
PORT_DIPSETTING( 0x00, "120 secs." )
- PORT_DIPNAME( 0x01, 0x01, "Racing Laps" ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPNAME( 0x01, 0x01, "Racing Laps" ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x01, "3" ) /* Manufacturer's recommended settings for Upright cabinet */
PORT_DIPSETTING( 0x00, "4" ) /* Manufacturer's recommended settings for Sit-Down cabinet */
PORT_MODIFY("DSWB")
- PORT_DIPNAME( 0xe0, 0x60, "Practice Rank" ) PORT_DIPLOCATION("SW2:1,2,3")
+ PORT_DIPNAME( 0xe0, 0x60, "Practice Rank" ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0xe0, "A" )
PORT_DIPSETTING( 0x60, "B" )
PORT_DIPSETTING( 0xa0, "C" )
@@ -640,7 +640,7 @@ static INPUT_PORTS_START( poleposa )
PORT_DIPSETTING( 0x40, "F" )
PORT_DIPSETTING( 0x80, "G" )
PORT_DIPSETTING( 0x00, "H" )
- PORT_DIPNAME( 0x1c, 0x14, "Extended Rank" ) PORT_DIPLOCATION("SW2:4,5,6")
+ PORT_DIPNAME( 0x1c, 0x14, "Extended Rank" ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x1c, "A" )
PORT_DIPSETTING( 0x0c, "B" )
PORT_DIPSETTING( 0x14, "C" )
@@ -649,10 +649,10 @@ static INPUT_PORTS_START( poleposa )
PORT_DIPSETTING( 0x08, "F" )
PORT_DIPSETTING( 0x10, "G" )
PORT_DIPSETTING( 0x00, "H" )
- PORT_DIPNAME( 0x02, 0x00, "Speed Unit" ) PORT_DIPLOCATION("SW2:7") /* MPH as per Atari manuals for the US regions */
+ PORT_DIPNAME( 0x02, 0x00, "Speed Unit" ) PORT_DIPLOCATION("SW2:7") /* MPH as per Atari manuals for the US regions */
PORT_DIPSETTING( 0x00, "mph" )
PORT_DIPSETTING( 0x02, "km/h" )
- PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8")
+ PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ))
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
@@ -746,7 +746,7 @@ static INPUT_PORTS_START( polepos2 )
PORT_INCLUDE( polepos )
PORT_MODIFY("DSWA")
- PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
+ PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
PORT_DIPSETTING( 0xc0, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_2C ) )
@@ -755,41 +755,41 @@ static INPUT_PORTS_START( polepos2 )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5")
+ PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5")
PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
- PORT_DIPNAME( 0x04, 0x00, "Speed Unit" ) PORT_DIPLOCATION("SW1:6") /* Set defualt to MPH for "English" regions */
+ PORT_DIPNAME( 0x04, 0x00, "Speed Unit" ) PORT_DIPLOCATION("SW1:6") /* Set defualt to MPH for "English" regions */
PORT_DIPSETTING( 0x00, "mph" )
PORT_DIPSETTING( 0x04, "km/h" )
- PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
+ PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ))
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
- PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") /* docs say "freeze", but it doesn't seem to work */
+ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") /* docs say "freeze", but it doesn't seem to work */
PORT_DIPSETTING( 0x01, DEF_STR( Off ))
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_MODIFY("DSWB")
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW2:1")
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW2:1")
PORT_DIPSETTING( 0x80, "90 secs." )
PORT_DIPSETTING( 0x00, "120 secs." )
- PORT_DIPNAME( 0x60, 0x60, "Practice Rank" ) PORT_DIPLOCATION("SW2:2,3")
+ PORT_DIPNAME( 0x60, 0x60, "Practice Rank" ) PORT_DIPLOCATION("SW2:2,3")
PORT_DIPSETTING( 0x20, "A" )
PORT_DIPSETTING( 0x60, "B" )
PORT_DIPSETTING( 0x40, "C" )
PORT_DIPSETTING( 0x00, "D" )
- PORT_DIPNAME( 0x18, 0x18, "Extended Rank" ) PORT_DIPLOCATION("SW2:4,5")
+ PORT_DIPNAME( 0x18, 0x18, "Extended Rank" ) PORT_DIPLOCATION("SW2:4,5")
PORT_DIPSETTING( 0x08, "A" )
PORT_DIPSETTING( 0x18, "B" )
PORT_DIPSETTING( 0x10, "C" )
PORT_DIPSETTING( 0x00, "D" )
- PORT_DIPNAME( 0x06, 0x06, "Goal" ) PORT_DIPLOCATION("SW2:6,7")
+ PORT_DIPNAME( 0x06, 0x06, "Goal" ) PORT_DIPLOCATION("SW2:6,7")
PORT_DIPSETTING( 0x02, "3" )
PORT_DIPSETTING( 0x06, "4" )
PORT_DIPSETTING( 0x04, "5" )
PORT_DIPSETTING( 0x00, "6" )
- PORT_DIPNAME( 0x01, 0x01, "Speed" ) PORT_DIPLOCATION("SW2:8")
+ PORT_DIPNAME( 0x01, 0x01, "Speed" ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x01, "Average" )
PORT_DIPSETTING( 0x00, DEF_STR( High ) )
INPUT_PORTS_END
@@ -799,7 +799,7 @@ static INPUT_PORTS_START( polepos2j )
PORT_INCLUDE( polepos2 )
PORT_MODIFY("DSWA")
- PORT_DIPNAME( 0x04, 0x04, "Speed Unit" ) PORT_DIPLOCATION("SW1:6") /* Set defualt to km/h for Japan */
+ PORT_DIPNAME( 0x04, 0x04, "Speed Unit" ) PORT_DIPLOCATION("SW1:6") /* Set defualt to km/h for Japan */
PORT_DIPSETTING( 0x00, "mph" )
PORT_DIPSETTING( 0x04, "km/h" )
INPUT_PORTS_END
diff --git a/src/mame/drivers/r2dx_v33.c b/src/mame/drivers/r2dx_v33.c
index 2febef0a023..f9361aa3373 100644
--- a/src/mame/drivers/r2dx_v33.c
+++ b/src/mame/drivers/r2dx_v33.c
@@ -40,11 +40,11 @@ public:
required_shared_ptr<UINT16> m_md_vram;
required_shared_ptr<UINT16> m_fg_vram;
required_shared_ptr<UINT16> m_tx_vram;
-
+
required_device<cpu_device> m_maincpu;
optional_device<seibu_sound_device> m_seibu_sound;
optional_device<eeprom_serial_93cxx_device> m_eeprom;
-
+
DECLARE_WRITE16_MEMBER(rdx_bg_vram_w);
DECLARE_WRITE16_MEMBER(rdx_md_vram_w);
DECLARE_WRITE16_MEMBER(rdx_fg_vram_w);
diff --git a/src/mame/drivers/raiden2.c b/src/mame/drivers/raiden2.c
index 348c8be91f7..19f5d8445ac 100644
--- a/src/mame/drivers/raiden2.c
+++ b/src/mame/drivers/raiden2.c
@@ -1175,7 +1175,7 @@ MACHINE_RESET_MEMBER(raiden2_state,raiden2)
{
common_reset();
sprcpt_init();
-
+
membank("mainbank")->set_entry(1);
prg_bank = 0;
@@ -1186,7 +1186,7 @@ MACHINE_RESET_MEMBER(raiden2_state,raidendx)
{
common_reset();
sprcpt_init();
-
+
membank("mainbank")->set_entry(8);
prg_bank = 0x08;
@@ -1200,7 +1200,7 @@ MACHINE_RESET_MEMBER(raiden2_state,zeroteam)
fg_bank = 2;
mid_bank = 1;
sprcpt_init();
-
+
membank("mainbank")->set_entry(1);
prg_bank = 0;
@@ -1213,7 +1213,7 @@ MACHINE_RESET_MEMBER(raiden2_state,xsedae)
fg_bank = 2;
mid_bank = 1;
sprcpt_init();
-
+
//membank("mainbank")->set_entry(1);
//cop_init();
diff --git a/src/mame/drivers/rampart.c b/src/mame/drivers/rampart.c
index 3b7b0822336..9e9312713c2 100644
--- a/src/mame/drivers/rampart.c
+++ b/src/mame/drivers/rampart.c
@@ -338,7 +338,7 @@ static MACHINE_CONFIG_START( rampart, rampart_state )
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
MCFG_MACHINE_RESET_OVERRIDE(rampart_state,rampart)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
MCFG_WATCHDOG_VBLANK_INIT(8)
diff --git a/src/mame/drivers/relief.c b/src/mame/drivers/relief.c
index a7c5d3fa90a..5c7342b01b6 100644
--- a/src/mame/drivers/relief.c
+++ b/src/mame/drivers/relief.c
@@ -265,7 +265,7 @@ static MACHINE_CONFIG_START( relief, relief_state )
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_MACHINE_RESET_OVERRIDE(relief_state,relief)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/renegade.c b/src/mame/drivers/renegade.c
index 8d69e82ce9c..d3629e6373c 100644
--- a/src/mame/drivers/renegade.c
+++ b/src/mame/drivers/renegade.c
@@ -144,7 +144,7 @@ void renegade_adpcm_device::device_start()
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock(), this);
m_base = machine().root_device().memregion("adpcm")->base();
m_adpcm.reset();
-
+
save_item(NAME(m_current));
save_item(NAME(m_end));
save_item(NAME(m_nibble));
diff --git a/src/mame/drivers/sandscrp.c b/src/mame/drivers/sandscrp.c
index d77984371bf..75f2b6e2aad 100644
--- a/src/mame/drivers/sandscrp.c
+++ b/src/mame/drivers/sandscrp.c
@@ -374,29 +374,29 @@ static INPUT_PORTS_START( sandscrp )
PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1") /* read by the Z80 through the sound chip */
- PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
+ PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x02, "1" )
PORT_DIPSETTING( 0x01, "2" )
PORT_DIPSETTING( 0x03, "3" )
PORT_DIPSETTING( 0x00, "5" )
- PORT_DIPNAME( 0x0c, 0x0c, "Bombs" ) PORT_DIPLOCATION("SW1:3,4")
+ PORT_DIPNAME( 0x0c, 0x0c, "Bombs" ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x08, "1" )
PORT_DIPSETTING( 0x04, "2" )
PORT_DIPSETTING( 0x0c, "3" )
PORT_DIPSETTING( 0x00, "5" )
- PORT_DIPNAME( 0x30, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5,6")
+ PORT_DIPNAME( 0x30, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5,6")
PORT_DIPSETTING( 0x30, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x20, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x10, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
- PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:7,8")
+ PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:7,8")
PORT_DIPSETTING( 0x80, "100K, 300K" )
PORT_DIPSETTING( 0xc0, "200K, 500K" )
PORT_DIPSETTING( 0x40, "500K, 1000K" )
PORT_DIPSETTING( 0x00, "1000K, 3000K" )
PORT_START("DSW2") /* read by the Z80 through the sound chip */
- PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
+ PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
PORT_DIPSETTING( 0x0a, DEF_STR( 6C_1C ) )
PORT_DIPSETTING( 0x0b, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 4C_1C ) )
@@ -413,13 +413,13 @@ static INPUT_PORTS_START( sandscrp )
PORT_DIPSETTING( 0x06, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:5")
+ PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:6")
+ PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" )
diff --git a/src/mame/drivers/seabattl.c b/src/mame/drivers/seabattl.c
index a9d53c07b95..72ff774eab6 100644
--- a/src/mame/drivers/seabattl.c
+++ b/src/mame/drivers/seabattl.c
@@ -525,7 +525,7 @@ static MACHINE_CONFIG_START( seabattl, seabattl_state )
MCFG_S2636_ADD("s2636", s2636_config)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
-
+
MCFG_DM9368_ADD("sc_thousand", digit_score_thousand_intf)
MCFG_DM9368_ADD("sc_hundred", digit_score_hundred_intf)
MCFG_DM9368_ADD("sc_half", digit_score_half_a_score_intf)
diff --git a/src/mame/drivers/sfbonus.c b/src/mame/drivers/sfbonus.c
index b6671315868..01e33f2fb2b 100644
--- a/src/mame/drivers/sfbonus.c
+++ b/src/mame/drivers/sfbonus.c
@@ -5538,7 +5538,7 @@ ROM_END
ROM3 429D
ROM4 AA27
ROM5 C409
- ROM6 59B6
+ ROM6 59B6
Note: ROM5 & ROM6 graphics roms were updated at some point to correct the misspelling of
POINT on the play field, currently it's "PONIT". Theses are currently undumped.
diff --git a/src/mame/drivers/shanghai.c b/src/mame/drivers/shanghai.c
index ff3c949da24..5021eef052b 100644
--- a/src/mame/drivers/shanghai.c
+++ b/src/mame/drivers/shanghai.c
@@ -34,7 +34,7 @@ public:
shanghai_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_hd63484(*this, "hd63484") { }
+ m_hd63484(*this, "hd63484") { }
DECLARE_WRITE16_MEMBER(shanghai_coin_w);
DECLARE_READ16_MEMBER(kothello_hd63484_status_r);
diff --git a/src/mame/drivers/skimaxx.c b/src/mame/drivers/skimaxx.c
index c26e90b3ad1..e10b2f975b7 100644
--- a/src/mame/drivers/skimaxx.c
+++ b/src/mame/drivers/skimaxx.c
@@ -533,7 +533,7 @@ static MACHINE_CONFIG_START( skimaxx, skimaxx_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_SIZE(0x400, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0, 0x280-1, 0, 0xf0-1)
- MCFG_SCREEN_UPDATE_DEVICE("tms", tms34010_device, tms340x0_ind16)
+ MCFG_SCREEN_UPDATE_DEVICE("tms", tms34010_device, tms340x0_ind16)
// MCFG_GFXDECODE( skimaxx )
diff --git a/src/mame/drivers/skullxbo.c b/src/mame/drivers/skullxbo.c
index 8f44926914b..71309268aa0 100644
--- a/src/mame/drivers/skullxbo.c
+++ b/src/mame/drivers/skullxbo.c
@@ -228,7 +228,7 @@ static MACHINE_CONFIG_START( skullxbo, skullxbo_state )
MCFG_TIMER_DRIVER_ADD("scan_timer", skullxbo_state, scanline_timer)
MCFG_MACHINE_RESET_OVERRIDE(skullxbo_state,skullxbo)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/drivers/snk68.c b/src/mame/drivers/snk68.c
index d22c1475073..a6aba9ec40d 100644
--- a/src/mame/drivers/snk68.c
+++ b/src/mame/drivers/snk68.c
@@ -214,46 +214,46 @@ static INPUT_PORTS_START( pow )
PORT_START("DSW1")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:!8,!7")
+ PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:!8,!7")
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0200, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0100, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0300, DEF_STR( 1C_4C ) )
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:!6,!5")
PORT_DIPSETTING( 0x0c00, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0800, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
- PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!4")
+ PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!4")
PORT_DIPSETTING( 0x0000, "2" )
PORT_DIPSETTING( 0x1000, "3" )
- PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!3")
+ PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!3")
PORT_DIPSETTING( 0x0000, "1st & 2nd only" )
PORT_DIPSETTING( 0x2000, "1st & every 2nd" )
- PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:!2")
+ PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:!2")
PORT_DIPSETTING( 0x0000, DEF_STR( English ) )
PORT_DIPSETTING( 0x4000, DEF_STR( Japanese ) )
- PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
+ PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x8000, DEF_STR( On ) )
PORT_START("DSW2")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE_DIPLOC( 0x0100, IP_ACTIVE_HIGH, "SW2:!8" )
- PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
+ PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
PORT_DIPSETTING( 0x0200, DEF_STR( No ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Yes ) )
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
PORT_DIPSETTING( 0x0000, "20k 50k" )
PORT_DIPSETTING( 0x0800, "40k 100k" )
PORT_DIPSETTING( 0x0400, "60k 150k" )
PORT_DIPSETTING( 0x0c00, DEF_STR( None ) )
- PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
+ PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
PORT_DIPSETTING( 0x2000, "Demo Sounds Off" )
PORT_DIPSETTING( 0x0000, "Demo Sounds On" )
PORT_DIPSETTING( 0x3000, "Freeze" )
PORT_DIPSETTING( 0x1000, "Infinite Lives (Cheat)")
- PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
+ PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
PORT_DIPSETTING( 0x8000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x4000, DEF_STR( Hard ) )
@@ -302,46 +302,46 @@ static INPUT_PORTS_START( searchar )
PORT_START("DSW1")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Joystick ) ) PORT_DIPLOCATION("SW1:!8")
+ PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Joystick ) ) PORT_DIPLOCATION("SW1:!8")
PORT_DIPSETTING( 0x0000, "Rotary Joystick" )
PORT_DIPSETTING( 0x0100, "Standard Joystick" )
- PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!7")
+ PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!6,!5")
PORT_DIPSETTING( 0x0800, "2" )
PORT_DIPSETTING( 0x0000, "3" )
PORT_DIPSETTING( 0x0400, "4" )
PORT_DIPSETTING( 0x0c00, "5" )
- PORT_DIPNAME( 0x3000, 0x0000, "Coin A & B" ) PORT_DIPLOCATION("SW1:!4,!3")
+ PORT_DIPNAME( 0x3000, 0x0000, "Coin A & B" ) PORT_DIPLOCATION("SW1:!4,!3")
PORT_DIPSETTING( 0x2000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x1000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x3000, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x4000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!2")
+ PORT_DIPNAME( 0x4000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!2")
PORT_DIPSETTING( 0x0000, "1st & 2nd only" )
PORT_DIPSETTING( 0x4000, "1st & every 2nd" )
- PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
+ PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x8000, DEF_STR( On ) )
PORT_START("DSW2")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE_DIPLOC( 0x0100, IP_ACTIVE_HIGH, "SW2:!8" )
- PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
+ PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
PORT_DIPSETTING( 0x0200, DEF_STR( No ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Yes ) )
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
PORT_DIPSETTING( 0x0000, "50k 200k" )
PORT_DIPSETTING( 0x0800, "70k 270k" )
PORT_DIPSETTING( 0x0400, "90k 350k" )
PORT_DIPSETTING( 0x0c00, DEF_STR( None ) )
- PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
+ PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
PORT_DIPSETTING( 0x2000, "Demo Sounds Off" )
PORT_DIPSETTING( 0x0000, "Demo Sounds On" )
PORT_DIPSETTING( 0x3000, "Freeze" )
PORT_DIPSETTING( 0x1000, "Infinite Lives (Cheat)")
- PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
+ PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
PORT_DIPSETTING( 0x8000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x4000, DEF_STR( Hard ) )
@@ -388,46 +388,46 @@ static INPUT_PORTS_START( streetsm )
PORT_START("DSW1") /* Dip switches (Active high) */
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!8,7")
+ PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!8,7")
PORT_DIPSETTING( 0x0200, "1" )
PORT_DIPSETTING( 0x0000, "2" )
PORT_DIPSETTING( 0x0100, "3" )
PORT_DIPSETTING( 0x0300, "4" )
- PORT_DIPNAME( 0x0c00, 0x0000, "Coin A & B" ) PORT_DIPLOCATION("SW1:!6,5")
+ PORT_DIPNAME( 0x0c00, 0x0000, "Coin A & B" ) PORT_DIPLOCATION("SW1:!6,5")
PORT_DIPSETTING( 0x0800, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!4")
+ PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!4")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x1000, DEF_STR( On ) )
- PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!3")
+ PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!3")
PORT_DIPSETTING( 0x0000, "1st & 2nd only" )
PORT_DIPSETTING( 0x2000, "1st & every 2nd" )
- PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!2")
+ PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!2")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x4000, DEF_STR( On ) )
- PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
+ PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x8000, DEF_STR( On ) )
PORT_START("DSW2") /* Dip switches (Active high) */
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE_DIPLOC( 0x0100, IP_ACTIVE_HIGH, "SW2:!8" )
- PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
+ PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
PORT_DIPSETTING( 0x0200, DEF_STR( No ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Yes ) )
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
PORT_DIPSETTING( 0x0000, "200k 400k" )
PORT_DIPSETTING( 0x0800, "400k 600k" )
PORT_DIPSETTING( 0x0400, "600k 800k" )
PORT_DIPSETTING( 0x0c00, DEF_STR( None ) )
- PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
+ PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
PORT_DIPSETTING( 0x2000, "Demo Sounds Off" )
PORT_DIPSETTING( 0x0000, "Demo Sounds On" )
PORT_DIPSETTING( 0x3000, "Freeze" )
PORT_DIPSETTING( 0x1000, "Infinite Lives (Cheat)")
- PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
+ PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
PORT_DIPSETTING( 0x8000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x4000, DEF_STR( Hard ) )
@@ -445,7 +445,7 @@ static INPUT_PORTS_START( streetsj )
PORT_INCLUDE( streetsm )
PORT_MODIFY("DSW1")
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:!6,5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:!6,5")
PORT_DIPSETTING( 0x0c00, "A 4/1 B 1/4" )
PORT_DIPSETTING( 0x0400, "A 3/1 B 1/3" )
PORT_DIPSETTING( 0x0800, "A 2/1 B 1/2" )
@@ -486,46 +486,46 @@ static INPUT_PORTS_START( ikari3 )
PORT_START("DSW1") /* Dip switches (Active high) */
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!8,!7")
+ PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!8,!7")
PORT_DIPSETTING( 0x0200, "2" )
PORT_DIPSETTING( 0x0000, "3" )
PORT_DIPSETTING( 0x0100, "4" )
PORT_DIPSETTING( 0x0300, "5" )
- PORT_DIPNAME( 0x0c00, 0x0000, "Coin A & B" ) PORT_DIPLOCATION("SW1:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, "Coin A & B" ) PORT_DIPLOCATION("SW1:!6,!5")
PORT_DIPSETTING( 0x0800, "First 2 Coins/1 Credit then 1/1" )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0400, "First 1 Coin/2 Credits then 1/1" )
PORT_DIPSETTING( 0x0c00, DEF_STR( Free_Play ) )
- PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!4")
+ PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:!4")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x1000, DEF_STR( On ) )
- PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!3")
+ PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" ) PORT_DIPLOCATION("SW1:!3")
PORT_DIPSETTING( 0x0000, "1st & 2nd only" )
PORT_DIPSETTING( 0x2000, "1st & every 2nd" )
- PORT_DIPNAME( 0x4000, 0x0000, "Blood" ) PORT_DIPLOCATION("SW1:!2")
+ PORT_DIPNAME( 0x4000, 0x0000, "Blood" ) PORT_DIPLOCATION("SW1:!2")
PORT_DIPSETTING( 0x4000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
+ PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!1")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x8000, DEF_STR( On ) )
PORT_START("DSW2") /* Dip switches (Active high) */
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE_DIPLOC( 0x0100, IP_ACTIVE_HIGH, "SW2:!8" )
- PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
+ PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!7")
PORT_DIPSETTING( 0x0200, DEF_STR( No ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Yes ) )
- PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
+ PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!6,!5")
PORT_DIPSETTING( 0x0000, "20k 50k" )
PORT_DIPSETTING( 0x0800, "40k 100k" )
PORT_DIPSETTING( 0x0400, "60k 150k" )
PORT_DIPSETTING( 0x0c00, DEF_STR( None ) )
- PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
+ PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" ) PORT_DIPLOCATION("SW2:!4,!3")
PORT_DIPSETTING( 0x2000, "Demo Sounds Off" )
PORT_DIPSETTING( 0x0000, "Demo Sounds On" )
PORT_DIPSETTING( 0x3000, "Freeze" )
PORT_DIPSETTING( 0x1000, "Infinite Lives (Cheat)")
- PORT_DIPNAME( 0xc000, 0x8000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
+ PORT_DIPNAME( 0xc000, 0x8000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!2,!1")
PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x8000, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x4000, DEF_STR( Hard ) )
diff --git a/src/mame/drivers/stfight.c b/src/mame/drivers/stfight.c
index 810fa199b41..1fc8c5b5a02 100644
--- a/src/mame/drivers/stfight.c
+++ b/src/mame/drivers/stfight.c
@@ -532,8 +532,8 @@ GFXDECODE_END
static const msm5205_interface msm5205_config =
{
- DEVCB_DRIVER_LINE_MEMBER(stfight_state, stfight_adpcm_int), // Interrupt function
- MSM5205_S48_4B // 8KHz, 4-bit
+ DEVCB_DRIVER_LINE_MEMBER(stfight_state, stfight_adpcm_int), // Interrupt function
+ MSM5205_S48_4B // 8KHz, 4-bit
};
static MACHINE_CONFIG_START( stfight, stfight_state )
diff --git a/src/mame/drivers/taito_b.c b/src/mame/drivers/taito_b.c
index 21ae36dd8e6..4178c2020cd 100644
--- a/src/mame/drivers/taito_b.c
+++ b/src/mame/drivers/taito_b.c
@@ -2994,7 +2994,7 @@ ROM_START( tetrist ) // Nastar / Nastar Warrior / Rastan Saga 2 conversion with
the game doesn't use any tiles from here but the roms must be present on the board to avoid
tile 0 being solid and obscuring the bitmap (however if we load them in the correct region
unwanted tiles from here are shown after gameover which is wrong) - There is an undumped PAL
- C12-01 that controls this effect.
+ C12-01 that controls this effect.
*/
ROM_LOAD( "b81-03.14", 0x000000, 0x080000, CRC(551b75e6) SHA1(5b8388ee2c6262f359c9e6d04c951ea8dc3901c9) )
ROM_LOAD( "b81-04.15", 0x080000, 0x080000, CRC(cf734e12) SHA1(4201a74468058761454515738fbf3a7b22a66e00) )
@@ -3024,7 +3024,7 @@ ROM_START( tetrista ) // Master of Weapon conversion with graphics ROMs left in
the game doesn't use any tiles from here but the roms must be present on the board to avoid
tile 0 being solid and obscuring the bitmap (however if we load them in the correct region
unwanted tiles from here are shown after gameover which is wrong) - There is an undumped PAL
- C35-06 that controls this effect.
+ C35-06 that controls this effect.
*/
ROM_LOAD( "b72-02.6", 0x000000, 0x080000, CRC(843444eb) SHA1(2b466045f882996c80e0090009ee957e11d32825) )
ROM_LOAD( "b72-01.5", 0x080000, 0x080000, CRC(a24ac26e) SHA1(895715a2bb0cb15334cba2283bd228b4fc08cd0c) )
diff --git a/src/mame/drivers/taito_f3.c b/src/mame/drivers/taito_f3.c
index 009d776143e..1eeeaacf5a1 100644
--- a/src/mame/drivers/taito_f3.c
+++ b/src/mame/drivers/taito_f3.c
@@ -1960,7 +1960,7 @@ ROM_START( bublbob2p )
ROM_REGION(0x200000, "gfx1" , ROMREGION_ERASE00 ) /* Sprites */
ROM_LOAD16_BYTE ("cq80-obj-0l-c166.ic8", 0x000000, 0x80000, CRC(9bff223b) SHA1(acf22731d91d61aefc3373f78006fd310bb89edf) )
ROM_LOAD16_BYTE ("cq80-obj-0m-24f4.ic30", 0x000001, 0x80000, CRC(ee71f643) SHA1(7a2042c6fad8f1b7e0a3ad077d054dc163a22230) )
- ROM_LOAD ("cq80-obj-0h-990d.ic32", 0x180000, 0x80000, CRC(4d3a78e0) SHA1(b19fb66e6082a68dc8600b8882ba50a3afce27c3) )
+ ROM_LOAD ("cq80-obj-0h-990d.ic32", 0x180000, 0x80000, CRC(4d3a78e0) SHA1(b19fb66e6082a68dc8600b8882ba50a3afce27c3) )
ROM_REGION(0x400000, "gfx2" , ROMREGION_ERASE00 ) /* Tiles */
ROM_LOAD32_BYTE("cq80-scr0-5ba4.ic7", 0x000000, 0x080000, CRC(044dc38b) SHA1(0bb715c9ae8298c6852c6309d69f769e87ab2fdc) )
diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c
index 7e02b57842a..1219b3a17a7 100644
--- a/src/mame/drivers/taito_x.c
+++ b/src/mame/drivers/taito_x.c
@@ -789,7 +789,7 @@ MACHINE_START_MEMBER(taitox_state,superman)
m_banknum = -1;
save_item(NAME(m_banknum));
machine().save().register_postload(save_prepost_delegate(FUNC(taitox_state::reset_sound_region), this));
-
+
m_current_bank = 0;
m_cc_port = 0;
save_item(NAME(m_current_bank));
@@ -817,7 +817,7 @@ static MACHINE_CONFIG_START( superman, taitox_state )
MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
MCFG_MACHINE_START_OVERRIDE(taitox_state,superman)
-
+
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
/* video hardware */
diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c
index 645b212fcfc..41fda70f324 100644
--- a/src/mame/drivers/taitoair.c
+++ b/src/mame/drivers/taitoair.c
@@ -133,7 +133,7 @@ Video section hung off TaitoH driver, it should be separate.
hardware which creates the 3d background scenes? It seems
the TMS320C25 is being used as a co-processor to relieve the
68000 of 3d calculations... it has direct access to line ram
-along with the 68000.
+along with the 68000.
Gradiation RAM is used to display a rotatable gradient background.
The rotation is most likely handled by the TC0430GRW ROZ chip.
@@ -691,11 +691,11 @@ void taitoair_state::machine_reset()
static MACHINE_CONFIG_START( airsys, taitoair_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) // MC68000P12
+ MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) // MC68000P12
MCFG_CPU_PROGRAM_MAP(airsys_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", taitoair_state, irq5_line_hold)
- MCFG_CPU_ADD("audiocpu", Z80, XTAL_16MHz / 4) // Z8400AB1
+ MCFG_CPU_ADD("audiocpu", Z80, XTAL_16MHz / 4) // Z8400AB1
MCFG_CPU_PROGRAM_MAP(sound_map)
MCFG_CPU_ADD("dsp", TMS32025, XTAL_36MHz) // Unverified
diff --git a/src/mame/drivers/taitotx.c b/src/mame/drivers/taitotx.c
index fcfd28e5828..686eb4f7877 100644
--- a/src/mame/drivers/taitotx.c
+++ b/src/mame/drivers/taitotx.c
@@ -262,7 +262,7 @@ ROM_END
// TAITO Type X Model 006B No 150FG0217 AC100V 50/60Hz 2.5A
// Windows(R) XP Embedded 00039-111-243-487 X11-15305
//
-// USAGI M9006613A VER.2.04JPN 40.0GB WD WD400BB-22JHCO
+// USAGI M9006613A VER.2.04JPN 40.0GB WD WD400BB-22JHCO
ROM_START( usagiol )
ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
ROM_LOAD("taito_type_x_bios.bin", 0x00, 0x10000, NO_DUMP ) // size unknown.
diff --git a/src/mame/drivers/taitotz.c b/src/mame/drivers/taitotz.c
index 53bce6e0113..6493a7afa84 100644
--- a/src/mame/drivers/taitotz.c
+++ b/src/mame/drivers/taitotz.c
@@ -626,7 +626,7 @@ class taitotz_renderer : public poly_manager<float, taitotz_polydata, 6, 50000>
public:
taitotz_renderer(taitotz_state &state, int width, int height, UINT32 *texram)
: poly_manager<float, taitotz_polydata, 6, 50000>(state.machine()),
- m_state(state)
+ m_state(state)
{
m_zbuffer = auto_bitmap_ind32_alloc(state.machine(), width, height);
m_texture = texram;
diff --git a/src/mame/drivers/tapatune.c b/src/mame/drivers/tapatune.c
index baf9d136fce..47c76d6eaca 100644
--- a/src/mame/drivers/tapatune.c
+++ b/src/mame/drivers/tapatune.c
@@ -1,34 +1,34 @@
/***************************************************************************
- Tap a Tune
+ Tap a Tune
driver by Mariusz Wojcieszek and Phil Bennett
- PCB Notes:
+ PCB Notes:
- Top board notable:
+ Top board notable:
- - Hitachi HD68HC000-12 68000 CPU (24 MHz crystal)
- - Hitachi HD46505SP-2 CRTC
- - 2x Sony CXK581000P-10L RAM
- - 2x Mosel MS6264L-10PC RAM
- - 2x Mosel MS62256L-10PC RAM
- - rom0.u3 / rom1.u12 - 68000 program
- - rom2.u4 / rom3.u13 / rom4.u5 / rom5.u14 - graphics
+ - Hitachi HD68HC000-12 68000 CPU (24 MHz crystal)
+ - Hitachi HD46505SP-2 CRTC
+ - 2x Sony CXK581000P-10L RAM
+ - 2x Mosel MS6264L-10PC RAM
+ - 2x Mosel MS62256L-10PC RAM
+ - rom0.u3 / rom1.u12 - 68000 program
+ - rom2.u4 / rom3.u13 / rom4.u5 / rom5.u14 - graphics
- Bottom board notable:
+ Bottom board notable:
- - Zilog Z0840006PSC Z80 CPU (24 MHz crystal)
- - BSMT2000 custom audio IC
- - rom.u8 Z80 program
- - arom1.u16 BSMT2000 samples
- - 2 banks of 8-position DIP switches
- - red/green/yellow LEDs
- - many connectors for I/O
+ - Zilog Z0840006PSC Z80 CPU (24 MHz crystal)
+ - BSMT2000 custom audio IC
+ - rom.u8 Z80 program
+ - arom1.u16 BSMT2000 samples
+ - 2 banks of 8-position DIP switches
+ - red/green/yellow LEDs
+ - many connectors for I/O
- The sound and I/O board is used by other redemption games such as
- Colorama and Wheel 'Em In
+ The sound and I/O board is used by other redemption games such as
+ Colorama and Wheel 'Em In
****************************************************************************/
@@ -70,11 +70,11 @@ public:
UINT8 m_z80_to_68k_data;
UINT8 m_68k_to_z80_index;
UINT8 m_68k_to_z80_data;
- UINT8 m_z80_data_available;
- UINT8 m_68k_data_available;
- UINT8 m_bsmt_data_l;
- UINT8 m_bsmt_data_h;
- bool m_bsmt_reset;
+ UINT8 m_z80_data_available;
+ UINT8 m_68k_data_available;
+ UINT8 m_bsmt_data_l;
+ UINT8 m_bsmt_data_h;
+ bool m_bsmt_reset;
virtual void machine_start();
virtual void machine_reset();
@@ -330,17 +330,17 @@ READ8_MEMBER(tapatune_state::sound_irq_clear)
WRITE8_MEMBER(tapatune_state::controls_mux)
{
/*
- Input multiplexer select and outputs:
-
- 76543210
- .......x Mux A
- ......x. Mux B (/Red LED)
- .....x.. Mux C (/Yellow LED)
- ....x... Mux D (/Green LED)
- ...x.... DOUT1 - High current driver 0
- ..x..... DOUT2 - High current driver 1
- .x...... DOUT3 - High current driver 2
- x....... DOUT4 - Ticket dispenser
+ Input multiplexer select and outputs:
+
+ 76543210
+ .......x Mux A
+ ......x. Mux B (/Red LED)
+ .....x.. Mux C (/Yellow LED)
+ ....x... Mux D (/Green LED)
+ ...x.... DOUT1 - High current driver 0
+ ..x..... DOUT2 - High current driver 1
+ .x...... DOUT3 - High current driver 2
+ x....... DOUT4 - Ticket dispenser
*/
m_controls_mux = data;
@@ -373,17 +373,17 @@ READ8_MEMBER(tapatune_state::special_r)
WRITE8_MEMBER(tapatune_state::lamps_w)
{
/*
- Button Lamps:
-
- 7654 3210
- .... ...x Pink
- .... ..x. Purple
- .... .x.. Blue
- .... x... Dark Green
- ...x .... Light Green
- ..x. .... Yellow
- .x.. .... Orange
- x... .... Red
+ Button Lamps:
+
+ 7654 3210
+ .... ...x Pink
+ .... ..x. Purple
+ .... .x.. Blue
+ .... x... Dark Green
+ ...x .... Light Green
+ ..x. .... Yellow
+ .x.. .... Orange
+ x... .... Red
*/
}
@@ -468,10 +468,10 @@ static INPUT_PORTS_START( tapatune )
PORT_DIPSETTING( 0x01, "35 secs" )
PORT_DIPSETTING( 0x00, "40 secs" )
PORT_DIPNAME( 0x18, 0x10, "Bad note penalty" ) PORT_DIPLOCATION("SW5:4,5")
- PORT_DIPSETTING( 0x18, "0 secs" )
- PORT_DIPSETTING( 0x10, "1 secs" )
- PORT_DIPSETTING( 0x08, "5 secs" )
- PORT_DIPSETTING( 0x00, "10 secs" )
+ PORT_DIPSETTING( 0x18, "0 secs" )
+ PORT_DIPSETTING( 0x10, "1 secs" )
+ PORT_DIPSETTING( 0x08, "5 secs" )
+ PORT_DIPSETTING( 0x00, "10 secs" )
PORT_DIPNAME( 0x20, 0x20, "Coins per game" ) PORT_DIPLOCATION("SW5:6")
PORT_DIPSETTING( 0x20, "1" )
PORT_DIPSETTING( 0x00, "2" )
diff --git a/src/mame/drivers/thunderj.c b/src/mame/drivers/thunderj.c
index 6b0d00d1851..5b621601cce 100644
--- a/src/mame/drivers/thunderj.c
+++ b/src/mame/drivers/thunderj.c
@@ -254,7 +254,7 @@ static MACHINE_CONFIG_START( thunderj, thunderj_state )
MCFG_MACHINE_START_OVERRIDE(thunderj_state,thunderj)
MCFG_MACHINE_RESET_OVERRIDE(thunderj_state,thunderj)
-
+
MCFG_ATARI_EEPROM_2816_ADD("eeprom")
/* perfect synchronization due to shared RAM */
diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c
index 8db50f8634a..f1b7e7a7d62 100644
--- a/src/mame/drivers/toaplan2.c
+++ b/src/mame/drivers/toaplan2.c
@@ -4029,8 +4029,7 @@ ROM_END
ROM_LOAD( "tp-026-3", 0x000000, 0x200000, CRC(e5578d98) SHA1(280d2b716d955e767d311fc9596823852435b6d7) ) \
ROM_LOAD( "tp-026-4", 0x200000, 0x200000, CRC(b760cb53) SHA1(bc9c5e49e45cdda0f774be0038aa4deb21d4d285) ) \
ROM_REGION( 0x40000, "oki", 0 ) \
- ROM_LOAD( "tp-026-2", 0x00000, 0x40000, CRC(85063f1f) SHA1(1bf4d77494de421c98f6273b9876e60d827a6826) ) \
-
+ ROM_LOAD( "tp-026-2", 0x00000, 0x40000, CRC(85063f1f) SHA1(1bf4d77494de421c98f6273b9876e60d827a6826) )
ROM_START( fixeightkt )
ROMS_FIXEIGHT
diff --git a/src/mame/drivers/toobin.c b/src/mame/drivers/toobin.c
index 9dfd0a2c5db..cbfa55c93c6 100644
--- a/src/mame/drivers/toobin.c
+++ b/src/mame/drivers/toobin.c
@@ -198,9 +198,9 @@ static MACHINE_CONFIG_START( toobin, toobin_state )
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_MACHINE_RESET_OVERRIDE(toobin_state,toobin)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
-
+
MCFG_WATCHDOG_VBLANK_INIT(8)
/* video hardware */
diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c
index afd4e8a3bec..33a3d929dc9 100644
--- a/src/mame/drivers/topspeed.c
+++ b/src/mame/drivers/topspeed.c
@@ -212,10 +212,10 @@ READ16_MEMBER(topspeed_state::motor_r)
{
switch (offset)
{
- case 0x0: // Motor status?
+ case 0x0: // Motor status?
return (machine().rand() & 0xff);
- case 0x101: // Motor CPU status?
+ case 0x101: // Motor CPU status?
return 0x55;
case 0x141: // Left limit data
@@ -315,10 +315,10 @@ WRITE8_MEMBER(topspeed_state::volume_w)
switch (offset)
{
- case 0x000: filter = m_filter2; break; // MSM5205 1
- case 0x200: filter = m_filter3; break; // MSM5205 2
- case 0x400: filter = m_filter1l; break; // YM-2151 L
- case 0x600: filter = m_filter1r; break; // YM-2151 R
+ case 0x000: filter = m_filter2; break; // MSM5205 1
+ case 0x200: filter = m_filter3; break; // MSM5205 2
+ case 0x400: filter = m_filter1l; break; // YM-2151 L
+ case 0x600: filter = m_filter1r; break; // YM-2151 R
}
filter->flt_volume_set_volume(data / 255.0f);
@@ -494,29 +494,29 @@ INPUT_PORTS_END
static const gfx_layout tile16x8_layout =
{
- 16,8, // 16*8 sprites
+ 16,8, // 16*8 sprites
RGN_FRAC(1,1),
- 4, // 4 bits per pixel
+ 4, // 4 bits per pixel
{ 0, 8, 16, 24 },
{ 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 },
- 64*8 // every sprite takes 64 consecutive bytes
+ 64*8 // every sprite takes 64 consecutive bytes
};
static const gfx_layout charlayout =
{
8,8, // 8*8 characters
RGN_FRAC(1,1),
- 4, // 4 bits per pixel
+ 4, // 4 bits per pixel
{ 0, 1, 2, 3 },
{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
- 32*8 // every sprite takes 32 consecutive bytes
+ 32*8 // every sprite takes 32 consecutive bytes
};
static GFXDECODE_START( topspeed )
- GFXDECODE_ENTRY( "gfx2", 0x0, tile16x8_layout, 0, 256 ) // Sprite parts
- GFXDECODE_ENTRY( "gfx1", 0x0, charlayout, 0, 256 ) // Sprites & playfield
+ GFXDECODE_ENTRY( "gfx2", 0x0, tile16x8_layout, 0, 256 ) // Sprite parts
+ GFXDECODE_ENTRY( "gfx1", 0x0, charlayout, 0, 256 ) // Sprites & playfield
// Road Lines gfxdecodable ?
GFXDECODE_END
@@ -528,13 +528,13 @@ GFXDECODE_END
static const msm5205_interface msm5205_config_1 =
{
DEVCB_DRIVER_LINE_MEMBER(topspeed_state, msm5205_1_vck), // VCK function
- MSM5205_S48_4B // 8 kHz, 4-bit
+ MSM5205_S48_4B // 8 kHz, 4-bit
};
static const msm5205_interface msm5205_config_2 =
{
- DEVCB_NULL, // VCK function
- MSM5205_SEX_4B // Slave mode, 4-bit
+ DEVCB_NULL, // VCK function
+ MSM5205_SEX_4B // Slave mode, 4-bit
};
@@ -544,7 +544,7 @@ static const msm5205_interface msm5205_config_2 =
static const pc080sn_interface pc080sn_intf =
{
- 1, // gfxnum
+ 1, // gfxnum
0, 8, 0, 0 // x_offset, y_offset, y_invert, dblwidth
};
@@ -564,10 +564,10 @@ static const tc0140syt_interface tc0140syt_intf =
static Z80CTC_INTERFACE( ctc_intf )
{
- DEVCB_NULL, // Interrupt handler
+ DEVCB_NULL, // Interrupt handler
DEVCB_DRIVER_LINE_MEMBER(topspeed_state, z80ctc_to0), // ZC/TO0 callback
DEVCB_NULL, // ZC/TO1 callback
- DEVCB_NULL // ZC/TO2 callback
+ DEVCB_NULL // ZC/TO2 callback
};
diff --git a/src/mame/drivers/trvmadns.c b/src/mame/drivers/trvmadns.c
index ba20b6cd8ae..f33ac6ec3bd 100644
--- a/src/mame/drivers/trvmadns.c
+++ b/src/mame/drivers/trvmadns.c
@@ -32,7 +32,7 @@ CPU board:
Sound: AY-3-8910
RAM: AMD AM9128-15PC (2048x8 Static RAM)
OSC: 10.000MHz
-Video: F6845P (or H6845P also labeled as HD46505RP) 40 pin dil (8 bit CRT Controller)
+Video: F6845P (or H6845P also labeled as HD46505RP) 40 pin dil (8 bit CRT Controller)
Misc: RCA X (CDM6116E2) 24 pin dil (General-Purpose Static RAM - Multiplexed I/O)
Roms: u7f lat green - type 2764
u6f lat green - type 2764
diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c
index 14813616c3e..3f5b7b38150 100644
--- a/src/mame/drivers/tumbleb.c
+++ b/src/mame/drivers/tumbleb.c
@@ -2155,8 +2155,8 @@ static MACHINE_CONFIG_START( htchctch, tumbleb_state )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
/* on at least hatch catch, cookie & bibi and choky choky the YM2151 clock is connected
- directly to the Z80 clock so the speed should match */
- MCFG_YM2151_ADD("ymsnd", 15000000/4)
+ directly to the Z80 clock so the speed should match */
+ MCFG_YM2151_ADD("ymsnd", 15000000/4)
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.10)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.10)
@@ -2173,9 +2173,9 @@ static MACHINE_CONFIG_DERIVED( cookbib, htchctch )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( chokchok, htchctch )
- MCFG_OKIM6295_REPLACE("oki", 3579545/4, OKIM6295_PIN7_HIGH)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
+ MCFG_OKIM6295_REPLACE("oki", 3579545/4, OKIM6295_PIN7_HIGH)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( cookbib_mcu, htchctch )
diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c
index 4c34192728f..3d42e0236de 100644
--- a/src/mame/drivers/vamphalf.c
+++ b/src/mame/drivers/vamphalf.c
@@ -984,8 +984,8 @@ static MACHINE_CONFIG_START( common, vamphalf_state )
MCFG_CPU_VBLANK_INT_DRIVER("screen", vamphalf_state, irq1_line_hold)
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
- MCFG_EEPROM_ERASE_TIME(attotime::from_usec(250)) // coolmini requires fast erase
- MCFG_EEPROM_WRITE_TIME(attotime::from_usec(250)) // dtfamily requires fast write
+ MCFG_EEPROM_ERASE_TIME(attotime::from_usec(250)) // coolmini requires fast erase
+ MCFG_EEPROM_WRITE_TIME(attotime::from_usec(250)) // dtfamily requires fast write
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c
index c7d8b8fb616..ca755bc09b4 100644
--- a/src/mame/drivers/vegas.c
+++ b/src/mame/drivers/vegas.c
@@ -1501,7 +1501,7 @@ static WRITE32_DEVICE_HANDLER( ide_bus_master32_w )
static READ32_DEVICE_HANDLER( ethernet_r )
{
smc91c94_device *ethernet = space.machine().device<smc91c94_device>("ethernet");
-
+
UINT32 result = 0;
if (ACCESSING_BITS_0_15)
result |= ethernet->read(space, offset * 2 + 0, mem_mask);
@@ -1514,7 +1514,7 @@ static READ32_DEVICE_HANDLER( ethernet_r )
static WRITE32_DEVICE_HANDLER( ethernet_w )
{
smc91c94_device *ethernet = space.machine().device<smc91c94_device>("ethernet");
-
+
if (ACCESSING_BITS_0_15)
ethernet->write(space, offset * 2 + 0, data, mem_mask);
if (ACCESSING_BITS_16_31)
diff --git a/src/mame/drivers/vicdual.c b/src/mame/drivers/vicdual.c
index fb9ebeb83b7..1945fb4364c 100644
--- a/src/mame/drivers/vicdual.c
+++ b/src/mame/drivers/vicdual.c
@@ -227,7 +227,7 @@ void vicdual_state::machine_start()
{
m_coin_status = 0;
m_palette_bank = 0;
-
+
m_port1State = 0;
m_port2State = 0;
m_psgData = 0;
diff --git a/src/mame/drivers/vindictr.c b/src/mame/drivers/vindictr.c
index 4ef6c05a8c6..4ceb543e847 100644
--- a/src/mame/drivers/vindictr.c
+++ b/src/mame/drivers/vindictr.c
@@ -183,7 +183,7 @@ static MACHINE_CONFIG_START( vindictr, vindictr_state )
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_MACHINE_RESET_OVERRIDE(vindictr_state,vindictr)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
@@ -194,7 +194,7 @@ static MACHINE_CONFIG_START( vindictr, vindictr_state )
MCFG_TILEMAP_ADD_STANDARD("playfield", 2, vindictr_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", 2, vindictr_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
MCFG_ATARI_MOTION_OBJECTS_ADD("mob", "screen", vindictr_state::s_mob_config)
-
+
MCFG_SCREEN_ADD("screen", RASTER)
/* note: these parameters are from published specs, not derived */
/* the board uses a SYNGEN chip to generate video signals */
diff --git a/src/mame/drivers/xybots.c b/src/mame/drivers/xybots.c
index 9503e82fa0d..b332e2d5941 100644
--- a/src/mame/drivers/xybots.c
+++ b/src/mame/drivers/xybots.c
@@ -183,7 +183,7 @@ static MACHINE_CONFIG_START( xybots, xybots_state )
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen)
MCFG_MACHINE_RESET_OVERRIDE(xybots_state,xybots)
-
+
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
/* video hardware */
diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h
index 819e3df0d1f..766847f7432 100644
--- a/src/mame/includes/amiga.h
+++ b/src/mame/includes/amiga.h
@@ -564,7 +564,7 @@ private:
// internal state
audio_channel m_channel[4];
sound_stream * m_stream;
-
+
TIMER_CALLBACK_MEMBER( signal_irq );
};
diff --git a/src/mame/includes/arcadecl.h b/src/mame/includes/arcadecl.h
index 633fbeead0c..7c4a46ea4b4 100644
--- a/src/mame/includes/arcadecl.h
+++ b/src/mame/includes/arcadecl.h
@@ -17,7 +17,7 @@ public:
optional_device<atari_motion_objects_device> m_mob;
required_shared_ptr<UINT16> m_bitmap;
-
+
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_WRITE16_MEMBER(latch_w);
diff --git a/src/mame/includes/atarisy1.h b/src/mame/includes/atarisy1.h
index 7a848152445..e2ace7815a1 100644
--- a/src/mame/includes/atarisy1.h
+++ b/src/mame/includes/atarisy1.h
@@ -86,6 +86,6 @@ public:
DECLARE_WRITE16_MEMBER( atarisy1_xscroll_w );
DECLARE_WRITE16_MEMBER( atarisy1_yscroll_w );
DECLARE_WRITE16_MEMBER( atarisy1_priority_w );
-
+
static const atari_motion_objects_config s_mob_config;
};
diff --git a/src/mame/includes/cabal.h b/src/mame/includes/cabal.h
index 893faac6acb..2fc8de5755b 100644
--- a/src/mame/includes/cabal.h
+++ b/src/mame/includes/cabal.h
@@ -20,7 +20,7 @@ public:
required_shared_ptr<UINT16> m_spriteram;
required_shared_ptr<UINT16> m_colorram;
required_shared_ptr<UINT16> m_videoram;
-
+
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
optional_device<seibu_sound_device> m_seibu_sound;
@@ -28,7 +28,7 @@ public:
optional_device<seibu_adpcm_device> m_adpcm2;
optional_device<msm5205_device> m_msm1;
optional_device<msm5205_device> m_msm2;
-
+
tilemap_t *m_background_layer;
tilemap_t *m_text_layer;
int m_sound_command1;
diff --git a/src/mame/includes/carpolo.h b/src/mame/includes/carpolo.h
index cd745006014..28ca6835ac0 100644
--- a/src/mame/includes/carpolo.h
+++ b/src/mame/includes/carpolo.h
@@ -101,7 +101,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(carpolo_7474_2s_2_q_cb);
DECLARE_WRITE_LINE_MEMBER(carpolo_7474_2u_1_q_cb);
DECLARE_WRITE_LINE_MEMBER(carpolo_7474_2u_2_q_cb);
-
+
void remap_sprite_code(int bank, int code, int *remapped_code, int *flipy);
void normalize_coordinates(int *x1, int *y1, int *x2, int *y2);
int check_sprite_left_goal_collision(int x1, int y1, int code1, int flipy1, int goalpost_only);
diff --git a/src/mame/includes/cd32.h b/src/mame/includes/cd32.h
index e40582410f6..a2971be2f06 100644
--- a/src/mame/includes/cd32.h
+++ b/src/mame/includes/cd32.h
@@ -61,7 +61,7 @@ public:
DECLARE_READ32_MEMBER( read );
DECLARE_WRITE32_MEMBER( write );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -108,25 +108,25 @@ private:
device_t *m_i2cmem;
int m_cdrom_is_device;
-
+
void nvram_write(UINT32 data);
UINT32 nvram_read();
-
+
void c2p_write(UINT32 data);
UINT32 c2p_read();
-
+
void cdda_stop();
void cdda_play(UINT32 lba, UINT32 num_blocks);
void cdda_pause(int pause);
UINT8 cdda_getstatus(UINT32 *lba);
void set_cd_status(UINT32 status);
-
+
TIMER_CALLBACK_MEMBER(frame_proc);
TIMER_CALLBACK_MEMBER(dma_proc);
-
+
void start_dma();
void setup_response( int len, UINT8 *r1 );
-
+
TIMER_CALLBACK_MEMBER( cd_delayed_cmd );
void update_cdrom();
};
diff --git a/src/mame/includes/darkmist.h b/src/mame/includes/darkmist.h
index 488b6279afa..60e7823eda9 100644
--- a/src/mame/includes/darkmist.h
+++ b/src/mame/includes/darkmist.h
@@ -18,10 +18,10 @@ public:
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_workram;
required_shared_ptr<UINT8> m_spriteram;
-
+
required_device<cpu_device> m_maincpu;
required_device<t5182_device> m_t5182;
-
+
int m_hw;
tilemap_t *m_bgtilemap;
tilemap_t *m_fgtilemap;
diff --git a/src/mame/includes/ddragon3.h b/src/mame/includes/ddragon3.h
index bd112bca8ae..b42c30e44fd 100644
--- a/src/mame/includes/ddragon3.h
+++ b/src/mame/includes/ddragon3.h
@@ -18,7 +18,7 @@ public:
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_oki(*this, "oki")
-
+
{
vblank_level = 6;
raster_level = 5;
@@ -27,7 +27,7 @@ public:
/* memory pointers */
required_shared_ptr<UINT16> m_bg_videoram;
required_shared_ptr<UINT16> m_fg_videoram;
-// required_shared_ptr<UINT16> m_spriteram;
+// required_shared_ptr<UINT16> m_spriteram;
required_device<buffered_spriteram16_device> m_spriteram;
// UINT16 * m_paletteram; // currently this uses generic palette handling
diff --git a/src/mame/includes/deadang.h b/src/mame/includes/deadang.h
index 504d7119b1b..8ddc1f4b4bf 100644
--- a/src/mame/includes/deadang.h
+++ b/src/mame/includes/deadang.h
@@ -19,13 +19,13 @@ public:
required_shared_ptr<UINT16> m_videoram;
required_shared_ptr<UINT16> m_scroll_ram;
required_shared_ptr<UINT16> m_video_data;
-
+
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<seibu_sound_device> m_seibu_sound;
required_device<seibu_adpcm_device> m_adpcm1;
required_device<seibu_adpcm_device> m_adpcm2;
-
+
tilemap_t *m_pf3_layer;
tilemap_t *m_pf2_layer;
tilemap_t *m_pf1_layer;
diff --git a/src/mame/includes/dynduke.h b/src/mame/includes/dynduke.h
index 1a2889afba7..b2e992a2ab2 100644
--- a/src/mame/includes/dynduke.h
+++ b/src/mame/includes/dynduke.h
@@ -19,7 +19,7 @@ public:
required_shared_ptr<UINT16> m_videoram;
required_shared_ptr<UINT16> m_back_data;
required_shared_ptr<UINT16> m_fore_data;
-
+
required_device<cpu_device> m_maincpu;
required_device<seibu_sound_device> m_seibu_sound;
diff --git a/src/mame/includes/exidy.h b/src/mame/includes/exidy.h
index 743d31c1542..5b03723a3f0 100644
--- a/src/mame/includes/exidy.h
+++ b/src/mame/includes/exidy.h
@@ -45,7 +45,7 @@ public:
m_dac(*this, "dac"),
m_samples(*this, "samples") { }
-
+
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_sprite1_xpos;
required_shared_ptr<UINT8> m_sprite1_ypos;
@@ -55,11 +55,11 @@ public:
required_shared_ptr<UINT8> m_sprite_enable;
required_shared_ptr<UINT8> m_color_latch;
required_shared_ptr<UINT8> m_characterram;
-
+
required_device<cpu_device> m_maincpu;
optional_device<dac_device> m_dac;
optional_device<samples_device> m_samples;
-
+
UINT8 m_last_dial;
UINT8 m_collision_mask;
UINT8 m_collision_invert;
@@ -94,7 +94,7 @@ public:
inline int sprite_1_enabled();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void check_collision();
-
+
/* Targ and Spectar samples */
int m_max_freq;
UINT8 m_port_1_last;
@@ -107,7 +107,7 @@ public:
DECLARE_WRITE8_MEMBER(spectar_audio_2_w);
void adjust_sample(UINT8 freq);
void common_audio_start(int freq);
-
+
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
diff --git a/src/mame/includes/exprraid.h b/src/mame/includes/exprraid.h
index 1f4555be43b..b508b948d78 100644
--- a/src/mame/includes/exprraid.h
+++ b/src/mame/includes/exprraid.h
@@ -28,12 +28,12 @@ public:
required_shared_ptr<UINT8> m_colorram;
/* protection */
- UINT8 m_prot_value;
+ UINT8 m_prot_value;
/* video-related */
- tilemap_t *m_bg_tilemap;
- tilemap_t *m_fg_tilemap;
- int m_bg_index[4];
+ tilemap_t *m_bg_tilemap;
+ tilemap_t *m_fg_tilemap;
+ int m_bg_index[4];
virtual void machine_start();
virtual void machine_reset();
diff --git a/src/mame/includes/galaxia.h b/src/mame/includes/galaxia.h
index aff7b5ce433..555596f640d 100644
--- a/src/mame/includes/galaxia.h
+++ b/src/mame/includes/galaxia.h
@@ -12,7 +12,7 @@ public:
galaxia_state(const machine_config &mconfig, device_type type, const char *tag)
: cvs_state(mconfig, type, tag) { }
-
+
tilemap_t *m_bg_tilemap;
bitmap_ind16 m_temp_bitmap;
DECLARE_WRITE8_MEMBER(galaxia_video_w);
diff --git a/src/mame/includes/gauntlet.h b/src/mame/includes/gauntlet.h
index d032a6b47c2..06bdb1b8229 100644
--- a/src/mame/includes/gauntlet.h
+++ b/src/mame/includes/gauntlet.h
@@ -12,10 +12,10 @@ class gauntlet_state : public atarigen_state
public:
gauntlet_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
- m_playfield_tilemap(*this, "playfield"),
- m_alpha_tilemap(*this, "alpha"),
- m_mob(*this, "mob") { }
-
+ m_playfield_tilemap(*this, "playfield"),
+ m_alpha_tilemap(*this, "alpha"),
+ m_mob(*this, "mob") { }
+
required_device<tilemap_device> m_playfield_tilemap;
required_device<tilemap_device> m_alpha_tilemap;
required_device<atari_motion_objects_device> m_mob;
diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h
index 4ccb16e47ca..c12e19b4cc8 100644
--- a/src/mame/includes/harddriv.h
+++ b/src/mame/includes/harddriv.h
@@ -76,7 +76,7 @@ public:
UINT16 * m_dsk_zram;
UINT16 * m_m68k_slapstic_base;
UINT16 * m_m68k_sloop_alt_base;
-
+
required_shared_ptr<UINT16> m_zram;
optional_shared_ptr<UINT16> m_adsp_data_memory;
diff --git a/src/mame/includes/klax.h b/src/mame/includes/klax.h
index c8dae44fff3..dac76b7885e 100644
--- a/src/mame/includes/klax.h
+++ b/src/mame/includes/klax.h
@@ -17,7 +17,7 @@ public:
required_device<tilemap_device> m_playfield_tilemap;
required_device<atari_motion_objects_device> m_mob;
-
+
virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_WRITE16_MEMBER(interrupt_ack_w);
diff --git a/src/mame/includes/macrossp.h b/src/mame/includes/macrossp.h
index 1514a1f85e3..18b52a9e99f 100644
--- a/src/mame/includes/macrossp.h
+++ b/src/mame/includes/macrossp.h
@@ -17,7 +17,7 @@ public:
m_scrb_videoram(*this, "scrb_videoram"),
m_scrb_linezoom(*this, "scrb_linezoom"),
m_scrb_videoregs(*this, "scrb_videoregs"),
-
+
m_scrc_videoram(*this, "scrc_videoram"),
m_scrc_linezoom(*this, "scrc_linezoom"),
m_scrc_videoregs(*this, "scrc_videoregs"),
@@ -30,8 +30,7 @@ public:
m_mainram(*this, "mainram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu")
- {
-
+ {
}
/* memory pointers */
diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h
index b667a9d65ba..f310acee4ff 100644
--- a/src/mame/includes/micro3d.h
+++ b/src/mame/includes/micro3d.h
@@ -185,7 +185,7 @@ public:
~micro3d_sound_device() {}
void noise_sh_w(UINT8 data);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
diff --git a/src/mame/includes/mjkjidai.h b/src/mame/includes/mjkjidai.h
index 5c59a4c5da8..dbeca63e3da 100644
--- a/src/mame/includes/mjkjidai.h
+++ b/src/mame/includes/mjkjidai.h
@@ -20,7 +20,7 @@ public:
required_shared_ptr<UINT8> m_spriteram2;
required_shared_ptr<UINT8> m_spriteram3;
required_shared_ptr<UINT8> m_videoram;
-
+
required_device<cpu_device> m_maincpu;
required_device<mjkjidai_adpcm_device> m_mjk_adpcm;
@@ -48,7 +48,7 @@ class mjkjidai_adpcm_device : public device_t,
public:
mjkjidai_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~mjkjidai_adpcm_device() {}
-
+
void mjkjidai_adpcm_play (int offset, int length);
protected:
diff --git a/src/mame/includes/model1.h b/src/mame/includes/model1.h
index 3ff3bd14fe1..a108bf97e59 100644
--- a/src/mame/includes/model1.h
+++ b/src/mame/includes/model1.h
@@ -22,7 +22,7 @@ public:
m_color_xlat(*this, "color_xlat"){ }
required_device<cpu_device> m_maincpu; // V60
- required_device<segam1audio_device> m_m1audio; // Model 1 standard sound board
+ required_device<segam1audio_device> m_m1audio; // Model 1 standard sound board
optional_device<dsbz80_device> m_dsbz80; // Digital Sound Board
optional_device<mb86233_cpu_device> m_tgp;
diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h
index d8406a33aec..b983c3d15a6 100644
--- a/src/mame/includes/model2.h
+++ b/src/mame/includes/model2.h
@@ -40,10 +40,10 @@ public:
required_shared_ptr<UINT32> m_lumaram;
optional_shared_ptr<UINT16> m_soundram;
optional_shared_ptr<UINT32> m_tgp_program;
-
+
required_device<i960_cpu_device> m_maincpu;
optional_device<dsbz80_device> m_dsbz80; // Z80-based MPEG Digital Sound Board
- optional_device<segam1audio_device> m_m1audio; // Model 1 standard sound board
+ optional_device<segam1audio_device> m_m1audio; // Model 1 standard sound board
optional_device<cpu_device> m_audiocpu;
optional_device<cpu_device> m_tgp;
optional_device<cpu_device> m_dsp;
diff --git a/src/mame/includes/mustache.h b/src/mame/includes/mustache.h
index b6832009e76..5c176a9c23c 100644
--- a/src/mame/includes/mustache.h
+++ b/src/mame/includes/mustache.h
@@ -12,10 +12,10 @@ public:
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_spriteram;
-
+
required_device<cpu_device> m_maincpu;
required_device<seibu_sound_device> m_cpu_decrypt;
-
+
tilemap_t *m_bg_tilemap;
int m_control_byte;
DECLARE_WRITE8_MEMBER(mustache_videoram_w);
diff --git a/src/mame/includes/namcos22.h b/src/mame/includes/namcos22.h
index 29d64512078..4e3576231b5 100644
--- a/src/mame/includes/namcos22.h
+++ b/src/mame/includes/namcos22.h
@@ -124,7 +124,7 @@ class namcos22_renderer : public poly_manager<float, namcos22_object_data, 4, 80
{
public:
namcos22_renderer(namcos22_state &state);
-
+
void render_scene(screen_device &screen, bitmap_rgb32 &bitmap);
struct namcos22_scenenode *new_scenenode(running_machine &machine, UINT32 zsort, namcos22_scenenode_type type);
@@ -306,7 +306,7 @@ public:
float m_camera_lz; // "
int m_camera_ambient; // 0.0..1.0
int m_camera_power; // 0.0..1.0
-
+
DECLARE_WRITE32_MEMBER(namcos22s_czram_w);
DECLARE_READ32_MEMBER(namcos22s_czram_r);
DECLARE_READ32_MEMBER(namcos22s_vics_control_r);
@@ -396,13 +396,13 @@ public:
inline UINT8 nthbyte(const UINT32 *src, int n) { return (src[n / 4] << ((n & 3) * 8)) >> 24; }
inline UINT16 nthword(const UINT32 *src, int n) { return (src[n / 2] << ((n & 1) * 16)) >> 16; }
-
+
inline INT32 signed18(INT32 val) { return (val & 0x00020000) ? (INT32)(val | 0xfffc0000) : val & 0x0001ffff; }
inline INT32 signed24(INT32 val) { return (val & 0x00800000) ? (INT32)(val | 0xff000000) : val & 0x007fffff; }
-
+
inline float dspfixed_to_nativefloat(INT16 val) { return val / (float)0x7fff; }
float dspfloat_to_nativefloat(UINT32 val);
-
+
void handle_driving_io();
void handle_coinage(int slots, int address_is_odd);
void handle_cybrcomm_io();
@@ -412,23 +412,23 @@ public:
void slave_halt();
void slave_enable();
void enable_slave_simulation(bool enable);
-
+
void matrix3d_multiply(float a[4][4], float b[4][4]);
void matrix3d_identity(float m[4][4]);
void transform_point(float *vx, float *vy, float *vz, float m[4][4]);
void transform_normal(float *nx, float *ny, float *nz, float m[4][4]);
void register_normals(INT32 addr, float m[4][4]);
-
+
void blit_single_quad(bitmap_rgb32 &bitmap, UINT32 color, UINT32 addr, float m[4][4], INT32 polyshift, int flags, int packetformat);
void blit_quads(bitmap_rgb32 &bitmap, INT32 addr, float m[4][4], INT32 base);
void blit_polyobject(bitmap_rgb32 &bitmap, int code, float m[4][4]);
-
+
void slavesim_handle_bb0003(const INT32 *src);
void slavesim_handle_200002(bitmap_rgb32 &bitmap, const INT32 *src);
void slavesim_handle_300000(const INT32 *src);
void slavesim_handle_233002(const INT32 *src);
void simulate_slavedsp(bitmap_rgb32 &bitmap);
-
+
INT32 point_read(INT32 addr);
void init_tables();
void update_mixer();
@@ -441,7 +441,7 @@ public:
void draw_text_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int prival);
void namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
-
+
void install_c74_speedup();
void install_130_speedup();
void install_141_speedup();
diff --git a/src/mame/includes/pgm.h b/src/mame/includes/pgm.h
index ffac9ade342..6f0c7082e85 100644
--- a/src/mame/includes/pgm.h
+++ b/src/mame/includes/pgm.h
@@ -279,7 +279,7 @@ public:
UINT8 coverage[256]; // coverage is how much of the table we've managed to verify using known facts about the table structure
int command_31_write_type;
-
+
// the maximum level size returned or read by the device appears to be this size
UINT16 level_structure[8][10];
diff --git a/src/mame/includes/raiden2.h b/src/mame/includes/raiden2.h
index 3808c637f5f..9a31544cc0d 100644
--- a/src/mame/includes/raiden2.h
+++ b/src/mame/includes/raiden2.h
@@ -12,7 +12,7 @@ public:
sprites(*this, "sprites") ,
m_maincpu(*this, "maincpu"),
m_seibu_sound(*this, "seibu_sound") { }
-
+
required_shared_ptr<UINT16> back_data,fore_data,mid_data, text_data, sprites;
required_device<cpu_device> m_maincpu;
required_device<seibu_sound_device> m_seibu_sound;
diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h
index 078f94dd5dd..4e788b92e12 100644
--- a/src/mame/includes/segas32.h
+++ b/src/mame/includes/segas32.h
@@ -30,7 +30,7 @@ public:
required_shared_ptr<UINT16> m_system32_videoram;
required_shared_ptr<UINT16> m_system32_spriteram;
optional_shared_ptr_array<UINT16, 2> m_system32_paletteram;
-
+
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
optional_device<multipcm_device> m_multipcm;
diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h
index ee2305a7da5..a889cabb592 100644
--- a/src/mame/includes/snes.h
+++ b/src/mame/includes/snes.h
@@ -450,7 +450,7 @@ public:
UINT16 ver_offset;
UINT8 extbg;
} m_mode7;
-
+
screen_device *m_screen;
UINT8 m_mosaic_size;
diff --git a/src/mame/includes/snk6502.h b/src/mame/includes/snk6502.h
index f5955f89afe..7cc0493e431 100644
--- a/src/mame/includes/snk6502.h
+++ b/src/mame/includes/snk6502.h
@@ -28,7 +28,7 @@ public:
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_charram;
-
+
required_device<cpu_device> m_maincpu;
required_device<snk6502_sound_device> m_sound;
@@ -102,7 +102,7 @@ public:
DECLARE_WRITE8_MEMBER( vanguard_speech_w );
DECLARE_WRITE8_MEMBER( fantasy_sound_w );
DECLARE_WRITE8_MEMBER( fantasy_speech_w );
-
+
void set_music_clock(double clock_time);
void set_music_freq(int freq);
int music0_playing();
@@ -131,7 +131,7 @@ private:
UINT32 m_hd38880_addr;
int m_hd38880_data_bytes;
double m_hd38880_speed;
-
+
inline void validate_tone_channel(int channel);
void sasuke_build_waveform(int mask);
void satansat_build_waveform(int mask);
diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h
index 1740b4f8c18..5286435e21a 100644
--- a/src/mame/includes/stfight.h
+++ b/src/mame/includes/stfight.h
@@ -38,7 +38,7 @@ public:
UINT16 m_adpcm_data_offs;
UINT8 m_adpcm_nibble;
UINT8 m_adpcm_reset;
-
+
UINT8 m_coin_state;
tilemap_t *m_fg_tilemap;
tilemap_t *m_bg_tilemap;
@@ -62,7 +62,7 @@ public:
DECLARE_WRITE8_MEMBER(stfight_text_attr_w);
DECLARE_WRITE8_MEMBER(stfight_sprite_bank_w);
DECLARE_WRITE8_MEMBER(stfight_vh_latch_w);
- DECLARE_WRITE8_MEMBER(cshooter_text_w);
+ DECLARE_WRITE8_MEMBER(cshooter_text_w);
DECLARE_READ8_MEMBER(stfight_fm_r);
diff --git a/src/mame/includes/taito_b.h b/src/mame/includes/taito_b.h
index 2264be9e4d1..39ee2aa971c 100644
--- a/src/mame/includes/taito_b.h
+++ b/src/mame/includes/taito_b.h
@@ -66,7 +66,7 @@ public:
optional_device<tc0220ioc_device> m_tc0220ioc;
optional_device<tc0510nio_device> m_tc0510nio;
optional_device<mb87078_device> m_mb87078;
-
+
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_READ16_MEMBER(tracky1_hi_r);
DECLARE_READ16_MEMBER(tracky1_lo_r);
diff --git a/src/mame/includes/taito_x.h b/src/mame/includes/taito_x.h
index 2831e4612f5..4ce98f1025e 100644
--- a/src/mame/includes/taito_x.h
+++ b/src/mame/includes/taito_x.h
@@ -17,7 +17,7 @@ public:
DECLARE_MACHINE_START(superman);
void reset_sound_region();
DECLARE_WRITE_LINE_MEMBER(irqhandler);
-
+
// superman c-chip
UINT16 m_current_bank;
UINT8 m_cc_port;
@@ -26,4 +26,4 @@ public:
DECLARE_WRITE16_MEMBER( cchip1_ctrl_w );
DECLARE_WRITE16_MEMBER( cchip1_bank_w );
DECLARE_WRITE16_MEMBER( cchip1_ram_w );
-}; \ No newline at end of file
+};
diff --git a/src/mame/includes/toki.h b/src/mame/includes/toki.h
index d530e209699..957d237c974 100644
--- a/src/mame/includes/toki.h
+++ b/src/mame/includes/toki.h
@@ -22,7 +22,7 @@ public:
required_shared_ptr<UINT16> m_background2_videoram16;
required_shared_ptr<UINT16> m_videoram;
required_shared_ptr<UINT16> m_scrollram16;
-
+
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
optional_device<seibu_sound_device> m_seibu_sound;
diff --git a/src/mame/includes/topspeed.h b/src/mame/includes/topspeed.h
index 32f424a0b7a..3c5206374cf 100644
--- a/src/mame/includes/topspeed.h
+++ b/src/mame/includes/topspeed.h
@@ -50,19 +50,19 @@ public:
required_device<filter_volume_device> m_filter3;
// Misc
- UINT16 m_cpua_ctrl;
- INT32 m_ioc220_port;
+ UINT16 m_cpua_ctrl;
+ INT32 m_ioc220_port;
// ADPCM
- UINT8 *m_msm_rom[2];
- UINT16 m_msm_pos[2];
- UINT8 m_msm_reset[2];
- UINT8 m_msm_nibble[2];
- UINT8 m_msm2_vck;
- UINT8 m_msm2_vck2;
+ UINT8 *m_msm_rom[2];
+ UINT16 m_msm_pos[2];
+ UINT8 m_msm_reset[2];
+ UINT8 m_msm_nibble[2];
+ UINT8 m_msm2_vck;
+ UINT8 m_msm2_vck2;
#ifdef MAME_DEBUG
- UINT8 m_dislayer[5];
+ UINT8 m_dislayer[5];
#endif
// drivers/topspeed.c
diff --git a/src/mame/includes/vicdual.h b/src/mame/includes/vicdual.h
index 59ef71aa867..c4e6b76d949 100644
--- a/src/mame/includes/vicdual.h
+++ b/src/mame/includes/vicdual.h
@@ -40,7 +40,7 @@ public:
UINT8 m_samurai_protection_data;
int m_nsub_coin_counter;
int m_nsub_play_counter;
-
+
int m_port1State;
int m_port2State;
int m_psgData;
@@ -79,27 +79,27 @@ public:
DECLARE_READ8_MEMBER(invinco_io_r);
DECLARE_WRITE8_MEMBER(invinco_io_w);
DECLARE_WRITE8_MEMBER(vicdual_palette_bank_w);
-
+
/*----------- defined in audio/vicdual.c -----------*/
DECLARE_WRITE8_MEMBER( frogs_audio_w );
DECLARE_WRITE8_MEMBER( headon_audio_w );
DECLARE_WRITE8_MEMBER( invho2_audio_w );
TIMER_CALLBACK_MEMBER( frogs_croak_callback );
-
+
/*----------- defined in audio/carnival.c -----------*/
DECLARE_WRITE8_MEMBER( carnival_audio_1_w );
DECLARE_WRITE8_MEMBER( carnival_audio_2_w );
DECLARE_READ8_MEMBER( carnival_music_port_t1_r );
DECLARE_WRITE8_MEMBER( carnival_music_port_1_w );
DECLARE_WRITE8_MEMBER( carnival_music_port_2_w );
-
+
/*----------- defined in audio/depthch.c -----------*/
DECLARE_WRITE8_MEMBER( depthch_audio_w );
-
+
/*----------- defined in audio/invinco.c -----------*/
DECLARE_WRITE8_MEMBER( invinco_audio_w );
-
+
/*----------- defined in audio/pulsar.c -----------*/
DECLARE_WRITE8_MEMBER( pulsar_audio_1_w );
DECLARE_WRITE8_MEMBER( pulsar_audio_2_w );
diff --git a/src/mame/includes/wolfpack.h b/src/mame/includes/wolfpack.h
index c51b60912e0..8606de4284c 100644
--- a/src/mame/includes/wolfpack.h
+++ b/src/mame/includes/wolfpack.h
@@ -15,10 +15,10 @@ public:
m_s14001a(*this, "speech") { }
required_shared_ptr<UINT8> m_alpha_num_ram;
-
+
required_device<cpu_device> m_maincpu;
required_device<s14001a_device> m_s14001a;
-
+
int m_collision;
unsigned m_current_index;
UINT8 m_video_invert;
diff --git a/src/mame/includes/xybots.h b/src/mame/includes/xybots.h
index ae1f64a7096..3474b6b889e 100644
--- a/src/mame/includes/xybots.h
+++ b/src/mame/includes/xybots.h
@@ -19,10 +19,10 @@ public:
m_mob(*this, "mob") { }
required_device<atari_jsa_i_device> m_jsa;
- required_device<tilemap_device> m_playfield_tilemap;
- required_device<tilemap_device> m_alpha_tilemap;
+ required_device<tilemap_device> m_playfield_tilemap;
+ required_device<tilemap_device> m_alpha_tilemap;
required_device<atari_motion_objects_device> m_mob;
-
+
UINT16 m_h256;
virtual void update_interrupts();
DECLARE_READ16_MEMBER(special_port1_r);
diff --git a/src/mame/includes/zac2650.h b/src/mame/includes/zac2650.h
index a9b379d920c..3fc188e1be7 100644
--- a/src/mame/includes/zac2650.h
+++ b/src/mame/includes/zac2650.h
@@ -12,10 +12,10 @@ public:
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_s2636_0_ram;
-
+
required_device<cpu_device> m_maincpu;
required_device<s2636_device> m_s2636_sound;
-
+
bitmap_ind16 m_bitmap;
bitmap_ind16 m_spritebitmap;
int m_CollisionBackground;
diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c
index 70b5e6b43fd..44f19d144f2 100644
--- a/src/mame/machine/atarigen.c
+++ b/src/mame/machine/atarigen.c
@@ -871,7 +871,7 @@ atari_eeprom_device::atari_eeprom_device(const machine_config &mconfig, device_t
//-------------------------------------------------
// unlock_read/unlock_write - unlock read/write
-// handlers
+// handlers
//-------------------------------------------------
READ8_MEMBER(atari_eeprom_device::unlock_read) { m_unlocked = true; return space.unmap(); }
@@ -936,7 +936,7 @@ atari_eeprom_2804_device::atari_eeprom_2804_device(const machine_config &mconfig
//-------------------------------------------------
// device_mconfig_additions - return machine
-// config fragment
+// config fragment
//-------------------------------------------------
MACHINE_CONFIG_FRAGMENT(atari_eeprom_2804_config)
@@ -961,7 +961,7 @@ atari_eeprom_2816_device::atari_eeprom_2816_device(const machine_config &mconfig
//-------------------------------------------------
// device_mconfig_additions - return machine
-// config fragment
+// config fragment
//-------------------------------------------------
MACHINE_CONFIG_FRAGMENT(atari_eeprom_2816_config)
diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h
index cb10be86a06..9d62ac76496 100644
--- a/src/mame/machine/atarigen.h
+++ b/src/mame/machine/atarigen.h
@@ -102,8 +102,7 @@
#define MCFG_ATARI_VAD_MOB(_config) \
{ astring fulltag(device->tag(), ":mob"); device_t *device; \
- MCFG_ATARI_MOTION_OBJECTS_ADD(fulltag, "^^screen", _config) } \
-
+ MCFG_ATARI_MOTION_OBJECTS_ADD(fulltag, "^^screen", _config) }
#define MCFG_ATARI_EEPROM_2804_ADD(_tag) \
@@ -202,7 +201,7 @@ private:
// device type definition
extern const device_type ATARI_VAD;
-class atari_vad_device : public device_t,
+class atari_vad_device : public device_t,
public device_video_interface
{
public:
@@ -298,7 +297,7 @@ public:
DECLARE_WRITE16_MEMBER(unlock_write);
DECLARE_READ32_MEMBER(unlock_read);
DECLARE_WRITE32_MEMBER(unlock_write);
-
+
// EEPROM read/write
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@@ -310,9 +309,9 @@ protected:
// internal state
required_device<eeprom_parallel_28xx_device> m_eeprom;
-
+
// live state
- bool m_unlocked;
+ bool m_unlocked;
};
class atari_eeprom_2804_device : public atari_eeprom_device
@@ -337,7 +336,7 @@ protected:
virtual machine_config_constructor device_mconfig_additions() const;
};
-
+
/***************************************************************************
TYPES & STRUCTURES
diff --git a/src/mame/machine/cd32.c b/src/mame/machine/cd32.c
index 803a8c4335d..32c0203101b 100644
--- a/src/mame/machine/cd32.c
+++ b/src/mame/machine/cd32.c
@@ -61,7 +61,7 @@ akiko_device::akiko_device(const machine_config &mconfig, const char *tag, devic
m_c2p_input_buffer[i] = 0;
m_c2p_output_buffer[i] = 0;
}
-
+
for (int i = 0; i < 2; i++)
{
m_cdrom_status[i] = 0;
diff --git a/src/mame/machine/deco104.c b/src/mame/machine/deco104.c
index 5d7af0dc571..f74f51d9c37 100644
--- a/src/mame/machine/deco104.c
+++ b/src/mame/machine/deco104.c
@@ -4,9 +4,9 @@
(a variation on the Deco 146 protection, see deco146.c for notes)
Emulation by David Haywood
- based on findings by Charles MacDonald
+ based on findings by Charles MacDonald
- previous protection simulations by Bryan McPhail
+ previous protection simulations by Bryan McPhail
***************************************************************************/
@@ -20,1033 +20,1032 @@
deco146port_xx port104_table[] = {
+ /* 0x000 */ { 0x04, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x002 */ { 0x2a, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
+ /* 0x004 */ { 0x5e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x006 */ { 0x98, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x008 */ { 0x94, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x00a */ { 0xbe, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x00c */ { 0xd6, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x00e */ { 0xe4, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x010 */ { 0x90, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x012 */ { 0xa8, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x014 */ { 0x24, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x016 */ { 0xfc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x018 */ { 0x08, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x01a */ { INPUT_PORT_C , { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $001A ; 0x0010
+ /* 0x01c */ { 0x72, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x01e */ { 0xc4, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x020 */ { 0xd0, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x022 */ { 0x66, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 1 },
+ /* 0x024 */ { 0x8c, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x026 */ { 0xec, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x028 */ { 0x58, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x02a */ { 0x80, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x02c */ { 0x82, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 1 },
+ /* 0x02e */ { 0x6a, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x030 */ { 0x00, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x032 */ { 0x60, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x034 */ { INPUT_PORT_B , { NIB0R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x036 */ { 0xae, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x038 */ { 0x12, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x03a */ { 0x42, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x03c */ { 0x1e, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x03e */ { 0xf6, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x040 */ { 0xdc, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x042 */ { 0x34, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x044 */ { 0x2c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x046 */ { 0x7a, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x048 */ { 0x10, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x04a */ { 0x9e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x04c */ { 0x3e, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x04e */ { 0x0e, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x050 */ { 0xa4, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
+ /* 0x052 */ { 0x0c, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x054 */ { 0x40, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x056 */ { 0x20, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x058 */ { 0x46, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x05a */ { 0x6c, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x05c */ { 0x9a, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x05e */ { 0x18, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x060 */ { 0xe0, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x062 */ { 0x30, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x064 */ { 0xca, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x066 */ { 0xac, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x068 */ { 0xe8, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x06a */ { 0x66, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x06c */ { 0x14, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x06e */ { 0x96, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x070 */ { 0x5c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x072 */ { 0x0a, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x074 */ { INPUT_PORT_B , { NIB0R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x076 */ { INPUT_PORT_C , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 }, // dc.w $0076 ; 0x1000 dc.w $0076 ; 0x1000 ; nand
+ /* 0x078 */ { 0x5a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x07a */ { 0x74, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x07c */ { 0xb4, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x07e */ { 0x86, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x080 */ { 0x84, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x082 */ { 0x28, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x084 */ { 0x50, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x086 */ { 0x66, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x088 */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0088
+ /* 0x08a */ { 0x1c, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x08c */ { 0x48, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x08e */ { 0xc2, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x090 */ { 0x44, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x092 */ { 0x3c, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x094 */ { 0xfa, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x096 */ { 0x22, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x098 */ { 0xf0, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x09a */ { 0x2e, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
+ /* 0x09c */ { 0x06, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x09e */ { 0x64, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
+ /* 0x0a0 */ { 0xcc, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x0a2 */ { 0x7a, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x0a4 */ { 0xb2, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x0a6 */ { 0xbe, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x0a8 */ { 0xde, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x0aa */ { 0xf8, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x0ac */ { 0xca, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x0ae */ { 0x3e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x0b0 */ { 0xb6, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x0b2 */ { 0xd8, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x0b4 */ { INPUT_PORT_C , { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 }, // dc.w $00B4 ; 0x1000
+ /* 0x0b6 */ { 0xc0, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x0b8 */ { 0xa2, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x0ba */ { 0xe6, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x0bc */ { 0x1a, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x0be */ { 0xb0, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x0c0 */ { 0x4c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x0c2 */ { 0x56, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x0c4 */ { 0xee, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x0c6 */ { 0xd4, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x0c8 */ { INPUT_PORT_A , { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 }, // dc.w $00C8 ; xor
+ /* 0x0ca */ { 0xda, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x0cc */ { 0xce, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
+ /* 0x0ce */ { 0xf2, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x0d0 */ { 0x8e, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 1 },
+ /* 0x0d2 */ { 0x3a, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x0d4 */ { 0x6e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x0d6 */ { 0xa6, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x0d8 */ { 0x78, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 0 },
+ /* 0x0da */ { 0xbc, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x0dc */ { 0xba, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x0de */ { 0x36, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x0e0 */ { 0x66, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x0e2 */ { 0x92, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x0e4 */ { 0x52, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x0e6 */ { 0xf4, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x0e8 */ { INPUT_PORT_B , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x0ea */ { 0xc6, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x0ec */ { 0xea, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x0ee */ { 0xfe, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x0f0 */ { 0xb2, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x0f2 */ { 0x32, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x0f4 */ { 0x76, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x0f6 */ { 0xe2, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x0f8 */ { 0x7c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x0fa */ { 0xa0, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x0fc */ { 0x4a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x0fe */ { 0x70, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x100 */ { 0x64, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x102 */ { 0x04, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x104 */ { 0xe2, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x106 */ { 0xca, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x108 */ { 0xa4, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x10a */ { 0x12, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x10c */ { 0xaa, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x10e */ { 0x7c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x110 */ { 0xf4, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x112 */ { 0xda, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x114 */ { 0x7a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x116 */ { 0x3a, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x118 */ { 0x00, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x11a */ { 0x66, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x11c */ { 0xce, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x11e */ { 0xb6, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x120 */ { 0x1c, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x122 */ { 0x82, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x124 */ { 0x4a, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x126 */ { 0x58, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x128 */ { 0xbe, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x12a */ { 0x36, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x12c */ { 0x9a, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
+ /* 0x12e */ { 0x02, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
+ /* 0x130 */ { 0xea, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x132 */ { 0xae, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x134 */ { 0x52, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x136 */ { 0xdc, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x138 */ { 0x9e, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x13a */ { 0xfc, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 1 },
+ /* 0x13c */ { 0x4c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x13e */ { 0x76, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x140 */ { 0x8c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
+ /* 0x142 */ { 0xd4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x144 */ { 0x3e, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x146 */ { 0x16, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x148 */ { 0xb8, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x14a */ { 0x50, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x14c */ { 0x42, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 0 }, // xor readback address, affected by xor, funky
+ /* 0x14e */ { 0xd6, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x150 */ { 0x7e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x152 */ { 0x92, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x154 */ { INPUT_PORT_A , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x156 */ { 0xde, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x158 */ { 0x1a, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x15a */ { 0x9c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 1 },
+ /* 0x15c */ { 0x14, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x15e */ { 0x98, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x160 */ { 0x40, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x162 */ { 0x6e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x164 */ { 0xc4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x166 */ { 0xc6, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x168 */ { 0x84, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x16a */ { 0x8e, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x16c */ { 0x96, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x16e */ { 0x6a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x170 */ { 0xf0, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x172 */ { 0x2a, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x174 */ { 0x1e, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x176 */ { 0x62, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x178 */ { 0x88, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x17a */ { 0xe0, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x17c */ { INPUT_PORT_A , { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 }, // dc.w $017C ; xor,nand
+ /* 0x17e */ { 0xcc, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x180 */ { INPUT_PORT_A , { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x182 */ { 0x46, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x184 */ { 0x90, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x186 */ { 0x72, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x188 */ { 0xee, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x18a */ { 0x2c, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x18c */ { 0x22, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x18e */ { 0x38, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x190 */ { 0x44, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x192 */ { 0xc0, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x194 */ { 0x54, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x196 */ { 0x6c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x198 */ { 0xfa, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x19a */ { 0x34, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x19c */ { 0xa8, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x19e */ { 0x3c, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x1a0 */ { 0x7e, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x1a2 */ { 0x4e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1a4 */ { 0x9c, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x1a6 */ { 0x16, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x1a8 */ { 0x38, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x1aa */ { 0xc8, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x1ac */ { 0x68, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x1ae */ { 0x54, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1b0 */ { 0xba, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x1b2 */ { 0x78, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1b4 */ { 0xcc, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x1b6 */ { 0xfe, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x1b8 */ { 0x86, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x1ba */ { 0x18, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x1bc */ { 0x0e, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x1be */ { 0xc2, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x1c0 */ { INPUT_PORT_C , { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 }, // dc.w $01C0 ; 0x1000
+ /* 0x1c2 */ { 0x0c, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x1c4 */ { INPUT_PORT_A , { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1c6 */ { 0x70, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1c8 */ { INPUT_PORT_A , { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1ca */ { 0x5c, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x1cc */ { 0xac, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x1ce */ { 0x48, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x1d0 */ { 0x0a, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
+ /* 0x1d2 */ { 0x94, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x1d4 */ { 0x66, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x1d6 */ { 0xf8, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x1d8 */ { 0x68, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1da */ { 0x24, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x1dc */ { 0x66, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x1de */ { 0xa6, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x1e0 */ { 0x74, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1e2 */ { 0xd0, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x1e4 */ { 0x5e, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 1 },
+ /* 0x1e6 */ { 0xe6, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x1e8 */ { 0x66, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1ea */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x1ec */ { INPUT_PORT_B , { NIB1R2, BLANK_, BLANK_, BLANK_ } , 0, 1 }, // dc.w $01EC ; nand
+ /* 0x1ee */ { 0xc8, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x1f0 */ { 0xa2, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x1f2 */ { 0x60, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x1f4 */ { 0xbc, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 1 },
+ /* 0x1f6 */ { 0x06, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x1f8 */ { 0x2e, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x1fa */ { 0x26, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x1fc */ { 0x56, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x1fe */ { 0xd2, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x200 */ { 0xa0, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x202 */ { 0x34, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x204 */ { 0xf6, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x206 */ { INPUT_PORT_A , { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x208 */ { 0xae, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x20a */ { 0xf4, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x20c */ { INPUT_PORT_C , { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 }, // dc.w $020C ; Bit not present dc.w $020C ; Bit not present ; xor,nand
+ /* 0x20e */ { 0x4e, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x210 */ { 0x0e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x212 */ { 0x6e, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x214 */ { 0x4a, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 1 },
+ /* 0x216 */ { 0x0a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x218 */ { 0x82, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 1 },
+ /* 0x21a */ { 0x66, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x21c */ { 0x6c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x21e */ { 0xb8, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x220 */ { 0x12, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x222 */ { 0x06, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x224 */ { 0x00, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x226 */ { 0x72, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x228 */ { 0xe4, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x22a */ { 0x90, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x22c */ { 0xc4, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x22e */ { 0x08, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x230 */ { 0x98, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x232 */ { 0xda, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x234 */ { 0x3a, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
+ /* 0x236 */ { 0xcc, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
+ /* 0x238 */ { 0x7c, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x23a */ { 0x86, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x23c */ { 0x56, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 1 },
+ /* 0x23e */ { 0x8a, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x240 */ { 0xa0, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x242 */ { 0x04, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x244 */ { 0x32, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x246 */ { 0x48, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x248 */ { 0x8c, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x24a */ { 0xa2, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x24c */ { 0xfa, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x24e */ { 0x46, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x250 */ { 0x62, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x252 */ { 0xe0, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x254 */ { 0x7e, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x256 */ { 0xce, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x258 */ { 0xf8, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x25a */ { 0x6a, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x25c */ { 0x58, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x25e */ { 0xc0, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
+ /* 0x260 */ { 0xe2, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x262 */ { 0x30, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x264 */ { 0x88, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x266 */ { 0xe8, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x268 */ { 0xac, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
+ /* 0x26a */ { 0xe6, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x26c */ { 0xc2, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x26e */ { 0xa8, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x270 */ { INPUT_PORT_C , { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 }, // dc.w $0270 ; 0x0010
+ /* 0x272 */ { 0x3c, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x274 */ { 0x68, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x276 */ { 0x2e, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x278 */ { 0x18, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x27a */ { 0x02, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x27c */ { 0x70, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x27e */ { 0x94, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x280 */ { 0x5e, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x282 */ { 0x26, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x284 */ { 0x14, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x286 */ { 0x7a, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x288 */ { 0xd2, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x28a */ { 0xd4, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x28c */ { 0xa6, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
+ /* 0x28e */ { 0x36, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x290 */ { 0xee, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x292 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0292 ; 0x0001
+ /* 0x294 */ { 0x66, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x296 */ { 0x5a, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x298 */ { 0x64, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x29a */ { 0x60, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x29c */ { 0xec, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x29e */ { 0x80, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x2a0 */ { 0xd0, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x2a2 */ { 0x44, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x2a4 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 }, // dc.w $02A4 ; 0x0001
+ /* 0x2a6 */ { 0xbc, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
+ /* 0x2a8 */ { 0x22, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x2aa */ { 0xb2, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x2ac */ { 0x1e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x2ae */ { 0x9c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
+ /* 0x2b0 */ { 0x96, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
+ /* 0x2b2 */ { 0x8e, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x2b4 */ { 0xb6, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x2b6 */ { 0xfe, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 1 },
+ /* 0x2b8 */ { 0x66, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x2ba */ { 0xf0, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x2bc */ { 0x20, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x2be */ { 0x40, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x2c0 */ { 0x4c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x2c2 */ { 0x76, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
+ /* 0x2c4 */ { 0xca, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x2c6 */ { 0x50, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x2c8 */ { 0x1c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x2ca */ { 0x1a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x2cc */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x2ce */ { 0x92, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x2d0 */ { 0x66, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
+ /* 0x2d2 */ { 0x28, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x2d4 */ { 0x74, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x2d6 */ { 0x16, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x2d8 */ { 0x9e, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x2da */ { 0xde, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x2dc */ { 0xba, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x2de */ { 0x78, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x2e0 */ { 0x9a, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x2e2 */ { 0xc6, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x2e4 */ { 0x42, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x2e6 */ { 0xea, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x2e8 */ { 0x0c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x2ea */ { 0xd8, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x2ec */ { 0x5c, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x2ee */ { 0xaa, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x2f0 */ { 0xb4, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x2f2 */ { 0xf2, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x2f4 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 }, // dc.w $02F4 ; 0x0001 dc.w $02F4 ; 0x0001 ; nand
+ /* 0x2f6 */ { 0x84, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x2f8 */ { 0xa4, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x2fa */ { INPUT_PORT_C , { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $02FA ; 0x0008
+ /* 0x2fc */ { 0xfc, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 0 },
+ /* 0x2fe */ { 0x10, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x300 */ { 0xa4, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x302 */ { 0x24, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x304 */ { 0xe2, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x306 */ { 0x32, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x308 */ { 0x2a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x30a */ { 0x66, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x30c */ { 0x86, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x30e */ { 0xaa, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x310 */ { 0x66, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x312 */ { 0x4e, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x314 */ { 0x84, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x316 */ { 0x96, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x318 */ { 0x26, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x31a */ { 0x64, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x31c */ { 0xac, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x31e */ { 0x78, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x320 */ { 0xfe, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x322 */ { 0x2e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x324 */ { 0x06, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x326 */ { 0x92, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x328 */ { 0x34, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x32a */ { 0xc0, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x32c */ { 0x8a, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x32e */ { 0x46, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x330 */ { 0xd8, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x332 */ { 0xc4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x334 */ { 0x30, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x336 */ { 0x1a, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x338 */ { 0xd0, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x33a */ { 0x60, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x33c */ { 0xf6, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x33e */ { 0x00, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x340 */ { 0x90, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x342 */ { 0xfc, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x344 */ { 0x08, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x346 */ { 0xa8, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x348 */ { 0x44, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x34a */ { 0x04, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x34c */ { 0x3c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x34e */ { 0xde, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x350 */ { 0x72, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x352 */ { 0x62, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x354 */ { 0x3a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x356 */ { 0xba, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x358 */ { 0x68, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x35a */ { 0x76, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x35c */ { 0x9e, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x35e */ { 0xc6, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x360 */ { 0xe4, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x362 */ { 0x02, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x364 */ { 0x6c, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x366 */ { 0xec, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x368 */ { INPUT_PORT_C , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 }, // dc.w $0368 ; 0x1000
+ /* 0x36a */ { INPUT_PORT_A , { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x36c */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x36e */ { 0x0c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 1 },
+ /* 0x370 */ { 0x80, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x372 */ { 0x82, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x374 */ { 0xb8, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x376 */ { 0x50, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x378 */ { 0x20, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x37a */ { 0xf4, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x37c */ { 0x8c, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x37e */ { 0xe6, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x380 */ { 0xda, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x382 */ { 0xf2, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x384 */ { 0xdc, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x386 */ { 0x9c, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x388 */ { INPUT_PORT_A , { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x38a */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x38c */ { 0x28, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x38e */ { 0xb6, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x390 */ { 0x2c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x392 */ { 0xce, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x394 */ { 0x0e, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x396 */ { 0x5c, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x398 */ { 0x52, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
+ /* 0x39a */ { 0x7e, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x39c */ { 0x6a, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x39e */ { 0xa0, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x3a0 */ { 0x52, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x3a2 */ { 0x94, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x3a4 */ { 0x2c, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x3a6 */ { 0xc8, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x3a8 */ { 0x18, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x3aa */ { 0x56, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x3ac */ { 0x54, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x3ae */ { 0x58, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x3b0 */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x3b2 */ { 0x14, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x3b4 */ { 0x38, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x3b6 */ { 0xf8, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x3b8 */ { 0xb4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x3ba */ { 0xd6, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x3bc */ { 0x5c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
+ /* 0x3be */ { 0x1c, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x3c0 */ { 0x22, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x3c2 */ { 0x66, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x3c4 */ { 0x8e, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x3c6 */ { 0xf0, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x3c8 */ { 0xae, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x3ca */ { 0x1e, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x3cc */ { 0xee, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x3ce */ { 0xea, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 1 },
+ /* 0x3d0 */ { 0xe8, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x3d2 */ { 0x88, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x3d4 */ { INPUT_PORT_C , { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 }, // dc.w $03D4 ; 0x0010
+ /* 0x3d6 */ { 0x66, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x3d8 */ { INPUT_PORT_B , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x3da */ { 0xfa, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x3dc */ { 0x4c, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x3de */ { 0x36, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x3e0 */ { 0xe0, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x3e2 */ { 0xd4, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x3e4 */ { 0xc8, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x3e6 */ { 0xc2, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x3e8 */ { 0x0a, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x3ea */ { 0x9a, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x3ec */ { 0x7c, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x3ee */ { 0x4a, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x3f0 */ { 0xd2, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x3f2 */ { 0x48, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x3f4 */ { 0x6e, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x3f6 */ { 0xa6, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
+ /* 0x3f8 */ { 0x42, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x3fa */ { 0x5e, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x3fc */ { 0xbc, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x3fe */ { 0x10, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x400 */ { 0x02, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x402 */ { 0x72, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x404 */ { 0x74, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x406 */ { 0x96, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x408 */ { 0x54, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x40a */ { 0xda, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x40c */ { 0xd6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x40e */ { 0x8a, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x410 */ { 0xde, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x412 */ { 0xa4, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x414 */ { 0xa2, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
+ /* 0x416 */ { 0xe4, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x418 */ { 0x04, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x41a */ { 0x84, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x41c */ { 0x2a, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x41e */ { 0x4c, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x420 */ { 0x2e, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x422 */ { 0x86, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x424 */ { 0x60, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x426 */ { 0xba, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x428 */ { 0x8c, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x42a */ { 0xee, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
+ /* 0x42c */ { 0xac, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x42e */ { 0x32, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
+ /* 0x430 */ { 0xd2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x432 */ { 0x0e, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x434 */ { 0x06, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 1 },
+ /* 0x436 */ { 0x66, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x438 */ { 0xec, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x43a */ { 0xfe, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x43c */ { INPUT_PORT_B , { BLANK_, BLANK_, BLANK_, BLANK_ } , 0, 0 }, // this address always seems to return 0, is it a port with all bits masked out? I'm going to assume it's a 'B' port (4-bit) with mask applied to those 4 bits so they always return 0 due to a design flaw, that would make 21 of each port type.
+ /* 0x43e */ { 0x7a, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x440 */ { 0xfc, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x442 */ { 0x10, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x444 */ { 0x66, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x446 */ { 0x16, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x448 */ { 0x90, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x44a */ { 0xb4, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x44c */ { INPUT_PORT_B, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 }, //dc.w $044C ; nand
+ /* 0x44e */ { 0x44, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x450 */ { INPUT_PORT_C , { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 }, // dc.w $0450 ; 0x0100 dc.w $0450 ; 0x0100 ; xor
+ /* 0x452 */ { 0x30, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x454 */ { 0x82, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x456 */ { 0x26, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x458 */ { 0x52, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x45a */ { 0xc6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x45c */ { 0xd8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x45e */ { 0x18, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x460 */ { 0xc8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x462 */ { 0x64, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x464 */ { 0xbe, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x466 */ { 0x42, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x468 */ { 0xc0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x46a */ { 0x38, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x46c */ { 0xd0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x46e */ { 0x9c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x470 */ { 0xa8, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x472 */ { 0x4a, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x474 */ { 0x1c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
+ /* 0x476 */ { 0xf0, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x478 */ { 0xb6, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x47a */ { 0xc2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x47c */ { 0x7e, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x47e */ { INPUT_PORT_B , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x480 */ { 0x5a, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x482 */ { 0x5c, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x484 */ { 0x5a, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x486 */ { 0x06, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x488 */ { 0x2c, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x48a */ { 0x76, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x48c */ { 0xbc, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x48e */ { 0x46, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x490 */ { 0x66, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x492 */ { 0xea, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x494 */ { 0x9a, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x496 */ { 0xb8, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 1 },
+ /* 0x498 */ { 0x36, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x49a */ { 0x56, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x49c */ { 0x6c, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x49e */ { 0x12, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x4a0 */ { 0xa4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4a2 */ { 0xa8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4a4 */ { 0xce, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 1 },
+ /* 0x4a6 */ { 0x8c, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4a8 */ { 0xb0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4aa */ { 0x48, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x4ac */ { INPUT_PORT_A , { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
+ /* 0x4ae */ { 0x92, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x4b0 */ { 0x10, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x4b2 */ { 0x74, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x4b4 */ { 0x08, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x4b6 */ { 0x94, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x4b8 */ { 0x46, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x4ba */ { 0x24, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x4bc */ { 0x42, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x4be */ { 0xa6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4c0 */ { 0x08, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x4c2 */ { 0x80, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x4c4 */ { 0x3c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x4c6 */ { 0x94, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x4c8 */ { INPUT_PORT_A , { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4ca */ { 0x20, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x4cc */ { 0xf6, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x4ce */ { 0x66, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x4d0 */ { 0xe2, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x4d2 */ { INPUT_PORT_B , { NIB0R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x4d4 */ { 0xd4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4d6 */ { 0xa0, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
+ /* 0x4d8 */ { 0x48, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x4da */ { 0xca, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4dc */ { 0x62, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x4de */ { 0x70, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x4e0 */ { 0xfa, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x4e2 */ { 0x9e, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x4e4 */ { 0x40, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x4e6 */ { 0x68, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x4e8 */ { 0x88, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x4ea */ { 0x3e, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x4ec */ { 0x7c, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x4ee */ { 0xcc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x4f0 */ { 0x34, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x4f2 */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 }, // dc.w $04F2
+ /* 0x4f4 */ { 0x28, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x4f6 */ { 0xe6, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x4f8 */ { 0x6a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x4fa */ { 0xaa, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
+ /* 0x4fc */ { 0x50, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x4fe */ { 0xa6, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 1 },
+ /* 0x500 */ { 0xf0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x502 */ { 0x88, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x504 */ { 0x5c, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x506 */ { INPUT_PORT_C , { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0506 ; 0x0004
+ /* 0x508 */ { INPUT_PORT_A , { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x50a */ { 0xc0, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
+ /* 0x50c */ { 0x26, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x50e */ { 0x72, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x510 */ { 0x8a, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
+ /* 0x512 */ { 0x06, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x514 */ { 0x32, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x516 */ { 0xb6, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x518 */ { 0x02, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x51a */ { 0xb2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x51c */ { 0x0a, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x51e */ { 0xd6, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x520 */ { 0xaa, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x522 */ { 0xca, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x524 */ { 0x54, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x526 */ { 0x08, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x528 */ { INPUT_PORT_B , { NIB2__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x52a */ { 0x8e, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x52c */ { 0xe0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x52e */ { 0xba, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x530 */ { 0x18, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x532 */ { 0xb0, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x534 */ { 0x1a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x536 */ { 0x7a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x538 */ { 0x3c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x53a */ { 0x0c, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x53c */ { 0xfa, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x53e */ { 0x9e, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x540 */ { 0x3e, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x542 */ { 0x9c, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x544 */ { 0x5a, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x546 */ { 0x62, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x548 */ { 0xf6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x54a */ { 0xde, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x54c */ { 0x38, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
+ /* 0x54e */ { 0xe6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x550 */ { 0xa2, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x552 */ { 0x4c, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x554 */ { 0xae, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x556 */ { 0xac, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x558 */ { 0x68, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x55a */ { 0xf2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x55c */ { 0x66, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x55e */ { 0xea, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x560 */ { 0x82, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x562 */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 1, 0 }, // dc.w $0562 ; xor
+ /* 0x564 */ { 0x80, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x566 */ { 0xf8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x568 */ { 0x6c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x56a */ { 0x7c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x56c */ { INPUT_PORT_A , { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x56e */ { 0x98, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x570 */ { 0x24, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x572 */ { 0xc2, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 1 },
+ /* 0x574 */ { 0xdc, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x576 */ { 0x52, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x578 */ { 0x2a, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x57a */ { 0xb8, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x57c */ { 0x28, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x57e */ { 0xd8, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x580 */ { 0x0c, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x582 */ { 0x8e, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x584 */ { 0x22, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x586 */ { 0x00, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x588 */ { 0x04, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x58a */ { 0x22, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x58c */ { 0xe8, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x58e */ { 0x74, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x590 */ { 0x0e, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x592 */ { 0x66, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x594 */ { 0x40, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x596 */ { 0xc8, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x598 */ { 0x70, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x59a */ { 0x16, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x59c */ { 0x12, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x59e */ { 0x36, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x5a0 */ { 0x5e, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x5a2 */ { 0x24, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x5a4 */ { 0xce, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5a6 */ { 0xb0, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x5a8 */ { 0xf2, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x5aa */ { 0x98, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x5ac */ { 0x6e, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x5ae */ { 0xdc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5b0 */ { 0xc4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5b2 */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x5b4 */ { 0xe0, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
+ /* 0x5b6 */ { 0x92, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x5b8 */ { 0x4e, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x5ba */ { 0xf4, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5bc */ { 0x78, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x5be */ { 0x58, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 1 },
+ /* 0x5c0 */ { 0xfe, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5c2 */ { 0x4a, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
+ /* 0x5c4 */ { 0x3a, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x5c6 */ { 0x2c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x5c8 */ { 0x96, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x5ca */ { 0x20, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x5cc */ { 0xc6, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x5ce */ { 0xa8, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x5d0 */ { 0xe2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5d2 */ { 0x66, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
+ /* 0x5d4 */ { 0xf4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5d6 */ { 0xec, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5d8 */ { 0xbe, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x5da */ { 0xe8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5dc */ { 0x6e, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x5de */ { 0x1e, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x5e0 */ { 0x14, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x5e2 */ { 0x84, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x5e4 */ { 0xa0, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x5e6 */ { 0x34, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x5e8 */ { 0xe4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x5ea */ { 0x58, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x5ec */ { INPUT_PORT_B , { NIB2__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x5ee */ { 0x42, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x5f0 */ { 0x8c, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x5f2 */ { 0x10, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x5f4 */ { INPUT_PORT_C , { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 }, // dc.w $05F4 ; 0x0100
+ /* 0x5f6 */ { 0x04, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x5f8 */ { 0x4e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x5fa */ { 0xd2, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x5fc */ { 0x7e, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x5fe */ { 0xcc, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x600 */ { 0xc6, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x602 */ { 0x20, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x604 */ { 0x36, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x606 */ { 0xfc, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x608 */ { 0x1c, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x60a */ { 0xca, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x60c */ { INPUT_PORT_A , { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x60e */ { 0xa0, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x610 */ { 0xa4, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x612 */ { 0x64, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x614 */ { 0x96, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x616 */ { 0x7e, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x618 */ { 0x0c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x61a */ { 0x38, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x61c */ { 0x66, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x61e */ { 0x22, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x620 */ { 0x1a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x622 */ { 0xae, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x624 */ { 0x9a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x626 */ { 0x4e, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x628 */ { 0x5a, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x62a */ { 0x8a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x62c */ { INPUT_PORT_A , { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 }, // dc.w $062C ; nand
+ /* 0x62e */ { 0x58, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x630 */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 1 }, // dc.w $0630 ; nand
+ /* 0x632 */ { 0x6a, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x634 */ { 0xc2, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
+ /* 0x636 */ { 0xc4, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x638 */ { 0x94, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x63a */ { 0x3c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x63c */ { 0x74, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x63e */ { 0x0a, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x640 */ { 0x30, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x642 */ { 0x68, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x644 */ { 0x40, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x646 */ { 0xda, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 0 },
+ /* 0x648 */ { 0x60, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x64a */ { 0xde, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x64c */ { 0x04, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x64e */ { 0x86, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x650 */ { 0x78, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x652 */ { 0x4a, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x654 */ { 0x4c, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x656 */ { 0x2e, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x658 */ { 0xbc, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x65a */ { 0xc0, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x65c */ { 0x44, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x65e */ { 0x9c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x660 */ { 0x48, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x662 */ { 0x8c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x664 */ { 0x9e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x666 */ { 0xfe, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x668 */ { 0x5e, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x66a */ { 0x16, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x66c */ { 0xdc, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x66e */ { 0xec, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x670 */ { 0xf4, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x672 */ { 0x6c, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x674 */ { INPUT_PORT_C , { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 }, // dc.w $0674 ; 0x0010
+ /* 0x676 */ { 0xd2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x678 */ { 0x72, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x67a */ { 0x28, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x67c */ { 0x1e, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x67e */ { INPUT_PORT_B , { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x680 */ { 0x7a, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x682 */ { 0xba, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x684 */ { 0xd8, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x686 */ { 0x46, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
+ /* 0x688 */ { 0xe4, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x68a */ { 0xd0, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x68c */ { 0x50, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x68e */ { 0x92, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x690 */ { 0x10, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x692 */ { 0x88, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x694 */ { 0xf2, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
+ /* 0x696 */ { 0xce, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x698 */ { 0x12, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x69a */ { 0x3e, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x69c */ { 0x06, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 1 },
+ /* 0x69e */ { 0xe8, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x6a0 */ { 0xb2, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x6a2 */ { 0x28, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x6a4 */ { 0xa0, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x6a6 */ { 0xe4, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x6a8 */ { 0x32, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x6aa */ { 0x20, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x6ac */ { 0xf6, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x6ae */ { 0xf2, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x6b0 */ { 0x10, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x6b2 */ { 0xb4, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x6b4 */ { 0xa0, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x6b6 */ { 0x30, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 1 },
+ /* 0x6b8 */ { 0xea, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x6ba */ { 0xf6, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x6bc */ { 0x42, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x6be */ { INPUT_PORT_A , { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 }, // dc.w $06BE ; xor
+ /* 0x6c0 */ { 0x08, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 1 },
+ /* 0x6c2 */ { 0x54, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x6c4 */ { 0x66, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x6c6 */ { 0xcc, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x6c8 */ { 0x52, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x6ca */ { 0xd4, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x6cc */ { INPUT_PORT_C , { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $06CC ; 0x0002
+ /* 0x6ce */ { 0x0e, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x6d0 */ { 0xb2, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x6d2 */ { 0xa2, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x6d4 */ { 0xb4, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x6d6 */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 }, // dc.w $06D6 ; xor
+ /* 0x6d8 */ { 0xac, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x6da */ { 0x24, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x6dc */ { 0xbe, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
+ /* 0x6de */ { 0xa8, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x6e0 */ { 0x2c, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x6e2 */ { 0x90, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x6e4 */ { 0x98, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x6e6 */ { 0x70, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x6e8 */ { 0xb6, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
+ /* 0x6ea */ { 0xb8, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
+ /* 0x6ec */ { 0x66, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x6ee */ { 0x2a, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
+ /* 0x6f0 */ { 0x62, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x6f2 */ { 0xc8, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x6f4 */ { 0x14, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x6f6 */ { 0xa6, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x6f8 */ { 0xe6, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
+ /* 0x6fa */ { 0xee, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x6fc */ { 0x82, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x6fe */ { 0x26, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 1 },
+ /* 0x700 */ { 0x66, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
+ /* 0x702 */ { 0x2c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x704 */ { 0x7c, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x706 */ { 0x18, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x708 */ { 0xda, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 0 },
+ /* 0x70a */ { 0xde, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x70c */ { 0x6e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x70e */ { 0x26, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x710 */ { 0xca, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x712 */ { 0xf0, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x714 */ { 0x82, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x716 */ { 0xc0, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x718 */ { 0x8e, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x71a */ { 0x20, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x71c */ { 0x4e, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x71e */ { 0xe0, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x720 */ { 0x66, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
+ /* 0x722 */ { 0xdc, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x724 */ { 0xb2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x726 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0726 ; 0x0001
+ /* 0x728 */ { 0xd4, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x72a */ { 0x86, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x72c */ { 0x78, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
+ /* 0x72e */ { 0xe4, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
+ /* 0x730 */ { 0x3e, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x732 */ { 0x72, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
+ /* 0x734 */ { 0x64, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x736 */ { 0x68, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 1 },
+ /* 0x738 */ { 0x54, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x73a */ { 0x00, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x73c */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $073C
+ /* 0x73e */ { 0xae, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x740 */ { 0x6a, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
+ /* 0x742 */ { 0x2e, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
+ /* 0x744 */ { 0xf6, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x746 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 }, // dc.w $0746 ; 0x0001 dc.w $0746 ; 0x0001 ; xor
+ /* 0x748 */ { 0x44, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x74a */ { 0x14, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x74c */ { 0xd2, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x74e */ { INPUT_PORT_C , { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 }, // dc.w $074E ; 0x0100
+ /* 0x750 */ { 0xaa, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x752 */ { 0xbe, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x754 */ { 0x76, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x756 */ { 0x60, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x758 */ { 0x70, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x75a */ { 0x4c, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
+ /* 0x75c */ { 0xbc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x75e */ { 0x7e, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x760 */ { 0x32, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
+ /* 0x762 */ { 0x88, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x764 */ { 0xe2, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x766 */ { 0x66, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x768 */ { 0x16, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 1 },
+ /* 0x76a */ { 0xfa, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x76c */ { 0x52, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x76e */ { 0xd6, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
+ /* 0x770 */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x772 */ { 0xc4, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
+ /* 0x774 */ { 0x38, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x776 */ { 0x6c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
+ /* 0x778 */ { 0xfc, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
+ /* 0x77a */ { 0x84, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
+ /* 0x77c */ { 0xb6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x77e */ { 0x62, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
+ /* 0x780 */ { 0xb8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x782 */ { 0xa2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x784 */ { 0x8a, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
+ /* 0x786 */ { 0x3a, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x788 */ { 0xf4, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 1 },
+ /* 0x78a */ { 0x40, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x78c */ { 0x7a, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
+ /* 0x78e */ { 0x1c, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x790 */ { 0x04, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x792 */ { 0x1a, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x794 */ { 0x0e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x796 */ { 0x30, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
+ /* 0x798 */ { 0x50, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
+ /* 0x79a */ { 0xc8, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 0 },
+ /* 0x79c */ { 0xc6, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
+ /* 0x79e */ { 0x12, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x7a0 */ { 0x6e, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x7a2 */ { 0x56, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x7a4 */ { 0xe2, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x7a6 */ { 0x00, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x7a8 */ { 0xfa, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
+ /* 0x7aa */ { 0x76, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
+ /* 0x7ac */ { 0x8e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7ae */ { 0xaa, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
+ /* 0x7b0 */ { 0x80, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7b2 */ { 0x3a, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x7b4 */ { 0xf8, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x7b6 */ { 0x02, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x7b8 */ { 0x84, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7ba */ { 0xd0, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 1 },
+ /* 0x7bc */ { 0xd6, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x7be */ { 0x66, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
+ /* 0x7c0 */ { 0xea, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 0 },
+ /* 0x7c2 */ { 0xe8, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
+ /* 0x7c4 */ { 0x9c, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x7c6 */ { 0x02, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
+ /* 0x7c8 */ { 0x9a, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
+ /* 0x7ca */ { 0xa0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7cc */ { 0x0c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x7ce */ { 0x80, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x7d0 */ { 0xec, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
+ /* 0x7d2 */ { 0x1e, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x7d4 */ { 0xb4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7d6 */ { 0x28, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 1 },
+ /* 0x7d8 */ { 0xee, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
+ /* 0x7da */ { 0x56, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
+ /* 0x7dc */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 }, // dc.w $07DC ; nand
+ /* 0x7de */ { 0x2a, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
+ /* 0x7e0 */ { 0xf8, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
+ /* 0x7e2 */ { 0x96, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 },
+ /* 0x7e4 */ { 0x34, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
+ /* 0x7e6 */ { 0x36, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x7e8 */ { 0x4a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
+ /* 0x7ea */ { 0x0a, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
+ /* 0x7ec */ { 0x66, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
+ /* 0x7ee */ { 0xc2, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x7f0 */ { 0xba, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7f2 */ { 0x5e, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
+ /* 0x7f4 */ { 0x5c, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 0 },
+ /* 0x7f6 */ { 0xac, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
+ /* 0x7f8 */ { 0x98, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
+ /* 0x7fa */ { 0x80, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
+ /* 0x7fc */ { INPUT_PORT_C , { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 }, // dc.w $07FC ; Bit not present
+ /* 0x7fe */ { 0xd8, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 1 }
- /* 0x000 */ { 0x04, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x002 */ { 0x2a, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
- /* 0x004 */ { 0x5e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x006 */ { 0x98, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x008 */ { 0x94, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x00a */ { 0xbe, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x00c */ { 0xd6, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x00e */ { 0xe4, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x010 */ { 0x90, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x012 */ { 0xa8, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x014 */ { 0x24, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x016 */ { 0xfc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x018 */ { 0x08, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x01a */ { INPUT_PORT_C , { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $001A ; 0x0010
- /* 0x01c */ { 0x72, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x01e */ { 0xc4, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x020 */ { 0xd0, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x022 */ { 0x66, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 1 },
- /* 0x024 */ { 0x8c, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x026 */ { 0xec, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x028 */ { 0x58, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x02a */ { 0x80, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x02c */ { 0x82, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 1 },
- /* 0x02e */ { 0x6a, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x030 */ { 0x00, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x032 */ { 0x60, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x034 */ { INPUT_PORT_B , { NIB0R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x036 */ { 0xae, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x038 */ { 0x12, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x03a */ { 0x42, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x03c */ { 0x1e, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x03e */ { 0xf6, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x040 */ { 0xdc, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x042 */ { 0x34, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x044 */ { 0x2c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x046 */ { 0x7a, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x048 */ { 0x10, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x04a */ { 0x9e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x04c */ { 0x3e, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x04e */ { 0x0e, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x050 */ { 0xa4, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
- /* 0x052 */ { 0x0c, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x054 */ { 0x40, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x056 */ { 0x20, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x058 */ { 0x46, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x05a */ { 0x6c, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x05c */ { 0x9a, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x05e */ { 0x18, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x060 */ { 0xe0, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x062 */ { 0x30, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x064 */ { 0xca, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x066 */ { 0xac, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x068 */ { 0xe8, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x06a */ { 0x66, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x06c */ { 0x14, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x06e */ { 0x96, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x070 */ { 0x5c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x072 */ { 0x0a, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x074 */ { INPUT_PORT_B , { NIB0R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x076 */ { INPUT_PORT_C , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 }, // dc.w $0076 ; 0x1000 dc.w $0076 ; 0x1000 ; nand
- /* 0x078 */ { 0x5a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x07a */ { 0x74, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x07c */ { 0xb4, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x07e */ { 0x86, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x080 */ { 0x84, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x082 */ { 0x28, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x084 */ { 0x50, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x086 */ { 0x66, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x088 */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0088
- /* 0x08a */ { 0x1c, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x08c */ { 0x48, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x08e */ { 0xc2, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x090 */ { 0x44, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x092 */ { 0x3c, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x094 */ { 0xfa, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x096 */ { 0x22, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x098 */ { 0xf0, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x09a */ { 0x2e, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
- /* 0x09c */ { 0x06, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x09e */ { 0x64, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
- /* 0x0a0 */ { 0xcc, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x0a2 */ { 0x7a, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x0a4 */ { 0xb2, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x0a6 */ { 0xbe, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x0a8 */ { 0xde, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x0aa */ { 0xf8, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x0ac */ { 0xca, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x0ae */ { 0x3e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x0b0 */ { 0xb6, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x0b2 */ { 0xd8, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x0b4 */ { INPUT_PORT_C , { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 }, // dc.w $00B4 ; 0x1000
- /* 0x0b6 */ { 0xc0, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x0b8 */ { 0xa2, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x0ba */ { 0xe6, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x0bc */ { 0x1a, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x0be */ { 0xb0, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x0c0 */ { 0x4c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x0c2 */ { 0x56, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x0c4 */ { 0xee, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x0c6 */ { 0xd4, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x0c8 */ { INPUT_PORT_A , { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 }, // dc.w $00C8 ; xor
- /* 0x0ca */ { 0xda, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x0cc */ { 0xce, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
- /* 0x0ce */ { 0xf2, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x0d0 */ { 0x8e, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 1 },
- /* 0x0d2 */ { 0x3a, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x0d4 */ { 0x6e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x0d6 */ { 0xa6, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x0d8 */ { 0x78, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 0 },
- /* 0x0da */ { 0xbc, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x0dc */ { 0xba, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x0de */ { 0x36, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x0e0 */ { 0x66, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x0e2 */ { 0x92, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x0e4 */ { 0x52, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x0e6 */ { 0xf4, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x0e8 */ { INPUT_PORT_B , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x0ea */ { 0xc6, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x0ec */ { 0xea, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x0ee */ { 0xfe, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x0f0 */ { 0xb2, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 1 },
- /* 0x0f2 */ { 0x32, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x0f4 */ { 0x76, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x0f6 */ { 0xe2, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x0f8 */ { 0x7c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x0fa */ { 0xa0, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x0fc */ { 0x4a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x0fe */ { 0x70, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x100 */ { 0x64, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x102 */ { 0x04, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x104 */ { 0xe2, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x106 */ { 0xca, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x108 */ { 0xa4, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x10a */ { 0x12, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x10c */ { 0xaa, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 0 },
- /* 0x10e */ { 0x7c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x110 */ { 0xf4, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x112 */ { 0xda, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x114 */ { 0x7a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x116 */ { 0x3a, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x118 */ { 0x00, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x11a */ { 0x66, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x11c */ { 0xce, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x11e */ { 0xb6, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x120 */ { 0x1c, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x122 */ { 0x82, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x124 */ { 0x4a, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x126 */ { 0x58, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x128 */ { 0xbe, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x12a */ { 0x36, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x12c */ { 0x9a, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
- /* 0x12e */ { 0x02, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
- /* 0x130 */ { 0xea, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x132 */ { 0xae, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x134 */ { 0x52, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
- /* 0x136 */ { 0xdc, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x138 */ { 0x9e, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x13a */ { 0xfc, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 1 },
- /* 0x13c */ { 0x4c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x13e */ { 0x76, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x140 */ { 0x8c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
- /* 0x142 */ { 0xd4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x144 */ { 0x3e, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x146 */ { 0x16, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x148 */ { 0xb8, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x14a */ { 0x50, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x14c */ { 0x42, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 0 }, // xor readback address, affected by xor, funky
- /* 0x14e */ { 0xd6, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x150 */ { 0x7e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x152 */ { 0x92, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x154 */ { INPUT_PORT_A , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x156 */ { 0xde, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x158 */ { 0x1a, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x15a */ { 0x9c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 1 },
- /* 0x15c */ { 0x14, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x15e */ { 0x98, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x160 */ { 0x40, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x162 */ { 0x6e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x164 */ { 0xc4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x166 */ { 0xc6, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x168 */ { 0x84, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x16a */ { 0x8e, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x16c */ { 0x96, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x16e */ { 0x6a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x170 */ { 0xf0, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x172 */ { 0x2a, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x174 */ { 0x1e, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x176 */ { 0x62, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x178 */ { 0x88, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x17a */ { 0xe0, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x17c */ { INPUT_PORT_A , { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 }, // dc.w $017C ; xor,nand
- /* 0x17e */ { 0xcc, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x180 */ { INPUT_PORT_A , { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x182 */ { 0x46, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x184 */ { 0x90, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x186 */ { 0x72, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x188 */ { 0xee, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x18a */ { 0x2c, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x18c */ { 0x22, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x18e */ { 0x38, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x190 */ { 0x44, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x192 */ { 0xc0, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x194 */ { 0x54, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x196 */ { 0x6c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x198 */ { 0xfa, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x19a */ { 0x34, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x19c */ { 0xa8, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x19e */ { 0x3c, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x1a0 */ { 0x7e, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 },
- /* 0x1a2 */ { 0x4e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1a4 */ { 0x9c, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x1a6 */ { 0x16, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x1a8 */ { 0x38, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x1aa */ { 0xc8, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x1ac */ { 0x68, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x1ae */ { 0x54, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1b0 */ { 0xba, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x1b2 */ { 0x78, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1b4 */ { 0xcc, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x1b6 */ { 0xfe, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x1b8 */ { 0x86, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x1ba */ { 0x18, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x1bc */ { 0x0e, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x1be */ { 0xc2, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x1c0 */ { INPUT_PORT_C , { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 }, // dc.w $01C0 ; 0x1000
- /* 0x1c2 */ { 0x0c, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x1c4 */ { INPUT_PORT_A , { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1c6 */ { 0x70, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1c8 */ { INPUT_PORT_A , { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1ca */ { 0x5c, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x1cc */ { 0xac, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x1ce */ { 0x48, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x1d0 */ { 0x0a, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
- /* 0x1d2 */ { 0x94, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x1d4 */ { 0x66, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x1d6 */ { 0xf8, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x1d8 */ { 0x68, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1da */ { 0x24, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x1dc */ { 0x66, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x1de */ { 0xa6, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x1e0 */ { 0x74, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1e2 */ { 0xd0, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x1e4 */ { 0x5e, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 1 },
- /* 0x1e6 */ { 0xe6, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x1e8 */ { 0x66, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1ea */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x1ec */ { INPUT_PORT_B , { NIB1R2, BLANK_, BLANK_, BLANK_ } , 0, 1 }, // dc.w $01EC ; nand
- /* 0x1ee */ { 0xc8, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x1f0 */ { 0xa2, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x1f2 */ { 0x60, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x1f4 */ { 0xbc, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 1 },
- /* 0x1f6 */ { 0x06, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x1f8 */ { 0x2e, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x1fa */ { 0x26, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x1fc */ { 0x56, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x1fe */ { 0xd2, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x200 */ { 0xa0, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x202 */ { 0x34, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x204 */ { 0xf6, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
- /* 0x206 */ { INPUT_PORT_A , { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x208 */ { 0xae, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x20a */ { 0xf4, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x20c */ { INPUT_PORT_C , { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 }, // dc.w $020C ; Bit not present dc.w $020C ; Bit not present ; xor,nand
- /* 0x20e */ { 0x4e, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x210 */ { 0x0e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x212 */ { 0x6e, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x214 */ { 0x4a, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 1 },
- /* 0x216 */ { 0x0a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x218 */ { 0x82, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 1 },
- /* 0x21a */ { 0x66, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x21c */ { 0x6c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x21e */ { 0xb8, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x220 */ { 0x12, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x222 */ { 0x06, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x224 */ { 0x00, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x226 */ { 0x72, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x228 */ { 0xe4, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x22a */ { 0x90, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x22c */ { 0xc4, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x22e */ { 0x08, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x230 */ { 0x98, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x232 */ { 0xda, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x234 */ { 0x3a, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
- /* 0x236 */ { 0xcc, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
- /* 0x238 */ { 0x7c, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x23a */ { 0x86, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x23c */ { 0x56, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 1 },
- /* 0x23e */ { 0x8a, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x240 */ { 0xa0, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x242 */ { 0x04, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x244 */ { 0x32, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x246 */ { 0x48, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x248 */ { 0x8c, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x24a */ { 0xa2, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x24c */ { 0xfa, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x24e */ { 0x46, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x250 */ { 0x62, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x252 */ { 0xe0, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x254 */ { 0x7e, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x256 */ { 0xce, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x258 */ { 0xf8, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x25a */ { 0x6a, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x25c */ { 0x58, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x25e */ { 0xc0, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
- /* 0x260 */ { 0xe2, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x262 */ { 0x30, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x264 */ { 0x88, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x266 */ { 0xe8, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x268 */ { 0xac, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
- /* 0x26a */ { 0xe6, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x26c */ { 0xc2, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x26e */ { 0xa8, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x270 */ { INPUT_PORT_C , { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 }, // dc.w $0270 ; 0x0010
- /* 0x272 */ { 0x3c, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x274 */ { 0x68, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x276 */ { 0x2e, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x278 */ { 0x18, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x27a */ { 0x02, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x27c */ { 0x70, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x27e */ { 0x94, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x280 */ { 0x5e, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x282 */ { 0x26, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x284 */ { 0x14, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x286 */ { 0x7a, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x288 */ { 0xd2, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x28a */ { 0xd4, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x28c */ { 0xa6, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
- /* 0x28e */ { 0x36, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x290 */ { 0xee, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x292 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0292 ; 0x0001
- /* 0x294 */ { 0x66, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x296 */ { 0x5a, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x298 */ { 0x64, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x29a */ { 0x60, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x29c */ { 0xec, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x29e */ { 0x80, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x2a0 */ { 0xd0, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x2a2 */ { 0x44, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x2a4 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 }, // dc.w $02A4 ; 0x0001
- /* 0x2a6 */ { 0xbc, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
- /* 0x2a8 */ { 0x22, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x2aa */ { 0xb2, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x2ac */ { 0x1e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x2ae */ { 0x9c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
- /* 0x2b0 */ { 0x96, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
- /* 0x2b2 */ { 0x8e, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x2b4 */ { 0xb6, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x2b6 */ { 0xfe, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 1 },
- /* 0x2b8 */ { 0x66, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x2ba */ { 0xf0, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x2bc */ { 0x20, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x2be */ { 0x40, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x2c0 */ { 0x4c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x2c2 */ { 0x76, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
- /* 0x2c4 */ { 0xca, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x2c6 */ { 0x50, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x2c8 */ { 0x1c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x2ca */ { 0x1a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x2cc */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x2ce */ { 0x92, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x2d0 */ { 0x66, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
- /* 0x2d2 */ { 0x28, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x2d4 */ { 0x74, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x2d6 */ { 0x16, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x2d8 */ { 0x9e, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x2da */ { 0xde, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x2dc */ { 0xba, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x2de */ { 0x78, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x2e0 */ { 0x9a, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x2e2 */ { 0xc6, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x2e4 */ { 0x42, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x2e6 */ { 0xea, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x2e8 */ { 0x0c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x2ea */ { 0xd8, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x2ec */ { 0x5c, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x2ee */ { 0xaa, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x2f0 */ { 0xb4, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x2f2 */ { 0xf2, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x2f4 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 }, // dc.w $02F4 ; 0x0001 dc.w $02F4 ; 0x0001 ; nand
- /* 0x2f6 */ { 0x84, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x2f8 */ { 0xa4, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x2fa */ { INPUT_PORT_C , { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $02FA ; 0x0008
- /* 0x2fc */ { 0xfc, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 0 },
- /* 0x2fe */ { 0x10, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x300 */ { 0xa4, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 0 },
- /* 0x302 */ { 0x24, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x304 */ { 0xe2, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x306 */ { 0x32, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x308 */ { 0x2a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x30a */ { 0x66, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x30c */ { 0x86, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x30e */ { 0xaa, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x310 */ { 0x66, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x312 */ { 0x4e, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x314 */ { 0x84, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x316 */ { 0x96, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x318 */ { 0x26, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x31a */ { 0x64, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x31c */ { 0xac, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x31e */ { 0x78, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x320 */ { 0xfe, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x322 */ { 0x2e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x324 */ { 0x06, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x326 */ { 0x92, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x328 */ { 0x34, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x32a */ { 0xc0, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x32c */ { 0x8a, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x32e */ { 0x46, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x330 */ { 0xd8, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x332 */ { 0xc4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x334 */ { 0x30, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x336 */ { 0x1a, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x338 */ { 0xd0, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 },
- /* 0x33a */ { 0x60, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x33c */ { 0xf6, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x33e */ { 0x00, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x340 */ { 0x90, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x342 */ { 0xfc, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x344 */ { 0x08, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x346 */ { 0xa8, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x348 */ { 0x44, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x34a */ { 0x04, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x34c */ { 0x3c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x34e */ { 0xde, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x350 */ { 0x72, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x352 */ { 0x62, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x354 */ { 0x3a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x356 */ { 0xba, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x358 */ { 0x68, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x35a */ { 0x76, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x35c */ { 0x9e, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x35e */ { 0xc6, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x360 */ { 0xe4, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x362 */ { 0x02, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x364 */ { 0x6c, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x366 */ { 0xec, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x368 */ { INPUT_PORT_C , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 }, // dc.w $0368 ; 0x1000
- /* 0x36a */ { INPUT_PORT_A , { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x36c */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x36e */ { 0x0c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 1 },
- /* 0x370 */ { 0x80, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x372 */ { 0x82, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x374 */ { 0xb8, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x376 */ { 0x50, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x378 */ { 0x20, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x37a */ { 0xf4, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x37c */ { 0x8c, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x37e */ { 0xe6, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x380 */ { 0xda, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x382 */ { 0xf2, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x384 */ { 0xdc, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x386 */ { 0x9c, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x388 */ { INPUT_PORT_A , { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x38a */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x38c */ { 0x28, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x38e */ { 0xb6, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x390 */ { 0x2c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x392 */ { 0xce, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x394 */ { 0x0e, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x396 */ { 0x5c, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x398 */ { 0x52, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
- /* 0x39a */ { 0x7e, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x39c */ { 0x6a, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x39e */ { 0xa0, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x3a0 */ { 0x52, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x3a2 */ { 0x94, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x3a4 */ { 0x2c, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x3a6 */ { 0xc8, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x3a8 */ { 0x18, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x3aa */ { 0x56, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x3ac */ { 0x54, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x3ae */ { 0x58, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x3b0 */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x3b2 */ { 0x14, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x3b4 */ { 0x38, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x3b6 */ { 0xf8, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x3b8 */ { 0xb4, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x3ba */ { 0xd6, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x3bc */ { 0x5c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
- /* 0x3be */ { 0x1c, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x3c0 */ { 0x22, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x3c2 */ { 0x66, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x3c4 */ { 0x8e, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x3c6 */ { 0xf0, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x3c8 */ { 0xae, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x3ca */ { 0x1e, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x3cc */ { 0xee, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x3ce */ { 0xea, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 1 },
- /* 0x3d0 */ { 0xe8, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x3d2 */ { 0x88, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x3d4 */ { INPUT_PORT_C , { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 }, // dc.w $03D4 ; 0x0010
- /* 0x3d6 */ { 0x66, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x3d8 */ { INPUT_PORT_B , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x3da */ { 0xfa, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x3dc */ { 0x4c, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x3de */ { 0x36, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x3e0 */ { 0xe0, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x3e2 */ { 0xd4, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x3e4 */ { 0xc8, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x3e6 */ { 0xc2, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x3e8 */ { 0x0a, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x3ea */ { 0x9a, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x3ec */ { 0x7c, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x3ee */ { 0x4a, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x3f0 */ { 0xd2, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x3f2 */ { 0x48, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x3f4 */ { 0x6e, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x3f6 */ { 0xa6, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
- /* 0x3f8 */ { 0x42, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x3fa */ { 0x5e, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x3fc */ { 0xbc, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x3fe */ { 0x10, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x400 */ { 0x02, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x402 */ { 0x72, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x404 */ { 0x74, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x406 */ { 0x96, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x408 */ { 0x54, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x40a */ { 0xda, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x40c */ { 0xd6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x40e */ { 0x8a, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x410 */ { 0xde, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x412 */ { 0xa4, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x414 */ { 0xa2, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
- /* 0x416 */ { 0xe4, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 1 },
- /* 0x418 */ { 0x04, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x41a */ { 0x84, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x41c */ { 0x2a, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x41e */ { 0x4c, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x420 */ { 0x2e, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x422 */ { 0x86, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x424 */ { 0x60, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x426 */ { 0xba, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x428 */ { 0x8c, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x42a */ { 0xee, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
- /* 0x42c */ { 0xac, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x42e */ { 0x32, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
- /* 0x430 */ { 0xd2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x432 */ { 0x0e, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x434 */ { 0x06, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 1 },
- /* 0x436 */ { 0x66, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x438 */ { 0xec, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x43a */ { 0xfe, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x43c */ { INPUT_PORT_B , { BLANK_, BLANK_, BLANK_, BLANK_ } , 0, 0 }, // this address always seems to return 0, is it a port with all bits masked out? I'm going to assume it's a 'B' port (4-bit) with mask applied to those 4 bits so they always return 0 due to a design flaw, that would make 21 of each port type.
- /* 0x43e */ { 0x7a, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x440 */ { 0xfc, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x442 */ { 0x10, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x444 */ { 0x66, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x446 */ { 0x16, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x448 */ { 0x90, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x44a */ { 0xb4, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x44c */ { INPUT_PORT_B, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 }, //dc.w $044C ; nand
- /* 0x44e */ { 0x44, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x450 */ { INPUT_PORT_C , { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 }, // dc.w $0450 ; 0x0100 dc.w $0450 ; 0x0100 ; xor
- /* 0x452 */ { 0x30, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x454 */ { 0x82, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x456 */ { 0x26, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x458 */ { 0x52, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x45a */ { 0xc6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x45c */ { 0xd8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x45e */ { 0x18, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x460 */ { 0xc8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x462 */ { 0x64, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x464 */ { 0xbe, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x466 */ { 0x42, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x468 */ { 0xc0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x46a */ { 0x38, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x46c */ { 0xd0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x46e */ { 0x9c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x470 */ { 0xa8, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x472 */ { 0x4a, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x474 */ { 0x1c, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
- /* 0x476 */ { 0xf0, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x478 */ { 0xb6, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x47a */ { 0xc2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x47c */ { 0x7e, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x47e */ { INPUT_PORT_B , { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x480 */ { 0x5a, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x482 */ { 0x5c, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x484 */ { 0x5a, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x486 */ { 0x06, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x488 */ { 0x2c, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x48a */ { 0x76, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x48c */ { 0xbc, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x48e */ { 0x46, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x490 */ { 0x66, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x492 */ { 0xea, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x494 */ { 0x9a, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x496 */ { 0xb8, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 1 },
- /* 0x498 */ { 0x36, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x49a */ { 0x56, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x49c */ { 0x6c, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x49e */ { 0x12, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x4a0 */ { 0xa4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4a2 */ { 0xa8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4a4 */ { 0xce, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 1 },
- /* 0x4a6 */ { 0x8c, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4a8 */ { 0xb0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4aa */ { 0x48, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x4ac */ { INPUT_PORT_A , { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
- /* 0x4ae */ { 0x92, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x4b0 */ { 0x10, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x4b2 */ { 0x74, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x4b4 */ { 0x08, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x4b6 */ { 0x94, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x4b8 */ { 0x46, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x4ba */ { 0x24, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x4bc */ { 0x42, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x4be */ { 0xa6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4c0 */ { 0x08, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x4c2 */ { 0x80, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x4c4 */ { 0x3c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x4c6 */ { 0x94, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x4c8 */ { INPUT_PORT_A , { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4ca */ { 0x20, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x4cc */ { 0xf6, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x4ce */ { 0x66, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x4d0 */ { 0xe2, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x4d2 */ { INPUT_PORT_B , { NIB0R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x4d4 */ { 0xd4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4d6 */ { 0xa0, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
- /* 0x4d8 */ { 0x48, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x4da */ { 0xca, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4dc */ { 0x62, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x4de */ { 0x70, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x4e0 */ { 0xfa, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x4e2 */ { 0x9e, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x4e4 */ { 0x40, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x4e6 */ { 0x68, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x4e8 */ { 0x88, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x4ea */ { 0x3e, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x4ec */ { 0x7c, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x4ee */ { 0xcc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x4f0 */ { 0x34, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x4f2 */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 }, // dc.w $04F2
- /* 0x4f4 */ { 0x28, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x4f6 */ { 0xe6, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x4f8 */ { 0x6a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x4fa */ { 0xaa, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 1 },
- /* 0x4fc */ { 0x50, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x4fe */ { 0xa6, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 1 },
- /* 0x500 */ { 0xf0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x502 */ { 0x88, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x504 */ { 0x5c, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x506 */ { INPUT_PORT_C , { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0506 ; 0x0004
- /* 0x508 */ { INPUT_PORT_A , { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x50a */ { 0xc0, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
- /* 0x50c */ { 0x26, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x50e */ { 0x72, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x510 */ { 0x8a, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
- /* 0x512 */ { 0x06, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x514 */ { 0x32, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x516 */ { 0xb6, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x518 */ { 0x02, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x51a */ { 0xb2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x51c */ { 0x0a, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x51e */ { 0xd6, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x520 */ { 0xaa, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x522 */ { 0xca, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x524 */ { 0x54, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x526 */ { 0x08, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x528 */ { INPUT_PORT_B , { NIB2__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x52a */ { 0x8e, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x52c */ { 0xe0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x52e */ { 0xba, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x530 */ { 0x18, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x532 */ { 0xb0, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x534 */ { 0x1a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x536 */ { 0x7a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x538 */ { 0x3c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x53a */ { 0x0c, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x53c */ { 0xfa, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x53e */ { 0x9e, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x540 */ { 0x3e, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x542 */ { 0x9c, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x544 */ { 0x5a, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x546 */ { 0x62, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x548 */ { 0xf6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x54a */ { 0xde, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x54c */ { 0x38, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
- /* 0x54e */ { 0xe6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x550 */ { 0xa2, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x552 */ { 0x4c, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x554 */ { 0xae, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x556 */ { 0xac, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x558 */ { 0x68, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x55a */ { 0xf2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x55c */ { 0x66, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x55e */ { 0xea, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x560 */ { 0x82, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x562 */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 1, 0 }, // dc.w $0562 ; xor
- /* 0x564 */ { 0x80, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x566 */ { 0xf8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x568 */ { 0x6c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x56a */ { 0x7c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x56c */ { INPUT_PORT_A , { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x56e */ { 0x98, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x570 */ { 0x24, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x572 */ { 0xc2, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 1 },
- /* 0x574 */ { 0xdc, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x576 */ { 0x52, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x578 */ { 0x2a, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x57a */ { 0xb8, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x57c */ { 0x28, { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x57e */ { 0xd8, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x580 */ { 0x0c, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x582 */ { 0x8e, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x584 */ { 0x22, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x586 */ { 0x00, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x588 */ { 0x04, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x58a */ { 0x22, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x58c */ { 0xe8, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x58e */ { 0x74, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x590 */ { 0x0e, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x592 */ { 0x66, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x594 */ { 0x40, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x596 */ { 0xc8, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x598 */ { 0x70, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x59a */ { 0x16, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x59c */ { 0x12, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x59e */ { 0x36, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x5a0 */ { 0x5e, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x5a2 */ { 0x24, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x5a4 */ { 0xce, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5a6 */ { 0xb0, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x5a8 */ { 0xf2, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x5aa */ { 0x98, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x5ac */ { 0x6e, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x5ae */ { 0xdc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5b0 */ { 0xc4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5b2 */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x5b4 */ { 0xe0, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
- /* 0x5b6 */ { 0x92, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x5b8 */ { 0x4e, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x5ba */ { 0xf4, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5bc */ { 0x78, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x5be */ { 0x58, { NIB3__, NIB0__, NIB2__, NIB1__ } , 0, 1 },
- /* 0x5c0 */ { 0xfe, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5c2 */ { 0x4a, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
- /* 0x5c4 */ { 0x3a, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x5c6 */ { 0x2c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x5c8 */ { 0x96, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x5ca */ { 0x20, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x5cc */ { 0xc6, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x5ce */ { 0xa8, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x5d0 */ { 0xe2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5d2 */ { 0x66, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 0 },
- /* 0x5d4 */ { 0xf4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5d6 */ { 0xec, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5d8 */ { 0xbe, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x5da */ { 0xe8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5dc */ { 0x6e, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x5de */ { 0x1e, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
- /* 0x5e0 */ { 0x14, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x5e2 */ { 0x84, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x5e4 */ { 0xa0, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x5e6 */ { 0x34, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x5e8 */ { 0xe4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x5ea */ { 0x58, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x5ec */ { INPUT_PORT_B , { NIB2__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x5ee */ { 0x42, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x5f0 */ { 0x8c, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x5f2 */ { 0x10, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x5f4 */ { INPUT_PORT_C , { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 }, // dc.w $05F4 ; 0x0100
- /* 0x5f6 */ { 0x04, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x5f8 */ { 0x4e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x5fa */ { 0xd2, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x5fc */ { 0x7e, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x5fe */ { 0xcc, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x600 */ { 0xc6, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x602 */ { 0x20, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x604 */ { 0x36, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x606 */ { 0xfc, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x608 */ { 0x1c, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x60a */ { 0xca, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x60c */ { INPUT_PORT_A , { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x60e */ { 0xa0, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x610 */ { 0xa4, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x612 */ { 0x64, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x614 */ { 0x96, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x616 */ { 0x7e, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x618 */ { 0x0c, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x61a */ { 0x38, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x61c */ { 0x66, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x61e */ { 0x22, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x620 */ { 0x1a, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x622 */ { 0xae, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x624 */ { 0x9a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x626 */ { 0x4e, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x628 */ { 0x5a, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x62a */ { 0x8a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x62c */ { INPUT_PORT_A , { NIB1__, NIB2__, BLANK_, NIB3__ } , 0, 1 }, // dc.w $062C ; nand
- /* 0x62e */ { 0x58, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x630 */ { INPUT_PORT_B , { NIB0__, BLANK_, BLANK_, BLANK_ } , 0, 1 }, // dc.w $0630 ; nand
- /* 0x632 */ { 0x6a, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x634 */ { 0xc2, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 0 },
- /* 0x636 */ { 0xc4, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x638 */ { 0x94, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x63a */ { 0x3c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x63c */ { 0x74, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x63e */ { 0x0a, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x640 */ { 0x30, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x642 */ { 0x68, { NIB1__, NIB0__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x644 */ { 0x40, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x646 */ { 0xda, { NIB2__, NIB3__, NIB1__, NIB0__ } , 0, 0 },
- /* 0x648 */ { 0x60, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x64a */ { 0xde, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x64c */ { 0x04, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x64e */ { 0x86, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x650 */ { 0x78, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x652 */ { 0x4a, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x654 */ { 0x4c, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x656 */ { 0x2e, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x658 */ { 0xbc, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x65a */ { 0xc0, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x65c */ { 0x44, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x65e */ { 0x9c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x660 */ { 0x48, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x662 */ { 0x8c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x664 */ { 0x9e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x666 */ { 0xfe, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x668 */ { 0x5e, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x66a */ { 0x16, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x66c */ { 0xdc, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x66e */ { 0xec, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x670 */ { 0xf4, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x672 */ { 0x6c, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x674 */ { INPUT_PORT_C , { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 }, // dc.w $0674 ; 0x0010
- /* 0x676 */ { 0xd2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x678 */ { 0x72, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x67a */ { 0x28, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x67c */ { 0x1e, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x67e */ { INPUT_PORT_B , { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x680 */ { 0x7a, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x682 */ { 0xba, { NIB3__, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x684 */ { 0xd8, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x686 */ { 0x46, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
- /* 0x688 */ { 0xe4, { NIB1__, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x68a */ { 0xd0, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x68c */ { 0x50, { NIB1R2, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x68e */ { 0x92, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x690 */ { 0x10, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x692 */ { 0x88, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x694 */ { 0xf2, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
- /* 0x696 */ { 0xce, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x698 */ { 0x12, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x69a */ { 0x3e, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x69c */ { 0x06, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 1 },
- /* 0x69e */ { 0xe8, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x6a0 */ { 0xb2, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x6a2 */ { 0x28, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x6a4 */ { 0xa0, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x6a6 */ { 0xe4, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x6a8 */ { 0x32, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x6aa */ { 0x20, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x6ac */ { 0xf6, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x6ae */ { 0xf2, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x6b0 */ { 0x10, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x6b2 */ { 0xb4, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x6b4 */ { 0xa0, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x6b6 */ { 0x30, { NIB0__, NIB3__, NIB2__, NIB1__ } , 1, 1 },
- /* 0x6b8 */ { 0xea, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x6ba */ { 0xf6, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x6bc */ { 0x42, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x6be */ { INPUT_PORT_A , { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 }, // dc.w $06BE ; xor
- /* 0x6c0 */ { 0x08, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 1 },
- /* 0x6c2 */ { 0x54, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x6c4 */ { 0x66, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 1 },
- /* 0x6c6 */ { 0xcc, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x6c8 */ { 0x52, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x6ca */ { 0xd4, { NIB2__, NIB1__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x6cc */ { INPUT_PORT_C , { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $06CC ; 0x0002
- /* 0x6ce */ { 0x0e, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x6d0 */ { 0xb2, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 0 },
- /* 0x6d2 */ { 0xa2, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x6d4 */ { 0xb4, { NIB2__, NIB1__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x6d6 */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 }, // dc.w $06D6 ; xor
- /* 0x6d8 */ { 0xac, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x6da */ { 0x24, { BLANK_, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x6dc */ { 0xbe, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 0 },
- /* 0x6de */ { 0xa8, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x6e0 */ { 0x2c, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x6e2 */ { 0x90, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x6e4 */ { 0x98, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x6e6 */ { 0x70, { NIB2__, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x6e8 */ { 0xb6, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 1 },
- /* 0x6ea */ { 0xb8, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 1 },
- /* 0x6ec */ { 0x66, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x6ee */ { 0x2a, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 0 },
- /* 0x6f0 */ { 0x62, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x6f2 */ { 0xc8, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x6f4 */ { 0x14, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x6f6 */ { 0xa6, { NIB2__, NIB3__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x6f8 */ { 0xe6, { NIB2__, NIB1__, BLANK_, NIB3__ } , 0, 0 },
- /* 0x6fa */ { 0xee, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x6fc */ { 0x82, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x6fe */ { 0x26, { NIB1__, NIB2__, NIB0__, NIB3__ } , 1, 1 },
- /* 0x700 */ { 0x66, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 0 },
- /* 0x702 */ { 0x2c, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x704 */ { 0x7c, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x706 */ { 0x18, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x708 */ { 0xda, { BLANK_, NIB3__, BLANK_, NIB2__ } , 0, 0 },
- /* 0x70a */ { 0xde, { NIB2R1, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x70c */ { 0x6e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x70e */ { 0x26, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x710 */ { 0xca, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x712 */ { 0xf0, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x714 */ { 0x82, { NIB3__, NIB2__, BLANK_, BLANK_ } , 1, 1 },
- /* 0x716 */ { 0xc0, { NIB0__, NIB3__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x718 */ { 0x8e, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x71a */ { 0x20, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x71c */ { 0x4e, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x71e */ { 0xe0, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 1 },
- /* 0x720 */ { 0x66, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 1 },
- /* 0x722 */ { 0xdc, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x724 */ { 0xb2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x726 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $0726 ; 0x0001
- /* 0x728 */ { 0xd4, { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x72a */ { 0x86, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x72c */ { 0x78, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 0 },
- /* 0x72e */ { 0xe4, { NIB1R2, NIB2__, NIB3__, BLANK_ } , 0, 1 },
- /* 0x730 */ { 0x3e, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x732 */ { 0x72, { NIB1__, NIB3__, NIB0__, NIB2__ } , 0, 0 },
- /* 0x734 */ { 0x64, { NIB2__, NIB1__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x736 */ { 0x68, { BLANK_, BLANK_, BLANK_, NIB3__ } , 0, 1 },
- /* 0x738 */ { 0x54, { NIB3R1, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x73a */ { 0x00, { NIB2R3, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x73c */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 }, // dc.w $073C
- /* 0x73e */ { 0xae, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x740 */ { 0x6a, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 0 },
- /* 0x742 */ { 0x2e, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 0 },
- /* 0x744 */ { 0xf6, { NIB2__, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x746 */ { INPUT_PORT_C , { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 }, // dc.w $0746 ; 0x0001 dc.w $0746 ; 0x0001 ; xor
- /* 0x748 */ { 0x44, { NIB0R3, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x74a */ { 0x14, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x74c */ { 0xd2, { BLANK_, BLANK_, BLANK_, NIB3__ } , 1, 0 },
- /* 0x74e */ { INPUT_PORT_C , { NIB2__, NIB3__, NIB0__, NIB1__ } , 0, 0 }, // dc.w $074E ; 0x0100
- /* 0x750 */ { 0xaa, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x752 */ { 0xbe, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x754 */ { 0x76, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x756 */ { 0x60, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x758 */ { 0x70, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x75a */ { 0x4c, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 1 },
- /* 0x75c */ { 0xbc, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x75e */ { 0x7e, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x760 */ { 0x32, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 0, 1 },
- /* 0x762 */ { 0x88, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x764 */ { 0xe2, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x766 */ { 0x66, { NIB2__, NIB1__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x768 */ { 0x16, { NIB0__, NIB3__, NIB2__, NIB1__ } , 0, 1 },
- /* 0x76a */ { 0xfa, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x76c */ { 0x52, { NIB0R1, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x76e */ { 0xd6, { NIB0__, NIB3__, NIB1__, NIB2__ } , 0, 1 },
- /* 0x770 */ { INPUT_PORT_B , { NIB1__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x772 */ { 0xc4, { NIB1__, NIB3__, NIB0__, NIB2__ } , 1, 0 },
- /* 0x774 */ { 0x38, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x776 */ { 0x6c, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 },
- /* 0x778 */ { 0xfc, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 1 },
- /* 0x77a */ { 0x84, { NIB0__, NIB2__, NIB3__, NIB1__ } , 0, 1 },
- /* 0x77c */ { 0xb6, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x77e */ { 0x62, { NIB3__, NIB1__, NIB2__, NIB0__ } , 0, 0 },
- /* 0x780 */ { 0xb8, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x782 */ { 0xa2, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x784 */ { 0x8a, { NIB2__, NIB0__, NIB1__, NIB3__ } , 0, 0 },
- /* 0x786 */ { 0x3a, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x788 */ { 0xf4, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 1 },
- /* 0x78a */ { 0x40, { NIB1__, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x78c */ { 0x7a, { NIB1__, NIB2__, NIB3__, BLANK_ } , 0, 0 },
- /* 0x78e */ { 0x1c, { NIB2R3, NIB3__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x790 */ { 0x04, { NIB0R2, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x792 */ { 0x1a, { NIB2R1, NIB3__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x794 */ { 0x0e, { NIB1R3, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x796 */ { 0x30, { NIB3__, NIB0__, NIB2__, NIB1__ } , 1, 0 },
- /* 0x798 */ { 0x50, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 1 },
- /* 0x79a */ { 0xc8, { NIB3R1, NIB0__, NIB1__, NIB2__ } , 1, 0 },
- /* 0x79c */ { 0xc6, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 1 },
- /* 0x79e */ { 0x12, { NIB1__, NIB0__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x7a0 */ { 0x6e, { NIB0__, NIB1__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x7a2 */ { 0x56, { NIB2__, NIB1__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x7a4 */ { 0xe2, { NIB2__, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x7a6 */ { 0x00, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 0, 1 },
- /* 0x7a8 */ { 0xfa, { NIB3__, NIB1__, NIB2__, NIB0__ } , 1, 0 },
- /* 0x7aa */ { 0x76, { NIB1R3, NIB2__, NIB3__, NIB0__ } , 1, 0 },
- /* 0x7ac */ { 0x8e, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7ae */ { 0xaa, { NIB1__, NIB0__, NIB3__, NIB2__ } , 0, 0 },
- /* 0x7b0 */ { 0x80, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7b2 */ { 0x3a, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x7b4 */ { 0xf8, { BLANK_, NIB3__, BLANK_, BLANK_ } , 1, 0 },
- /* 0x7b6 */ { 0x02, { NIB0__, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x7b8 */ { 0x84, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7ba */ { 0xd0, { NIB0__, NIB1__, NIB3__, NIB2__ } , 1, 1 },
- /* 0x7bc */ { 0xd6, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x7be */ { 0x66, { NIB2__, NIB1__, NIB0__, NIB3__ } , 1, 0 },
- /* 0x7c0 */ { 0xea, { NIB3R2, NIB0__, NIB1__, NIB2__ } , 0, 0 },
- /* 0x7c2 */ { 0xe8, { NIB3__, NIB2__, NIB0__, NIB1__ } , 0, 0 },
- /* 0x7c4 */ { 0x9c, { NIB2R2, NIB3__, BLANK_, BLANK_ } , 0, 0 },
- /* 0x7c6 */ { 0x02, { NIB3__, BLANK_, BLANK_, BLANK_ } , 1, 0 },
- /* 0x7c8 */ { 0x9a, { BLANK_, NIB2__, NIB3__, NIB1__ } , 1, 1 },
- /* 0x7ca */ { 0xa0, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7cc */ { 0x0c, { NIB3R3, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x7ce */ { 0x80, { NIB3R3, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x7d0 */ { 0xec, { NIB1__, NIB2__, NIB0__, NIB3__ } , 0, 0 },
- /* 0x7d2 */ { 0x1e, { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x7d4 */ { 0xb4, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7d6 */ { 0x28, { NIB3__, NIB2__, NIB1__, NIB0__ } , 0, 1 },
- /* 0x7d8 */ { 0xee, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 1 },
- /* 0x7da */ { 0x56, { NIB2__, NIB0__, NIB1__, NIB3__ } , 1, 1 },
- /* 0x7dc */ { INPUT_PORT_A , { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 1 }, // dc.w $07DC ; nand
- /* 0x7de */ { 0x2a, { NIB3__, NIB2__, NIB1__, NIB0__ } , 1, 1 },
- /* 0x7e0 */ { 0xf8, { NIB3__, NIB0__, NIB1__, NIB2__ } , 1, 1 },
- /* 0x7e2 */ { 0x96, { NIB1__, NIB2__, BLANK_, NIB3__ } , 1, 0 },
- /* 0x7e4 */ { 0x34, { BLANK_, NIB3__, BLANK_, NIB2__ } , 1, 1 },
- /* 0x7e6 */ { 0x36, { NIB1R1, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x7e8 */ { 0x4a, { NIB0__, NIB1__, NIB2__, NIB3__ } , 1, 0 },
- /* 0x7ea */ { 0x0a, { NIB3__, BLANK_, BLANK_, BLANK_ } , 0, 0 },
- /* 0x7ec */ { 0x66, { NIB3__, NIB2__, NIB0__, NIB1__ } , 1, 0 },
- /* 0x7ee */ { 0xc2, { NIB1R1, NIB2__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x7f0 */ { 0xba, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7f2 */ { 0x5e, { NIB3__, NIB2__, BLANK_, BLANK_ } , 0, 1 },
- /* 0x7f4 */ { 0x5c, { NIB2__, NIB1__, NIB3__, BLANK_ } , 1, 0 },
- /* 0x7f6 */ { 0xac, { NIB0__, NIB1__, NIB2__, NIB3__ } , 0, 0 },
- /* 0x7f8 */ { 0x98, { NIB1__, NIB2__, NIB3__, NIB0__ } , 0, 1 },
- /* 0x7fa */ { 0x80, { NIB3R2, BLANK_, BLANK_, BLANK_ } , 1, 1 },
- /* 0x7fc */ { INPUT_PORT_C , { BLANK_, NIB3__, BLANK_, BLANK_ } , 0, 0 }, // dc.w $07FC ; Bit not present
- /* 0x7fe */ { 0xd8, { NIB2R2, NIB3__, NIB0__, NIB1__ } , 1, 1 }
-
- };
+ };
@@ -1083,6 +1082,3 @@ void deco104_device::device_reset()
{
deco_146_base_device::device_reset();
}
-
-
-
diff --git a/src/mame/machine/deco146.c b/src/mame/machine/deco146.c
index efa05ba42aa..3eddf21e01d 100644
--- a/src/mame/machine/deco146.c
+++ b/src/mame/machine/deco146.c
@@ -95,8 +95,6 @@
deco146port_xx port_table[] = {
-
-
/* 0x000 */ { 0x08a, { NIB1__, NIB2__, NIB3__, BLANK_ }, 0, 1 },
/* 0x002 */ { 0x0aa, { NIB3__, NIB2__, NIB0__, NIB1__ }, 0, 0 },
/* 0x004 */ { 0x018, { NIB2R2, NIB3__, BLANK_, BLANK_ }, 0, 1 },
diff --git a/src/mame/machine/decocass_tape.h b/src/mame/machine/decocass_tape.h
index fe61707eb7f..ff5dfeb3602 100644
--- a/src/mame/machine/decocass_tape.h
+++ b/src/mame/machine/decocass_tape.h
@@ -10,13 +10,13 @@ public:
UINT8 get_status_bits();
UINT8 is_present();
void change_speed(INT8 newspeed);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
/* regions within the virtual tape */
enum tape_region
@@ -52,7 +52,7 @@ private:
BYTE_POSTGAP_33 = BYTE_POSTGAP_0 + 33,
BYTE_BLOCK_TOTAL /* total number of bytes in block */
};
-
+
// internal state
emu_timer * m_tape_timer; /* timer for running the tape */
INT8 m_speed; /* speed: <-1=fast rewind, -1=reverse, 0=stopped, 1=normal, >1=fast forward */
@@ -62,7 +62,7 @@ private:
UINT32 m_clockpos; /* the current clock position of the tape */
UINT32 m_numclocks; /* total number of clocks on the entire tape */
UINT16 m_crc16[256]; /* CRC16 for each block */
-
+
const char *describe_state();
TIMER_CALLBACK_MEMBER( tape_clock_callback );
};
diff --git a/src/mame/machine/decopincpu.c b/src/mame/machine/decopincpu.c
index 9f69767773b..e275d8548c3 100644
--- a/src/mame/machine/decopincpu.c
+++ b/src/mame/machine/decopincpu.c
@@ -338,21 +338,21 @@ ioport_constructor decocpu_type1_device::device_input_ports() const
decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, DECOCPU1, "Data East Pinball CPU Board Type 1", tag, owner, clock, "decocpu1", __FILE__),
- m_cpu(*this,"maincpu"),
- m_pia21(*this, "pia21"),
- m_pia24(*this, "pia24"),
- m_pia28(*this, "pia28"),
- m_pia2c(*this, "pia2c"),
- m_pia30(*this, "pia30"),
- m_pia34(*this, "pia34"),
- m_read_display(*this),
- m_write_display(*this),
- m_read_dmdstatus(*this),
- m_write_soundlatch(*this),
- m_read_switch(*this),
- m_write_switch(*this),
- m_write_lamp(*this),
- m_write_solenoid(*this)
+ m_cpu(*this,"maincpu"),
+ m_pia21(*this, "pia21"),
+ m_pia24(*this, "pia24"),
+ m_pia28(*this, "pia28"),
+ m_pia2c(*this, "pia2c"),
+ m_pia30(*this, "pia30"),
+ m_pia34(*this, "pia34"),
+ m_read_display(*this),
+ m_write_display(*this),
+ m_read_dmdstatus(*this),
+ m_write_soundlatch(*this),
+ m_read_switch(*this),
+ m_write_switch(*this),
+ m_write_lamp(*this),
+ m_write_solenoid(*this)
{}
decocpu_type1_device::decocpu_type1_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/mame/machine/gaelco3d.c b/src/mame/machine/gaelco3d.c
index e01db7b9e49..9abcd4478e7 100644
--- a/src/mame/machine/gaelco3d.c
+++ b/src/mame/machine/gaelco3d.c
@@ -454,4 +454,4 @@ WRITE8_MEMBER( gaelco_serial_device::tr_w)
m_status &= ~GAELCOSER_STATUS_SEND;
shmem_unlock(m_shmem);
-} \ No newline at end of file
+}
diff --git a/src/mame/machine/gaelco3d.h b/src/mame/machine/gaelco3d.h
index dd2097b8e19..da9eaf002d2 100644
--- a/src/mame/machine/gaelco3d.h
+++ b/src/mame/machine/gaelco3d.h
@@ -89,14 +89,14 @@ public:
/* only used in radikalb, set at beginning of receive isr, cleared at end */
DECLARE_WRITE8_MEMBER( irq_enable );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_stop();
virtual void device_reset();
-
+
private:
// internal state
devcb_resolved_write_line m_irq_func;
@@ -111,7 +111,7 @@ private:
buf_t *m_out_ptr;
osd_shared_mem *m_os_shmem;
shmem_t *m_shmem;
-
+
TIMER_CALLBACK_MEMBER( set_status_cb );
TIMER_CALLBACK_MEMBER( link_cb );
void set_status(UINT8 mask, UINT8 set, int wait);
diff --git a/src/mame/machine/maple-dc.c b/src/mame/machine/maple-dc.c
index 8b51188250f..0686668b0f7 100644
--- a/src/mame/machine/maple-dc.c
+++ b/src/mame/machine/maple-dc.c
@@ -312,6 +312,3 @@ WRITE32_MEMBER(maple_dc_device::sb_msys_w)
WRITE32_MEMBER(maple_dc_device::sb_mdapro_w)
{
}
-
-
-
diff --git a/src/mame/machine/megavdp.c b/src/mame/machine/megavdp.c
index c1e44091f0b..022603beb26 100644
--- a/src/mame/machine/megavdp.c
+++ b/src/mame/machine/megavdp.c
@@ -24,9 +24,9 @@ const device_type SEGA_GEN_VDP = &device_creator<sega_genesis_vdp_device>;
sega_genesis_vdp_device::sega_genesis_vdp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega315_5124_device( mconfig, SEGA315_5246, "Sega Genesis VDP", tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true, "sega_genesis_vdp", __FILE__),
- m_genesis_vdp_sndirqline_callback(*this),
- m_genesis_vdp_lv6irqline_callback(*this),
- m_genesis_vdp_lv4irqline_callback(*this)
+ m_genesis_vdp_sndirqline_callback(*this),
+ m_genesis_vdp_lv6irqline_callback(*this),
+ m_genesis_vdp_lv4irqline_callback(*this)
{
m_use_alt_timing = 0;
m_palwrite_base = -1;
diff --git a/src/mame/machine/namco62.h b/src/mame/machine/namco62.h
index 782b9671ae6..81acc232350 100644
--- a/src/mame/machine/namco62.h
+++ b/src/mame/machine/namco62.h
@@ -18,13 +18,13 @@ public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
-
+
protected:
// device-level overrides
virtual void device_start();
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
-
+
private:
// internal state
device_t* m_cpu;
diff --git a/src/mame/machine/naomi.c b/src/mame/machine/naomi.c
index 669417fe345..369ddefa22e 100644
--- a/src/mame/machine/naomi.c
+++ b/src/mame/machine/naomi.c
@@ -25,8 +25,8 @@ hotd2o: bp 0xc0ba1f6, modify work RAM 0xc9c35a8 to be zero, bpclear
READ64_MEMBER(naomi_state::naomi_biose_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc04173c)
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc04173c)
+// space.device().execute().spin_until_time(attotime::from_usec(500));
//space.device().execute().spin_until_interrupt();
// else
// printf("%08x\n", space.device().safe_pc());
@@ -36,8 +36,8 @@ READ64_MEMBER(naomi_state::naomi_biose_idle_skip_r )
READ64_MEMBER(naomi_state::naomi_biosh_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc045ffc)
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc045ffc)
+// space.device().execute().spin_until_time(attotime::from_usec(500));
// printf("%08x\n", space.device().safe_pc());
@@ -46,8 +46,8 @@ READ64_MEMBER(naomi_state::naomi_biosh_idle_skip_r )
READ64_MEMBER(naomi_state::naomi2_biose_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc04637c)
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc04637c)
+// space.device().execute().spin_until_time(attotime::from_usec(500));
//space.device().execute().spin_until_interrupt();
// else
// printf("%08x\n", space.device().safe_pc());
@@ -240,8 +240,8 @@ DRIVER_INIT_MEMBER(naomi_state,naomigd_mp)
READ64_MEMBER(naomi_state::naomigd_ggxxsla_idle_skip_r )
{
-// if (space.device().safe_pc()==0x0c0c9adc)
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0x0c0c9adc)
+// space.device().execute().spin_until_time(attotime::from_usec(500));
return dc_ram[0x1aae18/8];
}
@@ -254,8 +254,8 @@ DRIVER_INIT_MEMBER(naomi_state,ggxxsla)
READ64_MEMBER(naomi_state::naomigd_ggxx_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc0b5c3c) // or 0xc0bab0c
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc0b5c3c) // or 0xc0bab0c
+// space.device().execute().spin_until_time(attotime::from_usec(500));
return dc_ram[0x1837b8/8];
}
@@ -269,8 +269,8 @@ DRIVER_INIT_MEMBER(naomi_state,ggxx)
READ64_MEMBER(naomi_state::naomigd_ggxxrl_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc0b84bc) // or 0xc0bab0c
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc0b84bc) // or 0xc0bab0c
+// space.device().execute().spin_until_time(attotime::from_usec(500));
//printf("%08x\n", space.device().safe_pc());
@@ -286,8 +286,8 @@ DRIVER_INIT_MEMBER(naomi_state,ggxxrl)
/* at least speeds up the annoying copyright screens ;-) */
READ64_MEMBER(naomi_state::naomigd_sfz3ugd_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc36a2dc)
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc36a2dc)
+// space.device().execute().spin_until_time(attotime::from_usec(500));
return dc_ram[0x5dc900/8];
}
@@ -331,8 +331,8 @@ DRIVER_INIT_MEMBER(naomi_state,kick4csh)
READ64_MEMBER(naomi_state::hotd2_idle_skip_r )
{
-// if (space.device().safe_pc()==0xc0cfcbc)
-// space.device().execute().spin_until_time(attotime::from_usec(500));
+// if (space.device().safe_pc()==0xc0cfcbc)
+// space.device().execute().spin_until_time(attotime::from_usec(500));
//space.device().execute().spin_until_interrupt();
// else
// printf("%08x\n", space.device().safe_pc());
diff --git a/src/mame/machine/neoprot.c b/src/mame/machine/neoprot.c
index 21d117816c3..36a5a94c1d6 100644
--- a/src/mame/machine/neoprot.c
+++ b/src/mame/machine/neoprot.c
@@ -507,12 +507,12 @@ void neogeo_state::pvc_write_pack_color()
UINT16 sr = m_pvc_cartridge_ram[0xff5];
m_pvc_cartridge_ram[0xff6] = ((gb & 0x001e) >> 1) |
- ((gb & 0x1e00) >> 5) |
- ((sr & 0x001e) << 7) |
- ((gb & 0x0001) << 12) |
- ((gb & 0x0100) << 5) |
- ((sr & 0x0001) << 14) |
- ((sr & 0x0100) << 7);
+ ((gb & 0x1e00) >> 5) |
+ ((sr & 0x001e) << 7) |
+ ((gb & 0x0001) << 12) |
+ ((gb & 0x0100) << 5) |
+ ((sr & 0x0001) << 14) |
+ ((sr & 0x0100) << 7);
}
diff --git a/src/mame/machine/nmk004.c b/src/mame/machine/nmk004.c
index e2c044b8f3f..a56105a14ab 100644
--- a/src/mame/machine/nmk004.c
+++ b/src/mame/machine/nmk004.c
@@ -987,7 +987,7 @@ TIMER_CALLBACK_MEMBER( nmk004_device::real_init )
m_rom = machine().root_device().memregion("audiocpu")->base();
address_space &space = machine().firstcpu->space(AS_PROGRAM);
-
+
if (m_ymdevice != NULL)
{
m_ymdevice->control_port_w(space, 0, 0x2f);
@@ -998,10 +998,10 @@ TIMER_CALLBACK_MEMBER( nmk004_device::real_init )
m_ymdevice->control_port_w(space, 0, ym2203_init[i++]);
m_ymdevice->write_port_w(space, 0, ym2203_init[i++]);
}
- }
+ }
else
return;
-
+
m_oki_playing = 0;
oki_play_sample(0);
diff --git a/src/mame/machine/nmk004.h b/src/mame/machine/nmk004.h
index df7cc47eed1..c0b7458e05e 100644
--- a/src/mame/machine/nmk004.h
+++ b/src/mame/machine/nmk004.h
@@ -68,7 +68,7 @@ class nmk004_device : public device_t
public:
nmk004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~nmk004_device() {}
-
+
void ym2203_irq_handler(int irq);
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
@@ -95,7 +95,7 @@ private:
/* C020-C19F */ struct fm_control m_fm_control[FM_CHANNELS];
/* C220-C2DF */ struct psg_control m_psg_control[PSG_CHANNELS];
/* C1A0-C21F */ struct effects_control m_effects_control[EFFECTS_CHANNELS];
-
+
TIMER_CALLBACK_MEMBER( real_init );
UINT8 read8(int address);
UINT16 read16(int address);
@@ -112,4 +112,4 @@ private:
extern const device_type NMK004;
#define MCFG_NMK004_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, NMK004, 0)
+ MCFG_DEVICE_ADD(_tag, NMK004, 0)
diff --git a/src/mame/machine/pgmprot_igs025_igs028.c b/src/mame/machine/pgmprot_igs025_igs028.c
index 3fc5d763413..67489f761b2 100644
--- a/src/mame/machine/pgmprot_igs025_igs028.c
+++ b/src/mame/machine/pgmprot_igs025_igs028.c
@@ -186,7 +186,7 @@ void pgm_028_025_state::IGS028_do_dma(UINT16 src, UINT16 dst, UINT16 size, UINT1
UINT16 param = mode >> 8;
UINT16 *PROTROM = (UINT16*)memregion("user1")->base();
-// logerror ("mode: %2.2x, src: %4.4x, dst: %4.4x, size: %4.4x, data: %4.4x\n", (mode &0xf), src, dst, size, mode);
+// logerror ("mode: %2.2x, src: %4.4x, dst: %4.4x, size: %4.4x, data: %4.4x\n", (mode &0xf), src, dst, size, mode);
mode &= 0x0f;
@@ -214,7 +214,7 @@ void pgm_028_025_state::IGS028_do_dma(UINT16 src, UINT16 dst, UINT16 size, UINT1
if (mode==0) dat2 = 0x4e75; // hack
if (mode==1) dat2 = ((dat2 & 0xf000) >> 12) | ((dat2 & 0x0f00) >> 4) | ((dat2 & 0x00f0) << 4) | ((dat2 & 0x000f) << 12);
if (mode==2) dat2 ^= extraxor;
- // if (mode==5) dat2 = dat2;
+ // if (mode==5) dat2 = dat2;
if (mode==6) dat2 += extraxor;
if (mode==2 || mode==6) dat2 = (dat2<<8)|(dat2>>8);
@@ -224,8 +224,8 @@ void pgm_028_025_state::IGS028_do_dma(UINT16 src, UINT16 dst, UINT16 size, UINT1
}
break;
- // default:
- // logerror ("DMA mode unknown!!!\nsrc:%4.4x, dst: %4.4x, size: %4.4x, mode: %4.4x\n", src, dst, size, mode);
+ // default:
+ // logerror ("DMA mode unknown!!!\nsrc:%4.4x, dst: %4.4x, size: %4.4x, mode: %4.4x\n", src, dst, size, mode);
}
}
@@ -304,40 +304,40 @@ WRITE16_MEMBER(pgm_028_025_state::olds_w )
case 0x64: // incomplete?
{
- UINT16 p1 = m_sharedprotram[0x3050 / 2];
- UINT16 p2 = m_sharedprotram[0x3082 / 2];
- UINT16 p3 = m_sharedprotram[0x3054 / 2];
- UINT16 p4 = m_sharedprotram[0x3088 / 2];
-
- if (p2 == 0x02)
- olds_write_reg(p1, olds_read_reg(p1) + 0x10000);
-
- switch (p4)
- {
- case 0xd:
- olds_write_reg(p1,olds_read_reg(p3));
- break;
- case 0x0:
- olds_write_reg(p3,(olds_read_reg(p2))^(olds_read_reg(p1)));
- break;
- case 0xe:
- olds_write_reg(p3,olds_read_reg(p3)+0x10000);
- break;
- case 0x2:
- olds_write_reg(p1,(olds_read_reg(p2))+(olds_read_reg(p3)));
- break;
- case 0x6:
- olds_write_reg(p3,(olds_read_reg(p2))&(olds_read_reg(p1)));
- break;
- case 0x1:
- olds_write_reg(p2,olds_read_reg(p1)+0x10000);
- break;
- case 0x7:
- olds_write_reg(p3,olds_read_reg(p1));
- break;
- default:
- break;
- }
+ UINT16 p1 = m_sharedprotram[0x3050 / 2];
+ UINT16 p2 = m_sharedprotram[0x3082 / 2];
+ UINT16 p3 = m_sharedprotram[0x3054 / 2];
+ UINT16 p4 = m_sharedprotram[0x3088 / 2];
+
+ if (p2 == 0x02)
+ olds_write_reg(p1, olds_read_reg(p1) + 0x10000);
+
+ switch (p4)
+ {
+ case 0xd:
+ olds_write_reg(p1,olds_read_reg(p3));
+ break;
+ case 0x0:
+ olds_write_reg(p3,(olds_read_reg(p2))^(olds_read_reg(p1)));
+ break;
+ case 0xe:
+ olds_write_reg(p3,olds_read_reg(p3)+0x10000);
+ break;
+ case 0x2:
+ olds_write_reg(p1,(olds_read_reg(p2))+(olds_read_reg(p3)));
+ break;
+ case 0x6:
+ olds_write_reg(p3,(olds_read_reg(p2))&(olds_read_reg(p1)));
+ break;
+ case 0x1:
+ olds_write_reg(p2,olds_read_reg(p1)+0x10000);
+ break;
+ case 0x7:
+ olds_write_reg(p3,olds_read_reg(p1));
+ break;
+ default:
+ break;
+ }
}
break;
@@ -365,8 +365,8 @@ WRITE16_MEMBER(pgm_028_025_state::olds_w )
olds_protection_calculate_hold(m_olds_cmd & 0x0f, data & 0xff);
break;
- // default:
- // logerror ("unemulated write mode!\n");
+ // default:
+ // logerror ("unemulated write mode!\n");
}
}
}
@@ -420,8 +420,8 @@ MACHINE_RESET_MEMBER(pgm_028_025_state,olds)
{
MACHINE_RESET_CALL_MEMBER(pgm);
-// written by protection device
-// there seems to be an auto-dma that writes from $401000-402573?
+// written by protection device
+// there seems to be an auto-dma that writes from $401000-402573?
m_sharedprotram[0x1000/2] = 0x4749; // 'IGS.28'
m_sharedprotram[0x1002/2] = 0x2E53;
m_sharedprotram[0x1004/2] = 0x3832;
diff --git a/src/mame/machine/pgmprot_igs027a_type1.c b/src/mame/machine/pgmprot_igs027a_type1.c
index a7a934712cd..f3faba9cc63 100644
--- a/src/mame/machine/pgmprot_igs027a_type1.c
+++ b/src/mame/machine/pgmprot_igs027a_type1.c
@@ -571,39 +571,39 @@ void pgm_arm_type1_state::command_handler_ddp3(int pc)
// should be correct, note each value only appears once
UINT8 puzzli2_level_decode[256] = {
- // 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , a , b , c , d , e , f ,
+ // 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , a , b , c , d , e , f ,
0x32, 0x3e, 0xb2, 0x37, 0x31, 0x22, 0xd6, 0x0d, 0x35, 0x5c, 0x8d, 0x3c, 0x7a, 0x5f, 0xd7, 0xac, // 0x0
-// 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , x , x ,
- 0x53, 0xff, 0xeb, 0x44, 0xe8, 0x11, 0x69, 0x77, 0xd9, 0x34, 0x36, 0x45, 0xa6, 0xe9, 0x1c, 0xc6, // 0x1
-// 0 , 0 , x , x , x , 0 , x , 0 , x , 0 , 0 , 0 , 0 , x , 0 , x ,
+// 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , x , x ,
+ 0x53, 0xff, 0xeb, 0x44, 0xe8, 0x11, 0x69, 0x77, 0xd9, 0x34, 0x36, 0x45, 0xa6, 0xe9, 0x1c, 0xc6, // 0x1
+// 0 , 0 , x , x , x , 0 , x , 0 , x , 0 , 0 , 0 , 0 , x , 0 , x ,
0x3b, 0xbd, 0xad, 0x2e, 0x18, 0xdf, 0xa1, 0xab, 0xdd, 0x52, 0x57, 0xc2, 0xe5, 0x0a, 0x00, 0x6d, // 0x2
-// 0 , 0 , 0 , 1 , 1 , 1 , 1 , x , 1 , 1 , 0 , 0 , 1 , 1 , x , 0 ,
+// 0 , 0 , 0 , 1 , 1 , 1 , 1 , x , 1 , 1 , 0 , 0 , 1 , 1 , x , 0 ,
0x67, 0x64, 0x15, 0x70, 0xb6, 0x39, 0x27, 0x78, 0x82, 0xd2, 0x71, 0xb9, 0x13, 0xf5, 0x93, 0x92, // 0x3
-// 0 , x , 1 , 1 , x , 1 , 1 , 1 , 1 , 1 , 1 , 1 , x , 0 , x , x ,
+// 0 , x , 1 , 1 , x , 1 , 1 , 1 , 1 , 1 , 1 , 1 , x , 0 , x , x ,
0xfa, 0xe7, 0x5e, 0xb0, 0xf6, 0xaf, 0x95, 0x8a, 0x7c, 0x73, 0xf9, 0x63, 0x86, 0xcb, 0x1a, 0x56, // 0x4
-// 0 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 1 , 1 , 1 , 0 ,
- 0xf1, 0x3a, 0xae, 0x61, 0x01, 0x29, 0x97, 0x23, 0x8e, 0x5d, 0x9a, 0x65, 0x74, 0x21, 0x20, 0x40, // 0x5
-// 0 , 1 , 1 , 1 , 1 , 0 , x , x , x , 0 , 0 , 1 , 1 , 1 , 1 , 1 ,
- 0xd3, 0x05, 0xa2, 0xe1, 0xbc, 0x9e, 0x1e, 0x10, 0x14, 0x0c, 0x88, 0x9c, 0xec, 0x38, 0xb5, 0x9d, // 0x6
-// 1 , 0 , 0 , x , 1 , 1 , 0 , 0 , x , 0 , x , 0 , 0 , 1 , 1 , 1 ,
- 0x2d, 0xf7, 0x17, 0x0e, 0x84, 0xc7, 0x7d, 0xce, 0x94, 0x16, 0x48, 0xa8, 0x81, 0x6e, 0x7b, 0xd8, // 0x7
-// 1 , 1 , 1 , 1 , x , 0 , x , 0 , 1 , 1 , 1 , x , x , 1 , 1 , 1 ,
- 0xa7, 0x7f, 0x42, 0xe6, 0xa0, 0x2a, 0xef, 0xee, 0x24, 0xba, 0xb8, 0x7e, 0xc9, 0x2b, 0x90, 0xcc, // 0x8
-// 1 , x , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
- 0x5b, 0xd1, 0xf3, 0xe2, 0x6f, 0xed, 0x9f, 0xf0, 0x4b, 0x54, 0x8c, 0x08, 0xf8, 0x51, 0x68, 0xc8, // 0x9
-// x , 0 , 0 , 0 , 0 , 0 , 0 , 0 , x , 0 , x , 0 , 0 , 0 , 0 , 1 ,
- 0x03, 0x0b, 0xbb, 0xc1, 0xe3, 0x4d, 0x04, 0xc5, 0x8f, 0x09, 0x0f, 0xbf, 0x62, 0x49, 0x76, 0x59, // 0xa
-// 1 , 1 , 1 , 1 , 1 , x , 0 , 1 , 1 , 0 , x , 1 , 1 , 1 , 1 , 0 ,
- 0x1d, 0x80, 0xde, 0x60, 0x07, 0xe0, 0x1b, 0x66, 0xa5, 0xbe, 0xcd, 0x87, 0xdc, 0xc3, 0x6b, 0x4e, // 0xb
-// 0 , 1 , 1 , 1 , 1 , x , 0 , x , 0 , x , 0 , 1 , 1 , 0 , 1 , 1 ,
- 0xd0, 0xfd, 0xd4, 0x3f, 0x98, 0x96, 0x2f, 0x4c, 0xb3, 0xea, 0x2c, 0x75, 0xe4, 0xc0, 0x6c, 0x6a, // 0xc
-// 0 , x , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 0 , 1 , 1 , x , 1 , 1 , 1 ,
- 0x9b, 0xb7, 0x43, 0x8b, 0x41, 0x47, 0x02, 0xdb, 0x99, 0x3d, 0xa3, 0x79, 0x50, 0x4f, 0xb4, 0x55, // 0xd
+// 0 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 1 , 1 , 1 , 0 ,
+ 0xf1, 0x3a, 0xae, 0x61, 0x01, 0x29, 0x97, 0x23, 0x8e, 0x5d, 0x9a, 0x65, 0x74, 0x21, 0x20, 0x40, // 0x5
+// 0 , 1 , 1 , 1 , 1 , 0 , x , x , x , 0 , 0 , 1 , 1 , 1 , 1 , 1 ,
+ 0xd3, 0x05, 0xa2, 0xe1, 0xbc, 0x9e, 0x1e, 0x10, 0x14, 0x0c, 0x88, 0x9c, 0xec, 0x38, 0xb5, 0x9d, // 0x6
+// 1 , 0 , 0 , x , 1 , 1 , 0 , 0 , x , 0 , x , 0 , 0 , 1 , 1 , 1 ,
+ 0x2d, 0xf7, 0x17, 0x0e, 0x84, 0xc7, 0x7d, 0xce, 0x94, 0x16, 0x48, 0xa8, 0x81, 0x6e, 0x7b, 0xd8, // 0x7
+// 1 , 1 , 1 , 1 , x , 0 , x , 0 , 1 , 1 , 1 , x , x , 1 , 1 , 1 ,
+ 0xa7, 0x7f, 0x42, 0xe6, 0xa0, 0x2a, 0xef, 0xee, 0x24, 0xba, 0xb8, 0x7e, 0xc9, 0x2b, 0x90, 0xcc, // 0x8
+// 1 , x , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
+ 0x5b, 0xd1, 0xf3, 0xe2, 0x6f, 0xed, 0x9f, 0xf0, 0x4b, 0x54, 0x8c, 0x08, 0xf8, 0x51, 0x68, 0xc8, // 0x9
+// x , 0 , 0 , 0 , 0 , 0 , 0 , 0 , x , 0 , x , 0 , 0 , 0 , 0 , 1 ,
+ 0x03, 0x0b, 0xbb, 0xc1, 0xe3, 0x4d, 0x04, 0xc5, 0x8f, 0x09, 0x0f, 0xbf, 0x62, 0x49, 0x76, 0x59, // 0xa
+// 1 , 1 , 1 , 1 , 1 , x , 0 , 1 , 1 , 0 , x , 1 , 1 , 1 , 1 , 0 ,
+ 0x1d, 0x80, 0xde, 0x60, 0x07, 0xe0, 0x1b, 0x66, 0xa5, 0xbe, 0xcd, 0x87, 0xdc, 0xc3, 0x6b, 0x4e, // 0xb
+// 0 , 1 , 1 , 1 , 1 , x , 0 , x , 0 , x , 0 , 1 , 1 , 0 , 1 , 1 ,
+ 0xd0, 0xfd, 0xd4, 0x3f, 0x98, 0x96, 0x2f, 0x4c, 0xb3, 0xea, 0x2c, 0x75, 0xe4, 0xc0, 0x6c, 0x6a, // 0xc
+// 0 , x , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 0 , 1 , 1 , x , 1 , 1 , 1 ,
+ 0x9b, 0xb7, 0x43, 0x8b, 0x41, 0x47, 0x02, 0xdb, 0x99, 0x3d, 0xa3, 0x79, 0x50, 0x4f, 0xb4, 0x55, // 0xd
// 1 , 0 , 0 , 0 , 1 , 0 , 0 , x , x , 1 , 1 , 1 , 0 , 1 , 1 , 1 ,
- 0x5a, 0x25, 0xf4, 0xca, 0x58, 0x30, 0xc4, 0x12, 0xa9, 0x46, 0xda, 0x91, 0xa4, 0xaa, 0xfc, 0x85, // 0xe
-// 1 , 1 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , x ,
- 0xfb, 0x89, 0x06, 0xcf, 0xfe, 0x33, 0xd5, 0x28, 0x1f, 0x19, 0x4a, 0xb1, 0x83, 0xf2, 0x72, 0x26, // 0xf
-// x , x , 1 , 1 , 1 , 1 , 1 , 1 , x , 0 , 1 , 1 , 1 , 1 , 1 , 1 ,
+ 0x5a, 0x25, 0xf4, 0xca, 0x58, 0x30, 0xc4, 0x12, 0xa9, 0x46, 0xda, 0x91, 0xa4, 0xaa, 0xfc, 0x85, // 0xe
+// 1 , 1 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , x ,
+ 0xfb, 0x89, 0x06, 0xcf, 0xfe, 0x33, 0xd5, 0x28, 0x1f, 0x19, 0x4a, 0xb1, 0x83, 0xf2, 0x72, 0x26, // 0xf
+// x , x , 1 , 1 , 1 , 1 , 1 , 1 , x , 0 , 1 , 1 , 1 , 1 , 1 , 1 ,
};
@@ -611,23 +611,19 @@ UINT8 puzzli2_level_decode[256] = {
void pgm_arm_type1_state::command_handler_puzzli2(int pc)
{
-
switch (m_ddp3lastcommand)
{
-
-
-
case 0x31:
{
// how is this selected? command 54?
- /* writes the following sequence before how to play
+ /* writes the following sequence before how to play
each level has a different sequence written before it, size of sequence doesn't seem directly connected to level size (unlike the reads)
so it's probably compressed somehow as well as scrambled? 68k doesnt know in advance how big each lot of data is either, it only stops
writing when it gets a difference response from the MCU.
-
+
00138278: 31 00fd | (set xor table offset)
UNKNOWN - related to depth / number of columns?
00138278: 31 0087 | value 87, after xor is 75 (table address,value fd,f2)
@@ -639,7 +635,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
00138278: 31 003f | value 3f, after xor is 01 (table address,value 01,3e) -> 0x0101
00138278: 31 00b0 | value b0, after xor is 02 (table address,value 02,b2) -> 0x0102
00138278: 31 0035 | value 35, after xor is 02 (table address,value 03,37) -> 0x0102
- COLUMN 2
+ COLUMN 2
00138278: 31 0071 | value 71, after xor is 40 (table address,value 04,31) << 4 is the number of entries in this column
00138278: 31 002d | value 2d, after xor is 0f (table address,value 05,22) << 0x0f is a mask of 4 bits..
@@ -650,12 +646,12 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
COLUMN 3
00138278: 31 00dd | value dd, after xor is 50 (table address,value 0a,8d) << 5 is the number of entries in this column
00138278: 31 0023 | value 23, after xor is 1f (table address,value 0b,3c) << 0x1f is a mask of 5 bits..
-
+
00138278: 31 007a | value 7a, after xor is 00 (table address,value 0c,7a) -> 0x0100
00138278: 31 00f3 | value f3, after xor is 01 (table address,value fd,f2) -> 0x0101
00138278: 31 0077 | value 77, after xor is 05 (table address,value fe,72) -> 0x0105
00138278: 31 0022 | value 22, after xor is 04 (table address,value ff,26) -> 0x0104
- 00138278: 31 0036 | value 36, after xor is 04 (table address,value 00,32) -> 0x0104
+ 00138278: 31 0036 | value 36, after xor is 04 (table address,value 00,32) -> 0x0104
COLUMN 4
00138278: 31 002e | value 2e, after xor is 10 (table address,value 01,3e) << 1 is the number of entries in this column
00138278: 31 00b3 | value b3, after xor is 01 (table address,value 02,b2) << 0x01 is a mask of 1 bit..
@@ -664,7 +660,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
COLUMN 5
00138278: 31 0041 | value 41, after xor is 70 (table address,value 04,31) << 7 is the number of entries in this column
00138278: 31 005d | value 5d, after xor is 7f (table address,value 05,22) << 0x7f is a mask of 7 bits..
-
+
00138278: 31 00d6 | value d6, after xor is 00 (table address,value 06,d6) -> 0x0100
00138278: 31 000c | value 0c, after xor is 01 (table address,value 07,0d) -> 0x0101
00138278: 31 0036 | value 36, after xor is 03 (table address,value 08,35) -> 0x0103
@@ -675,7 +671,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
COLUMN 6
00138278: 31 00a2 | value a2, after xor is 50 (table address,value fd,f2) << 5 is the number of entries in this column
00138278: 31 006d | value 6d, after xor is 1f (table address,value fe,72) << 0x1f is a mask of 5 bits..
-
+
00138278: 31 0023 | value 23, after xor is 05 (table address,value ff,26) -> 0x0105
00138278: 31 0037 | value 37, after xor is 05 (table address,value 00,32) -> 0x0105
00138278: 31 003f | value 3f, after xor is 01 (table address,value 01,3e) -> 0x0101
@@ -708,7 +704,6 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
if (!end)
{
-
// always d2 0000 when writing doing level data
// but different for the writes on startup?
m_valueresponse = 0x00d20000;
@@ -716,17 +711,17 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
//UINT8 tableaddr = (hack_31_table_offset + (hack_31_table_offset2&0xf))&0xff;
//UINT8 xoredval = m_value0 ^ puzzli2_level_decode[tableaddr];
//puzzli2_printf("value %02x, after xor is %02x (table address,value %02x,%02x)\n", m_value0, xoredval, tableaddr, puzzli2_level_decode[tableaddr]);
-
+
hackcount2++;
hack_31_table_offset2++;
}
else
{
hackcount2=0;
-
+
// when the ARM detects the end of the stream has been reached it returns a 0x63 status with the number of columns in the data word
m_valueresponse = 0x00630000 | numbercolumns;
-
+
//UINT8 tableaddr = (hack_31_table_offset + (hack_31_table_offset2&0xf))&0xff;
//UINT8 xoredval = m_value0 ^ puzzli2_level_decode[tableaddr];
//puzzli2_printf("value %02x, after xor is %02x (table address,value %02x,%02x) (end, returning %02x as playfield width)\n", m_value0, xoredval, tableaddr, puzzli2_level_decode[tableaddr], m_valueresponse);
@@ -748,7 +743,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
}
break;
-
+
// after writing the compressed and scrambled data stream for the level (copied from ROM) with command 0x31
// the game expects to read back a fully formed level structure from the ARM
@@ -758,7 +753,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
// this is the how to play screen, correctly returned with current code
/*
- UINT16 retvals[61] =
+ UINT16 retvals[61] =
{ 0x0008, // depth (-2?)
0x0103, 0x0101, 0x0102, 0x0102, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // first column
0x0103, 0x0100, 0x0101, 0x0105, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -807,7 +802,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
m_valueresponse = 0x780000 | m_simregion<<8; // this must also return the cart region or the game will act in odd ways when inserting a coin on continue, or during the game on later levels
m_valuekey = 0x100;
m_puzzli_54_trigger = 0;
-
+
break;
@@ -846,7 +841,6 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
}
else
{
-
int val = ((hack_47_value & 0x0f00)>>8) * 0x19;
val +=((hack_47_value & 0x000f)>>0) * 0x05;
val += m_value0 & 0x000f;
@@ -855,14 +849,14 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
}
-
+
break;
case 0x61: // ??
puzzli2_printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0);
-
+
// this command is written before the values used to decrypt the z80 addresses (assumed) are uploaded with command 31
command_31_write_type = 1;
@@ -882,7 +876,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
case 0x54: // ??
puzzli2_printf("%08x: %02x %04x\n",pc, m_ddp3lastcommand, m_value0);
-
+
// this command is written before uploading the compressed level data stream with command 31
command_31_write_type = 2;
@@ -891,7 +885,7 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
hackcount2 = 0;
hackcount = 0;
m_valueresponse = 0x36<<16;
-
+
// clear the return structure
for (int columns=0;columns<8;columns++)
for (int rows=0;rows<10;rows++)
@@ -899,36 +893,36 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc)
break;
- /*
-
- puzzli2 on startup (00148a84) puzzli2s on startup (0014cf58)
-
- (001489f6: 61 0202 0014ceca: 61 0202)
- always
- : 31 004e a6f7 | : 31 | 0051 14c9 + 26DD2
- : 31 279e 534f | : 31 | 27a0 c121
- : 31 ab5c a7cf | : 31 | ab5f 15a1
- : 31 145f 7054 | : 31 | 1461 de26
- : 31 85a0 7b7f | : 31 | 85a2 e951
- : 31 7003 c5ab | : 31 | 7006 337d
- : 31 456d f3aa | : 31 | 4570 617c
-
- (00148b34: 41 e2bb 0014d008: 41 706d)
-
- actual values needed always
- 0x001694a8 / 0x0019027a + 26DD2
- 0x0016cfae / 0x00193D80
- 0x0016ebf2 / 0x001959c4
- 0x0016faa8 / 0x0019687a
- 0x00174416 / 0x0019b1e8
-
- 0x00166178 / 0x0018cf4a
- 0x00166e72 / 0x0018dc44
-
- as you can see the difference between the values written is always 26dd2, as is the difference between offsets expected
- this makes it impossible to know which value is for which address without further tests!
-
-
+ /*
+
+ puzzli2 on startup (00148a84) puzzli2s on startup (0014cf58)
+
+ (001489f6: 61 0202 0014ceca: 61 0202)
+ always
+ : 31 004e a6f7 | : 31 | 0051 14c9 + 26DD2
+ : 31 279e 534f | : 31 | 27a0 c121
+ : 31 ab5c a7cf | : 31 | ab5f 15a1
+ : 31 145f 7054 | : 31 | 1461 de26
+ : 31 85a0 7b7f | : 31 | 85a2 e951
+ : 31 7003 c5ab | : 31 | 7006 337d
+ : 31 456d f3aa | : 31 | 4570 617c
+
+ (00148b34: 41 e2bb 0014d008: 41 706d)
+
+ actual values needed always
+ 0x001694a8 / 0x0019027a + 26DD2
+ 0x0016cfae / 0x00193D80
+ 0x0016ebf2 / 0x001959c4
+ 0x0016faa8 / 0x0019687a
+ 0x00174416 / 0x0019b1e8
+
+ 0x00166178 / 0x0018cf4a
+ 0x00166e72 / 0x0018dc44
+
+ as you can see the difference between the values written is always 26dd2, as is the difference between offsets expected
+ this makes it impossible to know which value is for which address without further tests!
+
+
*/
// I think the values returned here must be connected to the values written to command 31 on startup
@@ -1072,7 +1066,7 @@ void pgm_arm_type1_state::command_handler_py2k2(int pc)
m_simregion = ioport("Region")->read();
m_valuekey = 0x100;
m_valueresponse = 0x00880000 | m_simregion<<8;
-
+
break;
}
}
@@ -1877,7 +1871,6 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
}
else
{
-
UINT8 rawvalue = datvalue;
UINT8 tableloc = (tableoffs+tableoffs2)&0xff;
rawvalue ^= puzzli2_level_decode[tableloc];
@@ -1916,7 +1909,7 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
stage = 2;
entries_left = (rawvalue >> 4);
m_row_bitmask = (rawvalue & 0x0f)<<8;
-
+
full_entry = rawvalue;
prev_tablloc = tableloc;
@@ -1931,10 +1924,10 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
puzzli2_printf("\n");
-
+
}
else if (stage==2)
- {
+ {
puzzli2_printf("%02x <- Mask value equal to number of entries (xor table location is %02x)", rawvalue, tableloc);
stage = 3;
@@ -1945,7 +1938,7 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
if (num_mask_bits != num_entries)
puzzli2_printf(" error - number of mask bits != number of entries - ");
- //
+ //
if (entries_left == 0)
{
// for 0 entries skip back to state 1 instead of 3, because there is nothing following
@@ -1972,7 +1965,7 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
{
return 1;
}
-
+
}
else
{
@@ -1982,7 +1975,6 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
}
else
{
-
// this isn't a strict rule
// the mask is used so they can specify spaces between elements too without storing the 00 bytes
coverage[tableloc] = 1;
@@ -2037,21 +2029,21 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
{
int fishtype = rawvalue;
puzzli2_printf("%02x <- fish type %d", rawvalue, fishtype);
- object_value = 0x0100 + fishtype;
+ object_value = 0x0100 + fishtype;
// 0x110 is a flashy fish? might be glitchy and need a special number..
}
else if (rawvalue<=0x21) // fish in bubbles
{
int fishtype = rawvalue - 0x11;
puzzli2_printf("%02x <- fish in bubble %d", rawvalue, fishtype);
- object_value = 0x0120 + fishtype;
+ object_value = 0x0120 + fishtype;
// 0x130 is a flashy fish? might be glitchy and need a special number..
}
else if (rawvalue<=0x32) // fish in eggs
{
int fishtype = rawvalue - 0x22;
puzzli2_printf("%02x <- fish in egg %d", rawvalue, fishtype);
- object_value = 0x0140 + fishtype;
+ object_value = 0x0140 + fishtype;
// 0x150 is a flashy fish? might be glitchy and need a special number..
}
@@ -2059,7 +2051,7 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
{
int fishtype = rawvalue - 0x33;
puzzli2_printf("%02x <- fish on hook %d", rawvalue, fishtype);
- object_value = 0x0180 + fishtype;
+ object_value = 0x0180 + fishtype;
// 0x190 is a flashy fish? might be glitchy and need a special number..
}
@@ -2080,7 +2072,7 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
if (object_value==0xffff)
{
object_value = 0x110;
- popmessage("unknown object type %02x\n", rawvalue);
+ popmessage("unknown object type %02x\n", rawvalue);
}
int realrow = get_position_of_bit(m_row_bitmask, currentrow);
@@ -2105,12 +2097,12 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue)
}
}
-
+
}
return 0;
}
-
+
DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2)
@@ -2142,12 +2134,12 @@ DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2)
if (!strcmp(machine().system().name,"puzzli2"))
{
offset = 0x17ab66;
- limit = 476;
+ limit = 476;
}
else
{
- offset = 0x16c3ca;
- limit = 500;
+ offset = 0x16c3ca;
+ limit = 500;
}
@@ -2206,7 +2198,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2)
fatalerror("mismatch in number of columns vs specified amount\n");
printf("\n");
-
+
}
diff --git a/src/mame/machine/pgmprot_igs027a_type2.c b/src/mame/machine/pgmprot_igs027a_type2.c
index 1c12555f20d..a555de18a16 100644
--- a/src/mame/machine/pgmprot_igs027a_type2.c
+++ b/src/mame/machine/pgmprot_igs027a_type2.c
@@ -165,7 +165,7 @@ WRITE32_MEMBER(pgm_arm_type2_state::kov2p_arm_region_w )
{
int pc = space.device().safe_pc();
int regionhack = ioport("RegionHack")->read();
-// printf("%08x\n", pc);
+// printf("%08x\n", pc);
if (pc==0x1b0 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0);
COMBINE_DATA(&m_arm7_shareram[0x138/4]);
}
diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c
index 847568dfd7f..2bb45761558 100644
--- a/src/mame/machine/stfight.c
+++ b/src/mame/machine/stfight.c
@@ -72,8 +72,6 @@ DRIVER_INIT_MEMBER(stfight_state,stfight)
DRIVER_INIT_MEMBER(stfight_state,cshooter)
{
-
-
}
void stfight_state::machine_reset()
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 67e0cea9f8e..e45d6561af1 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -284,9 +284,9 @@ chewing // ?? unknown
catacomb // 1982 MTM Games
ckongg // 1981 bootleg
ckongmc // 1981 bootleg
-ckonggx //
+ckonggx //
ckongcv // 19?? Competitive Video?
-ckongis //
+ckongis //
porter // 1982 bootleg (Arcade TV Game List - P.98, Left, 15 from bottom)
tdpgal // 1983 Design Labs / Thomas Automatics
guttangt
@@ -1095,7 +1095,7 @@ gdvsgd
// Misc Namco games
30test // (c) 1997
-25pacman // (c) 2006 Ver 3.0
+25pacman // (c) 2006 Ver 3.0
25pacmano // (c) 2005 Ver 2.0 - Same hardware as 20pacgal
20pacgal // (c) 2000 Ver 1.08
20pacgalr4 // (c) 2000 Ver 1.04
@@ -1107,7 +1107,7 @@ turrett // (c) 2001 licensed from Dell Electronics
// Universal games
cosmicg // 7907 (c) 1979
-cosmicgi // bootleg (Inder)
+cosmicgi // bootleg (Inder)
cosmica // 7910-AII (c) [1979]
cosmica1 // 7910-A (c) [1979]
cosmica2 // 7910 (c) 1979
@@ -1345,7 +1345,7 @@ multigmb // 1992
multigm2 // 1992
multigm3 // 19??
multigmt
-sgmt1 // 1994
+sgmt1 // 1994
supergm3 // 1996
cham24 // 2002
@@ -2405,7 +2405,7 @@ dariusgj // 1994.09 D87 (c) 1994 Taito Corporation (Japan)
dariusgu // 1994.11 D87 (c) 1994 Taito America Corporation (US)
dariusgx // 1994.?? D87 (c) 1994 Taito Corporation
bublbob2 // 1994.?? D90 (c) 1994 Taito Corporation Japan (World)
-bublbob2p // prototype
+bublbob2p // prototype
bubsymphe // 1994.?? D90 (c) 1994 Taito Corporation Japan (Europe)
bubsymphu // 1994.10 D90 (c) 1994 Taito America Corporation (US)
bubsymphj // 1994.10 D90 (c) 1994 Taito Corporation (Japan)
@@ -2498,7 +2498,7 @@ homura // (c) 2005 SKonec Entertainment
hotgmkmp // (c) 2005 XNauts
raiden3 // (c) 2005 Seibu Kaihatsu/Moss Ltd
spicaadv // (c) 2005 Taito Corporation
-usagiol // (c) 2005 Taito Corporation/Warashi
+usagiol // (c) 2005 Taito Corporation/Warashi
shikiga3 // (c) 2006 Alfa System/SKonec Entertainment
raiden4 // (c) 2007 Seibu Kaihatsu/Moss Ltd
kof98um // (c) 2008 SNK
@@ -5825,8 +5825,8 @@ hvysmsha // MBG (c) 1993 Data East Corporation (Asia)
hvysmshj // MBG (c) 1993 Data East Corporation (Japan)
nslasher // MBH (c) 1993 Data East Corporation
nslasherj // MBH (c) 1993 Data East Corporation (Japan)
-nslashers // MBH (c) 1993 Data East Corporation
-nslasheru // MBH (c) 1993 Data EAst Corporation (US)
+nslashers // MBH (c) 1993 Data East Corporation
+nslasheru // MBH (c) 1993 Data EAst Corporation (US)
// MBI ??
// MBJ ??
// MBK ??
@@ -9476,8 +9476,8 @@ dmnfrnta //
dmnfrntb //
dmnfrntpcb //
kovshp // (c) 2004 Knights of Valor Superheroes PLUS
-kovshpa //
-kovytzy // (c) 1999 Knights of Valour: Yi Tong Zhong Yuan
+kovshpa //
+kovytzy // (c) 1999 Knights of Valour: Yi Tong Zhong Yuan
kovshxas // bootleg
kovlsqh // bootleg
kovlsqh2 // bootleg
@@ -9495,7 +9495,7 @@ ddpdoj // (c) 2002 DoDonPachi Dai-Ou-Jou
ddpdoja //
ddpdojb //
ddpdojblk //
-ddpdojblka //
+ddpdojblka //
espgal // (c) 2003 Espgaluda
// IGS PGM2 Platform
@@ -11886,7 +11886,7 @@ nfsug // Need For Speed: Underground Install (2 Discs) (v1.1)
// unknown
fruitpc // ???
-casanova //
+casanova //
// Leisure Ent.
roul // (c) 1990
diff --git a/src/mame/video/8080bw.c b/src/mame/video/8080bw.c
index 960bfca1a0d..729304df65d 100644
--- a/src/mame/video/8080bw.c
+++ b/src/mame/video/8080bw.c
@@ -34,7 +34,7 @@ PALETTE_INIT_MEMBER(_8080bw_state,rollingc)
palette_set_color_rgb(machine(), i, pal1bit(i >> 2) >> 1, pal1bit(i >> 1) >> 1, pal1bit(i >> 0) >> 1);
palette_set_color_rgb(machine(), i | 8, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
}
-
+
// but according to photos, pen 6 is clearly orange instead of dark-yellow, and pen 5 is less dark as well
// pens 1, 2 and 4 are good though. Maybe we're missing a color prom?
palette_set_color_rgb(machine(), 0x05, 0xff, 0x00, 0x80); // pink
diff --git a/src/mame/video/atarimo.c b/src/mame/video/atarimo.c
index df01f18e49f..7537f3d93e5 100644
--- a/src/mame/video/atarimo.c
+++ b/src/mame/video/atarimo.c
@@ -48,14 +48,14 @@ cyberbal 1 1 1 0 0 0 1 1k 0 0 0x600 0x100 0 0,0,07f8
eprom 0 1 1 0 1 0 0 8 0 0 0x100 0x100 0 03ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,0,0,0008 0 0,0,0070,0 0 0 0
guts 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 03ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,000f 0,8000,0,0 0 0,0,0070,0 0 0 0
gauntlet 0 1 1 1 0 0 0 8 1 0 0x100 0x100 0 0,0,0,03ff 7fff,0,0,0 0 0,000f,0,0 0,ff80,0,0 0,0,ff80,0 0,0,0038,0 0,0,0007,0 0,0,0040,0 0 0 0 0 0
-klax 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0,0 0,0fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,0,0,0008 0 0 0 0 0
-offtwall 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
-rampart 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
+klax 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0,0 0,0fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,0,0,0008 0 0 0 0 0
+offtwall 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
+rampart 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
relief 1 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
shuuz 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
skullxbo 0 2 1 0 0 0 0 8 0 0 0x000 0x200 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ffc0,0 0,0,0,ff80 0,0,0,0070 0,0,0,000f 0,8000,0,0 0 0,0,0030,0 0 0 0
thunderj 1 1 1 0 1 0 0 8 0 0 0x100 0x100 0 03ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0,0,0070,0 0 0 0
-toobin 1 1 1 0 0 1 0 1k 0 0 0x100 0x100 0 0,0,00ff,0 0,3fff,0,0 0 0,0,0,000f 0,0,0,ffc0 7fc0,0,0,0 0007,0,0,0 0038,0,0,0 0,4000,0,0 0,8000,0,0 0 0 8000,0,0,0 0
+toobin 1 1 1 0 0 1 0 1k 0 0 0x100 0x100 0 0,0,00ff,0 0,3fff,0,0 0 0,0,0,000f 0,0,0,ffc0 7fc0,0,0,0 0007,0,0,0 0038,0,0,0 0,4000,0,0 0,8000,0,0 0 0 8000,0,0,0 0
vindictr 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 0,0,0,03ff 7fff,0,0,0 0 0,000f,0,0 0,ff80,0,0 0,0,ff80,0 0,0,0038,0 0,0,0007,0 0,0,0040,0 0 0,0070,0,0 0 0 0
xybots 1 1 0 0 0 0 0 0 0 0 0x100 0x300 0 003f,0,0,0 3fff,0,0,0 0 0,0,0,000f 0,0,0,ff80 0,0,ff80,0 0 0,0,0007,0 8000,0,0,0 0 0,000f,0,0 0 0 0
@@ -67,7 +67,7 @@ atarisy1 0 8 1 1 0 0 0 0 0 x38 0x100 0x100 0 0,0,0,00
atarisy2 1 1 1 0 0 0 0 0 0 0 0x000 0x040 15 0,0,0,07f8 0,07ff,0,0 0007,0,0,0 0,0,0,3000 0,0,ffc0,0 7fc0,0,0,0 0 0,3800,0,0 0,4000,0,0 0 0,0,0,c000 0,8000,0,0 0 0
-toobin 1 1 1 0 0 1 0 1k 0 0 0x100 0x100 0 0,0,00ff,0 0,3fff,0,0 0 0,0,0,000f 0,0,0,ffc0 7fc0,0,0,0 0007,0,0,0 0038,0,0,0 0,4000,0,0 0,8000,0,0 0 0 8000,0,0,0 0
+toobin 1 1 1 0 0 1 0 1k 0 0 0x100 0x100 0 0,0,00ff,0 0,3fff,0,0 0 0,0,0,000f 0,0,0,ffc0 7fc0,0,0,0 0007,0,0,0 0038,0,0,0 0,4000,0,0 0,8000,0,0 0 0 8000,0,0,0 0
gauntlet 0 1 1 1 0 0 0 8 1 0 0x100 0x100 0 0,0,0,03ff 7fff,0,0,0 0 0,000f,0,0 0,ff80,0,0 0,0,ff80,0 0,0,0038,0 0,0,0007,0 0,0,0040,0 0 0 0 0 0
vindictr 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 0,0,0,03ff 7fff,0,0,0 0 0,000f,0,0 0,ff80,0,0 0,0,ff80,0 0,0,0038,0 0,0,0007,0 0,0,0040,0 0 0,0070,0,0 0 0 0
@@ -85,9 +85,9 @@ guts 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 03ff,0,0
skullxbo 0 2 1 0 0 0 0 8 0 0 0x000 0x200 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ffc0,0 0,0,0,ff80 0,0,0,0070 0,0,0,000f 0,8000,0,0 0 0,0,0030,0 0 0 0
thunderj 1 1 1 0 1 0 0 8 0 0 0x100 0x100 0 03ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0,0,0070,0 0 0 0
arcadecl 0 1 1 0 0 0 0 0 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0 0 0 0 0 0
-klax 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0,0 0,0fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,0,0,0008 0 0 0 0 0
-offtwall 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
-rampart 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
+klax 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0,0 0,0fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,0,0,0008 0 0 0 0 0
+offtwall 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
+rampart 0 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
relief 1 1 1 0 0 0 0 8 0 0 0x100 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
shuuz 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0,0 0,7fff,0,0 0 0,0,000f,0 0,0,ff80,0 0,0,0,ff80 0,0,0,0070 0,0,0,0007 0,8000,0,0 0 0 0 0 0
@@ -102,8 +102,8 @@ shuuz 1 1 1 0 0 0 0 8 0 0 0x000 0x100 0 00ff,0,0
//**************************************************************************
//-------------------------------------------------
-// compute_log: Computes the number of bits
-// necessary to hold a given value. The input must
+// compute_log: Computes the number of bits
+// necessary to hold a given value. The input must
// be an even power of two.
//-------------------------------------------------
@@ -122,9 +122,9 @@ inline int atari_motion_objects_device::compute_log(int value)
//-------------------------------------------------
-// round_to_powerof2: Rounds a number up to the
-// nearest power of 2. Even powers of 2 are
-// rounded up to the next greatest power
+// round_to_powerof2: Rounds a number up to the
+// nearest power of 2. Even powers of 2 are
+// rounded up to the next greatest power
// (e.g., 4 returns 8).
//-------------------------------------------------
@@ -183,7 +183,7 @@ atari_motion_objects_device::atari_motion_objects_device(const machine_config &m
//-------------------------------------------------
// static_set_config: Set the tag of the
-// sound CPU
+// sound CPU
//-------------------------------------------------
void atari_motion_objects_device::static_set_config(device_t &device, const atari_motion_objects_config &config)
@@ -261,8 +261,8 @@ void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cl
//-------------------------------------------------
-// apply_stain: Mark high palette bits
-// starting at the given X,Y and continuing until
+// apply_stain: Mark high palette bits
+// starting at the given X,Y and continuing until
// a stop or the end of line.
//-------------------------------------------------
@@ -315,13 +315,13 @@ void atari_motion_objects_device::device_start()
m_tileheight = gfx->height();
m_tilexshift = compute_log(m_tilewidth);
m_tileyshift = compute_log(m_tileheight);
-
+
// derive bitmap information
m_bitmapwidth = round_to_powerof2(m_xposmask.mask());
m_bitmapheight = round_to_powerof2(m_yposmask.mask());
m_bitmapxmask = m_bitmapwidth - 1;
m_bitmapymask = m_bitmapheight - 1;
-
+
// derive sprite information
m_entrycount = round_to_powerof2(m_linkmask.mask());
m_entrybits = compute_log(m_entrycount);
@@ -363,8 +363,8 @@ void atari_motion_objects_device::device_start()
//-------------------------------------------------
-// device_reset: Handle a device reset by
-// clearing the interrupt lines and states
+// device_reset: Handle a device reset by
+// clearing the interrupt lines and states
//-------------------------------------------------
void atari_motion_objects_device::device_reset()
@@ -379,7 +379,7 @@ void atari_motion_objects_device::device_reset()
//-------------------------------------------------
// device_timer: Handle device-specific timer
-// calbacks
+// calbacks
//-------------------------------------------------
void atari_motion_objects_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
@@ -399,8 +399,8 @@ void atari_motion_objects_device::device_timer(emu_timer &timer, device_timer_id
//-------------------------------------------------
-// build_active_list: Build a list of active
-// objects.
+// build_active_list: Build a list of active
+// objects.
//-------------------------------------------------
void atari_motion_objects_device::build_active_list(int link)
@@ -445,8 +445,8 @@ void atari_motion_objects_device::build_active_list(int link)
//-------------------------------------------------
-// render_object: Internal processing callback
-// that renders to the backing bitmap and then
+// render_object: Internal processing callback
+// that renders to the backing bitmap and then
// copies the result to the destination.
//-------------------------------------------------
@@ -605,9 +605,9 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect
//-------------------------------------------------
atari_motion_objects_device::sprite_parameter::sprite_parameter()
- : m_word(0),
- m_shift(0),
- m_mask(0)
+ : m_word(0),
+ m_shift(0),
+ m_mask(0)
{
}
@@ -654,7 +654,7 @@ bool atari_motion_objects_device::sprite_parameter::set(const UINT16 input[4])
//-------------------------------------------------
atari_motion_objects_device::dual_sprite_parameter::dual_sprite_parameter()
- : m_uppershift(0)
+ : m_uppershift(0)
{
}
@@ -670,7 +670,7 @@ bool atari_motion_objects_device::dual_sprite_parameter::set(const atari_motion_
return false;
if (!m_upper.set(input.data_upper))
return false;
-
+
// determine teh upper shift amount
UINT16 temp = m_lower.mask();
m_uppershift = 0;
diff --git a/src/mame/video/atarimo.h b/src/mame/video/atarimo.h
index b8b08b2b2f8..a93295e7e94 100644
--- a/src/mame/video/atarimo.h
+++ b/src/mame/video/atarimo.h
@@ -50,8 +50,7 @@
#define MCFG_ATARI_MOTION_OBJECTS_ADD(_tag, _screen, _config) \
MCFG_DEVICE_ADD(_tag, ATARI_MOTION_OBJECTS, 0) \
MCFG_VIDEO_SET_SCREEN(_screen) \
- atari_motion_objects_device::static_set_config(*device, _config); \
-
+ atari_motion_objects_device::static_set_config(*device, _config);
//**************************************************************************
@@ -79,20 +78,20 @@ struct atari_motion_objects_config
UINT16 m_maxcolors; // maximum number of colors (remove me)
UINT8 m_transpen; // transparent pen index
- entry m_link_entry; // mask for the link
- dual_entry m_code_entry; // mask for the code index
- dual_entry m_color_entry; // mask for the color/priority
- entry m_xpos_entry; // mask for the X position
- entry m_ypos_entry; // mask for the Y position
- entry m_width_entry; // mask for the width, in tiles*/
- entry m_height_entry; // mask for the height, in tiles
- entry m_hflip_entry; // mask for the horizontal flip
- entry m_vflip_entry; // mask for the vertical flip
- entry m_priority_entry; // mask for the priority
- entry m_neighbor_entry; // mask for the neighbor
- entry m_absolute_entry; // mask for absolute coordinates
- entry m_special_entry; // mask for the special value
- UINT16 m_specialvalue; // resulting value to indicate "special"
+ entry m_link_entry; // mask for the link
+ dual_entry m_code_entry; // mask for the code index
+ dual_entry m_color_entry; // mask for the color/priority
+ entry m_xpos_entry; // mask for the X position
+ entry m_ypos_entry; // mask for the Y position
+ entry m_width_entry; // mask for the width, in tiles*/
+ entry m_height_entry; // mask for the height, in tiles
+ entry m_hflip_entry; // mask for the horizontal flip
+ entry m_vflip_entry; // mask for the vertical flip
+ entry m_priority_entry; // mask for the priority
+ entry m_neighbor_entry; // mask for the neighbor
+ entry m_absolute_entry; // mask for absolute coordinates
+ entry m_special_entry; // mask for the special value
+ UINT16 m_specialvalue; // resulting value to indicate "special"
};
@@ -114,7 +113,7 @@ public:
// static configuration helpers
static void static_set_config(device_t &device, const atari_motion_objects_config &config);
-
+
// getters
int bank() const { return m_bank; }
int xscroll() const { return m_xscroll; }
@@ -133,7 +132,7 @@ public:
// rendering
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect);
void apply_stain(bitmap_ind16 &bitmap, UINT16 *pf, UINT16 *mo, int x, int y);
-
+
// memory access
UINT16 &slipram(int offset) { return m_slipram[offset]; }
@@ -173,11 +172,11 @@ private:
UINT16 mask() const { return m_mask; }
private:
- UINT16 m_word; // word index
- UINT16 m_shift; // shift amount
- UINT16 m_mask; // final mask
+ UINT16 m_word; // word index
+ UINT16 m_shift; // shift amount
+ UINT16 m_mask; // final mask
};
-
+
// a sprite parameter, which is a word index + shift + mask
class dual_sprite_parameter
{
@@ -188,65 +187,65 @@ private:
UINT16 mask() const { return m_lower.mask() | (m_upper.mask() << m_uppershift); }
private:
- sprite_parameter m_lower; // lower parameter
- sprite_parameter m_upper; // upper parameter
- UINT16 m_uppershift; // upper shift
+ sprite_parameter m_lower; // lower parameter
+ sprite_parameter m_upper; // upper parameter
+ UINT16 m_uppershift; // upper shift
};
-
+
// parameter masks
- sprite_parameter m_linkmask; // mask for the link
- sprite_parameter m_gfxmask; // mask for the graphics bank
- dual_sprite_parameter m_codemask; // mask for the code index
- dual_sprite_parameter m_colormask; // mask for the color
- sprite_parameter m_xposmask; // mask for the X position
- sprite_parameter m_yposmask; // mask for the Y position
- sprite_parameter m_widthmask; // mask for the width, in tiles*/
- sprite_parameter m_heightmask; // mask for the height, in tiles
- sprite_parameter m_hflipmask; // mask for the horizontal flip
- sprite_parameter m_vflipmask; // mask for the vertical flip
- sprite_parameter m_prioritymask; // mask for the priority
- sprite_parameter m_neighbormask; // mask for the neighbor
- sprite_parameter m_absolutemask; // mask for absolute coordinates
- sprite_parameter m_specialmask; // mask for the special value
+ sprite_parameter m_linkmask; // mask for the link
+ sprite_parameter m_gfxmask; // mask for the graphics bank
+ dual_sprite_parameter m_codemask; // mask for the code index
+ dual_sprite_parameter m_colormask; // mask for the color
+ sprite_parameter m_xposmask; // mask for the X position
+ sprite_parameter m_yposmask; // mask for the Y position
+ sprite_parameter m_widthmask; // mask for the width, in tiles*/
+ sprite_parameter m_heightmask; // mask for the height, in tiles
+ sprite_parameter m_hflipmask; // mask for the horizontal flip
+ sprite_parameter m_vflipmask; // mask for the vertical flip
+ sprite_parameter m_prioritymask; // mask for the priority
+ sprite_parameter m_neighbormask; // mask for the neighbor
+ sprite_parameter m_absolutemask; // mask for absolute coordinates
+ sprite_parameter m_specialmask; // mask for the special value
// derived tile information
- int m_tilewidth; // width of non-rotated tile
- int m_tileheight; // height of non-rotated tile
- int m_tilexshift; // bits to shift X coordinate when drawing
- int m_tileyshift; // bits to shift Y coordinate when drawing
+ int m_tilewidth; // width of non-rotated tile
+ int m_tileheight; // height of non-rotated tile
+ int m_tilexshift; // bits to shift X coordinate when drawing
+ int m_tileyshift; // bits to shift Y coordinate when drawing
// derived bitmap information
- int m_bitmapwidth; // width of the full playfield bitmap
- int m_bitmapheight; // height of the full playfield bitmap
- int m_bitmapxmask; // x coordinate mask for the playfield bitmap
- int m_bitmapymask; // y coordinate mask for the playfield bitmap
-
+ int m_bitmapwidth; // width of the full playfield bitmap
+ int m_bitmapheight; // height of the full playfield bitmap
+ int m_bitmapxmask; // x coordinate mask for the playfield bitmap
+ int m_bitmapymask; // y coordinate mask for the playfield bitmap
+
// derived sprite information
- int m_entrycount; // number of entries per bank
- int m_entrybits; // number of bits needed to represent entrycount
- int m_spriterammask; // combined mask when accessing sprite RAM with raw addresses
- int m_spriteramsize; // total size of sprite RAM, in entries
- int m_slipshift; // log2(pixels_per_SLIP)
- int m_sliprammask; // combined mask when accessing SLIP RAM with raw addresses
- int m_slipramsize; // total size of SLIP RAM, in entries
+ int m_entrycount; // number of entries per bank
+ int m_entrybits; // number of bits needed to represent entrycount
+ int m_spriterammask; // combined mask when accessing sprite RAM with raw addresses
+ int m_spriteramsize; // total size of sprite RAM, in entries
+ int m_slipshift; // log2(pixels_per_SLIP)
+ int m_sliprammask; // combined mask when accessing SLIP RAM with raw addresses
+ int m_slipramsize; // total size of SLIP RAM, in entries
// live state
- emu_timer * m_force_update_timer; // timer for forced updating
- UINT32 m_bank; // current bank number
- UINT32 m_xscroll; // xscroll offset
- UINT32 m_yscroll; // yscroll offset
+ emu_timer * m_force_update_timer; // timer for forced updating
+ UINT32 m_bank; // current bank number
+ UINT32 m_xscroll; // xscroll offset
+ UINT32 m_yscroll; // yscroll offset
// arrays
optional_shared_ptr<UINT16> m_slipram; // pointer to the SLIP RAM
- dynamic_array<UINT16> m_codelookup; // lookup table for codes
- dynamic_array<UINT8> m_colorlookup; // lookup table for colors
- dynamic_array<UINT8> m_gfxlookup; // lookup table for graphics
-
- UINT16 m_activelist[MAX_PER_BANK*4]; // active list
- UINT16 * m_activelast; // last entry in the active list
-
- UINT32 m_last_xpos; // (during processing) the previous X position
- UINT32 m_next_xpos; // (during processing) the next X position
+ dynamic_array<UINT16> m_codelookup; // lookup table for codes
+ dynamic_array<UINT8> m_colorlookup; // lookup table for colors
+ dynamic_array<UINT8> m_gfxlookup; // lookup table for graphics
+
+ UINT16 m_activelist[MAX_PER_BANK*4]; // active list
+ UINT16 * m_activelast; // last entry in the active list
+
+ UINT32 m_last_xpos; // (during processing) the previous X position
+ UINT32 m_next_xpos; // (during processing) the next X position
};
diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c
index 94bcbff4df4..b1cb6206ed5 100644
--- a/src/mame/video/atarirle.c
+++ b/src/mame/video/atarirle.c
@@ -37,9 +37,9 @@ enum { atarirle_hilite_index = -1 };
//**************************************************************************
//-------------------------------------------------
-// round_to_powerof2: Rounds a number up to the
-// nearest power of 2. Even powers of 2 are
-// rounded up to the next greatest power
+// round_to_powerof2: Rounds a number up to the
+// nearest power of 2. Even powers of 2 are
+// rounded up to the next greatest power
// (e.g., 4 returns 8).
//-------------------------------------------------
@@ -66,14 +66,14 @@ inline int atari_rle_objects_device::round_to_powerof2(int value)
atari_rle_objects_device::atari_rle_objects_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ATARI_RLE_OBJECTS, "Atari RLE Motion Objects", tag, owner, clock, "atari_rle", __FILE__),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this)
{
}
//-------------------------------------------------
// static_set_config: Set the tag of the
-// sound CPU
+// sound CPU
//-------------------------------------------------
void atari_rle_objects_device::static_set_config(device_t &device, const atari_rle_objects_config &config)
@@ -84,8 +84,8 @@ void atari_rle_objects_device::static_set_config(device_t &device, const atari_r
//-------------------------------------------------
-// control_write: Write handler for MO control
-// bits.
+// control_write: Write handler for MO control
+// bits.
//-------------------------------------------------
WRITE8_MEMBER(atari_rle_objects_device::control_write)
@@ -137,8 +137,8 @@ WRITE8_MEMBER(atari_rle_objects_device::control_write)
//-------------------------------------------------
-// command_write: Write handler for MO command
-// bits.
+// command_write: Write handler for MO command
+// bits.
//-------------------------------------------------
WRITE8_MEMBER(atari_rle_objects_device::command_write)
@@ -178,9 +178,9 @@ void atari_rle_objects_device::vblank_callback(screen_device &screen, bool state
//-------------------------------------------------
-// device_start: Configures the motion objects
-// using the input description. Allocates all
-// memory necessary and generates the attribute
+// device_start: Configures the motion objects
+// using the input description. Allocates all
+// memory necessary and generates the attribute
// lookup table.
//-------------------------------------------------
@@ -284,7 +284,7 @@ void atari_rle_objects_device::device_reset()
//-------------------------------------------------
-// build_rle_tables: Builds internal table for
+// build_rle_tables: Builds internal table for
// RLE mapping.
//-------------------------------------------------
@@ -439,8 +439,8 @@ void atari_rle_objects_device::prescan_rle(int which)
//-------------------------------------------------
-// compute_checksum: Compute the checksum values
-// on the ROMs.
+// compute_checksum: Compute the checksum values
+// on the ROMs.
//-------------------------------------------------
void atari_rle_objects_device::compute_checksum()
@@ -458,16 +458,16 @@ void atari_rle_objects_device::compute_checksum()
//-------------------------------------------------
-// sort_and_render: Render all motion objects in
-// order.
+// sort_and_render: Render all motion objects in
+// order.
//-------------------------------------------------
void atari_rle_objects_device::sort_and_render()
-{
+{
// struct for sorting
struct sort_entry_t
{
- sort_entry_t * next;
+ sort_entry_t * next;
int entry;
};
@@ -538,7 +538,7 @@ void atari_rle_objects_device::draw_rle(bitmap_ind16 &bitmap, const rectangle &c
if (info.data == NULL)
return;
- //
+ //
int scaled_xoffs = (xscale * info.xoffs) >> 12;
int scaled_yoffs = (yscale * info.yoffs) >> 12;
@@ -567,7 +567,7 @@ void atari_rle_objects_device::draw_rle(bitmap_ind16 &bitmap, const rectangle &c
//-------------------------------------------------
-// draw_rle_zoom: Draw an RLE-compressed object to
+// draw_rle_zoom: Draw an RLE-compressed object to
// a 16-bit bitmap.
//-------------------------------------------------
@@ -745,8 +745,8 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang
//-------------------------------------------------
-// draw_rle_zoom_hflip: Draw an RLE-compressed
-// object to a 16-bit bitmap with horizontal
+// draw_rle_zoom_hflip: Draw an RLE-compressed
+// object to a 16-bit bitmap with horizontal
// flip.
//-------------------------------------------------
@@ -924,7 +924,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r
//-------------------------------------------------
// hilite_object: Hilight an object by drawing a
-// flashing box around it
+// flashing box around it
//-------------------------------------------------
void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite)
@@ -1031,9 +1031,9 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite)
//-------------------------------------------------
atari_rle_objects_device::sprite_parameter::sprite_parameter()
- : m_word(0),
- m_shift(0),
- m_mask(0)
+ : m_word(0),
+ m_shift(0),
+ m_mask(0)
{
}
diff --git a/src/mame/video/atarirle.h b/src/mame/video/atarirle.h
index b1196887483..9d943fe6780 100644
--- a/src/mame/video/atarirle.h
+++ b/src/mame/video/atarirle.h
@@ -84,15 +84,15 @@ struct atari_rle_objects_config
UINT16 m_rightclip; // right clip coordinate
UINT16 m_palettebase; // base palette entry
- entry m_code_entry; // mask for the code index
- entry m_color_entry; // mask for the color
- entry m_xpos_entry; // mask for the X position
- entry m_ypos_entry; // mask for the Y position
- entry m_scale_entry; // mask for the scale factor
- entry m_hflip_entry; // mask for the horizontal flip
- entry m_order_entry; // mask for the order
- entry m_priority_entry; // mask for the priority
- entry m_vram_entry; // mask for the VRAM target
+ entry m_code_entry; // mask for the code index
+ entry m_color_entry; // mask for the color
+ entry m_xpos_entry; // mask for the X position
+ entry m_ypos_entry; // mask for the Y position
+ entry m_scale_entry; // mask for the scale factor
+ entry m_hflip_entry; // mask for the horizontal flip
+ entry m_order_entry; // mask for the order
+ entry m_priority_entry; // mask for the priority
+ entry m_vram_entry; // mask for the VRAM target
};
@@ -102,8 +102,8 @@ struct atari_rle_objects_config
extern const device_type ATARI_RLE_OBJECTS;
class atari_rle_objects_device : public device_t,
- public device_video_interface,
- public atari_rle_objects_config
+ public device_video_interface,
+ public atari_rle_objects_config
{
public:
// construction/destruction
@@ -111,14 +111,14 @@ public:
// static configuration helpers
static void static_set_config(device_t &device, const atari_rle_objects_config &config);
-
+
// control handlers
DECLARE_WRITE8_MEMBER(control_write);
DECLARE_WRITE8_MEMBER(command_write);
// render helpers
void vblank_callback(screen_device &screen, bool state);
-
+
// getters
bitmap_ind16 &vram(int idx) { return m_vram[idx][(m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2]; }
@@ -140,9 +140,9 @@ private:
UINT16 mask() const { return m_mask; }
private:
- UINT16 m_word; // word index
- UINT16 m_shift; // shift amount
- UINT16 m_mask; // final mask
+ UINT16 m_word; // word index
+ UINT16 m_shift; // shift amount
+ UINT16 m_mask; // final mask
};
// internal structure describing each object in the ROMs
@@ -156,7 +156,7 @@ private:
const UINT16 * table;
const UINT16 * data;
};
-
+
// internal helpers
inline int round_to_powerof2(int value);
void build_rle_tables();
@@ -177,36 +177,36 @@ private:
rectangle m_cliprect; // clipping rectangle
// masks
- sprite_parameter m_codemask; // mask for the code index
- sprite_parameter m_colormask; // mask for the color
- sprite_parameter m_xposmask; // mask for the X position
- sprite_parameter m_yposmask; // mask for the Y position
- sprite_parameter m_scalemask; // mask for the scale factor
- sprite_parameter m_hflipmask; // mask for the horizontal flip
- sprite_parameter m_ordermask; // mask for the order
- sprite_parameter m_prioritymask; // mask for the priority
- sprite_parameter m_vrammask; // mask for the VRAM target
+ sprite_parameter m_codemask; // mask for the code index
+ sprite_parameter m_colormask; // mask for the color
+ sprite_parameter m_xposmask; // mask for the X position
+ sprite_parameter m_yposmask; // mask for the Y position
+ sprite_parameter m_scalemask; // mask for the scale factor
+ sprite_parameter m_hflipmask; // mask for the horizontal flip
+ sprite_parameter m_ordermask; // mask for the order
+ sprite_parameter m_prioritymask; // mask for the priority
+ sprite_parameter m_vrammask; // mask for the VRAM target
// ROM information
- const UINT16 * m_rombase; // pointer to the base of the GFX ROM
- int m_romlength; // length of the GFX ROM
- int m_objectcount; // number of objects in the ROM
+ const UINT16 * m_rombase; // pointer to the base of the GFX ROM
+ int m_romlength; // length of the GFX ROM
+ int m_objectcount; // number of objects in the ROM
dynamic_array<object_info> m_info; // list of info records
// rendering state
- bitmap_ind16 m_vram[2][2]; // pointers to VRAM bitmaps and backbuffers
- int m_partial_scanline; // partial update scanline
+ bitmap_ind16 m_vram[2][2]; // pointers to VRAM bitmaps and backbuffers
+ int m_partial_scanline; // partial update scanline
// control state
- UINT8 m_control_bits; // current control bits
- UINT8 m_command; // current command
- UINT16 m_checksums[256]; // checksums for each 0x40000 bytes
- memory_array m_ram;
+ UINT8 m_control_bits; // current control bits
+ UINT8 m_command; // current command
+ UINT16 m_checksums[256]; // checksums for each 0x40000 bytes
+ memory_array m_ram;
// tables
- UINT8 m_rle_bpp[8];
- UINT16 * m_rle_table[8];
- UINT16 m_rle_table_data[0x500];
+ UINT8 m_rle_bpp[8];
+ UINT16 * m_rle_table[8];
+ UINT16 m_rle_table_data[0x500];
};
diff --git a/src/mame/video/bfm_adr2.c b/src/mame/video/bfm_adr2.c
index 9afa31c96c0..10f55fefe14 100644
--- a/src/mame/video/bfm_adr2.c
+++ b/src/mame/video/bfm_adr2.c
@@ -117,7 +117,7 @@ const device_type BFM_ADDER2 = &device_creator<bfm_adder2_device>;
bfm_adder2_device::bfm_adder2_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
: device_t(mconfig, BFM_ADDER2, "BFM ADDER2", tag, owner, clock, "bfm_adder2", __FILE__),
- m_cpu(*this, "adder2")
+ m_cpu(*this, "adder2")
{
}
@@ -192,7 +192,7 @@ void bfm_adder2_device::device_reset()
void bfm_adder2_device::device_start()
{
adder2_decode_char_roms();
-
+
save_item(NAME(m_adder2_screen_page_reg));
save_item(NAME(m_adder2_c101));
save_item(NAME(m_adder2_rx));
@@ -208,7 +208,7 @@ void bfm_adder2_device::device_start()
m_tilemap0 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(bfm_adder2_device::get_tile0_info),this), TILEMAP_SCAN_ROWS, 8, 8, 50, 35);
m_tilemap1 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(bfm_adder2_device::get_tile1_info),this), TILEMAP_SCAN_ROWS, 8, 8, 50, 35);
-
+
palette_set_color(machine(), 0,MAKE_RGB(0x00,0x00,0x00));
palette_set_color(machine(), 1,MAKE_RGB(0x00,0x00,0xFF));
palette_set_color(machine(), 2,MAKE_RGB(0x00,0xFF,0x00));
@@ -224,13 +224,12 @@ void bfm_adder2_device::device_start()
palette_set_color(machine(),12,MAKE_RGB(0x80,0x00,0x00));
palette_set_color(machine(),13,MAKE_RGB(0x80,0x00,0x80));
palette_set_color(machine(),14,MAKE_RGB(0x80,0x80,0x00));
- palette_set_color(machine(),15,MAKE_RGB(0x80,0x80,0x80));
+ palette_set_color(machine(),15,MAKE_RGB(0x80,0x80,0x80));
}
// video update ///////////////////////////////////////////////////////////
UINT32 bfm_adder2_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
-
const rectangle visible1(0, 400-1, 0, 280-1); //minx,maxx, miny,maxy
if (m_adder2_screen_page_reg & SL_DISPLAY) m_tilemap1->draw(screen, bitmap, visible1, 0, 0);
@@ -409,7 +408,7 @@ WRITE8_MEMBER(bfm_adder2_device::vid_uart_tx_w)
m_adder2_sc2data = data; // store data
m_adder2_acia_triggered = 1; // set flag, acia IRQ triggered
-
+
m_cpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE );
//LOG_SERIAL(("sadder %02X (%c)\n",data, data ));
@@ -564,4 +563,3 @@ machine_config_constructor bfm_adder2_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( adder2 );
}
-
diff --git a/src/mame/video/bfm_adr2.h b/src/mame/video/bfm_adr2.h
index 2bf26c2dab1..1818ddbc1d2 100644
--- a/src/mame/video/bfm_adr2.h
+++ b/src/mame/video/bfm_adr2.h
@@ -25,39 +25,39 @@ public:
DECLARE_READ8_MEMBER( adder2_uart_rx_r );
DECLARE_WRITE8_MEMBER( adder2_uart_tx_w );
DECLARE_READ8_MEMBER( adder2_irq_r );
-
+
DECLARE_WRITE8_MEMBER(vid_uart_tx_w);
DECLARE_WRITE8_MEMBER(vid_uart_ctrl_w);
DECLARE_READ8_MEMBER(vid_uart_rx_r);
DECLARE_READ8_MEMBER(vid_uart_ctrl_r);
-
+
void adder2_decode_char_roms();
-
+
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual machine_config_constructor device_mconfig_additions() const;
private:
-
+
int m_adder2_screen_page_reg; // access/display select
int m_adder2_c101;
int m_adder2_rx;
int m_adder_vbl_triggered; // flag <>0, VBL IRQ triggered
int m_adder2_acia_triggered; // flag <>0, ACIA receive IRQ
-
+
UINT8 m_adder_ram[0xE80]; // normal RAM
UINT8 m_adder_screen_ram[2][0x1180]; // paged display RAM
-
+
tilemap_t *m_tilemap0; // tilemap screen0
tilemap_t *m_tilemap1; // timemap screen1
-
+
UINT8 m_adder2_data_from_sc2;
UINT8 m_adder2_data_to_sc2;
-
+
UINT8 m_adder2_data;
- UINT8 m_adder2_sc2data;
-
+ UINT8 m_adder2_sc2data;
+
optional_device<cpu_device> m_cpu;
};
diff --git a/src/mame/video/bfm_dm01.c b/src/mame/video/bfm_dm01.c
index b70e1448dfc..5cdc72d1c63 100644
--- a/src/mame/video/bfm_dm01.c
+++ b/src/mame/video/bfm_dm01.c
@@ -63,7 +63,7 @@ bfmdm01_device::bfmdm01_device(const machine_config &mconfig, const char *tag, d
{
for (int i = 0; i < 65; i++)
m_segbuffer[i] = 0;
-
+
for (int i = 0; i < DM_BYTESPERROW; i++)
m_scanline[i] = 0;
}
@@ -98,10 +98,10 @@ void bfmdm01_device::device_start()
save_item(NAME(m_xcounter));
save_item(NAME(m_busy));
save_item(NAME(m_comdata));
-
+
for (int i = 0; i < 65; i++)
save_item(NAME(m_segbuffer), i);
-
+
for (int i = 0; i < DM_BYTESPERROW; i++)
save_item(NAME(m_scanline), i);
}
diff --git a/src/mame/video/bfm_dm01.h b/src/mame/video/bfm_dm01.h
index f2de6166424..dd461b10c3a 100644
--- a/src/mame/video/bfm_dm01.h
+++ b/src/mame/video/bfm_dm01.h
@@ -28,7 +28,7 @@ public:
DECLARE_WRITE8_MEMBER( comm_w );
DECLARE_READ8_MEMBER( unknown_r );
DECLARE_WRITE8_MEMBER( unknown_w );
-
+
void writedata(UINT8 data);
int busy(void);
@@ -38,7 +38,7 @@ protected:
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
int m_data_avail;
@@ -49,9 +49,9 @@ private:
UINT8 m_scanline[DM_BYTESPERROW];
UINT8 m_comdata;
-
+
int read_data(void);
-
+
};
extern const device_type BF_DM01;
diff --git a/src/mame/video/cave.c b/src/mame/video/cave.c
index 4a70768d5e4..3a8e555645f 100644
--- a/src/mame/video/cave.c
+++ b/src/mame/video/cave.c
@@ -425,7 +425,7 @@ void cave_state::cave_vh_start( int num )
m_row_effect_offs_n = -1;
m_row_effect_offs_f = 1;
- m_background_pen = machine().config().m_gfxdecodeinfo[0].color_codes_start +
+ m_background_pen = machine().config().m_gfxdecodeinfo[0].color_codes_start +
(machine().config().m_gfxdecodeinfo[0].total_color_codes - 1) *
machine().gfx[0]->granularity();
@@ -1666,12 +1666,12 @@ PALETTE_INIT_MEMBER(cave_state,ppsatan)
for (int chip = 0; chip < 3; chip++)
{
- // Sprites: 0x987800 - 0x988fff
+ // Sprites: 0x987800 - 0x988fff
for (color = 0; color < 0x40; color++)
for (pen = 0; pen < 0x10; pen++)
m_palette_map[chip][(color << 8) | pen] = 0x7800/2 + ((color << 4) | pen);
- // Tiles: 0x980000 - 0x9803ff
+ // Tiles: 0x980000 - 0x9803ff
for (color = 0; color < 0x40; color++)
for (pen = 0; pen < 0x10; pen++)
m_palette_map[chip][0x4000 + ((color << 4) | pen)] = ((color << 4) | pen);
diff --git a/src/mame/video/ddragon3.c b/src/mame/video/ddragon3.c
index a098ecd9be1..0ecea2ad59e 100644
--- a/src/mame/video/ddragon3.c
+++ b/src/mame/video/ddragon3.c
@@ -68,8 +68,6 @@ WRITE16_MEMBER(ddragon3_state::ddragon3_bg_videoram_w)
TILE_GET_INFO_MEMBER(ddragon3_state::get_fg_tile_info)
{
-
-
UINT16 *tilebase;
int tileno,colbank;
@@ -332,4 +330,3 @@ UINT32 wwfwfest_state::screen_update_wwfwfest(screen_device &screen, bitmap_ind1
return 0;
}
-
diff --git a/src/mame/video/deco16ic.c b/src/mame/video/deco16ic.c
index f29a72e2b9e..2dd967249ce 100644
--- a/src/mame/video/deco16ic.c
+++ b/src/mame/video/deco16ic.c
@@ -421,7 +421,7 @@ TILE_GET_INFO_MEMBER(deco16ic_device::get_pf1_tile_info_b)
template<class _BitmapClass>
void deco16ic_device::custom_tilemap_draw(
- screen_device &screen,
+ screen_device &screen,
_BitmapClass &bitmap,
const rectangle &cliprect,
tilemap_t *tilemap0_8x8,
diff --git a/src/mame/video/deco16ic.h b/src/mame/video/deco16ic.h
index 8a2b8e633d0..972aaea916d 100644
--- a/src/mame/video/deco16ic.h
+++ b/src/mame/video/deco16ic.h
@@ -92,7 +92,7 @@ public:
template<class _BitmapClass>
void custom_tilemap_draw(
- screen_device &screen,
+ screen_device &screen,
_BitmapClass &bitmap,
const rectangle &cliprect,
tilemap_t *tilemap0_8x8,
diff --git a/src/mame/video/gticlub.c b/src/mame/video/gticlub.c
index 34859698516..a2e84d369ec 100644
--- a/src/mame/video/gticlub.c
+++ b/src/mame/video/gticlub.c
@@ -1591,5 +1591,3 @@ static int tick = 0;
static int debug_tex_page = 0;
static int debug_tex_palette = 0;
*/
-
-
diff --git a/src/mame/video/k001005.c b/src/mame/video/k001005.c
index 916479f3a88..b13f541897d 100644
--- a/src/mame/video/k001005.c
+++ b/src/mame/video/k001005.c
@@ -74,7 +74,7 @@ void k001005_device::device_config_complete()
const k001005_interface *intf = reinterpret_cast<const k001005_interface *>(static_config());
if (intf != NULL)
*static_cast<k001005_interface *>(this) = *intf;
-
+
// or initialize to defaults if none provided
else
{
@@ -163,7 +163,7 @@ void k001005_device::device_reset()
m_bitmap_page = 0;
memset(m_prev_v, 0, sizeof(m_prev_v));
- m_prev_poly_type = 0;
+ m_prev_poly_type = 0;
}
//-------------------------------------------------
diff --git a/src/mame/video/k001005.h b/src/mame/video/k001005.h
index 413764fee66..71c7c1dfa57 100644
--- a/src/mame/video/k001005.h
+++ b/src/mame/video/k001005.h
@@ -31,13 +31,13 @@ public:
void swap_buffers();
void preprocess_texture_data(UINT8 *rom, int length, int gticlub);
void render_polygons();
-
+
#if POLY_DEVICE
-
+
void draw_scanline( void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid );
void draw_scanline_tex( void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid );
-
-
+
+
#endif
DECLARE_READ32_MEMBER( read );
diff --git a/src/mame/video/k037122.h b/src/mame/video/k037122.h
index 5be964bf79c..056c65e69e3 100644
--- a/src/mame/video/k037122.h
+++ b/src/mame/video/k037122.h
@@ -8,7 +8,7 @@ class k037122_device : public device_t,
public:
k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k037122_device() {}
-
+
static void static_set_gfx_index(device_t &device, int index) { downcast<k037122_device &>(device).m_gfx_index = index; }
void tile_draw( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/video/kaneko_spr.c b/src/mame/video/kaneko_spr.c
index 9d99192232f..06307645beb 100644
--- a/src/mame/video/kaneko_spr.c
+++ b/src/mame/video/kaneko_spr.c
@@ -31,7 +31,7 @@ const device_type KANEKO_KC002_SPRITE = &device_creator<kaneko_kc002_sprite_devi
kaneko16_sprite_device::kaneko16_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, device_type type)
: device_t(mconfig, type, "kaneko16_sprite_device", tag, owner, clock, "kaneko16_sprite", __FILE__),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this)
{
m_keep_sprites = 0; // default disabled for games not using it
diff --git a/src/mame/video/mcd212.c b/src/mame/video/mcd212.c
index 225f0ea3002..424e669f687 100644
--- a/src/mame/video/mcd212.c
+++ b/src/mame/video/mcd212.c
@@ -1510,7 +1510,7 @@ void mcd212_device::device_reset()
mcd212_device::mcd212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MACHINE_MCD212, "MCD212", tag, owner, clock, "mcd212", __FILE__),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this)
{
}
diff --git a/src/mame/video/namcos2.c b/src/mame/video/namcos2.c
index 6d3e36c31b6..199afb13115 100644
--- a/src/mame/video/namcos2.c
+++ b/src/mame/video/namcos2.c
@@ -113,7 +113,7 @@ DrawRozHelperBlock(const struct RozParam *rozInfo, int destx, int desty,
static void
DrawRozHelper(
- screen_device &screen,
+ screen_device &screen,
bitmap_ind16 &bitmap,
tilemap_t *tmap,
const rectangle &clip,
@@ -226,7 +226,7 @@ DrawRozHelper(
}
else
{
- tmap->draw_roz(screen,
+ tmap->draw_roz(screen,
bitmap, clip,
rozInfo->startx, rozInfo->starty,
rozInfo->incxx, rozInfo->incxy,
diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c
index a223682062c..8115a6aa3c5 100644
--- a/src/mame/video/namcos22.c
+++ b/src/mame/video/namcos22.c
@@ -270,12 +270,12 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit
vertex_t clipv[6];
int clipverts;
int vertnum;
-
+
int direct = node->data.quad.direct;
int flags = node->data.quad.flags;
int color = node->data.quad.color;
int cz_adjust = node->data.quad.cz_adjust;
-
+
extra.destbase = &bitmap;
extra.pfade_enabled = 0;
extra.zfog_enabled = 0;
@@ -640,7 +640,7 @@ struct namcos22_scenenode *namcos22_renderer::new_scenenode(running_machine &mac
struct namcos22_scenenode *node = &m_scenenode_root;
struct namcos22_scenenode *prev = NULL;
int hash = 0;
-
+
for (int i = 0; i < 24; i += NAMCOS22_RADIX_BITS)
{
hash = (zsort >> 20) & NAMCOS22_RADIX_MASK;
@@ -751,7 +751,7 @@ float namcos22_state::dspfloat_to_nativefloat(UINT32 val)
void namcos22_state::matrix3d_multiply(float a[4][4], float b[4][4])
{
float temp[4][4];
-
+
for (int row = 0; row < 4; row++)
{
for (int col = 0; col < 4; col++)
@@ -764,7 +764,7 @@ void namcos22_state::matrix3d_multiply(float a[4][4], float b[4][4])
temp[row][col] = sum;
}
}
-
+
memcpy(a, temp, sizeof(temp));
}
@@ -784,7 +784,7 @@ void namcos22_state::transform_point(float *vx, float *vy, float *vz, float m[4]
float x = *vx;
float y = *vy;
float z = *vz;
-
+
*vx = m[0][0]*x + m[1][0]*y + m[2][0]*z + m[3][0];
*vy = m[0][1]*x + m[1][1]*y + m[2][1]*z + m[3][1];
*vz = m[0][2]*x + m[1][2]*y + m[2][2]*z + m[3][2];
@@ -795,7 +795,7 @@ void namcos22_state::transform_normal(float *nx, float *ny, float *nz, float m[4
float x = *nx;
float y = *ny;
float z = *nz;
-
+
*nx = m[0][0]*x + m[1][0]*y + m[2][0]*z;
*ny = m[0][1]*x + m[1][1]*y + m[2][1]*z;
*nz = m[0][2]*x + m[1][2]*y + m[2][2]*z;
@@ -2291,7 +2291,7 @@ UINT32 namcos22_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb
if (layer & 1) draw_polygons(bitmap);
m_poly->render_scene(screen, bitmap);
if (layer & 4) namcos22s_mix_text_layer(screen, bitmap, cliprect, 6);
-
+
// apply gamma
const UINT8 *rlut = (const UINT8 *)&m_mixer[0x100/4];
const UINT8 *glut = (const UINT8 *)&m_mixer[0x200/4];
@@ -2317,15 +2317,15 @@ UINT32 namcos22_state::screen_update_namcos22(screen_device &screen, bitmap_rgb3
update_mixer();
update_palette();
screen.priority().fill(0, cliprect);
-
+
// background color
bitmap.fill(screen.machine().pens[0x7fff], cliprect);
-
+
// layers
draw_polygons(bitmap);
m_poly->render_scene(screen, bitmap);
draw_text_layer(screen, bitmap, cliprect);
-
+
// apply gamma
const UINT8 *rlut = (const UINT8 *)m_gamma_proms->base();
const UINT8 *glut = (const UINT8 *)m_gamma_proms->base() + 0x100;
@@ -2383,7 +2383,7 @@ void namcos22_state::init_tables()
{
m_pointrom[i] = signed24(pointrom_high[i] << 16 | pointrom_mid[i] << 8 | pointrom_low[i]);
}
-
+
m_pointram = auto_alloc_array_clear(machine(), UINT32, 0x20000);
// textures
@@ -2393,7 +2393,7 @@ void namcos22_state::init_tables()
m_texture_tilemap = (UINT16 *)memregion("textilemap")->base();
m_texture_tiledata = (UINT8 *)machine().gfx[1]->get_data(0);
m_texture_tileattr = auto_alloc_array(machine(), UINT8, 0x080000*2);
-
+
// unpack textures
UINT8 *packed_tileattr = 0x200000 + (UINT8 *)memregion("textilemap")->base();
UINT8 *unpacked_tileattr = m_texture_tileattr;
@@ -2403,7 +2403,7 @@ void namcos22_state::init_tables()
*unpacked_tileattr++ = (*packed_tileattr) & 0xf;
packed_tileattr++;
}
-
+
// make attr/y/x lookup table
m_texture_ayx_to_pixel = auto_alloc_array(machine(), UINT8, 16*16*16);
for (int attr = 0; attr < 16; attr++)
@@ -2431,7 +2431,7 @@ void namcos22_state::init_tables()
}
}
}
-
+
// following setup is Namco System 22 specific
switch (m_gametype)
{
@@ -2475,7 +2475,7 @@ VIDEO_START_MEMBER(namcos22_state,common)
VIDEO_START_MEMBER(namcos22_state,namcos22)
{
m_is_ss22 = 0;
-
+
VIDEO_START_CALL_MEMBER(common);
}
diff --git a/src/mame/video/powervr2.c b/src/mame/video/powervr2.c
index 73e5920d964..f9d627665b6 100644
--- a/src/mame/video/powervr2.c
+++ b/src/mame/video/powervr2.c
@@ -614,7 +614,7 @@ void powervr2_device::tex_get_info(texinfo *t)
t->textured = texture;
// not textured, abort.
-// if (!t->textured) return;
+// if (!t->textured) return;
t->address = textureaddress;
t->pf = pixelformat;
@@ -664,7 +664,7 @@ void powervr2_device::tex_get_info(texinfo *t)
t->vqbase = t->address;
t->blend = use_alpha ? blend_functions[t->blend_mode] : bl10;
-// fprintf(stderr, "tex %d %d %d %d\n", t->pf, t->mode, pal_ram_ctrl, t->mipmapped);
+// fprintf(stderr, "tex %d %d %d %d\n", t->pf, t->mode, pal_ram_ctrl, t->mipmapped);
if(!t->textured)
{
t->coltype = coltype;
@@ -1002,9 +1002,9 @@ WRITE32_MEMBER( powervr2_device::startrender_w )
sanitycount++;
// prevent infinite loop if asked to process invalid data
//if(sanitycount>2000)
- // break;
+ // break;
}
-// printf("ISP START %d %d\n",sanitycount,m_screen->vpos());
+// printf("ISP START %d %d\n",sanitycount,m_screen->vpos());
/* Fire ISP irq after a set amount of time TODO: timing of this */
endofrender_timer_isp->adjust(state->m_maincpu->cycles_to_attotime(sanitycount*25));
break;
@@ -1184,11 +1184,11 @@ WRITE32_MEMBER( powervr2_device::spg_vblank_int_w )
COMBINE_DATA(&spg_vblank_int);
/* clear pending irqs and modify them with the updated ones */
-// vbin_timer->adjust(attotime::never);
-// vbout_timer->adjust(attotime::never);
+// vbin_timer->adjust(attotime::never);
+// vbout_timer->adjust(attotime::never);
-// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
-// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
+// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
+// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
}
READ32_MEMBER( powervr2_device::spg_control_r )
@@ -1316,7 +1316,7 @@ READ32_MEMBER( powervr2_device::spg_status_r )
UINT32 hsync = ((m_screen->hpos() >= spg_hbstart) || (m_screen->hpos() < spg_hbend)) ? 0 : 1;
/* FIXME: following is just a wild guess */
UINT32 blank = ((m_screen->vpos() >= spg_vbstart) || (m_screen->vpos() < spg_vbend) |
- (m_screen->hpos() >= spg_hbstart) || (m_screen->hpos() < spg_hbend)) ? 0 : 1;
+ (m_screen->hpos() >= spg_hbstart) || (m_screen->hpos() < spg_hbend)) ? 0 : 1;
if(vo_control & 4) { blank^=1; }
if(vo_control & 2) { vsync^=1; }
if(vo_control & 1) { hsync^=1; }
@@ -1656,35 +1656,35 @@ WRITE32_MEMBER( powervr2_device::sb_pdapro_w )
TIMER_CALLBACK_MEMBER(powervr2_device::transfer_opaque_list_irq)
{
-// printf("OPLST %d\n",m_screen->vpos());
+// printf("OPLST %d\n",m_screen->vpos());
irq_cb(EOXFER_OPLST_IRQ);
}
TIMER_CALLBACK_MEMBER(powervr2_device::transfer_opaque_modifier_volume_list_irq)
{
-// printf("OPMV %d\n",m_screen->vpos());
+// printf("OPMV %d\n",m_screen->vpos());
irq_cb(EOXFER_OPMV_IRQ);
}
TIMER_CALLBACK_MEMBER(powervr2_device::transfer_translucent_list_irq)
{
-// printf("TRLST %d\n",m_screen->vpos());
+// printf("TRLST %d\n",m_screen->vpos());
irq_cb(EOXFER_TRLST_IRQ);
}
TIMER_CALLBACK_MEMBER(powervr2_device::transfer_translucent_modifier_volume_list_irq)
{
-// printf("TRMV %d\n",m_screen->vpos());
+// printf("TRMV %d\n",m_screen->vpos());
irq_cb(EOXFER_TRMV_IRQ);
}
TIMER_CALLBACK_MEMBER(powervr2_device::transfer_punch_through_list_irq)
{
-// printf("PTLST %d\n",m_screen->vpos());
+// printf("PTLST %d\n",m_screen->vpos());
irq_cb(EOXFER_PTLST_IRQ);
}
@@ -2164,7 +2164,7 @@ void powervr2_device::render_hline(bitmap_rgb32 &bitmap, texinfo *ti, int y, flo
float *wbufline;
// untextured cases aren't handled
-// if (!ti->textured) return;
+// if (!ti->textured) return;
if(xr < 0 || xl >= 640)
return;
@@ -2908,7 +2908,7 @@ void powervr2_device::pvr_accumulationbuffer_to_framebuffer(address_space &space
UINT8 packmode = fb_w_ctrl & 0x7;
UINT8 unpackmode = (fb_r_ctrl & 0x0000000c) >>2; // aka fb_depth
-// popmessage("%02x %02x",packmode,unpackmode);
+// popmessage("%02x %02x",packmode,unpackmode);
switch (packmode)
{
@@ -3003,7 +3003,7 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle &
//INT32 ystart_f2 = (vo_starty >> 16) & 0x3ff;
INT32 hstart = (vo_startx & 0x3ff);
int res_x,res_y;
-// rectangle fbclip;
+// rectangle fbclip;
UINT8 unpackmode = (fb_r_ctrl & 0x0000000c) >>2; // aka fb_depth
UINT8 enable = (fb_r_ctrl & 0x00000001);
@@ -3018,7 +3018,7 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle &
dy++;
dy*=2; // probably depends on interlace mode, fields etc...
-// popmessage("%d %d %d %d %d",ystart_f1,ystart_f2,interlace_on,spg_vblank & 0x3ff,(spg_vblank >> 16) & 0x3ff);
+// popmessage("%d %d %d %d %d",ystart_f1,ystart_f2,interlace_on,spg_vblank & 0x3ff,(spg_vblank >> 16) & 0x3ff);
#if 0
fbclip.min_x = hstart;
@@ -3345,14 +3345,14 @@ TIMER_CALLBACK_MEMBER(powervr2_device::vbin)
irq_cb(VBL_IN_IRQ);
//popmessage("VII %d VOI %d VI %d VO %d VS %d",spg_vblank_int & 0x3ff,(spg_vblank_int >> 16) & 0x3ff,spg_vblank & 0x3ff,(spg_vblank >> 16) & 0x3ff,(spg_load >> 16) & 0x3ff);
-// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
+// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
}
TIMER_CALLBACK_MEMBER(powervr2_device::vbout)
{
irq_cb(VBL_OUT_IRQ);
-// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
+// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
}
TIMER_CALLBACK_MEMBER(powervr2_device::hbin)
@@ -3388,15 +3388,15 @@ TIMER_CALLBACK_MEMBER(powervr2_device::hbin)
TIMER_CALLBACK_MEMBER(powervr2_device::endofrender_video)
{
printf("VIDEO END %d\n",m_screen->vpos());
-// endofrender_timer_video->adjust(attotime::never);
+// endofrender_timer_video->adjust(attotime::never);
}
TIMER_CALLBACK_MEMBER(powervr2_device::endofrender_tsp)
{
printf("TSP END %d\n",m_screen->vpos());
-// endofrender_timer_tsp->adjust(attotime::never);
-// endofrender_timer_video->adjust(attotime::from_usec(500) );
+// endofrender_timer_tsp->adjust(attotime::never);
+// endofrender_timer_video->adjust(attotime::from_usec(500) );
}
TIMER_CALLBACK_MEMBER(powervr2_device::endofrender_isp)
@@ -3405,10 +3405,10 @@ TIMER_CALLBACK_MEMBER(powervr2_device::endofrender_isp)
irq_cb(EOR_TSP_IRQ); // TSP end of render
irq_cb(EOR_VIDEO_IRQ); // VIDEO end of render
-// printf("ISP END %d\n",m_screen->vpos());
+// printf("ISP END %d\n",m_screen->vpos());
endofrender_timer_isp->adjust(attotime::never);
-// endofrender_timer_tsp->adjust(attotime::from_usec(500) );
+// endofrender_timer_tsp->adjust(attotime::from_usec(500) );
}
UINT32 powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -3605,8 +3605,8 @@ void powervr2_device::device_start()
computedilated();
-// vbout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbout),this));
-// vbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbin),this));
+// vbout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbout),this));
+// vbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbin),this));
hbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::hbin),this));
yuv_timer_end = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::yuv_convert_end),this));
@@ -3749,8 +3749,8 @@ void powervr2_device::device_reset()
renderselect= -1;
grabsel=0;
-// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
-// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
+// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
+// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
hbin_timer->adjust(m_screen->time_until_pos(0, ((spg_hblank_int >> 16) & 0x3ff)-1));
scanline = 0;
@@ -3786,4 +3786,3 @@ void powervr2_device::pvr_scanline_timer(int vpos)
if(vbout_line == vpos)
irq_cb(VBL_OUT_IRQ);
}
-
diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h
index e77df348f87..bc8b0e2ae14 100644
--- a/src/mame/video/powervr2.h
+++ b/src/mame/video/powervr2.h
@@ -394,7 +394,7 @@ private:
static inline UINT32 cv_yuv(UINT16 c1, UINT16 c2, int x);
UINT32 tex_r_yuv_n(texinfo *t, float x, float y);
UINT32 tex_r_yuv_tw(texinfo *t, float x, float y);
-// UINT32 tex_r_yuv_vq(texinfo *t, float x, float y);
+// UINT32 tex_r_yuv_vq(texinfo *t, float x, float y);
UINT32 tex_r_1555_n(texinfo *t, float x, float y);
UINT32 tex_r_1555_tw(texinfo *t, float x, float y);
UINT32 tex_r_1555_vq(texinfo *t, float x, float y);
diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c
index 302e9ac0a49..6061c2e1b98 100644
--- a/src/mame/video/segaic16.c
+++ b/src/mame/video/segaic16.c
@@ -373,7 +373,7 @@ const device_type SEGAIC16VID = &device_creator<segaic16_video_device>;
segaic16_video_device::segaic16_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SEGAIC16VID, "Sega 16-bit Video", tag, owner, clock, "segaic16_video", __FILE__),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this)
{
}
diff --git a/src/mame/video/segaic16.h b/src/mame/video/segaic16.h
index 591a6577f37..723a214b984 100644
--- a/src/mame/video/segaic16.h
+++ b/src/mame/video/segaic16.h
@@ -89,7 +89,7 @@ struct rotate_info
-class segaic16_video_device : public device_t,
+class segaic16_video_device : public device_t,
public device_video_interface
{
public:
diff --git a/src/mame/video/snes.c b/src/mame/video/snes.c
index b074ee098da..9fd23a55a20 100644
--- a/src/mame/video/snes.c
+++ b/src/mame/video/snes.c
@@ -1647,7 +1647,7 @@ void snes_ppu_class::ppu_start(screen_device &screen)
{
m_screen = &screen;
running_machine &machine = screen.machine();
-
+
#if SNES_LAYER_DEBUG
memset(&debug_options, 0, sizeof(debug_options));
#endif
diff --git a/src/mame/video/tia.c b/src/mame/video/tia.c
index 75fc78bb86e..beb366bc429 100644
--- a/src/mame/video/tia.c
+++ b/src/mame/video/tia.c
@@ -164,7 +164,7 @@ PALETTE_INIT_MEMBER(tia_pal_video_device, tia_pal)
tia_video_device::tia_video_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this)
{
}
diff --git a/src/mame/video/tia.h b/src/mame/video/tia.h
index 8b86f09bbd6..9b8b10b0db3 100644
--- a/src/mame/video/tia.h
+++ b/src/mame/video/tia.h
@@ -31,7 +31,7 @@ struct player_gfx {
#define MCFG_TIA_PAL_VIDEO_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, TIA_PAL_VIDEO, 0) \
MCFG_DEVICE_CONFIG(_config)
-
+
#define MCFG_TIA_NTSC_VIDEO_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, TIA_NTSC_VIDEO, 0) \
MCFG_DEVICE_CONFIG(_config)
@@ -61,7 +61,7 @@ public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
-
+
protected:
// construction/destruction
tia_video_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, UINT32 clock);
@@ -211,9 +211,9 @@ class tia_pal_video_device : public tia_video_device
{
public:
tia_pal_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
DECLARE_PALETTE_INIT(tia_pal);
-
+
protected:
virtual machine_config_constructor device_mconfig_additions() const;
};
@@ -222,9 +222,9 @@ class tia_ntsc_video_device : public tia_video_device
{
public:
tia_ntsc_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
DECLARE_PALETTE_INIT(tia_ntsc);
-
+
protected:
virtual machine_config_constructor device_mconfig_additions() const;
};
diff --git a/src/mame/video/toobin.c b/src/mame/video/toobin.c
index 1ff31180eeb..9bb3ecfab89 100644
--- a/src/mame/video/toobin.c
+++ b/src/mame/video/toobin.c
@@ -78,7 +78,6 @@ const atari_motion_objects_config toobin_state::s_mob_config =
VIDEO_START_MEMBER(toobin_state,toobin)
{
-
/* allocate a playfield bitmap for rendering */
m_screen->register_screen_bitmap(m_pfbitmap);
diff --git a/src/mame/video/vrender0.c b/src/mame/video/vrender0.c
index 39d05dd465d..42346da5df2 100644
--- a/src/mame/video/vrender0.c
+++ b/src/mame/video/vrender0.c
@@ -124,7 +124,7 @@ struct QuadInfo
UINT8 DstAlpha;
UINT32 DstColor;
};
-
+
/*
Pick a rare enough color to disable transparency (that way I save a cmp per loop to check
if I must draw transparent or not. The palette build will take this color in account so
diff --git a/src/mame/video/vrender0.h b/src/mame/video/vrender0.h
index fe9f9109c04..8ba945d16c5 100644
--- a/src/mame/video/vrender0.h
+++ b/src/mame/video/vrender0.h
@@ -44,7 +44,7 @@ public:
~vr0video_device() {}
int vrender0_ProcessPacket(UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE);
-
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -59,7 +59,7 @@ private:
UINT32 m_LastPalUpdate;
RenderStateInfo m_RenderState;
-
+
UINT16 Alpha(UINT16 Src, UINT16 Dst);
};
diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c
index 8efaaf85732..1e3ada36536 100644
--- a/src/mame/video/ygv608.c
+++ b/src/mame/video/ygv608.c
@@ -105,7 +105,7 @@ TILEMAP_MAPPER_MEMBER( ygv608_device::get_tile_offset )
(machine().config().m_gfxdecodeinfo[x].gfxlayout->total)
TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_A_8 )
-{
+{
// extract row,col packed into tile_index
int col = tile_index >> 6;
int row = tile_index & 0x3f;
@@ -502,7 +502,7 @@ void ygv608_device::device_start()
memset(&m_regs, 0, sizeof(m_regs));
memset(&m_pattern_name_table, 0, sizeof(m_pattern_name_table));
memset(&m_sprite_attribute_table, 0, sizeof(m_sprite_attribute_table));
-
+
memset(&m_scroll_data_table, 0, sizeof(m_scroll_data_table));
memset(&m_colour_palette, 0, sizeof(m_colour_palette));
@@ -512,7 +512,7 @@ void ygv608_device::device_start()
m_pny_shift = 0;
m_na8_mask = 0;
m_col_shift = 0;
-
+
m_ax = 0; m_dx = 0; m_dxy = 0; m_ay = 0; m_dy = 0; m_dyx = 0;
memset(&m_base_addr, 0, sizeof(m_base_addr));
@@ -526,7 +526,7 @@ void ygv608_device::device_start()
m_namcond1_gfxbank = 0;
save_item(NAME(m_namcond1_gfxbank));
- /* create tilemaps of all sizes and combinations */
+ /* create tilemaps of all sizes and combinations */
m_tilemap_A_cache_8[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,32);
m_tilemap_A_cache_8[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 64,32);
m_tilemap_A_cache_8[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,64);
diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h
index 25ce8a96b79..72ecae06e02 100644
--- a/src/mame/video/ygv608.h
+++ b/src/mame/video/ygv608.h
@@ -288,16 +288,16 @@ public:
DECLARE_WRITE16_MEMBER( write );
DECLARE_READ16_MEMBER( read );
-
+
void set_gfxbank(UINT8 gfxbank);
-
+
UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
+
INTERRUPT_GEN_MEMBER( timed_interrupt );
-
+
// to be removed
- DECLARE_READ16_MEMBER( debug_trigger_r );
+ DECLARE_READ16_MEMBER( debug_trigger_r );
protected:
// device-level overrides
virtual void device_start();
@@ -326,7 +326,7 @@ private:
void SetPreShortcuts(int reg, int data );
void SetPostShortcuts(int reg);
void ShowYGV608Registers();
-
+
union {
UINT8 b[8];
YGV_PORTS s;
@@ -369,7 +369,7 @@ private:
UINT32 m_base_y_shift; // for extracting pattern y coord 'base'
UINT8 m_screen_resize; // screen requires resize
- UINT8 m_tilemap_resize; // tilemap requires resize
+ UINT8 m_tilemap_resize; // tilemap requires resize
};
// device type definition
diff --git a/src/mess/drivers/a7800.c b/src/mess/drivers/a7800.c
index db7363abe92..0156f5ab7ae 100644
--- a/src/mess/drivers/a7800.c
+++ b/src/mess/drivers/a7800.c
@@ -49,13 +49,13 @@
2013/08/04 Robert Tuccitto Green miscalculated proportions fixed.
- 2013/08/13 Robert Tuccitto Normalized contrast and brightness,
+ 2013/08/13 Robert Tuccitto Normalized contrast and brightness,
providing a standardize grayscale and adjusted color values.
- 2013/09/02 Robert Tuccitto Stored data for 26.7 & 27.7 phase shifts
+ 2013/09/02 Robert Tuccitto Stored data for 26.7 & 27.7 phase shifts
with corrections and label for 25.7 values. Made 26.7
- (medium) default. Phase shifting falls outside the realm of
- video controls and hope to implement a selectable toggle
+ (medium) default. Phase shifting falls outside the realm of
+ video controls and hope to implement a selectable toggle
hardware option similar to Donkey Kong TKG02/TKG04.
***************************************************************************/
@@ -286,100 +286,100 @@ static const rgb_t a7800p_palette[256*3] =
define NTSC_GREY
- MAKE_RGB(0x00,0x00,0x00), MAKE_RGB(0x11,0x11,0x11), MAKE_RGB(0x22,0x22,0x22), MAKE_RGB(0x33,0x33,0x33), \
- MAKE_RGB(0x44,0x44,0x44), MAKE_RGB(0x55,0x55,0x55), MAKE_RGB(0x66,0x66,0x66), MAKE_RGB(0x77,0x77,0x77), \
- MAKE_RGB(0x88,0x88,0x88), MAKE_RGB(0x99,0x99,0x99), MAKE_RGB(0xAA,0xAA,0xAA), MAKE_RGB(0xBB,0xBB,0xBB), \
- MAKE_RGB(0xCC,0xCC,0xCC), MAKE_RGB(0xDD,0xDD,0xDD), MAKE_RGB(0xEE,0xEE,0xEE), MAKE_RGB(0xFF,0xFF,0xFF )
+ MAKE_RGB(0x00,0x00,0x00), MAKE_RGB(0x11,0x11,0x11), MAKE_RGB(0x22,0x22,0x22), MAKE_RGB(0x33,0x33,0x33), \
+ MAKE_RGB(0x44,0x44,0x44), MAKE_RGB(0x55,0x55,0x55), MAKE_RGB(0x66,0x66,0x66), MAKE_RGB(0x77,0x77,0x77), \
+ MAKE_RGB(0x88,0x88,0x88), MAKE_RGB(0x99,0x99,0x99), MAKE_RGB(0xAA,0xAA,0xAA), MAKE_RGB(0xBB,0xBB,0xBB), \
+ MAKE_RGB(0xCC,0xCC,0xCC), MAKE_RGB(0xDD,0xDD,0xDD), MAKE_RGB(0xEE,0xEE,0xEE), MAKE_RGB(0xFF,0xFF,0xFF )
define NTSC_GOLD
- MAKE_RGB(0x1A,0x07,0x00), MAKE_RGB(0x2B,0x18,0x00), MAKE_RGB(0x3C,0x29,0x00), MAKE_RGB(0x4D,0x3A,0x00), \
- MAKE_RGB(0x5E,0x4B,0x00), MAKE_RGB(0x6F,0x5C,0x00), MAKE_RGB(0x80,0x6D,0x00), MAKE_RGB(0x91,0x7E,0x09), \
- MAKE_RGB(0xA2,0x8F,0x1A), MAKE_RGB(0xB3,0xA0,0x2B), MAKE_RGB(0xC4,0xB1,0x3C), MAKE_RGB(0xD5,0xC2,0x4D), \
- MAKE_RGB(0xE6,0xD3,0x5E), MAKE_RGB(0xF7,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x83), MAKE_RGB(0xFF,0xF7,0x97 )
+ MAKE_RGB(0x1A,0x07,0x00), MAKE_RGB(0x2B,0x18,0x00), MAKE_RGB(0x3C,0x29,0x00), MAKE_RGB(0x4D,0x3A,0x00), \
+ MAKE_RGB(0x5E,0x4B,0x00), MAKE_RGB(0x6F,0x5C,0x00), MAKE_RGB(0x80,0x6D,0x00), MAKE_RGB(0x91,0x7E,0x09), \
+ MAKE_RGB(0xA2,0x8F,0x1A), MAKE_RGB(0xB3,0xA0,0x2B), MAKE_RGB(0xC4,0xB1,0x3C), MAKE_RGB(0xD5,0xC2,0x4D), \
+ MAKE_RGB(0xE6,0xD3,0x5E), MAKE_RGB(0xF7,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x83), MAKE_RGB(0xFF,0xF7,0x97 )
define NTSC_ORANGE
- MAKE_RGB(0x31,0x00,0x00), MAKE_RGB(0x42,0x06,0x00), MAKE_RGB(0x53,0x17,0x00), MAKE_RGB(0x64,0x28,0x00), \
- MAKE_RGB(0x75,0x39,0x00), MAKE_RGB(0x86,0X4A,0x00), MAKE_RGB(0x97,0x5B,0x0A), MAKE_RGB(0xA8,0x6C,0x1B), \
- MAKE_RGB(0xB9,0x7D,0x2C), MAKE_RGB(0xCA,0x8E,0x3D), MAKE_RGB(0xDB,0x9F,0x4E), MAKE_RGB(0xEC,0xB0,0x5F), \
- MAKE_RGB(0xFD,0xC1,0x70), MAKE_RGB(0xFF,0xD2,0x85), MAKE_RGB(0xFF,0xE3,0x9C), MAKE_RGB(0xFF,0xF4,0xB2 )
+ MAKE_RGB(0x31,0x00,0x00), MAKE_RGB(0x42,0x06,0x00), MAKE_RGB(0x53,0x17,0x00), MAKE_RGB(0x64,0x28,0x00), \
+ MAKE_RGB(0x75,0x39,0x00), MAKE_RGB(0x86,0X4A,0x00), MAKE_RGB(0x97,0x5B,0x0A), MAKE_RGB(0xA8,0x6C,0x1B), \
+ MAKE_RGB(0xB9,0x7D,0x2C), MAKE_RGB(0xCA,0x8E,0x3D), MAKE_RGB(0xDB,0x9F,0x4E), MAKE_RGB(0xEC,0xB0,0x5F), \
+ MAKE_RGB(0xFD,0xC1,0x70), MAKE_RGB(0xFF,0xD2,0x85), MAKE_RGB(0xFF,0xE3,0x9C), MAKE_RGB(0xFF,0xF4,0xB2 )
define NTSC_RED_ORANGE
- MAKE_RGB(0x3E,0x00,0x00), MAKE_RGB(0x4F,0x00,0x00), MAKE_RGB(0x60,0x08,0x00), MAKE_RGB(0x71,0x19,0x00), \
- MAKE_RGB(0x82,0x2A,0x0D), MAKE_RGB(0x93,0x3B,0x1E), MAKE_RGB(0xA4,0x4C,0x2F), MAKE_RGB(0xB5,0x5D,0x40), \
- MAKE_RGB(0xC6,0x6E,0x51), MAKE_RGB(0xD7,0x7F,0x62), MAKE_RGB(0xE8,0x90,0x73), MAKE_RGB(0xF9,0xA1,0x83), \
- MAKE_RGB(0xFF,0xB2,0x98), MAKE_RGB(0xFF,0xC3,0xAE), MAKE_RGB(0xFF,0xD4,0xC4), MAKE_RGB(0xFF,0xE5,0xDA )
+ MAKE_RGB(0x3E,0x00,0x00), MAKE_RGB(0x4F,0x00,0x00), MAKE_RGB(0x60,0x08,0x00), MAKE_RGB(0x71,0x19,0x00), \
+ MAKE_RGB(0x82,0x2A,0x0D), MAKE_RGB(0x93,0x3B,0x1E), MAKE_RGB(0xA4,0x4C,0x2F), MAKE_RGB(0xB5,0x5D,0x40), \
+ MAKE_RGB(0xC6,0x6E,0x51), MAKE_RGB(0xD7,0x7F,0x62), MAKE_RGB(0xE8,0x90,0x73), MAKE_RGB(0xF9,0xA1,0x83), \
+ MAKE_RGB(0xFF,0xB2,0x98), MAKE_RGB(0xFF,0xC3,0xAE), MAKE_RGB(0xFF,0xD4,0xC4), MAKE_RGB(0xFF,0xE5,0xDA )
define NTSC_PINK
- MAKE_RGB(0x3F,0x00,0x03), MAKE_RGB(0x50,0x00,0x0F), MAKE_RGB(0x61,0x00,0x1B), MAKE_RGB(0x72,0x0F,0x2B), \
- MAKE_RGB(0x83,0x20,0x3C), MAKE_RGB(0x94,0x31,0x4D), MAKE_RGB(0xA5,0x42,0x5E), MAKE_RGB(0xB6,0x53,0x6F), \
- MAKE_RGB(0xC7,0x64,0x80), MAKE_RGB(0xD8,0x75,0x91), MAKE_RGB(0xE9,0x86,0xA2), MAKE_RGB(0xFA,0x97,0xB3), \
- MAKE_RGB(0xFF,0xA8,0xC8), MAKE_RGB(0xFF,0xB9,0xDE), MAKE_RGB(0xFF,0xCA,0xEF), MAKE_RGB(0xFF,0xDB,0xF4 )
+ MAKE_RGB(0x3F,0x00,0x03), MAKE_RGB(0x50,0x00,0x0F), MAKE_RGB(0x61,0x00,0x1B), MAKE_RGB(0x72,0x0F,0x2B), \
+ MAKE_RGB(0x83,0x20,0x3C), MAKE_RGB(0x94,0x31,0x4D), MAKE_RGB(0xA5,0x42,0x5E), MAKE_RGB(0xB6,0x53,0x6F), \
+ MAKE_RGB(0xC7,0x64,0x80), MAKE_RGB(0xD8,0x75,0x91), MAKE_RGB(0xE9,0x86,0xA2), MAKE_RGB(0xFA,0x97,0xB3), \
+ MAKE_RGB(0xFF,0xA8,0xC8), MAKE_RGB(0xFF,0xB9,0xDE), MAKE_RGB(0xFF,0xCA,0xEF), MAKE_RGB(0xFF,0xDB,0xF4 )
define NTSC_PURPLE
- MAKE_RGB(0x33,0x00,0x35), MAKE_RGB(0x44,0x00,0x41), MAKE_RGB(0x55,0x00,0x4C), MAKE_RGB(0x66,0x0C,0x5C), \
- MAKE_RGB(0x77,0x1D,0x6D), MAKE_RGB(0x88,0x2E,0x7E), MAKE_RGB(0x99,0x3F,0x8F), MAKE_RGB(0xAA,0x50,0xA0), \
- MAKE_RGB(0xBB,0x61,0xB1), MAKE_RGB(0xCC,0x72,0xC2), MAKE_RGB(0xDD,0x83,0xD3), MAKE_RGB(0xEE,0x94,0xE4), \
- MAKE_RGB(0xFF,0xA5,0xE4), MAKE_RGB(0xFF,0xB6,0xE9), MAKE_RGB(0xFF,0xC7,0xEE), MAKE_RGB(0xFF,0xD8,0xF3 )
+ MAKE_RGB(0x33,0x00,0x35), MAKE_RGB(0x44,0x00,0x41), MAKE_RGB(0x55,0x00,0x4C), MAKE_RGB(0x66,0x0C,0x5C), \
+ MAKE_RGB(0x77,0x1D,0x6D), MAKE_RGB(0x88,0x2E,0x7E), MAKE_RGB(0x99,0x3F,0x8F), MAKE_RGB(0xAA,0x50,0xA0), \
+ MAKE_RGB(0xBB,0x61,0xB1), MAKE_RGB(0xCC,0x72,0xC2), MAKE_RGB(0xDD,0x83,0xD3), MAKE_RGB(0xEE,0x94,0xE4), \
+ MAKE_RGB(0xFF,0xA5,0xE4), MAKE_RGB(0xFF,0xB6,0xE9), MAKE_RGB(0xFF,0xC7,0xEE), MAKE_RGB(0xFF,0xD8,0xF3 )
define NTSC_PURPLE_BLUE
- MAKE_RGB(0x1D,0x00,0x5C), MAKE_RGB(0x2E,0x00,0x68), MAKE_RGB(0x40,0x00,0x74), MAKE_RGB(0x51,0x10,0x84), \
- MAKE_RGB(0x62,0x21,0x95), MAKE_RGB(0x73,0x32,0xA6), MAKE_RGB(0x84,0x43,0xB7), MAKE_RGB(0x95,0x54,0xC8), \
- MAKE_RGB(0xA6,0x65,0xD9), MAKE_RGB(0xB7,0x76,0xEA), MAKE_RGB(0xC8,0x87,0xEB), MAKE_RGB(0xD9,0x98,0xEB), \
- MAKE_RGB(0xE9,0xA9,0xEC), MAKE_RGB(0xFB,0xBA,0xEB), MAKE_RGB(0xFF,0xCB,0xEF), MAKE_RGB(0xFF,0xDC,0xF4 )
+ MAKE_RGB(0x1D,0x00,0x5C), MAKE_RGB(0x2E,0x00,0x68), MAKE_RGB(0x40,0x00,0x74), MAKE_RGB(0x51,0x10,0x84), \
+ MAKE_RGB(0x62,0x21,0x95), MAKE_RGB(0x73,0x32,0xA6), MAKE_RGB(0x84,0x43,0xB7), MAKE_RGB(0x95,0x54,0xC8), \
+ MAKE_RGB(0xA6,0x65,0xD9), MAKE_RGB(0xB7,0x76,0xEA), MAKE_RGB(0xC8,0x87,0xEB), MAKE_RGB(0xD9,0x98,0xEB), \
+ MAKE_RGB(0xE9,0xA9,0xEC), MAKE_RGB(0xFB,0xBA,0xEB), MAKE_RGB(0xFF,0xCB,0xEF), MAKE_RGB(0xFF,0xDC,0xF4 )
define NTSC_BLUE1
- MAKE_RGB(0x02,0x00,0x71), MAKE_RGB(0x13,0x00,0x7D), MAKE_RGB(0x24,0x0B,0x8C), MAKE_RGB(0x35,0x1C,0x9D), \
- MAKE_RGB(0x46,0x2D,0xAE), MAKE_RGB(0x57,0x3E,0xBF), MAKE_RGB(0x68,0x4F,0xD0), MAKE_RGB(0x79,0x60,0xE1), \
- MAKE_RGB(0x8A,0x71,0xF2), MAKE_RGB(0x9B,0x82,0xF7), MAKE_RGB(0xAC,0x93,0xF7), MAKE_RGB(0xBD,0xA4,0xF7), \
- MAKE_RGB(0xCE,0xB5,0xF7), MAKE_RGB(0xDF,0xC6,0xF7), MAKE_RGB(0xF0,0xD7,0xF7), MAKE_RGB(0xFF,0xE8,0xF8 )
+ MAKE_RGB(0x02,0x00,0x71), MAKE_RGB(0x13,0x00,0x7D), MAKE_RGB(0x24,0x0B,0x8C), MAKE_RGB(0x35,0x1C,0x9D), \
+ MAKE_RGB(0x46,0x2D,0xAE), MAKE_RGB(0x57,0x3E,0xBF), MAKE_RGB(0x68,0x4F,0xD0), MAKE_RGB(0x79,0x60,0xE1), \
+ MAKE_RGB(0x8A,0x71,0xF2), MAKE_RGB(0x9B,0x82,0xF7), MAKE_RGB(0xAC,0x93,0xF7), MAKE_RGB(0xBD,0xA4,0xF7), \
+ MAKE_RGB(0xCE,0xB5,0xF7), MAKE_RGB(0xDF,0xC6,0xF7), MAKE_RGB(0xF0,0xD7,0xF7), MAKE_RGB(0xFF,0xE8,0xF8 )
define NTSC_BLUE2
- MAKE_RGB(0x00,0x00,0x68), MAKE_RGB(0x00,0x0A,0x7C), MAKE_RGB(0x08,0x1B,0x90), MAKE_RGB(0x19,0x2C,0xA1), \
- MAKE_RGB(0x2A,0x3D,0xB2), MAKE_RGB(0x3B,0x4E,0xC3), MAKE_RGB(0x4C,0x5F,0xD4), MAKE_RGB(0x5D,0x70,0xE5), \
- MAKE_RGB(0x6E,0x81,0xF6), MAKE_RGB(0x7F,0x92,0xFF), MAKE_RGB(0x90,0xA3,0xFF), MAKE_RGB(0xA1,0xB4,0xFF), \
- MAKE_RGB(0xB2,0xC5,0xFF), MAKE_RGB(0xC3,0xD6,0xFF), MAKE_RGB(0xD4,0xE7,0xFF), MAKE_RGB(0xE5,0xF8,0xFF )
+ MAKE_RGB(0x00,0x00,0x68), MAKE_RGB(0x00,0x0A,0x7C), MAKE_RGB(0x08,0x1B,0x90), MAKE_RGB(0x19,0x2C,0xA1), \
+ MAKE_RGB(0x2A,0x3D,0xB2), MAKE_RGB(0x3B,0x4E,0xC3), MAKE_RGB(0x4C,0x5F,0xD4), MAKE_RGB(0x5D,0x70,0xE5), \
+ MAKE_RGB(0x6E,0x81,0xF6), MAKE_RGB(0x7F,0x92,0xFF), MAKE_RGB(0x90,0xA3,0xFF), MAKE_RGB(0xA1,0xB4,0xFF), \
+ MAKE_RGB(0xB2,0xC5,0xFF), MAKE_RGB(0xC3,0xD6,0xFF), MAKE_RGB(0xD4,0xE7,0xFF), MAKE_RGB(0xE5,0xF8,0xFF )
define NTSC_LIGHT_BLUE
- MAKE_RGB(0x00,0x0A,0x4D), MAKE_RGB(0x00,0x1B,0x63), MAKE_RGB(0x00,0x2C,0x79), MAKE_RGB(0x02,0x3D,0x8F), \
- MAKE_RGB(0x13,0x4E,0xA0), MAKE_RGB(0x24,0x5F,0xB1), MAKE_RGB(0x35,0x70,0xC2), MAKE_RGB(0x46,0x81,0xD3), \
- MAKE_RGB(0x57,0x92,0xE4), MAKE_RGB(0x68,0xA3,0xF5), MAKE_RGB(0x79,0xB4,0xFF), MAKE_RGB(0x8A,0xC5,0xFF), \
- MAKE_RGB(0x9B,0xD6,0xFF), MAKE_RGB(0xAC,0xE7,0xFF), MAKE_RGB(0xBD,0xF8,0xFF), MAKE_RGB(0xCE,0xFF,0xFF )
+ MAKE_RGB(0x00,0x0A,0x4D), MAKE_RGB(0x00,0x1B,0x63), MAKE_RGB(0x00,0x2C,0x79), MAKE_RGB(0x02,0x3D,0x8F), \
+ MAKE_RGB(0x13,0x4E,0xA0), MAKE_RGB(0x24,0x5F,0xB1), MAKE_RGB(0x35,0x70,0xC2), MAKE_RGB(0x46,0x81,0xD3), \
+ MAKE_RGB(0x57,0x92,0xE4), MAKE_RGB(0x68,0xA3,0xF5), MAKE_RGB(0x79,0xB4,0xFF), MAKE_RGB(0x8A,0xC5,0xFF), \
+ MAKE_RGB(0x9B,0xD6,0xFF), MAKE_RGB(0xAC,0xE7,0xFF), MAKE_RGB(0xBD,0xF8,0xFF), MAKE_RGB(0xCE,0xFF,0xFF )
define NTSC_TURQUOISE
- MAKE_RGB(0x00,0x1A,0x26), MAKE_RGB(0x00,0x2B,0x3C), MAKE_RGB(0x00,0x3C,0x52), MAKE_RGB(0x00,0x4D,0x68), \
- MAKE_RGB(0x06,0x5E,0x7C), MAKE_RGB(0x17,0x6F,0x8D), MAKE_RGB(0x28,0x80,0x9E), MAKE_RGB(0x39,0x91,0xAF), \
- MAKE_RGB(0x4A,0xA2,0xC0), MAKE_RGB(0x5B,0xB3,0xD1), MAKE_RGB(0x6C,0xC4,0xE2), MAKE_RGB(0x7D,0xD5,0xF3), \
- MAKE_RGB(0x8E,0xE6,0xFF), MAKE_RGB(0x9F,0xF7,0xFF), MAKE_RGB(0xB0,0xFF,0xFF), MAKE_RGB(0xC1,0xFF,0xFF )
+ MAKE_RGB(0x00,0x1A,0x26), MAKE_RGB(0x00,0x2B,0x3C), MAKE_RGB(0x00,0x3C,0x52), MAKE_RGB(0x00,0x4D,0x68), \
+ MAKE_RGB(0x06,0x5E,0x7C), MAKE_RGB(0x17,0x6F,0x8D), MAKE_RGB(0x28,0x80,0x9E), MAKE_RGB(0x39,0x91,0xAF), \
+ MAKE_RGB(0x4A,0xA2,0xC0), MAKE_RGB(0x5B,0xB3,0xD1), MAKE_RGB(0x6C,0xC4,0xE2), MAKE_RGB(0x7D,0xD5,0xF3), \
+ MAKE_RGB(0x8E,0xE6,0xFF), MAKE_RGB(0x9F,0xF7,0xFF), MAKE_RGB(0xB0,0xFF,0xFF), MAKE_RGB(0xC1,0xFF,0xFF )
define NTSC_GREEN_BLUE
- MAKE_RGB(0x00,0x24,0x0B), MAKE_RGB(0x00,0x35,0x10), MAKE_RGB(0x00,0x46,0x22), MAKE_RGB(0x00,0x57,0x38), \
- MAKE_RGB(0x05,0x68,0x4D), MAKE_RGB(0x16,0x79,0x5E), MAKE_RGB(0x27,0x8A,0x6F), MAKE_RGB(0x38,0x9B,0x80), \
- MAKE_RGB(0x49,0xAC,0x91), MAKE_RGB(0x5A,0xBD,0xA2), MAKE_RGB(0x6B,0xCE,0xB3), MAKE_RGB(0x7C,0xDF,0xC4), \
- MAKE_RGB(0x8D,0xF0,0xD5), MAKE_RGB(0x9E,0xFF,0xE5), MAKE_RGB(0xAF,0xFF,0xF1), MAKE_RGB(0xC0,0xFF,0xFD )
+ MAKE_RGB(0x00,0x24,0x0B), MAKE_RGB(0x00,0x35,0x10), MAKE_RGB(0x00,0x46,0x22), MAKE_RGB(0x00,0x57,0x38), \
+ MAKE_RGB(0x05,0x68,0x4D), MAKE_RGB(0x16,0x79,0x5E), MAKE_RGB(0x27,0x8A,0x6F), MAKE_RGB(0x38,0x9B,0x80), \
+ MAKE_RGB(0x49,0xAC,0x91), MAKE_RGB(0x5A,0xBD,0xA2), MAKE_RGB(0x6B,0xCE,0xB3), MAKE_RGB(0x7C,0xDF,0xC4), \
+ MAKE_RGB(0x8D,0xF0,0xD5), MAKE_RGB(0x9E,0xFF,0xE5), MAKE_RGB(0xAF,0xFF,0xF1), MAKE_RGB(0xC0,0xFF,0xFD )
define NTSC_GREEN
- MAKE_RGB(0x00,0x27,0x0C), MAKE_RGB(0x00,0x38,0x11), MAKE_RGB(0x00,0x49,0x16), MAKE_RGB(0x00,0x5A,0x1B), \
- MAKE_RGB(0x10,0x6B,0x1B), MAKE_RGB(0x21,0x7C,0x2C), MAKE_RGB(0x32,0x8D,0x3D), MAKE_RGB(0x43,0x9E,0x4E), \
- MAKE_RGB(0x54,0xAF,0x5F), MAKE_RGB(0x65,0xC0,0x70), MAKE_RGB(0x76,0xD1,0x81), MAKE_RGB(0x87,0xE2,0x92), \
- MAKE_RGB(0x98,0xF3,0xA3), MAKE_RGB(0xA9,0xFF,0xB3), MAKE_RGB(0xBA,0xFF,0xBF), MAKE_RGB(0xCB,0xFF,0xCB )
+ MAKE_RGB(0x00,0x27,0x0C), MAKE_RGB(0x00,0x38,0x11), MAKE_RGB(0x00,0x49,0x16), MAKE_RGB(0x00,0x5A,0x1B), \
+ MAKE_RGB(0x10,0x6B,0x1B), MAKE_RGB(0x21,0x7C,0x2C), MAKE_RGB(0x32,0x8D,0x3D), MAKE_RGB(0x43,0x9E,0x4E), \
+ MAKE_RGB(0x54,0xAF,0x5F), MAKE_RGB(0x65,0xC0,0x70), MAKE_RGB(0x76,0xD1,0x81), MAKE_RGB(0x87,0xE2,0x92), \
+ MAKE_RGB(0x98,0xF3,0xA3), MAKE_RGB(0xA9,0xFF,0xB3), MAKE_RGB(0xBA,0xFF,0xBF), MAKE_RGB(0xCB,0xFF,0xCB )
define NTSC_YELLOW_GREEN
- MAKE_RGB(0x00,0x23,0x0A), MAKE_RGB(0x00,0x34,0x10), MAKE_RGB(0x04,0x45,0x13), MAKE_RGB(0x15,0x56,0x13), \
- MAKE_RGB(0x26,0x67,0x13), MAKE_RGB(0x37,0x78,0x13), MAKE_RGB(0x48,0x89,0x14), MAKE_RGB(0x59,0x9A,0x25), \
- MAKE_RGB(0x6A,0xAB,0x36), MAKE_RGB(0x7B,0xBC,0x47), MAKE_RGB(0x8C,0xCD,0x58), MAKE_RGB(0x9D,0xDE,0x69), \
- MAKE_RGB(0xAE,0xEF,0x7A), MAKE_RGB(0xBF,0xFF,0x8B), MAKE_RGB(0xD0,0xFF,0x97), MAKE_RGB(0xE1,0xFF,0xA3 )
+ MAKE_RGB(0x00,0x23,0x0A), MAKE_RGB(0x00,0x34,0x10), MAKE_RGB(0x04,0x45,0x13), MAKE_RGB(0x15,0x56,0x13), \
+ MAKE_RGB(0x26,0x67,0x13), MAKE_RGB(0x37,0x78,0x13), MAKE_RGB(0x48,0x89,0x14), MAKE_RGB(0x59,0x9A,0x25), \
+ MAKE_RGB(0x6A,0xAB,0x36), MAKE_RGB(0x7B,0xBC,0x47), MAKE_RGB(0x8C,0xCD,0x58), MAKE_RGB(0x9D,0xDE,0x69), \
+ MAKE_RGB(0xAE,0xEF,0x7A), MAKE_RGB(0xBF,0xFF,0x8B), MAKE_RGB(0xD0,0xFF,0x97), MAKE_RGB(0xE1,0xFF,0xA3 )
define NTSC_ORANGE_GREEN
- MAKE_RGB(0x00,0x17,0x07), MAKE_RGB(0x0E,0x28,0x08), MAKE_RGB(0x1F,0x39,0x08), MAKE_RGB(0x30,0x4A,0x08), \
- MAKE_RGB(0x41,0x5B,0x08), MAKE_RGB(0x52,0x6C,0x08), MAKE_RGB(0x63,0x7D,0x08), MAKE_RGB(0x74,0x8E,0x0D), \
- MAKE_RGB(0x85,0x9F,0x1E), MAKE_RGB(0x96,0xB0,0x2F), MAKE_RGB(0xA7,0xC1,0x40), MAKE_RGB(0xB8,0xD2,0x51), \
- MAKE_RGB(0xC9,0xE3,0x62), MAKE_RGB(0xDA,0xF4,0x73), MAKE_RGB(0xEB,0xFF,0x82), MAKE_RGB(0xFC,0xFF,0x8E )
+ MAKE_RGB(0x00,0x17,0x07), MAKE_RGB(0x0E,0x28,0x08), MAKE_RGB(0x1F,0x39,0x08), MAKE_RGB(0x30,0x4A,0x08), \
+ MAKE_RGB(0x41,0x5B,0x08), MAKE_RGB(0x52,0x6C,0x08), MAKE_RGB(0x63,0x7D,0x08), MAKE_RGB(0x74,0x8E,0x0D), \
+ MAKE_RGB(0x85,0x9F,0x1E), MAKE_RGB(0x96,0xB0,0x2F), MAKE_RGB(0xA7,0xC1,0x40), MAKE_RGB(0xB8,0xD2,0x51), \
+ MAKE_RGB(0xC9,0xE3,0x62), MAKE_RGB(0xDA,0xF4,0x73), MAKE_RGB(0xEB,0xFF,0x82), MAKE_RGB(0xFC,0xFF,0x8E )
define NTSC_LIGHT_ORANGE
- MAKE_RGB(0x19,0x07,0x00), MAKE_RGB(0x2A,0x18,0x00), MAKE_RGB(0x3B,0x29,0x00), MAKE_RGB(0x4C,0x3A,0x00), \
- MAKE_RGB(0x5D,0x4B,0x00), MAKE_RGB(0x6E,0x5C,0x00), MAKE_RGB(0x7F,0x6D,0x00), MAKE_RGB(0x90,0x7E,0x09), \
- MAKE_RGB(0xA1,0x8F,0x1A), MAKE_RGB(0xB2,0xA0,0x2B), MAKE_RGB(0xC3,0xB1,0x3C), MAKE_RGB(0xD4,0xC2,0x4D), \
- MAKE_RGB(0xE5,0xD3,0x5E), MAKE_RGB(0xF6,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x82), MAKE_RGB(0xFF,0xFF,0x96 )
+ MAKE_RGB(0x19,0x07,0x00), MAKE_RGB(0x2A,0x18,0x00), MAKE_RGB(0x3B,0x29,0x00), MAKE_RGB(0x4C,0x3A,0x00), \
+ MAKE_RGB(0x5D,0x4B,0x00), MAKE_RGB(0x6E,0x5C,0x00), MAKE_RGB(0x7F,0x6D,0x00), MAKE_RGB(0x90,0x7E,0x09), \
+ MAKE_RGB(0xA1,0x8F,0x1A), MAKE_RGB(0xB2,0xA0,0x2B), MAKE_RGB(0xC3,0xB1,0x3C), MAKE_RGB(0xD4,0xC2,0x4D), \
+ MAKE_RGB(0xE5,0xD3,0x5E), MAKE_RGB(0xF6,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x82), MAKE_RGB(0xFF,0xFF,0x96 )
***************************************************************************/
@@ -388,100 +388,100 @@ define NTSC_LIGHT_ORANGE
define NTSC_GREY
- MAKE_RGB(0x00,0x00,0x00), MAKE_RGB(0x11,0x11,0x11), MAKE_RGB(0x22,0x22,0x22), MAKE_RGB(0x33,0x33,0x33), \
- MAKE_RGB(0x44,0x44,0x44), MAKE_RGB(0x55,0x55,0x55), MAKE_RGB(0x66,0x66,0x66), MAKE_RGB(0x77,0x77,0x77), \
- MAKE_RGB(0x88,0x88,0x88), MAKE_RGB(0x99,0x99,0x99), MAKE_RGB(0xAA,0xAA,0xAA), MAKE_RGB(0xBB,0xBB,0xBB), \
- MAKE_RGB(0xCC,0xCC,0xCC), MAKE_RGB(0xDD,0xDD,0xDD), MAKE_RGB(0xEE,0xEE,0xEE), MAKE_RGB(0xFF,0xFF,0xFF )
+ MAKE_RGB(0x00,0x00,0x00), MAKE_RGB(0x11,0x11,0x11), MAKE_RGB(0x22,0x22,0x22), MAKE_RGB(0x33,0x33,0x33), \
+ MAKE_RGB(0x44,0x44,0x44), MAKE_RGB(0x55,0x55,0x55), MAKE_RGB(0x66,0x66,0x66), MAKE_RGB(0x77,0x77,0x77), \
+ MAKE_RGB(0x88,0x88,0x88), MAKE_RGB(0x99,0x99,0x99), MAKE_RGB(0xAA,0xAA,0xAA), MAKE_RGB(0xBB,0xBB,0xBB), \
+ MAKE_RGB(0xCC,0xCC,0xCC), MAKE_RGB(0xDD,0xDD,0xDD), MAKE_RGB(0xEE,0xEE,0xEE), MAKE_RGB(0xFF,0xFF,0xFF )
define NTSC_GOLD
- MAKE_RGB(0x1A,0x07,0x00), MAKE_RGB(0x2B,0x18,0x00), MAKE_RGB(0x3C,0x29,0x00), MAKE_RGB(0x4D,0x3A,0x00), \
- MAKE_RGB(0x5E,0x4B,0x00), MAKE_RGB(0x6F,0x5C,0x00), MAKE_RGB(0x80,0x6D,0x00), MAKE_RGB(0x91,0x7E,0x09), \
- MAKE_RGB(0xA2,0x8F,0x1A), MAKE_RGB(0xB3,0xA0,0x2B), MAKE_RGB(0xC4,0xB1,0x3C), MAKE_RGB(0xD5,0xC2,0x4D), \
- MAKE_RGB(0xE6,0xD3,0x5E), MAKE_RGB(0xF7,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x83), MAKE_RGB(0xFF,0xFF,0x97 )
+ MAKE_RGB(0x1A,0x07,0x00), MAKE_RGB(0x2B,0x18,0x00), MAKE_RGB(0x3C,0x29,0x00), MAKE_RGB(0x4D,0x3A,0x00), \
+ MAKE_RGB(0x5E,0x4B,0x00), MAKE_RGB(0x6F,0x5C,0x00), MAKE_RGB(0x80,0x6D,0x00), MAKE_RGB(0x91,0x7E,0x09), \
+ MAKE_RGB(0xA2,0x8F,0x1A), MAKE_RGB(0xB3,0xA0,0x2B), MAKE_RGB(0xC4,0xB1,0x3C), MAKE_RGB(0xD5,0xC2,0x4D), \
+ MAKE_RGB(0xE6,0xD3,0x5E), MAKE_RGB(0xF7,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x83), MAKE_RGB(0xFF,0xFF,0x97 )
define NTSC_ORANGE
- MAKE_RGB(0x32,0x00,0x00), MAKE_RGB(0x43,0x05,0x00), MAKE_RGB(0x54,0x16,0x00), MAKE_RGB(0x65,0x27,0x00), \
- MAKE_RGB(0x76,0x38,0x00), MAKE_RGB(0x87,0x49,0x00), MAKE_RGB(0x98,0x5A,0x0C), MAKE_RGB(0xA9,0x6B,0x1D), \
- MAKE_RGB(0xBA,0x7C,0x2E), MAKE_RGB(0xCB,0x8D,0x3F), MAKE_RGB(0xDC,0x9E,0x50), MAKE_RGB(0xED,0xAF,0x61), \
- MAKE_RGB(0xFE,0xC0,0x72), MAKE_RGB(0xFF,0xD1,0x88), MAKE_RGB(0xFF,0xE2,0x9E), MAKE_RGB(0xFF,0xF3,0xB4 )
+ MAKE_RGB(0x32,0x00,0x00), MAKE_RGB(0x43,0x05,0x00), MAKE_RGB(0x54,0x16,0x00), MAKE_RGB(0x65,0x27,0x00), \
+ MAKE_RGB(0x76,0x38,0x00), MAKE_RGB(0x87,0x49,0x00), MAKE_RGB(0x98,0x5A,0x0C), MAKE_RGB(0xA9,0x6B,0x1D), \
+ MAKE_RGB(0xBA,0x7C,0x2E), MAKE_RGB(0xCB,0x8D,0x3F), MAKE_RGB(0xDC,0x9E,0x50), MAKE_RGB(0xED,0xAF,0x61), \
+ MAKE_RGB(0xFE,0xC0,0x72), MAKE_RGB(0xFF,0xD1,0x88), MAKE_RGB(0xFF,0xE2,0x9E), MAKE_RGB(0xFF,0xF3,0xB4 )
define NTSC_RED_ORANGE
- MAKE_RGB(0x3F,0x00,0x00), MAKE_RGB(0x50,0x00,0x00), MAKE_RGB(0x61,0x06,0x00), MAKE_RGB(0x72,0x17,0x03), \
- MAKE_RGB(0x83,0x28,0x14), MAKE_RGB(0x94,0x39,0x25), MAKE_RGB(0xA5,0x4A,0x36), MAKE_RGB(0xB6,0x5B,0x47), \
- MAKE_RGB(0xC7,0x6C,0x58), MAKE_RGB(0xD8,0x7D,0x69), MAKE_RGB(0xE9,0x8E,0x7A), MAKE_RGB(0xFA,0x9F,0x8B), \
- MAKE_RGB(0xFF,0xB0,0x9F), MAKE_RGB(0xFF,0xC1,0xB5), MAKE_RGB(0xFF,0xD2,0xCB), MAKE_RGB(0xFF,0xE3,0xE1 )
+ MAKE_RGB(0x3F,0x00,0x00), MAKE_RGB(0x50,0x00,0x00), MAKE_RGB(0x61,0x06,0x00), MAKE_RGB(0x72,0x17,0x03), \
+ MAKE_RGB(0x83,0x28,0x14), MAKE_RGB(0x94,0x39,0x25), MAKE_RGB(0xA5,0x4A,0x36), MAKE_RGB(0xB6,0x5B,0x47), \
+ MAKE_RGB(0xC7,0x6C,0x58), MAKE_RGB(0xD8,0x7D,0x69), MAKE_RGB(0xE9,0x8E,0x7A), MAKE_RGB(0xFA,0x9F,0x8B), \
+ MAKE_RGB(0xFF,0xB0,0x9F), MAKE_RGB(0xFF,0xC1,0xB5), MAKE_RGB(0xFF,0xD2,0xCB), MAKE_RGB(0xFF,0xE3,0xE1 )
define NTSC_PINK
- MAKE_RGB(0x3D,0x00,0x10), MAKE_RGB(0x4E,0x00,0x1C), MAKE_RGB(0x5F,0x00,0x27), MAKE_RGB(0x70,0x0D,0x37), \
- MAKE_RGB(0x81,0x1E,0x48), MAKE_RGB(0x92,0x2F,0x59), MAKE_RGB(0xA3,0x40,0x6A), MAKE_RGB(0xB4,0x51,0x7B), \
- MAKE_RGB(0xC5,0x62,0x8C), MAKE_RGB(0xD6,0x73,0x9D), MAKE_RGB(0xE7,0x84,0xAE), MAKE_RGB(0xF8,0x95,0xBF), \
- MAKE_RGB(0xFF,0xA6,0xD3), MAKE_RGB(0xFF,0xB7,0xE9), MAKE_RGB(0xFF,0xC8,0xEE), MAKE_RGB(0xFF,0xD9,0xF4 )
+ MAKE_RGB(0x3D,0x00,0x10), MAKE_RGB(0x4E,0x00,0x1C), MAKE_RGB(0x5F,0x00,0x27), MAKE_RGB(0x70,0x0D,0x37), \
+ MAKE_RGB(0x81,0x1E,0x48), MAKE_RGB(0x92,0x2F,0x59), MAKE_RGB(0xA3,0x40,0x6A), MAKE_RGB(0xB4,0x51,0x7B), \
+ MAKE_RGB(0xC5,0x62,0x8C), MAKE_RGB(0xD6,0x73,0x9D), MAKE_RGB(0xE7,0x84,0xAE), MAKE_RGB(0xF8,0x95,0xBF), \
+ MAKE_RGB(0xFF,0xA6,0xD3), MAKE_RGB(0xFF,0xB7,0xE9), MAKE_RGB(0xFF,0xC8,0xEE), MAKE_RGB(0xFF,0xD9,0xF4 )
define NTSC_PURPLE
- MAKE_RGB(0x2D,0x00,0x42), MAKE_RGB(0x3E,0x00,0x4E), MAKE_RGB(0x4F,0x00,0x5A), MAKE_RGB(0x60,0x0C,0x6A), \
- MAKE_RGB(0x71,0x1D,0x7B), MAKE_RGB(0x82,0x2E,0x8C), MAKE_RGB(0x93,0x3F,0x9D), MAKE_RGB(0xA4,0x50,0xAE), \
- MAKE_RGB(0xB5,0x61,0xBF), MAKE_RGB(0xC6,0x72,0xD0), MAKE_RGB(0xD7,0x83,0xE1), MAKE_RGB(0xE8,0x94,0xE6), \
- MAKE_RGB(0xF9,0xA5,0xE6), MAKE_RGB(0xFF,0xB6,0xE9), MAKE_RGB(0xFF,0xC7,0xEE), MAKE_RGB(0xFF,0xD8,0xF3 )
+ MAKE_RGB(0x2D,0x00,0x42), MAKE_RGB(0x3E,0x00,0x4E), MAKE_RGB(0x4F,0x00,0x5A), MAKE_RGB(0x60,0x0C,0x6A), \
+ MAKE_RGB(0x71,0x1D,0x7B), MAKE_RGB(0x82,0x2E,0x8C), MAKE_RGB(0x93,0x3F,0x9D), MAKE_RGB(0xA4,0x50,0xAE), \
+ MAKE_RGB(0xB5,0x61,0xBF), MAKE_RGB(0xC6,0x72,0xD0), MAKE_RGB(0xD7,0x83,0xE1), MAKE_RGB(0xE8,0x94,0xE6), \
+ MAKE_RGB(0xF9,0xA5,0xE6), MAKE_RGB(0xFF,0xB6,0xE9), MAKE_RGB(0xFF,0xC7,0xEE), MAKE_RGB(0xFF,0xD8,0xF3 )
define NTSC_PURPLE_BLUE
- MAKE_RGB(0x13,0x00,0x67), MAKE_RGB(0x24,0x00,0x73), MAKE_RGB(0x35,0x03,0x80), MAKE_RGB(0x46,0x14,0x91), \
- MAKE_RGB(0x57,0x25,0xA2), MAKE_RGB(0x68,0x36,0xB3), MAKE_RGB(0x79,0x47,0xC4), MAKE_RGB(0x8A,0x58,0xD5), \
- MAKE_RGB(0x9B,0x69,0xE6), MAKE_RGB(0xAC,0x7A,0xF0), MAKE_RGB(0xBD,0x8B,0xF0), MAKE_RGB(0xCE,0x9C,0xF0), \
- MAKE_RGB(0xDF,0xAD,0xF0), MAKE_RGB(0xF0,0xBE,0xF0), MAKE_RGB(0xFF,0xCF,0xF1), MAKE_RGB(0xFF,0xE0,0xF6 )
+ MAKE_RGB(0x13,0x00,0x67), MAKE_RGB(0x24,0x00,0x73), MAKE_RGB(0x35,0x03,0x80), MAKE_RGB(0x46,0x14,0x91), \
+ MAKE_RGB(0x57,0x25,0xA2), MAKE_RGB(0x68,0x36,0xB3), MAKE_RGB(0x79,0x47,0xC4), MAKE_RGB(0x8A,0x58,0xD5), \
+ MAKE_RGB(0x9B,0x69,0xE6), MAKE_RGB(0xAC,0x7A,0xF0), MAKE_RGB(0xBD,0x8B,0xF0), MAKE_RGB(0xCE,0x9C,0xF0), \
+ MAKE_RGB(0xDF,0xAD,0xF0), MAKE_RGB(0xF0,0xBE,0xF0), MAKE_RGB(0xFF,0xCF,0xF1), MAKE_RGB(0xFF,0xE0,0xF6 )
define NTSC_BLUE1
- MAKE_RGB(0x00,0x00,0x70), MAKE_RGB(0x05,0x01,0x80), MAKE_RGB(0x16,0x12,0x91), MAKE_RGB(0x27,0x23,0xA2), \
- MAKE_RGB(0x38,0x34,0xB3), MAKE_RGB(0x49,0x45,0xC4), MAKE_RGB(0x5A,0x56,0xD5), MAKE_RGB(0x6B,0x67,0xE6), \
- MAKE_RGB(0x7C,0x78,0xF7), MAKE_RGB(0x8D,0x89,0xFE), MAKE_RGB(0x9E,0x9A,0xFE), MAKE_RGB(0xAF,0xAB,0xFE), \
- MAKE_RGB(0xC0,0xBC,0xFE), MAKE_RGB(0xD1,0xCD,0xFE), MAKE_RGB(0xE2,0xDE,0xFE), MAKE_RGB(0xF3,0xEF,0xFE )
+ MAKE_RGB(0x00,0x00,0x70), MAKE_RGB(0x05,0x01,0x80), MAKE_RGB(0x16,0x12,0x91), MAKE_RGB(0x27,0x23,0xA2), \
+ MAKE_RGB(0x38,0x34,0xB3), MAKE_RGB(0x49,0x45,0xC4), MAKE_RGB(0x5A,0x56,0xD5), MAKE_RGB(0x6B,0x67,0xE6), \
+ MAKE_RGB(0x7C,0x78,0xF7), MAKE_RGB(0x8D,0x89,0xFE), MAKE_RGB(0x9E,0x9A,0xFE), MAKE_RGB(0xAF,0xAB,0xFE), \
+ MAKE_RGB(0xC0,0xBC,0xFE), MAKE_RGB(0xD1,0xCD,0xFE), MAKE_RGB(0xE2,0xDE,0xFE), MAKE_RGB(0xF3,0xEF,0xFE )
define NTSC_BLUE2
- MAKE_RGB(0x00,0x03,0x5B), MAKE_RGB(0x00,0x14,0x71), MAKE_RGB(0x00,0x25,0x87), MAKE_RGB(0x0C,0x36,0x9A), \
- MAKE_RGB(0x1D,0x47,0xAB), MAKE_RGB(0x2E,0x58,0xBC), MAKE_RGB(0x3F,0x69,0xCD), MAKE_RGB(0x50,0x7A,0xDE), \
- MAKE_RGB(0x61,0x8B,0xEF), MAKE_RGB(0x72,0x9C,0xFF), MAKE_RGB(0x83,0xAD,0xFF), MAKE_RGB(0x94,0xBE,0xFF), \
- MAKE_RGB(0xA5,0xCF,0xFF), MAKE_RGB(0xB6,0xE0,0xFF), MAKE_RGB(0xC7,0xF1,0xFF), MAKE_RGB(0xD8,0xFF,0xFF )
+ MAKE_RGB(0x00,0x03,0x5B), MAKE_RGB(0x00,0x14,0x71), MAKE_RGB(0x00,0x25,0x87), MAKE_RGB(0x0C,0x36,0x9A), \
+ MAKE_RGB(0x1D,0x47,0xAB), MAKE_RGB(0x2E,0x58,0xBC), MAKE_RGB(0x3F,0x69,0xCD), MAKE_RGB(0x50,0x7A,0xDE), \
+ MAKE_RGB(0x61,0x8B,0xEF), MAKE_RGB(0x72,0x9C,0xFF), MAKE_RGB(0x83,0xAD,0xFF), MAKE_RGB(0x94,0xBE,0xFF), \
+ MAKE_RGB(0xA5,0xCF,0xFF), MAKE_RGB(0xB6,0xE0,0xFF), MAKE_RGB(0xC7,0xF1,0xFF), MAKE_RGB(0xD8,0xFF,0xFF )
define NTSC_LIGHT_BLUE
- MAKE_RGB(0x00,0x15,0x35), MAKE_RGB(0x00,0x26,0x4B), MAKE_RGB(0x00,0x37,0x61), MAKE_RGB(0x00,0x48,0x78), \
- MAKE_RGB(0x0A,0x59,0x8B), MAKE_RGB(0x1B,0x6A,0x9C), MAKE_RGB(0x2C,0x7B,0xAD), MAKE_RGB(0x3D,0x8C,0xBE), \
- MAKE_RGB(0x4E,0x9D,0xCF), MAKE_RGB(0x5F,0xAE,0xE0), MAKE_RGB(0x70,0xBF,0xF1), MAKE_RGB(0x81,0xD0,0xFF), \
- MAKE_RGB(0x92,0xE1,0xFF), MAKE_RGB(0xA3,0xF2,0xFF), MAKE_RGB(0xB4,0xFF,0xFF), MAKE_RGB(0xC5,0xFF,0xFF )
+ MAKE_RGB(0x00,0x15,0x35), MAKE_RGB(0x00,0x26,0x4B), MAKE_RGB(0x00,0x37,0x61), MAKE_RGB(0x00,0x48,0x78), \
+ MAKE_RGB(0x0A,0x59,0x8B), MAKE_RGB(0x1B,0x6A,0x9C), MAKE_RGB(0x2C,0x7B,0xAD), MAKE_RGB(0x3D,0x8C,0xBE), \
+ MAKE_RGB(0x4E,0x9D,0xCF), MAKE_RGB(0x5F,0xAE,0xE0), MAKE_RGB(0x70,0xBF,0xF1), MAKE_RGB(0x81,0xD0,0xFF), \
+ MAKE_RGB(0x92,0xE1,0xFF), MAKE_RGB(0xA3,0xF2,0xFF), MAKE_RGB(0xB4,0xFF,0xFF), MAKE_RGB(0xC5,0xFF,0xFF )
define NTSC_TURQUOISE
- MAKE_RGB(0x00,0x22,0x0A), MAKE_RGB(0x00,0x33,0x19), MAKE_RGB(0x00,0x44,0x2F), MAKE_RGB(0x00,0x55,0x45), \
- MAKE_RGB(0x04,0x66,0x5A), MAKE_RGB(0x15,0x77,0x6B), MAKE_RGB(0x26,0x88,0x7C), MAKE_RGB(0x37,0x99,0x8D), \
- MAKE_RGB(0x48,0xAA,0x9E), MAKE_RGB(0x59,0xBB,0xAF), MAKE_RGB(0x6A,0xCC,0xC0), MAKE_RGB(0x7B,0xDD,0xD1), \
- MAKE_RGB(0x8C,0xEE,0xE2), MAKE_RGB(0x9D,0xFF,0xF3), MAKE_RGB(0xAE,0xFF,0xFF), MAKE_RGB(0xBF,0xFF,0xFF )
+ MAKE_RGB(0x00,0x22,0x0A), MAKE_RGB(0x00,0x33,0x19), MAKE_RGB(0x00,0x44,0x2F), MAKE_RGB(0x00,0x55,0x45), \
+ MAKE_RGB(0x04,0x66,0x5A), MAKE_RGB(0x15,0x77,0x6B), MAKE_RGB(0x26,0x88,0x7C), MAKE_RGB(0x37,0x99,0x8D), \
+ MAKE_RGB(0x48,0xAA,0x9E), MAKE_RGB(0x59,0xBB,0xAF), MAKE_RGB(0x6A,0xCC,0xC0), MAKE_RGB(0x7B,0xDD,0xD1), \
+ MAKE_RGB(0x8C,0xEE,0xE2), MAKE_RGB(0x9D,0xFF,0xF3), MAKE_RGB(0xAE,0xFF,0xFF), MAKE_RGB(0xBF,0xFF,0xFF )
define NTSC_GREEN_BLUE
- MAKE_RGB(0x00,0x27,0x0C), MAKE_RGB(0x00,0x38,0x11), MAKE_RGB(0x00,0x49,0x16), MAKE_RGB(0x00,0x5A,0x1B), \
- MAKE_RGB(0x0D,0x6B,0x25), MAKE_RGB(0x1E,0x7C,0x36), MAKE_RGB(0x2F,0x8D,0x47), MAKE_RGB(0x40,0x9E,0x58), \
- MAKE_RGB(0x51,0xAF,0x69), MAKE_RGB(0x62,0xC0,0x7A), MAKE_RGB(0x73,0xD1,0x8B), MAKE_RGB(0x84,0xE2,0x9C), \
- MAKE_RGB(0x95,0xF3,0xAD), MAKE_RGB(0xA6,0xFF,0xBD), MAKE_RGB(0xB7,0xFF,0xC9), MAKE_RGB(0xC8,0xFF,0xD4 )
+ MAKE_RGB(0x00,0x27,0x0C), MAKE_RGB(0x00,0x38,0x11), MAKE_RGB(0x00,0x49,0x16), MAKE_RGB(0x00,0x5A,0x1B), \
+ MAKE_RGB(0x0D,0x6B,0x25), MAKE_RGB(0x1E,0x7C,0x36), MAKE_RGB(0x2F,0x8D,0x47), MAKE_RGB(0x40,0x9E,0x58), \
+ MAKE_RGB(0x51,0xAF,0x69), MAKE_RGB(0x62,0xC0,0x7A), MAKE_RGB(0x73,0xD1,0x8B), MAKE_RGB(0x84,0xE2,0x9C), \
+ MAKE_RGB(0x95,0xF3,0xAD), MAKE_RGB(0xA6,0xFF,0xBD), MAKE_RGB(0xB7,0xFF,0xC9), MAKE_RGB(0xC8,0xFF,0xD4 )
define NTSC_GREEN
- MAKE_RGB(0x00,0x24,0x0B), MAKE_RGB(0x00,0x35,0x10), MAKE_RGB(0x01,0x46,0x15), MAKE_RGB(0x12,0x57,0x15), \
- MAKE_RGB(0x23,0x68,0x15), MAKE_RGB(0x34,0x79,0x15), MAKE_RGB(0x45,0x8A,0x19), MAKE_RGB(0x56,0x9B,0x2A), \
- MAKE_RGB(0x67,0xAC,0x3B), MAKE_RGB(0x78,0xBD,0x4C), MAKE_RGB(0x89,0xCE,0x5D), MAKE_RGB(0x9A,0xDF,0x6E), \
- MAKE_RGB(0xAB,0xF0,0x7F), MAKE_RGB(0xBC,0xFF,0x8F), MAKE_RGB(0xCD,0xFF,0x9B), MAKE_RGB(0xDE,0xFF,0xA7 )
+ MAKE_RGB(0x00,0x24,0x0B), MAKE_RGB(0x00,0x35,0x10), MAKE_RGB(0x01,0x46,0x15), MAKE_RGB(0x12,0x57,0x15), \
+ MAKE_RGB(0x23,0x68,0x15), MAKE_RGB(0x34,0x79,0x15), MAKE_RGB(0x45,0x8A,0x19), MAKE_RGB(0x56,0x9B,0x2A), \
+ MAKE_RGB(0x67,0xAC,0x3B), MAKE_RGB(0x78,0xBD,0x4C), MAKE_RGB(0x89,0xCE,0x5D), MAKE_RGB(0x9A,0xDF,0x6E), \
+ MAKE_RGB(0xAB,0xF0,0x7F), MAKE_RGB(0xBC,0xFF,0x8F), MAKE_RGB(0xCD,0xFF,0x9B), MAKE_RGB(0xDE,0xFF,0xA7 )
define NTSC_YELLOW_GREEN
- MAKE_RGB(0x00,0x18,0x07), MAKE_RGB(0x00,0x29,0x0C), MAKE_RGB(0x1E,0x3A,0x08), MAKE_RGB(0x2F,0x4B,0x08), \
- MAKE_RGB(0x40,0x5C,0x08), MAKE_RGB(0x51,0x6D,0x08), MAKE_RGB(0x62,0x7E,0x08), MAKE_RGB(0x73,0x8F,0x0D), \
- MAKE_RGB(0x84,0xA0,0x1E), MAKE_RGB(0x95,0xB1,0x2F), MAKE_RGB(0xA6,0xC2,0x40), MAKE_RGB(0xB7,0xD3,0x51), \
- MAKE_RGB(0xC8,0xE4,0x62), MAKE_RGB(0xD9,0xF5,0x73), MAKE_RGB(0xEA,0xFF,0x82), MAKE_RGB(0xFB,0xFF,0x8E )
+ MAKE_RGB(0x00,0x18,0x07), MAKE_RGB(0x00,0x29,0x0C), MAKE_RGB(0x1E,0x3A,0x08), MAKE_RGB(0x2F,0x4B,0x08), \
+ MAKE_RGB(0x40,0x5C,0x08), MAKE_RGB(0x51,0x6D,0x08), MAKE_RGB(0x62,0x7E,0x08), MAKE_RGB(0x73,0x8F,0x0D), \
+ MAKE_RGB(0x84,0xA0,0x1E), MAKE_RGB(0x95,0xB1,0x2F), MAKE_RGB(0xA6,0xC2,0x40), MAKE_RGB(0xB7,0xD3,0x51), \
+ MAKE_RGB(0xC8,0xE4,0x62), MAKE_RGB(0xD9,0xF5,0x73), MAKE_RGB(0xEA,0xFF,0x82), MAKE_RGB(0xFB,0xFF,0x8E )
define NTSC_ORANGE_GREEN
- MAKE_RGB(0x1B,0x07,0x00), MAKE_RGB(0x2C,0x18,0x00), MAKE_RGB(0x3D,0x29,0x00), MAKE_RGB(0x4E,0x3A,0x00), \
- MAKE_RGB(0x5F,0x4B,0x00), MAKE_RGB(0x70,0x5C,0x00), MAKE_RGB(0x81,0x6D,0x00), MAKE_RGB(0x92,0x7E,0x09), \
- MAKE_RGB(0xA3,0x8F,0x1A), MAKE_RGB(0xB4,0xA0,0x2B), MAKE_RGB(0xC5,0xB1,0x3C), MAKE_RGB(0xD6,0xC2,0x4D), \
- MAKE_RGB(0xE7,0xD3,0x5E), MAKE_RGB(0xF8,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x83), MAKE_RGB(0xFF,0xFF,0x97 )
+ MAKE_RGB(0x1B,0x07,0x00), MAKE_RGB(0x2C,0x18,0x00), MAKE_RGB(0x3D,0x29,0x00), MAKE_RGB(0x4E,0x3A,0x00), \
+ MAKE_RGB(0x5F,0x4B,0x00), MAKE_RGB(0x70,0x5C,0x00), MAKE_RGB(0x81,0x6D,0x00), MAKE_RGB(0x92,0x7E,0x09), \
+ MAKE_RGB(0xA3,0x8F,0x1A), MAKE_RGB(0xB4,0xA0,0x2B), MAKE_RGB(0xC5,0xB1,0x3C), MAKE_RGB(0xD6,0xC2,0x4D), \
+ MAKE_RGB(0xE7,0xD3,0x5E), MAKE_RGB(0xF8,0xE4,0x6F), MAKE_RGB(0xFF,0xF5,0x83), MAKE_RGB(0xFF,0xFF,0x97 )
define NTSC_LIGHT_ORANGE
- MAKE_RGB(0x33,0x00,0x00), MAKE_RGB(0x44,0x05,0x00), MAKE_RGB(0x55,0x16,0x00), MAKE_RGB(0x66,0x27,0x00), \
- MAKE_RGB(0x77,0x38,0x00), MAKE_RGB(0x88,0x49,0x00), MAKE_RGB(0x99,0x5A,0x0D), MAKE_RGB(0xAA,0x6B,0x1E), \
- MAKE_RGB(0xBB,0x7C,0x2F), MAKE_RGB(0xCC,0x8D,0x40), MAKE_RGB(0xDD,0x9E,0x51), MAKE_RGB(0xEE,0xAF,0x62), \
- MAKE_RGB(0xFF,0xC0,0x73), MAKE_RGB(0xFF,0xD1,0x89), MAKE_RGB(0xFF,0xE2,0x9F), MAKE_RGB(0xFF,0xF3,0xB5 )
+ MAKE_RGB(0x33,0x00,0x00), MAKE_RGB(0x44,0x05,0x00), MAKE_RGB(0x55,0x16,0x00), MAKE_RGB(0x66,0x27,0x00), \
+ MAKE_RGB(0x77,0x38,0x00), MAKE_RGB(0x88,0x49,0x00), MAKE_RGB(0x99,0x5A,0x0D), MAKE_RGB(0xAA,0x6B,0x1E), \
+ MAKE_RGB(0xBB,0x7C,0x2F), MAKE_RGB(0xCC,0x8D,0x40), MAKE_RGB(0xDD,0x9E,0x51), MAKE_RGB(0xEE,0xAF,0x62), \
+ MAKE_RGB(0xFF,0xC0,0x73), MAKE_RGB(0xFF,0xD1,0x89), MAKE_RGB(0xFF,0xE2,0x9F), MAKE_RGB(0xFF,0xF3,0xB5 )
***************************************************************************/
/* Initialise the palette */
diff --git a/src/mess/drivers/abc1600.c b/src/mess/drivers/abc1600.c
index 6d9bc684dd7..42cab12859e 100644
--- a/src/mess/drivers/abc1600.c
+++ b/src/mess/drivers/abc1600.c
@@ -478,8 +478,8 @@ static ADDRESS_MAP_START( mac_mem, AS_PROGRAM, 8, abc1600_state )
AM_RANGE(0x1ff300, 0x1ff300) AM_MIRROR(0xff) AM_DEVREADWRITE_LEGACY(Z8410AB1_0_TAG, z80dma_r, z80dma_w)
AM_RANGE(0x1ff400, 0x1ff400) AM_MIRROR(0xff) AM_DEVREADWRITE_LEGACY(Z8410AB1_1_TAG, z80dma_r, z80dma_w)
AM_RANGE(0x1ff500, 0x1ff500) AM_MIRROR(0xff) AM_DEVREADWRITE_LEGACY(Z8410AB1_2_TAG, z80dma_r, z80dma_w)
- AM_RANGE(0x1ff600, 0x1ff607) AM_MIRROR(0xf8) AM_READWRITE(scc_r, scc_w)
- AM_RANGE(0x1ff700, 0x1ff707) AM_MIRROR(0xf8) AM_READWRITE(cio_r, cio_w)
+ AM_RANGE(0x1ff600, 0x1ff607) AM_MIRROR(0xf8) AM_READWRITE(scc_r, scc_w)
+ AM_RANGE(0x1ff700, 0x1ff707) AM_MIRROR(0xf8) AM_READWRITE(cio_r, cio_w)
AM_RANGE(0x1ff800, 0x1ffaff) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, io_map)
AM_RANGE(0x1ffb00, 0x1ffb00) AM_MIRROR(0x7e) AM_WRITE(fw0_w)
AM_RANGE(0x1ffb01, 0x1ffb01) AM_MIRROR(0x7e) AM_WRITE(fw1_w)
diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c
index 915580301e4..834372a4cfd 100644
--- a/src/mess/drivers/apple2.c
+++ b/src/mess/drivers/apple2.c
@@ -639,7 +639,7 @@ static SLOT_INTERFACE_START(apple2_cards)
SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */
SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */
SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */
- SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */
+ SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */
SLOT_INTERFACE_END
static SLOT_INTERFACE_START(apple2eaux_cards)
@@ -1150,23 +1150,23 @@ ROM_END
#if 0
ROM_START(laba2p) /* II Plus clone with on-board Disk II controller and Videx-compatible 80-column card, supposedly from lab equipment */
ROM_REGION(0x1000,"gfx1",0)
- ROM_LOAD( "char.u30", 0x0000, 0x1000, CRC(2dbaef88) SHA1(9834842796132a11facd57923326d6954bcb609f) )
+ ROM_LOAD( "char.u30", 0x0000, 0x1000, CRC(2dbaef88) SHA1(9834842796132a11facd57923326d6954bcb609f) )
ROM_REGION(0x4700,"maincpu",0)
- ROM_LOAD( "maind0.u35", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425) )
- ROM_LOAD( "maine0.u34", 0x2000, 0x2000, CRC(314462ca) SHA1(5a23616dca14e59b4aca8ff6cfa0d98592a78a79) )
+ ROM_LOAD( "maind0.u35", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425) )
+ ROM_LOAD( "maine0.u34", 0x2000, 0x2000, CRC(314462ca) SHA1(5a23616dca14e59b4aca8ff6cfa0d98592a78a79) )
ROM_REGION(0x1000, "fw80col", 0)
- ROM_LOAD( "80cfw.u3", 0x0000, 0x1000, CRC(92d2b8b0) SHA1(5149483eb3e550ece1584e85fc821bb04d068dec) ) // firmware for on-board Videx
+ ROM_LOAD( "80cfw.u3", 0x0000, 0x1000, CRC(92d2b8b0) SHA1(5149483eb3e550ece1584e85fc821bb04d068dec) ) // firmware for on-board Videx
ROM_REGION(0x1000, "cg80col", 0)
- ROM_LOAD( "80ccgv80.u25", 0x0000, 0x1000, CRC(6d5e2707) SHA1(c56f76e8a366fee7374eb09f4866435c692490b2) ) // character generator for on-board Videx
+ ROM_LOAD( "80ccgv80.u25", 0x0000, 0x1000, CRC(6d5e2707) SHA1(c56f76e8a366fee7374eb09f4866435c692490b2) ) // character generator for on-board Videx
ROM_REGION(0x800, "diskii", 0)
- ROM_LOAD( "diskfw.u7", 0x0000, 0x0800, CRC(9207ef4e) SHA1(5fcffa4c68b16a7ef2f62651d4c7470400e5bd35) ) // firmware for on-board Disk II
+ ROM_LOAD( "diskfw.u7", 0x0000, 0x0800, CRC(9207ef4e) SHA1(5fcffa4c68b16a7ef2f62651d4c7470400e5bd35) ) // firmware for on-board Disk II
ROM_REGION(0x800, "unknown", 0)
- ROM_LOAD( "unk.u5", 0x0000, 0x0800, CRC(240a1774) SHA1(e6aeb0702dc99d76fd8c5a642fdfbe9ab896acd4) ) // unknown ROM
+ ROM_LOAD( "unk.u5", 0x0000, 0x0800, CRC(240a1774) SHA1(e6aeb0702dc99d76fd8c5a642fdfbe9ab896acd4) ) // unknown ROM
ROM_END
#endif
@@ -1197,4 +1197,3 @@ COMP( 1984, agat9, apple2, 0, apple2p, apple2p, driver_device,
COMP( 1985, space84, apple2, 0, space84, apple2p, driver_device, 0, "ComputerTechnik/IBS", "Space 84", GAME_NOT_WORKING )
COMP( 1985, am64, apple2, 0, space84, apple2p, driver_device, 0, "ASEM", "AM 64", GAME_SUPPORTS_SAVE )
//COMP( 19??, laba2p, apple2, 0, laba2p, apple2p, driver_device, 0, "<unknown>", "Lab equipment Apple II Plus clone", GAME_SUPPORTS_SAVE )
-
diff --git a/src/mess/drivers/apricot.c b/src/mess/drivers/apricot.c
index f5489a38b32..99fb2e5386d 100644
--- a/src/mess/drivers/apricot.c
+++ b/src/mess/drivers/apricot.c
@@ -342,8 +342,8 @@ void apricot_state::machine_start()
//**************************************************************************
static ADDRESS_MAP_START( apricot_mem, AS_PROGRAM, 16, apricot_state )
-// AM_RANGE(0x00000, 0x3ffff) AM_RAMBANK("standard_ram")
-// AM_RANGE(0x40000, 0xeffff) AM_RAMBANK("expansion_ram")
+// AM_RANGE(0x00000, 0x3ffff) AM_RAMBANK("standard_ram")
+// AM_RANGE(0x40000, 0xeffff) AM_RAMBANK("expansion_ram")
AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0x7000) AM_RAM AM_SHARE("screen_buffer")
AM_RANGE(0xfc000, 0xfffff) AM_MIRROR(0x4000) AM_ROM AM_REGION("bootstrap", 0)
ADDRESS_MAP_END
diff --git a/src/mess/drivers/cat.c b/src/mess/drivers/cat.c
index 9eb72b20f66..085cd792ed4 100644
--- a/src/mess/drivers/cat.c
+++ b/src/mess/drivers/cat.c
@@ -154,7 +154,7 @@ Canon Cat:
Crystals:
X1: 19.968Mhz, used by GA2 (plus a PLL to multiply by 2?), and divide by 4 for
cpuclk, divide by 8 for 2.5mhz and divide by 5.5 for 3.63mhz (is this
- suposed to be divide by 6? there may not be a pll if it is...)
+ suposed to be divide by 6? there may not be a pll if it is...)
X2: 3.579545Mhz, used by the DTMF generator chip AMI S2579 at IC40
X3: 2.4576Mhz, used by the modem chip AMI S35213 at IC37
@@ -183,7 +183,7 @@ Board name: 950-0001C
| TMS4256 74F153 "VIDEO 2B" .----------. J4 | K =
| | AM27256 | 74HC02 74HC374 || | O =
| TMS4256 74F153 74LS393 |__________| || UM95089 Y2 | U =
-|_____________________________________(j9)________________________________________________________|_T___=
+|_____________________________________(j9)________________________________________________________|_T___=
"TIMING B" - AMPAL16R4APC (marked on silkscreen "TIMING PAL")
"DECODE E" - AMPAL16L8PC (marked on silkscreen "DECODE PAL")
diff --git a/src/mess/drivers/cosmicos.c b/src/mess/drivers/cosmicos.c
index bf4fbd3f206..33641343368 100644
--- a/src/mess/drivers/cosmicos.c
+++ b/src/mess/drivers/cosmicos.c
@@ -69,7 +69,7 @@ READ8_MEMBER( cosmicos_state::read )
WRITE8_MEMBER( cosmicos_state::write )
{
if (m_boot) offset |= 0xc0c0;
-
+
if (offset < 0xc000)
{
// TODO
@@ -77,7 +77,7 @@ WRITE8_MEMBER( cosmicos_state::write )
else if (!m_ram_disable && !m_ram_protect && (offset >= 0xff00))
{
m_ram->pointer()[offset & 0xff] = data;
- }
+ }
}
READ8_MEMBER( cosmicos_state::video_off_r )
diff --git a/src/mess/drivers/dccons.c b/src/mess/drivers/dccons.c
index f7bc3e87edc..6a43cc4556e 100644
--- a/src/mess/drivers/dccons.c
+++ b/src/mess/drivers/dccons.c
@@ -24,236 +24,236 @@
- Carrier: Jaleco logo uses YUV, but y size is halved?
- Close To: Hangs at FMV
- F355 Challenge: black screen after Sega logo;
- - Gundam - Side Story 0079: currently hangs at Bandai logo (regression)
- - Idol Janshi wo Tsukucchaou: pixel aspect is way wrong (stretched and offsetted horizontally)
- - Power Stone: hangs at Capcom logo;
- - Sega GT: no cursor on main menu;
- - Tetris 4D: hangs at BPS FMV (bp 0C0B0C4E)
-
- Notes:
- - DC US and DC PAL flash ROMs are definitely hacked, they are set to have Chinese instead of Japanese.
- - 0x1a002 of flash ROM returns the region type (0x30=Japan, 0x31=USA, 0x32=Europe). Amusingly, if the value
- on a non-jp console is different than these ones, the system shows a black swirl (and nothing boots).
- - gdi file for DCLP (a Dreamcast tester) doesn't have first two tracks info, they are:
- 1 0 4 2048 FILE0001.DUP 0
+ - Gundam - Side Story 0079: currently hangs at Bandai logo (regression)
+ - Idol Janshi wo Tsukucchaou: pixel aspect is way wrong (stretched and offsetted horizontally)
+ - Power Stone: hangs at Capcom logo;
+ - Sega GT: no cursor on main menu;
+ - Tetris 4D: hangs at BPS FMV (bp 0C0B0C4E)
+
+ Notes:
+ - DC US and DC PAL flash ROMs are definitely hacked, they are set to have Chinese instead of Japanese.
+ - 0x1a002 of flash ROM returns the region type (0x30=Japan, 0x31=USA, 0x32=Europe). Amusingly, if the value
+ on a non-jp console is different than these ones, the system shows a black swirl (and nothing boots).
+ - gdi file for DCLP (a Dreamcast tester) doesn't have first two tracks info, they are:
+ 1 0 4 2048 FILE0001.DUP 0
2 1798 0 2352 FILE0002.DUP 0
- serial i/o also fails on that, work ram addresses that needs to be patched with 0x0009 (nop) are:
- 0xc0196da
- 0xc0196ec
- SH4 TEST:
- UBC test (0101):
- ok
- FPU test (0201):
- NG
- 0xc03fe24 work ram flag check (1=error, 0=ok)
- Cache test (03xx):
- Cache Read/Write test (0301)
- NG
- Cache RAM mode Check (0305)
- NG
- MMU test (04xx):
- asserts
- TMU test (0501):
- *_reg check -> ok
- TCNT* reload -> NG
- TCNT* underflow irq -> NG
- MULT test (0601)
- ok
- DIVU test (0701)
- ok
- Store Queue test (0801):
- ok
- SCIF test (0901)
- NG
- Private Instruction test (0a01)
- NG
- Critical test (0dxx)
- Critical (Store Queue) test (0d01):
- ok
- Critical (Write back) test (0d02):
- ok
- Critical (ADD,CMP/EQ) test (0d03):
- ok
- Critical (OC_OIX) test (0d04):
- NG
- Critical (MAX current) test (0d05):
- ok (very slow!)
- Critical (IC Cross Talk) test (0d06):
- NG
- Critical (Cache D-array) test (0d07):
- NG
- SH-4 BUG (0exx)
- SH4_BUG 64bit FMOV
- ok
- SH4 BUG FIX (64bitFMOV)
- ok
- MEM TEST:
- AICA (0102)
- ok
- Work RAM (0204):
- ok
- PV64 area (0303):
- ok
- PV32 area (0403):
- ok
- CLX TEST:
- CLX internal RAM (0101):
- ok
- <Torus> check (0401):
- (sets up RGB888 mode 2, assuming it's critically failed)
- TA TEST:
- TA_YUVINT (0101):
- ok -> IST_EOXFER_YUV
- TA_OENDINT (0102):
- ok -> IST_EOXFER_OPLST
- TA_OMENDINT (0103):
- ok -> IST_EOXFER_OPMV
- TA_TENDINT (0104):
- ok -> IST_EOXFER_TRLST
- TA_TMENDINT (0105):
- ok -> IST_EOXFER_TRMV
- TA_PTENDINT (0106):
- ok -> IST_EOXFER_PTLST
- TA_ISPINT (0107):
- NG -> ISP/TSP Parameter Overflow (error)
- TA_OBJINT (0108):
- NG -> OBJect list pointer Overflow (error)
- TA_IPINT (0109):
- NG -> TA: Illegal parameter (error)
- YUV Converter (0201):
- ok
- DDT i/f TEST:
- Sort, Normal DMA (1) (0101)
- hangs (wants Sort DMA irq, of course)
- Sort, Normal DMA (2)
- ...
- Through
- NG, hangs again
- DC_DEINT (0201)
- ok
- DC_SDTEINT (0202)
- ok
- DC_SDTERINT (0203)
- ok (but returns error count ++, think it's a bug in the SW)
- G2 TEST
- DMA (0101):
- G2 EXT AREA DETECT:
- "!!!! ch00 ERROR DETECT !!!!"
- Interrupt (0301):
- G2 EXT AREA DETECT
- DMA END INT
- hangs
- Ext Interrupt (06xx)
- AICA INT (0601)
- error detect
- Modem INT (0602)
- error detect
- AICA TEST
- Sound RAM (01xx)
- Pattern R/W check (0101)
- ok
- Register (02xx)
- CH Data (0201)
- ok
- EXT Input (0202)
- ok
- DSP Data (0203)
- ok
- S_Clock (03xx)
- 50MSEC (0301)
- NG -> ~0xa58 in 0x702814, must be > 0x889 and < 0x8b0
- 25MSEC (0302)
- NG -> ~0x372 in 0x702814, must be > 0x443 and < 0x45a
- Timer (04xx)
- Timer A (0401)
- NG
- Timer B (0402)
- NG
- Timer C (0403)
- NG
- DMA (05xx)
- SRAM -> CH Reg (0501)
- ok
- SRAM -> Comm Reg (0502)
- ok
- SRAM -> DSP Reg (0503)
- ok
- CH Reg -> SRAM (0504)
- ok
- Comm Reg -> SRAM (0505)
- ok
- DSP Reg -> SRAM (0506)
- ok
- Clear SRAM (0507)
- ok
- Clear CH Reg (0508)
- ok
- Clear Comm Reg (0509)
- ok
- Clear DSP Reg (050a)
- ok
- Interrupt (06xx)
- Sampling clock (0601)
- NG (irq 0x400)
- Timer A (0602)
- randomly NG/ok
- Timer B (0603)
- ok
- Timer C (0604)
- ok
- DMA End (0605)
- ok
- Midi Out (0606)
- NG
- Main CPU (0607)
- ok
- RTC (07xx)
- Write Protect (0701)
- ok
- RW Comp (0702)
- ok
- Clock (0703)
- NG
- ARM7 (08xx)
- Load & Start (0801)
- NG
- Timer & Intr (0802)
- NG
- DMA (0803)
- NG
- Ch-Reg R/W (0804)
- ok
- SRAM incr (0805)
- NG
- SRAM pattern (0806)
- ok
- EG (09xx)
- LSA-Reg Left (0901)
- ok/NG
- LSA-Reg Right (0902)
- ok/NG
- LSA-Reg Left & Right (0903)
- ok/NG
- MIDI (0axx)
- OEMP bit (0a01)
- NG
- OFLL bit (0a02)
- NG
- PVRi/f test
- DMA (01xx)
- CPU trig (0101)
- ok
- INT trig
- ok
- Interrupt (02xx)
- PVR DMA end Int (0201)
- ok
- PVR DMA IA Int (0202)
- NG
- PVR DMA end (0203)
- NG
- Flash test:
- (SH-4 jumps to la la land as soon as this is started)
+ serial i/o also fails on that, work ram addresses that needs to be patched with 0x0009 (nop) are:
+ 0xc0196da
+ 0xc0196ec
+ SH4 TEST:
+ UBC test (0101):
+ ok
+ FPU test (0201):
+ NG
+ 0xc03fe24 work ram flag check (1=error, 0=ok)
+ Cache test (03xx):
+ Cache Read/Write test (0301)
+ NG
+ Cache RAM mode Check (0305)
+ NG
+ MMU test (04xx):
+ asserts
+ TMU test (0501):
+ *_reg check -> ok
+ TCNT* reload -> NG
+ TCNT* underflow irq -> NG
+ MULT test (0601)
+ ok
+ DIVU test (0701)
+ ok
+ Store Queue test (0801):
+ ok
+ SCIF test (0901)
+ NG
+ Private Instruction test (0a01)
+ NG
+ Critical test (0dxx)
+ Critical (Store Queue) test (0d01):
+ ok
+ Critical (Write back) test (0d02):
+ ok
+ Critical (ADD,CMP/EQ) test (0d03):
+ ok
+ Critical (OC_OIX) test (0d04):
+ NG
+ Critical (MAX current) test (0d05):
+ ok (very slow!)
+ Critical (IC Cross Talk) test (0d06):
+ NG
+ Critical (Cache D-array) test (0d07):
+ NG
+ SH-4 BUG (0exx)
+ SH4_BUG 64bit FMOV
+ ok
+ SH4 BUG FIX (64bitFMOV)
+ ok
+ MEM TEST:
+ AICA (0102)
+ ok
+ Work RAM (0204):
+ ok
+ PV64 area (0303):
+ ok
+ PV32 area (0403):
+ ok
+ CLX TEST:
+ CLX internal RAM (0101):
+ ok
+ <Torus> check (0401):
+ (sets up RGB888 mode 2, assuming it's critically failed)
+ TA TEST:
+ TA_YUVINT (0101):
+ ok -> IST_EOXFER_YUV
+ TA_OENDINT (0102):
+ ok -> IST_EOXFER_OPLST
+ TA_OMENDINT (0103):
+ ok -> IST_EOXFER_OPMV
+ TA_TENDINT (0104):
+ ok -> IST_EOXFER_TRLST
+ TA_TMENDINT (0105):
+ ok -> IST_EOXFER_TRMV
+ TA_PTENDINT (0106):
+ ok -> IST_EOXFER_PTLST
+ TA_ISPINT (0107):
+ NG -> ISP/TSP Parameter Overflow (error)
+ TA_OBJINT (0108):
+ NG -> OBJect list pointer Overflow (error)
+ TA_IPINT (0109):
+ NG -> TA: Illegal parameter (error)
+ YUV Converter (0201):
+ ok
+ DDT i/f TEST:
+ Sort, Normal DMA (1) (0101)
+ hangs (wants Sort DMA irq, of course)
+ Sort, Normal DMA (2)
+ ...
+ Through
+ NG, hangs again
+ DC_DEINT (0201)
+ ok
+ DC_SDTEINT (0202)
+ ok
+ DC_SDTERINT (0203)
+ ok (but returns error count ++, think it's a bug in the SW)
+ G2 TEST
+ DMA (0101):
+ G2 EXT AREA DETECT:
+ "!!!! ch00 ERROR DETECT !!!!"
+ Interrupt (0301):
+ G2 EXT AREA DETECT
+ DMA END INT
+ hangs
+ Ext Interrupt (06xx)
+ AICA INT (0601)
+ error detect
+ Modem INT (0602)
+ error detect
+ AICA TEST
+ Sound RAM (01xx)
+ Pattern R/W check (0101)
+ ok
+ Register (02xx)
+ CH Data (0201)
+ ok
+ EXT Input (0202)
+ ok
+ DSP Data (0203)
+ ok
+ S_Clock (03xx)
+ 50MSEC (0301)
+ NG -> ~0xa58 in 0x702814, must be > 0x889 and < 0x8b0
+ 25MSEC (0302)
+ NG -> ~0x372 in 0x702814, must be > 0x443 and < 0x45a
+ Timer (04xx)
+ Timer A (0401)
+ NG
+ Timer B (0402)
+ NG
+ Timer C (0403)
+ NG
+ DMA (05xx)
+ SRAM -> CH Reg (0501)
+ ok
+ SRAM -> Comm Reg (0502)
+ ok
+ SRAM -> DSP Reg (0503)
+ ok
+ CH Reg -> SRAM (0504)
+ ok
+ Comm Reg -> SRAM (0505)
+ ok
+ DSP Reg -> SRAM (0506)
+ ok
+ Clear SRAM (0507)
+ ok
+ Clear CH Reg (0508)
+ ok
+ Clear Comm Reg (0509)
+ ok
+ Clear DSP Reg (050a)
+ ok
+ Interrupt (06xx)
+ Sampling clock (0601)
+ NG (irq 0x400)
+ Timer A (0602)
+ randomly NG/ok
+ Timer B (0603)
+ ok
+ Timer C (0604)
+ ok
+ DMA End (0605)
+ ok
+ Midi Out (0606)
+ NG
+ Main CPU (0607)
+ ok
+ RTC (07xx)
+ Write Protect (0701)
+ ok
+ RW Comp (0702)
+ ok
+ Clock (0703)
+ NG
+ ARM7 (08xx)
+ Load & Start (0801)
+ NG
+ Timer & Intr (0802)
+ NG
+ DMA (0803)
+ NG
+ Ch-Reg R/W (0804)
+ ok
+ SRAM incr (0805)
+ NG
+ SRAM pattern (0806)
+ ok
+ EG (09xx)
+ LSA-Reg Left (0901)
+ ok/NG
+ LSA-Reg Right (0902)
+ ok/NG
+ LSA-Reg Left & Right (0903)
+ ok/NG
+ MIDI (0axx)
+ OEMP bit (0a01)
+ NG
+ OFLL bit (0a02)
+ NG
+ PVRi/f test
+ DMA (01xx)
+ CPU trig (0101)
+ ok
+ INT trig
+ ok
+ Interrupt (02xx)
+ PVR DMA end Int (0201)
+ ok
+ PVR DMA IA Int (0202)
+ NG
+ PVR DMA end (0203)
+ NG
+ Flash test:
+ (SH-4 jumps to la la land as soon as this is started)
*/
@@ -275,7 +275,7 @@
READ64_MEMBER(dc_cons_state::dcus_idle_skip_r )
{
//if (space.device().safe_pc()==0xc0ba52a)
- // space.device().execute().spin_until_time(attotime::from_usec(2500));
+ // space.device().execute().spin_until_time(attotime::from_usec(2500));
// device_spinuntil_int(&space.device());
return dc_ram[0x2303b0/8];
@@ -284,7 +284,7 @@ READ64_MEMBER(dc_cons_state::dcus_idle_skip_r )
READ64_MEMBER(dc_cons_state::dcjp_idle_skip_r )
{
//if (space.device().safe_pc()==0xc0bac62)
- // space.device().execute().spin_until_time(attotime::from_usec(2500));
+ // space.device().execute().spin_until_time(attotime::from_usec(2500));
// device_spinuntil_int(&space.device());
return dc_ram[0x2302f8/8];
@@ -384,7 +384,7 @@ static ADDRESS_MAP_START( dc_map, AS_PROGRAM, 64, dc_cons_state )
AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE(dc_arm_r, dc_arm_w )
// AM_RANGE(0x01000000, 0x01ffffff) G2 Ext Device #1
// AM_RANGE(0x02700000, 0x02707fff) AICA reg mirror
-// AM_RANGE(0x02800000, 0x02ffffff) AICA wave mem mirror
+// AM_RANGE(0x02800000, 0x02ffffff) AICA wave mem mirror
// AM_RANGE(0x03000000, 0x03ffffff) G2 Ext Device #2
@@ -627,7 +627,7 @@ static MACHINE_CONFIG_START( dc, dc_cons_state )
MCFG_MACHINE_RESET_OVERRIDE(dc_cons_state,dc_console )
-// MCFG_MACRONIX_29LV160TMC_ADD("dcflash")
+// MCFG_MACRONIX_29LV160TMC_ADD("dcflash")
MCFG_MAPLE_DC_ADD( "maple_dc", "maincpu", dc_maple_irq )
MCFG_DC_CONTROLLER_ADD("dcctrl0", "maple_dc", 0, ":P1:0", ":P1:1", ":P1:A0", ":P1:A1", ":P1:A2", ":P1:A3", ":P1:A4", ":P1:A5")
diff --git a/src/mess/drivers/dsb46.c b/src/mess/drivers/dsb46.c
index d26f52d2fe6..0c60e432ed1 100644
--- a/src/mess/drivers/dsb46.c
+++ b/src/mess/drivers/dsb46.c
@@ -77,7 +77,7 @@ WRITE8_MEMBER( dsb46_state::port1a_w )
{
membank("read")->set_entry(data & 1);
}
-
+
READ8_MEMBER( dsb46_state::port01_r )
{
return (m_term_data) ? 5 : 4;
diff --git a/src/mess/drivers/esq5505.c b/src/mess/drivers/esq5505.c
index c4f1a6e1fa9..a40a46b39f1 100644
--- a/src/mess/drivers/esq5505.c
+++ b/src/mess/drivers/esq5505.c
@@ -107,7 +107,7 @@
5 = Volume Slider
6 = Battery
7 = Voltage Reference
-
+
SQ-1:
4 = second digit of patch # becomes 2
5 = first digit of patch # becomes 2
@@ -117,11 +117,11 @@
12 = patch -1
13 = patch +1
14 = second digit of patch # becomes 5
- 15 = first digit of patch # becomes 5
+ 15 = first digit of patch # becomes 5
20 = select sound?
- 22 = second digit of patch # becomes 6
- 23 = first digit of patch # becomes 6
-
+ 22 = second digit of patch # becomes 6
+ 23 = first digit of patch # becomes 6
+
***************************************************************************/
#include <cstdio>
@@ -843,8 +843,8 @@ ROM_END
ROM_START( sd1 )
ROM_REGION(0x40000, "osrom", 0)
- ROM_LOAD16_BYTE( "sd1_21_300b_lower.bin", 0x000000, 0x020000, CRC(a1358a0c) SHA1(64ac5358aa46da37ca4195002cf358554e00878a) )
- ROM_LOAD16_BYTE( "sd1_21_300b_upper.bin", 0x000001, 0x010000, CRC(465ba463) SHA1(899b0e83d0788c8d49c7b09ccf0b4a92b528c6e9) )
+ ROM_LOAD16_BYTE( "sd1_21_300b_lower.bin", 0x000000, 0x020000, CRC(a1358a0c) SHA1(64ac5358aa46da37ca4195002cf358554e00878a) )
+ ROM_LOAD16_BYTE( "sd1_21_300b_upper.bin", 0x000001, 0x010000, CRC(465ba463) SHA1(899b0e83d0788c8d49c7b09ccf0b4a92b528c6e9) )
ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // BS=0 region (12-bit)
ROM_LOAD16_BYTE( "u34.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) )
@@ -865,8 +865,8 @@ ROM_START( sd132 )
ROM_LOAD16_BYTE_BIOS(0, "sd1_410_lo.bin", 0x000000, 0x020000, CRC(faa613a6) SHA1(60066765cddfa9d3b5d09057d8f83fb120f4e65e) )
ROM_LOAD16_BYTE_BIOS(0, "sd1_410_hi.bin", 0x000001, 0x010000, CRC(618c0aa8) SHA1(74acf458aa1d04a0a7a0cd5855c49e6855dbd301) )
ROM_SYSTEM_BIOS(1, "402", "SD-1 v4.02")
- ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_lo.bin", 0x000000, 0x020000, CRC(5da2572b) SHA1(cb6ddd637ed13bfeb40a99df56000479e63fc8ec) )
- ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_hi.bin", 0x000001, 0x010000, CRC(fc45c210) SHA1(23b81ebd9176112e6eae0c7c75b39fcb1656c953) )
+ ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_lo.bin", 0x000000, 0x020000, CRC(5da2572b) SHA1(cb6ddd637ed13bfeb40a99df56000479e63fc8ec) )
+ ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_hi.bin", 0x000001, 0x010000, CRC(fc45c210) SHA1(23b81ebd9176112e6eae0c7c75b39fcb1656c953) )
ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // BS=0 region (12-bit)
ROM_LOAD16_BYTE( "u34.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) )
@@ -964,7 +964,7 @@ DRIVER_INIT_MEMBER(esq5505_state,denib)
CONS( 1988, eps, 0, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS", GAME_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs)
CONS( 1989, vfx, 0, 0, vfx, vfx, esq5505_state, denib, "Ensoniq", "VFX", GAME_NOT_WORKING ) // 2x40 VFD
CONS( 1989, vfxsd, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "VFX-SD", GAME_NOT_WORKING ) // 2x40 VFD
-CONS( 1990, sd1, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (21 voice)", GAME_NOT_WORKING ) // 2x40 VFD
-CONS( 1990, sd132, sd1,0, vfx32, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (32 voice)", GAME_NOT_WORKING ) // 2x40 VFD
+CONS( 1990, sd1, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (21 voice)", GAME_NOT_WORKING ) // 2x40 VFD
+CONS( 1990, sd132, sd1,0, vfx32, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (32 voice)", GAME_NOT_WORKING ) // 2x40 VFD
CONS( 1990, sq1, 0, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-1", GAME_NOT_WORKING ) // 2x16 LCD
CONS( 1990, sqrack,sq1, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-Rack", GAME_NOT_WORKING ) // 2x16 LCD
diff --git a/src/mess/drivers/kaypro.c b/src/mess/drivers/kaypro.c
index 84ad609a773..4dd20d8f3af 100644
--- a/src/mess/drivers/kaypro.c
+++ b/src/mess/drivers/kaypro.c
@@ -175,11 +175,11 @@ static MC6845_INTERFACE( kaypro2x_crtc )
************************************************************/
//FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats )
-// FLOPPY_KAYPROII_FORMAT
+// FLOPPY_KAYPROII_FORMAT
//FLOPPY_FORMATS_END
//FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats )
-// FLOPPY_KAYPRO2X_FORMAT
+// FLOPPY_KAYPRO2X_FORMAT
//FLOPPY_FORMATS_END
static SLOT_INTERFACE_START( kaypro_floppies )
diff --git a/src/mess/drivers/kyocera.c b/src/mess/drivers/kyocera.c
index afbe55ee664..e99f7322bbe 100644
--- a/src/mess/drivers/kyocera.c
+++ b/src/mess/drivers/kyocera.c
@@ -1654,12 +1654,12 @@ ROM_END
/* System Drivers */
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
-COMP( 1983, kc85, 0, 0, kc85, kc85, driver_device, 0, "Kyosei", "Kyotronic 85 (Japan)", 0 )
-COMP( 1983, m10, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10", 0 )
-//COMP( 1983, m10m, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10 Modem (US)", 0 )
-COMP( 1983, trsm100, 0, 0, trsm100, kc85, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 100", 0 )
-COMP( 1986, tandy102, trsm100,0, tandy102, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 102", 0 )
-COMP( 1983, pc8201, 0, 0, pc8201, pc8201, driver_device, 0, "Nippon Electronic Company", "PC-8201 (Japan)", GAME_NOT_WORKING ) // keyboard layout wrong
-COMP( 1983, pc8201a, pc8201, 0, pc8201, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8201A", 0 )
-COMP( 1987, npc8300, pc8201, 0, pc8300, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8300", GAME_NOT_WORKING )
-COMP( 1984, tandy200, 0, 0, tandy200, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 200", 0 )
+COMP( 1983, kc85, 0, 0, kc85, kc85, driver_device, 0, "Kyosei", "Kyotronic 85 (Japan)", 0 )
+COMP( 1983, m10, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10", 0 )
+//COMP( 1983, m10m, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10 Modem (US)", 0 )
+COMP( 1983, trsm100, 0, 0, trsm100, kc85, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 100", 0 )
+COMP( 1986, tandy102, trsm100,0, tandy102, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 102", 0 )
+COMP( 1983, pc8201, 0, 0, pc8201, pc8201, driver_device, 0, "Nippon Electronic Company", "PC-8201 (Japan)", GAME_NOT_WORKING ) // keyboard layout wrong
+COMP( 1983, pc8201a, pc8201, 0, pc8201, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8201A", 0 )
+COMP( 1987, npc8300, pc8201, 0, pc8300, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8300", GAME_NOT_WORKING )
+COMP( 1984, tandy200, 0, 0, tandy200, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 200", 0 )
diff --git a/src/mess/drivers/lola8a.c b/src/mess/drivers/lola8a.c
index 063802323b4..c06b00ff852 100644
--- a/src/mess/drivers/lola8a.c
+++ b/src/mess/drivers/lola8a.c
@@ -1,20 +1,20 @@
/***************************************************************************
-
- Lola 8A
-
- Ivo Lola Ribar Institute
+
+ Lola 8A
+
+ Ivo Lola Ribar Institute
2013-08-28 Skeleton driver.
- BASIC commands :
-
- LET NEXT IF GOTO GOSUB RETURN READ DATA FOR CLS INPUT DIM STOP END RESTORE
- REM CLEAR PUSH POKE PRINT OUT ERROR USR CURSOR NORMAL INVERSE PLOT UNPLOT
- ELSE WIPE COLOUR CENTRE RANGE DRAW CIRCLE LOAD SAVE VERIFY HLOAD HSAVE HVERIFY
- DLOAD DSAVE DVERIFY MERGE CAT RUN NEW ON LIST DEF MON GWIND TWIND UNDER
- SPC OFF TAB THEN TO STEP AND OR XOR NOT ABS LEN SQR INT ASC CHR VAL STR MID
- ARG CALL RND LEFT RIGHT DOT SGN SIN FREE PI FN TAN COS POP PEEK INP LN EXP ATN
+ BASIC commands :
+
+ LET NEXT IF GOTO GOSUB RETURN READ DATA FOR CLS INPUT DIM STOP END RESTORE
+ REM CLEAR PUSH POKE PRINT OUT ERROR USR CURSOR NORMAL INVERSE PLOT UNPLOT
+ ELSE WIPE COLOUR CENTRE RANGE DRAW CIRCLE LOAD SAVE VERIFY HLOAD HSAVE HVERIFY
+ DLOAD DSAVE DVERIFY MERGE CAT RUN NEW ON LIST DEF MON GWIND TWIND UNDER
+ SPC OFF TAB THEN TO STEP AND OR XOR NOT ABS LEN SQR INT ASC CHR VAL STR MID
+ ARG CALL RND LEFT RIGHT DOT SGN SIN FREE PI FN TAN COS POP PEEK INP LN EXP ATN
****************************************************************************/
#include "emu.h"
@@ -38,19 +38,19 @@ public:
{ }
required_device<cpu_device> m_maincpu;
-
- virtual void palette_init();
+
+ virtual void palette_init();
virtual void machine_reset() { m_maincpu->set_pc(0x8000); }
-
+
DECLARE_READ8_MEMBER(lola8a_port_a_r);
DECLARE_WRITE8_MEMBER(lola8a_port_b_w);
DECLARE_WRITE_LINE_MEMBER(crtc_vsync);
DECLARE_READ_LINE_MEMBER(cass_r);
DECLARE_WRITE_LINE_MEMBER(cass_w);
-
+
DECLARE_READ8_MEMBER(keyboard_r);
-
-private:
+
+private:
UINT8 m_portb;
required_device<cassette_image_device> m_cass;
};
@@ -58,24 +58,24 @@ private:
static ADDRESS_MAP_START(lola8a_mem, AS_PROGRAM, 8, lola8a_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE( 0x0000, 0x1fff ) AM_RAM // 6264 at G45
- AM_RANGE( 0x2000, 0x3fff ) AM_RAM // 6264 at F45
- // empty place for 6264 at E45
- // empty place for 6264 at D45
+ AM_RANGE( 0x2000, 0x3fff ) AM_RAM // 6264 at F45
+ // empty place for 6264 at E45
+ // empty place for 6264 at D45
AM_RANGE( 0x8000, 0x9fff ) AM_ROM // 2764A at B45
AM_RANGE( 0xa000, 0xbfff ) AM_ROM // 2764A at C45
- AM_RANGE( 0xc000, 0xdfff ) AM_ROM // 2764A at H67
+ AM_RANGE( 0xc000, 0xdfff ) AM_ROM // 2764A at H67
AM_RANGE( 0xe000, 0xffff ) AM_RAM // 6264 at G67
ADDRESS_MAP_END
static ADDRESS_MAP_START(lola8a_io, AS_IO, 8, lola8a_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x80, 0x80) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w)
- AM_RANGE(0x84, 0x84) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w)
- AM_RANGE(0x88, 0x88) AM_READ(keyboard_r)
-
+ AM_RANGE(0x84, 0x84) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w)
+ AM_RANGE(0x88, 0x88) AM_READ(keyboard_r)
+
AM_RANGE(0x90, 0x90) AM_DEVREADWRITE(HD46505SP_TAG, mc6845_device, status_r, address_w)
AM_RANGE(0x92, 0x92) AM_DEVREADWRITE(HD46505SP_TAG, mc6845_device, register_r, register_w)
-
+
ADDRESS_MAP_END
/* Input ports */
@@ -99,8 +99,8 @@ static INPUT_PORTS_START( lola8a )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_2")
+
+ PORT_START("line_2")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)
@@ -109,8 +109,8 @@ static INPUT_PORTS_START( lola8a )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_3")
+
+ PORT_START("line_3")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)
@@ -119,18 +119,18 @@ static INPUT_PORTS_START( lola8a )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_4")
+
+ PORT_START("line_4")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_5")
+
+ PORT_START("line_5")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)
@@ -139,8 +139,8 @@ static INPUT_PORTS_START( lola8a )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_6")
+
+ PORT_START("line_6")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)// Z"
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)
@@ -149,28 +149,28 @@ static INPUT_PORTS_START( lola8a )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_7")
+
+ PORT_START("line_7")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) // C"
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // =
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // =
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // S"
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // C'
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // ;
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_8")
+
+ PORT_START("line_8")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)// /
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // ????
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // :
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // :
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
-
- PORT_START("line_9")
+
+ PORT_START("line_9")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) // return
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) // ????
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // ????
@@ -187,7 +187,7 @@ void lola8a_state::palette_init()
int i;
for(i=0;i<8;i++) {
- palette_set_color_rgb(machine(), i, pal1bit(i >> 1),pal1bit(i >> 2),pal1bit(i >> 0));
+ palette_set_color_rgb(machine(), i, pal1bit(i >> 1),pal1bit(i >> 2),pal1bit(i >> 0));
}
}
@@ -201,7 +201,7 @@ static MC6845_UPDATE_ROW( lola8a_update_row )
{
UINT16 addr = 0xa000 + sx*8 + ra + ma * 8;
UINT8 code = program.read_byte(addr);
-
+
for (int x = 0; x <= 8; x++)
{
int color = BIT(code, 7-x) ? 7 : 0;
@@ -241,15 +241,15 @@ READ8_MEMBER(lola8a_state::keyboard_r)
"line_8", "line_9", NULL, NULL,
NULL,NULL,NULL,NULL
};
-
- if( keynames[m_portb & 0x0f])
+
+ if( keynames[m_portb & 0x0f])
return ioport(keynames[m_portb & 0x0f])->read();
return 0xff;
}
WRITE_LINE_MEMBER(lola8a_state::crtc_vsync)
{
- m_maincpu->set_input_line(I8085_RST75_LINE, state? ASSERT_LINE : CLEAR_LINE);
+ m_maincpu->set_input_line(I8085_RST75_LINE, state? ASSERT_LINE : CLEAR_LINE);
}
static MC6845_INTERFACE( hd46505sp_intf )
@@ -283,12 +283,12 @@ static MACHINE_CONFIG_START( lola8a, lola8a_state )
MCFG_CPU_IO_MAP(lola8a_io)
MCFG_I8085A_SID(READLINE(lola8a_state, cass_r))
MCFG_I8085A_SOD(WRITELINE(lola8a_state, cass_w))
-
+
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_4_9152MHz / 4)
MCFG_SOUND_CONFIG(psg_intf)
MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",1.0)
-
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(50)
@@ -297,7 +297,7 @@ static MACHINE_CONFIG_START( lola8a, lola8a_state )
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_MC6845_ADD(HD46505SP_TAG, HD6845, "screen", XTAL_8MHz / 8, hd46505sp_intf) // HD6845 == HD46505S
- MCFG_PALETTE_LENGTH(8)
+ MCFG_PALETTE_LENGTH(8)
/* Cassette */
MCFG_CASSETTE_ADD( "cassette", default_cassette_interface )
@@ -315,6 +315,5 @@ ROM_END
/* Driver */
-/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
-COMP( 1986, lola8a, 0, 0, lola8a, lola8a, driver_device, 0, "Institut Ivo Lola Ribar", "Lola 8A", GAME_NOT_WORKING)
-
+/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
+COMP( 1986, lola8a, 0, 0, lola8a, lola8a, driver_device, 0, "Institut Ivo Lola Ribar", "Lola 8A", GAME_NOT_WORKING)
diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c
index ef6b0f82e50..30aa24b1157 100644
--- a/src/mess/drivers/mac.c
+++ b/src/mess/drivers/mac.c
@@ -960,7 +960,7 @@ static MACHINE_CONFIG_START( mac512ke, mac_state )
MCFG_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
MCFG_MACKBD_ADD()
- MCFG_MACKBD_CLKOUT_HANDLER(WRITELINE(mac_state, mac_kbd_clk_in))
+ MCFG_MACKBD_CLKOUT_HANDLER(WRITELINE(mac_state, mac_kbd_clk_in))
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
diff --git a/src/mess/drivers/megadriv.c b/src/mess/drivers/megadriv.c
index 484b0602502..b073feeef26 100644
--- a/src/mess/drivers/megadriv.c
+++ b/src/mess/drivers/megadriv.c
@@ -860,4 +860,3 @@ CONS( 1993, wmegam2, xeye, 0, mdj_scd, md, md_cons_state,
CONS( 1994, cdx, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "CDX (USA, NTSC)", GAME_NOT_WORKING )
CONS( 1994, multmega, cdx, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Multi-Mega (Europe, PAL)", GAME_NOT_WORKING )
CONS( 1994, 32x_scd, 0, 0, genesis_32x_scd, md, md_cons_state, genesis, "Sega", "Sega CD (USA, NTSC, w/32X)", GAME_NOT_WORKING )
-
diff --git a/src/mess/drivers/mtx.c b/src/mess/drivers/mtx.c
index 8ee63b95571..305a680c9ce 100644
--- a/src/mess/drivers/mtx.c
+++ b/src/mess/drivers/mtx.c
@@ -456,31 +456,31 @@ COMP( 1984, rs128, mtx512, 0, rs128, mtx512, driver_device, 0,
The following roms are available should they be considered useful:
ROM_START( mtx_roms )
- ROM_LOAD( "assem.rom", CRC(599d5b6b) SHA1(3ec1f7f476a21ca3206012ded22198c020b47f7d) )
- ROM_LOAD( "basic.rom", CRC(d1e9ff36) SHA1(e89ae3a627716e6cee7e35054be8a2472bdd49d4) )
- ROM_LOAD( "boot.rom", CRC(ed98d6dd) SHA1(4671ee49bb96262b0468f7122a49bf2588170903) )
- ROM_LOAD( "mtx3-an.rom", CRC(54c9eca2) SHA1(3e628beaa360e635264c8c2c3a5b8312951a220b) )
- ROM_LOAD( "nboot.rom", CRC(9caea81c) SHA1(93fca6e7ffbc7ae3283b8bda9f01c36b2bed1c54) )
+ ROM_LOAD( "assem.rom", CRC(599d5b6b) SHA1(3ec1f7f476a21ca3206012ded22198c020b47f7d) )
+ ROM_LOAD( "basic.rom", CRC(d1e9ff36) SHA1(e89ae3a627716e6cee7e35054be8a2472bdd49d4) )
+ ROM_LOAD( "boot.rom", CRC(ed98d6dd) SHA1(4671ee49bb96262b0468f7122a49bf2588170903) )
+ ROM_LOAD( "mtx3-an.rom", CRC(54c9eca2) SHA1(3e628beaa360e635264c8c2c3a5b8312951a220b) )
+ ROM_LOAD( "nboot.rom", CRC(9caea81c) SHA1(93fca6e7ffbc7ae3283b8bda9f01c36b2bed1c54) )
ROM_END
-BASIC.ROM this contains the monitor ROM plus the BASIC ROM.
- It's good to view them as one, because the monitor
- ROM contains a good deal of BASIC code and the machine
- code just runs from the monitor ROM into the BASIC ROM.
- It's also handy if you want to disassemble it (which
- you don't need because it's already done).
+BASIC.ROM this contains the monitor ROM plus the BASIC ROM.
+ It's good to view them as one, because the monitor
+ ROM contains a good deal of BASIC code and the machine
+ code just runs from the monitor ROM into the BASIC ROM.
+ It's also handy if you want to disassemble it (which
+ you don't need because it's already done).
-MTX3-AN.ROM the monitor ROM, but slightly modified
- While detecting memory size, the startup code destroys
- RAM content. When you have a lot of RAM it is convenient
- to have a ramdisk for CP/M, but it is a nuisance if the
- ramdisk is trashed at each reset. The modification simply
- prevents RAM trashing.
+MTX3-AN.ROM the monitor ROM, but slightly modified
+ While detecting memory size, the startup code destroys
+ RAM content. When you have a lot of RAM it is convenient
+ to have a ramdisk for CP/M, but it is a nuisance if the
+ ramdisk is trashed at each reset. The modification simply
+ prevents RAM trashing.
-ASSEM.ROM assembler ROM
+ASSEM.ROM assembler ROM
-BOOT.ROM FDX floppy boot ROM
+BOOT.ROM FDX floppy boot ROM
-NBOOT.ROM replacement FDX boot ROM written by M. Kessler (supports
- booting from different disk formats and different drives)
+NBOOT.ROM replacement FDX boot ROM written by M. Kessler (supports
+ booting from different disk formats and different drives)
*/
diff --git a/src/mess/drivers/octopus.c b/src/mess/drivers/octopus.c
index 53cf98f31ad..f0ec2b1ebd5 100644
--- a/src/mess/drivers/octopus.c
+++ b/src/mess/drivers/octopus.c
@@ -23,45 +23,45 @@ CP/M, MP/M (concurrent - multitasking-like OS, even with terminals), or even MS-
with Z80 or 8080. There was also LSI ELSIE system, a concurrent DOS. Last British LSI machines were 386 computers
which could be used as servers for Octopus computers.
-Manufacturer Hilger Analytical / LSI Computers Ltd.
-
-Origin UK
-Year of unit 1986?
-Year of introduction 1985
-End of production ?
-CPU Z80, 8088
-Speed ??
-RAM 256kB
-ROM 16kB (Basic)
-Colors: ??
-Sound: Speaker. Beeps :)
-OS: CP/M 80 or 86
+Manufacturer Hilger Analytical / LSI Computers Ltd.
+
+Origin UK
+Year of unit 1986?
+Year of introduction 1985
+End of production ?
+CPU Z80, 8088
+Speed ??
+RAM 256kB
+ROM 16kB (Basic)
+Colors: ??
+Sound: Speaker. Beeps :)
+OS: CP/M 80 or 86
MP/M 80 o 86
Concurrent CP/M
LSI ELSIE
MS-DOS
-Display modes: Text: ??
-Graphics: ??
-
-Media: Two internal 5.25" floppy disk drives, DS DD, 96tpi.
-Probably hard disk
+Display modes: Text: ??
+Graphics: ??
+
+Media: Two internal 5.25" floppy disk drives, DS DD, 96tpi.
+Probably hard disk
Power supply:
Built-in switching power supply.
-I/O: Serial port
+I/O: Serial port
2 parallel ports
Video TTL Output
Composite video output
-
-Possible upgrades: Many
-
+
+Possible upgrades: Many
+
Software accessibility:
Dedicated: Impossible.
CP/M - Good
DOS - Good.
-
+
It won't take XT nor AT keyboard, but pinout is quite similar. UPDATE: I saw a few photos of keyboard.
It's another Z80 computer! It has an EPROM, simple memory and CPU.
@@ -100,7 +100,7 @@ Enter selection:
This information was gained by studying boot ROM of the machine.
It's a very rare computer. It has 2 processors, Z80 and 8088, so it seems that it may run CP/M and DOS.
-Its BIOS performs POST and halts as there's no keyboard.
+Its BIOS performs POST and halts as there's no keyboard.
****************************************************************************/
diff --git a/src/mess/drivers/onyx.c b/src/mess/drivers/onyx.c
index 40c7088b08d..2d669cb35e5 100644
--- a/src/mess/drivers/onyx.c
+++ b/src/mess/drivers/onyx.c
@@ -249,9 +249,9 @@ static ADDRESS_MAP_START(c8002_mem, AS_PROGRAM, 16, onyx_state)
ADDRESS_MAP_END
//static ADDRESS_MAP_START(c8002_data, AS_DATA, 16, onyx_state)
-// AM_RANGE(0x00000, 0x00fff) AM_ROM AM_SHARE("share0")
-// AM_RANGE(0x01000, 0x07fff) AM_RAM AM_SHARE("share1")
-// AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2")
+// AM_RANGE(0x00000, 0x00fff) AM_ROM AM_SHARE("share0")
+// AM_RANGE(0x01000, 0x07fff) AM_RAM AM_SHARE("share1")
+// AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2")
//ADDRESS_MAP_END
static ADDRESS_MAP_START(c8002_io, AS_IO, 8, onyx_state)
diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c
index b14bc21b29e..59a4694782f 100644
--- a/src/mess/drivers/pc9801.c
+++ b/src/mess/drivers/pc9801.c
@@ -83,8 +83,8 @@
- Bishoujo Shanshinkan: has white rectangles all over the place;
- Bishoujo Tsuushin: hangs with a beep while writing some intro text;
- - Bomber Quest: beeps when speech is supposed to be played (0->1 to i/o port 0xfe8e?)
- - Deflektor: no sound, moans about a DIP-sw during loading, very slow on non-pc9801rs machines;
+ - Bomber Quest: beeps when speech is supposed to be played (0->1 to i/o port 0xfe8e?)
+ - Deflektor: no sound, moans about a DIP-sw during loading, very slow on non-pc9801rs machines;
- Dragon Buster: slight issue with window masking;
- Far Side Moon: doesn't detect sound board (tied to 0x00ec ports)
- Jan Borg Suzume: gets stuck at a pic8259 read;
@@ -92,17 +92,17 @@
- Lovely Horror: Doesn't show kanji, tries to read it thru the 0xa9 port;
- Madou Monogatari 1/2/3: doesn't display bitmap gfxs during gameplay;
- Quarth: should do a split screen effect, it doesn't hence there are broken gfxs
- - Princess Maker 2: mouse is buggy;
+ - Princess Maker 2: mouse is buggy;
- Princess Maker 2: screen transitions are very ugly (btanb?)
- - Puyo Puyo: beeps out when it's supposed to play samples, Not supposed to use ADPCM, is it a PIT issue?
- - Puzznic: trips illegal irq 0x41 (?), prints an error on screen. (PC-9801RS only, writes an 1 to 0x69d2f for whatever reason, almost surely a btanb)
- - Runner's High: wrong double height on the title screen;
- - Sokoban Perfect: hangs at title screen, after loading the menu;
+ - Puyo Puyo: beeps out when it's supposed to play samples, Not supposed to use ADPCM, is it a PIT issue?
+ - Puzznic: trips illegal irq 0x41 (?), prints an error on screen. (PC-9801RS only, writes an 1 to 0x69d2f for whatever reason, almost surely a btanb)
+ - Runner's High: wrong double height on the title screen;
+ - Sokoban Perfect: hangs at title screen, after loading the menu;
- Sorcerian, Twilight Zone 3: Fails initial booting, issue with 2dd irq?
- - The Incredible Machine: hangs at main menu (YM mis-fires irq?)
+ - The Incredible Machine: hangs at main menu (YM mis-fires irq?)
- Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press);
- Uno: uses EGC
- - Viper V16 Demo: moans with a JP message;
+ - Viper V16 Demo: moans with a JP message;
per-game TODO (PC-9821):
- Battle Skin Panic: gfx bugs at the Gainax logo, it crashes after it;
@@ -323,7 +323,7 @@ IDE:
0x432: IDE drive switch
0x435: <unknown>
- (ISA correlated i/o)
+ (ISA correlated i/o)
----------------------------------------------------------
0x0640 |WORD|R/W|Data Register |01F0h
0x0642 |BYTE| R |Error Register |01F1h
@@ -2291,15 +2291,15 @@ WRITE8_MEMBER(pc9801_state::pc9801rs_ide_io_0_w)
/*
[0x430]
[Read/write]
- bit 7-0: unknown
- 00 h = IDE Bank # 1
- 01 h = IDE Bank # 2
+ bit 7-0: unknown
+ 00 h = IDE Bank # 1
+ 01 h = IDE Bank # 2
[0x432]
- bit 7-0: Bank select
- 80 h = readout for dummy (only [WRITE])
- 00 h = IDE Bank # 1 choice
- 01 h = IDE Bank # 2 selection
+ bit 7-0: Bank select
+ 80 h = readout for dummy (only [WRITE])
+ 00 h = IDE Bank # 1 choice
+ 01 h = IDE Bank # 2 selection
*/
printf("IDE w %02x %02x\n",offset,data);
@@ -3828,7 +3828,7 @@ static MACHINE_CONFIG_DERIVED( pc9801ux, pc9801rs )
MCFG_80286_A20(pc9801_state, pc9801_286_a20)
MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq)
-// MCFG_I8237_REPLACE("i8237", 10000000, pc9801rs_dmac_intf) // unknown clock
+// MCFG_I8237_REPLACE("i8237", 10000000, pc9801rs_dmac_intf) // unknown clock
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( pc9801bx2, pc9801rs )
diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c
index 3c29694e2a8..e21e5dbf63b 100644
--- a/src/mess/drivers/rainbow.c
+++ b/src/mess/drivers/rainbow.c
@@ -5,28 +5,28 @@
Driver-in-progress by R. Belmont and Miodrag Milanovic with additions by Karl-Ludwig Deisenhofer.
STATE AS OF SEPTEMBER 2013
- --------------------------
- - FATAL: keyboard emulation needs love (inhibits the system from booting with ERROR 50 on cold or ERROR 13 on warm boot).
- - NOT WORKING: serial (ERROR 60)
- - NOT WORKING: printer interface (ERROR 40).
+ --------------------------
+ - FATAL: keyboard emulation needs love (inhibits the system from booting with ERROR 50 on cold or ERROR 13 on warm boot).
+ - NOT WORKING: serial (ERROR 60)
+ - NOT WORKING: printer interface (ERROR 40).
- - NON-CRITICAL: NVRAM currently saves changes instantly. A switch to EEPROM (load, store...) might be in order.
- - NON-CRITICAL: no code for W18 (DSR) jumper.
- - NON-CRITICAL: watchdog logic not implemented. MHFLU - ERROR 16 indicated hardware problems or (most often) software crashes on real hardware.
+ - NON-CRITICAL: NVRAM currently saves changes instantly. A switch to EEPROM (load, store...) might be in order.
+ - NON-CRITICAL: no code for W18 (DSR) jumper.
+ - NON-CRITICAL: watchdog logic not implemented. MHFLU - ERROR 16 indicated hardware problems or (most often) software crashes on real hardware.
+
+ - FUTURE IMPROVEMENTS (=> DIP switches currently disabled):
+ * Color graphics option (NEC 7220)
+ * Extended communication option ( = Bundle option ?)
- - FUTURE IMPROVEMENTS (=> DIP switches currently disabled):
- * Color graphics option (NEC 7220)
- * Extended communication option ( = Bundle option ?)
-
Meaning of Diagnostics LEDs (from PC100ESV1.PDF found, e.g.,
on ftp://ftp.update.uu.se/pub/rainbow/doc/rainbow-docs/
- Internal Diagnostic Messages F
+ Internal Diagnostic Messages F
Msg Message Lights Display A
No. * = on o = off T
- = on or off A
- 1 2 3 4 5 6 7 L
+ 1 2 3 4 5 6 7 L
--------------------------------------------------------------
1 Main Board (Video) o * * o * o * Yes
2 Main Board* (unsolicited interrupt) * * * * o * o Yes
@@ -74,7 +74,7 @@
PCB layout
----------
-DEC-100 model B
+DEC-100 model B
PCB # 5416206 / 5016205-01C1:
@@ -125,7 +125,7 @@ W17 pulls J1 serial port pin 1 to GND when set (otherwise pin unconnected)
#include "rainbow.lh" // BEZEL - LAYOUT with LEDs for diag 1-7, keyboard 8-11 and floppy 20-21
-#define DEC_B_NVMEM_SIZE (256)
+#define DEC_B_NVMEM_SIZE (256)
class rainbow_state : public driver_device
{
@@ -161,8 +161,8 @@ public:
required_ioport m_inp6;
required_ioport m_inp7;
required_ioport m_inp8;
-
- required_device<beep_device> m_beep;
+
+ required_device<beep_device> m_beep;
required_device<rainbow_video_device> m_crtc;
required_device<cpu_device> m_i8088;
@@ -185,7 +185,7 @@ public:
DECLARE_READ8_MEMBER(comm_control_r);
DECLARE_WRITE8_MEMBER(comm_control_w);
-
+
DECLARE_READ8_MEMBER(share_z80_r);
DECLARE_WRITE8_MEMBER(share_z80_w);
@@ -193,10 +193,10 @@ public:
DECLARE_WRITE8_MEMBER(floating_bus_w);
// EMULATOR TRAP TO INTERCEPT KEYBOARD cmd in AH and PARAMETER in AL (port 90 = AL / port 91 = AH)
- // TODO: beeper and led handling should better be handled by LK201 code.
+ // TODO: beeper and led handling should better be handled by LK201 code.
DECLARE_WRITE8_MEMBER(PORT90_W);
DECLARE_WRITE8_MEMBER(PORT91_W);
-
+
DECLARE_READ8_MEMBER(i8088_latch_r);
DECLARE_WRITE8_MEMBER(i8088_latch_w);
DECLARE_READ8_MEMBER(z80_latch_r);
@@ -204,10 +204,10 @@ public:
DECLARE_WRITE8_MEMBER(z80_diskdiag_read_w);
DECLARE_WRITE8_MEMBER(z80_diskdiag_write_w);
-
+
DECLARE_WRITE8_MEMBER(z80_diskcontrol_write_w);
DECLARE_READ8_MEMBER(system_parameter_r);
-
+
DECLARE_READ_LINE_MEMBER(kbd_rx);
DECLARE_WRITE_LINE_MEMBER(kbd_tx);
DECLARE_WRITE_LINE_MEMBER(kbd_rxready_w);
@@ -218,7 +218,7 @@ public:
bool m_zflip; // Z80 alternate memory map with A15 inverted
bool m_z80_halted;
bool m_kbd_tx_ready, m_kbd_rx_ready;
-
+
int m_KBD;
int m_beep_counter;
@@ -236,7 +236,7 @@ public:
};
void rainbow_state::machine_start()
-{ m_COLDBOOT = true;
+{ m_COLDBOOT = true;
save_item(NAME(m_z80_private));
save_item(NAME(m_z80_mailbox));
@@ -249,25 +249,25 @@ void rainbow_state::machine_start()
// Enables PORT90_W + PORT91_W via BIOS call (offset +$21 in HIGH ROM)
// F8 / FC ROM REGION (CHECK + PATCH)
- if(rom[0xfc000 + 0x0022] == 0x22 && rom[0xfc000 + 0x0023] == 0x28)
+ if(rom[0xfc000 + 0x0022] == 0x22 && rom[0xfc000 + 0x0023] == 0x28)
{
rom[0xf4303]=0x00; // Disable CRC CHECK (F0 / F4 ROM)
rom[0xfc000 + 0x0022] =0xe2; // jmp to offset $3906
rom[0xfc000 + 0x0023] =0x38;
-
+
rom[0xfc000 + 0x3906] =0xe6; // out 90,al
rom[0xfc000 + 0x3907] =0x90;
-
+
rom[0xfc000 + 0x3908] =0x86; // xchg al,ah
rom[0xfc000 + 0x3909] =0xc4;
rom[0xfc000 + 0x390a] =0xe6; // out 91,al
rom[0xfc000 + 0x390b] =0x91;
-
+
rom[0xfc000 + 0x390c] =0x86; // xchg al,ah
rom[0xfc000 + 0x390d] =0xc4;
-
+
rom[0xfc000 + 0x390e] =0xe9; // jmp (original jump offset $2846)
rom[0xfc000 + 0x390f] =0x35;
rom[0xfc000 + 0x3910] =0xef;
@@ -279,18 +279,18 @@ static ADDRESS_MAP_START( rainbow8088_map, AS_PROGRAM, 8, rainbow_state)
AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_SHARE("sh_ram")
AM_RANGE(0x10000, 0x1ffff) AM_RAM
- // test at f4e00 - f4e1c
- AM_RANGE(0x20000, 0xdffff) AM_READWRITE(floating_bus_r,floating_bus_w)
- AM_RANGE(0x20000, 0xdffff) AM_RAM
+ // test at f4e00 - f4e1c
+ AM_RANGE(0x20000, 0xdffff) AM_READWRITE(floating_bus_r,floating_bus_w)
+ AM_RANGE(0x20000, 0xdffff) AM_RAM
// TODO: handle shadowing 100% correctly.
// PDF says there is a 256 x 4 bit NVRAM from 0xed000 to 0xed040.
- // * SHOULD * be shadowed from $ec00 - $ecfff AND FROM $ed040 - $edfff.
+ // * SHOULD * be shadowed from $ec00 - $ecfff AND FROM $ed040 - $edfff.
// "address bits 8-12 are not decoded when accessing the NVM"
// ROM code gives an error if NVRAM isn't 256 x 8 bit
// with address bits 8-12 ignored, so do that.
- AM_RANGE(0xec000, 0xec0ff) AM_MIRROR(0x1f00) AM_RAM AM_SHARE("nvram")
+ AM_RANGE(0xec000, 0xec0ff) AM_MIRROR(0x1f00) AM_RAM AM_SHARE("nvram")
AM_RANGE(0xee000, 0xeffff) AM_RAM AM_SHARE("p_ram")
AM_RANGE(0xf0000, 0xfffff) AM_ROM
@@ -300,22 +300,22 @@ static ADDRESS_MAP_START( rainbow8088_io , AS_IO, 8, rainbow_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE (0x00, 0x00) AM_READWRITE(i8088_latch_r, i8088_latch_w)
-
+
// 0x02 Communication status / control register (8088)
AM_RANGE (0x02, 0x02) AM_READWRITE(comm_control_r, comm_control_w)
// 0x04 Video processor DC011
AM_RANGE (0x04, 0x04) AM_DEVWRITE("vt100_video", rainbow_video_device, dc011_w)
-
+
AM_RANGE (0x08, 0x08) AM_READ(system_parameter_r)
-
+
AM_RANGE (0x0a, 0x0a) AM_READWRITE(diagnostic_r, diagnostic_w)
// 0x0C Video processor DC012
AM_RANGE (0x0c, 0x0c) AM_DEVWRITE("vt100_video", rainbow_video_device, dc012_w)
AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("kbdser", i8251_device, data_r, data_w)
AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("kbdser", i8251_device, status_r, control_w)
-
+
AM_RANGE (0x90, 0x90) AM_WRITE(PORT90_W)
AM_RANGE (0x91, 0x91) AM_WRITE(PORT91_W)
ADDRESS_MAP_END
@@ -340,13 +340,13 @@ ADDRESS_MAP_END
/* Input ports */
static INPUT_PORTS_START( rainbow )
- PORT_START("FLOPPY CONTROLLER")
- PORT_DIPNAME( 0x02, 0x02, "FLOPPY CONTROLLER") PORT_TOGGLE
+ PORT_START("FLOPPY CONTROLLER")
+ PORT_DIPNAME( 0x02, 0x02, "FLOPPY CONTROLLER") PORT_TOGGLE
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_START("MEMORY PRESENT")
- PORT_DIPNAME( 0xF000, 0x2000, "MEMORY PRESENT")
+ PORT_DIPNAME( 0xF000, 0x2000, "MEMORY PRESENT")
PORT_DIPSETTING( 0x2000, "128 K (BOARD DEFAULT)" ) // NOTE: 0x2000 hard coded in 'system_parameter_r'
PORT_DIPSETTING( 0x3000, "192 K (MEMORY OPTION)" )
PORT_DIPSETTING( 0x4000, "256 K (MEMORY OPTION)" )
@@ -361,29 +361,29 @@ static INPUT_PORTS_START( rainbow )
PORT_DIPSETTING( 0xD000, "832 K (MEMORY OPTION)" )
PORT_DIPSETTING( 0xE000, "896 K (MEMORY OPTION)" )
- PORT_START("GRAPHICS OPTION")
- PORT_DIPNAME( 0x00, 0x00, "GRAPHICS OPTION") PORT_TOGGLE
+ PORT_START("GRAPHICS OPTION")
+ PORT_DIPNAME( 0x00, 0x00, "GRAPHICS OPTION") PORT_TOGGLE
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x04, DEF_STR( On ) )
- PORT_START("BUNDLE OPTION")
- PORT_DIPNAME( 0x00, 0x00, "BUNDLE OPTION") PORT_TOGGLE
+ PORT_START("BUNDLE OPTION")
+ PORT_DIPNAME( 0x00, 0x00, "BUNDLE OPTION") PORT_TOGGLE
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
-
+
PORT_START("W13")
- PORT_DIPNAME( 0x02, 0x02, "W13") PORT_TOGGLE
+ PORT_DIPNAME( 0x02, 0x02, "W13") PORT_TOGGLE
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("W14")
- PORT_DIPNAME( 0x04, 0x04, "W14") PORT_TOGGLE
+ PORT_DIPNAME( 0x04, 0x04, "W14") PORT_TOGGLE
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("W15")
- PORT_DIPNAME( 0x08, 0x08, "W15") PORT_TOGGLE
+ PORT_DIPNAME( 0x08, 0x08, "W15") PORT_TOGGLE
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("W18")
- PORT_DIPNAME( 0x00, 0x04, "W18") PORT_TOGGLE
+ PORT_DIPNAME( 0x00, 0x04, "W18") PORT_TOGGLE
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
@@ -398,12 +398,12 @@ void rainbow_state::machine_reset()
m_kbd_tx_ready = m_kbd_rx_ready = false;
m_kbd8251->input_callback(SERIAL_STATE_CTS); // raise clear to send
-
- m_KBD = 0;
+
+ m_KBD = 0;
m_beep->set_frequency(2000);
- m_beep->set_state(0);
-
+ m_beep->set_state(0);
+
// RESET ALL LEDs
output_set_value("led1", 1);
output_set_value("led2", 1);
@@ -416,7 +416,7 @@ void rainbow_state::machine_reset()
output_set_value("led9", 1);
output_set_value("led10", 1);
output_set_value("led11", 1);
-
+
output_set_value("led20", 1); // DRIVE 0 (A)
output_set_value("led21", 1); // DRIVE 1 (B)
}
@@ -431,21 +431,21 @@ UINT32 rainbow_state::screen_update_rainbow(screen_device &screen, bitmap_ind16
// WANTED: is a cleaner, more compatible way feasible?
READ8_MEMBER(rainbow_state::floating_bus_r)
{
- if ( m_maincpu->state_int(I8086_CS) != 0xF400)
- return space.read_byte(offset);
+ if ( m_maincpu->state_int(I8086_CS) != 0xF400)
+ return space.read_byte(offset);
- if ( m_maincpu->state_int(I8086_DS) < m_inp8->read() )
- {
- return space.read_byte(offset);
- } else
- {
- return (offset>>16) + 2;
- }
+ if ( m_maincpu->state_int(I8086_DS) < m_inp8->read() )
+ {
+ return space.read_byte(offset);
+ } else
+ {
+ return (offset>>16) + 2;
+ }
}
WRITE8_MEMBER(rainbow_state::floating_bus_w)
{
- space.write_byte(offset,data);
+ space.write_byte(offset,data);
}
@@ -507,31 +507,31 @@ WRITE8_MEMBER(rainbow_state::share_z80_w)
READ8_MEMBER(rainbow_state::system_parameter_r)
{
-/* Info about option boards is in bits 0 - 3:
+/* Info about option boards is in bits 0 - 3:
Bundle card (1) | Floppy (2) | Graphics (4) | Memory option (8)
- 0 1 2 3 4 5 6 7
+ 0 1 2 3 4 5 6 7
B F G M
( 1 means NOT present )
*/
// Hard coded value 0x2000 - see DIP switch setup!
- return 0x0f - m_inp5->read() - m_inp6->read() - m_inp7->read() - (
- (m_inp8->read() > 0x2000) ? 8 : 0
- );
+ return 0x0f - m_inp5->read() - m_inp6->read() - m_inp7->read() - (
+ (m_inp8->read() > 0x2000) ? 8 : 0
+ );
}
READ8_MEMBER(rainbow_state::comm_control_r)
{
- // Our simple COLDBOOT flag is adequate for the initial MHFU test (at BIOS location 00A8).
+ // Our simple COLDBOOT flag is adequate for the initial MHFU test (at BIOS location 00A8).
- // TODO: on real hardware, MHFU detection is disabled BY WRITING TO 0x10c (=> BIOS assumes power-up reset)
- // MHFU is enabled by writing to 0x0c.
- if (m_COLDBOOT)
- { m_COLDBOOT = 0;
- return ( 0x20 ); // bit 5 = watchdog detect.
- } else {
- return ( 0x00 ); // ERROR 16 is displayed = watchdog triggered
- }
+ // TODO: on real hardware, MHFU detection is disabled BY WRITING TO 0x10c (=> BIOS assumes power-up reset)
+ // MHFU is enabled by writing to 0x0c.
+ if (m_COLDBOOT)
+ { m_COLDBOOT = 0;
+ return ( 0x20 ); // bit 5 = watchdog detect.
+ } else {
+ return ( 0x00 ); // ERROR 16 is displayed = watchdog triggered
+ }
}
WRITE8_MEMBER(rainbow_state::comm_control_w)
@@ -544,9 +544,9 @@ WRITE8_MEMBER(rainbow_state::comm_control_w)
-4--5--6--7- <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart)
*/
output_set_value("led4", BIT(data, 5)); // LED "D6"
- output_set_value("led5", BIT(data, 7)); // LED "D5"
+ output_set_value("led5", BIT(data, 7)); // LED "D5"
output_set_value("led6", BIT(data, 6)); // LED "D4"
- output_set_value("led7", BIT(data, 4)); // LED "D3"
+ output_set_value("led7", BIT(data, 4)); // LED "D3"
// printf("%02x to COMM.CONTROL REGISTER\n", data);
}
@@ -554,53 +554,53 @@ WRITE8_MEMBER(rainbow_state::comm_control_w)
// EMULATOR TRAP (patched into ROM @ machine_start) via BIOS : call / offset +$21 (AL / AH)
WRITE8_MEMBER(rainbow_state::PORT90_W)
{
- //printf("KBD COMMAND : %02x to AL (90)\n", data);
-
+ //printf("KBD COMMAND : %02x to AL (90)\n", data);
+
m_KBD = 0; // reset previous command.
- if (data == 0xfd) { // Powerup (beep)
- m_beep->set_state(1);
- m_beep_counter=600; // BELL = 125 ms
+ if (data == 0xfd) { // Powerup (beep)
+ m_beep->set_state(1);
+ m_beep_counter=600; // BELL = 125 ms
}
- if (data == 0xa7) {
- m_beep->set_state(1);
- m_beep_counter=600; // BELL = 125 ms
+ if (data == 0xa7) {
+ m_beep->set_state(1);
+ m_beep_counter=600; // BELL = 125 ms
}
if (data == 0x9f) { // emit a keyclick (2ms)
- m_beep->set_state(1);
+ m_beep->set_state(1);
m_beep_counter=25; // longer than calculated ( 9,6 )
}
- if (data == 0x13) { // light LEDs -
- m_KBD = 0x13;
+ if (data == 0x13) { // light LEDs -
+ m_KBD = 0x13;
}
- if (data == 0x11) { // switch off LEDs -
- m_KBD = 0x11;
+ if (data == 0x11) { // switch off LEDs -
+ m_KBD = 0x11;
}
}
WRITE8_MEMBER(rainbow_state::PORT91_W)
{
- //printf("KBD PARAM %02x to AH (91) \n", data);
-
- // 4 leds, represented in the low 4 bits of a byte
- if (m_KBD == 0x13) { // light LEDs -
- if (data & 1) { output_set_value("led8", 0); } // KEYBOARD : "Wait" LED
+ //printf("KBD PARAM %02x to AH (91) \n", data);
+
+ // 4 leds, represented in the low 4 bits of a byte
+ if (m_KBD == 0x13) { // light LEDs -
+ if (data & 1) { output_set_value("led8", 0); } // KEYBOARD : "Wait" LED
if (data & 2) { output_set_value("led9", 0); } // KEYBOARD : "Compose" LED
if (data & 4) { output_set_value("led10", 0); } // KEYBOARD : "Lock" LED
if (data & 8) { output_set_value("led11", 0); } // KEYBOARD : "Hold" LED
m_KBD = 0; // reset previous command.
}
- if (m_KBD == 0x11) { // switch off LEDs -
- if (data & 1) { output_set_value("led8", 1); } // KEYBOARD : "Wait" LED
+ if (m_KBD == 0x11) { // switch off LEDs -
+ if (data & 1) { output_set_value("led8", 1); } // KEYBOARD : "Wait" LED
if (data & 2) { output_set_value("led9", 1); } // KEYBOARD : "Compose" LED
if (data & 4) { output_set_value("led10", 1); } // KEYBOARD : "Lock" LED
if (data & 8) { output_set_value("led11", 1); } // KEYBOARD : "Hold" LED
m_KBD = 0; // reset previous command.
}
-
+
if (m_KBD == 0x1b) { /* enable the keyclick */
/* max volume is 0, lowest is 0x7 */
m_KBD = 0; // reset previous command.
@@ -644,8 +644,8 @@ WRITE8_MEMBER(rainbow_state::z80_diskdiag_write_w)
{
/* Z80 LEDs:
4 5 6 <- bit #
- D11 D10 -D9 <- INTERNAL LED NUMBER (see PDF)
- -1 --2-- 3 <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart)
+ D11 D10 -D9 <- INTERNAL LED NUMBER (see PDF)
+ -1 --2-- 3 <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart)
*/
output_set_value("led1", BIT(data, 4)); // LED "D11"
output_set_value("led2", BIT(data, 5)); // LED "D10"
@@ -656,19 +656,19 @@ WRITE8_MEMBER(rainbow_state::z80_diskdiag_write_w)
WRITE8_MEMBER(rainbow_state::z80_diskcontrol_write_w)
{
- //printf("%02x to z80 DISK CONTROL (W)\n", data);
+ //printf("%02x to z80 DISK CONTROL (W)\n", data);
- // TODO: this logic is a bit primitive. According to the spec, the RX-50 drive LED only turns on if
+ // TODO: this logic is a bit primitive. According to the spec, the RX-50 drive LED only turns on if
// (a) spindle motor runs (b) disk is in drive (c) door closed (d) drive side is selected
- if ( (data & 1) && (data & 8) )
- output_set_value("led20", 0); // DISKETTE 0 SELECTED & MOTOR 0 ON => LIGHT "DRIVE A"
+ if ( (data & 1) && (data & 8) )
+ output_set_value("led20", 0); // DISKETTE 0 SELECTED & MOTOR 0 ON => LIGHT "DRIVE A"
else
- output_set_value("led20", 1);
+ output_set_value("led20", 1);
- if ( (data & 2) && (data & 8) )
- output_set_value("led21", 0); // DISKETTE 1 SELECTED & MOTOR 0 ON => LIGHT "DRIVE B"
+ if ( (data & 2) && (data & 8) )
+ output_set_value("led21", 0); // DISKETTE 1 SELECTED & MOTOR 0 ON => LIGHT "DRIVE B"
else
- output_set_value("led21", 1);
+ output_set_value("led21", 1);
}
READ8_MEMBER( rainbow_state::read_video_ram_r )
@@ -691,9 +691,9 @@ READ8_MEMBER( rainbow_state::diagnostic_r )
// printf("%02x DIP value ORed to diagnostic\n", ( m_inp1->read() | m_inp2->read() | m_inp3->read() ) );
return ( (m_diagnostic & (0xf1)) | ( m_inp1->read() |
- m_inp2->read() |
- m_inp3->read() )
- );
+ m_inp2->read() |
+ m_inp3->read() )
+ );
}
WRITE8_MEMBER( rainbow_state::diagnostic_w )
@@ -758,14 +758,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::keyboard_tick)
{
m_kbd8251->transmit_clock();
m_kbd8251->receive_clock();
-
- if (m_beep_counter > 1)
- m_beep_counter--;
- else
- if ( m_beep_counter == 1 )
+
+ if (m_beep_counter > 1)
+ m_beep_counter--;
+ else
+ if ( m_beep_counter == 1 )
{ m_beep->set_state(0);
- m_beep_counter = 0;
- }
+ m_beep_counter = 0;
+ }
}
static const vt_video_interface video_interface =
@@ -852,7 +852,7 @@ static MACHINE_CONFIG_START( rainbow, rainbow_state )
MCFG_PALETTE_LENGTH(3)
MCFG_PALETTE_INIT_OVERRIDE(driver_device, monochrome_amber)
MCFG_RAINBOW_VIDEO_ADD("vt100_video", video_interface)
-
+
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("beeper", BEEP, 0)
diff --git a/src/mess/drivers/sbc6510.c b/src/mess/drivers/sbc6510.c
index 2ee572fd0ac..c1c7a847472 100644
--- a/src/mess/drivers/sbc6510.c
+++ b/src/mess/drivers/sbc6510.c
@@ -284,7 +284,7 @@ static MACHINE_CONFIG_START( sbc6510, sbc6510_state )
MCFG_CPU_PROGRAM_MAP(sbc6510_mem)
MCFG_CPU_ADD("videocpu",ATMEGA88, XTAL_16MHz)
-// MCFG_DEVICE_DISABLE() // trips SLEEP opcode, needs to be emulated
+// MCFG_DEVICE_DISABLE() // trips SLEEP opcode, needs to be emulated
MCFG_CPU_AVR8_CONFIG(atmega88_config)
MCFG_CPU_PROGRAM_MAP(sbc6510_video_mem)
MCFG_CPU_DATA_MAP(sbc6510_video_data)
diff --git a/src/mess/drivers/segapico.c b/src/mess/drivers/segapico.c
index 8eed241ce82..3b44bb4376c 100644
--- a/src/mess/drivers/segapico.c
+++ b/src/mess/drivers/segapico.c
@@ -21,32 +21,32 @@ Pico mainboard (PAL version)
| | | +-+ |
| | | +--+ |B| +-+ |
| | | |A3| +-+ | | |
-| +------------------------------+ +--+ |C| +-|
+| +------------------------------+ +--+ |C| +-|
| | | | |
| GCMK-C2X +-+ | --> PEN
-| +-----+ +--+ +-|
-| | | |A3| +--------+ |
-| | A1 | +--+ | | +---------+ |
+| +-----+ +--+ +-|
+| | | |A3| +--------+ |
+| | A1 | +--+ | | +---------+ |
| SEGA | | | A2 | |HM53861J | |
-| 1994 837-10846 +-----+ | | | | |
-| IAC MAIN PAL +--------+ +---------+ |
+| 1994 837-10846 +-----+ | | | | |
+| IAC MAIN PAL +--------+ +---------+ |
| MADE IN JAPAN +----+ |
-| VA0 +----------+ |XTAL| +--+
-| | SEGA | +---------+ | | | <-- VCC IN
+| VA0 +----------+ |XTAL| +--+
+| | SEGA | +---------+ | | | <-- VCC IN
| | 315-5640 | |MC68HC000| |53.2| +--+
-| | 9434 W51 | |FN8-A | +----+ |00 | +----------+ |
-| | | | | | | +----+ | SEGA | |
-| | | | 2B89N | | | | 315-5313A| |
-| | | |S0AH9425A| | A4 | | F1001 | +--|
-| +----------+ +---------+ | | | | | |
+| | 9434 W51 | |FN8-A | +----+ |00 | +----------+ |
+| | | | | | | +----+ | SEGA | |
+| | | | 2B89N | | | | 315-5313A| |
+| | | |S0AH9425A| | A4 | | F1001 | +--|
+| +----------+ +---------+ | | | | | |
| | | |9428 LAGG | | --> VIDEO OUT
| | | | | | |
-| +----+ +----------+ +--|
+| +----+ +----------+ +--|
| |
| +----------------------------+ |
| ||||||CARTRIDGE CONNECTOR||||| |
| +----------------------------+ |
-| |
+| |
+------------------------------------------------------------------------------------------------------------+
A1 = SEGA / 315-5641 / D77591 / 9442CA010
@@ -130,7 +130,7 @@ class pico_base_state : public md_cons_state
{
public:
pico_base_state(const machine_config &mconfig, device_type type, const char *tag)
- : md_cons_state(mconfig, type, tag),
+ : md_cons_state(mconfig, type, tag),
m_upd7759(*this, "7759") { }
optional_device<upd7759_device> m_upd7759;
@@ -271,7 +271,7 @@ READ16_MEMBER(pico_base_state::pico_68k_io_read )
static void sound_cause_irq( device_t *device, int chip )
{
pico_base_state *state = device->machine().driver_data<pico_base_state>();
-// printf("sound irq\n");
+// printf("sound irq\n");
/* upd7759 callback */
state->m_maincpu->set_input_line(3, HOLD_LINE);
}
@@ -285,11 +285,10 @@ const upd775x_interface pico_upd7759_interface =
WRITE16_MEMBER(pico_base_state::pico_68k_io_write )
{
-// printf("pico_68k_io_write %04x %04x %04x\n", offset*2, data, mem_mask);
+// printf("pico_68k_io_write %04x %04x %04x\n", offset*2, data, mem_mask);
switch (offset)
{
-
case 0x12/2: // guess
m_upd7759->reset_w(0);
m_upd7759->start_w(0);
@@ -471,11 +470,11 @@ MMG-1
| |FL-1| |FL-1| | | | E |
| |0 | |0 | | | | D |
| | | | | | | | |
- |--+ +----+ +----+ +-------------+ | |
+ |--+ +----+ +----+ +-------------+ | |
+-- | | C |
| |--+ | O |
S-AUDIO <-| | +-----------+ +-------+ | N |
- | |--+ | SEGA | | SEGA | +-----------+ | N |
+ | |--+ | SEGA | | SEGA | +-----------+ | N |
+-- | | 315-5640 | |315-564| | 3D4 UA | | E |
|--+ | 9333 W26 | |1 | |HD68HC000CP| | C |
| | | |D77591 | |8 | | T |
diff --git a/src/mess/drivers/studio2.c b/src/mess/drivers/studio2.c
index 919771590a1..2418263a2b4 100644
--- a/src/mess/drivers/studio2.c
+++ b/src/mess/drivers/studio2.c
@@ -434,7 +434,7 @@ WRITE8_MEMBER( visicom_state::dma_w )
{
int sx = m_screen->hpos() + 4;
int y = m_screen->vpos();
-
+
UINT8 addr = offset & 0xff;
UINT8 color0 = m_color0_ram[addr];
UINT8 color1 = m_color1_ram[addr];
@@ -695,12 +695,12 @@ DRIVER_INIT_MEMBER(studio2_state,studio2)
/* Game Drivers */
-// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS
-CONS( 1977, studio2, 0, 0, studio2, studio2, studio2_state, studio2, "RCA", "Studio II", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
-CONS( 1978, visicom, studio2,0, visicom, studio2, studio2_state, studio2, "Toshiba", "Visicom COM-100 (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
-CONS( 1978, mpt02, studio2,0, mpt02, studio2, studio2_state, studio2, "Soundic", "Victory MPT-02 Home TV Programmer (Austria)", GAME_SUPPORTS_SAVE )
-CONS( 1978, mpt02h, studio2,0, mpt02, studio2, studio2_state, studio2, "Hanimex", "MPT-02 Jeu TV Programmable (France)", GAME_SUPPORTS_SAVE )
-CONS( 1978, mtc9016, studio2,0, mpt02, studio2, studio2_state, studio2, "Mustang", "9016 Telespiel Computer (Germany)", GAME_SUPPORTS_SAVE )
-CONS( 1978, shmc1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Sheen", "1200 Micro Computer (Australia)", GAME_SUPPORTS_SAVE )
-CONS( 1978, cm1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Conic", "M-1200 (?)", GAME_SUPPORTS_SAVE )
-CONS( 1978, apollo80, studio2,0, mpt02, studio2, studio2_state, studio2, "Academy", "Apollo 80 (Germany)", GAME_SUPPORTS_SAVE )
+// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS
+CONS( 1977, studio2, 0, 0, studio2, studio2, studio2_state, studio2, "RCA", "Studio II", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
+CONS( 1978, visicom, studio2,0, visicom, studio2, studio2_state, studio2, "Toshiba", "Visicom COM-100 (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
+CONS( 1978, mpt02, studio2,0, mpt02, studio2, studio2_state, studio2, "Soundic", "Victory MPT-02 Home TV Programmer (Austria)", GAME_SUPPORTS_SAVE )
+CONS( 1978, mpt02h, studio2,0, mpt02, studio2, studio2_state, studio2, "Hanimex", "MPT-02 Jeu TV Programmable (France)", GAME_SUPPORTS_SAVE )
+CONS( 1978, mtc9016, studio2,0, mpt02, studio2, studio2_state, studio2, "Mustang", "9016 Telespiel Computer (Germany)", GAME_SUPPORTS_SAVE )
+CONS( 1978, shmc1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Sheen", "1200 Micro Computer (Australia)", GAME_SUPPORTS_SAVE )
+CONS( 1978, cm1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Conic", "M-1200 (?)", GAME_SUPPORTS_SAVE )
+CONS( 1978, apollo80, studio2,0, mpt02, studio2, studio2_state, studio2, "Academy", "Apollo 80 (Germany)", GAME_SUPPORTS_SAVE )
diff --git a/src/mess/drivers/supracan.c b/src/mess/drivers/supracan.c
index f1ec608195d..a85aa12558a 100644
--- a/src/mess/drivers/supracan.c
+++ b/src/mess/drivers/supracan.c
@@ -1130,7 +1130,7 @@ static ADDRESS_MAP_START( supracan_mem, AS_PROGRAM, 16, supracan_state )
AM_RANGE( 0xe90000, 0xe9001f ) AM_READWRITE( supracan_sound_r, supracan_sound_w )
AM_RANGE( 0xe90020, 0xe9002f ) AM_WRITE( supracan_dma_channel0_w )
AM_RANGE( 0xe90030, 0xe9003f ) AM_WRITE( supracan_dma_channel1_w )
-
+
AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE( supracan_video_r, supracan_video_w )
AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
AM_RANGE( 0xf40000, 0xf5ffff ) AM_READWRITE(supracan_vram_r, supracan_vram_w)
@@ -1743,7 +1743,7 @@ WRITE16_MEMBER( supracan_state::supracan_video_w )
verboselog("maincpu", 0, "supracan_video_w: Unknown register: %08x = %04x & %04x\n", 0xf00000 + (offset << 1), data, mem_mask);
break;
}
-// m_video_regs[offset] = data;
+// m_video_regs[offset] = data;
}
diff --git a/src/mess/drivers/v1050.c b/src/mess/drivers/v1050.c
index dc64584ccba..e62ad9c78fb 100644
--- a/src/mess/drivers/v1050.c
+++ b/src/mess/drivers/v1050.c
@@ -93,39 +93,39 @@ Notes:
/*
- Using the hard disk
- -------------------
+ Using the hard disk
+ -------------------
- Use the chdman utility to create a Tandon TM501 (5MB) or CMI CM-5412 (10MB) hard disk image:
+ Use the chdman utility to create a Tandon TM501 (5MB) or CMI CM-5412 (10MB) hard disk image:
$ chdman createhd -chs 306,2,32 -ss 256 -o tm501.chd
- $ chdman createhd -chs 306,4,32 -ss 256 -o cm5412.chd
+ $ chdman createhd -chs 306,4,32 -ss 256 -o cm5412.chd
- Start the Visual 1050 emulator with the floppy and hard disk images mounted:
+ Start the Visual 1050 emulator with the floppy and hard disk images mounted:
- $ mess v1050 -flop1 cpm3:flop2 -hard cm5412.chd
+ $??mess v1050 -flop1 cpm3:flop2 -hard cm5412.chd
- Start the Winchester Format Program from the CP/M prompt:
+ Start the Winchester Format Program from the CP/M prompt:
- A>fmtwinch
+ A>fmtwinch
- Enter Y to continue.
- Ener A for 5MB, or B for 10MB hard disk.
- Enter C to start formatting.
+ Enter Y to continue.
+ Ener A for 5MB, or B for 10MB hard disk.
+ Enter C to start formatting.
- Once the formatting is complete, the CP/M system files need to be copied over to the hard disk:
+ Once the formatting is complete, the CP/M system files need to be copied over to the hard disk:
- A>copysys
+ A>copysys
- Enter source drive name "a" and press RETURN.
- Enter target drive name "c" and press RETURN.
- Enter "y" at the prompt for CPM3.SYS.
- Enter "y" at the prompt for CCP.COM.
- Press RETURN to return to CP/M.
+ Enter source drive name "a" and press RETURN.
+ Enter target drive name "c" and press RETURN.
+ Enter "y" at the prompt for CPM3.SYS.
+ Enter "y" at the prompt for CCP.COM.
+ Press RETURN to return to CP/M.
- The hard disk can now be booted from with the following command line:
+ The hard disk can now be booted from with the following command line:
- $ mess v1050 -hard cm5412.chd
+ $ mess v1050 -hard cm5412.chd
*/
diff --git a/src/mess/drivers/zaurus.c b/src/mess/drivers/zaurus.c
index 8a0e44bd5c8..eb5db827b39 100644
--- a/src/mess/drivers/zaurus.c
+++ b/src/mess/drivers/zaurus.c
@@ -1,13 +1,13 @@
/****************************************************************************************************************************************
- Sharp Zaurus PDA skeleton driver (SL, ARM/Linux based, 4th generation)
+ Sharp Zaurus PDA skeleton driver (SL, ARM/Linux based, 4th generation)
- TODO:
- - PXA-255 ID opcode fails on this
- - ARM TLB look-up errors?
- - RTC irq doesn't fire?
- - For whatever reason, after RTC check ARM executes invalid code at 0-0x200
- - Dumps are questionable to say the least
+ TODO:
+ - PXA-255 ID opcode fails on this
+ - ARM TLB look-up errors?
+ - RTC irq doesn't fire?
+ - For whatever reason, after RTC check ARM executes invalid code at 0-0x200
+ - Dumps are questionable to say the least
=========================================================================================================================================
Sharp Zaurus
@@ -1472,8 +1472,6 @@ void zaurus_state::video_start()
UINT32 zaurus_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
-
-
return 0;
}
@@ -1501,7 +1499,7 @@ void zaurus_state::pxa255_ostimer_irq_check()
{
PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs;
-// logerror("%08x OStimer irq check\n",ostimer_regs->oier);
+// logerror("%08x OStimer irq check\n",ostimer_regs->oier);
pxa255_set_irq_line(PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0);
//pxa255_set_irq_line(PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0);
@@ -1784,7 +1782,7 @@ MACHINE_CONFIG_END
/* was labeled SL-C500 */
ROM_START( zsl5500 )
ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 )
- ROM_LOAD( "sl-c500 v1.20 (zimage).bin", 0x000000, 0x13c000, BAD_DUMP CRC(dc1c259f) SHA1(8150744196a72821ae792462d0381182274c2ce0) )
+ ROM_LOAD( "sl-c500 v1.20 (zimage).bin", 0x000000, 0x13c000, BAD_DUMP CRC(dc1c259f) SHA1(8150744196a72821ae792462d0381182274c2ce0) )
ROM_END
ROM_START( zsl5600 )
@@ -1794,7 +1792,7 @@ ROM_END
ROM_START( zslc750 )
ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 )
- ROM_LOAD( "zaurus sl-c750 (zimage).bin", 0x000000, 0x121544, BAD_DUMP CRC(56353f4d) SHA1(8e1fff6e93d560bd6572c5c163bbd81378693f68) )
+ ROM_LOAD( "zaurus sl-c750 (zimage).bin", 0x000000, 0x121544, BAD_DUMP CRC(56353f4d) SHA1(8e1fff6e93d560bd6572c5c163bbd81378693f68) )
ROM_END
ROM_START( zslc760 )
@@ -1804,12 +1802,12 @@ ROM_END
ROM_START( zslc3000 )
ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 )
- ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c3000-20050428091110.bin", 0x000000, 0x12828c, BAD_DUMP CRC(fd94510d) SHA1(901f8154b4228a448f5551f0c9f21c2153e1e3a1) )
+ ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c3000-20050428091110.bin", 0x000000, 0x12828c, BAD_DUMP CRC(fd94510d) SHA1(901f8154b4228a448f5551f0c9f21c2153e1e3a1) )
ROM_END
ROM_START( zslc1000 )
ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 )
- ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c1000-20050427214434.bin", 0x000000, 0x128980, BAD_DUMP CRC(1e1a9279) SHA1(909ac3f00385eced55822d6a155b79d9d25f43b3) )
+ ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c1000-20050427214434.bin", 0x000000, 0x128980, BAD_DUMP CRC(1e1a9279) SHA1(909ac3f00385eced55822d6a155b79d9d25f43b3) )
ROM_END
GAME( 2002, zsl5500, 0, zaurus, zaurus, driver_device, 0, ROT0, "Sharp", "Zaurus SL-5500 \"Collie\"", GAME_IS_SKELETON )
diff --git a/src/mess/includes/aim65.h b/src/mess/includes/aim65.h
index 313a9d66010..fec6d81df8c 100644
--- a/src/mess/includes/aim65.h
+++ b/src/mess/includes/aim65.h
@@ -77,7 +77,7 @@ public:
DECLARE_WRITE16_MEMBER(aim65_update_ds3);
DECLARE_WRITE16_MEMBER(aim65_update_ds4);
DECLARE_WRITE16_MEMBER(aim65_update_ds5);
-
+
void dl1416_update(dl1416_device *device, int index);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(aim65_cart);
diff --git a/src/mess/includes/amstr_pc.h b/src/mess/includes/amstr_pc.h
index bd297e86b4a..ec37c30c8c5 100644
--- a/src/mess/includes/amstr_pc.h
+++ b/src/mess/includes/amstr_pc.h
@@ -18,10 +18,10 @@ public:
m_lpt1(*this, "lpt_1"),
m_lpt2(*this, "lpt_2")
{ m_mouse.x =0; m_mouse.y=0;}
-
+
required_device<pc_lpt_device> m_lpt1;
required_device<pc_lpt_device> m_lpt2;
-
+
DECLARE_READ8_MEMBER( pc1640_port60_r );
DECLARE_WRITE8_MEMBER( pc1640_port60_w );
diff --git a/src/mess/includes/dccons.h b/src/mess/includes/dccons.h
index 45b74bb6806..56d7b19a213 100644
--- a/src/mess/includes/dccons.h
+++ b/src/mess/includes/dccons.h
@@ -9,11 +9,11 @@ public:
dc_cons_state(const machine_config &mconfig, device_type type, const char *tag)
: dc_state(mconfig, type, tag),
m_ata(*this, "ata")
-// m_dcflash(*this, "dcflash")
+// m_dcflash(*this, "dcflash")
{ }
required_device<ata_interface_device> m_ata;
-// required_device<macronix_29lv160tmc_device> m_dcflash;
+// required_device<macronix_29lv160tmc_device> m_dcflash;
DECLARE_DRIVER_INIT(dc);
DECLARE_DRIVER_INIT(dcus);
@@ -36,8 +36,8 @@ public:
void dreamcast_atapi_init();
DECLARE_READ32_MEMBER( dc_mess_g1_ctrl_r );
DECLARE_WRITE32_MEMBER( dc_mess_g1_ctrl_w );
-// DECLARE_READ8_MEMBER( dc_flash_r );
-// DECLARE_WRITE8_MEMBER( dc_flash_w );
+// DECLARE_READ8_MEMBER( dc_flash_r );
+// DECLARE_WRITE8_MEMBER( dc_flash_w );
private:
UINT64 PDTRA, PCTRA;
diff --git a/src/mess/includes/md_cons.h b/src/mess/includes/md_cons.h
index c6d746fc93d..ec0a779cef7 100644
--- a/src/mess/includes/md_cons.h
+++ b/src/mess/includes/md_cons.h
@@ -26,5 +26,3 @@ public:
DECLARE_MACHINE_START( ms_megadriv ); // setup ioport_port + install cartslot handlers
DECLARE_MACHINE_RESET( ms_megadriv );
};
-
-
diff --git a/src/mess/includes/osi.h b/src/mess/includes/osi.h
index b6da6d79367..04a16a44836 100644
--- a/src/mess/includes/osi.h
+++ b/src/mess/includes/osi.h
@@ -74,7 +74,7 @@ public:
/* floppy state */
int m_fdc_index;
DECLARE_WRITE_LINE_MEMBER(osi470_index_callback);
-
+
DECLARE_PALETTE_INIT(osi630);
required_device<cpu_device> m_maincpu;
diff --git a/src/mess/includes/rmnimbus.h b/src/mess/includes/rmnimbus.h
index 1f27d8bb4a1..5405c16203b 100644
--- a/src/mess/includes/rmnimbus.h
+++ b/src/mess/includes/rmnimbus.h
@@ -411,7 +411,7 @@ public:
required_device<ram_device> m_ram;
UINT32 m_debug_machine;
-// i186_state m_i186;
+// i186_state m_i186;
keyboard_t m_keyboard;
nimbus_drives_t m_nimbus_drives;
ipc_interface_t m_ipc_interface;
@@ -429,8 +429,8 @@ public:
UINT8 m_hs_count;
UINT32 m_debug_video;
UINT8 m_vector;
-// DECLARE_READ16_MEMBER(nimbus_i186_internal_port_r);
-// DECLARE_WRITE16_MEMBER(nimbus_i186_internal_port_w);
+// DECLARE_READ16_MEMBER(nimbus_i186_internal_port_r);
+// DECLARE_WRITE16_MEMBER(nimbus_i186_internal_port_w);
DECLARE_READ8_MEMBER(nimbus_mcu_r);
DECLARE_WRITE8_MEMBER(nimbus_mcu_w);
DECLARE_READ16_MEMBER(nimbus_io_r);
@@ -461,8 +461,8 @@ public:
virtual void palette_init();
UINT32 screen_update_nimbus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_nimbus(screen_device &screen, bool state);
-// TIMER_CALLBACK_MEMBER(internal_timer_int);
-// TIMER_CALLBACK_MEMBER(dma_timer_callback);
+// TIMER_CALLBACK_MEMBER(internal_timer_int);
+// TIMER_CALLBACK_MEMBER(dma_timer_callback);
TIMER_CALLBACK_MEMBER(keyscan_callback);
TIMER_CALLBACK_MEMBER(mouse_callback);
DECLARE_WRITE_LINE_MEMBER(sio_interrupt);
@@ -502,17 +502,17 @@ public:
void write_reg_01E();
void write_reg_026();
void change_palette(UINT8 bank, UINT16 colours, UINT8 regno);
-// void update_interrupt_state();
-// void handle_eoi(int data);
+// void update_interrupt_state();
+// void handle_eoi(int data);
void external_int(UINT16 intno, UINT8 vector);
DECLARE_READ8_MEMBER(cascade_callback);
-// void nimbus_recalculate_ints();
-// void internal_timer_sync(int which);
-// void internal_timer_update(int which,int new_count,int new_maxA,int new_maxB,int new_control);
-// void update_dma_control(int which, int new_control);
-// void drq_callback(int which);
-// void nimbus_cpu_init();
-// void nimbus_cpu_reset();
+// void nimbus_recalculate_ints();
+// void internal_timer_sync(int which);
+// void internal_timer_update(int which,int new_count,int new_maxA,int new_maxB,int new_control);
+// void update_dma_control(int which, int new_control);
+// void drq_callback(int which);
+// void nimbus_cpu_init();
+// void nimbus_cpu_reset();
void *get_dssi_ptr(address_space &space, UINT16 ds, UINT16 si);
void nimbus_bank_memory();
void memory_reset();
diff --git a/src/mess/includes/studio2.h b/src/mess/includes/studio2.h
index ec1b85e32f3..75d0bca2507 100644
--- a/src/mess/includes/studio2.h
+++ b/src/mess/includes/studio2.h
@@ -79,7 +79,7 @@ public:
required_shared_ptr<UINT8> m_color1_ram;
DECLARE_WRITE8_MEMBER( dma_w );
-
+
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( visicom_cart_load );
};
diff --git a/src/mess/layout/rainbow.lay b/src/mess/layout/rainbow.lay
index 27b6752ec68..641d554999a 100644
--- a/src/mess/layout/rainbow.lay
+++ b/src/mess/layout/rainbow.lay
@@ -8,7 +8,7 @@
</disk>
</element>
-
+
<element name="DRIVE0">
<text string="A">
<color red="1.0" green="1.0" blue="1.0" />
@@ -87,7 +87,7 @@
<bezel name="led21" element="led">
<bounds x="15" y="18" width="10" height="10" />
</bezel>
-
+
<bezel name="led1" element="led">
<bounds x="15" y="43" width="10" height="10" />
</bezel>
@@ -121,7 +121,7 @@
<bezel name="led11" element="led">
<bounds x="15" y="252" width="10" height="10" />
</bezel>
-
+
<bezel name="label20" element="DRIVE0">
<bounds x="0" y="0" width="15" height="16" />
</bezel>
diff --git a/src/mess/machine/64h156.c b/src/mess/machine/64h156.c
index 085cee38612..a33928aeada 100644
--- a/src/mess/machine/64h156.c
+++ b/src/mess/machine/64h156.c
@@ -757,7 +757,7 @@ void c64h156_device::set_side(int side)
if (m_side != side)
{
m_side = side;
-
+
// read new track data
read_current_track();
}
diff --git a/src/mess/machine/a2applicard.c b/src/mess/machine/a2applicard.c
index 163e988f13e..c568f1085d5 100644
--- a/src/mess/machine/a2applicard.c
+++ b/src/mess/machine/a2applicard.c
@@ -3,10 +3,10 @@
a2applicard.c
Implementation of the PCPI AppliCard Z-80 card
-
+
Unlike the SoftCard and clones, this has its own 64k of RAM on board
and the Z80 runs completely independently of the host's 6502.
-
+
*********************************************************************/
#include "a2applicard.h"
@@ -25,7 +25,7 @@
const device_type A2BUS_APPLICARD = &device_creator<a2bus_applicard_device>;
#define Z80_TAG "z80"
-#define Z80_ROM_REGION "z80_rom"
+#define Z80_ROM_REGION "z80_rom"
static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, a2bus_applicard_device )
AM_RANGE(0x0000, 0xffff) AM_READWRITE(dma_r, dma_w)
@@ -36,7 +36,7 @@ static ADDRESS_MAP_START( z80_io, AS_IO, 8, a2bus_applicard_device )
ADDRESS_MAP_END
MACHINE_CONFIG_FRAGMENT( a2applicard )
- MCFG_CPU_ADD(Z80_TAG, Z80, 6000000) // Z80 runs at 6 MHz
+ MCFG_CPU_ADD(Z80_TAG, Z80, 6000000) // Z80 runs at 6 MHz
MCFG_CPU_PROGRAM_MAP(z80_mem)
MCFG_CPU_IO_MAP(z80_io)
MACHINE_CONFIG_END
@@ -147,7 +147,7 @@ UINT8 a2bus_applicard_device::read_c0nx(address_space &space, UINT8 offset)
m_z80->reset();
break;
- case 6: // IRQ on Z80 via CTC channel 3 (CP/M doesn't use the CTC or IRQs)
+ case 6: // IRQ on Z80 via CTC channel 3 (CP/M doesn't use the CTC or IRQs)
fatalerror("Applicard: Z80 IRQ not supported yet\n");
break;
@@ -163,7 +163,7 @@ void a2bus_applicard_device::write_c0nx(address_space &space, UINT8 offset, UINT
{
switch (offset & 0xf)
{
- case 0: // are these legal to write?
+ case 0: // are these legal to write?
case 2:
case 3:
break;
@@ -176,7 +176,7 @@ void a2bus_applicard_device::write_c0nx(address_space &space, UINT8 offset, UINT
case 5:
case 6:
case 7:
- read_c0nx(space, offset); // let the read handler take care of these
+ read_c0nx(space, offset); // let the read handler take care of these
break;
}
}
@@ -206,9 +206,9 @@ READ8_MEMBER( a2bus_applicard_device::z80_io_r )
return tmp;
case 0x60:
- break;
+ break;
}
- return 0xff;
+ return 0xff;
}
WRITE8_MEMBER( a2bus_applicard_device::z80_io_w )
@@ -254,7 +254,7 @@ READ8_MEMBER( a2bus_applicard_device::dma_r )
{
return m_z80ram[offset];
}
- return 0xff;
+ return 0xff;
}
diff --git a/src/mess/machine/abc1600mac.c b/src/mess/machine/abc1600mac.c
index 0a5512f3138..1e2766fddb7 100644
--- a/src/mess/machine/abc1600mac.c
+++ b/src/mess/machine/abc1600mac.c
@@ -241,7 +241,7 @@ UINT8 abc1600_mac_device::read_user_memory(offs_t offset)
{
int nonx = 0, wp = 0;
offs_t virtual_offset = translate_address(offset, &nonx, &wp);
-
+
return space().read_byte(virtual_offset);
}
diff --git a/src/mess/machine/abc1600mac.h b/src/mess/machine/abc1600mac.h
index 0acc6377510..353261b00e9 100644
--- a/src/mess/machine/abc1600mac.h
+++ b/src/mess/machine/abc1600mac.h
@@ -43,7 +43,7 @@
// ======================> abc1600_mac_device
class abc1600_mac_device : public device_t,
- public device_memory_interface
+ public device_memory_interface
{
public:
abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
diff --git a/src/mess/machine/c2040.c b/src/mess/machine/c2040.c
index cd9a5458821..d6148263a66 100644
--- a/src/mess/machine/c2040.c
+++ b/src/mess/machine/c2040.c
@@ -505,9 +505,9 @@ READ8_MEMBER( c2040_device::riot1_pb_r )
PB0 DEVICE NUMBER SELECTION
PB1 DEVICE NUMBER SELECTION
PB2 DEVICE NUMBER SELECTION
- PB3
- PB4
- PB5
+ PB3
+ PB4
+ PB5
PB6 DACI
PB7 RFDI
@@ -533,14 +533,14 @@ WRITE8_MEMBER( c2040_device::riot1_pb_w )
bit description
- PB0
- PB1
- PB2
+ PB0
+ PB1
+ PB2
PB3 ACT LED 1
PB4 ACT LED 0
PB5 ERR LED
- PB6
- PB7
+ PB6
+ PB7
*/
diff --git a/src/mess/machine/c64/magic_voice.c b/src/mess/machine/c64/magic_voice.c
index 9defb137f5f..d54d2f4f250 100644
--- a/src/mess/machine/c64/magic_voice.c
+++ b/src/mess/machine/c64/magic_voice.c
@@ -11,21 +11,21 @@
LA05-123 Pinout
---------------
- _____ _____
- NEXTP 1 |* \_/ | 28 +5V
- PD0 2 | | 27 _ROML2
- PD1 3 | | 26 _ROML
- PD2 4 | | 25 _I/O2
- PD3 5 | | 24 _GAME
- CLEAR 6 | | 23 PHI2
+ _____ _____
+ NEXTP 1 |* \_/ | 28 +5V
+ PD0 2 | | 27 _ROML2
+ PD1 3 | | 26 _ROML
+ PD2 4 | | 25 _I/O2
+ PD3 5 | | 24 _GAME
+ CLEAR 6 | | 23 PHI2
_RAM/EPROM 7 | LA05-123 | 22 _ROMH2
- PB5 8 | LA05-124 | 21 _ROMH
- PB6 9 | | 20 CLOCK
- _6525 10 | | 19 SDO
- _EPROM 11 | | 18 NEXTS
- CA12 12 | | 17 _DA/CA
- CA14 13 | | 16 CA15
- GND 14 |_____________| 15 CA13
+ PB5 8 | LA05-124 | 21 _ROMH
+ PB6 9 | | 20 CLOCK
+ _6525 10 | | 19 SDO
+ _EPROM 11 | | 18 NEXTS
+ CA12 12 | | 17 _DA/CA
+ CA14 13 | | 16 CA15
+ GND 14 |_____________| 15 CA13
http://www.stefan-uhlmann.de/cbm/MVM/index.html
@@ -34,9 +34,9 @@ http://www.stefan-uhlmann.de/cbm/MVM/index.html
/*
- TODO:
+ TODO:
- - T6721A speech synthesis
+ - T6721A speech synthesis
*/
@@ -48,14 +48,14 @@ http://www.stefan-uhlmann.de/cbm/MVM/index.html
// MACROS / CONSTANTS
//**************************************************************************
-#define T6721A_TAG "u5"
-#define MOS6525_TAG "u2"
-#define CMOS40105_TAG "u1"
+#define T6721A_TAG "u5"
+#define MOS6525_TAG "u2"
+#define CMOS40105_TAG "u1"
-#define A12 BIT(offset, 12)
-#define A13 BIT(offset, 13)
-#define A14 BIT(offset, 14)
-#define A15 BIT(offset, 15)
+#define A12 BIT(offset, 12)
+#define A13 BIT(offset, 13)
+#define A14 BIT(offset, 14)
+#define A15 BIT(offset, 15)
#define PB5 BIT(m_tpi_pb, 5)
#define PB6 BIT(m_tpi_pb, 6)
@@ -80,18 +80,18 @@ WRITE_LINE_MEMBER( c64_magic_voice_cartridge_device::tpi_irq_w )
READ8_MEMBER( c64_magic_voice_cartridge_device::tpi_pa_r )
{
/*
-
+
bit description
-
- 0
- 1
- 2
- 3
- 4
+
+ 0
+ 1
+ 2
+ 3
+ 4
5 J1 _GAME
6 T6721 _EOS
7 FIFO DIR
-
+
*/
UINT8 data = 0;
@@ -106,18 +106,18 @@ READ8_MEMBER( c64_magic_voice_cartridge_device::tpi_pa_r )
WRITE8_MEMBER( c64_magic_voice_cartridge_device::tpi_pa_w )
{
/*
-
+
bit description
-
+
0 FIFO D0
1 FIFO D1
2 FIFO D2
3 FIFO D3
4 FIFO SI
- 5
- 6
- 7
-
+ 5
+ 6
+ 7
+
*/
m_fifo->write(data & 0x0f);
@@ -127,18 +127,18 @@ WRITE8_MEMBER( c64_magic_voice_cartridge_device::tpi_pa_w )
READ8_MEMBER( c64_magic_voice_cartridge_device::tpi_pb_r )
{
/*
-
+
bit description
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
7 J1 _EXROM
-
+
*/
UINT8 data = 0;
@@ -151,9 +151,9 @@ READ8_MEMBER( c64_magic_voice_cartridge_device::tpi_pb_r )
WRITE8_MEMBER( c64_magic_voice_cartridge_device::tpi_pb_w )
{
/*
-
+
bit description
-
+
0 T6721 D0
1 T6721 D1
2 T6721 D2
@@ -161,8 +161,8 @@ WRITE8_MEMBER( c64_magic_voice_cartridge_device::tpi_pb_w )
4 T6721 _WR
5 LA05-124 pin 8 (DA/CA)
6 LA05-124 pin 9 (passthru)
- 7
-
+ 7
+
*/
if (!BIT(m_tpi_pb, 4) && BIT(data, 4))
@@ -208,7 +208,7 @@ WRITE_LINE_MEMBER( c64_magic_voice_cartridge_device::phi2_w )
m_vslsi->di_w(m_pd & 0x01);
m_pd >>= 1;
- }
+ }
}
WRITE_LINE_MEMBER( c64_magic_voice_cartridge_device::dtrd_w )
diff --git a/src/mess/machine/c64/magic_voice.h b/src/mess/machine/c64/magic_voice.h
index 73e5d81c5e1..a553acad186 100644
--- a/src/mess/machine/c64/magic_voice.h
+++ b/src/mess/machine/c64/magic_voice.h
@@ -28,7 +28,7 @@
// ======================> c64_magic_voice_cartridge_device
class c64_magic_voice_cartridge_device : public device_t,
- public device_c64_expansion_card_interface
+ public device_c64_expansion_card_interface
{
public:
// construction/destruction
diff --git a/src/mess/machine/c64/music64.h b/src/mess/machine/c64/music64.h
index e5bcfdb46c6..3b7c804f6cb 100644
--- a/src/mess/machine/c64/music64.h
+++ b/src/mess/machine/c64/music64.h
@@ -25,7 +25,7 @@
// ======================> c64_music64_cartridge_device
class c64_music64_cartridge_device : public device_t,
- public device_c64_expansion_card_interface
+ public device_c64_expansion_card_interface
{
public:
// construction/destruction
diff --git a/src/mess/machine/c64_nl10.h b/src/mess/machine/c64_nl10.h
index 84c61edc02f..6e7c552d3b9 100644
--- a/src/mess/machine/c64_nl10.h
+++ b/src/mess/machine/c64_nl10.h
@@ -24,7 +24,7 @@
// ======================> c64_nl10_interface_device
class c64_nl10_interface_device : public device_t,
- public device_cbm_iec_interface
+ public device_cbm_iec_interface
{
public:
// construction/destruction
diff --git a/src/mess/machine/comx_fd.c b/src/mess/machine/comx_fd.c
index e1853895ddf..e4b898614ad 100644
--- a/src/mess/machine/comx_fd.c
+++ b/src/mess/machine/comx_fd.c
@@ -44,9 +44,9 @@ Notes:
/*
- TODO:
+ TODO:
- - floppy broken (wd1770 digital PLL FM mode incomplete)
+ - floppy broken (wd1770 digital PLL FM mode incomplete)
*/
diff --git a/src/mess/machine/dccons.c b/src/mess/machine/dccons.c
index 22f25d05bde..1591448f6b4 100644
--- a/src/mess/machine/dccons.c
+++ b/src/mess/machine/dccons.c
@@ -151,7 +151,7 @@ WRITE32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_w )
/* 12x * 75 Hz = 0,00(1) secs per sector */
/* TODO: make DMA to be single step */
atapi_timer->adjust(attotime::from_usec(1111*atapi_xferlen/2048));
-// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80;
+// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80;
}
break;
@@ -163,7 +163,7 @@ WRITE32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_w )
case GD_UNLOCK:
if (data==0 || data==0x001fffff || data==0x42fe)
{
-// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80;
+// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80;
printf("Unlocking GD-ROM! %x\n", data);
}
break;
diff --git a/src/mess/machine/e05a03.c b/src/mess/machine/e05a03.c
index 68a3e34e9b4..f7fb6ef5f99 100644
--- a/src/mess/machine/e05a03.c
+++ b/src/mess/machine/e05a03.c
@@ -29,7 +29,6 @@ e05a03_device::e05a03_device(const machine_config &mconfig, const char *tag, dev
m_pf_motor(0),
m_cr_motor(0)
{
-
}
//-------------------------------------------------
diff --git a/src/mess/machine/e05a03.h b/src/mess/machine/e05a03.h
index 220b5dbde2a..6bfa0ee3785 100644
--- a/src/mess/machine/e05a03.h
+++ b/src/mess/machine/e05a03.h
@@ -49,10 +49,10 @@ protected:
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
-
+
/* 24-bit shift register, port 0x00, 0x01 and 0x02 */
UINT32 m_shift;
diff --git a/src/mess/machine/hardbox.c b/src/mess/machine/hardbox.c
index 096b366b06a..32e274bbadd 100644
--- a/src/mess/machine/hardbox.c
+++ b/src/mess/machine/hardbox.c
@@ -1,42 +1,42 @@
/****************************************************************************
- SSE HardBox emulation
+ SSE HardBox emulation
- Copyright MESS Team.
- Visit http://mamedev.org for licensing and usage restrictions.
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
****************************************************************************/
/*
- http://mikenaberezny.com/hardware/pet-cbm/sse-hardbox-corvus-interface/
+ http://mikenaberezny.com/hardware/pet-cbm/sse-hardbox-corvus-interface/
- The HardBox provides a CBM DOS interface for a Corvus hard disk. Before
- it can be used, a hard disk image must first be created and formatted.
- Use the CHDMAN utility to create a 20MB image:
+ The HardBox provides a CBM DOS interface for a Corvus hard disk. Before
+ it can be used, a hard disk image must first be created and formatted.
+ Use the CHDMAN utility to create a 20MB image:
- $ chdman createhd -o /path/to/corvus20mb.chd -chs 388,5,20 -ss 512
+ $ chdman createhd -o /path/to/corvus20mb.chd -chs 388,5,20 -ss 512
- Start the pet8032 emulator with the HardBox attached as device 9,
- with the new CHD and the utilities floppy mounted:
+ Start the pet8032 emulator with the HardBox attached as device 9,
+ with the new CHD and the utilities floppy mounted:
- $ mess pet8032 -ieee9 hardbox \
- -hard1 /path/to/corvus20mb.chd \
- -flop1 /path/to/hardbox-utils.d80
-
- Load and run the "configure" program from the floppy. When prompted
- for the HardBox device number, enter "9".
+ $ mess pet8032 -ieee9 hardbox \
+ -hard1 /path/to/corvus20mb.chd \
+ -flop1 /path/to/hardbox-utils.d80
- Select "q" for quick configure at the menu. It will present a default
- drive size and ask if you want to alter it. If the size is not 20,
- change it to 20.
+ Load and run the "configure" program from the floppy. When prompted
+ for the HardBox device number, enter "9".
- After accepting the drive size, it will prompt if you want to perform
- a format check. This requires uploading code into the Corvus, which
- the high level emulation of the Corvus does not support. Enter "n"
- to skip the format check.
+ Select "q" for quick configure at the menu. It will present a default
+ drive size and ask if you want to alter it. If the size is not 20,
+ change it to 20.
- Enter "y" to proceed with the format. After it has completed, the
- program will exit back to BASIC. The drive should now be usable.
+ After accepting the drive size, it will prompt if you want to perform
+ a format check. This requires uploading code into the Corvus, which
+ the high level emulation of the Corvus does not support. Enter "n"
+ to skip the format check.
+
+ Enter "y" to proceed with the format. After it has completed, the
+ program will exit back to BASIC. The drive should now be usable.
*/
@@ -136,7 +136,7 @@ READ8_MEMBER( hardbox_device::ppi0_pc_r )
{
UINT8 data = ioport("SW1")->read();
- /* DIP switches on PC1,PC2,PC3 configure the IEEE-488 primary address.
+ /* DIP switches on PC1,PC2,PC3 configure the IEEE-488 primary address.
We get the address from m_address instead. */
data |= ((m_slot->get_address() - 8) << 1) ^ 0xff;
@@ -373,7 +373,7 @@ void hardbox_device::device_start()
// reset that must happen after child devices
// have performed their resets
//-------------------------------------------------
-
+
void hardbox_device::device_reset_after_children()
{
/* The Z80 starts at address 0x0000 but the HardBox has RAM there and
@@ -381,9 +381,9 @@ void hardbox_device::device_reset_after_children()
74S287 PROM that temporarily changes the memory map so that the
IC3 EPROM at 0xe000 is mapped to 0x0000 for the first instruction
fetch only. The instruction normally at 0xe000 is an absolute jump
- into the ROM. On reset, the Z80 will fetch it from 0x0000 and set
+ into the ROM. On reset, the Z80 will fetch it from 0x0000 and set
its PC, then the normal map will be restored before the next
- instruction fetch. Here we just set the PC to 0xe000 after the Z80
+ instruction fetch. Here we just set the PC to 0xe000 after the Z80
resets, which has the same effect. */
m_maincpu->set_state_int(Z80_PC, 0xe000);
@@ -403,4 +403,3 @@ void hardbox_device::ieee488_ifc(int state)
m_ifc = state;
}
-
diff --git a/src/mess/machine/hardbox.h b/src/mess/machine/hardbox.h
index ebb1a9f49bd..a727f7cfaa7 100644
--- a/src/mess/machine/hardbox.h
+++ b/src/mess/machine/hardbox.h
@@ -68,7 +68,7 @@ private:
required_device<cpu_device> m_maincpu;
- int m_ifc; // Tracks previous state of IEEE-488 IFC line
+ int m_ifc; // Tracks previous state of IEEE-488 IFC line
};
// device type definition
diff --git a/src/mess/machine/isa_wd1002a_wx1.c b/src/mess/machine/isa_wd1002a_wx1.c
index de5da644960..8e01f284cc4 100644
--- a/src/mess/machine/isa_wd1002a_wx1.c
+++ b/src/mess/machine/isa_wd1002a_wx1.c
@@ -48,7 +48,7 @@ const rom_entry *isa8_wd1002a_wx1_device::device_rom_region() const
isa8_wd1002a_wx1_device::isa8_wd1002a_wx1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ISA8_WD1002A_WX1, "WD1002A-WX1", tag, owner, clock, "wd1002a_wx1", __FILE__),
- device_isa8_card_interface( mconfig, *this )
+ device_isa8_card_interface( mconfig, *this )
{
}
diff --git a/src/mess/machine/isa_xtide.c b/src/mess/machine/isa_xtide.c
index 0a8cf135018..221f0a4b69c 100644
--- a/src/mess/machine/isa_xtide.c
+++ b/src/mess/machine/isa_xtide.c
@@ -222,14 +222,14 @@ ROM_START( xtide )
ROMX_LOAD( "ide_xt.bin(v1.1.5)", 0x000000, 0x002000, CRC(33a7e0ee) SHA1(b610fd8ea31f5b0568b8b3f2c3ef682be4897a3d), ROM_BIOS(14) )
ROM_SYSTEM_BIOS( 14, "xub115xtp", "XTIDE_Universal_BIOS_v1.1.3 (XT 80186+)" )
- ROMX_LOAD( "ide_xtp.bin(v1.1.5)", 0x000000, 0x002000, CRC(44ad9ee9) SHA1(9cd275469703cadb85b6654c56e421a151324ac0), ROM_BIOS(15) )
+ ROMX_LOAD( "ide_xtp.bin(v1.1.5)", 0x000000, 0x002000, CRC(44ad9ee9) SHA1(9cd275469703cadb85b6654c56e421a151324ac0), ROM_BIOS(15) )
ROM_SYSTEM_BIOS( 15, "xub115at", "XTIDE_Universal_BIOS_v1.1.5 (AT)" )
ROMX_LOAD( "ide_at.bin(v1.1.5)", 0x000000, 0x002000, CRC(434286ce) SHA1(3fc07d174924e7c48b4758a7ba76ecd5362bd75b), ROM_BIOS(16) )
ROM_SYSTEM_BIOS( 16, "xub200b1xt", "XTIDE_Universal_BIOS_v2.0.0_beta1 (XT)" )
ROMX_LOAD( "ide_xt.bin(v2.0.0_beta1)", 0x000000, 0x002000, CRC(379579e7) SHA1(da5ee7b9c43a55592fe909451d31a6766d0ab977), ROM_BIOS(17) )
-
+
ROM_SYSTEM_BIOS( 17, "xub200b1xtp", "XTIDE_Universal_BIOS_v2.0.0_beta1 (XT 80186+)" )
ROMX_LOAD( "ide_xtp.bin(v2.0.0_beta1)", 0x000000, 0x002000, CRC(a887ed63) SHA1(fb33d9e8e8824f61a8d247610d7bd215b7e306b4), ROM_BIOS(18) )
diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c
index c321f8d7778..e9456f2aee5 100644
--- a/src/mess/machine/mac.c
+++ b/src/mess/machine/mac.c
@@ -98,7 +98,7 @@
#define AUDIO_IS_CLASSIC (m_model <= MODEL_MAC_CLASSIC)
#define MAC_HAS_VIA2 ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX))
-#define INTS_RBV ((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || ((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_LC_580))
+#define INTS_RBV ((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || ((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_LC_580))
#ifdef MAME_DEBUG
#define LOG_ADB 0
@@ -673,24 +673,24 @@ void mac_state::keyboard_init()
WRITE_LINE_MEMBER(mac_state::mac_kbd_clk_in)
{
- printf("CLK: %d\n", state^1);
- m_via1->write_cb1(state ? 0 : 1);
+ printf("CLK: %d\n", state^1);
+ m_via1->write_cb1(state ? 0 : 1);
}
#ifdef MAC_USE_EMULATED_KBD
READ8_MEMBER(mac_state::mac_via_in_cb2)
{
- printf("Read %d from keyboard (PC=%x)\n", (m_mackbd->data_r() == ASSERT_LINE) ? 1 : 0, m_maincpu->pc());
- return (m_mackbd->data_r() == ASSERT_LINE) ? 1 : 0;
+ printf("Read %d from keyboard (PC=%x)\n", (m_mackbd->data_r() == ASSERT_LINE) ? 1 : 0, m_maincpu->pc());
+ return (m_mackbd->data_r() == ASSERT_LINE) ? 1 : 0;
}
WRITE8_MEMBER(mac_state::mac_via_out_cb2)
{
- printf("Sending %d to kbd (PC=%x)\n", data, m_maincpu->pc());
- m_mackbd->data_w((data & 1) ? ASSERT_LINE : CLEAR_LINE);
+ printf("Sending %d to kbd (PC=%x)\n", data, m_maincpu->pc());
+ m_mackbd->data_w((data & 1) ? ASSERT_LINE : CLEAR_LINE);
}
-#else // keyboard HLE
+#else // keyboard HLE
TIMER_CALLBACK_MEMBER(mac_state::kbd_clock)
{
diff --git a/src/mess/machine/mackbd.c b/src/mess/machine/mackbd.c
index 7f3663b4e70..40e89851e12 100644
--- a/src/mess/machine/mackbd.c
+++ b/src/mess/machine/mackbd.c
@@ -57,7 +57,7 @@
// MACROS / CONSTANTS
//**************************************************************************
-#define MACKBD_CPU_TAG "mackbd"
+#define MACKBD_CPU_TAG "mackbd"
//**************************************************************************
// DEVICE DEFINITIONS
@@ -94,7 +94,7 @@ ADDRESS_MAP_END
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( mackbd )
- MCFG_CPU_ADD(MACKBD_CPU_TAG, I8021, 3000000) // "the approximate clock rate of the MPU is 3 MHz"
+ MCFG_CPU_ADD(MACKBD_CPU_TAG, I8021, 3000000) // "the approximate clock rate of the MPU is 3 MHz"
MCFG_CPU_PROGRAM_MAP(mackbd_map)
MCFG_CPU_IO_MAP(mackbd_io_map)
MACHINE_CONFIG_END
@@ -135,7 +135,7 @@ static INPUT_PORTS_START( mackbd )
PORT_START("COL4")
PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
- PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
@@ -143,15 +143,15 @@ static INPUT_PORTS_START( mackbd )
PORT_START("COL5")
PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
- PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
+ PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
PORT_START("COL6")
- PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
+ PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
- PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
+ PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_NAME("Return")
@@ -167,7 +167,7 @@ static INPUT_PORTS_START( mackbd )
PORT_START("COL8")
PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
+ PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
@@ -208,7 +208,7 @@ ioport_constructor mackbd_device::device_input_ports() const
//-------------------------------------------------
mackbd_device::mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, MACKBD, "Macintosh keyboard", tag, owner, clock, "mackbd", __FILE__),
+ : device_t(mconfig, MACKBD, "Macintosh keyboard", tag, owner, clock, "mackbd", __FILE__),
m_maincpu(*this, MACKBD_CPU_TAG),
m_clkout_handler(*this)
{
@@ -278,7 +278,7 @@ WRITE8_MEMBER(mackbd_device::p0_w)
else
{
m_clkout_handler(CLEAR_LINE);
-// machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
+// machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
}
}
@@ -311,7 +311,7 @@ WRITE8_MEMBER(mackbd_device::p2_w)
if (m_maincpu->pc() != 0x19e && m_maincpu->pc() != 0x1a3)
{
data_to_mac = data_from_mac = (data & 1);
-// printf("data to/from mac = %d (PC=%x)\n", data_to_mac, m_maincpu->pc());
+// printf("data to/from mac = %d (PC=%x)\n", data_to_mac, m_maincpu->pc());
}
}
@@ -329,4 +329,3 @@ WRITE_LINE_MEMBER(mackbd_device::data_w)
{
data_from_mac = (state == ASSERT_LINE) ? 1 : 0;
}
-
diff --git a/src/mess/machine/mackbd.h b/src/mess/machine/mackbd.h
index c169d2d465a..5f43dbdb17f 100644
--- a/src/mess/machine/mackbd.h
+++ b/src/mess/machine/mackbd.h
@@ -11,20 +11,20 @@
// MACROS / CONSTANTS
//**************************************************************************
-#define MACKBD_TAG "mackbd"
+#define MACKBD_TAG "mackbd"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_MACKBD_ADD() \
- MCFG_DEVICE_ADD(MACKBD_TAG, MACKBD, 0)
+ MCFG_DEVICE_ADD(MACKBD_TAG, MACKBD, 0)
#define MCFG_MACKBD_REPLACE() \
- MCFG_DEVICE_REPLACE(MACKBD_TAG, MACKBD, 0)
+ MCFG_DEVICE_REPLACE(MACKBD_TAG, MACKBD, 0)
#define MCFG_MACKBD_REMOVE() \
- MCFG_DEVICE_REMOVE(MACKBD_TAG)
+ MCFG_DEVICE_REMOVE(MACKBD_TAG)
#define MCFG_MACKBD_CLKOUT_HANDLER(_devcb) \
devcb = &mackbd_device::set_clkout_handler(*device, DEVCB2_##_devcb);
@@ -42,7 +42,7 @@ public:
template<class _Object> static devcb2_base &set_clkout_handler(device_t &device, _Object object) { return downcast<mackbd_device &>(device).m_clkout_handler.set_callback(object); }
// construction/destruction
- mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER(p0_r);
DECLARE_WRITE8_MEMBER(p0_w);
@@ -56,14 +56,14 @@ public:
DECLARE_WRITE_LINE_MEMBER(data_w);
protected:
- // device-level overrides
- virtual void device_start();
- virtual void device_reset();
- virtual machine_config_constructor device_mconfig_additions() const;
- virtual const rom_entry *device_rom_region() const;
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual const rom_entry *device_rom_region() const;
virtual ioport_constructor device_input_ports() const;
- required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_maincpu;
private:
UINT8 p0, p1, p2, data_from_mac, data_to_mac;
diff --git a/src/mess/machine/micropolis.c b/src/mess/machine/micropolis.c
index b3ccc909d43..bf620dfd564 100644
--- a/src/mess/machine/micropolis.c
+++ b/src/mess/machine/micropolis.c
@@ -134,7 +134,7 @@ void micropolis_device::device_start()
m_in_dden_func.resolve(m_in_dden_cb, *this);
m_out_intrq_func.resolve(m_out_intrq_cb, *this);
m_out_drq_func.resolve(m_out_drq_cb, *this);
-
+
save_item(NAME(m_data));
save_item(NAME(m_drive_num));
save_item(NAME(m_track));
diff --git a/src/mess/machine/micropolis.h b/src/mess/machine/micropolis.h
index 422b68ec5cc..dd04d0127ea 100644
--- a/src/mess/machine/micropolis.h
+++ b/src/mess/machine/micropolis.h
@@ -36,7 +36,7 @@ class micropolis_device : public device_t,
public:
micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~micropolis_device() {}
-
+
void set_drive(UINT8 drive); // set current drive (0-3)
DECLARE_READ8_MEMBER( status_r );
@@ -53,14 +53,14 @@ protected:
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
-
+
private:
// internal state
-
+
devcb_resolved_read_line m_in_dden_func;
devcb_resolved_write_line m_out_intrq_func;
devcb_resolved_write_line m_out_drq_func;
-
+
/* register */
UINT8 m_data;
UINT8 m_drive_num;
@@ -79,7 +79,7 @@ private:
/* this is the drive currently selected */
device_t *m_drive;
-
+
void read_sector();
void write_sector();
};
diff --git a/src/mess/machine/mpu401.c b/src/mess/machine/mpu401.c
index c11b4f0d885..c4a18dfb0b8 100644
--- a/src/mess/machine/mpu401.c
+++ b/src/mess/machine/mpu401.c
@@ -3,32 +3,32 @@
Roland MPU-401 core
This emulates the MPU-401 external box with the 6801, ASIC, and RAM in it.
-
+
We do it this way to facilitate the various PC, Apple II, C64, and other
possible hookups.
-
+
6801 GPIO port hookups (from the schematics)
-
+
P10 / P11 / P12: drive the metronome and speaker
P13 / P14 / P15: drive 3 pins on the SYNC OUT connector
P16: to DSRD on gate array
P17: to DRRD on gate array
-
+
P20: to SYC OUT on gate array
P21: to SYC IN on gate array, pulled up to Vcc via 4.7K resistor
- programmed as output of timer (OLVL)
+ programmed as output of timer (OLVL)
P22: to SRCK on gate array, inverted
P23: MIDI IN serial data (SCI in)
P24: MIDI OUT serial data (SCI out)
-
+
ASIC addresses from the 6801:
0x20: (r) read pending byte from the PC (w) apparently nothing
0x21: (r) ASIC status, see STAT_xxx bits below (w) send new byte to PC data port
-
+
Theory of operation: 6801's timer/counter is set up to drive a pulse stream
out P21 to the ASIC's SYC IN pin. The ASIC in turn generates the MIDI baud
rate (times 8) and returns that on pin P22.
-
+
The 6801 is believed to run in mode 2, based on a combination of the
schematics and the behavior (ie, internal RAM from 80-FF is clearly
present from the program's behavior, and ports 3/4 are obviously external
@@ -38,26 +38,26 @@
#include "machine/mpu401.h"
-#define M6801_TAG "mpu6801"
-#define ROM_TAG "mpurom"
-#define MIDIIN_TAG "mdin"
-#define MIDIOUT_TAG "mdout"
+#define M6801_TAG "mpu6801"
+#define ROM_TAG "mpurom"
+#define MIDIIN_TAG "mdin"
+#define MIDIOUT_TAG "mdout"
-#define P2_SYNC_OUT (0x01)
-#define P2_SYNC_IN (0x02)
-#define P2_SRCK_OUT (0x04)
-#define P2_MIDI_IN (0x08)
-#define P2_MIDI_OUT (0x10)
+#define P2_SYNC_OUT (0x01)
+#define P2_SYNC_IN (0x02)
+#define P2_SRCK_OUT (0x04)
+#define P2_MIDI_IN (0x08)
+#define P2_MIDI_OUT (0x10)
-#define STAT_CMD_PORT (0x01) // set if the new byte indicated by TX FULL was written to the command port, clear for data port
-#define STAT_TX_FULL (0x40) // indicates the PC has written a new byte we haven't read yet
-#define STAT_RX_EMPTY (0x80) // indicates we've written a new byte the PC hasn't read yet
+#define STAT_CMD_PORT (0x01) // set if the new byte indicated by TX FULL was written to the command port, clear for data port
+#define STAT_TX_FULL (0x40) // indicates the PC has written a new byte we haven't read yet
+#define STAT_RX_EMPTY (0x80) // indicates we've written a new byte the PC hasn't read yet
static ADDRESS_MAP_START( mpu401_map, AS_PROGRAM, 8, mpu401_device )
AM_RANGE(0x0000, 0x001f) AM_READWRITE(regs_mode2_r, regs_mode2_w)
AM_RANGE(0x0020, 0x0021) AM_READWRITE(asic_r, asic_w)
- AM_RANGE(0x0080, 0x00ff) AM_RAM // on-chip RAM
- AM_RANGE(0x0800, 0x0fff) AM_RAM // external RAM
+ AM_RANGE(0x0080, 0x00ff) AM_RAM // on-chip RAM
+ AM_RANGE(0x0800, 0x0fff) AM_RAM // external RAM
AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(ROM_TAG, 0)
ADDRESS_MAP_END
@@ -85,7 +85,7 @@ static const serial_port_interface midiout_intf =
};
MACHINE_CONFIG_FRAGMENT( mpu401 )
- MCFG_CPU_ADD(M6801_TAG, M6801, 4000000) /* 4 MHz as per schematics */
+ MCFG_CPU_ADD(M6801_TAG, M6801, 4000000) /* 4 MHz as per schematics */
MCFG_CPU_PROGRAM_MAP(mpu401_map)
MCFG_CPU_IO_MAP(mpu401_io_map)
MCFG_M6801_SER_TX(WRITELINE(mpu401_device, mpu401_midi_tx))
@@ -96,7 +96,7 @@ MACHINE_CONFIG_END
ROM_START( mpu401 )
ROM_REGION(0x1000, ROM_TAG, 0)
- ROM_LOAD( "roland_6801v0b55p.bin", 0x000000, 0x001000, CRC(65d3a151) SHA1(00efbfb96aeb997b69bb16981c6751d3c784bb87) )
+ ROM_LOAD( "roland_6801v0b55p.bin", 0x000000, 0x001000, CRC(65d3a151) SHA1(00efbfb96aeb997b69bb16981c6751d3c784bb87) )
ROM_END
//**************************************************************************
@@ -156,7 +156,7 @@ void mpu401_device::device_start()
void mpu401_device::device_reset()
{
- m_port2 = 0xff & ~(P2_SRCK_OUT | P2_MIDI_IN); // prevent spurious reception
+ m_port2 = 0xff & ~(P2_SRCK_OUT | P2_MIDI_IN); // prevent spurious reception
m_command = 0;
m_mpudata = 0;
m_gatearrstat = 0;
@@ -182,7 +182,7 @@ READ8_MEMBER(mpu401_device::regs_mode2_r)
case 6:
case 7:
case 0xf:
-// printf("MPU401: read @ unk %x (PC=%x)\n", offset, space.device().safe_pc());
+// printf("MPU401: read @ unk %x (PC=%x)\n", offset, space.device().safe_pc());
break;
default:
@@ -201,7 +201,7 @@ WRITE8_MEMBER(mpu401_device::regs_mode2_w)
case 6:
case 7:
case 0xf:
-// printf("MPU401: %02x @ unk %x (PC=%x)\n", data, offset, space.device().safe_pc());
+// printf("MPU401: %02x @ unk %x (PC=%x)\n", data, offset, space.device().safe_pc());
break;
default:
@@ -216,29 +216,29 @@ READ8_MEMBER(mpu401_device::port1_r)
WRITE8_MEMBER(mpu401_device::port1_w)
{
-// printf("port1_w: %02x met %x syncout %x DSRD %d DRRD %d\n", data, data & 3, (data>>3) & 3, (data>>6) & 1, (data>>7) & 1);
+// printf("port1_w: %02x met %x syncout %x DSRD %d DRRD %d\n", data, data & 3, (data>>3) & 3, (data>>6) & 1, (data>>7) & 1);
}
READ8_MEMBER(mpu401_device::port2_r)
{
-// printf("Read P2 (PC=%x)\n", space.device().safe_pc());
+// printf("Read P2 (PC=%x)\n", space.device().safe_pc());
return m_port2;
}
WRITE8_MEMBER(mpu401_device::port2_w)
{
-// printf("port2_w: %02x SYCOUT %d SYCIN %d SRCK %d MIDI OUT %d\n", data, (data & 1), (data>>1) & 1, (data>>2) & 1, (data>>4) & 1);
+// printf("port2_w: %02x SYCOUT %d SYCIN %d SRCK %d MIDI OUT %d\n", data, (data & 1), (data>>1) & 1, (data>>2) & 1, (data>>4) & 1);
}
READ8_MEMBER(mpu401_device::mpu_r)
{
-// printf("mpu_r @ %d\n", offset);
+// printf("mpu_r @ %d\n", offset);
- if (offset == 1) // status
+ if (offset == 1) // status
{
return m_gatearrstat;
}
- else // data
+ else // data
{
write_irq(CLEAR_LINE);
m_gatearrstat |= STAT_RX_EMPTY;
@@ -248,7 +248,7 @@ READ8_MEMBER(mpu401_device::mpu_r)
WRITE8_MEMBER(mpu401_device::mpu_w)
{
-// printf("%02x to MPU-401 @ %d\n", data, offset);
+// printf("%02x to MPU-401 @ %d\n", data, offset);
m_command = data;
m_gatearrstat |= STAT_TX_FULL;
@@ -269,7 +269,7 @@ READ8_MEMBER(mpu401_device::asic_r)
m_gatearrstat &= ~STAT_TX_FULL;
return m_command;
}
- else if (offset == 1)
+ else if (offset == 1)
{
return m_gatearrstat;
}
@@ -279,7 +279,7 @@ READ8_MEMBER(mpu401_device::asic_r)
WRITE8_MEMBER(mpu401_device::asic_w)
{
-// printf("MPU401: %02x to gate array @ %d\n", data, offset);
+// printf("MPU401: %02x to gate array @ %d\n", data, offset);
if (offset == 1)
{
@@ -307,4 +307,3 @@ WRITE_LINE_MEMBER(mpu401_device::mpu401_midi_tx)
{
m_mdout->tx(state);
}
-
diff --git a/src/mess/machine/mpu401.h b/src/mess/machine/mpu401.h
index 620b1986752..0e814787339 100644
--- a/src/mess/machine/mpu401.h
+++ b/src/mess/machine/mpu401.h
@@ -73,5 +73,3 @@ private:
extern const device_type MPU401;
#endif /* __MPU401_H__ */
-
-
diff --git a/src/mess/machine/pc_lpt.h b/src/mess/machine/pc_lpt.h
index fb0d2ceabb6..e6f5c2aafb2 100644
--- a/src/mess/machine/pc_lpt.h
+++ b/src/mess/machine/pc_lpt.h
@@ -40,9 +40,9 @@ public:
DECLARE_READ8_MEMBER( status_r );
DECLARE_READ8_MEMBER( control_r );
DECLARE_WRITE8_MEMBER( control_w );
-
+
DECLARE_WRITE_LINE_MEMBER( ack_w );
-
+
protected:
// device-level overrides
virtual void device_config_complete();
diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c
index b7ecc80259a..0c1e4dcf729 100644
--- a/src/mess/machine/rmnimbus.c
+++ b/src/mess/machine/rmnimbus.c
@@ -1230,7 +1230,7 @@ READ8_MEMBER(rmnimbus_state::cascade_callback)
void rmnimbus_state::machine_reset()
{
/* CPU */
-// nimbus_cpu_reset();
+// nimbus_cpu_reset();
iou_reset();
fdc_reset();
hdc_reset();
@@ -1248,7 +1248,7 @@ DRIVER_INIT_MEMBER(rmnimbus_state,nimbus)
void rmnimbus_state::machine_start()
{
/* init cpu */
-// nimbus_cpu_init();
+// nimbus_cpu_init();
m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::keyscan_callback),this));
m_nimbus_mouse.m_mouse_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::mouse_callback),this));
diff --git a/src/mess/machine/ti99/spchsyn.c b/src/mess/machine/ti99/spchsyn.c
index 2027f088366..e1a9fdffb45 100644
--- a/src/mess/machine/ti99/spchsyn.c
+++ b/src/mess/machine/ti99/spchsyn.c
@@ -8,8 +8,8 @@
speech synthesizer must be moved into the Peripheral Box.
The Speech Synthesizer used for the TI was the CD2501E, AKA TMS5200,
- (internal name TMC0285), a predecessor of the TMS5220 which was used in
- other commercial products.
+ (internal name TMC0285), a predecessor of the TMS5220 which was used in
+ other commercial products.
Note that this adapter also contains the speech roms.
diff --git a/src/mess/machine/ti99/videowrp.c b/src/mess/machine/ti99/videowrp.c
index af91f8e9421..5a17ee06f67 100644
--- a/src/mess/machine/ti99/videowrp.c
+++ b/src/mess/machine/ti99/videowrp.c
@@ -42,12 +42,12 @@ ti_exp_video_device::ti_exp_video_device(const machine_config &mconfig, const ch
ti_sound_sn94624_device::ti_sound_sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ti_sound_system_device(mconfig, TISOUND_94624, tag, "Onboard sound (SN94624)", owner, clock, "ti_sound_sn94624", __FILE__)
-{
+{
}
ti_sound_sn76496_device::ti_sound_sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ti_sound_system_device(mconfig, TISOUND_76496, tag, "Onboard sound (SN76496)", owner, clock, "ti_sound_sn76496", __FILE__)
-{
+{
}
/*****************************************************************************/
diff --git a/src/mess/mess.lst b/src/mess/mess.lst
index 7e85195a7d7..a08207b2bc9 100644
--- a/src/mess/mess.lst
+++ b/src/mess/mess.lst
@@ -102,7 +102,7 @@ megadriv // 1990 Sega Mega Drive (Europe)
pico // 1994 Sega Pico (Europe)
picou // 1994 Sega Pico (USA)
picoj // 1993 Sega Pico (Japan)
-copera // 1993 Sega / Yamaha
+copera // 1993 Sega / Yamaha
segacd // 1992 Sega Sega CD (USA)
megacd // 1993 Sega Mega-CD (Europe)
megacda // 1993 Sega Mega-CD (Asia)
diff --git a/src/mess/video/733_asr.h b/src/mess/video/733_asr.h
index 945a92b58b7..be568d579ad 100644
--- a/src/mess/video/733_asr.h
+++ b/src/mess/video/733_asr.h
@@ -24,7 +24,7 @@ public:
~asr733_device() { global_free(m_token); }
DECLARE_PALETTE_INIT(asr733);
-
+
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
protected:
diff --git a/src/mess/video/911_vdt.h b/src/mess/video/911_vdt.h
index f48d5cf80c1..5173d0cb29b 100644
--- a/src/mess/video/911_vdt.h
+++ b/src/mess/video/911_vdt.h
@@ -48,7 +48,7 @@ public:
~vdt911_device() { global_free(m_token); }
DECLARE_PALETTE_INIT(vdt911);
-
+
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
protected:
diff --git a/src/mess/video/abc1600.c b/src/mess/video/abc1600.c
index 117219c4426..1c4b60a7ebc 100644
--- a/src/mess/video/abc1600.c
+++ b/src/mess/video/abc1600.c
@@ -9,10 +9,10 @@
/*
- TODO:
+ TODO:
- - portrait/landscape detection is broken
- - bottom border is not respected
+ - portrait/landscape detection is broken
+ - bottom border is not respected
*/
@@ -257,12 +257,12 @@ machine_config_constructor abc1600_mover_device::device_mconfig_additions() cons
abc1600_mover_device::abc1600_mover_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ABC1600_MOVER, "ABC 1600 Mover", tag, owner, clock, "abc1600mover", __FILE__),
- device_memory_interface(mconfig, *this),
- m_space_config("vram", ENDIANNESS_BIG, 16, 18, -1, *ADDRESS_MAP_NAME(mover_map)),
- m_crtc(*this, SY6845E_TAG),
- m_wrmsk_rom(*this, "wrmsk"),
- m_shinf_rom(*this, "shinf"),
- m_drmsk_rom(*this, "drmsk")
+ device_memory_interface(mconfig, *this),
+ m_space_config("vram", ENDIANNESS_BIG, 16, 18, -1, *ADDRESS_MAP_NAME(mover_map)),
+ m_crtc(*this, SY6845E_TAG),
+ m_wrmsk_rom(*this, "wrmsk"),
+ m_shinf_rom(*this, "shinf"),
+ m_drmsk_rom(*this, "drmsk")
{
}
diff --git a/src/mess/video/abc1600.h b/src/mess/video/abc1600.h
index 3b5b9158439..c023e14f319 100644
--- a/src/mess/video/abc1600.h
+++ b/src/mess/video/abc1600.h
@@ -36,7 +36,7 @@
// ======================> abc1600_mover_device
class abc1600_mover_device : public device_t,
- public device_memory_interface
+ public device_memory_interface
{
public:
// construction/destruction
diff --git a/src/mess/video/cirrus.h b/src/mess/video/cirrus.h
index f8f0e1e3d2e..65bd68477e1 100644
--- a/src/mess/video/cirrus.h
+++ b/src/mess/video/cirrus.h
@@ -22,7 +22,7 @@ public:
virtual UINT32 pci_read(pci_bus_device *pcibus, int function, int offset, UINT32 mem_mask);
virtual void pci_write(pci_bus_device *pcibus, int function, int offset, UINT32 data, UINT32 mem_mask);
-
+
DECLARE_WRITE8_MEMBER( cirrus_42E8_w );
protected:
diff --git a/src/mess/video/gb_lcd.h b/src/mess/video/gb_lcd.h
index 1ca596aab74..e2a2ea64bf7 100644
--- a/src/mess/video/gb_lcd.h
+++ b/src/mess/video/gb_lcd.h
@@ -36,7 +36,7 @@ struct layer_struct {
};
-class gb_lcd_device : public device_t,
+class gb_lcd_device : public device_t,
public device_video_interface
{
public:
diff --git a/src/mess/video/k1ge.h b/src/mess/video/k1ge.h
index 00c3045ea91..e9ed010f2c0 100644
--- a/src/mess/video/k1ge.h
+++ b/src/mess/video/k1ge.h
@@ -27,9 +27,9 @@ public:
DECLARE_WRITE8_MEMBER( reg_write );
DECLARE_READ8_MEMBER( vram_read );
DECLARE_WRITE8_MEMBER( vram_write );
-
+
DECLARE_PALETTE_INIT(k1ge);
-
+
void update( bitmap_ind16 &bitmap, const rectangle &cliprect );
// Static methods
@@ -66,7 +66,7 @@ class k2ge_device : public k1ge_device
{
public:
k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
DECLARE_PALETTE_INIT(k2ge);
protected:
virtual machine_config_constructor device_mconfig_additions() const;
diff --git a/src/mess/video/nubus_m2video.c b/src/mess/video/nubus_m2video.c
index d99fe339067..8d2c94750fb 100644
--- a/src/mess/video/nubus_m2video.c
+++ b/src/mess/video/nubus_m2video.c
@@ -281,7 +281,7 @@ WRITE32_MEMBER( nubus_m2video_device::m2video_w )
break;
default:
-// printf("m2video_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
+// printf("m2video_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
break;
}
}
@@ -295,7 +295,7 @@ READ32_MEMBER( nubus_m2video_device::m2video_r )
}
else
{
-// printf("m2video_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
+// printf("m2video_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
}
return 0;
diff --git a/src/mess/video/pds30_procolor816.c b/src/mess/video/pds30_procolor816.c
index 759704bbfa2..96fc4bbfa5b 100644
--- a/src/mess/video/pds30_procolor816.c
+++ b/src/mess/video/pds30_procolor816.c
@@ -332,7 +332,7 @@ READ32_MEMBER( nubus_procolor816_device::procolor816_r )
}
else
{
-// printf("procolor816_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc());
+// printf("procolor816_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc());
}
return 0;
diff --git a/src/mess/video/vtvideo.c b/src/mess/video/vtvideo.c
index 2157e71ee4d..5a88875be9c 100644
--- a/src/mess/video/vtvideo.c
+++ b/src/mess/video/vtvideo.c
@@ -6,20 +6,20 @@
01/05/2009 Initial implementation [Miodrag Milanovic]
Sept. 2013 portions by Karl-Ludwig Deisenhofer.
- STATE OF DEC-100 VIDEO AS OF SEPTEMBER 2013
- -------------------------------------------
- - FURTHER TESTING: do line and character attributes match real hardware? Does soft scrolling work?
- - LIKELY INCORRECT : implementation of double size attribute in 132 columns mode (additional case)
+ STATE OF DEC-100 VIDEO AS OF SEPTEMBER 2013
+ -------------------------------------------
+ - FURTHER TESTING: do line and character attributes match real hardware? Does soft scrolling work?
+ - LIKELY INCORRECT : implementation of double size attribute in 132 columns mode (additional case)
- - MISSING: undocumented features of DC011 / DC012 - see public domain SQUEEZE.COM pokes:
- 0f00 => PORT 0C;
- 0b00 => PORT 0C;
- 1000 => PORT 04
- (SQUEEZE compresses the display in X and Y direction on a real DEC-100 B)
+ - MISSING: undocumented features of DC011 / DC012 - see public domain SQUEEZE.COM pokes:
+ 0f00 => PORT 0C;
+ 0b00 => PORT 0C;
+ 1000 => PORT 04
+ (SQUEEZE compresses the display in X and Y direction on a real DEC-100 B)
- - IMPROVEMENTS:
- - find a more realistic approach for intensity control (bold attribute)
- - correct phosphor colors (green, white and amber monitors were common)
+ - IMPROVEMENTS:
+ - find a more realistic approach for intensity control (bold attribute)
+ - correct phosphor colors (green, white and amber monitors were common)
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
@@ -122,7 +122,7 @@ void vt100_video_device::device_reset()
{
palette_set_color_rgb(machine(), 0, 0x00, 0x00, 0x00); // black
palette_set_color_rgb(machine(), 1, 0xff, 0xff, 0xff); // white
-
+
m_height = 25;
m_height_MAX = 25;
@@ -149,7 +149,7 @@ void rainbow_video_device::device_reset()
m_height = 24; // <---- DEC-100
m_height_MAX = 48;
-
+
m_lba7 = 0;
m_scroll_latch = 0;
@@ -181,7 +181,7 @@ void vt100_video_device::recompute_parameters()
} else {
horiz_pix_total = m_columns * 10; // normal 80 character mode.
}
-
+
visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1);
m_screen->configure(horiz_pix_total, vert_pix_total, visarea, m_screen->frame_period().attoseconds);
@@ -238,31 +238,31 @@ WRITE8_MEMBER( vt100_video_device::dc012_w )
// set basic attribute to reverse video / blink flip-flop off
m_basic_attribute = 1;
m_blink_flip_flop = 0;
-
- if (m_height_MAX == 25) break; // VT 100.
- if (m_height != 24)
+ if (m_height_MAX == 25) break; // VT 100.
+
+ if (m_height != 24)
{
- m_height = 24; // (DEC Rainbow 100) : 24 line display
+ m_height = 24; // (DEC Rainbow 100) : 24 line display
recompute_parameters();
- }
+ }
break;
case 0x0e:
- break; // (DC12) : 'not supported'
+ break; // (DC12) : 'not supported'
case 0x0f:
// (DEC Rainbow 100) : set basic attribute to reverse video / blink flip-flop off
m_basic_attribute = 1;
m_blink_flip_flop = 0;
- if (m_height_MAX == 25) break; // VT 100.
+ if (m_height_MAX == 25) break; // VT 100.
if (m_height != 48)
{
- m_height = 48; // (DEC Rainbow 100) : 48 line display
+ m_height = 48; // (DEC Rainbow 100) : 48 line display
recompute_parameters();
- }
+ }
break;
}
}
@@ -440,12 +440,12 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x,
{
UINT8 xsize, d_xsize;
if (m_columns == 132)
- { xsize = 9;
- d_xsize = 18;
+ { xsize = 9;
+ d_xsize = 18;
} else
{
- xsize = 10;
- d_xsize = 20;
+ xsize = 10;
+ d_xsize = 20;
}
UINT8 line = 0;
@@ -475,13 +475,13 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x,
line = m_gfx[code * 16 + j];
- if ( i == 8 )
- {
- if ( underline != 0 ) line = 0xff;
+ if ( i == 8 )
+ {
+ if ( underline != 0 ) line = 0xff;
}
// Code to handle basic attribute from VT-100
- if ( m_basic_attribute == 1 )
+ if ( m_basic_attribute == 1 )
{
if ((code & 0x80) == 0x80)
invert = 1;
@@ -489,15 +489,15 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x,
invert = 0;
}
- if (m_blink_flip_flop > 0)
+ if (m_blink_flip_flop > 0)
{
- if ( blink != 0 )
- {
- line = line ^ 0xff;
- }
+ if ( blink != 0 )
+ {
+ line = line ^ 0xff;
+ }
}
- if (invert != 0)
- line = line ^ 0xff;
+ if (invert != 0)
+ line = line ^ 0xff;
for (int b = 0; b < 8; b++)
{
@@ -519,7 +519,7 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x,
{
bitmap.pix16(y * 10 + i, x * d_xsize + 16) = bit;
bitmap.pix16(y * 10 + i, x * d_xsize + 17) = bit;
- bitmap.pix16(y * 10 + i, x * d_xsize + 18) = bit;
+ bitmap.pix16(y * 10 + i, x * d_xsize + 18) = bit;
bitmap.pix16(y * 10 + i, x * d_xsize + 19) = bit;
}
else
@@ -567,14 +567,14 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c
addr = (temp) & 0x0fff;
attr_addr = ((temp) & 0x1fff) - 2;
- // No AVO here.
- attr_addr |= 0x1000;
+ // No AVO here.
+ attr_addr |= 0x1000;
if (attr_addr > 0x2000) // Ignore attributes beyond 8192 byte limit (SRAM).
{
scroll_region = 1; // binary 1 <- SET DEFAULTS
display_type = 3; // binary 111
- } else
- {
+ } else
+ {
temp = m_in_ram_func(attr_addr);
scroll_region = (temp) & 1;
display_type = (temp >> 1) & 3;
@@ -589,22 +589,22 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c
}
else
{
- // display regular char
+ // display regular char
if (line >= m_skip_lines)
{
attr_addr = 0x1000 | ( (addr + xpos) & 0x0fff );
temp = m_in_ram_func(attr_addr); // get character attribute
- // TODO: check if reverse bit is treated the same way on real hardware
+ // TODO: check if reverse bit is treated the same way on real hardware
// 1 = display char. in REVERSE (encoded as 8)
// 0 = display char. in BOLD (encoded as 16)
// 0 = display char. w. BLINK (encoded as 32)
- // 0 = display char. w. UNDERLINE (encoded as 64).
+ // 0 = display char. w. UNDERLINE (encoded as 64).
display_char(bitmap, code, xpos, ypos, scroll_region, display_type | ( ( (temp & 1)) << 3 )
- | ( (2-(temp & 2)) << 3 )
- | ( (4-(temp & 4)) << 3 )
- | ( (8-(temp & 8)) << 3 )
- );
+ | ( (2-(temp & 2)) << 3 )
+ | ( (4-(temp & 4)) << 3 )
+ | ( (8-(temp & 8)) << 3 )
+ );
}
xpos++;
if (xpos > m_columns)
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h
index 66ae5758e6d..5eb3e1a480d 100644
--- a/src/osd/osdcomm.h
+++ b/src/osd/osdcomm.h
@@ -67,7 +67,7 @@
#define ATTR_CONST __attribute__((const))
#define ATTR_FORCE_INLINE __attribute__((always_inline))
#define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
-#define ATTR_DEPRECATED __attribute__((deprecated))
+#define ATTR_DEPRECATED __attribute__((deprecated))
/* not supported in GCC prior to 4.4.x */
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)
#define ATTR_HOT __attribute__((hot))
@@ -83,7 +83,7 @@
#else
#define ATTR_UNUSED
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-#define ATTR_NORETURN __declspec(noreturn)
+#define ATTR_NORETURN __declspec(noreturn)
#else
#define ATTR_NORETURN
#endif
@@ -93,7 +93,7 @@
#define ATTR_CONST
#define ATTR_FORCE_INLINE
#define ATTR_NONNULL(...)
-#define ATTR_DEPRECATED __declspec(deprecated)
+#define ATTR_DEPRECATED __declspec(deprecated)
#define ATTR_HOT
#define ATTR_COLD
#define UNEXPECTED(exp) (exp)
diff --git a/src/osd/portmedia/pmmidi.c b/src/osd/portmedia/pmmidi.c
index 5a6d2528347..18a43ade850 100644
--- a/src/osd/portmedia/pmmidi.c
+++ b/src/osd/portmedia/pmmidi.c
@@ -298,7 +298,7 @@ void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
PmEvent ev;
ev.timestamp = 0; // use the current time
-// printf("write: %02x (%d)\n", data, dev->xmit_cnt);
+// printf("write: %02x (%d)\n", data, dev->xmit_cnt);
if (dev->xmit_cnt >= 4)
{
@@ -314,7 +314,7 @@ void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
// if we get a status that isn't sysex, assume it's system common
if ((data & 0x80) && (data != MIDI_EOX))
{
-// printf("common during sysex!\n");
+// printf("common during sysex!\n");
ev.message = Pm_Message(data, 0, 0);
Pm_Write(dev->pmStream, &ev, 1);
return;
@@ -330,7 +330,7 @@ void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
dev->xmit_in[0] = dev->xmit_in[1] = dev->xmit_in[2] = dev->xmit_in[3] = 0;
dev->xmit_cnt = 0;
-// printf("SysEx packet: %08x\n", ev.message);
+// printf("SysEx packet: %08x\n", ev.message);
// if this is EOX, kill the running status
if (data == MIDI_EOX)
@@ -352,23 +352,23 @@ void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
{
dev->xmit_in[dev->xmit_cnt++] = dev->last_status;
dev->xmit_in[dev->xmit_cnt++] = data;
-// printf("\trunning status: [%d] = %02x, [%d] = %02x, last_status = %02x\n", dev->xmit_cnt-2, dev->last_status, dev->xmit_cnt-1, data, dev->last_status);
+// printf("\trunning status: [%d] = %02x, [%d] = %02x, last_status = %02x\n", dev->xmit_cnt-2, dev->last_status, dev->xmit_cnt-1, data, dev->last_status);
}
else
{
dev->xmit_in[dev->xmit_cnt++] = data;
-// printf("\tNRS: [%d] = %02x\n", dev->xmit_cnt-1, data);
+// printf("\tNRS: [%d] = %02x\n", dev->xmit_cnt-1, data);
}
if ((dev->xmit_cnt == 1) && (dev->xmit_in[0] == MIDI_SYSEX))
{
-// printf("Start SysEx!\n");
+// printf("Start SysEx!\n");
dev->last_status = MIDI_SYSEX;
return;
}
// are we there yet?
-// printf("status check: %02x\n", dev->xmit_in[0]);
+// printf("status check: %02x\n", dev->xmit_in[0]);
switch ((dev->xmit_in[0]>>4) & 0xf)
{
case 0xc: // 2-byte messages
diff --git a/src/osd/sdl/debugqtbreakpointswindow.c b/src/osd/sdl/debugqtbreakpointswindow.c
index 82e8bd5dc4b..31000e26c51 100644
--- a/src/osd/sdl/debugqtbreakpointswindow.c
+++ b/src/osd/sdl/debugqtbreakpointswindow.c
@@ -112,7 +112,7 @@ void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
- typeGroup->actions()[m_bwType]->trigger();
+ typeGroup->actions()[m_bwType]->trigger();
}
diff --git a/src/osd/windows/d3dhlsl.h b/src/osd/windows/d3dhlsl.h
index 31fcc7553bb..206262eea15 100644
--- a/src/osd/windows/d3dhlsl.h
+++ b/src/osd/windows/d3dhlsl.h
@@ -55,7 +55,6 @@
namespace d3d
{
-
class effect;
class shaders;
@@ -133,33 +132,33 @@ public:
uniform(effect *shader, const char *name, uniform_type type, int id);
- void set_next(uniform *next);
- uniform * get_next() { return m_next; }
+ void set_next(uniform *next);
+ uniform * get_next() { return m_next; }
- void set(float x, float y, float z, float w);
- void set(float x, float y, float z);
- void set(float x, float y);
- void set(float x);
- void set(int x);
- void set(matrix *mat);
- void set(texture *tex);
+ void set(float x, float y, float z, float w);
+ void set(float x, float y, float z);
+ void set(float x, float y);
+ void set(float x);
+ void set(int x);
+ void set(matrix *mat);
+ void set(texture *tex);
- void upload();
- void update();
+ void upload();
+ void update();
protected:
- uniform *m_next;
-
- float m_vec[4];
- int m_ival;
- matrix *m_mval;
- texture *m_texture;
- int m_count;
- uniform_type m_type;
- int m_id;
-
- effect *m_shader;
- D3DXHANDLE m_handle;
+ uniform *m_next;
+
+ float m_vec[4];
+ int m_ival;
+ matrix *m_mval;
+ texture *m_texture;
+ int m_count;
+ uniform_type m_type;
+ int m_id;
+
+ effect *m_shader;
+ D3DXHANDLE m_handle;
};
class effect
@@ -170,38 +169,38 @@ public:
effect(shaders *shadersys, device *dev, const char *name, const char *path);
~effect();
- void begin(UINT *passes, DWORD flags);
- void begin_pass(UINT pass);
+ void begin(UINT *passes, DWORD flags);
+ void begin_pass(UINT pass);
- void end();
- void end_pass();
+ void end();
+ void end_pass();
- void set_technique(const char *name);
+ void set_technique(const char *name);
- void set_vector(D3DXHANDLE param, int count, float *vector);
- void set_float(D3DXHANDLE param, float value);
- void set_int(D3DXHANDLE param, int value);
- void set_matrix(D3DXHANDLE param, matrix *matrix);
- void set_texture(D3DXHANDLE param, texture *tex);
+ void set_vector(D3DXHANDLE param, int count, float *vector);
+ void set_float(D3DXHANDLE param, float value);
+ void set_int(D3DXHANDLE param, int value);
+ void set_matrix(D3DXHANDLE param, matrix *matrix);
+ void set_texture(D3DXHANDLE param, texture *tex);
- void add_uniform(const char *name, uniform::uniform_type type, int id);
- void update_uniforms();
+ void add_uniform(const char *name, uniform::uniform_type type, int id);
+ void update_uniforms();
- D3DXHANDLE get_parameter(D3DXHANDLE param, const char *name);
+ D3DXHANDLE get_parameter(D3DXHANDLE param, const char *name);
- ULONG release();
+ ULONG release();
- shaders* get_shaders() { return m_shaders; }
+ shaders* get_shaders() { return m_shaders; }
- bool is_valid() { return m_valid; }
+ bool is_valid() { return m_valid; }
private:
- uniform *m_uniform_head;
- uniform *m_uniform_tail;
+ uniform *m_uniform_head;
+ uniform *m_uniform_tail;
ID3DXEffect *m_effect;
- shaders *m_shaders;
+ shaders *m_shaders;
- bool m_valid;
+ bool m_valid;
};
class render_target;
@@ -358,15 +357,15 @@ private:
void remove_cache_target(cache_target *cache);
// Shader passes
- void ntsc_pass(render_target *rt, vec2f &texsize, vec2f &delta);
- void color_convolution_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims);
- void prescale_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims);
- void deconverge_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims);
- void defocus_pass(render_target *rt, vec2f &texsize);
- void phosphor_pass(render_target *rt, cache_target *ct, vec2f &texsize, bool focus_enable);
- void screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum);
- void avi_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum);
- void raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta, poly_info *poly, int vertnum);
+ void ntsc_pass(render_target *rt, vec2f &texsize, vec2f &delta);
+ void color_convolution_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims);
+ void prescale_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims);
+ void deconverge_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims);
+ void defocus_pass(render_target *rt, vec2f &texsize);
+ void phosphor_pass(render_target *rt, cache_target *ct, vec2f &texsize, bool focus_enable);
+ void screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum);
+ void avi_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum);
+ void raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta, poly_info *poly, int vertnum);
base * d3dintf; // D3D interface
win_window_info * window; // D3D window info
@@ -434,9 +433,9 @@ private:
effect * vector_effect; // pointer to the vector-effect object
vertex * fsfx_vertices; // pointer to our full-screen-quad object
- texture_info * curr_texture;
- bool phosphor_passthrough;
- float target_size[2];
+ texture_info * curr_texture;
+ bool phosphor_passthrough;
+ float target_size[2];
public:
render_target * targethead;
diff --git a/src/osd/windows/d3dintf.h b/src/osd/windows/d3dintf.h
index e3b153e4369..3bc73a1726a 100644
--- a/src/osd/windows/d3dintf.h
+++ b/src/osd/windows/d3dintf.h
@@ -245,7 +245,7 @@ struct base
void * d3dobj;
HINSTANCE dllhandle;
bool post_fx_available;
- HINSTANCE libhandle;
+ HINSTANCE libhandle;
// interface pointers
interface d3d;
diff --git a/src/osd/windows/drawd3d.h b/src/osd/windows/drawd3d.h
index f22838a030b..0165c2af0a8 100644
--- a/src/osd/windows/drawd3d.h
+++ b/src/osd/windows/drawd3d.h
@@ -177,7 +177,7 @@ public:
// Setters / getters
int get_adapter() { return m_adapter; }
int get_width() { return m_width; }
- vec2f get_dims() { return vec2f(m_width, m_height); }
+ vec2f get_dims() { return vec2f(m_width, m_height); }
int get_height() { return m_height; }
int get_refresh() { return m_refresh; }
diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c
index c5b077f06a8..3da2c9f8e3f 100644
--- a/src/osd/windows/winmain.c
+++ b/src/osd/windows/winmain.c
@@ -318,7 +318,7 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
{ WINOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
{ WINOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
- { WINOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
+ { WINOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ WINOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" },
{ WINOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
{ WINOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index e84adc5425b..b85a6ce37fd 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -66,7 +66,7 @@
#define WINOPTION_WINDOW "window"
#define WINOPTION_MAXIMIZE "maximize"
#define WINOPTION_KEEPASPECT "keepaspect"
-#define WINOPTION_UNEVENSTRETCH "unevenstretch"
+#define WINOPTION_UNEVENSTRETCH "unevenstretch"
#define WINOPTION_PRESCALE "prescale"
#define WINOPTION_WAITVSYNC "waitvsync"
#define WINOPTION_SYNCREFRESH "syncrefresh"
diff --git a/src/osd/windows/winptty.c b/src/osd/windows/winptty.c
index 0f0bea55b0d..5f582412072 100644
--- a/src/osd/windows/winptty.c
+++ b/src/osd/windows/winptty.c
@@ -18,9 +18,9 @@ file_error win_open_ptty(const char *path, UINT32 openflags, osd_file **file, UI
return FILERR_OUT_OF_MEMORY;
pipe = CreateNamedPipe(t_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 32, 32, 0, NULL);
-
+
osd_free(t_name);
-
+
if(pipe == INVALID_HANDLE_VALUE)
return FILERR_ACCESS_DENIED;
diff --git a/src/tools/jedutil.c b/src/tools/jedutil.c
index 52dff1f1b29..d290fcc5295 100644
--- a/src/tools/jedutil.c
+++ b/src/tools/jedutil.c
@@ -514,64 +514,64 @@ static pin_fuse_rows pal20r8pinfuserows[] = {
{22, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 280}}; /* Registered Output */
static pin_fuse_rows pal20x4pinfuserows[] = {
- {14, 1440, 1480, 1560},
- {15, 1280, 1320, 1400},
- {16, 1120, 1160, 1240},
- {17, NO_OUTPUT_ENABLE_FUSE_ROW, 960, 1080}, /* Registered Output */
- {18, NO_OUTPUT_ENABLE_FUSE_ROW, 800, 920}, /* Registered Output */
- {19, NO_OUTPUT_ENABLE_FUSE_ROW, 640, 760}, /* Registered Output */
- {20, NO_OUTPUT_ENABLE_FUSE_ROW, 480, 600}, /* Registered Output */
- {21, 320, 360, 440},
- {22, 160, 200, 280},
- {23, 0, 40, 120}};
+ {14, 1440, 1480, 1560},
+ {15, 1280, 1320, 1400},
+ {16, 1120, 1160, 1240},
+ {17, NO_OUTPUT_ENABLE_FUSE_ROW, 960, 1080}, /* Registered Output */
+ {18, NO_OUTPUT_ENABLE_FUSE_ROW, 800, 920}, /* Registered Output */
+ {19, NO_OUTPUT_ENABLE_FUSE_ROW, 640, 760}, /* Registered Output */
+ {20, NO_OUTPUT_ENABLE_FUSE_ROW, 480, 600}, /* Registered Output */
+ {21, 320, 360, 440},
+ {22, 160, 200, 280},
+ {23, 0, 40, 120}};
static pin_fuse_rows pal20x8pinfuserows[] = {
- {14, 1440, 1480, 1560},
- {15, NO_OUTPUT_ENABLE_FUSE_ROW, 1280, 1400}, /* Registered Output */
- {16, NO_OUTPUT_ENABLE_FUSE_ROW, 1120, 1240}, /* Registered Output */
- {17, NO_OUTPUT_ENABLE_FUSE_ROW, 960, 1080}, /* Registered Output */
- {18, NO_OUTPUT_ENABLE_FUSE_ROW, 800, 920}, /* Registered Output */
- {19, NO_OUTPUT_ENABLE_FUSE_ROW, 640, 760}, /* Registered Output */
- {20, NO_OUTPUT_ENABLE_FUSE_ROW, 480, 600}, /* Registered Output */
- {21, NO_OUTPUT_ENABLE_FUSE_ROW, 320, 440}, /* Registered Output */
- {22, NO_OUTPUT_ENABLE_FUSE_ROW, 160, 280}, /* Registered Output */
- {23, 0, 40, 120}};
+ {14, 1440, 1480, 1560},
+ {15, NO_OUTPUT_ENABLE_FUSE_ROW, 1280, 1400}, /* Registered Output */
+ {16, NO_OUTPUT_ENABLE_FUSE_ROW, 1120, 1240}, /* Registered Output */
+ {17, NO_OUTPUT_ENABLE_FUSE_ROW, 960, 1080}, /* Registered Output */
+ {18, NO_OUTPUT_ENABLE_FUSE_ROW, 800, 920}, /* Registered Output */
+ {19, NO_OUTPUT_ENABLE_FUSE_ROW, 640, 760}, /* Registered Output */
+ {20, NO_OUTPUT_ENABLE_FUSE_ROW, 480, 600}, /* Registered Output */
+ {21, NO_OUTPUT_ENABLE_FUSE_ROW, 320, 440}, /* Registered Output */
+ {22, NO_OUTPUT_ENABLE_FUSE_ROW, 160, 280}, /* Registered Output */
+ {23, 0, 40, 120}};
static pin_fuse_rows pal20x10pinfuserows[] = {
- {14, NO_OUTPUT_ENABLE_FUSE_ROW, 1440, 1560}, /* Registered Output */
- {15, NO_OUTPUT_ENABLE_FUSE_ROW, 1280, 1400}, /* Registered Output */
- {16, NO_OUTPUT_ENABLE_FUSE_ROW, 1120, 1240}, /* Registered Output */
- {17, NO_OUTPUT_ENABLE_FUSE_ROW, 960, 1080}, /* Registered Output */
- {18, NO_OUTPUT_ENABLE_FUSE_ROW, 800, 920}, /* Registered Output */
- {19, NO_OUTPUT_ENABLE_FUSE_ROW, 640, 760}, /* Registered Output */
- {20, NO_OUTPUT_ENABLE_FUSE_ROW, 480, 600}, /* Registered Output */
- {21, NO_OUTPUT_ENABLE_FUSE_ROW, 320, 440}, /* Registered Output */
- {22, NO_OUTPUT_ENABLE_FUSE_ROW, 160, 280}, /* Registered Output */
- {23, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 120}}; /* Registered Output */
+ {14, NO_OUTPUT_ENABLE_FUSE_ROW, 1440, 1560}, /* Registered Output */
+ {15, NO_OUTPUT_ENABLE_FUSE_ROW, 1280, 1400}, /* Registered Output */
+ {16, NO_OUTPUT_ENABLE_FUSE_ROW, 1120, 1240}, /* Registered Output */
+ {17, NO_OUTPUT_ENABLE_FUSE_ROW, 960, 1080}, /* Registered Output */
+ {18, NO_OUTPUT_ENABLE_FUSE_ROW, 800, 920}, /* Registered Output */
+ {19, NO_OUTPUT_ENABLE_FUSE_ROW, 640, 760}, /* Registered Output */
+ {20, NO_OUTPUT_ENABLE_FUSE_ROW, 480, 600}, /* Registered Output */
+ {21, NO_OUTPUT_ENABLE_FUSE_ROW, 320, 440}, /* Registered Output */
+ {22, NO_OUTPUT_ENABLE_FUSE_ROW, 160, 280}, /* Registered Output */
+ {23, NO_OUTPUT_ENABLE_FUSE_ROW, 0, 120}}; /* Registered Output */
static pin_fuse_rows _82s153_pls153pinfuserows[] = {
- {9, 1472, 0, 0},
- {11, 1508, 0, 0},
- {12, 1544, 0, 0},
- {13, 1580, 0, 0},
- {14, 1616, 0, 0},
- {15, 1652, 0, 0},
- {16, 1688, 0, 0},
- {17, 1724, 0, 0},
- {18, 1760, 0, 0},
- {19, 1796, 0, 0}};
+ {9, 1472, 0, 0},
+ {11, 1508, 0, 0},
+ {12, 1544, 0, 0},
+ {13, 1580, 0, 0},
+ {14, 1616, 0, 0},
+ {15, 1652, 0, 0},
+ {16, 1688, 0, 0},
+ {17, 1724, 0, 0},
+ {18, 1760, 0, 0},
+ {19, 1796, 0, 0}};
static pin_fuse_rows ck2605pinfuserows[] = {
- {9, 736, 0, 0},
- {11, 772, 0, 0},
- {12, 808, 0, 0},
- {13, 844, 0, 0},
- {14, 880, 0, 0},
- {15, 916, 0, 0},
- {16, 952, 0, 0},
- {17, 988, 0, 0},
- {18, 1024, 0, 0},
- {19, 1060, 0, 0}};
+ {9, 736, 0, 0},
+ {11, 772, 0, 0},
+ {12, 808, 0, 0},
+ {13, 844, 0, 0},
+ {14, 880, 0, 0},
+ {15, 916, 0, 0},
+ {16, 952, 0, 0},
+ {17, 988, 0, 0},
+ {18, 1024, 0, 0},
+ {19, 1060, 0, 0}};
static pin_fuse_columns pal10l8pinfusecolumns[] = {
{1, 3, 2},
@@ -970,111 +970,111 @@ static pin_fuse_columns pal20r8pinfusecolumns[] = {
{23, 3, 2}};
static pin_fuse_columns pal20x4pinfusecolumns[] = {
- {2, 1, 0},
- {3, 5, 4},
- {4, 9, 8},
- {5, 13, 12},
- {6, 17, 16},
- {7, 21, 20},
- {8, 25, 24},
- {9, 29, 28},
- {10, 33, 32},
- {11, 37, 36},
- {14, 39, 38},
- {15, 35, 34},
- {16, 31, 30},
- {17, 27, 26},
- {18, 23, 22},
- {19, 19, 18},
- {20, 15, 14},
- {21, 11, 10},
- {22, 7, 6},
- {23, 3, 2}};
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {14, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6},
+ {23, 3, 2}};
static pin_fuse_columns pal20x8pinfusecolumns[] = {
- {2, 1, 0},
- {3, 5, 4},
- {4, 9, 8},
- {5, 13, 12},
- {6, 17, 16},
- {7, 21, 20},
- {8, 25, 24},
- {9, 29, 28},
- {10, 33, 32},
- {11, 37, 36},
- {14, 39, 38},
- {15, 35, 34},
- {16, 31, 30},
- {17, 27, 26},
- {18, 23, 22},
- {19, 19, 18},
- {20, 15, 14},
- {21, 11, 10},
- {22, 7, 6},
- {23, 3, 2}};
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {14, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6},
+ {23, 3, 2}};
static pin_fuse_columns pal20x10pinfusecolumns[] = {
- {2, 1, 0},
- {3, 5, 4},
- {4, 9, 8},
- {5, 13, 12},
- {6, 17, 16},
- {7, 21, 20},
- {8, 25, 24},
- {9, 29, 28},
- {10, 33, 32},
- {11, 37, 36},
- {14, 39, 38},
- {15, 35, 34},
- {16, 31, 30},
- {17, 27, 26},
- {18, 23, 22},
- {19, 19, 18},
- {20, 15, 14},
- {21, 11, 10},
- {22, 7, 6},
- {23, 3, 2}
+ {2, 1, 0},
+ {3, 5, 4},
+ {4, 9, 8},
+ {5, 13, 12},
+ {6, 17, 16},
+ {7, 21, 20},
+ {8, 25, 24},
+ {9, 29, 28},
+ {10, 33, 32},
+ {11, 37, 36},
+ {14, 39, 38},
+ {15, 35, 34},
+ {16, 31, 30},
+ {17, 27, 26},
+ {18, 23, 22},
+ {19, 19, 18},
+ {20, 15, 14},
+ {21, 11, 10},
+ {22, 7, 6},
+ {23, 3, 2}
};
static pin_fuse_columns _82s153_pls153pinfusecolumns[] = {
- {1, 1, 0},
- {2, 3, 2},
- {3, 5, 4},
- {4, 7, 6},
- {5, 9, 8},
- {6, 11, 10},
- {7, 13, 12},
- {8, 15, 14},
- {9, 17, 16},
- {11, 19, 18},
- {12, 21, 20},
- {13, 23, 22},
- {14, 25, 24},
- {15, 27, 26},
- {16, 29, 28},
- {17, 31, 30},
- {18, 33, 32},
- {19, 35, 34}};
+ {1, 1, 0},
+ {2, 3, 2},
+ {3, 5, 4},
+ {4, 7, 6},
+ {5, 9, 8},
+ {6, 11, 10},
+ {7, 13, 12},
+ {8, 15, 14},
+ {9, 17, 16},
+ {11, 19, 18},
+ {12, 21, 20},
+ {13, 23, 22},
+ {14, 25, 24},
+ {15, 27, 26},
+ {16, 29, 28},
+ {17, 31, 30},
+ {18, 33, 32},
+ {19, 35, 34}};
static pin_fuse_columns ck2605pinfusecolumns[] = {
- {1, 1, 0},
- {2, 3, 2},
- {3, 5, 4},
- {4, 7, 6},
- {5, 9, 8},
- {6, 11, 10},
- {7, 13, 12},
- {8, 15, 14},
- {9, 17, 16},
- {11, 19, 18},
- {12, 21, 20},
- {13, 23, 22},
- {14, 25, 24},
- {15, 27, 26},
- {16, 29, 28},
- {17, 31, 30},
- {18, 33, 32},
- {19, 35, 34}};
+ {1, 1, 0},
+ {2, 3, 2},
+ {3, 5, 4},
+ {4, 7, 6},
+ {5, 9, 8},
+ {6, 11, 10},
+ {7, 13, 12},
+ {8, 15, 14},
+ {9, 17, 16},
+ {11, 19, 18},
+ {12, 21, 20},
+ {13, 23, 22},
+ {14, 25, 24},
+ {15, 27, 26},
+ {16, 29, 28},
+ {17, 31, 30},
+ {18, 33, 32},
+ {19, 35, 34}};
static pal_data paldata[] = {
{"PAL10L8",
@@ -1172,12 +1172,12 @@ static pal_data paldata[] = {
/*{"PAL16RA8", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},
{"PAL16V8R", NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},*/
{"PALCE16V8",
- palce16v8pinfuserows, ARRAY_LEN(palce16v8pinfuserows),
- palce16v8pinfusecolumns, ARRAY_LEN(palce16v8pinfusecolumns),
+ palce16v8pinfuserows, ARRAY_LEN(palce16v8pinfuserows),
+ palce16v8pinfusecolumns, ARRAY_LEN(palce16v8pinfusecolumns),
print_palce16v8_product_terms,
config_palce16v8_pins,
- NULL,
- NULL},
+ NULL,
+ NULL},
{"GAL16V8",
gal16v8pinfuserows, ARRAY_LEN(gal16v8pinfuserows),
gal16v8pinfusecolumns, ARRAY_LEN(gal16v8pinfusecolumns),
@@ -1192,7 +1192,7 @@ static pal_data paldata[] = {
config_peel18cv8_pins,
NULL,
get_peel18cv8_pin_fuse_state},
- {"GAL18V10",
+ {"GAL18V10",
gal18v10pinfuserows, ARRAY_LEN(gal18v10pinfuserows),
gal18v10pinfusecolumns, ARRAY_LEN(gal18v10pinfusecolumns),
print_gal18v10_product_terms,
@@ -1273,7 +1273,7 @@ static pal_data paldata[] = {
config_82s153_pls153_pins,
NULL,
NULL},
- {"CK2605",
+ {"CK2605",
ck2605pinfuserows, ARRAY_LEN(ck2605pinfuserows),
ck2605pinfusecolumns, ARRAY_LEN(ck2605pinfusecolumns),
print_ck2605_product_terms,
@@ -2140,7 +2140,7 @@ static void print_pal16r8_product_terms(const pal_data* pal, const jed_data* jed
static void print_palce16v8_product_terms(const pal_data* pal, const jed_data* jed)
{
- fprintf(stderr, "Printing product terms for PALCE16V8 not supported!\n");
+ fprintf(stderr, "Printing product terms for PALCE16V8 not supported!\n");
/*print_product_terms(pal, jed);*/
}
@@ -2347,7 +2347,7 @@ static void print_82s153_pls153_product_terms(const pal_data* pal, const jed_dat
printf("Equations:\n\n");
for (index = 0; index < outputpinscount; ++index)
- {
+ {
flags = outputpins[index].flags;
indent = 0;
@@ -2363,51 +2363,51 @@ static void print_82s153_pls153_product_terms(const pal_data* pal, const jed_dat
printf("%s", buffer);
- haveterms = 0;
+ haveterms = 0;
indent += strlen(buffer);
fuse_rows = find_fuse_rows(pal, outputpins[index].pin);
- fuserow = 0;
-
- if (outputpins[index].pin != 9)
- {
- or_column = 19 - outputpins[index].pin;
- }
- else
- {
- or_column = 9;
- }
-
- for (row = 0; row < 32; ++row)
- {
- if (!jed_get_fuse(jed, fuserow + columncount + or_column))
- {
- generate_product_terms(pal, jed, fuserow, buffer);
-
- if (strlen(buffer) > 0)
- {
- if (haveterms)
- {
- printf(" +\n");
-
- for (indentindex = 0; indentindex < indent; ++indentindex)
- {
- printf(" ");
- }
- }
- else
- {
- haveterms = 1;
- }
-
- printf("%s", buffer);
- }
- }
-
- fuserow += (columncount + 10);
- }
-
- printf("\n");
+ fuserow = 0;
+
+ if (outputpins[index].pin != 9)
+ {
+ or_column = 19 - outputpins[index].pin;
+ }
+ else
+ {
+ or_column = 9;
+ }
+
+ for (row = 0; row < 32; ++row)
+ {
+ if (!jed_get_fuse(jed, fuserow + columncount + or_column))
+ {
+ generate_product_terms(pal, jed, fuserow, buffer);
+
+ if (strlen(buffer) > 0)
+ {
+ if (haveterms)
+ {
+ printf(" +\n");
+
+ for (indentindex = 0; indentindex < indent; ++indentindex)
+ {
+ printf(" ");
+ }
+ }
+ else
+ {
+ haveterms = 1;
+ }
+
+ printf("%s", buffer);
+ }
+ }
+
+ fuserow += (columncount + 10);
+ }
+
+ printf("\n");
/* output enable equations */
@@ -2425,7 +2425,7 @@ static void print_82s153_pls153_product_terms(const pal_data* pal, const jed_dat
}
printf("\n");
- }
+ }
}
@@ -2450,7 +2450,7 @@ static void print_ck2605_product_terms(const pal_data* pal, const jed_data* jed)
printf("Equations:\n\n");
for (index = 0; index < outputpinscount; ++index)
- {
+ {
flags = outputpins[index].flags;
indent = 0;
@@ -2466,51 +2466,51 @@ static void print_ck2605_product_terms(const pal_data* pal, const jed_data* jed)
printf("%s", buffer);
- haveterms = 0;
+ haveterms = 0;
indent += strlen(buffer);
fuse_rows = find_fuse_rows(pal, outputpins[index].pin);
- fuserow = 0;
-
- if (outputpins[index].pin != 9)
- {
- or_column = 19 - outputpins[index].pin;
- }
- else
- {
- or_column = 9;
- }
-
- for (row = 0; row < 16; ++row)
- {
- if (!jed_get_fuse(jed, fuserow + columncount + or_column))
- {
- generate_product_terms(pal, jed, fuserow, buffer);
-
- if (strlen(buffer) > 0)
- {
- if (haveterms)
- {
- printf(" +\n");
-
- for (indentindex = 0; indentindex < indent; ++indentindex)
- {
- printf(" ");
- }
- }
- else
- {
- haveterms = 1;
- }
-
- printf("%s", buffer);
- }
- }
-
- fuserow += (columncount + 10);
- }
-
- printf("\n");
+ fuserow = 0;
+
+ if (outputpins[index].pin != 9)
+ {
+ or_column = 19 - outputpins[index].pin;
+ }
+ else
+ {
+ or_column = 9;
+ }
+
+ for (row = 0; row < 16; ++row)
+ {
+ if (!jed_get_fuse(jed, fuserow + columncount + or_column))
+ {
+ generate_product_terms(pal, jed, fuserow, buffer);
+
+ if (strlen(buffer) > 0)
+ {
+ if (haveterms)
+ {
+ printf(" +\n");
+
+ for (indentindex = 0; indentindex < indent; ++indentindex)
+ {
+ printf(" ");
+ }
+ }
+ else
+ {
+ haveterms = 1;
+ }
+
+ printf("%s", buffer);
+ }
+ }
+
+ fuserow += (columncount + 10);
+ }
+
+ printf("\n");
/* output enable equations */
@@ -2528,7 +2528,7 @@ static void print_ck2605_product_terms(const pal_data* pal, const jed_data* jed)
}
printf("\n");
- }
+ }
}
@@ -2888,7 +2888,7 @@ static void config_palce16v8_pins(const pal_data* pal, const jed_data* jed)
struct _output_logic_macrocell
{
UINT16 pin;
- UINT16 sl0_fuse; /* registers allowed */
+ UINT16 sl0_fuse; /* registers allowed */
UINT16 sl1_fuse; /* output polarity 0 - low, 1 - high */
};
@@ -2901,40 +2901,40 @@ static void config_palce16v8_pins(const pal_data* pal, const jed_data* jed)
{17, 2122, 2050},
{18, 2121, 2049},
{19, 2120, 2048}};
- UINT16 sg0 = 2192; /* guessing on fuse here */
- UINT16 sg1 = 2193; /* guessing on fuse here */
- UINT16 index;
-
- for (index = 0; index < ARRAY_LEN(macrocells); ++index)
- {
- if (jed_get_fuse(jed, sg0))
- {
- /* Device uses no registers */
-
- if (jed_get_fuse(jed, sg1))
- {
- /* Combinatorial I/O */
- }
- else
- {
- /* Combinatorial Output or Input */
- }
- }
- else
- {
- /* Device uses registers */
-
- if (jed_get_fuse(jed, sg1))
- {
- }
- else
- {
- fprintf(stderr, "Unknown configuration type!\n");
- }
- }
- }
-
- /* 2056 - 2119 are the 64 bit signature fuses */
+ UINT16 sg0 = 2192; /* guessing on fuse here */
+ UINT16 sg1 = 2193; /* guessing on fuse here */
+ UINT16 index;
+
+ for (index = 0; index < ARRAY_LEN(macrocells); ++index)
+ {
+ if (jed_get_fuse(jed, sg0))
+ {
+ /* Device uses no registers */
+
+ if (jed_get_fuse(jed, sg1))
+ {
+ /* Combinatorial I/O */
+ }
+ else
+ {
+ /* Combinatorial Output or Input */
+ }
+ }
+ else
+ {
+ /* Device uses registers */
+
+ if (jed_get_fuse(jed, sg1))
+ {
+ }
+ else
+ {
+ fprintf(stderr, "Unknown configuration type!\n");
+ }
+ }
+ }
+
+ /* 2056 - 2119 are the 64 bit signature fuses */
fprintf(stderr, "Configuring product terms for PALCE16V8 not supported!\n");
}
@@ -3641,7 +3641,7 @@ static void config_pal20x4_pins(const pal_data* pal, const jed_data* jed)
{
static UINT16 input_pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
static pin_output_config output_pins[] = {
- {14, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
+ {14, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
{15, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
{16, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
{17, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
@@ -3650,7 +3650,7 @@ static void config_pal20x4_pins(const pal_data* pal, const jed_data* jed)
{20, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{21, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
{22, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
- {23, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT}};
+ {23, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT}};
set_input_pins(input_pins, ARRAY_LEN(input_pins));
set_output_pins(output_pins, ARRAY_LEN(output_pins));
@@ -3665,7 +3665,7 @@ static void config_pal20x8_pins(const pal_data* pal, const jed_data* jed)
{
static UINT16 input_pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
static pin_output_config output_pins[] = {
- {14, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
+ {14, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT},
{15, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{16, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{17, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
@@ -3674,7 +3674,7 @@ static void config_pal20x8_pins(const pal_data* pal, const jed_data* jed)
{20, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{21, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{22, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
- {23, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT}};
+ {23, OUTPUT_ACTIVELOW | OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT}};
set_input_pins(input_pins, ARRAY_LEN(input_pins));
set_output_pins(output_pins, ARRAY_LEN(output_pins));
@@ -3691,7 +3691,7 @@ static void config_pal20x10_pins(const pal_data* pal, const jed_data* jed)
{
static UINT16 input_pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
static pin_output_config output_pins[] = {
- {14, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
+ {14, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{15, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{16, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{17, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
@@ -3700,7 +3700,7 @@ static void config_pal20x10_pins(const pal_data* pal, const jed_data* jed)
{20, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{21, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
{22, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED},
- {23, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED}};
+ {23, OUTPUT_ACTIVELOW | OUTPUT_REGISTERED | OUTPUT_FEEDBACK_REGISTERED}};
set_input_pins(input_pins, ARRAY_LEN(input_pins));
set_output_pins(output_pins, ARRAY_LEN(output_pins));
@@ -3721,12 +3721,12 @@ static void config_82s153_pls153_pins(const pal_data* pal, const jed_data* jed)
output_pin_count = 0;
- for (index = 0; index < pal->pinfuserowscount; ++index)
- {
- if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
- {
- output_pins[output_pin_count].pin = pal->pinfuserows[index].pin;
- output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT;
+ for (index = 0; index < pal->pinfuserowscount; ++index)
+ {
+ if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
+ {
+ output_pins[output_pin_count].pin = pal->pinfuserows[index].pin;
+ output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT;
if (jed_get_fuse(jed, 1832 + (9 - index)))
{
@@ -3737,9 +3737,9 @@ static void config_82s153_pls153_pins(const pal_data* pal, const jed_data* jed)
output_pins[output_pin_count].flags |= OUTPUT_ACTIVEHIGH;
}
- ++output_pin_count;
- }
- }
+ ++output_pin_count;
+ }
+ }
set_input_pins(input_pins, ARRAY_LEN(input_pins));
set_output_pins(output_pins, output_pin_count);
@@ -3760,12 +3760,12 @@ static void config_ck2605_pins(const pal_data* pal, const jed_data* jed)
output_pin_count = 0;
- for (index = 0; index < pal->pinfuserowscount; ++index)
- {
- if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
- {
- output_pins[output_pin_count].pin = pal->pinfuserows[index].pin;
- output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT;
+ for (index = 0; index < pal->pinfuserowscount; ++index)
+ {
+ if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable))
+ {
+ output_pins[output_pin_count].pin = pal->pinfuserows[index].pin;
+ output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT;
if (jed_get_fuse(jed, 1096 + (9 - index)))
{
@@ -3776,9 +3776,9 @@ static void config_ck2605_pins(const pal_data* pal, const jed_data* jed)
output_pins[output_pin_count].flags |= OUTPUT_ACTIVEHIGH;
}
- ++output_pin_count;
- }
- }
+ ++output_pin_count;
+ }
+ }
set_input_pins(input_pins, ARRAY_LEN(input_pins));
set_output_pins(output_pins, output_pin_count);
diff --git a/src/version.c b/src/version.c
index 6f12d16ed61..b9e412b3344 100644
--- a/src/version.c
+++ b/src/version.c
@@ -38,4 +38,4 @@
***************************************************************************/
extern const char build_version[];
-const char build_version[] = "0.149u1 ("__DATE__")";
+const char build_version[] = "0.150 ("__DATE__")";