README: explain further musl-specific tweaks
[rofl0r-df-libgraphics.git] / g_src / basics.h
blobaddd6cc2d2ea39af2af6a032b6e1d857291c2a0f
1 #ifndef BASICS_H
2 #define BASICS_H
4 #ifndef WIN32
5 #include <stdint.h>
6 #endif
7 #include <string>
8 using std::string;
10 #ifndef BITS
12 #define BITS
14 #define BIT1 1
15 #define BIT2 2
16 #define BIT3 4
17 #define BIT4 8
18 #define BIT5 16
19 #define BIT6 32
20 #define BIT7 64
21 #define BIT8 128
22 #define BIT9 256
23 #define BIT10 512
24 #define BIT11 1024
25 #define BIT12 2048
26 #define BIT13 4096
27 #define BIT14 8192
28 #define BIT15 16384
29 #define BIT16 32768
30 #define BIT17 65536UL
31 #define BIT18 131072UL
32 #define BIT19 262144UL
33 #define BIT20 524288UL
34 #define BIT21 1048576UL
35 #define BIT22 2097152UL
36 #define BIT23 4194304UL
37 #define BIT24 8388608UL
38 #define BIT25 16777216UL
39 #define BIT26 33554432UL
40 #define BIT27 67108864UL
41 #define BIT28 134217728UL
42 #define BIT29 268435456UL
43 #define BIT30 536870912UL
44 #define BIT31 1073741824UL
45 #define BIT32 2147483648UL
47 #endif
49 void gamelog_string(const string &str);
50 void errorlog_string(const string &str);
51 void errorlog_string(const char *ptr);
53 bool grab_token_string(string &dest,string &source,char compc=':');
54 bool grab_token_string(string &dest,string &source,int32_t &pos,char compc=':');
55 bool grab_token_string_pos(string &dest,string &source,int32_t pos,char compc=':');
56 void replace_token_string(string &token,string &str,int32_t pos,char compc,string &nw,char repc);
57 bool grab_token_list_as_string(string &dest,string &source,int32_t &pos,char compc=':');
58 bool grab_token_expression(string &dest,string &source,int32_t &pos,char compc=':');
59 char grab_variable_token(string &str,string &token,char sec_comp,int32_t &pos,int32_t i_pos);
61 int32_t convert_string_to_long(string &str);
62 uint32_t convert_string_to_ulong(string &str);
63 void add_long_to_string(int32_t n,string &str);
64 void convert_long_to_string(int32_t n,string &str);
65 void convert_ulong_to_string(uint32_t n,string &str);
67 void lower_case_string(string &str);
68 void upper_case_string(string &str);
69 void simplify_string(string &str);
70 void capitalize_string_words(string &str);
71 void capitalize_string_first_word(string &str);
72 void abbreviate_string(string &str,int32_t len);
74 void get_number(int32_t number,string &str);
75 void get_ordinal(int32_t number,string &str,bool shorten);
77 enum GameMode
79 GAMEMODE_DWARF,
80 GAMEMODE_ADVENTURE,
81 GAMEMODENUM,
82 GAMEMODE_NONE
85 enum GameType
87 GAMETYPE_DWARF_MAIN,
88 GAMETYPE_ADVENTURE_MAIN,
89 GAMETYPE_VIEW_LEGENDS,
90 GAMETYPE_DWARF_RECLAIM,
91 GAMETYPE_DWARF_ARENA,
92 GAMETYPE_ADVENTURE_ARENA,
93 GAMETYPENUM,
94 GAMETYPE_NONE
97 enum Song
99 SONG_TITLE,
100 SONG_GAME,
101 SONGNUM
105 enum justification : unsigned char {
106 justify_left, justify_center, justify_right,
107 justify_cont,
108 not_truetype
111 extern int charmap[256];
113 #endif