1 /***********************************************************
2 * Artsoft Retro-Game Library *
3 *----------------------------------------------------------*
4 * (c) 1994-2001 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
23 /* values for InitCounter() and Counter() */
24 #define INIT_COUNTER 0
25 #define READ_COUNTER 1
27 /* values for InitRND() */
28 #define NEW_RANDOMIZE -1
30 /* values for Error() */
32 #define ERR_WARN (1 << 0)
33 #define ERR_EXIT (1 << 1)
34 #define ERR_HELP (1 << 2)
35 #define ERR_SOUND_SERVER (1 << 3)
36 #define ERR_NETWORK_SERVER (1 << 4)
37 #define ERR_NETWORK_CLIENT (1 << 5)
38 #define ERR_FROM_SERVER (ERR_SOUND_SERVER | ERR_NETWORK_SERVER)
39 #define ERR_EXIT_HELP (ERR_EXIT | ERR_HELP)
40 #define ERR_EXIT_SOUND_SERVER (ERR_EXIT | ERR_SOUND_SERVER)
41 #define ERR_EXIT_NETWORK_SERVER (ERR_EXIT | ERR_NETWORK_SERVER)
42 #define ERR_EXIT_NETWORK_CLIENT (ERR_EXIT | ERR_NETWORK_CLIENT)
44 /* values for getFile...() and putFile...() */
45 #define BYTE_ORDER_BIG_ENDIAN 0
46 #define BYTE_ORDER_LITTLE_ENDIAN 1
48 /* values for createDirectory() */
49 #define PERMS_PRIVATE 0
50 #define PERMS_PUBLIC 1
52 /* values for general file handling stuff */
53 #define MAX_FILENAME_LEN 256
54 #define MAX_LINE_LEN 1000
56 void InitCounter(void);
57 unsigned long Counter(void);
58 void Delay(unsigned long);
59 boolean FrameReached(unsigned long *, unsigned long);
60 boolean DelayReached(unsigned long *, unsigned long);
61 void WaitUntilDelayReached(unsigned long *, unsigned long);
62 char *int2str(int, int);
63 unsigned int SimpleRND(unsigned int);
64 unsigned int RND(unsigned int);
65 unsigned int InitRND(long);
66 char *getLoginName(void);
67 char *getRealName(void);
68 char *getHomeDir(void);
69 char *getPath2(char *, char *);
70 char *getPath3(char *, char *, char*);
71 char *getStringCopy(char *);
72 char *getStringToLower(char *);
74 void GetOptions(char **);
76 void SetError(char *, ...);
78 void Error(int, char *, ...);
80 void *checked_malloc(unsigned long);
81 void *checked_calloc(unsigned long);
82 void *checked_realloc(void *, unsigned long);
83 inline void swap_numbers(int *, int *);
84 inline void swap_number_pairs(int *, int *, int *, int *);
86 short getFile16BitInteger(FILE *, int);
87 void putFile16BitInteger(FILE *, short, int);
88 int getFile32BitInteger(FILE *, int);
89 void putFile32BitInteger(FILE *, int, int);
90 boolean getFileChunk(FILE *, char *, int *, int);
91 void putFileChunk(FILE *, char *, int, int);
92 void ReadUnusedBytesFromFile(FILE *, unsigned long);
93 void WriteUnusedBytesToFile(FILE *, unsigned long);
95 char *getKeyNameFromKey(Key);
96 char *getX11KeyNameFromKey(Key);
97 Key getKeyFromKeyName(char *);
98 Key getKeyFromX11KeyName(char *);
99 char getCharFromKey(Key);
101 boolean FileIsGraphic(char *);
102 boolean FileIsSound(char *);
103 boolean FileIsMusic(char *);
105 #if !defined(PLATFORM_UNIX)
106 void initErrorFile();
107 FILE *openErrorFile();
108 void dumpErrorFile();
111 void debug_print_timestamp(int, char *);