diff options
author | portix <portix@gmx.net> | 2014-03-03 15:44:56 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2014-03-03 15:44:56 +0100 |
commit | 05c5a1a8ff467ae10c30433621a55da0fbc9b474 (patch) | |
tree | e7ac44d11b5165d7d97435bc14ccbf11a0e4edc5 | |
parent | a5b91346520adb5d9c8c193c4a02718eebcc0011 (diff) | |
download | dwb-05c5a1a8ff467ae10c30433621a55da0fbc9b474.zip |
Pass overwrite parameter to provide in xprovide
-rw-r--r-- | exar/exar.c | 2 | ||||
-rw-r--r-- | src/scripts.c | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/exar/exar.c b/exar/exar.c index d06ffdd7..6c52eed6 100644 --- a/exar/exar.c +++ b/exar/exar.c @@ -469,7 +469,7 @@ ftw_pack(const char *fpath, const struct stat *st, int tf) LOG(3, "Skipping output file %s\n", s_out_path); return 0; } - + filename = strrchr(stripped, '/'); if (filename == NULL) diff --git a/src/scripts.c b/src/scripts.c index 86bf691d..840b3d8b 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -58,7 +58,9 @@ "var xinclude=_xinclude.bind(this,this.path);"\ "var xgettext=_xgettext.bind(this,this.path);"\ "const script=this;"\ -"if(!exports.id)Object.defineProperty(exports,'id',{value:script.generateId()});/*<dwb*/" +"if(!exports.id)Object.defineProperty(exports,'id',{value:script.generateId()});"\ +"var xprovide=function(n,m,o){provide(n+exports.id,m,o);};"\ +"var xrequire=function(n){return require(n+exports.id);};/*<dwb*/" #define SCRIPT_TEMPLATE_END "%s/*dwb>*/}catch(e){script.debug(e);};" @@ -2440,6 +2442,31 @@ error_out: return content; } /** + * Same as {@link provide}, but can only be called from an archive. The module + * can only be required by the same archive + * inside an archive. + * + * @name xprovide + * @function + * @param {String} name The name of the module + * @param {Object} module The module + * @param {Boolean} [overwrite] + * Whether to overwrite existing module with + * the same name, default false + * */ +/** + * Same as {@link require}, but can only be called from an archive and xrequire + * is always synchronous. Only modules provided in the same archive can be + * loaded with xrequire. + * + * @name xrequire + * @function + * @param {String} name The name of the module + * + * @returns {Object} + * The module + * */ +/** * Load a textfile from an archive. This function can only be called from scripts * inside an archive. * |