HP85 GPIB Disk Emulator
1.0
HP85GPIBDiskEmulator
|
Go to the documentation of this file.
19 #ifndef LIF_STAND_ALONE
26 #define LIF_SECTOR_SIZE 256
29 #define LIF_DIR_SIZE 32
30 #define LIF_DIR_RECORDS_PER_SECTOR (LIF_SECTOR_SIZE/LIF_DIR_SIZE)
99 uint8_t filename[10+1];
193 #endif // #ifndef _LIFUTILS_H
MEMSPACE long lif_add_ascii_file_as_e010_wrapper(lif_t *LIF, uint32_t offset, char *username)
Add ASCII file as E010 data to LIF image - or compute converted data size To find size of formatted r...
MEMSPACE uint8_t lif_BIN2BCD(uint8_t data)
Convert number >= 0 and <= 99 to BCD.
MEMSPACE int lif_del_file(char *lifimagename, char *lifname)
Delete LIF file in LIF image.
MEMSPACE void lif_str2dir(uint8_t *B, lif_t *LIF)
Convert byte vector into byte vector.
MEMSPACE void lif_vol2str(lif_t *LIF, uint8_t *B)
Convert LIF volume records into byte vector.
MEMSPACE void lif_S2B(uint8_t *B, uint8_t *name, int size)
Convert string to LIF directory record.
MEMSPACE char * lif_lifbcd2timestr(uint8_t *bcd)
MEMSPACE int lif_check_volume(lif_t *LIF)
Check Volume Table for values in range.
Master LIF data structure Contains image file name Volume Structure Current Directory Entry read/writ...
MEMSPACE int lif_ascii_string_to_e010(char *str, long offset, uint8_t *wbuf)
Convert an ASCII string into HP85 E010 format.
MEMSPACE char * lif_ctime_gmt(time_t *tp)
GMT version of POSIX ctime().
MEMSPACE int lif_tests(int argc, char *argv[])
LIF user tests.
MEMSPACE char * lif_stralloc(char *str)
Allocate and copy a string Displays message on errors.
MEMSPACE int lif_fixname(uint8_t *B, char *name, int size)
Convert name into a valid LIF name Only use the basename() part of the string and remove any file nam...
MEMSPACE int lif_writedirindex(lif_t *LIF, int index)
Write LIF drectory record number N.
MEMSPACE int lif_checkdirindex(lif_t *LIF, int index)
Check directory index limits.
MEMSPACE long lif_add_lif_file(char *lifimagename, char *lifname, char *userfile)
Add LIF file from another LIF image.
MEMSPACE int lif_extract_e010_as_ascii(char *lifimagename, char *lifname, char *username)
Extract E010 type file from LIF image and save as user ASCII file.
MEMSPACE long lif_create_image(char *lifimagename, char *liflabel, uint32_t dirsectors, uint32_t sectors)
Create/Format a LIF new disk image This can take a while to run, about 1 min for 10,...
MEMSPACE int lif_newdir(lif_t *LIF, long sectors)
Allocate index of free directory record.
MEMSPACE void lif_str2vol(uint8_t *B, lif_t *LIF)
Convert byte vector into LIF volume records.
MEMSPACE void lif_closedir(lif_t *LIF)
Close LIF directory clear and free lif_t structure.
MEMSPACE void lif_close_volume(lif_t *LIF)
Free LIF structure and close any files.
MEMSPACE void lif_dir_clear(lif_t *LIF)
Clear DIR part of LIF structure.
MEMSPACE FILE * lif_open(char *name, char *mode)
Open a file that must exist Displays message on errors.
MEMSPACE void lif_free(void *p)
Free allocated memory Displays message on errors.
MEMSPACE void lif_time2lifbcd(time_t t, uint8_t *bcd)
UNIX time to LIF BCD time format The BCD year is only the lower 2 digits of the year So We assume tha...
MEMSPACE int lif_readdirindex(lif_t *LIF, int index)
Read LIF directory record number N.
MEMSPACE int lif_find_file(lif_t *LIF, char *liflabel)
Find a LIF image file by name.
MEMSPACE uint32_t lif_bytes2sectors(uint32_t bytes)
Convert bytes into used sectors.
MEMSPACE void lif_dir2str(lif_t *LIF, uint8_t *B)
Convert LIF directory records into byte vector.
MEMSPACE lif_t * lif_updatefree(lif_t *LIF)
Update free space @parameter[in] *LIF: LIF structure.
MEMSPACE lif_t * lif_open_volume(char *name, char *mode)
Open LIF directory for reading.
MEMSPACE int lif_chars(int c, int index __attribute__((unused)))
Check if characters in a LIF volume or LIF file name are valid.
MEMSPACE int lif_seek_msg(FILE *fp, long offset, char *msg)
MEMSPACE int lif_e010_pad_sector(long offset, uint8_t *wbuf)
HP85 E010 ASCII LIF records ef [ff]* = no more data in this sector df size [ASCII] = data must fit in...
MEMSPACE int lif_check_dir(lif_t *LIF)
Validate Directory record values We only do basic out of bounds tests for this record Purged or EOF d...
MEMSPACE int lif_rename_volume(char *lifimagename, char *volname)
Rename LIF VOLUME NAME.
MEMSPACE int lif_checkname(char *name)
Check volume LIF name or directory name is valid.
MEMSPACE void lif_rewinddir(lif_t *LIF)
Rewind LIF directory Note readdir pre-increments the directory pointer index so we start at -1.
MEMSPACE void lif_image_clear(lif_t *LIF)
File seek with error message.
MEMSPACE int lif_BCD2BIN(uint8_t bin)
Convert BCD in the range 0 and <= 99 to BIN BCD format: each hex nibble has a digit 0 ....
uint32_t sectors_per_track
MEMSPACE void lif_dir(char *lifimagename)
Display a LIF image file directory.
uint32_t time_t
type of EPOCH result.
MEMSPACE void * lif_calloc(long size)
Allocate and clear memory Displays message on errors.
MEMSPACE long lif_add_ascii_file_as_e010(char *lifimagename, char *lifname, char *userfile)
Convert and add ASCII file to the LIF image as type E010 format The basename of the lifname,...
MEMSPACE lifdir_t * lif_readdir(lif_t *LIF)
Read a directory records from LIF image advancind directory index.
MEMSPACE int lif_writedirEOF(lif_t *LIF, int index)
Write LIF drectory EOF.
MEMSPACE int lif_write(lif_t *LIF, void *buf, long offset, int bytes)
Write data to an LIF image Displays message on errors.
MEMSPACE stat_t * lif_stat(char *name, stat_t *p)
Stat a file Displays message on errors.
MEMSPACE int lif_extract_lif_as_lif(char *lifimagename, char *lifname, char *username)
Extract a file from LIF image entry as standalone LIF image.
MEMSPACE void lif_vol_clear(lif_t *LIF)
Clear VOL part of LIF structure.
MEMSPACE int lif_B2S(uint8_t *B, uint8_t *name, int size)
Convert LIF space padded string name into normal string.
MEMSPACE int lif_rename_file(char *lifimagename, char *oldlifname, char *newlifname)
Rename LIF file in LIF image.
MEMSPACE void lif_help(int full)
Help Menu for User invoked GPIB functions and tasks See: int gpib_tests(char *str)
MEMSPACE lif_t * lif_create_volume(char *imagename, char *liflabel, long dirstart, long dirsectors, long filesectors)
Create LIF image with Volume, Directory and optional empty filespace.
MEMSPACE void lif_dump_vol(lif_t *LIF, char *msg)
Dump LIF struture data for debugging.
MEMSPACE time_t lif_lifbcd2time(uint8_t *bcd)
convert BCD date into time_t value The BCD year is only the lower 2 digits of the year So We assume t...
MEMSPACE long lif_read(lif_t *LIF, void *buf, long offset, int bytes)
Read data from a LIF image Displays message on errors.