|
|
| version 1.39, 2008/06/26 15:00:42 | version 1.41, 2008/09/04 13:15:36 |
|---|---|
| Line 44 static void _length(Request& r, MethodPa | Line 44 static void _length(Request& r, MethodPa |
| static void _pos(Request& r, MethodParams& params) { | static void _pos(Request& r, MethodParams& params) { |
| // just checking for consistency | // just checking for consistency |
| params.as_no_junction(0, "substr must not be code"); | params.as_no_junction(0, "substr must not be code"); |
| if(params.count()>1){ | |
| ssize_t offset=params.as_int(1, "n must be int", r); | |
| if(offset<0) | |
| throw Exception(PARSER_RUNTIME, | |
| 0, | |
| "n(%d) must be >=0", offset); | |
| } | |
| // never found | // never found |
| r.write_no_lang(*new VInt(-1)); | r.write_no_lang(*new VInt(-1)); |
| } | } |
| Line 167 MVoid::MVoid(): Methoded("void") { | Line 174 MVoid::MVoid(): Methoded("void") { |
| add_native_method("length", Method::CT_DYNAMIC, _length, 0, 0); | add_native_method("length", Method::CT_DYNAMIC, _length, 0, 0); |
| // ^void.pos[substr] | // ^void.pos[substr] |
| add_native_method("pos", Method::CT_DYNAMIC, _pos, 1, 1); | // ^void.pos[substr](n) |
| add_native_method("pos", Method::CT_DYNAMIC, _pos, 1, 2); | |
| // ^void.int[] | // ^void.int[] |
| // ^void.int(default) | // ^void.int(default) |
| Line 181 MVoid::MVoid(): Methoded("void") { | Line 189 MVoid::MVoid(): Methoded("void") { |
| // ^void.bool(default) | // ^void.bool(default) |
| add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1); | add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1); |
| // ^sql[query] | // ^void:sql{query} |
| add_native_method("sql", Method::CT_STATIC, _sql, 1, 2); | add_native_method("sql", Method::CT_STATIC, _sql, 1, 2); |
| // ^void.left() ^void.right() | // ^void.left() ^void.right() |