}
}
-void MotorEnv::outputFile (const ustring& src, const ustring& type) {
+void MotorEnv::outputFile (const ustring& src, const ustring& type, bool base64) {
if (isPlainFile (src)) {
if (! responseDone)
standardResponse (type);
- output->out_file (src);
+ if (base64)
+ output->out_file_base64 (src);
+ else
+ output->out_file (src);
} else {
if (! responseDone)
noContentResponse ();
}
}
-void MotorEnv::outputFile (const ustring& src, const ustring& type, bool finline, const ustring& dispname) {
+void MotorEnv::outputFile (const ustring& src, const ustring& type, bool finline, const ustring& dispname, bool base64) {
if (isPlainFile (src)) {
if (! responseDone)
standardResponse (type, uEmpty, dispname, finline);
- output->out_file (src);
+ if (base64)
+ output->out_file_base64 (src);
+ else
+ output->out_file (src);
} else {
if (! responseDone)
noContentResponse ();
};
virtual void doMotor (const ustring& file, const ustring& type, MotorOutput* out = NULL);
virtual void doMotorFile (const ustring& file, bool skipHead, const ustring& type, MotorOutput* out = NULL);
- virtual void outputFile (const ustring& src, const ustring& type);
- virtual void outputFile (const ustring& src, const ustring& type, bool finline, const ustring& dispname);
+ virtual void outputFile (const ustring& src, const ustring& type, bool base64 = false);
+ virtual void outputFile (const ustring& src, const ustring& type, bool finline, const ustring& dispname, bool base64 = false);
virtual void standardResponse () {
standardResponse (mimetype);
};
/*DOC:
===read-file===
- (read-file FILENAME [#serial | #named | :serial BOOL | :named BOOL] [:code ENCODING]) -> STRING
+ (read-file FILENAME [#serial | #named] [:code ENCODING]) -> STRING
(read-file [:source-serial FILENAME | :source-named FILENAME | :source-static FILENAME] [:code ENCODING]) -> STRING
*/
/*DOC:
===write-file===
- (write-file FILENAME STRING [#serial | #named | :serial BOOL | :named BOOL] [:code ENCODING]
+ (write-file FILENAME STRING [#serial | #named] [:code ENCODING]
[#crlf | :crlf BOOL]) -> NIL
*/
/*DOC:
===set-storage===
- (set-storage NAME [#create | :create BOOL]) -> NIL
+ (set-storage NAME [#create]) -> NIL
*/
//#AFUNC set-storage ml_set_storage
/*DOC:
===delete-file===
- (delete-file NAME_STORAGE [#serial | #named | :serial BOOL | :named BOOL]) -> NIL
+ (delete-file NAME_STORAGE [#serial | #named]) -> NIL
(delete-file [:target-serial FILENAME | :target-named FILENAME]) -> NIL
*/
/*DOC:
===rename-file===
- (rename-file FROM_FILE TO_FILE [#serial | #named | :serial BOOL | :named BOOL]) -> NIL
+ (rename-file FROM_FILE TO_FILE [#serial | #named]) -> NIL
*/
//#AFUNC rename-file ml_rename_file
/*DOC:
===response-motor===
- (response-motor HTMLFILE [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL] [:type MIME_TYPE] [#continue | :continue BOOL]) -> NIL
- (response-motor [:source-serial FILENAME | :source-named FILENAME | :source-static FILENAME] [:type MIME_TYPE] [#continue | :continue BOOL]) -> NIL
+ (response-motor HTMLFILE [#serial | #named | #static] [:type MIME_TYPE] [#continue]) -> NIL
+ (response-motor [:source-serial FILENAME | :source-named FILENAME | :source-static FILENAME] [:type MIME_TYPE] [#continue]) -> NIL
*/
//#AFUNC response-motor ml_response_motor
}
/*DOC:
===response-file===
- (response-file FILENAME [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL]
- [:type MIME_TYPE] [#inline | :inline BOOL] [:name NAME]) -> NIL
+ (response-file FILENAME [#serial | #named | #static] [:type MIME_TYPE] [#inline] [:name NAME] [#base64]) -> NIL
*/
//#AFUNC response-file ml_response_file
MNode* ml_response_file (MNode* cell, MlEnv* mlenv) {
-#if 0
- ResponseParam par (mlenv);
- par.proc (cell, mlenv, false);
- if (par.finline || par.dispname.length () > 0) {
- mlenv->env->outputFile (par.src, par.type, par.finline, par.dispname);
- } else {
- mlenv->env->outputFile (par.src, par.type);
- }
- if (! par.cflag)
- mlenv->breakProg ();
-#endif
MNode* arg = cell->cdr ();
StoreType storetype (mlenv);
ustring type;
ustring dispname;
bool cflag = false;
bool finline = false;
+ bool fbase64 = false;
MNodePtr t;
std::vector<MNode*> keywords;
static paramList kwlist[] = {
{CharConst ("serial"), true}, // 7
{CharConst ("named"), true}, // 8
{CharConst ("static"), true}, // 9
+ {CharConst ("base64"), true}, // 10
{NULL, 0, 0}
};
if (keywords[9] && eval_bool (keywords[9], mlenv)) // static
storetype.setStatic ();
#endif
+ if (keywords[10])
+ fbase64 = eval_bool (keywords[10], mlenv); // base64
src = storetype.src (mlenv);
if (type.empty ()) {
}
if (finline || dispname.length () > 0) {
- mlenv->env->outputFile (src, type, finline, dispname);
+ mlenv->env->outputFile (src, type, finline, dispname, fbase64);
} else {
- mlenv->env->outputFile (src, type);
+ mlenv->env->outputFile (src, type, fbase64);
}
if (! cflag)
mlenv->breakProg ();
/*DOC:
===filesize===
- (filesize FILENAME [#serial | #named | :serial BOOL | :named BOOL]) -> INTEGER or NIL
+ (filesize FILENAME [#serial | #named]) -> INTEGER or NIL
(filesize [:source-serial FILENAME | :source-named FILENAME | :source-static FILENAME]) -> INTEGER or NIL
*/
/*DOC:
===list-files===
- (list-files [#serial | #named | :serial BOOL | :named BOOL]) -> LIST_of_FILENAMES
+ (list-files [#serial | #named]) -> LIST_of_FILENAMES
*/
//#AFUNC list-files ml_list_files