[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[534] trunk
Brought to you by:
fredm
From: <fr...@us...> - 2008-10-21 12:05:59
|
Revision: 534 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=534&view=rev Author: fredm Date: 2008-10-21 12:05:43 +0000 (Tue, 21 Oct 2008) Log Message: ----------- Merge up to vendor revision 3775. Revision Links: -------------- http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=3775&view=rev Modified Paths: -------------- trunk/FuseGenerator/FuseGenerator.xcodeproj/project.pbxproj trunk/FuseGenerator/LibspectrumSCRExtractor.m trunk/FuseGenerator/generate.pl trunk/FuseGenerator/libspectrum.h trunk/FuseImporter/FuseImporter.xcodeproj/project.pbxproj trunk/FuseImporter/LibspectrumMetadataImporter.m trunk/FuseImporter/generate.pl trunk/FuseImporter/libspectrum.h trunk/fuse/Makefile.am trunk/fuse/README trunk/fuse/compat/amiga/Makefile.am trunk/fuse/compat/morphos/Makefile.am trunk/fuse/compat/unix/Makefile.am trunk/fuse/compat/unix/osname.c trunk/fuse/compat/win32/Makefile.am trunk/fuse/compat.h trunk/fuse/configure.in trunk/fuse/dck.c trunk/fuse/debugger/Makefile.am trunk/fuse/debugger/breakpoint.c trunk/fuse/debugger/breakpoint.h trunk/fuse/debugger/command.c trunk/fuse/debugger/commandl.l trunk/fuse/debugger/commandy.y trunk/fuse/debugger/debugger.c trunk/fuse/debugger/debugger.h trunk/fuse/debugger/debugger_internals.h trunk/fuse/debugger/expression.c trunk/fuse/disk/beta.c trunk/fuse/disk/beta.h trunk/fuse/disk/disk.c trunk/fuse/disk/fdd.c trunk/fuse/disk/fdd.h trunk/fuse/disk/plusd.c trunk/fuse/disk/plusd.h trunk/fuse/disk/upd_fdc.c trunk/fuse/disk/upd_fdc.h trunk/fuse/disk/wd_fdc.c trunk/fuse/disk/wd_fdc.h trunk/fuse/divide.c trunk/fuse/event.c trunk/fuse/event.h trunk/fuse/fuse.c trunk/fuse/fusepb/English.lproj/InfoPlist.strings trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj trunk/fuse/fusepb/Info-Fuse.plist trunk/fuse/fusepb/controllers/DebuggerController.m trunk/fuse/fusepb/models/Emulator.m trunk/fuse/hacking/ChangeLog trunk/fuse/if1.c trunk/fuse/input.c trunk/fuse/input.h trunk/fuse/keysyms.pl trunk/fuse/loader.c trunk/fuse/machine.c trunk/fuse/machines/specplus3.h trunk/fuse/memory.c trunk/fuse/menu.c trunk/fuse/menu.h trunk/fuse/menu_data.dat trunk/fuse/menu_data.pl trunk/fuse/periph.c trunk/fuse/periph.h trunk/fuse/profile.c trunk/fuse/rzx.c trunk/fuse/rzx.h trunk/fuse/screenshot.c trunk/fuse/settings.dat trunk/fuse/simpleide.c trunk/fuse/snapshot.c trunk/fuse/sound/alsasound.c trunk/fuse/sound/dxsound.c trunk/fuse/sound/win32sound.c trunk/fuse/spectrum.c trunk/fuse/spectrum.h trunk/fuse/tape.c trunk/fuse/tape.h trunk/fuse/timer/timer.c trunk/fuse/timer/timer.h trunk/fuse/ui/cocoa/cocoajoystick.c trunk/fuse/ui/fb/fbdisplay.c trunk/fuse/ui/gtk/debugger.c trunk/fuse/ui/gtk/gtkjoystick.c trunk/fuse/ui/gtk/gtkkeyboard.c trunk/fuse/ui/gtk/gtkui.c trunk/fuse/ui/options.dat trunk/fuse/ui/scaler/scalers.c trunk/fuse/ui/sdl/sdldisplay.c trunk/fuse/ui/sdl/sdljoystick.c trunk/fuse/ui/svga/svgadisplay.c trunk/fuse/ui/svga/svgajoystick.c trunk/fuse/ui/uidisplay.h trunk/fuse/ui/uijoystick.c trunk/fuse/ui/widget/Makefile.am trunk/fuse/ui/widget/browse.c trunk/fuse/ui/widget/debugger.c trunk/fuse/ui/widget/error.c trunk/fuse/ui/widget/filesel.c trunk/fuse/ui/widget/memory.c trunk/fuse/ui/widget/menu.c trunk/fuse/ui/widget/options.pl trunk/fuse/ui/widget/picture.c trunk/fuse/ui/widget/pokefinder.c trunk/fuse/ui/widget/query.c trunk/fuse/ui/widget/roms.c trunk/fuse/ui/widget/select.c trunk/fuse/ui/widget/text.c trunk/fuse/ui/widget/widget.c trunk/fuse/ui/widget/widget.h trunk/fuse/ui/widget/widget_internals.h trunk/fuse/ui/win32/Makefile.am trunk/fuse/ui/win32/binary.c trunk/fuse/ui/win32/binary.rc trunk/fuse/ui/win32/browse.c trunk/fuse/ui/win32/browse.h trunk/fuse/ui/win32/browse.rc trunk/fuse/ui/win32/debugger.c trunk/fuse/ui/win32/debugger.h trunk/fuse/ui/win32/debugger.rc trunk/fuse/ui/win32/memorybrowser.c trunk/fuse/ui/win32/memorybrowser.h trunk/fuse/ui/win32/memorybrowser.rc trunk/fuse/ui/win32/options-header.pl trunk/fuse/ui/win32/options-resource.pl trunk/fuse/ui/win32/options.pl trunk/fuse/ui/win32/picture.c trunk/fuse/ui/win32/picture.h trunk/fuse/ui/win32/picture.rc trunk/fuse/ui/win32/pokefinder.c trunk/fuse/ui/win32/pokefinder.h trunk/fuse/ui/win32/pokefinder.rc trunk/fuse/ui/win32/rollback.c trunk/fuse/ui/win32/rollback.rc trunk/fuse/ui/win32/roms.c trunk/fuse/ui/win32/roms.rc trunk/fuse/ui/win32/select_template.rc trunk/fuse/ui/win32/statusbar.c trunk/fuse/ui/win32/win32display.c trunk/fuse/ui/win32/win32internals.h trunk/fuse/ui/win32/win32joystick.c trunk/fuse/ui/win32/win32joystick.rc trunk/fuse/ui/win32/win32keyboard.c trunk/fuse/ui/win32/win32ui.c trunk/fuse/ui/xlib/xdisplay.c trunk/fuse/ui/xlib/xui.c trunk/fuse/unittests/unittests.c trunk/fuse/utils.c trunk/fuse/z80/coretest.c trunk/fuse/z80/tests/tests.expected trunk/fuse/z80/tests/tests.in trunk/fuse/z80/z80.c trunk/fuse/z80/z80.h trunk/fuse/z80/z80.pl trunk/fuse/z80/z80_ops.c trunk/fuse/zxatasp.c trunk/fuse/zxcf.c trunk/libspectrum/generate.pl trunk/libspectrum/libspectrum/Makefile.am trunk/libspectrum/libspectrum/accessor.pl trunk/libspectrum/libspectrum/bzip2.c trunk/libspectrum/libspectrum/configure.in trunk/libspectrum/libspectrum/creator.c trunk/libspectrum/libspectrum/crypto.c trunk/libspectrum/libspectrum/csw.c trunk/libspectrum/libspectrum/dck.c trunk/libspectrum/libspectrum/hacking/ChangeLog trunk/libspectrum/libspectrum/ide.c trunk/libspectrum/libspectrum/internals.h trunk/libspectrum/libspectrum/libspectrum.c trunk/libspectrum/libspectrum/libspectrum.h.in trunk/libspectrum/libspectrum/make-perl.c trunk/libspectrum/libspectrum/microdrive.c trunk/libspectrum/libspectrum/myglib/Makefile.am trunk/libspectrum/libspectrum/myglib/ghash.c trunk/libspectrum/libspectrum/myglib/gslist.c trunk/libspectrum/libspectrum/plusd.c trunk/libspectrum/libspectrum/rzx.c trunk/libspectrum/libspectrum/sna.c trunk/libspectrum/libspectrum/snapshot.c trunk/libspectrum/libspectrum/sp.c trunk/libspectrum/libspectrum/szx.c trunk/libspectrum/libspectrum/tap.c trunk/libspectrum/libspectrum/tape.c trunk/libspectrum/libspectrum/tape_block.c trunk/libspectrum/libspectrum/tape_block.h trunk/libspectrum/libspectrum/test/Makefile.am trunk/libspectrum/libspectrum/test/edges.c trunk/libspectrum/libspectrum/test/test.c trunk/libspectrum/libspectrum/test/test.h trunk/libspectrum/libspectrum/test/test15.c trunk/libspectrum/libspectrum/tzx_read.c trunk/libspectrum/libspectrum/tzx_write.c trunk/libspectrum/libspectrum/warajevo_read.c trunk/libspectrum/libspectrum/wav.c trunk/libspectrum/libspectrum/z80.c trunk/libspectrum/libspectrum/z80em.c trunk/libspectrum/libspectrum/zlib.c trunk/libspectrum/libspectrum/zxs.c trunk/libspectrum/libspectrum.h trunk/libspectrum/libspectrum.xcodeproj/project.pbxproj Added Paths: ----------- trunk/fuse/PORTING trunk/fuse/compat/unix/file.c trunk/fuse/compat/wii/ trunk/fuse/compat/wii/Makefile.am trunk/fuse/compat/wii/file.c trunk/fuse/debugger/event.c trunk/fuse/debugger/variable.c trunk/fuse/mempool.c trunk/fuse/mempool.h trunk/fuse/ui/win32/confirm.c trunk/fuse/ui/win32/fileselector.c trunk/libspectrum/libspectrum/memory.c trunk/libspectrum/libspectrum/myglib/garray.c trunk/libspectrum/libspectrum/test/writeprotected.mdr Removed Paths: ------------- trunk/fuse/compat/wii/Makefile.am trunk/fuse/compat/wii/file.c trunk/fuse/ui/win32/error.c trunk/fuse/ui/win32/win32display.h trunk/fuse/ui/win32/win32keyboard.h Property Changed: ---------------- trunk/fuse/ trunk/libspectrum/libspectrum/ Modified: trunk/FuseGenerator/FuseGenerator.xcodeproj/project.pbxproj =================================================================== --- trunk/FuseGenerator/FuseGenerator.xcodeproj/project.pbxproj 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseGenerator/FuseGenerator.xcodeproj/project.pbxproj 2008-10-21 12:05:43 UTC (rev 534) @@ -16,6 +16,8 @@ B63944FB0D18C7C30059DAA5 /* tape_accessors.txt in Sources */ = {isa = PBXBuildFile; fileRef = B6D30B2E0D162B910036CC54 /* tape_accessors.txt */; }; B63944FC0D18C7C30059DAA5 /* snap_accessors.txt in Sources */ = {isa = PBXBuildFile; fileRef = B6D30B2C0D162B810036CC54 /* snap_accessors.txt */; }; B63945090D18CA120059DAA5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B63945080D18CA120059DAA5 /* Cocoa.framework */; }; + B67F1E790E93A39800246616 /* garray.c in Sources */ = {isa = PBXBuildFile; fileRef = B67F1E780E93A39800246616 /* garray.c */; }; + B67F1E7B0E93A3AF00246616 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = B67F1E7A0E93A3AF00246616 /* memory.c */; }; B6D30AE60D1627ED0036CC54 /* bzip2.c in Sources */ = {isa = PBXBuildFile; fileRef = B6D30AE50D1627ED0036CC54 /* bzip2.c */; }; B6D30AEC0D16280E0036CC54 /* creator.c in Sources */ = {isa = PBXBuildFile; fileRef = B6D30AE70D16280E0036CC54 /* creator.c */; }; B6D30AED0D16280E0036CC54 /* crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = B6D30AE80D16280E0036CC54 /* crypto.c */; }; @@ -107,6 +109,8 @@ B63944A90D18B0430059DAA5 /* LibspectrumSCRExtractor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LibspectrumSCRExtractor.m; sourceTree = "<group>"; }; B63944CB0D18C1CD0059DAA5 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = SOURCE_ROOT; }; B63945080D18CA120059DAA5 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; + B67F1E780E93A39800246616 /* garray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = garray.c; path = ../../../libspectrum/libspectrum/myglib/garray.c; sourceTree = "<group>"; }; + B67F1E7A0E93A3AF00246616 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memory.c; path = ../../libspectrum/libspectrum/memory.c; sourceTree = "<group>"; }; B6D30AE30D1627C90036CC54 /* libspectrum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libspectrum.h; path = ../libspectrum.h; sourceTree = "<group>"; }; B6D30AE50D1627ED0036CC54 /* bzip2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bzip2.c; sourceTree = "<group>"; }; B6D30AE70D16280E0036CC54 /* creator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = creator.c; sourceTree = "<group>"; }; @@ -251,6 +255,7 @@ B6D30AF20D1628470036CC54 /* internals.h */, B6D30AF30D1628470036CC54 /* libspectrum.c */, B6D30AE30D1627C90036CC54 /* libspectrum.h */, + B67F1E7A0E93A3AF00246616 /* memory.c */, B6D30AF70D16288A0036CC54 /* microdrive.c */, B6D30AF90D1628A10036CC54 /* plusd.c */, B6D30AFB0D1628DB0036CC54 /* rzx.c */, @@ -280,6 +285,7 @@ B6D30B230D1629DC0036CC54 /* myglib */ = { isa = PBXGroup; children = ( + B67F1E780E93A39800246616 /* garray.c */, B6D30B250D162A130036CC54 /* ghash.c */, B6D30B260D162A130036CC54 /* gslist.c */, ); @@ -431,6 +437,8 @@ B6D30B4C0D1653510036CC54 /* ColourMacros.c in Sources */, B6D30B510D1653730036CC54 /* JWSpectrumScreen.m in Sources */, B63944AB0D18B0430059DAA5 /* LibspectrumSCRExtractor.m in Sources */, + B67F1E790E93A39800246616 /* garray.c in Sources */, + B67F1E7B0E93A3AF00246616 /* memory.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: trunk/FuseGenerator/LibspectrumSCRExtractor.m =================================================================== --- trunk/FuseGenerator/LibspectrumSCRExtractor.m 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseGenerator/LibspectrumSCRExtractor.m 2008-10-21 12:05:43 UTC (rev 534) @@ -194,8 +194,7 @@ int seen_scr_header = 0; - error = libspectrum_tape_alloc( &tape ); - if( error != LIBSPECTRUM_ERROR_NONE ) { return; } + tape = libspectrum_tape_alloc(); error = libspectrum_tape_read( tape, buffer, length, LIBSPECTRUM_ID_UNKNOWN, [filename UTF8String] ); @@ -326,7 +325,7 @@ libspectrum_rzx *rzx; libspectrum_snap *snap; - error = libspectrum_rzx_alloc( &rzx ); if( error ) return; + rzx = libspectrum_rzx_alloc(); error = libspectrum_rzx_read( rzx, buffer, length ); if( error != LIBSPECTRUM_ERROR_NONE ) { return; } @@ -348,8 +347,7 @@ int error = 0; libspectrum_snap *snap; - error = libspectrum_snap_alloc( &snap ); - if( error != LIBSPECTRUM_ERROR_NONE ) { return; } + snap = libspectrum_snap_alloc(); error = libspectrum_snap_read( snap, buffer, length, type, [filename UTF8String] ); Modified: trunk/FuseGenerator/generate.pl =================================================================== --- trunk/FuseGenerator/generate.pl 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseGenerator/generate.pl 2008-10-21 12:05:43 UTC (rev 534) @@ -25,7 +25,9 @@ #define TRUE (!FALSE) #endif +typedef char gchar; typedef int gint; +typedef long glong; typedef gint gboolean; typedef unsigned int guint; typedef const void * gconstpointer; @@ -94,6 +96,9 @@ gint WIN32_DLL g_int_equal (gconstpointer v, gconstpointer v2); guint WIN32_DLL g_int_hash (gconstpointer v); +gint WIN32_DLL g_str_equal (gconstpointer v, + gconstpointer v2); +guint WIN32_DLL g_str_hash (gconstpointer v); GHashTable WIN32_DLL *g_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func); @@ -113,6 +118,25 @@ guint WIN32_DLL g_hash_table_size (GHashTable *hash_table); +typedef struct _GArray GArray; + +struct _GArray { + /* Public */ + gchar *data; + size_t len; + + /* Private */ + guint element_size; + size_t allocated; +}; + +GArray* WIN32_DLL g_array_new( gboolean zero_terminated, gboolean clear, + guint element_size ); +#define g_array_append_val(a,v) g_array_append_vals( a, &(v), 1 ); +GArray* WIN32_DLL g_array_append_vals( GArray *array, gconstpointer data, guint len ); +#define g_array_index(a,t,i) (*(((t*)a->data)+i)) +GArray* WIN32_DLL g_array_set_size( GArray *array, guint length ); + #define GINT_TO_POINTER(i) ((gpointer) (i)) #define GPOINTER_TO_INT(p) ((gint) (p)) CODE Modified: trunk/FuseGenerator/libspectrum.h =================================================================== --- trunk/FuseGenerator/libspectrum.h 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseGenerator/libspectrum.h 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ /* libspectrum.h: the library for dealing with ZX Spectrum emulator files Copyright (c) 2001-2007 Philip Kendall, Darren Salt, Fredrick Meunier - $Id: libspectrum.h.in 3595 2008-04-01 10:51:58Z pak21 $ + $Id: libspectrum.h.in 3771 2008-09-11 11:23:17Z pak21 $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,9 @@ #define TRUE (!FALSE) #endif +typedef char gchar; typedef int gint; +typedef long glong; typedef gint gboolean; typedef unsigned int guint; typedef const void * gconstpointer; @@ -153,6 +155,9 @@ gint WIN32_DLL g_int_equal (gconstpointer v, gconstpointer v2); guint WIN32_DLL g_int_hash (gconstpointer v); +gint WIN32_DLL g_str_equal (gconstpointer v, + gconstpointer v2); +guint WIN32_DLL g_str_hash (gconstpointer v); GHashTable WIN32_DLL *g_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func); @@ -172,6 +177,25 @@ guint WIN32_DLL g_hash_table_size (GHashTable *hash_table); +typedef struct _GArray GArray; + +struct _GArray { + /* Public */ + gchar *data; + size_t len; + + /* Private */ + guint element_size; + size_t allocated; +}; + +GArray* WIN32_DLL g_array_new( gboolean zero_terminated, gboolean clear, + guint element_size ); +#define g_array_append_val(a,v) g_array_append_vals( a, &(v), 1 ); +GArray* WIN32_DLL g_array_append_vals( GArray *array, gconstpointer data, guint len ); +#define g_array_index(a,t,i) (*(((t*)a->data)+i)) +GArray* WIN32_DLL g_array_set_size( GArray *array, guint length ); + #define GINT_TO_POINTER(i) ((gpointer) (i)) #define GPOINTER_TO_INT(p) ((gint) (p)) @@ -225,6 +249,27 @@ libspectrum_default_error_function( libspectrum_error error, const char *format, va_list ap ); +/* Memory allocators */ + +typedef void* (*libspectrum_malloc_fn_t)( size_t size ); +typedef void* (*libspectrum_calloc_fn_t)( size_t nmemb, size_t size ); +typedef void* (*libspectrum_realloc_fn_t)( void *ptr, size_t size ); +typedef void (*libspectrum_free_fn_t)( void *ptr ); + +typedef struct libspectrum_mem_vtable_t { + libspectrum_malloc_fn_t malloc; + libspectrum_calloc_fn_t calloc; + libspectrum_realloc_fn_t realloc; + libspectrum_free_fn_t free; +} libspectrum_mem_vtable_t; + +void* WIN32_DLL libspectrum_malloc( size_t size ); +void* WIN32_DLL libspectrum_calloc( size_t nmemb, size_t size ); +void* WIN32_DLL libspectrum_realloc( void *ptr, size_t size ); +void WIN32_DLL libspectrum_free( void *ptr ); + +void WIN32_DLL libspectrum_mem_set_vtable( libspectrum_mem_vtable_t *table ); + /* Attempt to identify a given file */ /* Various types of file we might manage to identify */ @@ -445,9 +490,9 @@ typedef struct libspectrum_creator libspectrum_creator; +libspectrum_creator* WIN32_DLL +libspectrum_creator_alloc( void ); libspectrum_error WIN32_DLL -libspectrum_creator_alloc( libspectrum_creator **creator ); -libspectrum_error WIN32_DLL libspectrum_creator_free( libspectrum_creator *creator ); libspectrum_error WIN32_DLL @@ -490,7 +535,7 @@ typedef struct libspectrum_snap libspectrum_snap; -libspectrum_error WIN32_DLL libspectrum_snap_alloc( libspectrum_snap **snap ); +libspectrum_snap* WIN32_DLL libspectrum_snap_alloc( void ); libspectrum_error WIN32_DLL libspectrum_snap_free( libspectrum_snap *snap ); /* Read in a snapshot, optionally guessing what type it is */ @@ -605,7 +650,7 @@ void WIN32_DLL libspectrum_snap_set_interface1_drive_count( libspectrum_snap *snap, int interface1_drive_count ); int WIN32_DLL libspectrum_snap_interface1_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_interface1_custom_rom( libspectrum_snap *snap, int interface1_custom_rom ); -libspectrum_byte WIN32_DLL * libspectrum_snap_interface1_rom( libspectrum_snap * snap, int idx ); +libspectrum_byte WIN32_DLL * libspectrum_snap_interface1_rom( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_interface1_rom( libspectrum_snap *snap, int idx, libspectrum_byte* interface1_rom ); size_t WIN32_DLL libspectrum_snap_interface1_rom_length( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_interface1_rom_length( libspectrum_snap *snap, int idx, size_t interface1_rom_length ); @@ -727,7 +772,7 @@ void WIN32_DLL libspectrum_snap_set_simpleide_active( libspectrum_snap *snap, int simpleide_active ); int WIN32_DLL libspectrum_snap_divide_active( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_divide_active( libspectrum_snap *snap, int divide_active ); -int WIN32_DLL libspectrum_snap_divide_eprom_writeprotect( libspectrum_snap *snap); +int WIN32_DLL libspectrum_snap_divide_eprom_writeprotect( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_divide_eprom_writeprotect( libspectrum_snap *snap, int divide_eprom_writeprotect ); int WIN32_DLL libspectrum_snap_divide_paged( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_divide_paged( libspectrum_snap *snap, int divide_paged ); @@ -737,10 +782,9 @@ void WIN32_DLL libspectrum_snap_set_divide_pages( libspectrum_snap *snap, size_t divide_pages ); libspectrum_byte WIN32_DLL * libspectrum_snap_divide_eprom( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_divide_eprom( libspectrum_snap *snap, int idx, libspectrum_byte* divide_eprom ); -libspectrum_byte WIN32_DLL * libspectrum_snap_divide_ram( libspectrum_snap *snap , int idx ); +libspectrum_byte WIN32_DLL * libspectrum_snap_divide_ram( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_divide_ram( libspectrum_snap *snap, int idx, libspectrum_byte* divide_ram ); - /* DEPRECATED: use libspectrum_snap_read() instead */ DEPRECATED libspectrum_error WIN32_DLL @@ -835,10 +879,9 @@ } libspectrum_tape_state_type; /* Routines to manipulate tape blocks */ +libspectrum_tape_block* WIN32_DLL +libspectrum_tape_block_alloc( libspectrum_tape_type type ); libspectrum_error WIN32_DLL -libspectrum_tape_block_alloc( libspectrum_tape_block **block, - libspectrum_tape_type type ); -libspectrum_error WIN32_DLL libspectrum_tape_block_free( libspectrum_tape_block *block ); libspectrum_tape_type WIN32_DLL libspectrum_tape_block_type( libspectrum_tape_block *block ); @@ -857,6 +900,9 @@ int WIN32_DLL libspectrum_tape_block_metadata( libspectrum_tape_block *block ); +libspectrum_dword +libspectrum_tape_block_length( libspectrum_tape_block *block ); + /* Accessor functions */ libspectrum_dword WIN32_DLL libspectrum_tape_block_bit_length( libspectrum_tape_block *block ); libspectrum_error WIN32_DLL libspectrum_tape_block_set_bit_length( libspectrum_tape_block *block, libspectrum_dword bit_length ); @@ -916,7 +962,7 @@ /* A linked list of tape blocks */ typedef struct libspectrum_tape libspectrum_tape; -libspectrum_error WIN32_DLL libspectrum_tape_alloc( libspectrum_tape **tape ); +libspectrum_tape* WIN32_DLL libspectrum_tape_alloc( void ); libspectrum_error WIN32_DLL libspectrum_tape_clear( libspectrum_tape *tape ); libspectrum_error WIN32_DLL libspectrum_tape_free( libspectrum_tape *tape ); @@ -969,15 +1015,15 @@ libspectrum_tape_nth_block( libspectrum_tape *tape, int n ); /* Append a block to the current tape */ -libspectrum_error WIN32_DLL +void WIN32_DLL libspectrum_tape_append_block( libspectrum_tape *tape, libspectrum_tape_block *block ); -libspectrum_error +void WIN32_DLL libspectrum_tape_remove_block( libspectrum_tape *tape, libspectrum_tape_iterator it ); -libspectrum_error +libspectrum_error WIN32_DLL libspectrum_tape_insert_block( libspectrum_tape *tape, libspectrum_tape_block *block, size_t position ); @@ -1059,10 +1105,10 @@ typedef struct libspectrum_rzx libspectrum_rzx; -libspectrum_error WIN32_DLL libspectrum_rzx_alloc( libspectrum_rzx **rzx ); +libspectrum_rzx* WIN32_DLL libspectrum_rzx_alloc( void ); libspectrum_error WIN32_DLL libspectrum_rzx_free( libspectrum_rzx *rzx ); -libspectrum_error WIN32_DLL +void WIN32_DLL libspectrum_rzx_start_input( libspectrum_rzx *rzx, libspectrum_dword tstates ); libspectrum_error WIN32_DLL libspectrum_rzx_stop_input( libspectrum_rzx *rzx ); @@ -1125,8 +1171,6 @@ libspectrum_creator *creator, int compress, libspectrum_rzx_dsa_key *key ); -libspectrum_error WIN32_DLL libspectrum_rzx_alloc( libspectrum_rzx **rzx ); - /* Something to step through all the blocks in an input recording */ typedef struct _GSList *libspectrum_rzx_iterator; @@ -1181,9 +1225,9 @@ /* Constructor/destructor */ +libspectrum_microdrive* WIN32_DLL +libspectrum_microdrive_alloc( void ); libspectrum_error WIN32_DLL -libspectrum_microdrive_alloc( libspectrum_microdrive **microdrive ); -libspectrum_error WIN32_DLL libspectrum_microdrive_free( libspectrum_microdrive *microdrive ); /* Accessors */ @@ -1215,7 +1259,7 @@ libspectrum_error WIN32_DLL libspectrum_microdrive_mdr_read( libspectrum_microdrive *microdrive, libspectrum_byte *buffer, size_t length ); -libspectrum_error WIN32_DLL +void WIN32_DLL libspectrum_microdrive_mdr_write( const libspectrum_microdrive *microdrive, libspectrum_byte **buffer, size_t *length ); @@ -1251,7 +1295,7 @@ libspectrum_dck_block *dck[256]; /* dck block data */ } libspectrum_dck; -libspectrum_error WIN32_DLL libspectrum_dck_alloc( libspectrum_dck **dck ); +libspectrum_dck* WIN32_DLL libspectrum_dck_alloc( void ); libspectrum_error WIN32_DLL libspectrum_dck_free( libspectrum_dck *dck, int keep_pages ); @@ -1311,10 +1355,9 @@ typedef struct libspectrum_ide_channel libspectrum_ide_channel; +libspectrum_ide_channel* WIN32_DLL +libspectrum_ide_alloc( libspectrum_ide_databus databus ); libspectrum_error WIN32_DLL -libspectrum_ide_alloc( libspectrum_ide_channel **chn, - libspectrum_ide_databus databus ); -libspectrum_error WIN32_DLL libspectrum_ide_free( libspectrum_ide_channel *chn ); libspectrum_error WIN32_DLL Modified: trunk/FuseImporter/FuseImporter.xcodeproj/project.pbxproj =================================================================== --- trunk/FuseImporter/FuseImporter.xcodeproj/project.pbxproj 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseImporter/FuseImporter.xcodeproj/project.pbxproj 2008-10-21 12:05:43 UTC (rev 534) @@ -13,6 +13,8 @@ B60E533C082720EC00F2C004 /* GetMetadataForFile.m in Sources */ = {isa = PBXBuildFile; fileRef = B60E533B082720EC00F2C004 /* GetMetadataForFile.m */; }; B61617260C1CE2980009ADF9 /* csw.c in Sources */ = {isa = PBXBuildFile; fileRef = B61617250C1CE2980009ADF9 /* csw.c */; }; B616172A0C1CE2A50009ADF9 /* wav.c in Sources */ = {isa = PBXBuildFile; fileRef = B61617290C1CE2A50009ADF9 /* wav.c */; }; + B61E31AF0E925C66008097AC /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = B61E31AE0E925C66008097AC /* memory.c */; }; + B61E31B30E925C73008097AC /* garray.c in Sources */ = {isa = PBXBuildFile; fileRef = B61E31B20E925C73008097AC /* garray.c */; }; B62C1CD00B761515000BA4E0 /* symbol_table.c in Sources */ = {isa = PBXBuildFile; fileRef = B62C1CCF0B761515000BA4E0 /* symbol_table.c */; }; B639B7930A6BB2C100927E24 /* z80em.c in Sources */ = {isa = PBXBuildFile; fileRef = B639B7920A6BB2C100927E24 /* z80em.c */; }; B69709730827C03F00904D8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B69709720827C03F00904D8F /* Foundation.framework */; }; @@ -114,6 +116,8 @@ B60E533B082720EC00F2C004 /* GetMetadataForFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetMetadataForFile.m; sourceTree = "<group>"; }; B61617250C1CE2980009ADF9 /* csw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = csw.c; path = ../../libspectrum/libspectrum/csw.c; sourceTree = "<group>"; }; B61617290C1CE2A50009ADF9 /* wav.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wav.c; path = ../../libspectrum/libspectrum/wav.c; sourceTree = "<group>"; }; + B61E31AE0E925C66008097AC /* memory.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = memory.c; path = ../../libspectrum/libspectrum/memory.c; sourceTree = "<group>"; }; + B61E31B20E925C73008097AC /* garray.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = garray.c; path = ../../../libspectrum/libspectrum/myglib/garray.c; sourceTree = "<group>"; }; B62C1CCF0B761515000BA4E0 /* symbol_table.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = symbol_table.c; path = ../../libspectrum/libspectrum/symbol_table.c; sourceTree = "<group>"; }; B639B7920A6BB2C100927E24 /* z80em.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = z80em.c; path = ../../libspectrum/libspectrum/z80em.c; sourceTree = "<group>"; }; B6687E130A607F1D005D0FDE /* libspectrum.h.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = libspectrum.h.in; path = ../../libspectrum/libspectrum/libspectrum.h.in; sourceTree = "<group>"; }; @@ -242,6 +246,7 @@ B6BF2A040A5FFD0100D16624 /* internals.h */, B6BF2A050A5FFD0100D16624 /* libspectrum.c */, B6BF2A060A5FFD0100D16624 /* libspectrum.h */, + B61E31AE0E925C66008097AC /* memory.c */, B6BF2A070A5FFD0100D16624 /* microdrive.c */, B6BF2A080A5FFD0100D16624 /* plusd.c */, B6BF2A090A5FFD0100D16624 /* rzx.c */, @@ -271,6 +276,7 @@ B6BF29F10A5FFC9700D16624 /* myglib */ = { isa = PBXGroup; children = ( + B61E31B20E925C73008097AC /* garray.c */, B6BF29FC0A5FFCD700D16624 /* gslist.c */, B6BF29F80A5FFCC200D16624 /* ghash.c */, ); @@ -400,6 +406,8 @@ B62C1CD00B761515000BA4E0 /* symbol_table.c in Sources */, B61617260C1CE2980009ADF9 /* csw.c in Sources */, B616172A0C1CE2A50009ADF9 /* wav.c in Sources */, + B61E31AF0E925C66008097AC /* memory.c in Sources */, + B61E31B30E925C73008097AC /* garray.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: trunk/FuseImporter/LibspectrumMetadataImporter.m =================================================================== --- trunk/FuseImporter/LibspectrumMetadataImporter.m 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseImporter/LibspectrumMetadataImporter.m 2008-10-21 12:05:43 UTC (rev 534) @@ -177,35 +177,17 @@ libspectrum_tape *tape; libspectrum_tape_iterator iterator; libspectrum_tape_block *block; + libspectrum_dword tstates_total = 0; size_t i; - error = libspectrum_tape_alloc( &tape ); - if( error != LIBSPECTRUM_ERROR_NONE ) { - return NO; - } + tape = libspectrum_tape_alloc(); error = libspectrum_tape_read( tape, buffer, length, type, fsrep ); if( error != LIBSPECTRUM_ERROR_NONE ) { return NO; } - int flags = 0; - libspectrum_dword tstates_total = 0; - libspectrum_dword edge_tstates = 0; - - while( !(flags & LIBSPECTRUM_TAPE_FLAGS_STOP) ) { - error = libspectrum_tape_get_next_edge( &edge_tstates, &flags, tape ); - if( error != LIBSPECTRUM_ERROR_NONE ) return NO; - - tstates_total += edge_tstates; - } - - float duration = tstates_total/3500000.0; - - [attributes setObject:[NSNumber numberWithFloat:duration] - forKey:(NSString *)kMDItemDurationSeconds]; - [attributes setObject:[NSNumber numberWithInt:1] forKey:(NSString *)kMDItemAudioChannelCount]; @@ -385,10 +367,17 @@ break; } + tstates_total += libspectrum_tape_block_length( block ); + block = libspectrum_tape_iterator_next( &iterator ); } + float duration = tstates_total/3500000.0; + + [attributes setObject:[NSNumber numberWithFloat:duration] + forKey:(NSString *)kMDItemDurationSeconds]; + error = libspectrum_tape_free( tape ); if( error != LIBSPECTRUM_ERROR_NONE ) { munmap( buffer, length ); @@ -470,10 +459,7 @@ libspectrum_snap *snap; - error = libspectrum_snap_alloc( &snap ); - if( error != LIBSPECTRUM_ERROR_NONE ) { - return NO; - } + snap = libspectrum_snap_alloc(); error = libspectrum_snap_read( snap, buffer, length, type, fsrep ); if( error ) { @@ -501,10 +487,7 @@ libspectrum_rzx *rzx; libspectrum_snap *snap = NULL; - error = libspectrum_rzx_alloc( &rzx ); - if( error != LIBSPECTRUM_ERROR_NONE ) { - return NO; - } + rzx = libspectrum_rzx_alloc(); error = libspectrum_rzx_read( rzx, buffer, length ); if( error ) { Modified: trunk/FuseImporter/generate.pl =================================================================== --- trunk/FuseImporter/generate.pl 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseImporter/generate.pl 2008-10-21 12:05:43 UTC (rev 534) @@ -25,7 +25,9 @@ #define TRUE (!FALSE) #endif +typedef char gchar; typedef int gint; +typedef long glong; typedef gint gboolean; typedef unsigned int guint; typedef const void * gconstpointer; @@ -94,6 +96,9 @@ gint WIN32_DLL g_int_equal (gconstpointer v, gconstpointer v2); guint WIN32_DLL g_int_hash (gconstpointer v); +gint WIN32_DLL g_str_equal (gconstpointer v, + gconstpointer v2); +guint WIN32_DLL g_str_hash (gconstpointer v); GHashTable WIN32_DLL *g_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func); @@ -113,6 +118,25 @@ guint WIN32_DLL g_hash_table_size (GHashTable *hash_table); +typedef struct _GArray GArray; + +struct _GArray { + /* Public */ + gchar *data; + size_t len; + + /* Private */ + guint element_size; + size_t allocated; +}; + +GArray* WIN32_DLL g_array_new( gboolean zero_terminated, gboolean clear, + guint element_size ); +#define g_array_append_val(a,v) g_array_append_vals( a, &(v), 1 ); +GArray* WIN32_DLL g_array_append_vals( GArray *array, gconstpointer data, guint len ); +#define g_array_index(a,t,i) (*(((t*)a->data)+i)) +GArray* WIN32_DLL g_array_set_size( GArray *array, guint length ); + #define GINT_TO_POINTER(i) ((gpointer) (i)) #define GPOINTER_TO_INT(p) ((gint) (p)) CODE Modified: trunk/FuseImporter/libspectrum.h =================================================================== --- trunk/FuseImporter/libspectrum.h 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/FuseImporter/libspectrum.h 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ /* libspectrum.h: the library for dealing with ZX Spectrum emulator files Copyright (c) 2001-2007 Philip Kendall, Darren Salt, Fredrick Meunier - $Id: libspectrum.h.in 3595 2008-04-01 10:51:58Z pak21 $ + $Id: libspectrum.h.in 3771 2008-09-11 11:23:17Z pak21 $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,9 @@ #define TRUE (!FALSE) #endif +typedef char gchar; typedef int gint; +typedef long glong; typedef gint gboolean; typedef unsigned int guint; typedef const void * gconstpointer; @@ -153,6 +155,9 @@ gint WIN32_DLL g_int_equal (gconstpointer v, gconstpointer v2); guint WIN32_DLL g_int_hash (gconstpointer v); +gint WIN32_DLL g_str_equal (gconstpointer v, + gconstpointer v2); +guint WIN32_DLL g_str_hash (gconstpointer v); GHashTable WIN32_DLL *g_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func); @@ -172,6 +177,25 @@ guint WIN32_DLL g_hash_table_size (GHashTable *hash_table); +typedef struct _GArray GArray; + +struct _GArray { + /* Public */ + gchar *data; + size_t len; + + /* Private */ + guint element_size; + size_t allocated; +}; + +GArray* WIN32_DLL g_array_new( gboolean zero_terminated, gboolean clear, + guint element_size ); +#define g_array_append_val(a,v) g_array_append_vals( a, &(v), 1 ); +GArray* WIN32_DLL g_array_append_vals( GArray *array, gconstpointer data, guint len ); +#define g_array_index(a,t,i) (*(((t*)a->data)+i)) +GArray* WIN32_DLL g_array_set_size( GArray *array, guint length ); + #define GINT_TO_POINTER(i) ((gpointer) (i)) #define GPOINTER_TO_INT(p) ((gint) (p)) @@ -225,6 +249,27 @@ libspectrum_default_error_function( libspectrum_error error, const char *format, va_list ap ); +/* Memory allocators */ + +typedef void* (*libspectrum_malloc_fn_t)( size_t size ); +typedef void* (*libspectrum_calloc_fn_t)( size_t nmemb, size_t size ); +typedef void* (*libspectrum_realloc_fn_t)( void *ptr, size_t size ); +typedef void (*libspectrum_free_fn_t)( void *ptr ); + +typedef struct libspectrum_mem_vtable_t { + libspectrum_malloc_fn_t malloc; + libspectrum_calloc_fn_t calloc; + libspectrum_realloc_fn_t realloc; + libspectrum_free_fn_t free; +} libspectrum_mem_vtable_t; + +void* WIN32_DLL libspectrum_malloc( size_t size ); +void* WIN32_DLL libspectrum_calloc( size_t nmemb, size_t size ); +void* WIN32_DLL libspectrum_realloc( void *ptr, size_t size ); +void WIN32_DLL libspectrum_free( void *ptr ); + +void WIN32_DLL libspectrum_mem_set_vtable( libspectrum_mem_vtable_t *table ); + /* Attempt to identify a given file */ /* Various types of file we might manage to identify */ @@ -445,9 +490,9 @@ typedef struct libspectrum_creator libspectrum_creator; +libspectrum_creator* WIN32_DLL +libspectrum_creator_alloc( void ); libspectrum_error WIN32_DLL -libspectrum_creator_alloc( libspectrum_creator **creator ); -libspectrum_error WIN32_DLL libspectrum_creator_free( libspectrum_creator *creator ); libspectrum_error WIN32_DLL @@ -490,7 +535,7 @@ typedef struct libspectrum_snap libspectrum_snap; -libspectrum_error WIN32_DLL libspectrum_snap_alloc( libspectrum_snap **snap ); +libspectrum_snap* WIN32_DLL libspectrum_snap_alloc( void ); libspectrum_error WIN32_DLL libspectrum_snap_free( libspectrum_snap *snap ); /* Read in a snapshot, optionally guessing what type it is */ @@ -605,7 +650,7 @@ void WIN32_DLL libspectrum_snap_set_interface1_drive_count( libspectrum_snap *snap, int interface1_drive_count ); int WIN32_DLL libspectrum_snap_interface1_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_interface1_custom_rom( libspectrum_snap *snap, int interface1_custom_rom ); -libspectrum_byte WIN32_DLL * libspectrum_snap_interface1_rom( libspectrum_snap * snap, int idx ); +libspectrum_byte WIN32_DLL * libspectrum_snap_interface1_rom( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_interface1_rom( libspectrum_snap *snap, int idx, libspectrum_byte* interface1_rom ); size_t WIN32_DLL libspectrum_snap_interface1_rom_length( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_interface1_rom_length( libspectrum_snap *snap, int idx, size_t interface1_rom_length ); @@ -727,7 +772,7 @@ void WIN32_DLL libspectrum_snap_set_simpleide_active( libspectrum_snap *snap, int simpleide_active ); int WIN32_DLL libspectrum_snap_divide_active( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_divide_active( libspectrum_snap *snap, int divide_active ); -int WIN32_DLL libspectrum_snap_divide_eprom_writeprotect( libspectrum_snap *snap); +int WIN32_DLL libspectrum_snap_divide_eprom_writeprotect( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_divide_eprom_writeprotect( libspectrum_snap *snap, int divide_eprom_writeprotect ); int WIN32_DLL libspectrum_snap_divide_paged( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_divide_paged( libspectrum_snap *snap, int divide_paged ); @@ -737,10 +782,9 @@ void WIN32_DLL libspectrum_snap_set_divide_pages( libspectrum_snap *snap, size_t divide_pages ); libspectrum_byte WIN32_DLL * libspectrum_snap_divide_eprom( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_divide_eprom( libspectrum_snap *snap, int idx, libspectrum_byte* divide_eprom ); -libspectrum_byte WIN32_DLL * libspectrum_snap_divide_ram( libspectrum_snap *snap , int idx ); +libspectrum_byte WIN32_DLL * libspectrum_snap_divide_ram( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_divide_ram( libspectrum_snap *snap, int idx, libspectrum_byte* divide_ram ); - /* DEPRECATED: use libspectrum_snap_read() instead */ DEPRECATED libspectrum_error WIN32_DLL @@ -835,10 +879,9 @@ } libspectrum_tape_state_type; /* Routines to manipulate tape blocks */ +libspectrum_tape_block* WIN32_DLL +libspectrum_tape_block_alloc( libspectrum_tape_type type ); libspectrum_error WIN32_DLL -libspectrum_tape_block_alloc( libspectrum_tape_block **block, - libspectrum_tape_type type ); -libspectrum_error WIN32_DLL libspectrum_tape_block_free( libspectrum_tape_block *block ); libspectrum_tape_type WIN32_DLL libspectrum_tape_block_type( libspectrum_tape_block *block ); @@ -857,6 +900,9 @@ int WIN32_DLL libspectrum_tape_block_metadata( libspectrum_tape_block *block ); +libspectrum_dword +libspectrum_tape_block_length( libspectrum_tape_block *block ); + /* Accessor functions */ libspectrum_dword WIN32_DLL libspectrum_tape_block_bit_length( libspectrum_tape_block *block ); libspectrum_error WIN32_DLL libspectrum_tape_block_set_bit_length( libspectrum_tape_block *block, libspectrum_dword bit_length ); @@ -916,7 +962,7 @@ /* A linked list of tape blocks */ typedef struct libspectrum_tape libspectrum_tape; -libspectrum_error WIN32_DLL libspectrum_tape_alloc( libspectrum_tape **tape ); +libspectrum_tape* WIN32_DLL libspectrum_tape_alloc( void ); libspectrum_error WIN32_DLL libspectrum_tape_clear( libspectrum_tape *tape ); libspectrum_error WIN32_DLL libspectrum_tape_free( libspectrum_tape *tape ); @@ -969,15 +1015,15 @@ libspectrum_tape_nth_block( libspectrum_tape *tape, int n ); /* Append a block to the current tape */ -libspectrum_error WIN32_DLL +void WIN32_DLL libspectrum_tape_append_block( libspectrum_tape *tape, libspectrum_tape_block *block ); -libspectrum_error +void WIN32_DLL libspectrum_tape_remove_block( libspectrum_tape *tape, libspectrum_tape_iterator it ); -libspectrum_error +libspectrum_error WIN32_DLL libspectrum_tape_insert_block( libspectrum_tape *tape, libspectrum_tape_block *block, size_t position ); @@ -1059,10 +1105,10 @@ typedef struct libspectrum_rzx libspectrum_rzx; -libspectrum_error WIN32_DLL libspectrum_rzx_alloc( libspectrum_rzx **rzx ); +libspectrum_rzx* WIN32_DLL libspectrum_rzx_alloc( void ); libspectrum_error WIN32_DLL libspectrum_rzx_free( libspectrum_rzx *rzx ); -libspectrum_error WIN32_DLL +void WIN32_DLL libspectrum_rzx_start_input( libspectrum_rzx *rzx, libspectrum_dword tstates ); libspectrum_error WIN32_DLL libspectrum_rzx_stop_input( libspectrum_rzx *rzx ); @@ -1125,8 +1171,6 @@ libspectrum_creator *creator, int compress, libspectrum_rzx_dsa_key *key ); -libspectrum_error WIN32_DLL libspectrum_rzx_alloc( libspectrum_rzx **rzx ); - /* Something to step through all the blocks in an input recording */ typedef struct _GSList *libspectrum_rzx_iterator; @@ -1181,9 +1225,9 @@ /* Constructor/destructor */ +libspectrum_microdrive* WIN32_DLL +libspectrum_microdrive_alloc( void ); libspectrum_error WIN32_DLL -libspectrum_microdrive_alloc( libspectrum_microdrive **microdrive ); -libspectrum_error WIN32_DLL libspectrum_microdrive_free( libspectrum_microdrive *microdrive ); /* Accessors */ @@ -1215,7 +1259,7 @@ libspectrum_error WIN32_DLL libspectrum_microdrive_mdr_read( libspectrum_microdrive *microdrive, libspectrum_byte *buffer, size_t length ); -libspectrum_error WIN32_DLL +void WIN32_DLL libspectrum_microdrive_mdr_write( const libspectrum_microdrive *microdrive, libspectrum_byte **buffer, size_t *length ); @@ -1251,7 +1295,7 @@ libspectrum_dck_block *dck[256]; /* dck block data */ } libspectrum_dck; -libspectrum_error WIN32_DLL libspectrum_dck_alloc( libspectrum_dck **dck ); +libspectrum_dck* WIN32_DLL libspectrum_dck_alloc( void ); libspectrum_error WIN32_DLL libspectrum_dck_free( libspectrum_dck *dck, int keep_pages ); @@ -1311,10 +1355,9 @@ typedef struct libspectrum_ide_channel libspectrum_ide_channel; +libspectrum_ide_channel* WIN32_DLL +libspectrum_ide_alloc( libspectrum_ide_databus databus ); libspectrum_error WIN32_DLL -libspectrum_ide_alloc( libspectrum_ide_channel **chn, - libspectrum_ide_databus databus ); -libspectrum_error WIN32_DLL libspectrum_ide_free( libspectrum_ide_channel *chn ); libspectrum_error WIN32_DLL Property changes on: trunk/fuse ___________________________________________________________________ Added: svn:mergeinfo + /vendor/fuse-emulator/current/fuse:530-533 Modified: trunk/fuse/Makefile.am =================================================================== --- trunk/fuse/Makefile.am 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/Makefile.am 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ # Process this file with automake to produce Makefile.in ## Copyright (c) 1999-2008 Philip Kendall -## $Id: Makefile.am 3609 2008-05-01 13:17:56Z fredm $ +## $Id: Makefile.am 3617 2008-05-17 08:09:47Z pak21 $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -72,6 +72,7 @@ loader.c \ machine.c \ memory.c \ + mempool.c \ menu.c \ module.c \ periph.c \ Copied: trunk/fuse/PORTING (from rev 533, vendor/fuse-emulator/current/fuse/PORTING) =================================================================== --- trunk/fuse/PORTING (rev 0) +++ trunk/fuse/PORTING 2008-10-21 12:05:43 UTC (rev 534) @@ -0,0 +1,22 @@ +Porting Fuse +============ + +Sorry, at the moment this isn't a helpful guide as to what you need to do +to port Fuse to a new platform. + +Unfortunately, various people have failed to read and understand the GNU +General Public License (see 'COPYING') before porting Fuse, so this is a +very brief guide to what you can and can't do with Fuse's code: + +* If you release a binary of Fuse, you *must* release *all* the source + code you used to create it at the same time. "Soon" or "when I've + tidied up the code" is NOT acceptable. + +* If you use any code which you haven't written yourself, it must be + available under a licence compatible with the GPL. As an example, this + means you may *not* use any code which "may not be used for commercial + purposes". Any code which is licenced under the GPL (v2), the modified + BSD license or which is truly in the public domain is OK. + +Note that above is not an exhaustive list of what you can and cannot +do with Fuse's code. For the full details, see the GPL. Modified: trunk/fuse/README =================================================================== --- trunk/fuse/README 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/README 2008-10-21 12:05:43 UTC (rev 534) @@ -26,6 +26,14 @@ * Emulation of the DivIDE, Interface I, Kempston mouse, Spectrum +3e, ZXATASP, ZXCF, Beta 128 and +D interfaces. +Help! <xyz> doesn't work +------------------------ + +If you're having a problem using/running/building Fuse, the two places +you're most likely to get help are the development mailing list +<fus...@li...> or the official forums at +<http://sourceforge.net/forum/?group_id=91293>. + What you'll need to run Fuse ---------------------------- @@ -143,4 +151,4 @@ Philip Kendall <phi...@sh...> 5 January 2008 -$Id: README 3584 2008-03-25 10:27:30Z fredm $ +$Id: README 3718 2008-07-19 12:29:41Z pak21 $ Modified: trunk/fuse/compat/amiga/Makefile.am =================================================================== --- trunk/fuse/compat/amiga/Makefile.am 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/compat/amiga/Makefile.am 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in -## Copyright (c) 2007 Philip Kendall +## Copyright (c) 2007-2008 Philip Kendall -## $Id: Makefile.am 3578 2008-03-22 20:51:36Z zubzero $ +## $Id: Makefile.am 3687 2008-06-23 11:55:23Z pak21 $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -27,7 +27,8 @@ noinst_LIBRARIES = libcompatos.a -libcompatos_a_SOURCES = osname.c \ +libcompatos_a_SOURCES = ../unix/file.c \ + osname.c \ paths.c INCLUDES = @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBSPEC_CFLAGS@ Modified: trunk/fuse/compat/morphos/Makefile.am =================================================================== --- trunk/fuse/compat/morphos/Makefile.am 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/compat/morphos/Makefile.am 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in -## Copyright (c) 2007 Philip Kendall +## Copyright (c) 2007-2008 Philip Kendall -## $Id: Makefile.am 3115 2007-08-19 02:49:14Z fredm $ +## $Id: Makefile.am 3687 2008-06-23 11:55:23Z pak21 $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -27,7 +27,8 @@ noinst_LIBRARIES = libcompatos.a -libcompatos_a_SOURCES = osname.c \ +libcompatos_a_SOURCES = ../unix/file.c \ + osname.c \ ../amiga/paths.c INCLUDES = @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBSPEC_CFLAGS@ Modified: trunk/fuse/compat/unix/Makefile.am =================================================================== --- trunk/fuse/compat/unix/Makefile.am 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/compat/unix/Makefile.am 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in -## Copyright (c) 2007 Philip Kendall +## Copyright (c) 2007-2008 Philip Kendall -## $Id: Makefile.am 3115 2007-08-19 02:49:14Z fredm $ +## $Id: Makefile.am 3687 2008-06-23 11:55:23Z pak21 $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -27,7 +27,8 @@ noinst_LIBRARIES = libcompatos.a -libcompatos_a_SOURCES = osname.c \ +libcompatos_a_SOURCES = file.c \ + osname.c \ paths.c INCLUDES = @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBSPEC_CFLAGS@ Copied: trunk/fuse/compat/unix/file.c (from rev 533, vendor/fuse-emulator/current/fuse/compat/unix/file.c) =================================================================== --- trunk/fuse/compat/unix/file.c (rev 0) +++ trunk/fuse/compat/unix/file.c 2008-10-21 12:05:43 UTC (rev 534) @@ -0,0 +1,107 @@ +/* file.c: File-related compatibility routines + Copyright (c) 2008 Philip Kendall + + $Id: file.c 3722 2008-07-22 03:12:28Z specu $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Author contact information: + + E-mail: phi...@sh... + +*/ + +#include <config.h> + +#include <errno.h> +#include <fcntl.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +#include "compat.h" +#include "ui/ui.h" + +/* Certain brain damaged operating systems (DOS/Windows) treat text + and binary files different in open(2) and need to be given the + O_BINARY flag to tell them it's a binary file */ +#ifndef O_BINARY +#define O_BINARY 0 +#endif /* #ifndef O_BINARY */ + +const compat_fd COMPAT_FILE_OPEN_FAILED = -1; + +compat_fd +compat_file_open( const char *path, int write ) +{ + int flags = write ? O_WRONLY | O_CREAT | O_BINARY : O_RDONLY | O_BINARY; + return open( path, flags ); +} + +off_t +compat_file_get_length( compat_fd fd ) +{ + struct stat file_info; + + if( fstat( fd, &file_info ) ) { + ui_error( UI_ERROR_ERROR, "couldn't stat file: %s", strerror( errno ) ); + return -1; + } + + return file_info.st_size; +} + +int +compat_file_read( compat_fd fd, utils_file *file ) +{ + ssize_t bytes = read( fd, file->buffer, file->length ); + if( bytes != file->length ) { + if( bytes == -1 ) { + ui_error( UI_ERROR_ERROR, "error reading file: %s", strerror( errno ) ); + } else { + ui_error( UI_ERROR_ERROR, + "error reading file: expected %ld bytes, but read only %ld", + (unsigned long)file->length, (unsigned long)bytes ); + } + return 1; + } + + return 0; +} + +int +compat_file_write( compat_fd fd, const unsigned char *buffer, size_t length ) +{ + ssize_t bytes = write( fd, buffer, length ); + if( bytes != length ) { + if( bytes == -1 ) { + ui_error( UI_ERROR_ERROR, "error writing file: %s", strerror( errno ) ); + } else { + ui_error( UI_ERROR_ERROR, + "error writing file: expected %ld bytes, but wrote only %ld", + (unsigned long)length, (unsigned long)bytes ); + } + return 1; + } + + return 0; +} + +int +compat_file_close( compat_fd fd ) +{ + return close( fd ); +} Modified: trunk/fuse/compat/unix/osname.c =================================================================== --- trunk/fuse/compat/unix/osname.c 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/compat/unix/osname.c 2008-10-21 12:05:43 UTC (rev 534) @@ -1,7 +1,7 @@ /* osname.c: Get a representation of the OS we're running on Copyright (c) 1999-2007 Philip Kendall - $Id: osname.c 3115 2007-08-19 02:49:14Z fredm $ + $Id: osname.c 3626 2008-05-23 10:30:30Z pak21 $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ int error; error = uname( &osname ); - if( error ) { + if( error < 0 ) { ui_error( UI_ERROR_ERROR, "error getting system information: %s", strerror( errno ) ); return 1; Deleted: trunk/fuse/compat/wii/Makefile.am =================================================================== --- vendor/fuse-emulator/current/fuse/compat/wii/Makefile.am 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/compat/wii/Makefile.am 2008-10-21 12:05:43 UTC (rev 534) @@ -1,34 +0,0 @@ -## Process this file with automake to produce Makefile.in -## Copyright (c) 2007-2008 Philip Kendall - -## $Id: Makefile.am 3687 2008-06-23 11:55:23Z pak21 $ - -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License along -## with this program; if not, write to the Free Software Foundation, Inc., -## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -## -## Author contact information: -## -## E-mail: phi...@sh... - -AUTOMAKE_OPTIONS = foreign - -AM_CPPFLAGS = -I$(srcdir)/../.. - -noinst_LIBRARIES = libcompatos.a - -libcompatos_a_SOURCES = file.c \ - osname.c \ - paths.c - -INCLUDES = @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBSPEC_CFLAGS@ Copied: trunk/fuse/compat/wii/Makefile.am (from rev 533, vendor/fuse-emulator/current/fuse/compat/wii/Makefile.am) =================================================================== --- trunk/fuse/compat/wii/Makefile.am (rev 0) +++ trunk/fuse/compat/wii/Makefile.am 2008-10-21 12:05:43 UTC (rev 534) @@ -0,0 +1,34 @@ +## Process this file with automake to produce Makefile.in +## Copyright (c) 2007-2008 Philip Kendall + +## $Id: Makefile.am 3687 2008-06-23 11:55:23Z pak21 $ + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program; if not, write to the Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +## +## Author contact information: +## +## E-mail: phi...@sh... + +AUTOMAKE_OPTIONS = foreign + +AM_CPPFLAGS = -I$(srcdir)/../.. + +noinst_LIBRARIES = libcompatos.a + +libcompatos_a_SOURCES = file.c \ + osname.c \ + paths.c + +INCLUDES = @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBSPEC_CFLAGS@ Deleted: trunk/fuse/compat/wii/file.c =================================================================== --- vendor/fuse-emulator/current/fuse/compat/wii/file.c 2008-09-28 12:29:27 UTC (rev 533) +++ trunk/fuse/compat/wii/file.c 2008-10-21 12:05:43 UTC (rev 534) @@ -1,90 +0,0 @@ -/* file.c: File-related compatibility routines - Copyright (c) 2008 Philip Kendall - - $Id: file.c 3688 2008-06-23 18:17:56Z pak21 $ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - Author contact information: - - E-mail: phi...@sh... - -*/ - -#include <config.h> - -#include <errno.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "compat.h" -#include "ui/ui.h" - -const compat_fd COMPAT_FILE_OPEN_FAILED = NULL; - -compat_fd -compat_file_open( const char *path, int write ) -{ - return fopen( path, write ? "w" : "r" ); -} - -off_t -compat_file_get_length( compat_fd fd ) -{ - struct stat file_info; - - if( fstat( fileno( fd ), &file_info ) ) { - ui_error( UI_ERROR_ERROR, "couldn't stat file: %s", strerror( errno ) ); - return -1; - } - - return file_info.st_size; -} - -int -compat_file_read( compat_fd fd, utils_file *file ) -{ - size_t bytes = fread( file->buffer, 1, file->length, fd ); - if( bytes != file->length ) { - ui_error( UI_ERROR_ERROR, - "error reading file: expected %d bytes, but read only %d", - file->length, bytes ); - return 1; - } - - return 0; -} - -int -compat_file_write( compat_fd fd, const unsigned char *buffer, size_t length ) -{ - size_t bytes = fwrite( buffer, 1, length, fd ); - if( bytes != length ) { - ui_error( UI_ERROR_ERROR, - "error writing file: expected %d bytes, but wrote only %d", - length, bytes ); - return 1; - } - - return 0; -} - -int -compat_file_close( compat_fd fd ) -{ - return fclose( fd ); -} Copied: trunk/fuse/compat/wii/file.c (from rev 533, vendor/fuse-emulator/current/fuse/compat/wii/file.c) =================================================================== --- trunk/fuse/compat/wii/file.c (rev 0) +++ trunk/fuse/compat/wii/file.c 2008-10-21 12:05:43 UTC (rev 534) @@ -0,0 +1,90 @@ +/* file.c: File-related compatibility routines + Copyright (c) 2008 Philip Kendall + + $Id: file.c 3688 2008-06-23 18:17:56Z pak21 $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTI... [truncated message content] |