From: <pa...@us...> - 2008-10-27 20:55:53
|
Revision: 3793 http://fuse-emulator.svn.sourceforge.net/fuse-emulator/?rev=3793&view=rev Author: pak21 Date: 2008-10-27 20:55:47 +0000 (Mon, 27 Oct 2008) Log Message: ----------- Bring up to date. Modified Paths: -------------- trunk/libspectrum/doc/libspectrum.txt trunk/libspectrum/hacking/ChangeLog Modified: trunk/libspectrum/doc/libspectrum.txt =================================================================== --- trunk/libspectrum/doc/libspectrum.txt 2008-10-27 20:49:34 UTC (rev 3792) +++ trunk/libspectrum/doc/libspectrum.txt 2008-10-27 20:55:47 UTC (rev 3793) @@ -61,9 +61,9 @@ libspectrum_error libspectrum_init( void ) This routine must be called before any other libspectrum routines, -other than `libspectrum_version' and `libspectrum_check_version' to -initialise the library. If it isn't called, undefined behaviour may -result. +other than `libspectrum_version', `libspectrum_check_version' and +`libspectrum_mem_set_vtable' to initialise the library. If it isn't +called, undefined behaviour may result. const char *libspectrum_version( void ) @@ -83,6 +83,34 @@ returns non-zero if the libspectrum version in use is at least `version' or zero if it is not. +Memory handling +=============== + +By default, libspectrum will use the standard library's malloc(), +calloc(), realloc() and free() for memory handling, but wrapped so that +they are "strong" (they will either succeed or abort the program). It is +possible to replace these with custom allocation routines if you wish. + +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 libspectrum_mem_set_vtable( libspectrum_mem_vtable_t *table ) + +Set the memory handling routines to be those specified by `table'. This +function may *not* be called after libspectrum_init() has been called. +Note that libspectrum will ensure that the memory allocators are still +strong, and will abort the program if any of the allocators returns +NULL. + Error handling ============== @@ -391,7 +419,7 @@ libspectrum provides a `libspectrum_creator' structure to store this information. -libspectrum_error libspectrum_creator_alloc( libspectrum_creator **creator ) +libspectrum_creator* libspectrum_creator_alloc( void ) Allocate a new `libspectrum_creator' structure. @@ -451,7 +479,7 @@ `libspectrum_snap' structure, which can be accessed via the following routines: -libspectrum_error libspectrum_snap_alloc( libspectrum_snap **snap ) +libspectrum_snap* libspectrum_snap_alloc( void ) Allocate a new libspectrum_snap structure. @@ -704,7 +732,7 @@ The routines for dealing with tapes are: -libspectrum_error libspectrum_tape_alloc( libspectrum_tape **tape ) +libspectrum_tape* libspectrum_tape_alloc( void ) Allocate a new libspectrum_tape object. @@ -765,6 +793,10 @@ forced high at this edge LIBSPECTRUM_TAPE_FLAGS_NO_EDGE This "edge" isn't really an edge and doesn't change the input signal from the tape. +LIBSPECTRUM_TAPE_FLAGS_LENGTH_SHORT This edge is a "short" edge; used + for loader acceleration +LIBSPECTRUM_TAPE_FLAGS_LENGTH_LONG This edge is a "long" edge; again + used for loader acceleration int libspectrum_tape_present( libspectrum_tape *tape ) @@ -781,12 +813,27 @@ Set the current block on the tape to be the `n'th block and initialise it. Again, the first block on the tape is block 0. -libspectrum_error +void libspectrum_tape_append_block( libspectrum_tape *tape, libspectrum_tape_block *block ) Append `block' to `tape'. +void +libspectrum_tape_remove_block( libspectrum_tape *tape, + libspectrum_tape_iterator it ) + +Remove the block pointed to by `it' (see the "Tape iterators" section) +from the tape. + +libspectrum_error +libspectrum_tape_insert_block( libspectrum_tape *tape, + libspectrum_tape_block *block, + size_t position ) + +Insert `block' into `tape` in position `position', where position 0 +would make the new block the first block on the tape. + libspectrum_tape_block* libspectrum_tape_current_block( libspectrum_tape *tape ) @@ -874,9 +921,8 @@ The basic routines for dealing with tape blocks are: -libspectrum_error -libspectrum_tape_block_alloc( libspectrum_tape_block **block, - libspectrum_tape_type type ) +libspectrum_tape_block* +libspectrum_tape_block_alloc( libspectrum_tape_type type ) Allocate a new tape block of `type'. @@ -922,6 +968,11 @@ Returns 1 if the block consists solely of metadata (comments, etc.) or 0 if it contains real data. +libspectrum_dword +libspectrum_tape_block_length( libspectrum_tape_block *block ) + +Returns the length (in tstates) of this block + The `get' and `set' functions follow the same pattern as for the snapshot routines: the `get' functions are like @@ -1088,7 +1139,7 @@ All input recording routines are accessed through the opaque `libspectrum_rzx' structure. -libspectrum_error libspectrum_rzx_alloc( libspectrum_rzx **rzx ) +libspectrum_rzx* libspectrum_rzx_alloc( void ) Allocate a new input recording object. @@ -1097,7 +1148,7 @@ Free the memory used by an input recording object as allocated by `libspectrum_rzx_alloc'. -libspectrum_error +void libspectrum_rzx_start_input( libspectrum_rzx *rzx, libspectrum_dword tstates ) Start an input recording block int the object. @@ -1107,9 +1158,13 @@ Stop the current input recording block. libspectrum_error -libspectrum_rzx_add_snap( libspectrum_rzx *rzx, libspectrum_snap *snap ) +libspectrum_rzx_add_snap( libspectrum_rzx *rzx, libspectrum_snap *snap, + int automatic ) -Add `snap' to the input recording at this point. +Add `snap' to the input recording at this point. `automatic' can be used +to indicate whether this block was automatically added by the calling +program (non-zero) or explicitly requested by the user (zero) and then +fetched with libspectrum_rzx_iterator_snap_is_automatic() (see below). libspectrum_error libspectrum_rzx_rollback( libspectrum_rzx *rzx, libspectrum_snap **snap ) @@ -1226,6 +1281,13 @@ Get the snapshot pointed to by `it'. If `it' does not point to a snapshot, NULL is returned. +int +libspectrum_rzx_iterator_snap_is_automatic( libspectrum_rzx_iterator it ) + +Returns non-zero if `it' points to a snap which has its "automatic" flag +(see libspectrum_rzx_add_snap()) set to true, or false if it doesn't (or +if `it' doesn't point to a snapshot). + Input recording iterators ------------------------- @@ -1394,8 +1456,8 @@ Routines for handling images of microdrive cartridges. As usual, these are accessed through an opaque structure, libspectrum_microdrive. -libspectrum_error -libspectrum_microdrive_alloc( libspectrum_microdrive **microdrive ) +libspectrum_microdrive* +libspectrum_microdrive_alloc( void ) Allocate a microdrive structure. @@ -1444,7 +1506,7 @@ libspectrum_error libspectrum_microdrive_mdr_read( libspectrum_microdrive *microdrive, libspectrum_byte *buffer, size_t length ) -libspectrum_error +void libspectrum_microdrive_mdr_write( const libspectrum_microdrive *microdrive, libspectrum_byte **buffer, size_t *length ) @@ -1494,7 +1556,7 @@ The actual routines for handling dock files: -libspectrum_error libspectrum_dck_alloc( libspectrum_dck **dck ) +libspectrum_dck* libspectrum_dck_alloc( void ) Allocate a dock structure. @@ -1520,9 +1582,8 @@ images are not handled entirely in memory as are the other file types, but require a real file. -libspectrum_error -libspectrum_ide_alloc( libspectrum_ide_channel **chn, - libspectrum_ide_database databus ) +libspectrum_ide_channel* +libspectrum_ide_alloc( libspectrum_ide_databus databus ) Allocate a new IDE channel in `*chn' of type `databus'. `databus' can take the following values: Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2008-10-27 20:49:34 UTC (rev 3792) +++ trunk/libspectrum/hacking/ChangeLog 2008-10-27 20:55:47 UTC (rev 3793) @@ -690,3 +690,4 @@ 20081027 ChangeLog: bring up to date. 20081027 libspectrum.h.in: Win32: fixed dll export for libspectrum_tape_block_length (Marek). +20081027 doc/libspectrum.txt: bring up to date. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |