improved handling of failed tape uploads to score server
[rocksndiamonds.git] / src / libgame / misc.h
index 2fb49475e4465fddd75d73c7c43a94876e2814f6..27ae0f3df394bdacd632f9195c430295f7b4545d 100644 (file)
 #define GetEngineRandom(max)           get_random_number(RANDOM_ENGINE, max)
 #define GetSimpleRandom(max)           get_random_number(RANDOM_SIMPLE, max)
 
-// values for Error()
-#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)
-
 // values for getFile...() and putFile...()
 #define BYTE_ORDER_BIG_ENDIAN          0
 #define BYTE_ORDER_LITTLE_ENDIAN       1
@@ -123,9 +106,11 @@ void PrintNoLog(char *, ...);
 void PrintLine(char *, int);
 void PrintLineWithPrefix(char *, char *, int);
 
+void DebugContinued(char *, char *, ...);
 void Debug(char *, char *, ...);
 void Info(char *, ...);
 void Warn(char *, ...);
+void Error(char *, ...);
 void Fail(char *, ...);
 void FailWithHelp(char *, ...);
 
@@ -135,6 +120,8 @@ int log_2(unsigned int);
 
 boolean getTokenValueFromString(char *, char **, char **);
 
+char *getUUID(void);
+
 void InitCounter(void);
 unsigned int Counter(void);
 void Delay(unsigned int);
@@ -150,8 +137,19 @@ void SkipUntilDelayReached(unsigned int *, unsigned int, int *, int);
 unsigned int init_random_number(int, int);
 unsigned int get_random_number(int, int);
 
+#if defined(PLATFORM_UNIX)
+char *getUnixLoginName(void);
+char *getUnixRealName(void);
+char *getUnixHomeDir(void);
+#endif
+
 char *getLoginName(void);
 char *getRealName(void);
+char *getFixedUserName(char *);
+char *getDefaultUserName(int);
+
+char *getTimestampFromEpoch(time_t);
+char *getCurrentTimestamp(void);
 
 time_t getFileTimestampEpochSeconds(char *);
 
@@ -175,6 +173,8 @@ char *getStringToLower(const char *);
 void setString(char **, char *);
 boolean strEqual(char *, char *);
 boolean strEqualN(char *, char *, int);
+boolean strEqualCase(char *, char *);
+boolean strEqualCaseN(char *, char *, int);
 boolean strPrefix(char *, char *);
 boolean strSuffix(char *, char *);
 boolean strPrefixLower(char *, char *);
@@ -184,10 +184,6 @@ void GetOptions(int, char **,
                void (*print_usage_function)(void),
                void (*print_version_function)(void));
 
-void SetError(char *, ...);
-char *GetError(void);
-void Error(int, char *, ...);
-
 void *checked_malloc(unsigned int);
 void *checked_calloc(unsigned int);
 void *checked_realloc(void *, unsigned int);
@@ -231,6 +227,10 @@ void WriteUnusedBytesToFile(FILE *, unsigned int);
 #define putFileChunkBE(f,s,x) putFileChunk(f,s,x,BYTE_ORDER_BIG_ENDIAN)
 #define putFileChunkLE(f,s,x) putFileChunk(f,s,x,BYTE_ORDER_LITTLE_ENDIAN)
 
+char *getUTF8FromLatin1(char *);
+char *getLatin1FromUTF8(char *);
+char *getEscapedJSON(char *);
+
 char *getKeyNameFromKey(Key);
 char *getX11KeyNameFromKey(Key);
 Key getKeyFromKeyName(char *);
@@ -258,6 +258,7 @@ int seekFile(File *, long, int);
 int getByteFromFile(File *);
 char *getStringFromFile(File *, char *, int);
 int copyFile(char *, char *);
+boolean touchFile(char *);
 
 Directory *openDirectory(char *);
 int closeDirectory(Directory *);