Mkd64 module API  1.3b
API for creating own mkd64 modules
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DiskFile Class Reference

Class representing a file to be written on a C64 disk. More...

#include <mkd64/diskfile.h>

Related Functions

(Note that these are not member functions.)

typedef void(* DataDelete )(const void *owner, void *data)
 callback for deleting data attached using DiskFile_attachData().
void DiskFile_attachData (DiskFile *self, const void *owner, void *data, DataDelete deleter)
 Attach arbitrary data to this diskfile.
void * DiskFile_data (const DiskFile *self, const void *owner)
 Get attached data for a given owner.
size_t DiskFile_size (const DiskFile *self)
 Get the size of the file in bytes.
size_t DiskFile_blocks (const DiskFile *self)
 Get the size of the file in blocks.
void DiskFile_setInterleave (DiskFile *self, int interleave)
 Set interleave for this file.
int DiskFile_interleave (const DiskFile *self)
 Get interleave for this file.
void DiskFile_setName (DiskFile *self, const char *name)
 Set the name of this file.
const char * DiskFile_name (const DiskFile *self)
 Get the name of this file.
int DiskFile_fileNo (const DiskFile *self)
 Get the number of the file.

Detailed Description

Class representing a file to be written on a C64 disk.

Friends And Related Function Documentation

typedef void(* DataDelete)(const void *owner, void *data)
related

callback for deleting data attached using DiskFile_attachData().

Parameters
ownerpointer to the owner as given to DiskFile_attachData()
datathe data to delete
void DiskFile_attachData ( DiskFile self,
const void *  owner,
void *  data,
DataDelete  deleter 
)
related

Attach arbitrary data to this diskfile.

Each data owner should call this only once, otherwise the data from the previous call will be deleted and a warning is printed to stderr.

Parameters
selfthe diskfile
ownerthe owner of the data to attach
datathe data to attach
deletera callback that must free all memory of data when called
size_t DiskFile_blocks ( const DiskFile self)
related

Get the size of the file in blocks.

this will only return a real value after the file was written to a disk image, before that it will just return 0.

Parameters
selfthe diskfile
Returns
the size in blocks
void * DiskFile_data ( const DiskFile self,
const void *  owner 
)
related

Get attached data for a given owner.

Parameters
selfthe diskfile
ownerthe owner of the data
Returns
pointer to the data, or 0 if no data for this owner was found
int DiskFile_fileNo ( const DiskFile self)
related

Get the number of the file.

Each file gets automatically a number when it is written to the disk image, so this can be used to determine the order in which files were written.

Parameters
selfthe diskfile
Returns
the file number
int DiskFile_interleave ( const DiskFile self)
related

Get interleave for this file.

Parameters
selfthe diskfile
Returns
the currently set interleave value
const char * DiskFile_name ( const DiskFile self)
related

Get the name of this file.

Parameters
selfthe diskfile
Returns
the (current) name of the file, see DiskFile_setName().
void DiskFile_setInterleave ( DiskFile self,
int  interleave 
)
related

Set interleave for this file.

this sets an interleave value to be used when the file is written to a disk image. Modules may use this to set a default when they are told to handle the file, the user may later override it by specifying a -i parameter before the final -w. If this is never called, the file will be written to the disk image without interleave (consecutive sectors).

Parameters
selfthe diskfile
interleavethe interleave value to set.
void DiskFile_setName ( DiskFile self,
const char *  name 
)
related

Set the name of this file.

mkd64 initially sets the file name to the name of the file loaded from the local system – or an empty string if no file was loaded. modules should call this exactly when they create some kind of "directory entry" for the file and set it to the name appearing in the directory. The file map feature will use this name for creating the map (list of files with start track/sector).

Parameters
selfthe diskfile
namethe name to set for the file
size_t DiskFile_size ( const DiskFile self)
related

Get the size of the file in bytes.

Parameters
selfthe diskfile
Returns
size in bytes, or 0 if no real file was read from the local system

The documentation for this class was generated from the following file: