Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | some bugs fixed |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b360d43149405c8e2cfed86683e87e5a |
User & Date: | monster 2012-08-12 10:26:48.296 |
Context
2012-08-17
| ||
09:12 | updated check-in: abbd8eb1ee user: monster tags: trunk | |
2012-08-12
| ||
10:26 | some bugs fixed check-in: b360d43149 user: monster tags: trunk | |
2012-08-11
| ||
02:42 | xddb inser/update fixes check-in: eb40275c3f user: monster tags: trunk | |
Changes
Changes to buffer.hc.
︙ | ︙ | |||
524 525 526 527 528 529 530 | } #endif ; void *Buffer_Copy(void *S, int count) #ifdef _YO_BUFFER_BUILTIN { | > > | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | } #endif ; void *Buffer_Copy(void *S, int count) #ifdef _YO_BUFFER_BUILTIN { YO_BUFFER *bf; if ( count < 0 ) count = S?strlen(S):0; bf = Buffer_Init(count); if ( count ) memcpy(bf->at,S,count); return bf; } #endif ; |
︙ | ︙ |
Changes to cgi.hc.
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | YO_CGI_OCTETSTREAM = 2, YO_CGI_MULTIPART = 3, YO_CGI_POST_MAX_PAYLOAD = 64*KILOBYTE, CGI_OUT_TEXTHTML = 200, CGI_OUT_REDIRECT = 301, CGI_OUT_DATASTREAM = 299, CGI_OUT_NOTFOUND = 404, }; /* YO_CGI_COOKIE does not require specific destructor, use free */ typedef struct _YO_CGI_COOKIE { struct _YO_CGI_COOKIE *next; char *value; | > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | YO_CGI_OCTETSTREAM = 2, YO_CGI_MULTIPART = 3, YO_CGI_POST_MAX_PAYLOAD = 64*KILOBYTE, CGI_OUT_TEXTHTML = 200, CGI_OUT_REDIRECT = 301, CGI_OUT_DATASTREAM = 299, CGI_OUT_NOTFOUND = 404, CGI_OUT_TEXTJSON = 200, CGI_OUT_TEXTPLAIN = 10002, }; /* YO_CGI_COOKIE does not require specific destructor, use free */ typedef struct _YO_CGI_COOKIE { struct _YO_CGI_COOKIE *next; char *value; |
︙ | ︙ | |||
872 873 874 875 876 877 878 879 880 881 882 883 884 885 | #ifdef _YO_CGI_BUILTIN { if ( out_status == CGI_OUT_TEXTHTML ) { Cgi_Put_Out_(cgi,"Content-Type: text/html; charset=utf-8\r\n"); Cgi_Put_Out_(cgi,__Format("Content-Length: %d\r\n\r\n",Cgi_Get_Len(cgi))); Cgi_Put_Out_(cgi,cgi->out->at); } else if ( out_status == CGI_OUT_REDIRECT ) { Cgi_Put_Out_(cgi,"Location: "); Cgi_Put_Out_(cgi,cgi->out->at); Cgi_Put_Out_(cgi,"\r\n"); Cgi_Put_Out_(cgi,Cgi_Format_Cookies_Out(cgi)); | > > > > > > > > > > > > | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | #ifdef _YO_CGI_BUILTIN { if ( out_status == CGI_OUT_TEXTHTML ) { Cgi_Put_Out_(cgi,"Content-Type: text/html; charset=utf-8\r\n"); Cgi_Put_Out_(cgi,__Format("Content-Length: %d\r\n\r\n",Cgi_Get_Len(cgi))); Cgi_Put_Out_(cgi,cgi->out->at); } else if ( out_status == CGI_OUT_TEXTJSON ) { Cgi_Put_Out_(cgi,"Content-Type: text/json; charset=utf-8\r\n"); Cgi_Put_Out_(cgi,__Format("Content-Length: %d\r\n\r\n",Cgi_Get_Len(cgi))); Cgi_Put_Out_(cgi,cgi->out->at); } else if ( out_status == CGI_OUT_TEXTPLAIN ) { Cgi_Put_Out_(cgi,"Content-Type: text/plain; charset=utf-8\r\n"); Cgi_Put_Out_(cgi,__Format("Content-Length: %d\r\n\r\n",Cgi_Get_Len(cgi))); Cgi_Put_Out_(cgi,cgi->out->at); } else if ( out_status == CGI_OUT_REDIRECT ) { Cgi_Put_Out_(cgi,"Location: "); Cgi_Put_Out_(cgi,cgi->out->at); Cgi_Put_Out_(cgi,"\r\n"); Cgi_Put_Out_(cgi,Cgi_Format_Cookies_Out(cgi)); |
︙ | ︙ |
Changes to file.hc.
︙ | ︙ | |||
1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | #ifdef _YO_FILE_BUILTIN { return 0; } #endif ; int Buffer_File_Read(YO_BUFFER_FILE *f, void *buf, int count, int min_count) #ifdef _YO_FILE_BUILTIN { if ( min_count < 0 ) min_count = count; if ( f->offs + min_count > f->bf->count ) __Raise(YO_ERROR_IO_EOF,"end of file"); count = Yo_MIN(f->bf->count-f->offs,count); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 | #ifdef _YO_FILE_BUILTIN { return 0; } #endif ; char *Buffer_File_Read_Line(YO_BUFFER_FILE *f) #ifdef _YO_FILE_BUILTIN { char *R, *S = f->bf->chars; int i = f->offs; #ifdef _DEBUG char *SS = f->bf->chars + f->offs; #endif if ( i == f->bf->count ) return 0; do { if ( S[f->offs++] == '\n' ) break; } while ( f->bf->count != f->offs ); R = Str_Copy_L(S+i,f->offs-i); S = R+f->offs-i-1; if ( R <= S && *S == '\n' ) { *S-- = 0; if ( R <= S && *S == '\r' ) *S = 0; } return R; } #endif ; int Buffer_File_Read(YO_BUFFER_FILE *f, void *buf, int count, int min_count) #ifdef _YO_FILE_BUILTIN { if ( min_count < 0 ) min_count = count; if ( f->offs + min_count > f->bf->count ) __Raise(YO_ERROR_IO_EOF,"end of file"); count = Yo_MIN(f->bf->count-f->offs,count); |
︙ | ︙ | |||
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 | {Oj_Write_OjMID, Buffer_File_Write}, {Oj_Available_OjMID, Buffer_File_Available}, {Oj_Eof_OjMID, Buffer_File_Eof}, {Oj_Length_OjMID, Buffer_File_Length}, {Oj_Seek_OjMID, Buffer_File_Seek}, {Oj_Tell_OjMID, Buffer_File_Tell}, {Oj_Flush_OjMID, Buffer_File_Flush}, {0} }; YO_BUFFER_FILE *file = __Object(sizeof(YO_BUFFER_FILE),funcs); file->bf = __Refe(bf); return file; } #endif ; void YO_MEMORY_FILE_Destruct(YO_BUFFER_FILE *file) | > > | 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | {Oj_Write_OjMID, Buffer_File_Write}, {Oj_Available_OjMID, Buffer_File_Available}, {Oj_Eof_OjMID, Buffer_File_Eof}, {Oj_Length_OjMID, Buffer_File_Length}, {Oj_Seek_OjMID, Buffer_File_Seek}, {Oj_Tell_OjMID, Buffer_File_Tell}, {Oj_Flush_OjMID, Buffer_File_Flush}, {Oj_Read_Line_OjMID, Buffer_File_Read_Line}, {0} }; YO_BUFFER_FILE *file = __Object(sizeof(YO_BUFFER_FILE),funcs); if ( !bf ) bf = Buffer_Init(0); file->bf = __Refe(bf); return file; } #endif ; void YO_MEMORY_FILE_Destruct(YO_BUFFER_FILE *file) |
︙ | ︙ | |||
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | {Oj_Write_OjMID, Memory_File_Write}, {Oj_Available_OjMID, Buffer_File_Available}, {Oj_Eof_OjMID, Buffer_File_Eof}, {Oj_Length_OjMID, Buffer_File_Length}, {Oj_Seek_OjMID, Buffer_File_Seek}, {Oj_Tell_OjMID, Buffer_File_Tell}, {Oj_Flush_OjMID, Buffer_File_Flush}, {0} }; YO_BUFFER_FILE *file = __Object(sizeof(YO_BUFFER_FILE),funcs); file->bf = __Zero_Malloc_Npl(sizeof(YO_BUFFER)); file->bf->at = mem; file->bf->count = mem_len; | > | 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | {Oj_Write_OjMID, Memory_File_Write}, {Oj_Available_OjMID, Buffer_File_Available}, {Oj_Eof_OjMID, Buffer_File_Eof}, {Oj_Length_OjMID, Buffer_File_Length}, {Oj_Seek_OjMID, Buffer_File_Seek}, {Oj_Tell_OjMID, Buffer_File_Tell}, {Oj_Flush_OjMID, Buffer_File_Flush}, {Oj_Read_Line_OjMID, Buffer_File_Read_Line}, {0} }; YO_BUFFER_FILE *file = __Object(sizeof(YO_BUFFER_FILE),funcs); file->bf = __Zero_Malloc_Npl(sizeof(YO_BUFFER)); file->bf->at = mem; file->bf->count = mem_len; |
︙ | ︙ |
Changes to httpd.hc.
︙ | ︙ | |||
695 696 697 698 699 700 701 | else httpd->callback(httpd->obj,rqst,HTTPD_STAT_REJECTED); } } #endif ; | | | | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | else httpd->callback(httpd->obj,rqst,HTTPD_STAT_REJECTED); } } #endif ; void Httpd_Listen(YO_HTTPD *httpd, char *host, int port, int listen) #ifdef _YO_HTTPD_BUILTIN { httpd->sok = __Refe(Tcp_Listen(host,port,listen)); free(httpd->host); httpd->host = Str_Copy_Npl(host,-1); httpd->port = port; Tcp_Aio_Accept(httpd->sok,Cbk_Httpd_Accept,httpd); } #endif ; |
︙ | ︙ |
Changes to prog.hc.
︙ | ︙ | |||
258 259 260 261 262 263 264 265 266 267 268 269 270 271 | rt = 1; atexit(Prog_Clear_At_Exit); } __Except { if ( flags & PROG_EXIT_ON_ERROR ) Error_Print_N_Exit(Yo__basename(argv[0]),-1); } return rt; } #endif ; YO_ARRAY *Prog_Argc_Argv(char *input) | > > > > | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | rt = 1; atexit(Prog_Clear_At_Exit); } __Except { if ( flags & PROG_EXIT_ON_ERROR ) Error_Print_N_Exit(Yo__basename(argv[0]),-1); if ( !Prog_Data_Opts ) Prog_Data_Opts = Yo_Refe(Dicto_Refs()); if ( !Prog_Data_Args ) Prog_Data_Args = Yo_Refe(Array_Void()); } return rt; } #endif ; YO_ARRAY *Prog_Argc_Argv(char *input) |
︙ | ︙ |
Changes to sar/quad.hc.
︙ | ︙ | |||
45 46 47 48 49 50 51 | #ifndef C_once_631AF050_DD3C_45AA_9B7D_1213254067C2 #define C_once_631AF050_DD3C_45AA_9B7D_1213254067C2 #include "../sar.hc" #ifdef _LIBYOYO | | | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #ifndef C_once_631AF050_DD3C_45AA_9B7D_1213254067C2 #define C_once_631AF050_DD3C_45AA_9B7D_1213254067C2 #include "../sar.hc" #ifdef _LIBYOYO #define _YO_QUADARRAY_BUILTIN #endif #ifdef _YO_QUADARRAY_BUILTIN STRUCTED_ARRAY(Qarray,YO_QUAD_ARRAY,quad_t); #else STRUCTED_ARRAY_DEF(Qarray,YO_QUAD_ARRAY,quad_t); #endif #endif /*C_once_631AF050_DD3C_45AA_9B7D_1213254067C2*/ |
Changes to tasque.hc.
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | enum { TASQUE_COMPLETE = 0, TASQUE_FAIL = 0x80000000, TASQUE_STACK_SIZE = 64*KILOBYTE, }; typedef struct _YO_TASQUE_TASK { struct _YO_TASQUE_TASK *next; tasque_proc_t task; void *obj; tasque_update_t update; void *monitor; | > > > > > > > | | 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 | enum { TASQUE_COMPLETE = 0, TASQUE_FAIL = 0x80000000, TASQUE_STACK_SIZE = 64*KILOBYTE, }; typedef struct _YO_TASQUE_PROCESSOR { thread_t thr; struct _YO_TASQUE_PROCESSOR **prev; struct _YO_TASQUE_PROCESSOR *next; } YO_TASQUE_PROCESSOR; typedef struct _YO_TASQUE_TASK { struct _YO_TASQUE_TASK *next; tasque_proc_t task; void *obj; tasque_update_t update; void *monitor; YO_TASQUE_PROCESSOR *processor; } YO_TASQUE_TASK; typedef struct _YO_TASQUE_ALERT { struct _YO_TASQUE_ALERT *next; tasque_alert_t callback; void *obj; |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | int Tasque_COUNT = 0; YO_TASQUE_TASK * volatile Tasque_Task_In = 0; YO_TASQUE_TASK * volatile Tasque_Task_Out = 0; YO_TASQUE_TASK * volatile Tasque_Task_Care = 0; YO_TASQUE_ALERT *Tasque_Alerts_List = 0; YO_THRSYNC Tasque_Lock = YO_THRSYNC_INIT; YO_THRSYNC Tasque_Out_Monitor = YO_THRSYNC_INIT; #else extern int Tasque_MAX; extern int Tasque_RESERVE; #endif void YO_TASQUE_TASK_Destruct(YO_TASQUE_TASK *tpt) #ifdef _YO_TASQUE_BUILTIN | > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | int Tasque_COUNT = 0; YO_TASQUE_TASK * volatile Tasque_Task_In = 0; YO_TASQUE_TASK * volatile Tasque_Task_Out = 0; YO_TASQUE_TASK * volatile Tasque_Task_Care = 0; YO_TASQUE_ALERT *Tasque_Alerts_List = 0; YO_THRSYNC Tasque_Lock = YO_THRSYNC_INIT; YO_THRSYNC Tasque_Out_Monitor = YO_THRSYNC_INIT; YO_THRSYNC Tasque_Out_Monitor1 = YO_THRSYNC_INIT; YO_TASQUE_PROCESSOR *Tasque_Proc_List = 0; #else extern int Tasque_MAX; extern int Tasque_RESERVE; #endif void YO_TASQUE_TASK_Destruct(YO_TASQUE_TASK *tpt) #ifdef _YO_TASQUE_BUILTIN |
︙ | ︙ | |||
116 117 118 119 120 121 122 | STRICT_REQUIRE(!tpt->next); __Unrefe(tpt->obj); __Destruct(tpt); } #endif ; | | < > | > > > > > | | > > > > > | 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 | STRICT_REQUIRE(!tpt->next); __Unrefe(tpt->obj); __Destruct(tpt); } #endif ; void Tasque_Task_Processor(YO_TASQUE_PROCESSOR **_pcs) #ifdef _YO_TASQUE_BUILTIN { int alive = 1; YO_TASQUE_TASK *t = 0; YO_TASQUE_PROCESSOR pcs; Thread_Lock(&Tasque_Lock); ++Tasque_ONCARE; ++Tasque_COUNT; pcs.next = Tasque_Proc_List; if ( pcs.next ) pcs.next->prev = &pcs.next; Tasque_Proc_List = &pcs; pcs.prev = &Tasque_Proc_List; *_pcs = &pcs; Thread_Unlock(&Tasque_Lock); while ( alive ) { Thread_Lock(&Tasque_Lock); if ( Tasque_Task_In ) { t = Slist_Pop((YO_TASQUE_TASK**)&Tasque_Task_In); STRICT_REQUIRE(Tasque_ONCARE > 0); STRICT_REQUIRE(!t->processor); t->processor = &pcs; Slist_Push((YO_TASQUE_TASK**)&Tasque_Task_Care,t); --Tasque_ONCARE; } else { if ( Tasque_ONCARE > Tasque_RESERVE ) { alive = 0; --Tasque_COUNT; --Tasque_ONCARE; if ( pcs.next ) pcs.next->prev = pcs.prev; *pcs.prev = pcs.next; pcs.prev = 0; pcs.next = 0; } else { Thread_Wait(&Tasque_Lock,10); } } Thread_Unlock(&Tasque_Lock); if ( t ) { t->task(t->obj); Thread_Lock(&Tasque_Lock); Slist_Remove((YO_TASQUE_TASK**)&Tasque_Task_Care,t); t->processor = 0; Slist_Push((YO_TASQUE_TASK**)&Tasque_Task_Out,t); t = 0; ++Tasque_ONCARE; Thread_Unlock(&Tasque_Lock); Thread_Notify(&Tasque_Out_Monitor); } } |
︙ | ︙ | |||
208 209 210 211 212 213 214 | t->callback = callback; t->obj = __Refe(obj); Slist_Push(&Tasque_Alerts_List,__Retain(t)); } #endif ; | < | < | | < | < < < < < < < < < < < < < < < < < < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 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 | t->callback = callback; t->obj = __Refe(obj); Slist_Push(&Tasque_Alerts_List,__Retain(t)); } #endif ; void Tasque_Perform_Alert() #ifdef _YO_TASQUE_BUILTIN { quad_t deadline = Get_System_Millis(); YO_TASQUE_ALERT **a; YO_TASQUE_ALERT *k; if ( Tasque_Alerts_List ) { a = &Tasque_Alerts_List; do { if ( (*a)->deadline > deadline ) a = &(*a)->next; else __Auto_Release { k = __Pool_RefPtr(*a); *a = k->next; k->next = 0; k->callback(k->obj,TASQUE_COMPLETE); } } while ( *a ); } } #endif ; int Tasque_Perform_Update(int ms, int worktime) #ifdef _YO_TASQUE_BUILTIN { int i; quad_t deadline = worktime ? Get_System_Millis() + worktime : 0; YO_TASQUE_TASK *t; if ( !Tasque_ONCARE && Tasque_COUNT < Tasque_MAX ) { YO_TASQUE_PROCESSOR * volatile p = 0; thread_t thr = Thread_Run_Sure(Tasque_Task_Processor,&p,TASQUE_STACK_SIZE); while ( !p ) Switch_to_Thread(); __Thr_Lock(&Tasque_Lock) p->thr = thr; } Tasque_Perform_Alert(); if ( !Tasque_Task_Out ) __Thr_Lock(&Tasque_Out_Monitor) { if ( Tasque_Task_In || Tasque_Task_Care ) Thread_Wait(&Tasque_Out_Monitor,ms); } do for ( i=0; i < 10 && Tasque_Task_Out; ++i ) __Auto_Release { __Thr_Lock(&Tasque_Lock) t = __Pool_RefPtr(Slist_Pop((YO_TASQUE_TASK**)&Tasque_Task_Out)); t->update(t->monitor,t->obj,TASQUE_COMPLETE); Tasque_Perform_Alert(); } while (Tasque_Task_Out && ( !deadline || Get_System_Millis() < deadline) ); Tasque_Perform_Alert(); __Thr_Lock(&Tasque_Lock) i = !!Tasque_Task_In || !!Tasque_Task_Out || !!Tasque_Task_Care || !!Tasque_Alerts_List; return i; } #endif ; void Tasque_Finish_Task_List(YO_TASQUE_TASK * volatile *lst,int status) #ifdef _YO_TASQUE_BUILTIN { YO_TASQUE_TASK *t; while ( *lst ) __Auto_Release { t = __Pool_RefPtr(Slist_Pop((YO_TASQUE_TASK**)lst)); __Thr_Lock(&Tasque_Lock) if ( t->processor ) Thread_Terminate(t->processor->thr); t->update(t->monitor,t->obj,status); } } #endif ; void Tasque_Terminate() |
︙ | ︙ | |||
313 314 315 316 317 318 319 | Tasque_RESERVE = 0; do { Thread_Notify(&Tasque_Lock); Sleep(10); } | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | Tasque_RESERVE = 0; do { Thread_Notify(&Tasque_Lock); Sleep(10); } while ( Tasque_ONCARE && t > System_Millis() ); __Thr_Lock(&Tasque_Lock) Tasque_Finish_Task_List(&Tasque_Task_Out,TASQUE_COMPLETE); Tasque_Terminate(); } #endif ; #endif /* C_once_FDCDEF27_5EA4_4C1D_99AB_1CD0A992A18A */ |
Changes to tcpip.hc.
︙ | ︙ | |||
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | void Wrk_Tcp_Recv(YO_TCP_IOT *iot) #ifdef _YO_TCPIP_BUILTIN { char *b = iot->dta; int count = iot->count; int cc = count; while ( cc ) { int q = recv(iot->skt,b,cc,0); if ( q < 0 ) { iot->count = count-cc; iot->err = Tcp_Errno(); return; } STRICT_REQUIRE( q <= cc ); cc -= q; b += q; if ( count-cc >= iot->mincount ) break; } iot->count = count-cc; | > > > > > > > > < | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | void Wrk_Tcp_Recv(YO_TCP_IOT *iot) #ifdef _YO_TCPIP_BUILTIN { char *b = iot->dta; int count = iot->count; int cc = count; iot->err = 0; while ( cc ) { int q = recv(iot->skt,b,cc,0); if ( q < 0 ) { iot->count = count-cc; iot->err = Tcp_Errno(); return; } if ( !q ) { if ( count-cc < iot->mincount ) iot->err = -1; iot->count = count-cc; return; } STRICT_REQUIRE( q <= cc ); cc -= q; b += q; if ( count-cc >= iot->mincount ) break; } iot->count = count-cc; } #endif ; void Cbk_Tcp_Recv(YO_TCPSOK *sok, YO_TCP_IOT *iot, int status) #ifdef _YO_TCPIP_BUILTIN { |
︙ | ︙ |
Changes to threads.hc.
︙ | ︙ | |||
157 158 159 160 161 162 163 | #endif /* be sure thread is running */ thread_t Thread_Run_Sure(thread_func_t func, void *o, int stacksize) #ifdef _YO_THREADS_BUILTIN { thread_t thr = Thread_Run(func,o,stacksize); | | < < < < < < < | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | #endif /* be sure thread is running */ thread_t Thread_Run_Sure(thread_func_t func, void *o, int stacksize) #ifdef _YO_THREADS_BUILTIN { thread_t thr = Thread_Run(func,o,stacksize); if ( !Thread_Is_OK(thr) ) _Thread_Raise_Error(); return thr; } #endif ; void Thread_Close(thread_t thr) #ifdef _YO_THREADS_BUILTIN |
︙ | ︙ |
Changes to webhost.hc.
︙ | ︙ | |||
433 434 435 436 437 438 439 440 441 442 443 444 445 446 | char c; for ( i = 0; i < services->count; ++i ) { YO_WEBHOST_SERVICE * svc = services->at[i]; if ( svc->prefix && Str_Starts_With(query,svc->prefix) ) { L = strlen(svc->prefix); c = query[L]; if ( !c || c == '/' ) { *script = Str_Copy_L(query,L); *pathinfo = Str_Copy(query+L); return svc; } | > | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | char c; for ( i = 0; i < services->count; ++i ) { YO_WEBHOST_SERVICE * svc = services->at[i]; if ( svc->prefix && Str_Starts_With(query,svc->prefix) ) { L = strlen(svc->prefix); if ( L > 0 && svc->prefix[L-1] == '/' ) --L; c = query[L]; if ( !c || c == '/' ) { *script = Str_Copy_L(query,L); *pathinfo = Str_Copy(query+L); return svc; } |
︙ | ︙ | |||
454 455 456 457 458 459 460 | void Webhost_Execute_Service(YO_WEBHOST_CGIST *st, char *doc_root) #ifdef _YO_WEBHOST_BUILTIN { YO_ARRAY *env; if ( !doc_root ) doc_root = st->host->doc_roots->count?st->host->doc_roots->at[0]:0; env = Webhost_Setup_Environment(doc_root,st->rqst,st->path,st->script,st->pathinfo,st->url); st->rqst->outstrm_type = Mime_String_Of_Npl(YO_MIME_HTML); | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | void Webhost_Execute_Service(YO_WEBHOST_CGIST *st, char *doc_root) #ifdef _YO_WEBHOST_BUILTIN { YO_ARRAY *env; if ( !doc_root ) doc_root = st->host->doc_roots->count?st->host->doc_roots->at[0]:0; env = Webhost_Setup_Environment(doc_root,st->rqst,st->path,st->script,st->pathinfo,st->url); st->rqst->outstrm_type = Mime_String_Of_Npl(YO_MIME_HTML); st->rqst->outstrm = __Refe(Buffer_As_File(0));//__Refe(Cfile_Temp()); st->cgi = __Refe(Cgi_Init_2(st->rqst->instrm,st->rqst->outstrm,(char**)env->at)); Tasque_Alert(0,st->svc->callback,st); } #endif ; int Webhost_CGI_Headers(YO_HTTPD_REQUEST *rqst, void *strm) |
︙ | ︙ | |||
500 501 502 503 504 505 506 507 508 509 510 511 512 513 | } } return retcode; } #endif ; void Webhost_Exit_Service(YO_WEBHOST_CGIST *st, int error) #ifdef _YO_WEBHOST_BUILTIN { int retcode = 0; __Auto_Release { | > > > > > > > > > > > > > > > > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | } } return retcode; } #endif ; void Webhost_Error_Service(YO_WEBHOST_CGIST *st, int retcode, char *text) #ifdef _YO_WEBHOST_BUILTIN { __Auto_Release { YO_HTTPD_REQUEST *rqst = st->rqst; rqst->outstrm_type = Mime_String_Of_Npl(YO_MIME_TEXT); rqst->outstrm = Buffer_As_File(Buffer_Copy(text,-1)); rqst->outstrm_length = Oj_Available(rqst->outstrm); } Httpd_Continue_Request(st->rqst,retcode); } #endif ; void Webhost_Exit_Service(YO_WEBHOST_CGIST *st, int error) #ifdef _YO_WEBHOST_BUILTIN { int retcode = 0; __Auto_Release { |
︙ | ︙ | |||
526 527 528 529 530 531 532 | } if ( retcode ) Httpd_Continue_Request(st->rqst,retcode); } #endif ; | | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | } if ( retcode ) Httpd_Continue_Request(st->rqst,retcode); } #endif ; YO_WEBHOST_CGIST *Webhost_CGI_State(YO_WEBHOST *host, YO_HTTPD_REQUEST *rqst, char *path, char *script, char *pathinfo, YO_URL *url) #ifdef _YO_WEBHOST_BUILTIN { YO_WEBHOST_CGIST *st = __Object_Dtor(sizeof(YO_WEBHOST_CGIST),YO_WEBHOST_CGIST_Destruct); st->host = __Refe(host); st->url = __Refe(url); st->rqst = __Refe(rqst); st->path = path; st->script = script; st->pathinfo = pathinfo; return st; } #endif ; #if defined __windoze && !defined _YO_WITHOUT_EXEC_CGI void Webhost_Check_CGI_Status(YO_WEBHOST_CGIST *st, int error) #ifdef _YO_WEBHOST_BUILTIN { int retcode = 0; if ( error ) return; |
︙ | ︙ | |||
686 687 688 689 690 691 692 | st->svc = __Refe(svc); Webhost_Execute_Service(st,doc_root); return 0; } } | | | 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | st->svc = __Refe(svc); Webhost_Execute_Service(st,doc_root); return 0; } } #if defined __windoze && !defined _YO_WITHOUT_EXEC_CGI if ( host->exec_root ) { path = Webhost_Find_Executable(host,url->query,&script,&pathinfo); if ( path ) return Webhost_Execute_CGI(Webhost_CGI_State(host, rqst, __Retain(path), script, pathinfo, url)); } #endif |
︙ | ︙ |
Changes to winreg.hc.
︙ | ︙ | |||
92 93 94 95 96 97 98 | wchar_t *name = opt?Str_Utf8_To_Unicode(opt):L""; wchar_t *buf = 0; DWORD ltype = REG_SZ; long err = 0; DWORD L = 0; if ( ERROR_SUCCESS != (err=RegQueryValueExW(o->hkey,name,0,<ype,0,&L)) ) | > | | > > | | | | | | | | | | | | | > | 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 | wchar_t *name = opt?Str_Utf8_To_Unicode(opt):L""; wchar_t *buf = 0; DWORD ltype = REG_SZ; long err = 0; DWORD L = 0; if ( ERROR_SUCCESS != (err=RegQueryValueExW(o->hkey,name,0,<ype,0,&L)) ) if ( err != ERROR_FILE_NOT_FOUND ) __Raise(YO_ERROR_IO, __Format("failed to query value '%s' of '%s': error %08x", (opt?opt:""),o->name,err)); if ( ltype != REG_NONE && err == ERROR_SUCCESS ) { if ( ltype != REG_SZ ) __Raise(YO_ERROR_IO, __Format("failed to query value '%s' of '%s': is not string value",(opt?opt:""),o->name)); //buf = Yo_Malloc((L+1)*sizeof(wchar_t)); buf = Yo_Malloc(L+2); buf[L/sizeof(wchar_t)] = 0; if ( ERROR_SUCCESS == (err=RegQueryValueExW(o->hkey,name,0,<ype,(LPBYTE)buf,&L)) ) ret = Str_Unicode_To_Utf8(buf); else if ( err != ERROR_FILE_NOT_FOUND ) __Raise(YO_ERROR_IO, __Format("failed to query value '%s' of '%s': error %08x", (opt?opt:""),o->name,err)); } } return ret; } #endif ; void WinReg_Set_String(YO_WINREG *o,char *opt,char *val) |
︙ | ︙ |
Changes to xjson.hc.
︙ | ︙ | |||
226 227 228 229 230 231 232 | char *Json_Format_Into(YO_BUFFER *bf, YO_XNODE *r, int flags) #ifdef _YO_JSON_BUILTIN { int indent = (flags&0xff); if ( !bf ) bf = Buffer_Init(0); Buffer_Append(bf,"{\n",2); Def_Format_Node_In_Depth(bf,r,flags|XDEF_FORMAT_JSON,indent+1); | | | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | char *Json_Format_Into(YO_BUFFER *bf, YO_XNODE *r, int flags) #ifdef _YO_JSON_BUILTIN { int indent = (flags&0xff); if ( !bf ) bf = Buffer_Init(0); Buffer_Append(bf,"{\n",2); Def_Format_Node_In_Depth(bf,r,flags|XDEF_FORMAT_JSON,indent+1); Buffer_Append(bf,"}\n",2); return (char*)bf->at; } #endif ; char *Json_Format(YO_XNODE *r, int flags) #ifdef _YO_JSON_BUILTIN |
︙ | ︙ |
Changes to yoyo.hc.
︙ | ︙ | |||
135 136 137 138 139 140 141 | # include <windef.h> # include <winbase.h> # include <excpt.h> # include <objbase.h> # include <io.h> # include <process.h> # include <malloc.h> /* alloca */ | | > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | # include <windef.h> # include <winbase.h> # include <excpt.h> # include <objbase.h> # include <io.h> # include <process.h> # include <malloc.h> /* alloca */ # if defined _MSC_VER && _MSC_VER >= 1600 # include <intrin.h> # pragma intrinsic(_ReadWriteBarrier) # endif # ifdef _PTHREADS # define _XTHREADS # ifdef __GNUC__ # include <pthread.h> # else # include "otros/winpthreads.hc" /* testing purposes only! */ |
︙ | ︙ | |||
409 410 411 412 413 414 415 | #if defined __GNUC__ # define __RwBarrier() __asm__ __volatile__ ("" ::: "memory") # define Atomic_Increment(Ptr) __sync_sub_and_fetch((i32_t volatile *)Ptr,1) # define Atomic_Decrement(Ptr) __sync_sub_and_fetch((i32_t volatile *)Ptr,1) # define Atomic_CmpXchg(Ptr,Val,Comp) __sync_bool_compare_and_swap((u32_t *volatile)Ptr,(u32_t)Comp,(u32_t)Val) # define Atomic_CmpXchg_Ptr(Ptr,Val,Comp) __sync_bool_compare_and_swap((void *volatile*)Ptr,(void*)Comp,(void*)Val) | | < | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | #if defined __GNUC__ # define __RwBarrier() __asm__ __volatile__ ("" ::: "memory") # define Atomic_Increment(Ptr) __sync_sub_and_fetch((i32_t volatile *)Ptr,1) # define Atomic_Decrement(Ptr) __sync_sub_and_fetch((i32_t volatile *)Ptr,1) # define Atomic_CmpXchg(Ptr,Val,Comp) __sync_bool_compare_and_swap((u32_t *volatile)Ptr,(u32_t)Comp,(u32_t)Val) # define Atomic_CmpXchg_Ptr(Ptr,Val,Comp) __sync_bool_compare_and_swap((void *volatile*)Ptr,(void*)Comp,(void*)Val) #elif defined _MSC_VER # define __RwBarrier() _ReadWriteBarrier() # define Atomic_Increment(Ptr) InterlockedIncrement(Ptr) # define Atomic_Decrement(Ptr) InterlockedDecrement(Ptr) # define Atomic_CmpXchg(Ptr,Val,Comp) (InterlockedCompareExchange(Ptr,Val,Comp) == (Comp)) # define Atomic_CmpXchg_Ptr(Ptr,Val,Comp) (InterlockedCompareExchangePointer(Ptr,Val,Comp) == (Comp)) #endif |
︙ | ︙ |