#define GetSimpleRandom(max) get_random_number(RANDOM_SIMPLE, max)
/* values for Error() */
-#define ERR_INFO 0
-#define ERR_INFO_LINE (1 << 0)
-#define ERR_WARN (1 << 1)
-#define ERR_EXIT (1 << 2)
-#define ERR_HELP (1 << 3)
-#define ERR_SOUND_SERVER (1 << 4)
-#define ERR_NETWORK_SERVER (1 << 5)
-#define ERR_NETWORK_CLIENT (1 << 6)
+#define ERR_UNKNOWN 0
+#define ERR_DEBUG (1 << 0)
+#define ERR_INFO (1 << 1)
+#define ERR_INFO_LINE (1 << 2)
+#define ERR_WARN (1 << 3)
+#define ERR_EXIT (1 << 4)
+#define ERR_HELP (1 << 5)
+#define ERR_SOUND_SERVER (1 << 6)
+#define ERR_NETWORK_SERVER (1 << 7)
+#define ERR_NETWORK_CLIENT (1 << 8)
#define ERR_FROM_SERVER (ERR_SOUND_SERVER | ERR_NETWORK_SERVER)
#define ERR_EXIT_HELP (ERR_EXIT | ERR_HELP)
#define ERR_EXIT_SOUND_SERVER (ERR_EXIT | ERR_SOUND_SERVER)
#define ERR_EXIT_NETWORK_SERVER (ERR_EXIT | ERR_NETWORK_SERVER)
#define ERR_EXIT_NETWORK_CLIENT (ERR_EXIT | ERR_NETWORK_CLIENT)
+#if 0
+#define ERR_ERROR (ERR_UNKNOWN)
+#define ERR_FATAL (ERR_EXIT)
+#define ERR_VERBOSE (ERR_INFO)
+#endif
/* values for getFile...() and putFile...() */
#define BYTE_ORDER_BIG_ENDIAN 0
char *getStringCat3(char *, char *, char *);
char *getPath2(char *, char *);
char *getPath3(char *, char *, char*);
-char *getStringCopy(char *);
-char *getStringCopyN(char *, int);
-char *getStringToLower(char *);
+char *getStringCopy(const char *);
+char *getStringCopyN(const char *, int);
+char *getStringCopyNStatic(const char *, int);
+char *getStringToLower(const char *);
void setString(char **, char *);
boolean strEqual(char *, char *);
boolean strEqualN(char *, char *, int);
boolean strPrefixLower(char *, char *);
boolean strSuffixLower(char *, char *);
-void GetOptions(char **, void (*print_usage_function)(void));
+void GetOptions(char **,
+ void (*print_usage_function)(void),
+ void (*print_version_function)(void));
void SetError(char *, ...);
char *GetError(void);
void swap_numbers(int *, int *);
void swap_number_pairs(int *, int *, int *, int *);
+#if 1
+
+int getFile8BitInteger(File *);
+int putFile8BitInteger(FILE *, int);
+int getFile16BitInteger(File *, int);
+int putFile16BitInteger(FILE *, int, int);
+int getFile32BitInteger(File *, int);
+int putFile32BitInteger(FILE *, int, int);
+
+boolean getFileChunk(File *, char *, int *, int);
+int putFileChunk(FILE *, char *, int, int);
+int getFileVersion(File *);
+int putFileVersion(FILE *, int);
+
+void ReadBytesFromFile(File *, byte *, unsigned int);
+void WriteBytesToFile(FILE *, byte *, unsigned int);
+
+void ReadUnusedBytesFromFile(File *, unsigned int);
+void WriteUnusedBytesToFile(FILE *, unsigned int);
+
+#else
+
int getFile8BitInteger(FILE *);
int putFile8BitInteger(FILE *, int);
int getFile16BitInteger(FILE *, int);
void ReadUnusedBytesFromFile(FILE *, unsigned int);
void WriteUnusedBytesToFile(FILE *, unsigned int);
+#endif
+
#define getFile8Bit(f) getFile8BitInteger(f)
#define putFile8Bit(f,x) putFile8BitInteger(f,x)
#define getFile16BitBE(f) getFile16BitInteger(f,BYTE_ORDER_BIG_ENDIAN)
File *openFile(char *, char *);
int closeFile(File *);
int checkEndOfFile(File *);
+size_t readFile(File *, void *, size_t, size_t);
+int seekFile(File *, long, int);
+int getByteFromFile(File *);
char *getStringFromFile(File *, char *, int);
Directory *openDirectory(char *);
DirectoryEntry *readDirectory(Directory *);
void freeDirectoryEntry(DirectoryEntry *);
+boolean directoryExists(char *);
boolean fileExists(char *);
boolean FileIsGraphic(char *);
boolean FileIsSound(char *);
#if DEBUG
void debug_print_timestamp(int, char *);
+#endif
void print_timestamp_init(char *);
void print_timestamp_time(char *);
void print_timestamp_done(char *);
-#endif /* DEBUG */
-
#endif /* MISC_H */