Unnamed Fossil Project

Check-in [bce04069bb]
Login

Check-in [bce04069bb]

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

Overview
Comment:httpx updated
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bce04069bb37c75995bc230f3434b7a88dbaf23a
User & Date: alexey@sudachen.name 2012-03-03 09:29:26.000
Context
2012-03-04
15:34
updated check-in: 5c2217113b user: alexey@sudachen.name tags: trunk
2012-03-03
09:29
httpx updated check-in: bce04069bb user: alexey@sudachen.name tags: trunk
2012-02-23
09:34
cl10 compatibility fixed check-in: df6b1db1dc user: alexey@sudachen.name tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Added bio.hc.




























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
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
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
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
297
298
299
300
301
302

/*

Copyright © 2010-2012, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

*/

#ifndef C_once_91A90154_CD39_414F_9D05_4B45029B172F
#define C_once_91A90154_CD39_414F_9D05_4B45029B172F

#ifdef _LIBYOYO
#define _YOYO_BIO_BUILTIN
#endif

enum 
  { 
    YOYO_BIO_BUFFER_SIZE = 512,
    YOYO_BIO_WRITE = __FOUR_CHARS('W','R','I','T'), 
    YOYO_BIO_READ  = __FOUR_CHARS('R','E','A','D'),
  };

typedef struct _YOYO_BIO_BUFFER
  {
    int    start, end;
    byte_t data[YOYO_BIO_BUFFER_SIZE];
  } YOYO_BIO_BUFFER;

typedef struct _YOYO_BIO
  {
    YOYO_BIO_BUFFER bf;
    int (*inout)(void*,void*,int,int);
    void *strm;
    int  direction;
  } YOYO_BIO;

YOYO_BIO *Bio_Input(void *strm)
#ifdef _YOYO_BIO_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Destruct_OjMID,    YOYO_BIO_Destruct},
        {Oj_Read_OjMID,        Buffer_File_Read},
      };
    YOYO_BIO *bio = __Object(sizeof(YOYO_BIO),funcs);
    bio->direction = YOYO_BIO_READ;
    bio->inout = (int(*)(void*,void*,int,int))Yo_Find_Method_Of(&strm,Oj_Read_OjMID,YO_RAISE_ERROR)
    bio->strm = __Refe(strm);
    return bio;
  }
#endif  
  ;
  
YOYO_BIO *Bio_Output(void *strm)
#ifdef _YOYO_BIO_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Destruct_OjMID,    YOYO_BIO_Destruct},
        {Oj_Write_OjMID,       Bio_Write},
        {Oj_Flush_OjMID,       Bio_Flush},
      };
      
    YOYO_BIO *bio = __Object(sizeof(YOYO_BIO),funcs);
    bio->direction = YOYO_BIO_WRITE;
    bio->inout = (int(*)(void*,void*,int,int))Yo_Find_Method_Of(&strm,Oj_Write_OjMID,YO_RAISE_ERROR)
    bio->strm  = __Refe(strm);
    return bio;
  }
#endif  
  ;

void Bio_Flush(YOYO_BIO *bio)
#ifdef _YOYO_BIO_BUILTIN
  {
    /* output bio doesn´t use bf.start */
    if ( bio->direction != YOYO_BIO_WRITE )
      __Raise(YOYO_ERROR_UNSUPPORTED,__yoTa("input BIO doesn't support Flush"));
    if ( bio->bf.data )
      bio->inout(bio->strm,bio->bf.data,bio->bf.end);
    bio->bf.end = 0;
    Oj_Flush(bio->strm);
  }
#endif
  ;
  
int Bio_Write(YOYO_BIO *bio,void *dta,int count,int mincount)
#ifdef _YOYO_BIO_BUILTIN
  {
    /* output bio doesn´t use bf.start */
    int q,cc=0;
    
    if ( bio->direction != YOYO_BIO_WRITE )
      __Raise(YOYO_ERROR_UNSUPPORTED,__yoTa("input BIO doesn't support Write"));
    
    while ( cc != count )
      {
        q = Yo_MIN(count-cc,(sizeof(bio->bf.data)-bio->bf.end));
        
        if ( q )
          {
            memcpy(bio->bf.data+bio->bf.end,(char*)dta+cc,q);
            bio->bf.end += q;
            cc += q;
          }
        
        if ( bio->bf.end == sizeof(bio->bf.data) )
          {
            bio->inout(bio->strm,bio->bf.data,bio->bf.end,bio->bf.end);
            bio->bf.end = 0;
          }
      }
       
    return cc;
  }
#endif
  ;

int _Bio_Fill_Buffer(YOYO_BIO *bio, int read_or_die)
#ifdef _YOYO_BIO_BUILTIN
  {
    bio->bf.start = 0;
    bio->bf.end = 0;
    q = bio->inout(bio->strm,bio->bf.data,sizeof(bio->bf.data),read_or_die?1:0);
    bio->bf.end = q;

    if ( !q && read_or_die ) 
      __Raise(YOYO_ERROR_UNEXPECTED,__yoTa("chained read should return least 1 byte or die!",0))
  }
#endif
  ;
  
int Bio_Read(YOYO_BIO *bio,void *out,int count,int mincount)
#ifdef _YOYO_BIO_BUILTIN
  {
    int q,cc = 0;
    if ( bio->direction != YOYO_BIO_READ )
      __Raise(YOYO_ERROR_UNSUPPORTED,__yoTa("output BIO doesn't support Read"));
    
    if ( !count ) return 0;
    
    while ( cc != count )
      {
        q = Yo_MIN(count-cc,(bio->bf.end-bio->bf.start));

        if ( !q )
          {
            if ( mincount <= cc ) return cc;
            _Bio_Fill_Buffer(bio,mincount);     
          }
        else
          {        
            STRICT_REQUIRE(bio->bf.start < bio->bf.end);
            STRICT_REQUIRE(bio->bf.start+q <= bio->bf.end);
            memcpy((char*)dta+cc,bio->bf.data+bio->bf.start,q);
            bio->bf.start += q;
            cc += q;
          }
      }
    
    return cc;
  }
#endif
  ;

char *Bio_Read_Line(YOYO_BIO *bio, YOYO_BUFFER *bf)
#ifdef _YOYO_BIO_BUILTIN
  {
    int i, E;
    YOYO_BUFFER *out = bf;
    if ( !out ) out  = Buffer_Init(0);
    out->count = 0;
    
    for(;;)
      {
        char *p;
        if ( bio->bf.end == bio->bf.start )
          {
            _Bio_Fill_Buffer(bio,0);
            if ( bio->bf.end == bio->bf.start ) break;
          }
        Buffer_Grow_Reserve(out,out->count+128+1);
        p = (char*)bio->bf.data+bio->bf.start;
        for ( i = 0, E = Yo_MIN((bio->bf.end-bio->bf.start),128); i < E; ++i )
          {
            if ( p[i] == '\n' ) { ++i; break; }
          }
        memcpy(out->at,bio->bf.data+bio->bf.start,i);
        out->count += i;
        bio->bf.start += i;
        if ( i && out->at[out->count-1] == '\r' ) --out->count;
        out->at[out->count] = 0;
      }
    
    if ( !bf )
      {
        char *r = Buffer_Take_Data(out);
        __Unrefe(out);
        return r;
      }
    else
      return bf->at;
  }
#endif 
  ;

int Bio_Copy_Into(YOYO_BIO *bio, void *strm, int count)
#ifdef _YOYO_BIO_BUILTIN
  {
    byte_t bf[512];
    int i;
    int (*oj_read)(void*,void*,int,int) = 
      ((int(*)(void*,void*,int,int))Yo_Find_Method_Of(&strm,Oj_Read_OjMID,YO_RAISE_ERROR));
    for ( i = 0; i < count || count < 0; )
      {
        int l = oj_read(strm,bf,sizeof(bf),0);
        if ( l ) 
          {
            Bio_Write(bio,bf,l,l);
            i += l;
          }
        else if ( count < 0 )
          break;
        else
          __Raise(YOYO_ERROR_IO_EOF,__yoTa("stream out of data",0));
      }
    return i;
  }
#endif 
  ;

int Bio_Copy_From(YOYO_BIO *bio, void *strm, int count)
#ifdef _YOYO_BIO_BUILTIN
  {
    byte_t bf[512];
    int i;
    int (*oj_write)(void*,void*,int,int) = 
      ((int(*)(void*,void*,int,int))Yo_Find_Method_Of(&strm,Oj_Write_OjMID,YO_RAISE_ERROR));
    for ( i = 0; i < count || count < 0; )
      {
        int l = Bio_Read(bio,bf,sizeof(bf),0);
        if ( l ) 
          {
            oj_write(strm,bf,l,l);
            i += l;
          }
        else if ( count < 0 )
          break;
        else
          __Raise(YOYO_ERROR_IO_EOF,__yoTa("stream out of data",0));
      }
    return i;
  }
#endif 
  ;

void Bio_Reset(YOYO_BIO *bio)
#ifdef _YOYO_BIO_BUILTIN
  {
    bio->bf.start = bio->bf.end = 0;
  }
#endif 
  ;

#endif /* C_once_91A90154_CD39_414F_9D05_4B45029B172F */
Changes to httpx.hc.
1
2
3
4
5
6
7
8
9
10
11

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.



|







1
2
3
4
5
6
7
8
9
10
11

/*

Copyright © 2010-2012, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
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
*/

#ifndef C_once_DAA1D391_392F_467C_B5A8_6C8D0D3A9DCC
#define C_once_DAA1D391_392F_467C_B5A8_6C8D0D3A9DCC

#include "yoyo.hc"
#include "string.hc"


#include "file.hc"
#include "tcpip.hc"



#ifdef _LIBYOYO
#define _YOYO_HTTPX_BUILTIN
#endif

enum
  {
    YOYO_HTTPX_DOING_NOTHING      = 0,
    YOYO_HTTPX_IS_PREPARING       = 1,
    YOYO_HTTPX_IS_RESOLVING       = 2,
    YOYO_HTTPX_IS_CONNECTING      = 3,
    YOYO_HTTPX_IS_QUERYING        = 4,
    YOYO_HTTPX_IS_GETTING_STATUS  = 5,
    YOYO_HTTPX_IS_GETTING_HEADERS = 6,
    YOYO_HTTPX_IS_GETTING_CONTENT = 7,
    YOYO_HTTPX_IS_FINISHED        = 8,
    YOYO_HTTPX_IS_FAILED          = 9,
    YOYO_HTTPX_RESOLVING_ERROR    = 0x1001,
    YOYO_HTTPX_URLPARSING_ERROR   = 0x1002,
    YOYO_HTTPX_GETTING_ERROR      = 0x1003,













  };

typedef struct _YOYO_HTTPX_NTFY
  {
    void (*progress)(struct _YOYO_HTTPX_NTFY *, int st, int count, int total);
    void (*error)(struct _YOYO_HTTPX_NTFY *, int st, char *msg);
  } YOYO_HTTPX_NTFY;




































































































































































































































































































































































































#endif /* C_once_DAA1D391_392F_467C_B5A8_6C8D0D3A9DCC */








>
>


>
>




















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








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


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
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
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
*/

#ifndef C_once_DAA1D391_392F_467C_B5A8_6C8D0D3A9DCC
#define C_once_DAA1D391_392F_467C_B5A8_6C8D0D3A9DCC

#include "yoyo.hc"
#include "string.hc"
#include "buffer.hc"
#include "dicto.hc"
#include "file.hc"
#include "tcpip.hc"
#include "bio.hc"
//#include "ssl.hc"

#ifdef _LIBYOYO
#define _YOYO_HTTPX_BUILTIN
#endif

enum
  {
    YOYO_HTTPX_DOING_NOTHING      = 0,
    YOYO_HTTPX_IS_PREPARING       = 1,
    YOYO_HTTPX_IS_RESOLVING       = 2,
    YOYO_HTTPX_IS_CONNECTING      = 3,
    YOYO_HTTPX_IS_QUERYING        = 4,
    YOYO_HTTPX_IS_GETTING_STATUS  = 5,
    YOYO_HTTPX_IS_GETTING_HEADERS = 6,
    YOYO_HTTPX_IS_GETTING_CONTENT = 7,
    YOYO_HTTPX_IS_FINISHED        = 8,
    YOYO_HTTPX_IS_FAILED          = 9,
    YOYO_HTTPX_RESOLVING_ERROR    = 0x1001,
    YOYO_HTTPX_URLPARSING_ERROR   = 0x1002,
    YOYO_HTTPX_GETTING_ERROR      = 0x1003,
    
    YOYO_HTTPX_GET                = __FOUR_CHARS('G','E','T','_'),
    YOYO_HTTPX_PUT                = __FOUR_CHARS('P','U','T','_'),
    YOYO_HTTPX_POST               = __FOUR_CHARS('P','O','S','T'),
    YOYO_HTTPX_HEAD               = __FOUR_CHARS('H','E','A','D'),
  };

enum 
  {
    YOYO_URL_UNKNOWN  = 0,
    YOYO_URL_HTTP     = 80,
    YOYO_URL_HTTPS    = 443,
    YOYO_URL_FILE     = -1,
  };

typedef struct _YOYO_HTTPX_NTFY
  {
    void (*progress)(struct _YOYO_HTTPX_NTFY *, int st, int count, int total);
    void (*error)(struct _YOYO_HTTPX_NTFY *, int st, char *msg);
  } YOYO_HTTPX_NTFY;

typedef struct _YOYO_URL 
  {
    char *host, *user, *passw, *query, *args, *anchor, *uri;
    int   port, proto;
  } YOYO_URL;

void YOYO_URL_Destruct(YOYO_URL *url)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    free(url->host);
    free(url->user);
    free(url->passw);
    free(url->query);
    free(url->args);
    free(url->anchor);
    free(url->uri);
    __Destruct(url);
  }
#endif
  ;
  
int Url_Proto(char *S)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    if ( !strcmp_I(S,"http")  )  return YOYO_URL_HTTP;
    if ( !strcmp_I(S,"https") )  return YOYO_URL_HTTPS;
    if ( !strcmp_I(S,"file")  )  return YOYO_URL_FILE;
    return YOYO_URL_UNKNOWN;
  }
#endif
  ;
  
YOYO_URL *Parse_Url(char *url)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    YOYO_URL *urlout = 0;
    __Auto_Ptr(urlout)
      {
        /* proto://user:passwd@host:port/query#anchor?args */
      
        char *p;
        char *pS = url;
        
        char *proto = 0;
        char *host  = 0;
        char *user  = 0;
        char *passw = 0;
        char *uri   = 0;
        char *args  = 0;
        char *query = 0;
        char *anchor= 0;
        int   port  = 0;
        
        p = pS;
        while ( *p && Isalpha(*p) ) ++p;
        
        if ( *p && *p == ':' && p[1] && p[1] == '/' && p[2] && p[2] == '/' )
          {
            proto = Str_Range(pS,p);
            pS = p+3;
          }
          
        p = pS;
        while ( *p && (Isalnum(*p) || *p == '.' || *p == '-' || *p == ':' ) ) ++p;
        
        if ( *p == '@' ) // user/password
          {
            char *q = pS;
            while ( *q != '@' && *q != ':' ) ++q;
            if ( *q == ':' ) 
              {
                user = Str_Range(pS,q);
                passw = Str_Range(q+1,p);
              }
            else
              user = Str_Range(pS,p);
            pS = p+1;
          }
          
        p = pS;
        while ( *p && (Isalnum(*p) || *p == '.' || *p == '-') ) ++p;
        
        if ( *p == ':' )
          {
            host = Str_Range(pS,p);
            pS = p+1; ++p;
            while ( *p && Isdigit(*p) ) ++p;
            if ( *p == '/' || !*p )
              { 
                port = strtol(pS,0,10); 
              }
            else
              __Raise(YOYO_ERROR_ILLFORMED,__yoTa("invalid port value",0));
            pS = p;
          }
        else if ( !*p || *p == '/' )
          {
            host = Str_Range(pS,p);
            pS = p;
          }
        
        uri = Str_Copy(pS,-1);  
        
        p = pS;
        while ( *p && *p != '?' && *p != '#' ) ++p;
        query = Str_Range(pS,p);

        if ( *p == '#' )
          {
            pS = ++p;
            while ( *p && *p != '?' ) ++p;
            anchor = Str_Range(pS,p);
          }
           
        if ( *p == '?' ) 
          {
            pS = ++p;
            while ( *p ) ++p;
            args = Str_Range(pS,p);
          }
                          
        urlout = __Object_Dtor(sizeof(YOYO_URL),YOYO_URL_Destruct);
        urlout->args  = __Retain(args);
        urlout->anchor= __Retain(anchor);
        urlout->query = __Retain(query);
        urlout->uri   = __Retain(uri);
        urlout->host  = __Retain(host);
        urlout->passw = __Retain(passw);
        urlout->user  = __Retain(user);
        urlout->port  = port;
        urlout->proto = Url_Proto(proto);
      }
      
    return urlout;
  }
#endif
  ;

typedef struct _YOYO_HTTPX
  {
    void *strm;
    YOYO_BIO *bio_in;
    YOYO_BIO *bio_out;
    
    YOYO_DICTO *hdrs;
    int  code;
    char *text;
    int  content_length;
    char *content_type; /* handles by hdrs */
    
    int http10: 1;
    int heepalive: 1;
  } YOYO_HTTPX;

YOYO_HTTPX_Destruct(YOYO_HTTPX *httpx)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    Oj_Close(httpx->strm);
    __Unrefe(httpx->bio_in);
    __Unrefe(httpx->bio_out);
    __Unrefe(httpx->strm);
    __Unrefe(httpx->hdrs);
    free(http->text);
    __Destruct(httpx);
  }
#endif
  ;
  
YOYO_HTTPX *Httpx_Connect(int proto, char *host, int port)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    YOYO_HTTPX *httpx = 0;
    __Auto_Ptr(cnt) 
      {
        YOYO_TCPSOK *sok;
        
        sok = Tcp_Open(host,port);
        
        httpx = __Object_Dtor(sizeof(YOYO_HTTPX),YOYO_HTTPX_Destruct);
        httpx->strm    = __Refe(sok);
        httpx->bio_in  = __Refe(Bio_Input(httpx->strm));
        httpx->bio_out = __Refe(Bio_Output(httpx->strm));
      }
    return cnt;
  }
#endif

void Httpx_Send_Header_Line(YOYO_BIO *bio, char *name, char *value)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    Bio_Write(bio,name,-1);
    Bio_Write(bio,": ",2);
    Bio_Write(bio,value,-1);
    Bio_Write(bio,"\r\n",2);
  }
#endif
  ;
  
void Httpx_Send_Header_Line_Filtered(YOYO_BIO *bio, char *name, char *value)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    if ( !strcmp_I(name,"Host")
       ||!strcmp_I(name,"User-Agent")
       ||!strcmp_I(name,"Accept-Charset")
       ||!strcmp_I(name,"Accept")
       ||!strcmp_I(name,"Content-Type")
       ||!strcmp_I(name,"Connection")
       ||!strcmp_I(name,"Content-Length") )
      return;
      
    Httpx_Send_Header_Line(bio,name,value); 
  }
#endif  
  ;
    
void Httpx_Send_Common_Header_Line(YOYO_DICTO *hdrs,char *name, char *dflt,YOYO_BIO *bio)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    char *val = hdrs?Dicto_Get(hdrs,name,dlft):dflt;
    Httpx_Send_Header_Line(bio,name,val); 
  }
#endif
  ;
    
void Httpx_Send_Request_Line(YOYO_BIO *bio, int method, char *uri, int http10)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    static char s_GET[3]  = "GET";
    static char s_PUT[3]  = "PUT";
    static char s_POST[4] = "POST";
    static char s_HEAD[4] = "HEAD";
    
    switch ( method )
      {
        case YOYO_HTTPX_GET:  Bio_Write(bio,s_GET,sizeof(s_GET)); break;
        case YOYO_HTTPX_PUT:  Bio_Write(bio,s_PUT,sizeof(s_PUT)); break;
        case YOYO_HTTPX_POST: Bio_Write(bio,s_POST,sizeof(s_POST)); break;
        case YOYO_HTTPX_HEAD: Bio_Write(bio,s_HEAD,sizeof(s_HEAD)); break;
        default:
          __Raise_Format(YOYO_ERROR_ILLFORMED,(__yoTa("invalid HTTPX request method: %d",0),method);
      }
      
    Bio_Write(bio," ",1);
    Bio_Write(bio,uri,-1);
    
    if ( http10 )
      Bio_Write(bio,"HTTP/1.0\r\n",10);
    else
      Bio_Write(bio,"HTTP/1.1\r\n",10);
  }
#endif
  ;
  
void Httpx_Send_Request(YOYO_HTTPX *httpx, YOYO_URL *url, int method, YOYO_DICTO *hdrs, void *strm)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    YOYO_BIO *bio = httpx->bio_out;
    Bio_Reset(&httpx->bio_out);    
    Httpx_Send_Request_Line(bio,method,url->uri,httpx->http10);
    Httpx_Send_Common_Header_Line(hdrs,"Host",url->host,bio);
    Httpx_Send_Common_Header_Line(hdrs,"User-Agent","httpx",bio);
    Httpx_Send_Common_Header_Line(hdrs,"Accept","*/*",bio);
    Httpx_Send_Common_Header_Line(hdrs,"Accept-Charset","utf-8",bio);
    if ( hdrs ) 
      Dicto_Apply(hdrs,Httpx_Send_Header_Line_Filtered,bio);
    if ( strm && ( method == YOYO_HTTPX_POST || method == YOYO_HTTPX_PUT ) ) 
      {
        quad_t length = Oj_Available(strm);
        char len[13];
        snprintf(len,"%d",sizeof(len),(int)length);
        if ( method == YOYO_HTTPX_POST )
          Httpx_Send_Common_Header_Line(hdrs,"Content-Type","application/x-www-form-urlencoded",bio);
        else  
          Httpx_Send_Common_Header_Line(hdrs,"Content-Type","application/octet-stream",bio);
        Httpx_Send_Header_Line("Content-Length",len);
        Bio_Write(bio,"\r\n",2);
        Bio_Copy_Into(bio,strm);
      }
    else
      Bio_Write(bio,"\r\n",2);
    Bio_Flush(bio);
  }
#endif
  ;
  
void Httpx_Recv_Response(YOYO_HTTPX *httpx)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    char *S = 0;
    YOYO_BUFFER *bf = Buffer_Init(0);
    YOYO_BIO *bio = httpx->bio_in;
    Bio_Reset(bio);
    S = Bio_Read_Line(bio,bf);
    httpx->content_length = 0;
    httpx->content_type = 0;
    
    if ( strcmp_I(S,"http/1.") )
      {
        while ( *S && !Isspace(*S) ) ++S;
        while ( Isspace(*S) ) ++S;
        httpx->code = strtol(S,&S,10);
        while ( Isspace(*S) ) ++S;
        httpx->text = Str_Copy(S,-1);
      }
    else
      __Raise_Format(YOYO_ERROR_ILLFORMED,(__yoTa("illformed http response: %.10s",0),S));
        
    for (;;)
      {
        char *q, *Q;
        S = Bio_Read_Line(bio,bf);
        while (Isspace(*S)) ++S;
        if ( !*S ) break; 
        q = S;
        while ( *q && *q != ':' ) ++q;
        if ( *q == ':' )
          {
            *q = 0;
            ++q;
            while ( Isspace(*q) ) ++q;
            Dicto_Put(httpx->hdrs,S,(Q=Str_Copy_Npl(q,-1)));
            if ( !strcmp_I(S,"Content-Length") )
              httpx->content_length = Str_To_Int(q);
            else if ( !strcmp_I(S,"Content-Type") )
              httpx->content_type = Q;
          }
      }
  }
#endif
  ;
  
int Httpx_Request(YOYO_HTTPX *httpx, char *uri, int method, YOYO_DICTO *hdrs, void *strm)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    __Auto_Release
      {
        Httpx_Send_Request(httpx,uri,method,hdrs,strm);
        Httpx_Recv_Response(httpx);
      }
      
    return httpx->code;
  }
#endif
  ;
  
#define Httpx_Clear_Cookies(Hdrs) Httpx_Set_Cookie(Hdrs,0,0,0)   
void Httpx_Set_Cookie(YOYO_DICTO *hdrs, char *name, char *value, quad_t lifetime)
#ifdef _YOYO_HTTPX_BUILTIN
  {
  }
#endif
  ;
    
char *Httpx_Get_Cookie(YOYO_DICTO *hdrs, char *name, quad_t *lifetime)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    return 0;
  }
#endif
  ;
  
#define Httpx_Read_All(Httpx,Out) Httpx_Read(Httpx,Out,-1)
YOYO_BUFFER *Httpx_Read(YOYO_HTTPX *httpx, YOYO_BUFFER *out, int count)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    if ( !out )
      out = Buffer_Init(0);

    __Auto_Release
      {
        void *f = Buffer_As_File(out);
        Bio_Copy_From(httpx->bio_in,f,count);
      }
      
    return out;
  }
#endif
  ;
  
void Httpx_Close(YOYO_HTTPX *httpx)
#ifdef _YOYO_HTTPX_BUILTIN
  {
    Oj_Close(httpx->strm);
  }
#endif
  ;

#endif /* C_once_DAA1D391_392F_467C_B5A8_6C8D0D3A9DCC */

Changes to string.hc.
144
145
146
147
148
149
150










151
152
153
154
155
156
157
    if ( L < 0 ) L = S?strlen(S):0;
    p = Yo_Malloc_Npl(L+1);
    if ( L )
      memcpy(p,S,L);
    p[L] = 0;
    return p;
  }










#endif
  ;

#define Str_Trim_Copy(Str,Len) __Pool(Str_Trim_Copy_Npl(Str,Len))
char *Str_Trim_Copy_Npl(char *S, int L)
#ifdef _YOYO_STRING_BUILTIN
  {







>
>
>
>
>
>
>
>
>
>







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
    if ( L < 0 ) L = S?strlen(S):0;
    p = Yo_Malloc_Npl(L+1);
    if ( L )
      memcpy(p,S,L);
    p[L] = 0;
    return p;
  }
#endif
  ;

#define Str_Range(Start,End) __Pool(Str_Range_Npl(Start,End))
char *Str_Range_Npl(char *S, char *E)
#ifdef _YOYO_STRING_BUILTIN
  {
    STRICT_REQUIRE(E >= S);
    return Str_Copy_Npl(S,E-S);
  }
#endif
  ;

#define Str_Trim_Copy(Str,Len) __Pool(Str_Trim_Copy_Npl(Str,Len))
char *Str_Trim_Copy_Npl(char *S, int L)
#ifdef _YOYO_STRING_BUILTIN
  {
Changes to tcpip.hc.
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "string.hc"
#include "file.hc"

#ifdef _LIBYOYO
#define _YOYO_TCPIP_BUILTIN
#endif

typedef struct _YOYO_SOCKET
  {
    int       skt;
    char     *host;
    int       port;
    in_addr_t ip;
  } YOYO_SOCKET

#ifdef __windoze
void _WSA_Init()
#ifdef _YOYO_TCPIP_BUILTIN
  {
    static int wsa_status = -1;
    static WSADATA wsa_data = {0};







|





|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "string.hc"
#include "file.hc"

#ifdef _LIBYOYO
#define _YOYO_TCPIP_BUILTIN
#endif

typedef struct _YOYO_TCPSOK
  {
    int       skt;
    char     *host;
    int       port;
    in_addr_t ip;
  } YOYO_TCPSOK;

#ifdef __windoze
void _WSA_Init()
#ifdef _YOYO_TCPIP_BUILTIN
  {
    static int wsa_status = -1;
    static WSADATA wsa_data = {0};
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
          __Raise_Format(YOYO_ERROR_DNS,("DNS couldn't resolve ip for name %s",host));
      }
    return 0;
  }        
#endif
  ;
  
void Socket_Close(YOYO_SOCKET *sok)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    if ( sok->skt >= 0 ) 
      {
        close(sok->skt);
        sok->skt = -1;
      }
  }
#endif
  ;
  
void YOYO_SOCKET_Destruct(YOYO_SOCKET *sok)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    Socket_Close(sok);
    free(sok->host);
    __Detruct(sok);
  }
#endif
  ;
  
int Socket_Read(YOYO_SOCKET *sok, void *out, int count, int mincount)
#ifdef _YOYO_TCPIP_BUILTIN  
  {
    byte_t *b = out;
    int cc = count;
    while ( cc )
      {
        int q = recv(skt,b,cc,0);
        if ( q < 0 )
          __Raise_Format(YOYO_ERROR_IO,("tcp recv failed with error %s",strerror(errno)));
        STRICT_REQUIRE( q <= cc );
        cc -= q;
        b += q;
        if ( q == 0 && count-cc >= mincount )
          break;
      }
    return count-cc;
  }
#endif
  ;
  
int Socket_Write(YOYO_SOCKET *sok, void *out, int count, int mincount)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    byte_t *b = out;
    int cc = count;
    while ( cc )
      {
        int q = send(skt,b,cc,0);
        if ( q < 0 )
          __Raise_Format(YOYO_ERROR_IO,("tcp send failed with error %s",strerror(errno)));
        STRICT_REQUIRE( q <= cc );
        cc -= q;
        b += q;
        if ( q == 0 && count-cc >= mincount )
          break;
      }
    return count-cc;
  }
#endif
  ;
  
YOYO_SOCKET *Socket_Init(in_addr_t ip, int port, int skt, char *hostname)
#ifdef _YOYO_TCPIP_BUILTIN  
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Destruct_OjMID,    YOYO_SOCKET_Destruct},
        {Oj_Close_OjMID,       Socket_Close},
        {Oj_Read_OjMID,        Socket_Read},
        {Oj_Write_OjMID,       Socket_Write},
        //{Oj_Available_OjMID,   Socket_Available},
        //{Oj_Eof_OjMID,         Socket_Eof},
        {0}
      };

    YOYO_SOCKET *sok = __Object(sizeof(YOYO_SOCKET),funcs);
    sok->skt = skt;
    sok->port = port;
    sok->ip = ip;
    sok->host = hostname ? Str_Copy_Npl(hostname,-1) : Ipv4_Format_Npl(ip);
  }
#endif
  ;
  
YOYO_TCPSOKET *Socket_Open_Inaddr(in_addr_t ip, int port, char *hostname)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    YOYO_TCPSOKET *sok;
    
    sockaddr_in addr = {0}; 
    int skt, conerr;
    
    _WSA_Init();
    
    addr.sin_family = AF_INET;







|











|


|






|




















|




















|




|
|
|
|
|
|



|








|


|







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
          __Raise_Format(YOYO_ERROR_DNS,("DNS couldn't resolve ip for name %s",host));
      }
    return 0;
  }        
#endif
  ;
  
void Tcp_Close(YOYO_TCPSOK *sok)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    if ( sok->skt >= 0 ) 
      {
        close(sok->skt);
        sok->skt = -1;
      }
  }
#endif
  ;
  
void YOYO_TCPSOK_Destruct(YOYO_TCPSOK *sok)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    Tcp_Close(sok);
    free(sok->host);
    __Detruct(sok);
  }
#endif
  ;
  
int Tcp_Read(YOYO_TCPSOK *sok, void *out, int count, int mincount)
#ifdef _YOYO_TCPIP_BUILTIN  
  {
    byte_t *b = out;
    int cc = count;
    while ( cc )
      {
        int q = recv(skt,b,cc,0);
        if ( q < 0 )
          __Raise_Format(YOYO_ERROR_IO,("tcp recv failed with error %s",strerror(errno)));
        STRICT_REQUIRE( q <= cc );
        cc -= q;
        b += q;
        if ( q == 0 && count-cc >= mincount )
          break;
      }
    return count-cc;
  }
#endif
  ;
  
int Tcp_Write(YOYO_TCPSOK *sok, void *out, int count, int mincount)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    byte_t *b = out;
    int cc = count;
    while ( cc )
      {
        int q = send(skt,b,cc,0);
        if ( q < 0 )
          __Raise_Format(YOYO_ERROR_IO,("tcp send failed with error %s",strerror(errno)));
        STRICT_REQUIRE( q <= cc );
        cc -= q;
        b += q;
        if ( q == 0 && count-cc >= mincount )
          break;
      }
    return count-cc;
  }
#endif
  ;
  
YOYO_TCPSOK *Tcp_Init(in_addr_t ip, int port, int skt, char *hostname)
#ifdef _YOYO_TCPIP_BUILTIN  
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Destruct_OjMID,    YOYO_TCPSOK_Destruct},
        {Oj_Close_OjMID,       Tcp_Close},
        {Oj_Read_OjMID,        Tcp_Read},
        {Oj_Write_OjMID,       Tcp_Write},
        //{Oj_Available_OjMID,   Tcp_Available},
        //{Oj_Eof_OjMID,         Tcp_Eof},
        {0}
      };

    YOYO_TCPSOK *sok = __Object(sizeof(YOYO_TCPSOK),funcs);
    sok->skt = skt;
    sok->port = port;
    sok->ip = ip;
    sok->host = hostname ? Str_Copy_Npl(hostname,-1) : Ipv4_Format_Npl(ip);
  }
#endif
  ;
  
YOYO_TCPSOK *Tcp_Open_Inaddr(in_addr_t ip, int port, char *hostname)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    YOYO_TCPSOK *sok;
    
    sockaddr_in addr = {0}; 
    int skt, conerr;
    
    _WSA_Init();
    
    addr.sin_family = AF_INET;
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
        __Raise_Format(YOYO_ERROR_IO,("tcp connection failed: sok %d, point (%s -> %s):%d, error %d"
                          ,skt
                          ,hostname?hostname:Ipv4_Fomat(ip)
                          ,Ipv4_Fomat(ip)
                          ,port
                          ,conerr));

    sok = Socket_Init(skt,ip,port,hostname);
    return sok;
  }
#endif
  ;
  
YOYO_TCPSOKET *Socket_Open(char *host, int port)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    in_addr_t ip = Dns_Resolve(host);
    YOYO_TCPSOKET *sok = Soket_Open_Inaddr(ip,port,hotname);
    return sok;
  }
#endif
  ;
  
#endif /* C_once_F8F16072_F92E_49E7_A983_54F60965F4C9 */








|





|



|







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
        __Raise_Format(YOYO_ERROR_IO,("tcp connection failed: sok %d, point (%s -> %s):%d, error %d"
                          ,skt
                          ,hostname?hostname:Ipv4_Fomat(ip)
                          ,Ipv4_Fomat(ip)
                          ,port
                          ,conerr));

    sok = Tcp_Init(skt,ip,port,hostname);
    return sok;
  }
#endif
  ;
  
YOYO_TCPSOK *Tcp_Open(char *host, int port)
#ifdef _YOYO_TCPIP_BUILTIN
  {
    in_addr_t ip = Dns_Resolve(host);
    YOYO_TCPSOK *sok = Soket_Open_Inaddr(ip,port,hotname);
    return sok;
  }
#endif
  ;
  
#endif /* C_once_F8F16072_F92E_49E7_A983_54F60965F4C9 */

Changes to xdata.hc.
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
char *Xvalue_Get_Str(YOYO_XVALUE *val, char *dfltval)
#ifdef _YOYO_XDATA_BUILTIN
  {
    if ( val )
      switch (val->opt&XVALUE_OPT_VALTYPE_MASK) 
        {
          case XVALUE_OPT_VALTYPE_STR:
            return val->txt;
          case XVALUE_OPT_VALTYPE_LIT:
            return (char*)&val->down;
          case XVALUE_OPT_VALTYPE_NONE:
            return "";
          case XVALUE_OPT_VALTYPE_BOOL:
            if ( val->bval )
              return "yes";







|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
char *Xvalue_Get_Str(YOYO_XVALUE *val, char *dfltval)
#ifdef _YOYO_XDATA_BUILTIN
  {
    if ( val )
      switch (val->opt&XVALUE_OPT_VALTYPE_MASK) 
        {
          case XVALUE_OPT_VALTYPE_STR:
            return ( val->txt[0] ) ? val->txt : dfltval;
          case XVALUE_OPT_VALTYPE_LIT:
            return (char*)&val->down;
          case XVALUE_OPT_VALTYPE_NONE:
            return "";
          case XVALUE_OPT_VALTYPE_BOOL:
            if ( val->bval )
              return "yes";
Changes to yoyo.hc.
168
169
170
171
172
173
174


175
176
177
178
179
180
181
  int backtrace( void **cbk, int count );
#else
# define backtrace(Cbk,Count) (0)
#endif

/* Only if x is one-byte symbol! */
#define Isspace(x)   isspace((byte_t)(x))


#define Isdigit(x)   isdigit((byte_t)(x))
#define Isxdigit(x)  isxdigit((byte_t)(x))
#define Toupper(x)   toupper((byte_t)(x))
#define Tolower(x)   tolower((byte_t)(x))

/* ATTENTION! int is always less then size_t! use it carefully */
#define iszof(x)     ((int)sizeof(x))







>
>







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
  int backtrace( void **cbk, int count );
#else
# define backtrace(Cbk,Count) (0)
#endif

/* Only if x is one-byte symbol! */
#define Isspace(x)   isspace((byte_t)(x))
#define Isalpha(x)   isalpha((byte_t)(x))
#define Isalnum(x)   isalnum((byte_t)(x))
#define Isdigit(x)   isdigit((byte_t)(x))
#define Isxdigit(x)  isxdigit((byte_t)(x))
#define Toupper(x)   toupper((byte_t)(x))
#define Tolower(x)   tolower((byte_t)(x))

/* ATTENTION! int is always less then size_t! use it carefully */
#define iszof(x)     ((int)sizeof(x))