author | unc0rr |
Sun, 09 Feb 2014 00:44:29 +0400 | |
changeset 10124 | aabd1b75d5a3 |
parent 10121 | 8b65699beb56 |
child 10127 | 7f29a65aa1e4 |
permissions | -rw-r--r-- |
10015 | 1 |
#ifndef _FPCRTL_MISC_H_ |
2 |
#define _FPCRTL_MISC_H_ |
|
3 |
||
4 |
#include "pas2c.h" |
|
5 |
#include <assert.h> |
|
6 |
#include <stdbool.h> |
|
7 |
||
8 |
#ifdef EMSCRIPTEN |
|
9 |
#include <GL/gl.h> |
|
10 |
#else |
|
11 |
#include <GL/glew.h> |
|
12 |
#endif |
|
13 |
||
14 |
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(__VA_ARGS__, 5,4,3,2,1) |
|
15 |
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,...) N |
|
16 |
||
17 |
#define macro_dispatcher(func, ...) macro_dispatcher_(func, VA_NUM_ARGS(__VA_ARGS__)) |
|
18 |
#define macro_dispatcher_(func, nargs) macro_dispatcher__(func, nargs) |
|
19 |
#define macro_dispatcher__(func, nargs) func ## nargs |
|
20 |
||
21 |
#define FPCRTL_DEBUG |
|
22 |
||
23 |
#define FIX_STRING(s) (s.str[s.len] = 0) |
|
24 |
||
25 |
//#define fpcrtl_check_string(s) do{ if(strlen((s).str) != (s).len){ \ |
|
26 |
// printf("String %s internal inconsistency error. Length should be %d but actually is %d.\n", (s).str, strlen((s).str), (s).len); \ |
|
27 |
// assert(0);\ |
|
28 |
// }}while(0) |
|
29 |
||
30 |
void fpcrtl_assert(int); |
|
31 |
void fpcrtl_print_trace (void); |
|
32 |
||
33 |
int fpcrtl_round(double number); |
|
34 |
void fpcrtl_printf(const char* format, ...); |
|
35 |
||
36 |
string255 fpcrtl_make_string(const char* s); |
|
37 |
||
38 |
string255 fpcrtl_strconcat(string255 str1, string255 str2); |
|
39 |
string255 fpcrtl_strappend(string255 s, char c); |
|
40 |
string255 fpcrtl_strprepend(char c, string255 s); |
|
41 |
string255 fpcrtl_chrconcat(char a, char b); |
|
42 |
||
10124
aabd1b75d5a3
Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents:
10121
diff
changeset
|
43 |
astring fpcrtl_strconcatA(astring str1, astring str2); |
aabd1b75d5a3
Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents:
10121
diff
changeset
|
44 |
|
10015 | 45 |
// return true if str1 == str2 |
46 |
bool fpcrtl_strcompare(string255 str1, string255 str2); |
|
47 |
bool fpcrtl_strcomparec(string255 a, char b); |
|
48 |
bool fpcrtl_strncompare(string255 a, string255 b); |
|
49 |
||
10121 | 50 |
char* fpcrtl__pchar(string255 s); |
10015 | 51 |
string255 fpcrtl_pchar2str(char *s); |
10121 | 52 |
astring fpcrtl_str2astr(string255 s); |
10124
aabd1b75d5a3
Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents:
10121
diff
changeset
|
53 |
string255 fpcrtl_astr2str(astring s); |
aabd1b75d5a3
Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents:
10121
diff
changeset
|
54 |
string255 fpcrtl_astr2str(astring a); |
10015 | 55 |
#define fpcrtl_TypeInfo sizeof // dummy |
56 |
||
57 |
#ifdef EMSCRIPTEN |
|
58 |
#define GLEW_OK 1 |
|
59 |
GLenum glewInit(); |
|
60 |
#endif |
|
61 |
||
62 |
#endif |