1 
2 #ifndef ZXFLIB_H_INCLUDED
3 
4 #define ZXFLIB_H_INCLUDED
5 
6 #define ZXF_MAGIC "PLUS3DOS\032\001"	/* +3DOS magic number */
7 
8 typedef unsigned char  zxf_byte;
9 typedef unsigned short zxf_word;
10 
11 typedef int zxf_errno_t;
12 
13 
14 typedef enum
15 {
16 	ZXF_NAKED,
17 	ZXF_P3DOS,
18 	ZXF_TAP,
19 	ZXF_SNA,
20 	ZXF_ROM
21 } ZXF_FORMAT;
22 
23 
24 typedef struct
25 {
26 	ZXF_FORMAT zxf_format;
27 	zxf_byte zxf_header[128];
28 	zxf_byte zxf_data[768];
29 	zxf_byte zxf_udgs[168];
30 } ZXF_FILE;
31 
32 /* Initialise the structure as empty */
33 void zxf_file_new(ZXF_FILE *f);
34 /* Initialise the structure for a new font*/
35 zxf_errno_t zxf_file_create(ZXF_FILE *f);
36 /* Load a font from a stream
37  * nb: If the file pointer is important to you, you have to save it. */
38 zxf_errno_t zxf_file_read  (ZXF_FILE *f, FILE *fp, ZXF_FORMAT fmt);
39 /* Write font to stream. If format is ROM or SNA, auxname must be set. */
40 zxf_errno_t zxf_file_write (ZXF_FILE *f, FILE *fp, ZXF_FORMAT fmt, char *auxname);
41 /* Free any memory associated with a Spectrum font file (dummy) */
42 void zxf_file_delete (ZXF_FILE *f);
43 /* Expand error number returned by other routines, to string */
44 char *zxf_error_string(zxf_errno_t err);
45 
46 /* errors */
47 #define ZXF_E_OK        ( 0)	/* OK */
48 #define ZXF_E_NOTP3FNT	(-3)	/* Attempt to load incorrect file */
49 #define ZXF_E_ERRNO	(-4)	/* Error in fread() or fwrite() */
50 #define ZXF_E_EMPTY	(-5)	/* Attempt to save an empty file */
51 #endif /* ZXFLIB_H_INCLUDED */
52 
53