|
|
| version 1.31, 2001/04/25 10:25:31 | version 1.31.2.2, 2001/04/27 16:48:19 |
|---|---|
| Line 8 | Line 8 |
| $Id$ | $Id$ |
| */ | */ |
| #include "classes.h" | |
| #include "pa_request.h" | #include "pa_request.h" |
| #include "_file.h" | |
| #include "pa_vfile.h" | #include "pa_vfile.h" |
| #include "pa_table.h" | #include "pa_table.h" |
| #include "pa_vint.h" | #include "pa_vint.h" |
| #include "pa_exec.h" | #include "pa_exec.h" |
| // consts | // defines |
| const int FIND_MONKEY_MAX_HOPS=10; | #define FILE_CLASS_NAME "file" |
| // global var | // class |
| VStateless_class *file_class; | class MFile : public Methoded { |
| public: | |
| MFile(Pool& pool); | |
| bool used_directly() { return true; } | |
| }; | |
| // consts | |
| const int FIND_MONKEY_MAX_HOPS=10; | |
| // methods | // methods |
| Line 237 static void _cgi(Request& r, const Strin | Line 245 static void _cgi(Request& r, const Strin |
| } | } |
| } | } |
| // initialize | // constructor |
| MFile::MFile(Pool& pool) : Methoded(pool) { | |
| set_name(NEW String(pool, FILE_CLASS_NAME)); | |
| void initialize_file_class(Pool& pool, VStateless_class& vclass) { | |
| // ^save[file-name] | // ^save[file-name] |
| vclass.add_native_method("save", Method::CT_DYNAMIC, _save, 1, 1); | add_native_method("save", Method::CT_DYNAMIC, _save, 1, 1); |
| // ^delete[file-name] | // ^delete[file-name] |
| vclass.add_native_method("delete", Method::CT_STATIC, _delete, 1, 1); | add_native_method("delete", Method::CT_STATIC, _delete, 1, 1); |
| // ^find[file-name] | // ^find[file-name] |
| // ^find[file-name]{when-not-found} | // ^find[file-name]{when-not-found} |
| vclass.add_native_method("find", Method::CT_STATIC, _find, 1, 2); | add_native_method("find", Method::CT_STATIC, _find, 1, 2); |
| // ^load[disk-name] | // ^load[disk-name] |
| // ^load[disk-name;user-name] | // ^load[disk-name;user-name] |
| vclass.add_native_method("load", Method::CT_DYNAMIC, _load, 1, 2); | add_native_method("load", Method::CT_DYNAMIC, _load, 1, 2); |
| // ^stat[disk-name] | // ^stat[disk-name] |
| vclass.add_native_method("stat", Method::CT_DYNAMIC, _stat, 1, 1); | add_native_method("stat", Method::CT_DYNAMIC, _stat, 1, 1); |
| // ^exec[file-name] | // ^exec[file-name] |
| // ^exec[file-name;env hash] | // ^exec[file-name;env hash] |
| // ^exec[file-name;env hash;1cmd;2line;3ar;4g;5s] | // ^exec[file-name;env hash;1cmd;2line;3ar;4g;5s] |
| vclass.add_native_method("cgi", Method::CT_DYNAMIC, _cgi, 1, 2+5); | add_native_method("cgi", Method::CT_DYNAMIC, _cgi, 1, 2+5); |
| } | |
| // global variable | |
| Methoded *file_class; | |
| // creator | |
| Methoded *MFile_create(Pool& pool) { | |
| return new(pool) MFile(pool); | |
| } | } |