compiler

Compiler for the Compilers classes.
Log | Files | Refs

string.h (444B)


      1 #ifndef COMPILER_STRING_H_
      2 #define COMPILER_STRING_H_
      3 
      4 typedef struct {
      5     const char*   ptr;
      6     unsigned long size;
      7 } String;
      8 
      9 #define FROM_STR(str) ((String) {.ptr = str, .size = strlen(str)})
     10 #define STR(str)      ((String) {.ptr = str, .size = sizeof(str) - 1})
     11 
     12 bool StringEq(const String a, const String b);
     13 bool StringEqCstr(const String a, const char* cstr);
     14 int  String2Long(const String a, long* ret);
     15 
     16 #endif // COMPILER_STRING_H_