project_files/hwc/rtl/misc.h
changeset 10128 0f6878b5395a
parent 10127 7f29a65aa1e4
child 10129 cd2a64a1f4aa
equal deleted inserted replaced
10127:7f29a65aa1e4 10128:0f6878b5395a
    16 
    16 
    17 #define     macro_dispatcher(func, ...)             macro_dispatcher_(func, VA_NUM_ARGS(__VA_ARGS__))
    17 #define     macro_dispatcher(func, ...)             macro_dispatcher_(func, VA_NUM_ARGS(__VA_ARGS__))
    18 #define     macro_dispatcher_(func, nargs)          macro_dispatcher__(func, nargs)
    18 #define     macro_dispatcher_(func, nargs)          macro_dispatcher__(func, nargs)
    19 #define     macro_dispatcher__(func, nargs)         func ## nargs
    19 #define     macro_dispatcher__(func, nargs)         func ## nargs
    20 
    20 
    21 #define     FPCRTL_DEBUG
    21 //#define     FPCRTL_DEBUG
    22 
    22 
    23 #define     FIX_STRING(s)                           (s.str[s.len] = 0)
    23 #define     FIX_STRING(s)                           (s.str[s.len == 255 ? 254 : s.len] = 0)
    24 
       
    25 //#define fpcrtl_check_string(s)     do{ if(strlen((s).str) != (s).len){ \
    24 //#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); \
    25 //                                        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);\
    26 //                                        assert(0);\
    28 //                                    }}while(0)
    27 //                                    }}while(0)
    29 
    28 
    39 string255   fpcrtl_strappend(string255 s, char c);
    38 string255   fpcrtl_strappend(string255 s, char c);
    40 string255   fpcrtl_strprepend(char c, string255 s);
    39 string255   fpcrtl_strprepend(char c, string255 s);
    41 string255   fpcrtl_chrconcat(char a, char b);
    40 string255   fpcrtl_chrconcat(char a, char b);
    42 
    41 
    43 astring     fpcrtl_strconcatA(astring str1, astring str2);
    42 astring     fpcrtl_strconcatA(astring str1, astring str2);
       
    43 astring     fpcrtl_strappendA(astring s, char c);
    44 
    44 
    45 // return true if str1 == str2
    45 // return true if str1 == str2
    46 bool        fpcrtl_strcompare(string255 str1, string255 str2);
    46 bool        fpcrtl_strcompare(string255 str1, string255 str2);
    47 bool        fpcrtl_strcomparec(string255 a, char b);
    47 bool        fpcrtl_strcomparec(string255 a, char b);
    48 bool        fpcrtl_strncompare(string255 a, string255 b);
    48 bool        fpcrtl_strncompare(string255 a, string255 b);
    49 bool        fpcrtl_strncompareA(astring a, astring b);
    49 bool        fpcrtl_strncompareA(astring a, astring b);
    50 
    50 
    51 char*       fpcrtl__pchar(string255 s);
    51 #define     fpcrtl__pchar(s)                    fpcrtl__pchar__vars(&(s))
    52 string255   fpcrtl_pchar2str(char *s);
    52 #define     fpcrtl__pcharA(s)                   fpcrtl__pcharA__vars(&(s))
    53 astring     fpcrtl_pchar2astr(char *s);
    53 char*       fpcrtl__pchar__vars(string255 * s);
       
    54 string255   fpcrtl_pchar2str(const char *s);
       
    55 astring     fpcrtl_pchar2astr(const char *s);
    54 astring     fpcrtl_str2astr(string255 s);
    56 astring     fpcrtl_str2astr(string255 s);
    55 string255   fpcrtl_astr2str(astring s);
    57 string255   fpcrtl_astr2str(astring s);
    56 #define     fpcrtl_TypeInfo                         sizeof // dummy
    58 #define     fpcrtl_TypeInfo                         sizeof // dummy
    57 
    59 
    58 #ifdef EMSCRIPTEN
    60 #ifdef EMSCRIPTEN