|
|
| version 1.91, 2001/07/07 17:59:02 | version 1.93, 2001/07/18 10:06:04 |
|---|---|
| Line 154 static Table *fill_month_days(Request& r | Line 154 static Table *fill_month_days(Request& r |
| for(int _day=1-weekDay1; _day<=monthDays;) { | for(int _day=1-weekDay1; _day<=monthDays;) { |
| Array& row=*new(pool) Array(pool, 7); | Array& row=*new(pool) Array(pool, 7); |
| for(int wday=0; wday<7; wday++, _day++) { | for(int wday=0; wday<7; wday++, _day++) { |
| String *cell; | String *cell=new(pool) String(pool); |
| if(_day>=1 && _day<=monthDays) { | if(_day>=1 && _day<=monthDays) { |
| char *buf=(char *)malloc(2+1); | char *buf=(char *)malloc(2+1); |
| sprintf(buf, "%02d", _day); | cell->APPEND_CLEAN(buf, sprintf(buf, "%02d", _day), |
| cell=new(pool) String(pool, buf); | method_name.origin().file, method_name.origin().line); |
| } else | } |
| cell=new(pool) String(pool); | |
| row+=cell; | row+=cell; |
| } | } |
| *result+=&row; | *result+=&row; |
| Line 200 static Table *fill_week_days(Request& r, | Line 199 static Table *fill_week_days(Request& r, |
| for(int curWeekDay=0; curWeekDay<7; curWeekDay++, t+=SECS_PER_DAY) { | for(int curWeekDay=0; curWeekDay<7; curWeekDay++, t+=SECS_PER_DAY) { |
| tm *tmOut=localtime(&t); | tm *tmOut=localtime(&t); |
| Array& row=*new(pool) Array(pool, 4); | Array& row=*new(pool) Array(pool, 4); |
| {char *buf=(char *)malloc(4+1); sprintf(buf, "%04d", 1900+tmOut->tm_year); row+=new(pool) String(pool, buf);} | #define WDFILL(size, value) { \ |
| {char *buf=(char *)malloc(2+1); sprintf(buf, "%02d", 1+tmOut->tm_mon); row+=new(pool) String(pool, buf);} | char *buf=(char *)malloc(size+1); \ |
| {char *buf=(char *)malloc(2+1); sprintf(buf, "%02d", tmOut->tm_mday); row+=new(pool) String(pool, buf);} | String *cell=new(pool) String(pool); \ |
| {char *buf=(char *)malloc(2+1); sprintf(buf, "%02d", tmOut->tm_wday); row+=new(pool) String(pool, buf);} | cell->APPEND_CLEAN(buf, sprintf(buf, "%0"#size"d", value), \ |
| method_name.origin().file, \ | |
| method_name.origin().line); \ | |
| row+=cell; \ | |
| } | |
| WDFILL(4, 1900+tmOut->tm_year); | |
| WDFILL(2, 1+tmOut->tm_mon); | |
| WDFILL(2, tmOut->tm_mday); | |
| WDFILL(2, tmOut->tm_wday); | |
| *result+=&row; | *result+=&row; |
| } | } |
| Line 213 static Table *fill_week_days(Request& r, | Line 220 static Table *fill_week_days(Request& r, |
| static void _calendar(Request& r, const String& method_name, MethodParams *params) { | static void _calendar(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| const String& what=params->as_string(0, "'what' must be rus|eng"); | const String& what=params->as_string(0, "format must be strig"); |
| bool rus=false; | bool rus=false; |
| if(what == "rus") | if(what=="rus") |
| rus=true; | rus=true; |
| else if(what == "eng") | else if(what=="eng") |
| rus=false; | rus=false; |
| else | else |
| PTHROW(0, 0, | PTHROW(0, 0, |
| Line 284 static void _save(Request& r, const Stri | Line 291 static void _save(Request& r, const Stri |
| sdata.cstr(), sdata.size(), true); | sdata.cstr(), sdata.size(), true); |
| } | } |
| static void _count(Request& r, const String&, MethodParams *) { | static void _count(Request& r, const String& method_name, MethodParams *) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& value=*new(pool) VInt(pool, static_cast<VTable *>(r.self)->table().size()); | Value& value=*new(pool) VInt(pool, static_cast<VTable *>(r.self)->table().size()); |
| value.set_name(method_name); | |
| r.write_no_lang(value); | r.write_no_lang(value); |
| } | } |
| static void _line(Request& r, const String& method_name, MethodParams *) { | static void _line(Request& r, const String& method_name, MethodParams *) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& value=*new(pool) VInt(pool, 1+static_cast<VTable *>(r.self)->table().current()); | Value& value=*new(pool) VInt(pool, 1+static_cast<VTable *>(r.self)->table().current()); |
| value.set_name(method_name); | |
| r.write_no_lang(value); | r.write_no_lang(value); |
| } | } |
| Line 304 static void _offset(Request& r, const St | Line 313 static void _offset(Request& r, const St |
| table.shift(r.process(offset_expr).as_int()); | table.shift(r.process(offset_expr).as_int()); |
| } else { | } else { |
| Value& value=*new(pool) VInt(pool, table.current()); | Value& value=*new(pool) VInt(pool, table.current()); |
| value.set_name(method_name); | |
| r.write_no_lang(value); | r.write_no_lang(value); |
| } | } |
| } | } |