*/
/*DOC:
-===$neon==
- ($neon [#http | #https] Host Port
- [:proxy '(HOSTNAME . PORT)] [:proxy-user '(ID . PASSWORD)]
- [:on-error FUNCTION]
- [#no-verify]
- [SUBFUNCTION...]) -> LAST VALUE
+===$neon, %neon==
+ (%neon [#http | #https] Host Port
+ :module-store VAR
+ :proxy '(HOSTNAME . PORT) :proxy-user '(ID . PASSWORD)
+ :on-error FUNCTION
+ #no-verify
+ [SUBFUNCTION...]) -> LAST_VALUE
*/
//#MFUNC $neon ml_neon cMLNeonID
+//#MFUNC %neon ml_neon cMLNeonID
MNode* ml_neon (MNode* cell, MlEnv* mlenv) {
MNode* arg = cell->cdr ();
NeonInit.init ();
MLNeon obj (mlenv);
+ MNodePtr objStore;
MNodePtr errfn;
MNodePtr ans;
MNodePtr t;
{CharConst ("proxy-user"), false}, // 3
{CharConst ("on-error"), false}, // 4
{CharConst ("no-verify"), true}, // 5
+ {CharConst ("module-store"), false}, // 6
{NULL, 0, 0}
};
}
evkw (4, errfn); // 4:on-error
evkw_bool (5, obj.fnoverify); // 5:no-verify
+ if (evkw (6, t)) { // 6:module-store
+ if (isSym (t ())) {
+ objStore = newMNode_libobj (&obj);
+ mlenv->setVar (t ()->to_string (), objStore ());
+ } else {
+ throw (t ()->dump_string_short () + uErrorBadParam);
+ }
+ }
if (! matchHostname (obj.host))
throw (obj.host + ": bad hostname.");
}
}
mlenv->stopBreak (cell->car ());
+ if (objStore () && objStore ()->isLibObj ())
+ objStore ()->type = MNode::MC_NIL; // 強制NIL化
return ans.release ();
}
/*DOC:
====http-request====
- (http-request PATH [#get] [#post] [#put] [#delete] [#head] [#file]
- [:basic-user '(ID . PASSWORD)]
- [:query '((NAME . VALUE) ...)] [:get-query '((NAME . VALUE) ...)] [#no-encode]
- [:post-file-serial '((NAME . FILE) ...)]
- [:post-file-named '((NAME . FILE) ...)]
- [:post-file-static '((NAME . FILE) ...)]
- [:raw-query TEXT] [:raw-file-serial FILE] [:raw-file-named FILE] [:raw-file-static FILE]
- [:query-type MIMETYPE]
- [:cookie '((NAME . VALUE) ...)] [:header '((NAME . VALUE) ...)]
- [#sjis] [#euc-jp] [:iconv NAME]
+ (http-request PATH [#get | #post | #put | #delete | #head | #file]
+ :basic-user '(ID . PASSWORD)
+ :query '((NAME . VALUE) ...)
+ :get-query '((NAME . VALUE) ...)
+ #no-encode
+ :post-file-serial '((NAME . FILE) ...)
+ :post-file-named '((NAME . FILE) ...)
+ :post-file-static '((NAME . FILE) ...)
+ :raw-query TEXT :raw-file-serial FILE :raw-file-named FILE :raw-file-static FILE
+ :query-type MIMETYPE
+ :cookie '((NAME . VALUE) ...) :header '((NAME . VALUE) ...)
+ [#sjis | #euc-jp | :iconv NAME]
+ :module MODULE
*/
-//#SFUNC http-request ml_neon_http_request
+//#SFUNC http-request ml_neon_http_request $neon
+//#SFUNC http-request ml_neon_http_request %neon
MNode* ml_neon_http_request (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
{CharConst ("sjis"), true}, // 19
{CharConst ("euc-jp"), true}, // 20
{CharConst ("iconv"), false}, // 21
+ {CharConst ("module"), false}, // 22
{NULL, 0, 0}
};
- obj->query.reset (new NeonQuery (obj->session->get (), mlenv));
setParams (arg, 1, ¶ms, kwlist, &keywords, NULL);
+ if (evkw (22, t)) // 22:module
+ assignNLNeon (obj, t ());
+ obj->query.reset (new NeonQuery (obj->session->get (), mlenv));
obj->query->path = eval_str (params[0], mlenv);
if (evkw_bool (0, f)) // 0:get
obj->query->method = NeonQuery::METHOD_GET;
/*DOC:
====http-status====
- (http-status) -> NUMBER
+ (http-status :module MODULE) -> NUMBER
*/
-//#SFUNC http-status ml_neon_http_status
+//#SFUNC http-status ml_neon_http_status $neon
+//#SFUNC http-status ml_neon_http_status %neon
MNode* ml_neon_http_status (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
+ MNodePtr t;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
- if (arg)
- throw (uErrorWrongNumber);
+ setParams (arg, 0, NULL, kwlist, &keywords, NULL);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
+
if (! obj->query)
return NULL;
/*DOC:
====http-response====
- (http-response) -> STRING
+ (http-response :module MODULE) -> STRING
*/
-//#SFUNC http-response ml_neon_http_response
+//#SFUNC http-response ml_neon_http_response $neon
+//#SFUNC http-response ml_neon_http_response %neon
MNode* ml_neon_http_response (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
ustring ans;
+ MNodePtr t;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 0, NULL, kwlist, &keywords, NULL);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
- if (arg)
- throw (uErrorWrongNumber);
if (! obj->query)
return NULL;
/*DOC:
====http-response-file====
- (http-response-file FILENAME) -> NIL
+ (http-response-file FILENAME :module MODULE) -> NIL
*/
-//#SFUNC http-response-file ml_neon_http_response_file
+//#SFUNC http-response-file ml_neon_http_response_file $neon
+//#SFUNC http-response-file ml_neon_http_response_file %neon
MNode* ml_neon_http_response_file (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
ustring name;
ustring tgt, tmp;
+ MNodePtr t;
+ std::vector<MNode*> params;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 1, ¶ms, kwlist, &keywords, NULL);
+ name = eval_str (params[0], mlenv);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
- if (! arg)
- throw (uErrorWrongNumber);
- name = eval_str (arg->car (), mlenv);
- nextNode (arg);
- if (arg)
- throw (uErrorWrongNumber);
if (! obj->query)
return NULL;
/*DOC:
====http-response-output====
- (http-response-output [#continue | :continue BOOL]) -> NIL
+ (http-response-output :module MODULE #continue) -> NIL
*/
-//#SFUNC http-response-output ml_neon_http_response_output
+//#SFUNC http-response-output ml_neon_http_response_output $neon
+//#SFUNC http-response-output ml_neon_http_response_output %neon
MNode* ml_neon_http_response_output (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
bool cflag = false;
+ MNodePtr t;
std::vector<MNode*> keywords;
static paramList kwlist[] = {
- {CharConst ("continue"), true},
+ {CharConst ("continue"), true}, // 0
+ {CharConst ("module"), false}, // 1
{NULL, 0, 0}
};
setParams (arg, 0, NULL, kwlist, &keywords, NULL);
- if (keywords[0] && eval_bool (keywords[0], mlenv))
- cflag = true;
+ evkw_bool (0, cflag);
+ if (evkw (1, t)) // 1:module
+ assignNLNeon (obj, t ());
+
if (! obj->query)
return NULL;
/*DOC:
====get-cookie====
- (get-cookie NAME) -> STRING
+ (get-cookie NAME :module MODULE) -> STRING
*/
-//#SFUNC get-cookie ml_neon_get_cookie
+//#SFUNC get-cookie ml_neon_get_cookie $neon
+//#SFUNC get-cookie ml_neon_get_cookie %neon
MNode* ml_neon_get_cookie (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
ustring name;
+ MNodePtr t;
+ std::vector<MNode*> params;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 1, ¶ms, kwlist, &keywords, NULL);
+ name = eval_str (params[0], mlenv);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
- if (! arg)
- throw (uErrorWrongNumber);
- name = eval_str (arg->car (), mlenv);
- nextNode (arg);
- if (arg)
- throw (uErrorWrongNumber);
if (! obj->query)
return NULL;
/*DOC:
====get-cookie-all====
- (get-cookie-all) -> LIST of (NAME . VALUE)
+ (get-cookie-all :module MODULE) -> LIST of (NAME . VALUE)
*/
-//#SFUNC get-cookie-all ml_neon_get_cookie_all
+//#SFUNC get-cookie-all ml_neon_get_cookie_all $neon
+//#SFUNC get-cookie-all ml_neon_get_cookie_all %neon
MNode* ml_neon_get_cookie_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
+ MNodePtr t;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 0, NULL, kwlist, &keywords, NULL);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
- if (arg)
- throw (uErrorWrongNumber);
if (! obj->query)
return NULL;
/*DOC:
====http-content-type====
- (http-content-type) -> STRING
+ (http-content-type :module MODULE) -> STRING
*/
-//#SFUNC http-content-type ml_neon_http_content_type
+//#SFUNC http-content-type ml_neon_http_content_type $neon
+//#SFUNC http-content-type ml_neon_http_content_type %neon
MNode* ml_neon_http_content_type (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
+ MNodePtr t;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 0, NULL, kwlist, &keywords, NULL);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
if (! obj->query)
return NULL;
/*DOC:
====http-get-header====
- (http-get-header NAME) -> STRING
+ (http-get-header NAME :module MODULE) -> STRING
*/
-//#SFUNC http-get-header ml_neon_http_get_header
+//#SFUNC http-get-header ml_neon_http_get_header $neon
+//#SFUNC http-get-header ml_neon_http_get_header %neon
MNode* ml_neon_http_get_header (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
ustring name;
ustring u;
+ MNodePtr t;
+ std::vector<MNode*> params;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 1, ¶ms, kwlist, &keywords, NULL);
+ name = eval_str (params[0], mlenv);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
- if (! arg)
- throw (uErrorWrongNumber);
- name = eval_str (arg->car (), mlenv);
- nextNode (arg);
- if (arg)
- throw (uErrorWrongNumber);
if (! obj->query)
return NULL;
/*DOC:
====http-get-header-all====
- (http-get-header-all) -> LIST of (NAME . VALUE)
+ (http-get-header-all :module MODULE) -> LIST of (NAME . VALUE)
*/
-//#SFUNC http-get-header-all ml_neon_http_get_header_all
+//#SFUNC http-get-header-all ml_neon_http_get_header_all $neon
+//#SFUNC http-get-header-all ml_neon_http_get_header_all %neon
MNode* ml_neon_http_get_header_all (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
MNode* arg = cell->cdr ();
MLNeon* obj = (MLNeon*)mobj;
+ MNodePtr t;
+ std::vector<MNode*> keywords;
+ static paramList kwlist[] = {
+ {CharConst ("module"), false}, // 0
+ {NULL, 0, 0}
+ };
+
+ setParams (arg, 0, NULL, kwlist, &keywords, NULL);
+ if (evkw (0, t)) // 0:module
+ assignNLNeon (obj, t ());
- if (arg)
- throw (uErrorWrongNumber);
if (! obj->query)
return NULL;