|
|
| version 1.7, 2001/03/12 20:55:14 | version 1.9, 2001/03/12 21:18:00 |
|---|---|
| Line 103 static void _offset(Request& r, const St | Line 103 static void _offset(Request& r, const St |
| Table& table=r.self->as_vtable().table(); | Table& table=r.self->as_vtable().table(); |
| if(params->size()) { | if(params->size()) { |
| if(int size=table.size()) { | if(int size=table.size()) { |
| int offset=static_cast<int>( | int offset= |
| r.process(*static_cast<Value *>(params->get(0))).get_double()); | (int)r.process(*static_cast<Value *>(params->get(0))).get_double(); |
| table.set_current((table.get_current()+offset+size)%size); | table.set_current((table.get_current()+offset+size)%size); |
| } | } |
| } else { | } else { |
| Line 137 static void _menu(Request& r, const Stri | Line 137 static void _menu(Request& r, const Stri |
| } | } |
| } | } |
| static void _empty(Request& r, const String&, Array *params) { | |
| Table& table=r.self->as_vtable().table(); | |
| if(table.size()==0) { | |
| Value& value=r.process(*static_cast<Value *>(params->get(0))); | |
| r.write_pass_lang(value); | |
| } else if(params->size()==2) { | |
| Value& value=r.process(*static_cast<Value *>(params->get(1))); | |
| r.write_pass_lang(value); | |
| } | |
| } | |
| void initialize_table_class(Pool& pool, VClass& vclass) { | void initialize_table_class(Pool& pool, VClass& vclass) { |
| // ^table.set[data] ^table.set[nameless;data] | // ^table.set[data] ^table.set[nameless;data] |
| vclass.add_native_method("set", _set, 1, 2); | vclass.add_native_method("set", _set, 1, 2); |
| Line 155 void initialize_table_class(Pool& pool, | Line 166 void initialize_table_class(Pool& pool, |
| // ^table.menu{code} ^table.menu{code}[delim] | // ^table.menu{code} ^table.menu{code}[delim] |
| vclass.add_native_method("menu", _menu, 1, 2); | vclass.add_native_method("menu", _menu, 1, 2); |
| // ^table.empty{code-when-empty} ^table.empty{code-when-empty}{code-when-not} | |
| vclass.add_native_method("empty", _empty, 1, 2); | |
| } | } |