sheepy

build system (sheepy) and package manager (spm) for C
git clone https://spartatek.se/git/sheepy.git
Log | Files | Refs | README | LICENSE

aux-string.i (3069B)


      1 /* -*- C++ -*- vim:set syntax=cpp: 
      2  * (C) Frank-Rene Schaefer    
      3  * ABSOLUTELY NO WARRANTY                    */
      4 #ifndef __QUEX_INCLUDE_GUARD__AUX_STRING_I
      5 #define __QUEX_INCLUDE_GUARD__AUX_STRING_I
      6 
      7 #include "definitions"
      8 
      9 #ifndef  QUEX_CHARACTER_CONVERTER_DECLARED
     10 #    error "A character converter must have been included before this file." 
     11 /*   This file is unable to include the character converters since they 
     12  *   may change or may even be autogenerated. So, wheresover this fils is 
     13  *   included, a converter file must have been included before.                
     14  *   
     15  *   Consider files in "code_base/converter_helper/"                         */
     16 #endif
     17 
     18 QUEX_NAMESPACE_MAIN_OPEN
     19 
     20 QUEX_INLINE size_t 
     21 QUEX_NAME(strlen)(const QUEX_TYPE_LEXATOM* Str)
     22 {
     23     const QUEX_TYPE_LEXATOM* iterator = Str;
     24     while( *iterator != 0 ) ++iterator; 
     25     return (size_t)(iterator - Str);
     26 }
     27 
     28 QUEX_INLINE size_t 
     29 QUEX_NAME(strcmp)(const QUEX_TYPE_LEXATOM* it0, 
     30                   const QUEX_TYPE_LEXATOM* it1)
     31 {
     32     for(; *it0 == *it1; ++it0, ++it1) {
     33         /* Both letters are the same and == 0?
     34          * => both reach terminall zero without being different. */
     35         if( *it0 == 0 ) return 0;
     36     }
     37     return (size_t)(*it0) - (size_t)(*it1);
     38 }
     39 
     40 QUEX_INLINE void
     41 QUEX_NAME(to_utf8)(const QUEX_TYPE_LEXATOM** source_p, const QUEX_TYPE_LEXATOM* SourceEnd,
     42                    uint8_t**                   drain_p,  const uint8_t*             DrainEnd)
     43 {
     44     QUEX_CONVERTER_STRING(QUEX_SETTING_CHARACTER_CODEC,utf8)(
     45                           source_p, SourceEnd, drain_p, DrainEnd);
     46 }
     47 
     48 QUEX_INLINE void
     49 QUEX_NAME(to_utf16)(const QUEX_TYPE_LEXATOM** source_p, const QUEX_TYPE_LEXATOM* SourceEnd,
     50                     uint16_t**                  drain_p,  const uint16_t*            DrainEnd)
     51 {
     52     QUEX_CONVERTER_STRING(QUEX_SETTING_CHARACTER_CODEC,utf16)(
     53                           source_p, SourceEnd, drain_p, DrainEnd);
     54 }
     55 
     56 QUEX_INLINE void
     57 QUEX_NAME(to_utf32)(const QUEX_TYPE_LEXATOM** source_p, const QUEX_TYPE_LEXATOM* SourceEnd,
     58                     uint32_t**                  drain_p,  const uint32_t*            DrainEnd)
     59 {
     60     QUEX_CONVERTER_STRING(QUEX_SETTING_CHARACTER_CODEC,utf32)(
     61                           source_p, SourceEnd, drain_p, DrainEnd);
     62 }
     63 
     64 QUEX_INLINE void
     65 QUEX_NAME(to_char)(const QUEX_TYPE_LEXATOM** source_p, const QUEX_TYPE_LEXATOM* SourceEnd,
     66                    char**                      drain_p,  const char*                DrainEnd)
     67 {
     68     QUEX_CONVERTER_STRING(QUEX_SETTING_CHARACTER_CODEC,char)(
     69                           source_p, SourceEnd, drain_p, DrainEnd);
     70 }
     71 
     72 #if ! defined(__QUEX_OPTION_WCHAR_T_DISABLED)
     73 QUEX_INLINE void
     74 QUEX_NAME(to_wchar)(const QUEX_TYPE_LEXATOM** source_p, const QUEX_TYPE_LEXATOM* SourceEnd,
     75                     wchar_t**                   drain_p,  const wchar_t*             DrainEnd)
     76 {
     77     QUEX_CONVERTER_STRING(QUEX_SETTING_CHARACTER_CODEC,wchar)(
     78                           source_p, SourceEnd, drain_p, DrainEnd);
     79 }
     80 #endif
     81 
     82 QUEX_NAMESPACE_MAIN_CLOSE
     83 
     84 #endif /* __QUEX_INCLUDE_GUARD__AUX_STRING_I */