diff options
author | 2012-09-16 05:24:30 +0000 | |
---|---|---|
committer | 2012-09-16 05:24:30 +0000 | |
commit | 1a301849034da9956b893453acce8e0f9168e150 (patch) | |
tree | a39f7a6c6b4c54b7993e58cd22ea6b6bd25f37cf /src/mess/tools | |
parent | 91f928d6cd774c9526c7fde7e0860aded24d08a5 (diff) |
Final round of struct/union/enum normalization.
Diffstat (limited to 'src/mess/tools')
-rw-r--r-- | src/mess/tools/imgtool/filter.h | 2 | ||||
-rw-r--r-- | src/mess/tools/imgtool/imgtool.c | 10 | ||||
-rw-r--r-- | src/mess/tools/imgtool/library.c | 4 | ||||
-rw-r--r-- | src/mess/tools/imgtool/library.h | 12 | ||||
-rw-r--r-- | src/mess/tools/imgtool/modules/concept.c | 24 | ||||
-rw-r--r-- | src/mess/tools/imgtool/modules/mac.c | 170 | ||||
-rw-r--r-- | src/mess/tools/imgtool/modules/ti99.c | 104 | ||||
-rw-r--r-- | src/mess/tools/imgtool/modules/ti990hd.c | 64 | ||||
-rw-r--r-- | src/mess/tools/imgtool/modules/vzdos.c | 8 | ||||
-rw-r--r-- | src/mess/tools/imgtool/stream.c | 10 | ||||
-rw-r--r-- | src/mess/tools/imgtool/stream.h | 2 |
11 files changed, 204 insertions, 206 deletions
diff --git a/src/mess/tools/imgtool/filter.h b/src/mess/tools/imgtool/filter.h index 0e93d5e2092..324c891d5dd 100644 --- a/src/mess/tools/imgtool/filter.h +++ b/src/mess/tools/imgtool/filter.h @@ -14,7 +14,7 @@ #include "library.h" -typedef struct _imgtool_filter imgtool_filter; +struct imgtool_filter; enum { diff --git a/src/mess/tools/imgtool/imgtool.c b/src/mess/tools/imgtool/imgtool.c index 4236050f870..ce958f67f2a 100644 --- a/src/mess/tools/imgtool/imgtool.c +++ b/src/mess/tools/imgtool/imgtool.c @@ -20,13 +20,13 @@ TYPE DEFINITIONS ***************************************************************************/ -struct _imgtool_image +struct imgtool_image { const imgtool_module *module; object_pool *pool; }; -struct _imgtool_partition +struct imgtool_partition { imgtool_image *image; object_pool *pool; @@ -68,7 +68,7 @@ struct _imgtool_partition const char *writefile_optspec; }; -struct _imgtool_directory +struct imgtool_directory { imgtool_partition *partition; }; @@ -1121,7 +1121,7 @@ static imgtoolerr_t internal_open(const imgtool_module *module, const char *fnam } /* setup the image structure */ - size = sizeof(struct _imgtool_image) + module->image_extra_bytes; + size = sizeof(imgtool_image) + module->image_extra_bytes; image = (imgtool_image *) pool_malloc_lib(pool, size); if (!image) { @@ -2640,7 +2640,7 @@ imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *pa if (err) goto done; - size = sizeof(struct _imgtool_directory) + partition->directory_extra_bytes; + size = sizeof(imgtool_directory) + partition->directory_extra_bytes; enumeration = (imgtool_directory *) malloc(size); if (!enumeration) { diff --git a/src/mess/tools/imgtool/library.c b/src/mess/tools/imgtool/library.c index a564f37dd38..b0fa99d648d 100644 --- a/src/mess/tools/imgtool/library.c +++ b/src/mess/tools/imgtool/library.c @@ -12,7 +12,7 @@ #include "library.h" #include "pool.h" -struct _imgtool_library +struct imgtool_library { object_pool *pool; imgtool_module *first; @@ -32,7 +32,7 @@ imgtool_library *imgtool_library_create(void) goto error; /* allocate the main structure */ - library = (imgtool_library *)pool_malloc_lib(pool, sizeof(struct _imgtool_library)); + library = (imgtool_library *)pool_malloc_lib(pool, sizeof(imgtool_library)); if (!library) goto error; diff --git a/src/mess/tools/imgtool/library.h b/src/mess/tools/imgtool/library.h index 2a785a6b26d..9717e52e088 100644 --- a/src/mess/tools/imgtool/library.h +++ b/src/mess/tools/imgtool/library.h @@ -25,10 +25,10 @@ #include "charconv.h" -typedef struct _imgtool_image imgtool_image; -typedef struct _imgtool_partition imgtool_partition; -typedef struct _imgtool_directory imgtool_directory; -typedef struct _imgtool_library imgtool_library; +struct imgtool_image; +struct imgtool_partition; +struct imgtool_directory; +struct imgtool_library; enum imgtool_suggestion_viability_t { @@ -228,11 +228,11 @@ enum union imgtoolinfo; -typedef struct _imgtool_class imgtool_class; +struct imgtool_class; typedef void (*imgtool_get_info)(const imgtool_class *, UINT32, union imgtoolinfo *); -struct _imgtool_class +struct imgtool_class { imgtool_get_info get_info; imgtool_get_info derived_get_info; diff --git a/src/mess/tools/imgtool/modules/concept.c b/src/mess/tools/imgtool/modules/concept.c index 3a111074f31..0aa608e983e 100644 --- a/src/mess/tools/imgtool/modules/concept.c +++ b/src/mess/tools/imgtool/modules/concept.c @@ -12,10 +12,10 @@ #include <limits.h> #include "imgtool.h" -typedef struct UINT16xE +struct UINT16xE { UINT8 bytes[2]; -} UINT16xE; +}; /* get_UINT16xE @@ -69,7 +69,7 @@ INLINE void set_UINT16xE(int little_endian, UINT16xE *word, UINT16 data) device directory record (Disk sector 2-5) */ -typedef struct concept_vol_hdr_entry +struct concept_vol_hdr_entry { UINT16xE first_block; UINT16xE next_block; @@ -83,9 +83,9 @@ typedef struct concept_vol_hdr_entry char mem_flipped; char disk_flipped; UINT16xE unused; -} concept_vol_hdr_entry; +}; -typedef struct concept_file_dir_entry +struct concept_file_dir_entry { UINT16xE first_block; UINT16xE next_block; @@ -94,32 +94,32 @@ typedef struct concept_file_dir_entry unsigned char filename[16]; UINT16xE last_byte; UINT16xE last_access; -} concept_file_dir_entry; +}; -typedef struct concept_dev_dir +struct concept_dev_dir { concept_vol_hdr_entry vol_hdr; concept_file_dir_entry file_dir[77]; char unused[20]; -} concept_dev_dir; +}; /* concept disk image descriptor */ -typedef struct concept_image +struct concept_image { imgtool_stream *file_handle; /* imgtool file handle */ concept_dev_dir dev_dir; /* cached copy of device directory */ -} concept_image; +}; /* concept catalog iterator, used when imgtool reads the catalog */ -typedef struct concept_iterator +struct concept_iterator { concept_image *image; int index; /* current index */ -} concept_iterator; +}; static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f); diff --git a/src/mess/tools/imgtool/modules/mac.c b/src/mess/tools/imgtool/modules/mac.c index fd7c8c349fe..c8d0a65f4d5 100644 --- a/src/mess/tools/imgtool/modules/mac.c +++ b/src/mess/tools/imgtool/modules/mac.c @@ -114,20 +114,20 @@ #pragma mark MISCELLANEOUS UTILITIES #endif -typedef struct UINT16BE +struct UINT16BE { UINT8 bytes[2]; -} UINT16BE; +}; -typedef struct UINT24BE +struct UINT24BE { UINT8 bytes[3]; -} UINT24BE; +}; -typedef struct UINT32BE +struct UINT32BE { UINT8 bytes[4]; -} UINT32BE; +}; INLINE UINT16 get_UINT16BE(UINT16BE word) { @@ -181,27 +181,27 @@ typedef UINT32BE mac_type; /* point record, with the y and x coordinates */ -typedef struct mac_point +struct mac_point { UINT16BE v; /* actually signed */ UINT16BE h; /* actually signed */ -} mac_point; +}; /* rect record, with the corner coordinates */ -typedef struct mac_rect +struct mac_rect { UINT16BE top; /* actually signed */ UINT16BE left; /* actually signed */ UINT16BE bottom;/* actually signed */ UINT16BE right; /* actually signed */ -} mac_rect; +}; /* FInfo (Finder file info) record */ -typedef struct mac_FInfo +struct mac_FInfo { mac_type type; /* file type */ mac_type creator; /* file creator */ @@ -221,12 +221,12 @@ typedef struct mac_FInfo /* HFS & HFS+: System 7: The window in which the file???s icon appears System 8: reserved (set to 0) */ -} mac_FInfo; +}; /* FXInfo (Finder extended file info) record -- not found in MFS */ -typedef struct mac_FXInfo +struct mac_FXInfo { UINT16BE iconID; /* System 7: An ID number for the file???s icon; the numbers that identify icons are assigned by the @@ -243,12 +243,12 @@ typedef struct mac_FXInfo file onto the desktop, the directory ID of the folder from which the user moves the file is saved here) */ -} mac_FXInfo; +}; /* DInfo (Finder folder info) record -- not found in MFS */ -typedef struct mac_DInfo +struct mac_DInfo { mac_rect rect; /* Folder's window bounds */ UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */ @@ -259,12 +259,12 @@ typedef struct mac_DInfo UINT16BE view; /* System 7: The manner in which folders are displayed */ /* System 8: reserved (set to 0) */ -} mac_DInfo; +}; /* DXInfo (Finder extended folder info) record -- not found in MFS */ -typedef struct mac_DXInfo +struct mac_DXInfo { mac_point scroll; /* Scroll position */ UINT32BE openChain; /* System 7: chain of directory IDs for open folders */ @@ -279,7 +279,7 @@ typedef struct mac_DXInfo folder onto the desktop, the directory ID of the folder from which the user moves it is saved here) */ -} mac_DXInfo; +}; /* defines for FInfo & DInfo flags fields @@ -609,11 +609,11 @@ static void mac_strncpy(UINT8 *dest, int n, const UINT8 *src) /* disk image reference */ -typedef struct mac_l1_imgref +struct mac_l1_imgref { imgtool_image *image; UINT32 heads; -} mac_l1_imgref; +}; @@ -752,12 +752,10 @@ enum mac_format enum mac_forkID { data_fork = 0x00, rsrc_fork = 0xff }; -typedef struct mac_l2_imgref mac_l2_imgref; - /* MFS image ref */ -typedef struct mfs_l2_imgref +struct mfs_l2_imgref { UINT16 dir_num_files; UINT16 dir_start; @@ -769,16 +767,16 @@ typedef struct mfs_l2_imgref unsigned char ABlink_dirty[13]; /* dirty flag for each disk block in the ABlink array */ UINT8 ABlink[6141]; -} mfs_l2_imgref; +}; /* HFS extent descriptor */ -typedef struct hfs_extent +struct hfs_extent { UINT16BE stABN; /* first allocation block */ UINT16BE numABlks; /* number of allocation blocks */ -} hfs_extent; +}; /* HFS likes to group extents by 3 (it is 8 with HFS+), so we create a @@ -789,26 +787,26 @@ typedef hfs_extent hfs_extent_3[3]; /* MFS open file ref */ -typedef struct mfs_fileref +struct mfs_fileref { UINT16 stBlk; /* first allocation block of file */ -} mfs_fileref; +}; /* HFS open file ref */ -typedef struct hfs_fileref +struct hfs_fileref { hfs_extent_3 extents; /* first 3 file extents */ UINT32 parID; /* CNID of parent directory (undefined for extent & catalog files) */ mac_str31 filename; /* file name (undefined for extent & catalog files) */ -} hfs_fileref; +}; /* MFS/HFS open file ref */ -typedef struct mac_fileref +struct u { mac_l2_imgref *l2_img; /* image pointer */ @@ -828,13 +826,13 @@ typedef struct mac_fileref { mfs_fileref mfs; hfs_fileref hfs; - } u; + }; } mac_fileref; /* open BT ref */ -typedef struct mac_BTref +struct mac_BTref { mac_fileref fileref; /* open B-tree file ref */ @@ -849,7 +847,7 @@ typedef struct mac_BTref int (*key_compare_func)(const void *key1, const void *key2); void *node_buf; /* current node buffer */ -} mac_BTref; +}; /* Constants for BTHeaderRec attributes field @@ -864,7 +862,7 @@ enum /* HFS image ref */ -typedef struct hfs_l2_imgref +struct hfs_l2_imgref { UINT16 VBM_start; @@ -876,7 +874,7 @@ typedef struct hfs_l2_imgref mac_BTref cat_BT; UINT8 VBM[8192]; -} hfs_l2_imgref; +}; /* MFS/HFS image ref @@ -903,7 +901,7 @@ struct mac_l2_imgref /* MFS Master Directory Block */ -typedef struct mfs_mdb_t +struct mfs_mdb_ { UINT8 sigWord[2]; /* volume signature - always $D2D7 */ UINT32BE crDate; /* date and time of volume creation */ @@ -938,12 +936,12 @@ typedef struct mfs_mdb_t was that the disk utility could rely on the tag data to rebuild the link array if it should ever be corrupted. */ -} mfs_mdb_; +}; /* HFS Master Directory Block */ -typedef struct hfs_mdb_t +struct v1 { /* First fields are similar to MFS, though several fields have a different meaning */ UINT8 sigWord[2]; /* volume signature - always $D2D7 */ @@ -983,7 +981,7 @@ typedef struct hfs_mdb_t UINT16BE VCSize; /* size (in blocks) of volume cache */ UINT16BE VBMCSize; /* size (in blocks) of volume bitmap cache */ UINT16BE ctlCSize; /* size (in blocks) of common volume cache */ - } v1; + }; struct { UINT16BE embedSigWord; /* embedded volume signature */ @@ -998,17 +996,17 @@ typedef struct hfs_mdb_t } hfs_mdb_t; /* to save a little stack space, we use the same buffer for MDB and next blocks */ -typedef union img_open_buf +union img_open_buf { mfs_mdb_t mfs_mdb; hfs_mdb_t hfs_mdb; UINT8 raw[512]; -} img_open_buf; +}; /* Information extracted from catalog/directory */ -typedef struct mac_dirent +struct mac_dirent { UINT16 dataRecType; /* type of data record */ @@ -1026,14 +1024,14 @@ typedef struct mac_dirent UINT32 createDate; /* date and time of creation */ UINT32 modifyDate; /* date and time of last modification */ -} mac_dirent; +}; /* Tag record for GCR floppies (12 bytes) And, no, I don't know the format of the 20-byte tag record of the HD20 */ -typedef struct floppy_tag_record +struct floppy_tag_record { UINT32BE fileID; /* a.k.a. CNID */ /* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */ @@ -1051,7 +1049,7 @@ typedef struct floppy_tag_record each time a volume is written to, the current value of wrCnt is written in the tag field, then it is incremented */ /* (DV17 says "disk block number", but it cannot be true) */ -} floppy_tag_record; +}; #ifdef UNUSED_FUNCTION static void hfs_image_close(mac_l2_imgref *l2_img); @@ -1452,7 +1450,7 @@ static imgtoolerr_t mac_file_seteof(mac_fileref *fileref, UINT32 newEof) files appear does not match file names, and it does not always match file IDs. */ -typedef struct mfs_dir_entry +struct mfs_dir_entry { UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */ /* 0x00 means end of block: if we are not done @@ -1478,7 +1476,7 @@ typedef struct mfs_dir_entry /* next chars are file name - 255 chars at most */ /* IIRC, Finder 7 only supports 31 chars, wheareas earlier versions support 63 chars */ -} mfs_dir_entry; +}; /* FOBJ desktop resource: describes a folder, or the location of the volume @@ -1487,7 +1485,7 @@ typedef struct mfs_dir_entry In typical Apple manner, this resource is not documented. However, I have managed to reverse engineer some parts of it. */ -typedef struct mfs_FOBJ +struct mfs_FOBJ { UINT8 unknown0[2]; /* $00: $0004 for disk, $0008 for folder??? */ mac_point location; /* $02: location in parent window */ @@ -1522,19 +1520,19 @@ typedef struct mfs_FOBJ UINT8 name[1]; /* variable-length macintosh string */ } v2; } u; -} mfs_FOBJ; +}; /* MFS open dir ref */ -typedef struct mfs_dirref +struct mfs_dirref { mac_l2_imgref *l2_img; /* image pointer */ UINT16 index; /* current file index in the disk directory */ UINT16 cur_block; /* current block offset in directory file */ UINT16 cur_offset; /* current byte offset in current block of directory file */ UINT8 block_buffer[512]; /* buffer with current directory block */ -} mfs_dirref; +}; @@ -2770,13 +2768,13 @@ static int mfs_hashString(const mac_str255 string) /* HFS extents B-tree key */ -typedef struct hfs_extentKey +struct hfs_extentKey { UINT8 keyLength; /* length of key, excluding this field */ UINT8 forkType; /* 0 = data fork, FF = resource fork */ UINT32BE fileID; /* file ID */ UINT16BE startBlock; /* first file allocation block number in this extent */ -} hfs_extentKey; +}; enum { keyLength_hfs_extentKey = sizeof(hfs_extentKey) - sizeof(UINT8) @@ -2785,7 +2783,7 @@ enum /* HFS catalog B-tree key */ -typedef struct hfs_catKey +struct hfs_catKey { UINT8 keyLen; /* key length */ UINT8 resrv1; /* reserved */ @@ -2793,12 +2791,12 @@ typedef struct hfs_catKey mac_str31 cName; /* catalog node name */ /* note that in index nodes, it is a mac_str31, but in leaf keys it's a variable-length string */ -} hfs_catKey; +}; /* HFS catalog data record for a folder - 70 bytes */ -typedef struct hfs_catFolderData +struct hfs_catFolderData { UINT16BE recordType; /* record type */ UINT16BE flags; /* folder flags */ @@ -2810,12 +2808,12 @@ typedef struct hfs_catFolderData mac_DInfo userInfo; /* Finder information */ mac_DXInfo finderInfo; /* additional Finder information */ UINT32BE reserved[4]; /* reserved - set to zero */ -} hfs_catFolderData; +}; /* HFS catalog data record for a file - 102 bytes */ -typedef struct hfs_catFileData +struct hfs_catFileData { UINT16BE recordType; /* record type */ UINT8 flags; /* file flags */ @@ -2836,7 +2834,7 @@ typedef struct hfs_catFileData hfs_extent_3 dataExtents; /* first data fork extent record */ hfs_extent_3 rsrcExtents; /* first resource fork extent record */ UINT32BE reserved; /* reserved - set to zero */ -} hfs_catFileData; +}; /* HFS catalog data record for a thread - 46 bytes @@ -2844,24 +2842,24 @@ typedef struct hfs_catFileData The key for a thread record features the CNID of the item and an empty name, instead of the CNID of the parent and the item name. */ -typedef struct hfs_catThreadData +struct hfs_catThreadData { UINT16BE recordType; /* record type */ UINT32BE reserved[2]; /* reserved - set to zero */ UINT32BE parID; /* parent ID for this catalog node */ mac_str31 nodeName; /* name of this catalog node */ -} hfs_catThreadData; +}; /* union for all types at once */ -typedef union hfs_catData +union hfs_catData { UINT16BE dataType; hfs_catFolderData folder; hfs_catFileData file; hfs_catThreadData thread; -} hfs_catData; +}; /* HFS catalog record types @@ -2890,12 +2888,12 @@ enum /* BT functions used by HFS functions */ -typedef struct BT_leaf_rec_enumerator +struct BT_leaf_rec_enumerator { mac_BTref *BTref; UINT32 cur_node; int cur_rec; -} BT_leaf_rec_enumerator; +}; static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent); static void BT_close(mac_BTref *BTref); @@ -2907,12 +2905,12 @@ static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, in static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator); static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len); -typedef struct hfs_cat_enumerator +struct hfs_cat_enumerator { mac_l2_imgref *l2_img; BT_leaf_rec_enumerator BT_enumerator; UINT32 parID; -} hfs_cat_enumerator; +}; /* hfs_open_extents_file @@ -3640,7 +3638,7 @@ static imgtoolerr_t hfs_file_get_nth_block_address(mac_fileref *fileref, UINT32 Header of a node record */ -typedef struct BTNodeHeader +struct BTNodeHeader { UINT32BE fLink; /* (index of) next node at this level */ UINT32BE bLink; /* (index of) previous node at this level */ @@ -3650,7 +3648,7 @@ typedef struct BTNodeHeader parent, whatever IM says) */ UINT16BE numRecords; /* number of records in this node */ UINT16BE reserved; /* reserved; set to zero */ -} BTNodeHeader; +}; /* Constants for BTNodeHeader kind field @@ -3672,7 +3670,7 @@ enum BTHeaderRecord: first record of a B-tree header node (second record is unused, and third is node allocation bitmap). */ -typedef struct BTHeaderRecord +struct BTHeaderRecord { UINT16BE treeDepth; /* maximum height (usually leaf nodes) */ UINT32BE rootNode; /* node number of root node */ @@ -3693,7 +3691,7 @@ typedef struct BTHeaderRecord UINT8 reserved2; /* reserved */ UINT32BE attributes; /* persistent attributes about the tree */ UINT32BE reserved3[16]; /* reserved */ -} BTHeaderRecord; +}; static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent); @@ -3955,13 +3953,13 @@ static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, in Return imgtool error code */ -typedef struct data_nodes_t +struct data_nodes_t { void *buf; UINT32 node_num; UINT32 cur_rec; UINT32 num_recs; -} data_nodes_t; +}; static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent) { UINT16 node_numRecords; @@ -4842,13 +4840,13 @@ static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerat /* Resource header */ -typedef struct rsrc_header +struct rsrc_header { UINT32BE data_offs; /* Offset from beginning of resource fork to resource data */ UINT32BE map_offs; /* Offset from beginning of resource fork to resource map */ UINT32BE data_len; /* Length of resource data */ UINT32BE map_len; /* Length of resource map */ -} rsrc_header; +}; /* Resource data: each data entry is preceded by its len (UINT32BE) @@ -4858,7 +4856,7 @@ typedef struct rsrc_header /* Resource map: */ -typedef struct rsrc_map_header +struct rsrc_map_header { rsrc_header reserved0; /* Reserved for copy of resource header */ UINT32BE reserved1; /* Reserved for handle to next resource map */ @@ -4869,22 +4867,22 @@ typedef struct rsrc_map_header UINT16BE namelist_offs; /* Offset from beginning of map to resource name list */ UINT16BE type_count; /* Number of types in the map minus 1 */ /* This is actually part of the type list, which matters for offsets */ -} rsrc_map_header; +}; /* Resource type list entry */ -typedef struct rsrc_type_entry +struct rsrc_type_entry { UINT32BE type; /* Resource type */ UINT16BE ref_count; /* Number of resources of this type in map minus 1 */ UINT16BE ref_offs; /* Offset from beginning of resource type list to reference list for this type */ -} rsrc_type_entry; +}; /* Resource reference list entry */ -typedef struct rsrc_ref_entry +struct rsrc_ref_entry { UINT16BE id; /* Resource ID */ UINT16BE name_offs; /* Offset from beginning of resource name list to resource name */ @@ -4892,13 +4890,13 @@ typedef struct rsrc_ref_entry UINT8 attr; /* Resource attributes */ UINT24BE data_offs; /* Offset from beginning of resource data to data for this resource */ UINT32BE reserved; /* Reserved for handle to resource */ -} rsrc_ref_entry; +}; /* Resource name list entry: this is just a standard macintosh string */ -typedef struct mac_resfileref +struct mac_resfileref { mac_fileref fileref; /* open resource fork ref (you may open resources files in data fork, too, if you ever need to, @@ -4911,7 +4909,7 @@ typedef struct mac_resfileref UINT16 namelist_offs; /* Offset from beginning of map to resource name list */ UINT16 type_count; /* Number of types in the map minus 1 */ /* This is actually part of the type list, which matters for offsets */ -} mac_resfileref; +}; #ifdef UNUSED_FUNCTION /* @@ -5311,7 +5309,7 @@ static void mac_image_info(imgtool_image *img, char *string, size_t len) /* MFS/HFS catalog iterator, used when imgtool reads the catalog */ -typedef struct mac_iterator +struct mac_iterator { mac_format format; mac_l2_imgref *l2_img; @@ -5326,7 +5324,7 @@ typedef struct mac_iterator hfs_cat_enumerator catref; /* catalog file enumerator */ } hfs; } u; -} mac_iterator; +}; /* Open the disk catalog for enumeration diff --git a/src/mess/tools/imgtool/modules/ti99.c b/src/mess/tools/imgtool/modules/ti99.c index 0b1172d4f31..54870a2dc47 100644 --- a/src/mess/tools/imgtool/modules/ti99.c +++ b/src/mess/tools/imgtool/modules/ti99.c @@ -266,15 +266,15 @@ will accept paths of such length). */ Miscellaneous utilities that are used to handle TI data types */ -typedef struct UINT16BE +struct UINT16BE { UINT8 bytes[2]; -} UINT16BE; +}; -typedef struct UINT16LE +struct UINT16LE { UINT8 bytes[2]; -} UINT16LE; +}; INLINE UINT16 get_UINT16BE(UINT16BE word) { @@ -456,42 +456,42 @@ static int check_fpath(const char *fpath) /* Disk geometry */ -typedef struct ti99_geometry +struct ti99_geometry { int secspertrack; int cylinders; int heads; -} ti99_geometry; +}; /* Physical sector address */ -typedef struct ti99_sector_address +struct ti99_sector_address { int sector; int cylinder; int side; -} ti99_sector_address; +}; /* Time stamp (used in fdr, and WIN VIB/DDR) */ -typedef struct ti99_date_time +struct ti99_date_time { UINT8 time_MSB, time_LSB;/* 0-4: hour, 5-10: minutes, 11-15: seconds/2 */ UINT8 date_MSB, date_LSB;/* 0-6: year, 7-10: month, 11-15: day */ -} ti99_date_time; +}; /* Subdirectory descriptor (HFDC only) The HFDC supports up to 3 subdirectories. */ -typedef struct dsk_subdir +struct dsk_subdir { char name[10]; /* subdirectory name (10 characters, pad with spaces) */ UINT16BE fdir_aphysrec; /* aphysrec address of fdir record for this subdirectory */ -} dsk_subdir; +}; /* DSK VIB record @@ -499,7 +499,7 @@ typedef struct dsk_subdir Most fields in this record are only revelant to level 2 routines, but level 1 routines need the disk geometry information extracted from the VIB. */ -typedef struct dsk_vib +struct dsk_vib { char name[10]; /* disk volume name (10 characters, pad with spaces) */ UINT16BE totphysrecs; /* total number of physrecs on disk (usually 360, */ @@ -526,7 +526,7 @@ typedef struct dsk_vib /* (AU 0 is associated to LSBit of byte 0, */ /* AU 7 to MSBit of byte 0, AU 8 to LSBit */ /* of byte 1, etc.) */ -} dsk_vib; +}; enum ti99_img_format { @@ -540,7 +540,7 @@ enum ti99_img_format /* level-1 disk image descriptor */ -typedef struct ti99_lvl1_imgref +struct ti99_lvl1_imgref { ti99_img_format img_format; /* tells the image format */ imgtool_stream *file_handle; /* imgtool file handle */ @@ -548,7 +548,7 @@ typedef struct ti99_lvl1_imgref ti99_geometry geometry; /* geometry */ unsigned pc99_track_len; /* unformatted track length (pc99 format) */ UINT32 *pc99_data_offset_array; /* offset for each sector (pc99 format) */ -} ti99_lvl1_imgref; +}; /* calculate CRC for data address marks or sector data @@ -1384,7 +1384,7 @@ static int write_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, c /* WIN VIB/DDR record */ -typedef struct win_vib_ddr +struct win_vib_ddr { char name[10]; /* disk volume name (10 characters, pad with spaces) */ UINT16BE totAUs; /* total number of AUs */ @@ -1437,16 +1437,16 @@ typedef struct win_vib_ddr } ddr; } u2; UINT16BE subdir_AU[114];/* points to all subdirectory DDRs */ -} win_vib_ddr; +}; /* AU format */ -typedef struct ti99_AUformat +struct ti99_AUformat { int totAUs; /* total number of AUs */ int physrecsperAU; /* number of 256-byte physical records per AU */ -} ti99_AUformat; +}; /* DSK directory reference: 0 for root, 1 for 1st subdir, 2 for 2nd subdir, 3 @@ -1457,55 +1457,55 @@ typedef struct ti99_AUformat /* catalog entry (used for in-memory catalog) */ -typedef struct dir_entry +struct dir_entry { UINT16 dir_ptr; /* DSK: unused */ /* WIN: AU address of the DDR for this directory */ char name[10]; /* name of this directory (copied from the VIB for DSK, DDR for WIN) */ -} dir_entry; +}; -typedef struct file_entry +struct file_entry { UINT16 fdr_ptr; /* DSK: aphysrec address of the FDR for this file */ /* WIN: AU address of the FDR for this file */ char name[10]; /* name of this file (copied from FDR) */ -} file_entry; +}; -typedef struct ti99_catalog +struct ti99_catalog { int num_subdirs; /* number of subdirectories */ int num_files; /* number of files */ dir_entry subdirs[114]; /* description of each subdir */ file_entry files[128]; /* description of each file */ -} ti99_catalog; +}; /* level-2 disk image descriptor */ -typedef struct ti99_lvl2_imgref_dsk +struct ti99_lvl2_imgref_dsk { UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */ ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */ UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory and up to 3 subdirectories */ -} ti99_lvl2_imgref_dsk; +}; enum win_vib_t { win_vib_v1, win_vib_v2 }; -typedef struct ti99_lvl2_imgref_win +struct ti99_lvl2_imgref_win { win_vib_t vib_version; /* version of the vib record in aphysrec 0 (see win_vib_ddr) */ -} ti99_lvl2_imgref_win; +}; enum l2i_t { L2I_DSK, L2I_WIN }; -typedef struct ti99_lvl2_imgref +struct u { ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */ ti99_AUformat AUformat; /* AU format */ @@ -1535,7 +1535,7 @@ typedef struct ti99_lvl2_imgref { ti99_lvl2_imgref_dsk dsk; ti99_lvl2_imgref_win win; - } u; /* structure-specific info */ + }; /* structure-specific info */ } ti99_lvl2_imgref; /* @@ -1554,7 +1554,7 @@ enum /* DSK FDR record */ -typedef struct dsk_fdr +struct dsk_fdr { char name[10]; /* file name (10 characters, pad with spaces) */ UINT16BE xreclen; /* extended record len: if record len is >= 256, */ @@ -1595,12 +1595,12 @@ typedef struct dsk_fdr /* bytes each), one entry for each file cluster. */ /* 12 bits: address of first AU of cluster */ /* 12 bits: offset of last 256-byte record in cluster */ -} dsk_fdr; +}; /* WIN FDR record */ -typedef struct win_fdr +struct win_fdr { char name[10]; /* file name (10 characters, pad with spaces) */ UINT16BE xreclen; /* extended record len: if record len is >= 256, */ @@ -1657,12 +1657,12 @@ typedef struct win_fdr /* bytes each), one entry for each file cluster. */ /* 16 bits: address of first AU of cluster */ /* 16 bits: address of last AU of cluster */ -} win_fdr; +}; /* tifile header: stand-alone file */ -typedef struct tifile_header +struct tifile_header { char tifiles[8]; /* always '\7TIFILES' */ UINT16BE fphysrecs; /* file length in physrecs */ @@ -1697,32 +1697,32 @@ typedef struct tifile_header /* 4 bytes: time & date of last update */ /* 2 bytes: unknown (always >0000) */ /* 96 chars: 0xCA53 repeated 56 times */ -} tifile_header; +}; /* level-2 file descriptor */ -typedef struct ti99_lvl2_fileref_dsk +struct ti99_lvl2_fileref_dsk { ti99_lvl2_imgref *l2_img; int fdr_aphysrec; dsk_fdr fdr; -} ti99_lvl2_fileref_dsk; +}; -typedef struct ti99_lvl2_fileref_win +struct ti99_lvl2_fileref_win { ti99_lvl2_imgref *l2_img; unsigned fphysrecs; /* copy of field in the eldest FDR */ unsigned eldestfdr_aphysrec; /* aphysrec address of the eldest FDR */ unsigned curfdr_aphysrec; /* aphysrec address of the currently open sibling FDR */ win_fdr curfdr; /* buffer with currently open sibling FDR */ -} ti99_lvl2_fileref_win; +}; -typedef struct ti99_lvl2_fileref_tifiles +struct ti99_lvl2_fileref_tifiles { imgtool_stream *file_handle; tifile_header hdr; -} ti99_lvl2_fileref_tifiles; +}; enum l2f_type_t { @@ -1730,7 +1730,7 @@ enum l2f_type_t L2F_WIN, L2F_TIFILES }; -typedef struct ti99_lvl2_fileref +struct u { l2f_type_t type; union @@ -1738,7 +1738,7 @@ typedef struct ti99_lvl2_fileref ti99_lvl2_fileref_dsk dsk; ti99_lvl2_fileref_win win; ti99_lvl2_fileref_tifiles tifiles; - } u; + }; } ti99_lvl2_fileref; @@ -3696,14 +3696,14 @@ static void current_date_time(ti99_date_time *reply) * files with variable-size records (sequential-access) */ -typedef struct ti99_lvl3_fileref +struct ti99_lvl3_fileref { ti99_lvl2_fileref l2_file; int cur_log_rec; int cur_phys_rec; int cur_pos_in_phys_rec; -} ti99_lvl3_fileref; +}; #ifdef UNUSED_FUNCTION /* @@ -3827,23 +3827,23 @@ static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_rec /* ti99 catalog iterator, used when imgtool reads the catalog */ -typedef struct dsk_iterator +struct dsk_iterator { ti99_lvl2_imgref *image; int level; int listing_subdirs; /* true if we are listing subdirectories at current level */ int index[2]; /* current index in the disk catalog */ ti99_catalog *cur_catalog; /* current catalog */ -} dsk_iterator; +}; -typedef struct win_iterator +struct win_iterator { ti99_lvl2_imgref *image; int level; int listing_subdirs; /* true if we are listing subdirectories at current level */ int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ ti99_catalog catalog[MAX_DIR_LEVEL]; /* current catalog */ -} win_iterator; +}; static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f); diff --git a/src/mess/tools/imgtool/modules/ti990hd.c b/src/mess/tools/imgtool/modules/ti990hd.c index a9607efb3ef..44fde6df08b 100644 --- a/src/mess/tools/imgtool/modules/ti990hd.c +++ b/src/mess/tools/imgtool/modules/ti990hd.c @@ -35,15 +35,15 @@ that is longer than 39 characters. */ #define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */ -typedef struct UINT16BE +struct UINT16BE { UINT8 bytes[2]; -} UINT16BE; +}; -typedef struct UINT32BE +struct UINT32BE { UINT8 bytes[4]; -} UINT32BE; +}; INLINE UINT16 get_UINT16BE(UINT16BE word) { @@ -72,13 +72,13 @@ INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) /* disk image header */ -typedef struct disk_image_header +struct disk_image_header { UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */ UINT32BE heads; /* number of heads on hard disk (big-endian) */ UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */ UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */ -} disk_image_header; +}; enum { @@ -101,7 +101,7 @@ enum /* SC0 record (Disk sector 0) */ -typedef struct ti990_sc0 +struct ti990_sc0 { char vnm[8]; /* volume name */ UINT16BE tna; /* total number of ADUs */ @@ -148,12 +148,12 @@ typedef struct ti990_sc0 UINT16BE dct; /* disk creation time */ UINT16BE fsf; /* * * RESERVED * * */ /* SCOSIZ = >AA */ -} ti990_sc0; +}; /* DOR (Directory Overhead Record) */ -typedef struct ti990_dor +struct ti990_dor { UINT16BE nrc; /* # records in directory (minus DOR) nrc = nfl + nar (+ tfc???) */ UINT16BE nfl; /* # files currently in directory */ @@ -164,7 +164,7 @@ typedef struct ti990_dor char pnm[8]; /* name of parent directory (VCATALOG for root, even though it makes little sense) */ UINT16BE prs; /* "default physical record length (used for file creation)" */ /* DORSIZ = >1C */ -} ti990_dor; +}; /* file flags found in fdr @@ -198,16 +198,16 @@ enum /* ACE subrecord found in FDR */ -typedef struct ti990_ace +struct ti990_ace { char agn[8]; /* access group name */ UINT16BE flg; /* flags */ -} ti990_ace; +}; /* FDR record */ -typedef struct ti990_fdr +struct ti990_fdr { UINT16BE hkc; /* hask key count: the number of file descriptor records that are present in the directory that hashed to this record number */ UINT16BE hkv; /* hask key value: the result of the hash algorithm for the file name actually covered in this record */ @@ -243,7 +243,7 @@ typedef struct ti990_fdr UINT16BE psa; /* public security attribute */ ti990_ace ace[9]; /* 9 access control entries */ UINT8 fil[2]; /* not used */ -} ti990_fdr; +}; /* ADR record: variant of FDR for Aliases @@ -251,7 +251,7 @@ typedef struct ti990_fdr The fields marked here with *** are in the ADR template to maintain compatability with the FDR template. */ -typedef struct ti990_adr +struct ti990_adr { UINT16BE hkc; /* hask key count */ UINT16BE hkv; /* hask key value */ @@ -266,7 +266,7 @@ typedef struct ti990_adr UINT16BE fill05; /* *** secondary allocation address */ UINT16BE rna; /* record number of next ADR */ UINT16BE raf; /* record # of actual FDR (from 1 through dor.nrc) */ -} ti990_adr; +}; /* CDR record: variant of FDR for Channel @@ -274,7 +274,7 @@ typedef struct ti990_adr The CDR is the permanent record of a channel. It is carried as an alias of the program file in which the channel owner task resides. */ -typedef struct ti990_cdr +struct ti990_cdr { UINT16BE hkc; /* hask key count */ UINT16BE hkv; /* hask key value */ @@ -295,7 +295,7 @@ typedef struct ti990_cdr UINT16BE psa; /* public security attribute */ UINT8 scg[94]; /* "SDT with 9 control groups" (whatever it means - and, no, 94 is not dividable by 9) */ UINT8 fill06[8]; /* reserved */ -} ti990_cdr; +}; /* Based on contents of the flags field, catalog entries may be either an FDR, @@ -305,19 +305,19 @@ typedef struct ti990_cdr field starts at offset 4, and therefore if we try to interpret a KDR as an FDR (or ADR, CDR), we will find fnm[0] and assume the FDR is empty. */ -typedef union directory_entry +union directory_entry { ti990_fdr fdr; ti990_adr adr; ti990_cdr cdr; -} directory_entry; +}; #if 0 /* tifile header: stand-alone file */ -typedef struct tifile_header +struct tifile_header { char tifiles[8]; /* always '\7TIFILES' */ UINT8 secsused_MSB; /* file length in sectors (big-endian) */ @@ -329,59 +329,59 @@ typedef struct tifile_header UINT8 fixrecs_MSB; /* file length in records (big-endian) */ UINT8 fixrecs_LSB; UINT8 res[128-16]; /* reserved */ -} tifile_header; +}; /* catalog entry (used for in-memory catalog) */ -typedef struct catalog_entry +struct catalog_entry { UINT16 fdr_secnum; char filename[10]; -} catalog_entry; +}; #endif /* Disk geometry */ -typedef struct ti990_geometry +struct ti990_geometry { unsigned int cylinders, heads, sectors_per_track, bytes_per_sector; -} ti990_geometry; +}; /* Physical sector address */ -typedef struct ti990_phys_sec_address +struct ti990_phys_sec_address { int cylinder; int head; int sector; -} ti990_phys_sec_address; +}; /* ti99 disk image descriptor */ -typedef struct ti990_image +struct ti990_image { imgtool_stream *file_handle; /* imgtool file handle */ ti990_geometry geometry; /* geometry */ ti990_sc0 sec0; /* cached copy of sector 0 */ -} ti990_image; +}; /* ti990 catalog iterator, used when imgtool reads the catalog */ -typedef struct ti990_iterator +struct ti990_iterator { ti990_image *image; int level; /* current recursion level */ int nrc[MAX_DIR_LEVEL]; /* length of disk catalogs in records */ int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ directory_entry xdr[MAX_DIR_LEVEL]; /* fdr records */ -} ti990_iterator; +}; static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f); diff --git a/src/mess/tools/imgtool/modules/vzdos.c b/src/mess/tools/imgtool/modules/vzdos.c index 741f068a68b..5c93a3b94d4 100644 --- a/src/mess/tools/imgtool/modules/vzdos.c +++ b/src/mess/tools/imgtool/modules/vzdos.c @@ -40,7 +40,7 @@ as track map, with one bit for each sector used. #define MAX_DIRENTS (15*8) /* vzdos directry entry */ -typedef struct vzdos_dirent +struct vzdos_dirent { char ftype; char delimitor; @@ -49,13 +49,13 @@ typedef struct vzdos_dirent UINT8 start_sector; UINT16 start_address; UINT16 end_address; -} vzdos_dirent; +}; -typedef struct vz_iterator +struct vz_iterator { int index; int eof; -} vz_iterator; +}; static const UINT8 sector_order[] = { diff --git a/src/mess/tools/imgtool/stream.c b/src/mess/tools/imgtool/stream.c index 95c385d3ee8..5b7c22148aa 100644 --- a/src/mess/tools/imgtool/stream.c +++ b/src/mess/tools/imgtool/stream.c @@ -20,7 +20,7 @@ enum imgtype_t IMG_MEM }; -struct _imgtool_stream +struct imgtool_stream { imgtype_t imgtype; int write_protect; @@ -54,7 +54,7 @@ static imgtool_stream *stream_open_zip(const char *zipname, const char *subname, goto error; fclose(f); - imgfile = (imgtool_stream *)malloc(sizeof(struct _imgtool_stream)); + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); if (!imgfile) goto error; @@ -156,7 +156,7 @@ imgtool_stream *stream_open(const char *fname, int read_or_write) goto error; } - imgfile = (imgtool_stream *)malloc(sizeof(struct _imgtool_stream)); + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); if (!imgfile) goto error; @@ -186,7 +186,7 @@ imgtool_stream *stream_open_write_stream(int size) { imgtool_stream *imgfile; - imgfile = (imgtool_stream *)malloc(sizeof(struct _imgtool_stream)); + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); if (!imgfile) return NULL; @@ -211,7 +211,7 @@ imgtool_stream *stream_open_mem(void *buf, size_t sz) { imgtool_stream *imgfile; - imgfile = (imgtool_stream *)malloc(sizeof(struct _imgtool_stream)); + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); if (!imgfile) return NULL; diff --git a/src/mess/tools/imgtool/stream.h b/src/mess/tools/imgtool/stream.h index b798501cd1b..fedf899a96e 100644 --- a/src/mess/tools/imgtool/stream.h +++ b/src/mess/tools/imgtool/stream.h @@ -12,7 +12,7 @@ #include "imgterrs.h" #include "corefile.h" -typedef struct _imgtool_stream imgtool_stream; +struct imgtool_stream; imgtool_stream *stream_open(const char *fname, int read_or_write); /* similar params to mame_fopen */ imgtool_stream *stream_open_write_stream(int filesize); |