updated contact info in source file headers
[rocksndiamonds.git] / src / libgame / misc.h
index 4f3c3481c099c7f71d3b8c97ae037a48028968c9..d83a6563909264579b4bd3964fa1d40d1393b68d 100644 (file)
@@ -1,15 +1,13 @@
-/***********************************************************
-* Artsoft Retro-Game Library                               *
-*----------------------------------------------------------*
-* (c) 1994-2006 Artsoft Entertainment                      *
-*               Holger Schemel                             *
-*               Detmolder Strasse 189                      *
-*               33604 Bielefeld                            *
-*               Germany                                    *
-*               e-mail: info@artsoft.org                   *
-*----------------------------------------------------------*
-* misc.h                                                   *
-***********************************************************/
+// ============================================================================
+// Artsoft Retro-Game Library
+// ----------------------------------------------------------------------------
+// (c) 1995-2014 by Artsoft Entertainment
+//                         Holger Schemel
+//                 info@artsoft.org
+//                 http://www.artsoft.org/
+// ----------------------------------------------------------------------------
+// misc.h
+// ============================================================================
 
 #ifndef MISC_H
 #define MISC_H
 #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
@@ -147,9 +152,10 @@ char *getStringCat2(char *, char *);
 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);
@@ -158,7 +164,9 @@ boolean strSuffix(char *, char *);
 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);
@@ -173,6 +181,28 @@ void clear_mem(void *, unsigned int);
 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);
@@ -191,6 +221,8 @@ void WriteBytesToFile(FILE *, byte *, unsigned 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)
@@ -227,6 +259,9 @@ int getNumNodes(ListNode *);
 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 *);
@@ -234,6 +269,7 @@ int closeDirectory(Directory *);
 DirectoryEntry *readDirectory(Directory *);
 void freeDirectoryEntry(DirectoryEntry *);
 
+boolean directoryExists(char *);
 boolean fileExists(char *);
 boolean FileIsGraphic(char *);
 boolean FileIsSound(char *);
@@ -262,11 +298,10 @@ void NotifyUserAboutErrorFile();
 
 #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 */