[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pascal



if anyone cares:

//	PasStructs.h

#ifndef _H_PasStructs
#define _H_PasStructs

#ifndef ushort
	typedef unsigned short ushort;
#endif

#include "FileSystemTypes.h"
#include "PasDiskLocSpec.h"

#pragma options align = packed

#define	Pas_kBytesPerBlock			512L		//	0x0200L bytes
#define	Pas_kBlocksPerDisk			280L		//	0x0118L blocks
#define Pas_kDirStartBlock			2L
#define Pas_kDirEndBlockPlusOne		6L

//	disk structs
typedef struct {
	Byte		byte[Pas_kBytesPerBlock];
} Pas_Block;

typedef struct Pas_Disk {
	Pas_Block	block[Pas_kBlocksPerDisk];
} Pas_Disk;

typedef ushort	Pas_BlockNum, Pas_EntryIndex;

#define	Pas_GetBlock(imageRec, blockNum)	\
	&((imageRec)->image.pas->block[blockNum])
	
#define	Pas_kMaxDirEntries		77
#define	Pas_kVolIDLength		7
#define	Pas_kTitleIDLength		15

typedef struct {
	unsigned short	month	: 3;
	unsigned short	day		: 5;
	unsigned short	year	: 7;
	unsigned short	unused	: 1;
} Pas_DateRec;

typedef unsigned	char	Pas_VolumeID[Pas_kVolIDLength + 1];
typedef 			char	Pas_VolumeIDStr[Pas_kVolIDLength];

typedef unsigned	char	Pas_TitleID[Pas_kTitleIDLength + 1];
typedef 			char	Pas_TitleIDStr[Pas_kTitleIDLength];

typedef enum {
	Pas_FileKind_UNTYPED, 
	Pas_FileKind_X_DISK,
	Pas_FileKind_CODE, 
	Pas_FileKind_TEXT, 
	Pas_FileKind_INFO, 
	Pas_FileKind_DATA, 
	Pas_FileKind_GRAF, 
	Pas_FileKind_FOTO, 
	Pas_FileKind_SECURE_DIR, 

	Pas_FileKind_NUMTYPES
} Pas_FileKindType;

/*************
	Pas_DirEntryVolume is for these types:
		Pas_FileKind_UNTYPED
		Pas_FileKind_SECURE_DIR
*/
typedef struct {						//	volume info - only in Pas_DirEntry[0]
	Pas_VolumeID	volumeID;			//	name of disk volume
	Pas_BlockSpec	endOfVolume;		//	last block in volume
	Byte			numFiles;			//	number of files in directory
	RboShort		loadTime;			//	time of last access
	Pas_DateRec		lastBoot;			//	most recent date settings
} Pas_DirEntryVolume;

typedef struct {						//	regular file info
	Pas_TitleID		titleID;			//	name of file
	RboShort		lastByte;			//	num bytes in last file block
	Pas_DateRec		access;				//	date of last modification
} Pas_DirEntryFile;

typedef union {
	Pas_DirEntryVolume		volume;
	Pas_DirEntryFile		file;
} Pas_DirEntryUnion;

typedef struct {
	Pas_BlockSpec		firstBlock;
	Pas_BlockSpec		lastBlockPlusOne;
	RboShort			fileKind;		//	Pas_FileKindType
	Pas_DirEntryUnion	entryType;
} Pas_DirEntry;

typedef Pas_DirEntry	Pas_Directory[Pas_kMaxDirEntries];

#pragma options align = reset

Boolean		Pas_IsPas(DiskImageRec *imageRec);
void		Pas_Catalog(DiskImageRec *imageRec);

#endif