Unnamed Fossil Project

Check-in [3497207bc2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:updated
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3497207bc26c3cb64571209acf074787627ed743
User & Date: alexey@sudachen.name 2011-10-17 15:03:31
Context
2011-11-07
00:37
removed 'extra' directory check-in: 91394f2a1f user: alexey@sudachen.name tags: trunk
2011-10-17
15:03
updated check-in: 3497207bc2 user: alexey@sudachen.name tags: trunk
2011-10-06
08:01
updated check-in: d61fab19de user: alexey@sudachen.name tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cipher.hc.

31
32
33
34
35
36
37


38
39
40
41
42
43
44
..
65
66
67
68
69
70
71
72
73
74
75












































76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117






118
119
120
121
122
123
124
125
126
127

















128
129
130
131
132










133


134


























































































135
136
137
138
139
140
141
142
143
144


145
146

147
148

149
150
151
152
153
154
155
156
157
158

159
160
161
162
163
164
#define C_once_1F19AF84_9BBE_46CC_87A4_8252243D7219

#ifdef _LIBYOYO
#define _YOYO_CIPHER_BUILTIN
#endif

#include "yoyo.hc"



#ifdef _YOYO_CIPHER_BUILTIN
# define _YOYO_CIPHER_BUILTIN_CODE(Code) Code
# define _YOYO_CIPHER_EXTERN 
#else
# define _YOYO_CIPHER_BUILTIN_CODE(Code)
# define _YOYO_CIPHER_EXTERN extern 
................................................................................
  { ((void(*)(void*,void*))Yo_Find_Method_Of(cipher,Oj_Decrypt16_OjMID,YO_RAISE_ERROR))
        (cipher,block16); });

void _Oj_Check_Buffer_Size_N_Alignment_8(int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    if ( S_len < 8 ) 
      Yo_Raise(YOYO_ERROR_NO_ENOUGH,"data buffer to small",__Yo_FILE__,__LINE__);
    
    if ( S_len % 8 )
      Yo_Raise(YOYO_ERROR_UNALIGNED,"data buffer should be aligned to 8 bytes",__Yo_FILE__,__LINE__);












































  }
#endif
  ;

void Oj_Encrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    void (*encrypt8)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,YO_RAISE_ERROR);
    
    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    
    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;
        encrypt8(cipher,p);
      }
  }
#endif
  ;

void Oj_Encrypt_CBC(void *cipher, void *S, int S_len, void *old8_)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j;
    byte_t *old8 = old8_;
    void (*encrypt8)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,YO_RAISE_ERROR);
    
    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    
    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;
        if ( old8 )
          for ( j = 0; j < 8; ++j )
            p[j] ^= old8[j];
        encrypt8(cipher,p);
        old8 = p;
      }
      
    if ( old8_ )
      memcpy(old8_,old8,8);






  }
#endif
  ;

void Oj_Decrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    void (*decrypt8)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,YO_RAISE_ERROR);
    

















    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);

    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;










        decrypt8(cipher,p);


      }


























































































  }
#endif
  ;

void Oj_Decrypt_CBC(void *cipher, void *S, int S_len, void *old8)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j;
    void (*decrypt8)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,YO_RAISE_ERROR);



    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    

    if ( !old8 ) old8 = alloca(8);


    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t bf[8];
        byte_t *p = (byte_t*)S+i*8;
        memcpy(bf,p,8);
        decrypt8(cipher,p);
        for ( j = 0; j < 8; ++j )
          p[j] ^= ((byte_t*)old8)[j];
        memcpy(old8,bf,8);
      }

  }
#endif
  ;

#endif /* C_once_1F19AF84_9BBE_46CC_87A4_8252243D7219 */








>
>







 







|


|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
>
>
>
>
>
>








|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|



>
>
>
>
>
>
>
>
>
>
|
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




|


<
|
<
>
>
|
<
>
|
<
>
|
<
<
<
<
<
<
<
<
<
>






31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131























132








133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

282

283
284
285

286
287

288
289









290
291
292
293
294
295
296
#define C_once_1F19AF84_9BBE_46CC_87A4_8252243D7219

#ifdef _LIBYOYO
#define _YOYO_CIPHER_BUILTIN
#endif

#include "yoyo.hc"
#include "md5.hc"
#include "sha2.hc"

#ifdef _YOYO_CIPHER_BUILTIN
# define _YOYO_CIPHER_BUILTIN_CODE(Code) Code
# define _YOYO_CIPHER_EXTERN 
#else
# define _YOYO_CIPHER_BUILTIN_CODE(Code)
# define _YOYO_CIPHER_EXTERN extern 
................................................................................
  { ((void(*)(void*,void*))Yo_Find_Method_Of(cipher,Oj_Decrypt16_OjMID,YO_RAISE_ERROR))
        (cipher,block16); });

void _Oj_Check_Buffer_Size_N_Alignment_8(int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    if ( S_len < 8 ) 
      __Raise(YOYO_ERROR_NO_ENOUGH,__yoTa("data buffer to small",0));
    
    if ( S_len % 8 )
      __Raise(YOYO_ERROR_UNALIGNED,__yoTa("size of data buffer should be aligned to 8 bytes",0));
  }
#endif
  ;

void _Oj_Check_Buffer_Size_N_Alignment_16(int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    if ( S_len < 16 ) 
      __Raise(YOYO_ERROR_NO_ENOUGH,__yoTa("data buffer to small",0));
    
    if ( S_len % 16 )
      __Raise(YOYO_ERROR_UNALIGNED,__yoTa("size of data buffer should be aligned to 16 bytes",0));
  }
#endif
  ;

void _Oj_Encrypt_Decrypt_ECB_8(void *cipher, void (*f8)(void*,void*), void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    
    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    
    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;
        f8(cipher,p);
      }
  }
#endif
  ;

void _Oj_Encrypt_Decrypt_ECB_16(void *cipher, void (*f16)(void*,void*), void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    
    _Oj_Check_Buffer_Size_N_Alignment_16(S_len);
    
    for ( i = 0; i < S_len/16; ++i )
      {
        byte_t *p = (byte_t*)S+i*16;
        f16(cipher,p);
      }
  }
#endif
  ;

void Oj_Encrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    























    if ( f )








      _Oj_Encrypt_Decrypt_ECB_8(cipher,f,S,S_len);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) )
      _Oj_Encrypt_Decrypt_ECB_16(cipher,f,S,S_len);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
  }
#endif
  ;

void Oj_Decrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,0);
    
    if ( f )
      _Oj_Encrypt_Decrypt_ECB_8(cipher,f,S,S_len);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,0)) )
      _Oj_Encrypt_Decrypt_ECB_16(cipher,f,S,S_len);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Decrypt8_OjMID or Oj_Decrypt16_OjMID mothod",0));
  }
#endif
  ;

quad_t _Oj_Encrypt_Decrypt_XEX_8(void *cipher, void (*f8)(void*,void*), void (*xex)(void*,void*), void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j, n = xex?8:16;
    byte_t q16[16] = {0};
    
    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    
    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;
        ++st;
        Quad_To_Eight(st,q16);
        
        if ( xex )
          xex(cipher,q16);
        else
          Md5_Digest(q16,8,q16);
        
        for ( j = 0; j < n; ++j )
          p[j%8] ^= q16[j];
        f8(cipher,p);
        for ( j = 0; j < n; ++j )
          p[j%8] ^= q16[j];
      }
    
    return st;
  }
#endif
  ;

quad_t _Oj_Encrypt_Decrypt_XEX_16(void *cipher, void (*f16)(void*,void*), void (*xex)(void*,void*), void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j, n = xex?16:32;
    byte_t q32[32] = {0};
    
    _Oj_Check_Buffer_Size_N_Alignment_16(S_len);
    
    for ( i = 0; i < S_len/16; ++i )
      {
        byte_t *p = (byte_t*)S+i*16;
        ++st;
        Quad_To_Eight(st,q32);
        ++st;
        Quad_To_Eight(st,q32+8);
        
        if ( xex )
          xex(cipher,q32);
        else
          Sha2_Digest(q32,16,q32);
          
        for ( j = 0; j < n; ++j )
          p[j%16] ^= q32[j];
        f16(cipher,p);
        for ( j = 0; j < n; ++j )
          p[j%16] ^= q32[j];
      }
    
    return st;
  }
#endif
  ;

quad_t Oj_Encrypt_XEX(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    if ( encrypt ) 
      return _Oj_Encrypt_Decrypt_XEX_8(cipher,encrypt,encrypt,S,S_len,st);
    else if ( 0 != (encrypt = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) ) 
      return _Oj_Encrypt_Decrypt_XEX_16(cipher,encrypt,encrypt,S,S_len,st);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Decrypt_XEX(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    void (*decrypt)(void*,void*);
    if ( encrypt )
      {
        decrypt = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,YO_RAISE_ERROR);
        return _Oj_Encrypt_Decrypt_XEX_8(cipher,decrypt,encrypt,S,S_len,st);
      }
    else if ( 0 != (encrypt = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) )
      {
        decrypt = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,YO_RAISE_ERROR);
        return _Oj_Encrypt_Decrypt_XEX_16(cipher,decrypt,encrypt,S,S_len,st);
      }
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Encrypt_XEX_MDSH(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    if ( f ) 
      return _Oj_Encrypt_Decrypt_XEX_8(cipher,f,0,S,S_len,st);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) ) 
      return _Oj_Encrypt_Decrypt_XEX_16(cipher,f,0,S,S_len,st);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Decrypt_XEX_MDSH(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {

    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,0);

    if ( f ) 
      return _Oj_Encrypt_Decrypt_XEX_8(cipher,f,0,S,S_len,st);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,0)) ) 

      return _Oj_Encrypt_Decrypt_XEX_16(cipher,f,0,S,S_len,st);
    else

      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Decrypt8_OjMID or Oj_Decrypt16_OjMID mothod",0));









    return 0;
  }
#endif
  ;

#endif /* C_once_1F19AF84_9BBE_46CC_87A4_8252243D7219 */

Changes to datetime.hc.

34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50

51
52


53
54
55
56
57







58
59
60
61
62
63
64
65
66
67
68
69
70
71


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99


100
101
102

103
104






























105
106
107
108
109
110
111
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#define _YOYO_DATETIME_BUILTIN
#endif

#include "yoyo.hc"

typedef quad_t datetime_t;

uint_t Get_Mclocks()
#ifdef _YOYO_DATETIME_BUILTIN
  {

    double c = clock();
    return (uint_t)((c/CLOCKS_PER_SEC)*1000);
  }
#endif
  ;

uint_t Get_Curr_Date()

#ifdef _YOYO_DATETIME_BUILTIN
  {


    time_t t;
    struct tm *tm;
    time(&t);
    tm = gmtime(&t);
    return (((uint_t)tm->tm_year+1900)<<16)|((uint_t)(tm->tm_mon+1)<<8)|tm->tm_mday;







  }
#endif
  ;

uint_t Get_Curr_Time()
#ifdef _YOYO_DATETIME_BUILTIN
  {
    uint_t msec;
    time_t t;
    struct tm *tm;
    time(&t);
    msec = Get_Mclocks();
    tm = gmtime(&t);
    return ((uint_t)tm->tm_hour<<24)|((uint_t)tm->tm_min<<16)|((uint_t)tm->tm_sec<<8)|((msec/10)%100);


  }
#endif
  ;

double Get_Sclocks()
#ifdef _YOYO_DATETIME_BUILTIN
  {
    double c = clock();
    return c/CLOCKS_PER_SEC;
  }
#endif
  ;

quad_t Get_Gmtime_Datetime(time_t t)
#ifdef _YOYO_DATETIME_BUILTIN
  {
    uint_t msec,dt,mt;
    struct tm *tm;
    tm = gmtime(&t);
    msec = Get_Mclocks();
    dt = (((uint_t)tm->tm_year+1900)<<16)|(((uint_t)tm->tm_mon+1)<<8)|tm->tm_mday;
    mt = ((uint_t)tm->tm_hour<<24)|(uint_t)(tm->tm_min<<16)|((uint_t)tm->tm_sec<<8)|((msec/10)%100);
    return ((quad_t)dt << 32)|(quad_t)mt;
  }
#endif
  ;

quad_t Get_Curr_Datetime()


#ifdef _YOYO_DATETIME_BUILTIN
  {
    time_t t;

    time(&t);
    return Get_Gmtime_Datetime(t);






























  }
#endif
  ;

#define Dt_Hour(Dt) ((int)((Dt)>>24)&0x0ff)
#define Dt_Min(Dt)  ((int)((Dt)>>16)&0x0ff)
#define Dt_Sec(Dt)  ((int)((Dt)>> 8)&0x0ff)
................................................................................
  {
    uint_t dt = ((year%0x0ffff)<<16)|((month%13)<<8)|(day%32);
    uint_t mt = ((hour%24)<<24)|((minute%60)<<16)|((segundo%60)<<8);
    return ((quad_t)dt << 32)|(quad_t)mt;
  }
#endif
  ;
  
time_t Get_Posix_Datetime(quad_t dtime)
#ifdef _YOYO_DATETIME_BUILTIN
  {
    struct tm tm;
    memset(&tm,0,sizeof(tm));
    tm.tm_year = Dt_Year(dtime)-1900;
    tm.tm_mon  = Dt_Mon(dtime)-1;
    tm.tm_mday = Dt_Mday(dtime);
................................................................................
    tm.tm_hour = Dt_Hour(dtime);
    tm.tm_min  = Dt_Min(dtime);
    return mktime(&tm);
  }
#endif
  ;

#define Get_System_Millis() (Get_System_Useconds()/1000)
quad_t Get_System_Useconds()
#ifdef _YOYO_DATETIME_BUILTIN
  {
  #ifdef __windoze
    SYSTEMTIME systime = {0};
    FILETIME   ftime;
    quad_t Q;
    GetSystemTime(&systime);
    SystemTimeToFileTime(&systime,&ftime);
    Q = ((quad_t)ftime.dwHighDateTime << 32) + (quad_t)ftime.dwLowDateTime;
    return Q/10;
  #else
    struct timeval tv = {0};
    gettimeofday(&tv,0);
    return  ( (quad_t)tv.tv_sec * 1000*1000 + (quad_t)tv.tv_usec );
  #endif
  }
#endif
  ;
  
#ifdef __windoze
  void Timet_To_Filetime(time_t t, FILETIME *pft)
# ifdef _YOYO_DATETIME_BUILTIN
    {
      quad_t ll = (quad_t)t * 10000000 + 116444736000000000LL;
      pft->dwLowDateTime = (DWORD)ll;
      pft->dwHighDateTime = (DWORD)(ll >> 32);







|
|
<
>
|
|
|
|
<
<
<
>


>
>
|
|
|
|
|
>
>
>
>
>
>
>



|
|


<
<
<
<
<
<
<
>
>













|


<
<
<
<
|
|





<
>
>


<
>
|
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







34
35
36
37
38
39
40
41
42

43
44
45
46
47



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89




90
91
92
93
94
95
96

97
98
99
100

101
102

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
...
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
163
164
165
166
167
168
169





















170
171
172
173
174
175
176
#define _YOYO_DATETIME_BUILTIN
#endif

#include "yoyo.hc"

typedef quad_t datetime_t;

#define Get_Curr_Datetime()    Current_Gmt_Datetime()
#define Get_Posix_Datetime(Dt) Timet_Of_Datetime(Dt)

#define Get_Gmtime_Datetime(T) Gmtime_Datetime(T)
#define Get_System_Useconds()  System_Useconds()
#define Get_System_Millis()    (Get_System_Useconds()/1000)

#define System_Millis() (System_Useconds()/1000)



quad_t System_Useconds()
#ifdef _YOYO_DATETIME_BUILTIN
  {
  #ifdef __windoze
    SYSTEMTIME systime = {0};
    FILETIME   ftime;
    quad_t Q;
    GetSystemTime(&systime);
    SystemTimeToFileTime(&systime,&ftime);
    Q = ((quad_t)ftime.dwHighDateTime << 32) + (quad_t)ftime.dwLowDateTime;
    Q -= 116444736000000000LL; /* posix epoche */
    return Q/10;
  #else
    struct timeval tv = {0};
    gettimeofday(&tv,0);
    return  ( (quad_t)tv.tv_sec * 1000*1000 + (quad_t)tv.tv_usec );
  #endif
  }
#endif
  ;
  
uint_t Get_Mclocks()
#ifdef _YOYO_DATETIME_BUILTIN
  {







    double c = clock();
    return (uint_t)((c/CLOCKS_PER_SEC)*1000);
  }
#endif
  ;

double Get_Sclocks()
#ifdef _YOYO_DATETIME_BUILTIN
  {
    double c = clock();
    return c/CLOCKS_PER_SEC;
  }
#endif
  ;

quad_t Tm_To_Datetime(struct tm *tm,int msec)
#ifdef _YOYO_DATETIME_BUILTIN
  {




    uint_t dt = (((uint_t)tm->tm_year+1900)<<16)|(((uint_t)tm->tm_mon+1)<<8)|tm->tm_mday;
    uint_t mt = ((uint_t)tm->tm_hour<<24)|(uint_t)(tm->tm_min<<16)|((uint_t)tm->tm_sec<<8)|((msec/10)%100);
    return ((quad_t)dt << 32)|(quad_t)mt;
  }
#endif
  ;


#define Gmtime_Datetime(T) _Gmtime_Datetime(T,0)
quad_t _Gmtime_Datetime(time_t t, int ms)
#ifdef _YOYO_DATETIME_BUILTIN
  {

    struct tm *tm;
    tm = gmtime(&t);

    return Tm_To_Datetime(tm,ms);
  }
#endif
  ;

#define Local_Datetime(T) _Local_Datetime(T,0)
quad_t _Local_Datetime(time_t t, int ms)
#ifdef _YOYO_DATETIME_BUILTIN
  {
    struct tm *tm;
    tm = localtime(&t);
    return Tm_To_Datetime(tm,ms);
  }
#endif
  ;

quad_t Current_Gmt_Datetime()
#ifdef _YOYO_DATETIME_BUILTIN
  {
    quad_t usec = Get_System_Useconds();
    return _Gmtime_Datetime((time_t)(usec/1000000),(int)((usec/1000)%1000));
  }
#endif
  ;

quad_t Current_Local_Datetime()
#ifdef _YOYO_DATETIME_BUILTIN
  {
    quad_t usec = Get_System_Useconds();
    return _Local_Datetime((time_t)(usec/1000000),(int)((usec/1000)%1000));
  }
#endif
  ;

#define Dt_Hour(Dt) ((int)((Dt)>>24)&0x0ff)
#define Dt_Min(Dt)  ((int)((Dt)>>16)&0x0ff)
#define Dt_Sec(Dt)  ((int)((Dt)>> 8)&0x0ff)
................................................................................
  {
    uint_t dt = ((year%0x0ffff)<<16)|((month%13)<<8)|(day%32);
    uint_t mt = ((hour%24)<<24)|((minute%60)<<16)|((segundo%60)<<8);
    return ((quad_t)dt << 32)|(quad_t)mt;
  }
#endif
  ;

time_t Timet_Of_Datetime(quad_t dtime)
#ifdef _YOYO_DATETIME_BUILTIN
  {
    struct tm tm;
    memset(&tm,0,sizeof(tm));
    tm.tm_year = Dt_Year(dtime)-1900;
    tm.tm_mon  = Dt_Mon(dtime)-1;
    tm.tm_mday = Dt_Mday(dtime);
................................................................................
    tm.tm_hour = Dt_Hour(dtime);
    tm.tm_min  = Dt_Min(dtime);
    return mktime(&tm);
  }
#endif
  ;






















#ifdef __windoze
  void Timet_To_Filetime(time_t t, FILETIME *pft)
# ifdef _YOYO_DATETIME_BUILTIN
    {
      quad_t ll = (quad_t)t * 10000000 + 116444736000000000LL;
      pft->dwLowDateTime = (DWORD)ll;
      pft->dwHighDateTime = (DWORD)(ll >> 32);

Changes to defpars.hc.

113
114
115
116
117
118
119





















120
121
122
123
124
125
126
...
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
      }
    
    return out;
  }
#endif
  ;






















typedef struct
  {
    int type;
    union
      {
        YOYO_ARRAY  *arr;
        YOYO_BUFFER *dat;
................................................................................
            Def_Parse_Skip_Spaces(st);

            if ( *st->text == '(' )
              {
                char *dflt;
                ++st->text;
                Def_Parse_Skip_Spaces(st);
                dflt = Def_Parse_Get_Literal(st);
                Def_Parse_Skip_Spaces(st);
                if ( *st->text != ')' )
                  __Raise(YOYO_ERROR_ILLFORMED,__Format("expected ')' at line %d",st->lineno));
                ++st->text;
                Def_Parse_Skip_Spaces(st);

                nn = Xnode_Append(n,name);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
      }
    
    return out;
  }
#endif
  ;


char *Def_Parse_Get_Node_Literal(YOYO_DEFPARSE_STATE *st)
#ifdef _YOYO_DEFPARS_BUILTIN
  {
    if ( *st->text == '"' || *st->text == '\'' )
      return Def_Parse_Get_Literal(st);
    else
      {
        int capacity = 127;
        int len = 0;
        char *out = 0;
        char *q = st->text;
        while ( *st->text && *st->text != ')' )
          ++st->text;
        __Vector_Append(&out,&len,&capacity,q,st->text-q);
        return out;
      }
  }
#endif
  ;

typedef struct
  {
    int type;
    union
      {
        YOYO_ARRAY  *arr;
        YOYO_BUFFER *dat;
................................................................................
            Def_Parse_Skip_Spaces(st);

            if ( *st->text == '(' )
              {
                char *dflt;
                ++st->text;
                Def_Parse_Skip_Spaces(st);
                dflt = Def_Parse_Get_Node_Literal(st);
                Def_Parse_Skip_Spaces(st);
                if ( *st->text != ')' )
                  __Raise(YOYO_ERROR_ILLFORMED,__Format("expected ')' at line %d",st->lineno));
                ++st->text;
                Def_Parse_Skip_Spaces(st);

                nn = Xnode_Append(n,name);

Changes to file.hc.

50
51
52
53
54
55
56

























57
58
59
60
61
62
63
...
117
118
119
120
121
122
123



















124
125
126
127
128
129
130
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
398
399
400
401
402
403
404

















405
406
407
408
409
410
411
...
522
523
524
525
526
527
528

529
530
531
532
533
534
535
# define _YOYO_FILE_BUILTIN_CODE(Code) Code
# define _YOYO_FILE_EXTERN
#else
# define _YOYO_FILE_BUILTIN_CODE(Code)
# define _YOYO_FILE_EXTERN extern
#endif


























char *Path_Basename(char *path)
#ifdef _YOYO_FILE_BUILTIN
  {
    char *ret = path;
    if ( path )
      {
        char *p = strrchr(path,'/');
................................................................................
      #endif
      }
    return ptr;
  }
#endif
  ;




















char *Path_Unique_Name(char *dirname,char *pfx, char *sfx)
#ifdef _YOYO_FILE_BUILTIN
  {
  #ifdef __windoze
    char DELIMITER[] = "\\";
  #else
    char DELIMITER[] = "/";
................................................................................
      }
  #endif
    return Str_Copy(path,-1);
  }
#endif
  ;

void File_Check_Error(char *op, FILE *f, char *fname, int look_to_errno)
#ifdef _YOYO_FILE_BUILTIN
  {
    int err = 0;
    char *errS = 0;
    
    if ( look_to_errno )
      {
        if ( (err = errno) ) 
          errS = strerror(err);
      }
    else if ( f && !feof(f) && ( err = ferror(f) ) )
      {
        errS = strerror(err);
        clearerr(f);
      }
    
    if (err)
      Yo_Raise(YOYO_ERROR_IO,
        Yo_Format("%s failed on file '%s': %s",op,fname,errS),
        __FILE__,__LINE__);
  }
#endif
  ;

#define Raise_If_File_Error(Op,Fname) File_Check_Error(Op,0,Fname,1)

typedef struct _YOYO_FILE_STATS
  {
    time_t ctime;
    time_t mtime;
    quad_t length;
    
    struct {
................................................................................
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_directory;});
int File_Is_Writable(char *name)
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_writable;});
int File_Is_Readable(char *name)
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_readable;});
int File_Is_Executable(char *name)
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_executable;});


















void Create_Directory(char *name)
#ifdef _YOYO_FILE_BUILTIN
  {
    YOYO_FILE_STATS st;
    if ( !File_Get_Stats(name,&st,1)->f.is_directory )
      {
................................................................................
        if ( st.f.exists )
          {
            if ( st.f.is_directory && force )
              {
                YOYO_ARRAY *L = File_List_Directory(name,0);
                for ( i = 0; i < L->count; ++i )
                  File_Unlink(Path_Join(name,L->at[i]),force);

              }
            else
              err =
              #ifdef __windoze
                _wunlink(Str_Utf8_To_Unicode(name));
              #else
                unlink(name);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
286
287
288
289
290
291
292



























293
294
295
296
297
298
299
...
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
...
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# define _YOYO_FILE_BUILTIN_CODE(Code) Code
# define _YOYO_FILE_EXTERN
#else
# define _YOYO_FILE_BUILTIN_CODE(Code)
# define _YOYO_FILE_EXTERN extern
#endif

void File_Check_Error(char *op, FILE *f, char *fname, int look_to_errno)
#ifdef _YOYO_FILE_BUILTIN
  {
    int err = 0;
    char *errS = 0;
    
    if ( look_to_errno )
      {
        if ( (err = errno) ) 
          errS = strerror(err);
      }
    else if ( f && !feof(f) && ( err = ferror(f) ) )
      {
        errS = strerror(err);
        clearerr(f);
      }
    
    if (err)
      __Raise_Format(YOYO_ERROR_IO,("%s failed on file '%s': %s",op,fname,errS));
  }
#endif
  ;

#define Raise_If_File_Error(Op,Fname) File_Check_Error(Op,0,Fname,1)

char *Path_Basename(char *path)
#ifdef _YOYO_FILE_BUILTIN
  {
    char *ret = path;
    if ( path )
      {
        char *p = strrchr(path,'/');
................................................................................
      #endif
      }
    return ptr;
  }
#endif
  ;

void Change_Directory(char *dirname)
#ifdef _YOYO_FILE_BUILTIN
  {
    __Auto_Release
      {
        int err;
      #ifdef __windoze
        wchar_t *tmp = Str_Utf8_To_Unicode(dirname);
        err = _wchdir(tmp);
      #else
        err = chdir(dirname);
      #endif
        if ( err == - 1 )
          Raise_If_File_Error("chdir",dirname);
      }
  }
#endif
  ;
  
char *Path_Unique_Name(char *dirname,char *pfx, char *sfx)
#ifdef _YOYO_FILE_BUILTIN
  {
  #ifdef __windoze
    char DELIMITER[] = "\\";
  #else
    char DELIMITER[] = "/";
................................................................................
      }
  #endif
    return Str_Copy(path,-1);
  }
#endif
  ;




























typedef struct _YOYO_FILE_STATS
  {
    time_t ctime;
    time_t mtime;
    quad_t length;
    
    struct {
................................................................................
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_directory;});
int File_Is_Writable(char *name)
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_writable;});
int File_Is_Readable(char *name)
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_readable;});
int File_Is_Executable(char *name)
  _YOYO_FILE_BUILTIN_CODE({YOYO_FILE_STATS st={0}; return File_Get_Stats(name,&st,0)->f.is_executable;});

void Delete_Directory(char *name)
#ifdef _YOYO_FILE_BUILTIN
  {
    YOYO_FILE_STATS st;
    if ( File_Get_Stats(name,&st,1)->f.is_directory )
      {
      #ifdef __windoze
        if ( _wrmdir(Str_Utf8_To_Unicode(name)) < 0 )
      #else
        if ( rmdir(name) < 0 )
      #endif  
          File_Check_Error("rmdir",0,name,1);
      }
  }
#endif
  ;

void Create_Directory(char *name)
#ifdef _YOYO_FILE_BUILTIN
  {
    YOYO_FILE_STATS st;
    if ( !File_Get_Stats(name,&st,1)->f.is_directory )
      {
................................................................................
        if ( st.f.exists )
          {
            if ( st.f.is_directory && force )
              {
                YOYO_ARRAY *L = File_List_Directory(name,0);
                for ( i = 0; i < L->count; ++i )
                  File_Unlink(Path_Join(name,L->at[i]),force);
                Delete_Directory(name);
              }
            else
              err =
              #ifdef __windoze
                _wunlink(Str_Utf8_To_Unicode(name));
              #else
                unlink(name);

Changes to prog.hc.

247
248
249
250
251
252
253




























































































254
255
256
257
258
259
260
        if ( flags & PROG_EXIT_ON_ERROR )
          Error_Print_N_Exit(Yo__basename(argv[0]),-1);
      }
    return rt;
  }
#endif
  ;





























































































int Prog_Arguments_Count()
#ifdef _YOYO_PROG_BUILTIN
  {
    return Array_Count(Prog_Data_Args);
  }
#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
        if ( flags & PROG_EXIT_ON_ERROR )
          Error_Print_N_Exit(Yo__basename(argv[0]),-1);
      }
    return rt;
  }
#endif
  ;

YOYO_ARRAY *Prog_Argc_Argv(char *input)
#ifdef _YOYO_PROG_BUILTIN
  {
    YOYO_ARRAY *argv = Array_Pchars();
    
    __Auto_Release
      {
        int   argc;
        char *arg;
        char *copybuf;
        int   dquote = 0;
        int   lquote = 0;
    
        if ( input )
          {
            copybuf = __Malloc(strlen(input) + 1);
            for ( ; *input ; )
              {
                while ( ' ' == *input || '\t' == *input ) ++input;
            
                arg = copybuf;
                while ( *input )
                  {
                    if ( (*input == ' ' || *input == '\t' ) && !dquote && !lquote )
                      break;
                    else
                      {
                        if (0) ;
                        else if (dquote)
                          {
                            if (*input == '"') 
                              {
                                if ( input[1] == '"' )
                                  *arg++ = *input++;
                                dquote = 0;
                              }
                            else *arg++ = *input;
                          }
                        else if (lquote)
                          {
                            if (*input == '>') lquote = 0;
                            *arg++ = *input;
                          }
                        else // !dquote && !lquote
                          {
                            if (0) ;
                            else if (*input == '"') dquote = 1;
                            else 
                              {
                                if (*input == '<') lquote = 1;
                                *arg++ = *input;
                              }
                          }
                        input++;
                      }
                  }
                *arg = 0;
            
                Array_Push(argv,Str_Copy_Npl(copybuf,-1));
            
                while ( *input && (' ' == *input || '\t' == *input) ) ++input;
              }
          }
      
        argc = argv->count;
        Array_Push(argv,0);
        argv->count = argc;
      }
      
    return argv;
  }
#endif
  ;
  
#ifdef __windoze
int Prog_Init_Windoze(char *patt, unsigned flags)
#ifdef _YOYO_PROG_BUILTIN
  {
    int rt;
    
    __Auto_Release
      {
        YOYO_ARRAY *argv = Prog_Argc_Argv(Str_Unicode_To_Utf8(GetCommandLineW()));
        rt = Prog_Init(argv->count,(char**)argv->at,patt,flags);
      }
      
    return rt;
  }
#endif
  ;
#endif

int Prog_Arguments_Count()
#ifdef _YOYO_PROG_BUILTIN
  {
    return Array_Count(Prog_Data_Args);
  }
#endif

Changes to string.hc.

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
...
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399

/* caseinsensitive strcmp, returns 0 if equal */
#define Str_Ansi_Equal_Nocase(Cs,Ct) (!strcmp_I(Cs,Ct))
int strcmp_I(char *cs, char *ct)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    do 
      {
        q = Toupper(*cs) - Toupper(*ct++);
      }
    while ( *cs++ && !q );
    return q;
  }
#endif
................................................................................
  ;

#define Str_Unicode_Compare_Nocase(Cs,Ct) wcscmp_I(Cs,Ct)
int wcscmp_I(wchar_t *cs, wchar_t *ct)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    do 
      {
        q = towupper(*cs) - towupper(*ct++);
      }
    while ( *cs++ && !q );
    return q;
  }
#endif
................................................................................
  ;

/* caseinsensitive strncmp, returns 0 if equal */
int strncmp_I(char *cs, char *ct, int l)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    if ( l ) do 
      {
        q = Toupper(*cs) - Toupper(*ct++);
      }
    while ( *cs++ && !q && --l );
    return q;
  }    
#endif
  ;

int wcsncmp_I(wchar_t *cs, wchar_t *ct, int l)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    if ( l ) do 
      {
        q = towupper(*cs) - towupper(*ct++);
      }
    while ( *cs++ && !q && --l );
    return q;
  }    
#endif
................................................................................
  ;

_YOYO_STRING_EXTERN byte_t Str_6bit_Decoding_Table[] /* 64 */ 
#ifdef _YOYO_STRING_BUILTIN
= {
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    0  ,1  ,2  ,3  ,4  ,5  ,6  ,7  ,8  ,9  ,255,255,255,255,255,255,
    63 ,36 ,37 ,38 ,39 ,40 ,41 ,42 ,43 ,44 ,45 ,46 ,47 ,48 ,49 ,50 ,
    51 ,52 ,53 ,54 ,55 ,56 ,57 ,58 ,59 ,60 ,61 ,255,255,255,255,62 ,
    255,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,
    25 ,26 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,







|







 







|







 







|













|







 







|

|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
...
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399

/* caseinsensitive strcmp, returns 0 if equal */
#define Str_Ansi_Equal_Nocase(Cs,Ct) (!strcmp_I(Cs,Ct))
int strcmp_I(char *cs, char *ct)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    if ( cs && ct ) do 
      {
        q = Toupper(*cs) - Toupper(*ct++);
      }
    while ( *cs++ && !q );
    return q;
  }
#endif
................................................................................
  ;

#define Str_Unicode_Compare_Nocase(Cs,Ct) wcscmp_I(Cs,Ct)
int wcscmp_I(wchar_t *cs, wchar_t *ct)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    if ( cs && ct ) do 
      {
        q = towupper(*cs) - towupper(*ct++);
      }
    while ( *cs++ && !q );
    return q;
  }
#endif
................................................................................
  ;

/* caseinsensitive strncmp, returns 0 if equal */
int strncmp_I(char *cs, char *ct, int l)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    if ( l && cs && ct ) do 
      {
        q = Toupper(*cs) - Toupper(*ct++);
      }
    while ( *cs++ && !q && --l );
    return q;
  }    
#endif
  ;

int wcsncmp_I(wchar_t *cs, wchar_t *ct, int l)
#ifdef _YOYO_STRING_BUILTIN
  {
    int q = 0;
    if ( l && cs && ct ) do 
      {
        q = towupper(*cs) - towupper(*ct++);
      }
    while ( *cs++ && !q && --l );
    return q;
  }    
#endif
................................................................................
  ;

_YOYO_STRING_EXTERN byte_t Str_6bit_Decoding_Table[] /* 64 */ 
#ifdef _YOYO_STRING_BUILTIN
= {
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,63, 255,255,
    0  ,1  ,2  ,3  ,4  ,5  ,6  ,7  ,8  ,9  ,255,255,255,255,255,255,
    255,36 ,37 ,38 ,39 ,40 ,41 ,42 ,43 ,44 ,45 ,46 ,47 ,48 ,49 ,50 ,
    51 ,52 ,53 ,54 ,55 ,56 ,57 ,58 ,59 ,60 ,61 ,255,255,255,255,62 ,
    255,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,
    25 ,26 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,

Changes to winlpc.hc.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    HANDLE handle;
    void  *tag;
    int    waitable;
  } YOYO_LPCPORT;

#define Lpc_Is_Connected(Port) ((Port)->handle != 0)
  
long Lpc_Create_Port(YOYO_LPCPORT *port, char *name, int waitable, int maxsize)
#ifdef _YOYO_WINLPC_BUILTIN
  {
    long ntst;
    OBJECT_ATTRIBUTES oa; 
    UNICODE_STRING us_name;
    wchar_t wname[256]; 
    
................................................................................
    Str_Utf8_To_Unicode_Convert(name,wname,256);
    RtlInitUnicodeString(&us_name, wname);
    InitializeObjectAttributes(&oa, &us_name, 0, 0, 0);
    
    port->waitable = waitable;
    
    if ( waitable )
      ntst = NtCreateWaitablePort(&port->handle, &oa, 100, maxsize, 0);
    else
      ntst = NtCreatePort(&port->handle, &oa, 100, maxsize, 0);

    return ntst;
  }
#endif
  ;

long Lpc_Connect_Port(







|







 







|

|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    HANDLE handle;
    void  *tag;
    int    waitable;
  } YOYO_LPCPORT;

#define Lpc_Is_Connected(Port) ((Port)->handle != 0)
  
long Lpc_Create_Port(YOYO_LPCPORT *port, char *name, int waitable)
#ifdef _YOYO_WINLPC_BUILTIN
  {
    long ntst;
    OBJECT_ATTRIBUTES oa; 
    UNICODE_STRING us_name;
    wchar_t wname[256]; 
    
................................................................................
    Str_Utf8_To_Unicode_Convert(name,wname,256);
    RtlInitUnicodeString(&us_name, wname);
    InitializeObjectAttributes(&oa, &us_name, 0, 0, 0);
    
    port->waitable = waitable;
    
    if ( waitable )
      ntst = NtCreateWaitablePort(&port->handle, &oa, WINLPC_MAX_DATA_LENGTH, WINLPC_MAX_DATA_LENGTH, 0);
    else
      ntst = NtCreatePort(&port->handle, &oa, WINLPC_MAX_DATA_LENGTH, WINLPC_MAX_DATA_LENGTH, 0);

    return ntst;
  }
#endif
  ;

long Lpc_Connect_Port(

Changes to xdata.hc.

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
      switch (val->opt&XVALUE_OPT_VALTYPE_MASK) 
        {
          case XVALUE_OPT_VALTYPE_INT:
            return val->dec;
          case XVALUE_OPT_VALTYPE_FLT:          
            return (long)val->flt;
          case XVALUE_OPT_VALTYPE_STR:
            return Str_To_Int(val->txt);
          case XVALUE_OPT_VALTYPE_LIT:
            return Str_To_Int((char*)&val->down);
          case XVALUE_OPT_VALTYPE_NONE:
            return 0;
          case XVALUE_OPT_VALTYPE_BOOL:
            return val->bval;
          default:
            __Raise(YOYO_ERROR_UNEXPECTED_VALUE,0);
        }
................................................................................
      switch (val->opt&XVALUE_OPT_VALTYPE_MASK) 
        {
          case XVALUE_OPT_VALTYPE_INT:
            return (double)val->dec;
          case XVALUE_OPT_VALTYPE_FLT:          
            return val->flt;
          case XVALUE_OPT_VALTYPE_STR:
            return Str_To_Flt(val->txt);
          case XVALUE_OPT_VALTYPE_LIT:
            return Str_To_Flt((char*)&val->down);
          case XVALUE_OPT_VALTYPE_NONE:
            return 0;
          default:
            __Raise(YOYO_ERROR_UNEXPECTED_VALUE,0);
        }
    return dfltval;
  }
................................................................................
          case XVALUE_OPT_VALTYPE_INT:
            return val->dec?1:0;
          case XVALUE_OPT_VALTYPE_BOOL:
            return val->bval;
          case XVALUE_OPT_VALTYPE_FLT:          
            return val->flt?1:0;
          case XVALUE_OPT_VALTYPE_STR:
            return Str_To_Bool(val->txt);
          case XVALUE_OPT_VALTYPE_LIT:
            return Str_To_Bool((char*)&val->down);
          case XVALUE_OPT_VALTYPE_NONE:
            return 0;
          default:
            __Raise(YOYO_ERROR_UNEXPECTED_VALUE,0);
        }
    return dfltval;
  }







|

|







 







|

|







 







|

|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
      switch (val->opt&XVALUE_OPT_VALTYPE_MASK) 
        {
          case XVALUE_OPT_VALTYPE_INT:
            return val->dec;
          case XVALUE_OPT_VALTYPE_FLT:          
            return (long)val->flt;
          case XVALUE_OPT_VALTYPE_STR:
            return Str_To_Int_Dflt(val->txt,dfltval);
          case XVALUE_OPT_VALTYPE_LIT:
            return Str_To_Int_Dflt((char*)&val->down,dfltval);
          case XVALUE_OPT_VALTYPE_NONE:
            return 0;
          case XVALUE_OPT_VALTYPE_BOOL:
            return val->bval;
          default:
            __Raise(YOYO_ERROR_UNEXPECTED_VALUE,0);
        }
................................................................................
      switch (val->opt&XVALUE_OPT_VALTYPE_MASK) 
        {
          case XVALUE_OPT_VALTYPE_INT:
            return (double)val->dec;
          case XVALUE_OPT_VALTYPE_FLT:          
            return val->flt;
          case XVALUE_OPT_VALTYPE_STR:
            return Str_To_Flt_Dflt(val->txt,dfltval);
          case XVALUE_OPT_VALTYPE_LIT:
            return Str_To_Flt_Dflt((char*)&val->down,dfltval);
          case XVALUE_OPT_VALTYPE_NONE:
            return 0;
          default:
            __Raise(YOYO_ERROR_UNEXPECTED_VALUE,0);
        }
    return dfltval;
  }
................................................................................
          case XVALUE_OPT_VALTYPE_INT:
            return val->dec?1:0;
          case XVALUE_OPT_VALTYPE_BOOL:
            return val->bval;
          case XVALUE_OPT_VALTYPE_FLT:          
            return val->flt?1:0;
          case XVALUE_OPT_VALTYPE_STR:
            return Str_To_Bool_Dflt(val->txt,dfltval);
          case XVALUE_OPT_VALTYPE_LIT:
            return Str_To_Bool_Dflt((char*)&val->down,dfltval);
          case XVALUE_OPT_VALTYPE_NONE:
            return 0;
          default:
            __Raise(YOYO_ERROR_UNEXPECTED_VALUE,0);
        }
    return dfltval;
  }

Changes to yoyo.hc.

371
372
373
374
375
376
377










































378
379
380
381
382
383
384
....
1414
1415
1416
1417
1418
1419
1420


1421
1422
1423
1424
1425
1426
1427
....
1448
1449
1450
1451
1452
1453
1454



1455
1456
1457
1458
1459
1460
1461
#ifdef _STRICT
# define STRICT_REQUIRE(Expr) REQUIRE(Expr)
# define STRICT_CHECK(Expr) (Expr)
#else
# define STRICT_REQUIRE(Expr) ((void)0)
# define STRICT_CHECK(Expr) (1)
#endif /* _STRICT */











































#if defined __i386 || defined __x86_64
#define Four_To_Unsigned(Four)  (*(uint_t*)(Four))
#else
uint_t Four_To_Unsigned(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
................................................................................
            Yo_Fatal(YOYO_FATAL_ERROR,__yoTa("trying to pop unexistent lock",0),__Yo_FILE__,__LINE__);
          }
      }
  }
#endif
  ;
  


#ifdef _YOYO_CORE_BUILTIN
void _Yo_Raise(int err,char *msg,char *filename,int lineno)
  {
    YOYO_C_SUPPORT_INFO *nfo = Yo_Tls_Get(Yo_Csup_Nfo_Tls);
    STRICT_REQUIRE( !nfo || nfo->jb_top < nfo->jb_count );
    
    if ( err == YO_RERAISE_CURRENT_ERROR && (!nfo || !nfo->err.code) )
................................................................................
            locks[i].unlock(locks[i].cs);
        
        Yo_Unwind_Scope(0,nfo->jb[nfo->jb_top].auto_top);
        
        --nfo->jb_top;
        STRICT_REQUIRE(nfo->jb_top >= -1);
        



        longjmp(nfo->jb[nfo->jb_top+1].b,err?err:-1);
      }
    else
      {
        if ( err != YO_RERAISE_CURRENT_ERROR )
          Yo_Fatal(err,msg,filename,lineno);
        else







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>







 







>
>
>







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
....
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
....
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
#ifdef _STRICT
# define STRICT_REQUIRE(Expr) REQUIRE(Expr)
# define STRICT_CHECK(Expr) (Expr)
#else
# define STRICT_REQUIRE(Expr) ((void)0)
# define STRICT_CHECK(Expr) (1)
#endif /* _STRICT */

#if defined __i386 || defined __x86_64
#define Eight_To_Quad(Eight)  (*(quad_t*)(Eight))
#else
quad_t Eight_To_Quad(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    uint_t q0,q1;    
    q0 =   (unsigned int)((unsigned char*)b)[0]
              | ((unsigned int)((unsigned char*)b)[1] << 8)
              | ((unsigned int)((unsigned char*)b)[2] << 16)
              | ((unsigned int)((unsigned char*)b)[3] << 24);
    b = (char*b)+4;
    q1 =   (unsigned int)((unsigned char*)b)[0]
              | ((unsigned int)((unsigned char*)b)[1] << 8)
              | ((unsigned int)((unsigned char*)b)[2] << 16)
              | ((unsigned int)((unsigned char*)b)[3] << 24);
    return (quad_t)q0 | ((quad_t)q1 << 32);
  }
#endif
  ;
#endif

#if defined __i386 || defined __x86_64
#define Quad_To_Eight(Q,Eight) ((*(quad_t*)(Eight)) = (Q))
#else
void Quad_To_Eight(quad_t q, void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    byte_t *p = b;
    p[0] = (byte_t)q;
    p[1] = (byte_t)(q>>8);
    p[2] = (byte_t)(q>>16);
    p[3] = (byte_t)(q>>24);
    p[4] = (byte_t)(q>>32);
    p[5] = (byte_t)(q>>40);
    p[6] = (byte_t)(q>>48);
    p[7] = (byte_t)(q>>56);
  }
#endif
  ;
#endif

#if defined __i386 || defined __x86_64
#define Four_To_Unsigned(Four)  (*(uint_t*)(Four))
#else
uint_t Four_To_Unsigned(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
................................................................................
            Yo_Fatal(YOYO_FATAL_ERROR,__yoTa("trying to pop unexistent lock",0),__Yo_FILE__,__LINE__);
          }
      }
  }
#endif
  ;
  
char *Yo_Btrace(void);

#ifdef _YOYO_CORE_BUILTIN
void _Yo_Raise(int err,char *msg,char *filename,int lineno)
  {
    YOYO_C_SUPPORT_INFO *nfo = Yo_Tls_Get(Yo_Csup_Nfo_Tls);
    STRICT_REQUIRE( !nfo || nfo->jb_top < nfo->jb_count );
    
    if ( err == YO_RERAISE_CURRENT_ERROR && (!nfo || !nfo->err.code) )
................................................................................
            locks[i].unlock(locks[i].cs);
        
        Yo_Unwind_Scope(0,nfo->jb[nfo->jb_top].auto_top);
        
        --nfo->jb_top;
        STRICT_REQUIRE(nfo->jb_top >= -1);
        
      #ifdef _TRACEXPT
        StdErr_Print_Nl(Yo_Btrace());
      #endif  
        longjmp(nfo->jb[nfo->jb_top+1].b,err?err:-1);
      }
    else
      {
        if ( err != YO_RERAISE_CURRENT_ERROR )
          Yo_Fatal(err,msg,filename,lineno);
        else