--- parser3/src/classes/file.C 2001/04/28 15:22:38 1.35 +++ parser3/src/classes/file.C 2001/07/07 16:38:01 1.39 @@ -5,8 +5,9 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: file.C,v 1.35 2001/04/28 15:22:38 paf Exp $ + $Id: file.C,v 1.39 2001/07/07 16:38:01 parser Exp $ */ +static const char *RCSId="$Id: file.C,v 1.39 2001/07/07 16:38:01 parser Exp $"; #include "classes.h" #include "pa_request.h" @@ -43,7 +44,7 @@ const int FIND_MONKEY_MAX_HOPS=10; // methods static void _save(Request& r, const String&, MethodParams *params) { - Value& vfile_name=params->get_no_junction(0, "file name must not be code"); + Value& vfile_name=params->as_no_junction(0, "file name must not be code"); // save static_cast(r.self)->save(r.absolute(vfile_name.as_string())); @@ -51,7 +52,7 @@ static void _save(Request& r, const Stri static void _delete(Request& r, const String&, MethodParams *params) { Pool& pool=r.pool(); - Value& vfile_name=params->get_no_junction(0, "file name must not be code"); + Value& vfile_name=params->as_no_junction(0, "file name must not be code"); // unlink file_delete(pool, r.absolute(vfile_name.as_string())); @@ -59,7 +60,7 @@ static void _delete(Request& r, const St static void _find(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - Value& vfile_name=params->get_no_junction(0, "file name must not be code"); + Value& vfile_name=params->as_no_junction(0, "file name must not be code"); const String &lfile_name=vfile_name.as_string(); @@ -83,14 +84,14 @@ static void _find(Request& r, const Stri // not found if(params->size()==2) { - Value& not_found_code=params->get_junction(1, "not-found param must be code"); + Value& not_found_code=params->as_junction(1, "not-found param must be code"); r.write_pass_lang(r.process(not_found_code)); } } static void _load(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - Value& vfile_name=params->get_no_junction(0, "file name must not be code"); + Value& vfile_name=params->as_no_junction(0, "file name must not be code"); const String& lfile_name=vfile_name.as_string(); @@ -106,7 +107,7 @@ static void _load(Request& r, const Stri static void _stat(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - Value& vfile_name=params->get_no_junction(0, "file name must not be code"); + Value& vfile_name=params->as_no_junction(0, "file name must not be code"); const String& lfile_name=vfile_name.as_string(); @@ -128,16 +129,11 @@ static void pass_cgi_header_attribute(Ar hash.put(string.mid(0, colon_pos), new(string.pool()) VString(string.mid(colon_pos+1, string.size()))); } -/** - ^exec[file-name] - ^exec[file-name;env hash] - ^exec[file-name;env hash;cmd;line;arg;s] - @todo fix `` in perl - they produced flipping consoles and no output to perl -*/ +/// @todo fix `` in perl - they produced flipping consoles and no output to perl static void _cgi(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - Value& vfile_name=params->get_no_junction(0, "file name must not be code"); + Value& vfile_name=params->as_no_junction(0, "file name must not be code"); const String& script_name=r.absolute(vfile_name.as_string()); @@ -186,7 +182,7 @@ static void _cgi(Request& r, const Strin #endif if(params->size()>1) { - Value& venv=params->get_no_junction(1, "env must not be code"); + Value& venv=params->as_no_junction(1, "env must not be code"); if(Hash *user_env=venv.get_hash()) user_env->for_each(append_env_pair, &env); else @@ -277,9 +273,9 @@ MFile::MFile(Pool& apool) : Methoded(apo // ^stat[disk-name] add_native_method("stat", Method::CT_DYNAMIC, _stat, 1, 1); - // ^exec[file-name] - // ^exec[file-name;env hash] - // ^exec[file-name;env hash;1cmd;2line;3ar;4g;5s] + // ^cgi[file-name] + // ^cgi[file-name;env hash] + // ^cgi[file-name;env hash;1cmd;2line;3ar;4g;5s] add_native_method("cgi", Method::CT_DYNAMIC, _cgi, 1, 2+5); }