diff --git a/.appveyor.yml b/.appveyor.yml index 2b1a075..8a722fc 100755 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ environment: - version: 20180109 + version: 20180127 affix: xdhq matrix: - nodejs_version: "4" diff --git a/CHANGELOG.md b/CHANGELOG.md index 313c1e9..8bba39a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,10 @@ -Changelog for the *XDHTML* wrappers. \ No newline at end of file +*Changelog* for the *XDHTML* wrappers. + +2018-01-14: +- *xdhqnjs* + - all the files served by the *httpd* server are automatically now relative to the directory containing the main *JS* script; it's no more required to give this directory as parameter of the `launch(...)` method, + +2018-01-13: +- *xdhqnjs* + - replacing the *cast* system handling with a system based on *CSS* styles and classes, + - adding functions to (en|dis)able elements (including styles). diff --git a/Makefile b/Makefile index 554cb55..dcd1461 100644 --- a/Makefile +++ b/Makefile @@ -43,9 +43,9 @@ mods += csdbns csdcmn csdmns csdmxb csdmxs mods += csdscb mods += sclargmnt sclmisc sclerror scllocale sclrgstry mods += scln4a sclnjs -mods += prtcl server -mods += registry treep xdhp xdh_cmn xdh_dws -mods += xdh_ups +mods += prtcl proxy prxy_cmn prxy_recv prxy_send +mods += tree +mods += registry treep xdhp pmods += pllio @@ -396,7 +396,7 @@ ifeq ("$(target)","$(Android)") rm -rf *.d endif -copt += -DVERSION=\""20180109"\" +copt += -DVERSION=\""20180127"\" copt += -DCOPYRIGHT_YEARS=\""2017"\" copt += -DIDENTIFIER=\""d6a723cb-e88f-4f2f-b429-3adc207f1d62"\" diff --git a/XDHq.js b/XDHq.js index 116b547..590b739 100755 --- a/XDHq.js +++ b/XDHq.js @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2017 Claude SIMON (http://q37.info/contact/). + Copyright (C) 2017 Claude SIMON (http://q37.info/contact/). This file is part of XDHq. @@ -36,12 +36,12 @@ if (process.env.EPEIOS_SRC) { } else { componentPath = '~/bin/'; epeiosPath = "~/hg/epeios/tools/"; - xslPath = path.join( epeiosToolsPath, "xdhq/servers/" ); + xslPath = path.join(epeiosToolsPath, "xdhq/servers/"); } njsq = require(componentPath + 'njsq.node'); } else { - njsq = require('njsq'); - componentPath = __dirname; + njsq = require('njsq'); + componentPath = __dirname; } componentFilename = path.join(componentPath, affix + "njs").replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/ /g, "\\ "); @@ -50,134 +50,154 @@ module.exports = njsq; class Tree { constructor() { - njsq._wrapper(xdhq, 1, this ); + njsq._call(xdhq, 1, this); } pushTag(name) { - njsq._wrapper(xdhq, 3, this, name); + njsq._call(xdhq, 3, this, name); } popTag() { - njsq._wrapper(xdhq, 4, this); + njsq._call(xdhq, 4, this); } - putValue( value ) { - njsq._wrapper(xdhq, 5, this, value.toString()); + putValue(value) { + njsq._call(xdhq, 5, this, value.toString()); } putAttribute(name, value) { - njsq._wrapper(xdhq, 6, this, name, value.toString()); + njsq._call(xdhq, 6, this, name, value.toString()); } } -function pushLabelAndItem(labelAndItem, itemType, labels, items) { - if ((labelAndItem instanceof Array) && (labelAndItem.length === 2) && (typeof labelAndItem[0] === "string") && (typeof labelAndItem[1] === itemType)) { - labels.push(labelAndItem[0]); - items.push(labelAndItem[1]); - } else - throw ("Error in parameters."); +// {'a': b, 'c': d, 'e': f} -> ['a','c','e'] [b,d,f] +function split(keysAndValues, keys, values) { + for (var prop in keysAndValues) { + keys.push(prop); + values.push(keysAndValues[prop]); + } } -// '[a,b],[c,d],[e,f]' => '[a,c,e],[b,d,f]' -function pushLabelsAndItems(labelsAndItems, itemType, labels, items) { - var length = labelsAndItems.length; +// ['a', 'b', 'c'] ['d', 'e', 'f'] -> { 'a': 'd', 'b': 'e', 'c': 'f' } +function unsplit(keys, values) { + var i = 0; + var keysValues = {}; - while (length--) { - pushLabelAndItem(labelsAndItems[length], itemType, labels, items); + while (i < keys.length) { + keysValues[keys[i]] = values[i]; + i++; } -} -function nop() { + return keysValues; } -function normalize(callback) { - if (typeof callback === "undefined") - return nop; - else - return callback; +// 'key', value -> { 'key': value } +function merge(key, value) { + var keyValue = {}; + + keyValue[key] = value; + + return keyValue; } class XDH { alert(message, callback) { - njsq._wrapper(xdhq, 9, this, message, normalize(callback)); + njsq._call(xdhq, 9, this, message, callback); } confirm(message, callback) { - njsq._wrapper(xdhq, 10, this, message, (result) => normalize(callback)( result == "true" )); + njsq._call(xdhq, 10, this, message, (result) => callback(result == "true")); } setLayout(id, tree, xslFilename, callback) { - njsq._wrapper(xdhq, 11, this, id, tree, xslFilename, normalize(callback)); + njsq._call(xdhq, 11, this, id, tree, xslFilename, callback); } - getContents(ids, callback ) { - njsq._wrapper(xdhq, 12, this, ids, normalize( callback) ); + getContents(ids, callback) { + njsq._call(xdhq, 12, this, ids, + (contents) => callback(unsplit(ids, contents)) + ); } - getContent(id, callback ) { - return this.getContents([id], (result) => { normalize(callback)(result[0]); } ); + getContent(id, callback) { + return this.getContents([id], (result) => { callback(result[id]); }); } setContents(idsAndContents, callback) { - var ids = new Array(); - var contents = new Array(); + var ids = []; + var contents = []; - pushLabelsAndItems(idsAndContents, "string", ids, contents); + split(idsAndContents, ids, contents); - njsq._wrapper(xdhq, 13, this, ids, contents, normalize(callback)); + njsq._call(xdhq, 13, this, ids, contents, callback); } setContent(id, content, callback) { - return this.setContents([[id,content]], normalize(callback)); + return this.setContents(merge(id, content), callback); } dressWidgets(id, callback) { - njsq._wrapper(xdhq, 14, this, id, normalize(callback)); + njsq._call(xdhq, 14, this, id, callback); } - setCastsByIds(idsAndValues, callback ) { - var ids = new Array(); - var values = new Array(); + handleClasses(idsAndClasses, fid, callback) { + var ids = []; + var classes = []; - pushLabelsAndItems(idsAndValues, "string", ids, values); + split(idsAndClasses, ids, classes); - njsq._wrapper(xdhq, 15, this, ids, values, normalize(callback)); + njsq._call(xdhq, fid, this, ids, classes, callback); } - setCastById(id, value, callback ) { - this.setCastsByIds([[id, value]], normalize(callback) ); + addClasses(idsAndClasses, callback) { + this.handleClasses(idsAndClasses, 15, callback); } - setCastsByTags(id, tagsAndValues, callback) { - var tags = new Array(); - var values = new Array(); - - pushLabelsAndItems(tagsAndValues, "string", tags, values); - - njsq._wrapper(xdhq, 16, this, id, tags, values, normalize(callback)); + addClass(id, clas, callback) { + this.addClasses(merge(id, clas), callback); + } + removeClasses(idsAndClasses, callback) { + this.handleClasses(idsAndClasses, 16, callback); } - setCastByTag(id, tag, value, callback) { - this.setCastsByTags(id, [[tag, value]], normalize(callback)); + removeClass(id, clas, callback) { + this.removeClasses(merge(id, clas), callback); + } + toggleClasses(idsAndClasses, callback) { + this.handleClasses(idsAndClasses, 17, callback); + } + toggleClass(id, clas, callback) { + this.toggleClasses(merge(id, clas), callback); + } + enableElements(ids, callback) { + njsq._call(xdhq, 18, this, ids, callback); + } + enableElement(id, callback) { + this.enableElements([id], callback); + } + disableElements(ids, callback) { + njsq._call(xdhq, 19, this, ids, callback); + } + disableElement(id, callback) { + this.disableElements([id], callback); } getAttribute(id, name, callback) { - return njsq._wrapper(xdhq, 17, this, id, name, normalize(callback)); + return njsq._call(xdhq, 20, this, id, name, callback); } - setAttribute(id, name, value, callback ) { - njsq._wrapper(xdhq, 18, this, id, name, value, normalize(callback)); + setAttribute(id, name, value, callback) { + njsq._call(xdhq, 21, this, id, name, value, callback); } getProperty(id, name) { - return njsq._wrapper(xdhq, 19, this, id, name); + return njsq._call(xdhq, 22, this, id, name); } setProperty(id, name, value) { - njsq._wrapper(xdhq, 20, this, id, name, value); + njsq._call(xdhq, 23, this, id, name, value); } } function register(idsAndItems) { - var tags = new Array(); - var callbacks = new Array(); + var tags = []; + var callbacks = []; - pushLabelsAndItems(idsAndItems, "function", tags, callbacks); + split(idsAndItems, tags, callbacks); - njsq._wrapper(xdhq, 7, tags, callbacks); + njsq._call(xdhq, 7, tags, callbacks); } -function launch( callback ) { - njsq._wrapper(xdhq, 8, callback, "53752" ); +function launch(callback) { + njsq._call(xdhq, 8, callback, "53752"); } module.exports.componentInfo = () => njsq._componentInfo(xdhq); module.exports.wrapperInfo = () => njsq._wrapperInfo(); -module.exports.returnArgument = (text) => { return njsq._wrapper(xdhq, 0, text) }; +module.exports.returnArgument = (text) => { return njsq._call(xdhq, 0, text) }; module.exports.Tree = Tree; module.exports.register = register; module.exports.launch = launch; module.exports.XDH = XDH; - diff --git a/binding.gyp b/binding.gyp index ea0594f..e1ef27e 100755 --- a/binding.gyp +++ b/binding.gyp @@ -41,9 +41,9 @@ { "target_name": "<(module_name)", "type": "shared_library", - "sources": [ "<(src)/xdhqnjs.cpp", "<(src)/registry.cpp", "<(src)/treep.cpp", "<(src)/xdhp.cpp", "<(src)/xdh_cmn.cpp", "<(src)/xdh_dws.cpp", "<(src)/xdh_ups.cpp", "<(epeios)/ags.cpp", "<(epeios)/aem.cpp", "<(epeios)/bch.cpp", "<(epeios)/bitbch.cpp", "<(epeios)/bomhdl.cpp", "<(epeios)/bso.cpp", "<(epeios)/cdgb64.cpp", "<(epeios)/cio.cpp", "<(epeios)/cpe.cpp", "<(epeios)/crptgr.cpp", "<(epeios)/cslio.cpp", "<(epeios)/crt.cpp", "<(epeios)/ctn.cpp", "<(epeios)/dir.cpp", "<(epeios)/dte.cpp", "<(epeios)/dtfbsc.cpp", "<(epeios)/dtfptb.cpp", "<(epeios)/epsmsc.cpp", "<(epeios)/err.cpp", "<(epeios)/fdr.cpp", "<(epeios)/fil.cpp", "<(epeios)/flf.cpp", "<(epeios)/flsq.cpp", "<(epeios)/flw.cpp", "<(epeios)/flx.cpp", "<(epeios)/fnm.cpp", "<(epeios)/ias.cpp", "<(epeios)/idsq.cpp", "<(epeios)/iof.cpp", "<(epeios)/iop.cpp", "<(epeios)/lcl.cpp", "<(epeios)/lck.cpp", "<(epeios)/lst.cpp", "<(epeios)/lstbch.cpp", "<(epeios)/lstcrt.cpp", "<(epeios)/lstctn.cpp", "<(epeios)/mns.cpp", "<(epeios)/mtk.cpp", "<(epeios)/mtx.cpp", "<(epeios)/ntvstr.cpp", "<(epeios)/que.cpp", "<(epeios)/rgstry.cpp", "<(epeios)/sdr.cpp", "<(epeios)/stkbse.cpp", "<(epeios)/stkbch.cpp", "<(epeios)/stkcrt.cpp", "<(epeios)/stkctn.cpp", "<(epeios)/str.cpp", "<(epeios)/strng.cpp", "<(epeios)/stsfsm.cpp", "<(epeios)/tagsbs.cpp", "<(epeios)/tht.cpp", "<(epeios)/thtsub.cpp", "<(epeios)/tol.cpp", "<(epeios)/txf.cpp", "<(epeios)/tys.cpp", "<(epeios)/uys.cpp", "<(epeios)/utf.cpp", "<(epeios)/xml.cpp", "<(epeios)/xpp.cpp", "<(epeios)/xtf.cpp", "<(epeios)/llio.cpp", "<(epeios)/dlbrry.cpp", "<(epeios)/n4all.cpp", "<(epeios)/n4njs.cpp", "<(epeios)/plgn.cpp", "<(epeios)/plgncore.cpp", "<(epeios)/uvqdcl.cpp", "<(epeios)/sck.cpp", "<(epeios)/csdbns.cpp", "<(epeios)/csdcmn.cpp", "<(epeios)/csdmns.cpp", "<(epeios)/csdmxb.cpp", "<(epeios)/csdmxs.cpp", "<(epeios)/csdscb.cpp", "<(epeios)/sclargmnt.cpp", "<(epeios)/sclmisc.cpp", "<(epeios)/sclerror.cpp", "<(epeios)/scllocale.cpp", "<(epeios)/sclrgstry.cpp", "<(epeios)/scln4a.cpp", "<(epeios)/sclnjs.cpp", "<(src)/prtcl.cpp", "<(src)/server.cpp", + "sources": [ "<(src)/xdhqnjs.cpp", "<(src)/registry.cpp", "<(src)/treep.cpp", "<(src)/xdhp.cpp", "<(epeios)/ags.cpp", "<(epeios)/aem.cpp", "<(epeios)/bch.cpp", "<(epeios)/bitbch.cpp", "<(epeios)/bomhdl.cpp", "<(epeios)/bso.cpp", "<(epeios)/cdgb64.cpp", "<(epeios)/cio.cpp", "<(epeios)/cpe.cpp", "<(epeios)/crptgr.cpp", "<(epeios)/cslio.cpp", "<(epeios)/crt.cpp", "<(epeios)/ctn.cpp", "<(epeios)/dir.cpp", "<(epeios)/dte.cpp", "<(epeios)/dtfbsc.cpp", "<(epeios)/dtfptb.cpp", "<(epeios)/epsmsc.cpp", "<(epeios)/err.cpp", "<(epeios)/fdr.cpp", "<(epeios)/fil.cpp", "<(epeios)/flf.cpp", "<(epeios)/flsq.cpp", "<(epeios)/flw.cpp", "<(epeios)/flx.cpp", "<(epeios)/fnm.cpp", "<(epeios)/ias.cpp", "<(epeios)/idsq.cpp", "<(epeios)/iof.cpp", "<(epeios)/iop.cpp", "<(epeios)/lcl.cpp", "<(epeios)/lck.cpp", "<(epeios)/lst.cpp", "<(epeios)/lstbch.cpp", "<(epeios)/lstcrt.cpp", "<(epeios)/lstctn.cpp", "<(epeios)/mns.cpp", "<(epeios)/mtk.cpp", "<(epeios)/mtx.cpp", "<(epeios)/ntvstr.cpp", "<(epeios)/que.cpp", "<(epeios)/rgstry.cpp", "<(epeios)/sdr.cpp", "<(epeios)/stkbse.cpp", "<(epeios)/stkbch.cpp", "<(epeios)/stkcrt.cpp", "<(epeios)/stkctn.cpp", "<(epeios)/str.cpp", "<(epeios)/strng.cpp", "<(epeios)/stsfsm.cpp", "<(epeios)/tagsbs.cpp", "<(epeios)/tht.cpp", "<(epeios)/thtsub.cpp", "<(epeios)/tol.cpp", "<(epeios)/txf.cpp", "<(epeios)/tys.cpp", "<(epeios)/uys.cpp", "<(epeios)/utf.cpp", "<(epeios)/xml.cpp", "<(epeios)/xpp.cpp", "<(epeios)/xtf.cpp", "<(epeios)/llio.cpp", "<(epeios)/dlbrry.cpp", "<(epeios)/n4all.cpp", "<(epeios)/n4njs.cpp", "<(epeios)/plgn.cpp", "<(epeios)/plgncore.cpp", "<(epeios)/uvqdcl.cpp", "<(epeios)/sck.cpp", "<(epeios)/csdbns.cpp", "<(epeios)/csdcmn.cpp", "<(epeios)/csdmns.cpp", "<(epeios)/csdmxb.cpp", "<(epeios)/csdmxs.cpp", "<(epeios)/csdscb.cpp", "<(epeios)/sclargmnt.cpp", "<(epeios)/sclmisc.cpp", "<(epeios)/sclerror.cpp", "<(epeios)/scllocale.cpp", "<(epeios)/sclrgstry.cpp", "<(epeios)/scln4a.cpp", "<(epeios)/sclnjs.cpp", "<(src)/prtcl.cpp", "<(src)/proxy.cpp", "<(src)/prxy_cmn.cpp", "<(src)/prxy_recv.cpp", "<(src)/prxy_send.cpp", "<(src)/tree.cpp", ], - "defines": ["VERSION=\"20180109\"", "COPYRIGHT_YEARS=\"2017\""], + "defines": ["VERSION=\"20180127\"", "COPYRIGHT_YEARS=\"2017\""], "include_dirs": [ "<(src)", "<(epeios)", ], "conditions": [ [ diff --git a/package.json b/package.json index de04f0f..533946a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xdhq", - "version": "2018.1.9", + "version": "2018.1.27", "author": "Claude SIMON (http://q37.info/contact/)", "description": "'XDHTML' wrapper.", "main": "XDHq.js", @@ -10,12 +10,12 @@ "binary": { "module_name": "xdhqnjs", "module_path": "./", - "remote_path": "./epeios-q37/xdhq-node/releases/download/v20180109/", - "package_name": "{module_name}-v20180109-{platform}-{arch}.tar.gz", + "remote_path": "./epeios-q37/xdhq-node/releases/download/v20180127/", + "package_name": "{module_name}-v20180127-{platform}-{arch}.tar.gz", "host": "https://github.com" }, "dependencies": { - "njsq": "2018.1.9" + "njsq": "2018.1.27" }, "devDependencies": { diff --git a/src/epeios/CHANGELOG.md b/src/epeios/CHANGELOG.md index d6c51c4..2492f5f 100755 --- a/src/epeios/CHANGELOG.md +++ b/src/epeios/CHANGELOG.md @@ -1,6 +1,99 @@ # *Epeios* changelog +2018-01-27: +- V8Q: + - fixing missing method in *Node.js* v4, + +2018-01-26: +- NODEQ: + - adaptation to modification in *V8Q*, + - N4NJS + - reporting missing callback, +- SCLNJS: + - adaptation to modifications in *N4NJS*, +- V8Q: + - a value and derived can now be initialized with an undefined value; useful to handle callback parameter, when none is provided by user, + - consolidation of the emptiness of an object, + +2018-01-25: +- MTHTMC + - using *MTHRTN* instead of *MTHFRC*, +- THT: + - introducing `rReadWrite`, + +2018-01-17: +- *common*: + - **$**: handling array of strings, +- N4ZND: + - **$**, +- SCLZND: + - **$**, + +2018-01-16: +- *common*: + - **$**: handling array of strings, +- JNIQ: + - **$**, +- N4JRE: + - **$**, +- SCLJRE: + - **$**, + +2018-01-15: +- *common*: + - **$**: adding handling of booleans, +- N4JRE: + - **$**, +- SCLJRE: + - **$**, + +2018-01-12: +- *common*: + - **$**: + - improving *CSS* classes and rules handling, + - adding element disabling/enabling features, +- SCLXDHTML: + - **$**, +- XDHCMN: + - **$**, +- XDHDWS: + - **$**, +- XDHUJP: + - **$**, +- XDHUJS: + - **$**, + +2018-01-11: +- *common*: + - **$**: replacing *cast* related operations handling by operations on *CSS* related classes and rules (continued), +- SCLXDHTML: + - **$**, +- XDHCMN: + - **$**, +- XDHDWS: + - **$**, +- XDHUJP: + - **$**, +- XDHUJR: + - **$**, +- XDHUJS: + - **$**, + 2018-01-10: +- *common*: + - **$**: replacing *cast* related operations handling by operations on *CSS* related classes and rules, +- SCLXDHTML: + - **$**, +- XDHCMN: + - **$**, +- XDHDWS: + - **$**, +- XDHUJP: + - **$**, +- XDHUJR: + - **$**, +- XDHUJS: + - **$**, - XDHUTL: - fixing *Clang* warning, diff --git a/src/epeios/csdmxs.h b/src/epeios/csdmxs.h index f34a987..bf1276f 100644 --- a/src/epeios/csdmxs.h +++ b/src/epeios/csdmxs.h @@ -302,7 +302,6 @@ qRE qRH sId Id = CSDMXB_UNDEFINED; csdscb::action__ Action = csdscb::aContinue; - rData_ &Data = *(rData_ *)UP; bso::sBool OwnerShipTaken = false; flw::sDressedRWFlow<> Flow; qRB diff --git a/src/epeios/n4all.h b/src/epeios/n4all.h index 8525326..1020443 100644 --- a/src/epeios/n4all.h +++ b/src/epeios/n4all.h @@ -80,17 +80,17 @@ namespace n4all { // Destroyed by launching by 'delete', so must be created with 'new' ! class cLauncher { protected: - virtual void N4ALLLaunch( + virtual void N4ALLCall( void *Function, cCaller &Caller ) = 0; virtual void N4ALLInfo( str::dString &Info ) = 0; public: qCALLBACK( Launcher ); - void Launch( + void Call( void *Function, cCaller &Caller ) { - return N4ALLLaunch( Function, Caller ); + return N4ALLCall( Function, Caller ); } void Info( str::dString &Info ) { diff --git a/src/epeios/n4njs.h b/src/epeios/n4njs.h index 82fc40f..296049d 100644 --- a/src/epeios/n4njs.h +++ b/src/epeios/n4njs.h @@ -183,14 +183,16 @@ namespace n4njs { protected: virtual cUObject *N4NJSLaunch( eType ReturnType, + bso::sBool *IsEmpty, // Set to 'true' if the callback was not set (the corresponding JS parameter was absent). const dArguments &Arguments ) = 0; // Type is the expected type of the returned value. public: qCALLBACK( UCallback ); cUObject *Launch( eType ReturnType, + bso::sBool *IsEmpty, // Set to 'true' if the callback was not set (the corresponding JS parameter was absent). const dArguments &Arguments ) { - return N4NJSLaunch( ReturnType, Arguments ); + return N4NJSLaunch( ReturnType, IsEmpty, Arguments ); } }; diff --git a/src/epeios/sclnjs.cpp b/src/epeios/sclnjs.cpp index 028c750..8f0fc82 100644 --- a/src/epeios/sclnjs.cpp +++ b/src/epeios/sclnjs.cpp @@ -185,7 +185,7 @@ namespace { class sLauncher_ : public cLauncher_ { protected: - virtual void N4ALLLaunch( + virtual void N4ALLCall( void *Function, n4all::cCaller &RawCaller ) override { diff --git a/src/epeios/sclnjs.h b/src/epeios/sclnjs.h index 13a3cc2..16f1880 100644 --- a/src/epeios/sclnjs.h +++ b/src/epeios/sclnjs.h @@ -237,16 +237,17 @@ namespace sclnjs { }; // Launch with 'dArguments' as arguments. - template void Launch_( + template bso::sBool Launch_( ret_item &ReturnItem, n4njs::eType ReturnType, n4njs::cUCallback &Callback, const dArguments &Arguments ) { + bso::sBool IsEmpty = false; qRH; ret *Return = NULL; qRB; - Return = (ret *)Callback.Launch( ReturnType, Arguments ); + Return = (ret *)Callback.Launch( ReturnType, &IsEmpty, Arguments ); ReturnItem.Assign( Return ); qRR; @@ -254,6 +255,7 @@ namespace sclnjs { delete Return; qRT; qRE; + return !IsEmpty; } // Launch with variadics as arguments. @@ -276,11 +278,15 @@ namespace sclnjs { } - void inline VoidLaunch( + inline bso::sBool VoidLaunch( n4njs::cUCallback &Callback, const dArguments &Arguments ) { - Callback.Launch( n4njs::tVoid, Arguments ); + bso::sBool IsEmpty = false; + + Callback.Launch( n4njs::tVoid, &IsEmpty, Arguments ); + + return !IsEmpty; } template void inline VoidLaunch( @@ -323,11 +329,11 @@ namespace sclnjs { { return sclnjs::VoidLaunch( C_(), Args... ); } - void VoidLaunch( const dArguments &Arguments ) + bso::sBool VoidLaunch( const dArguments &Arguments ) { return sclnjs::VoidLaunch( C_(), Arguments ); } - void VoidLaunch( const wArguments &Arguments ) + bso::sBool VoidLaunch( const wArguments &Arguments ) { return VoidLaunch( *Arguments ); } diff --git a/src/epeios/tht.h b/src/epeios/tht.h index cb16b40..f360ed8 100644 --- a/src/epeios/tht.h +++ b/src/epeios/tht.h @@ -339,6 +339,66 @@ namespace tht { qRE } }; + + // One can read only when one has write, and one can write only if previous writing was red. + class rReadWrite + { + private: + mtx::rHandler Write_, Read_; + void Delete_( mtx::rHandler Handler ) + { + if ( Handler != mtx::UndefinedHandler ) + mtx::Delete( Handler, true ); + } + public: + void reset( bso::sBool P = true ) + { + if ( P ) { + Delete_( Write_ ); + Delete_( Read_ ); + } + + Write_ = Read_ = mtx::UndefinedHandler; + } + qCDTOR( rReadWrite ); + void Init( void ) + { + Delete_( Write_ ); + Delete_( Read_ ); + + Write_ = mtx::Create(); + Read_ = mtx::Create(); + + mtx::Lock( Read_ ); + } + void WriteBegin( void ) + { + mtx::Lock( Write_ ); + } + void WriteEnd( void ) + { + mtx::Unlock( Read_ ); + } + void WriteDismiss( void ) + { + WriteBegin(); + WriteEnd(); + } + void ReadBegin( void ) + { + mtx::Lock( Read_ ); + } + void ReadEnd( void ) + { + mtx::Unlock( Write_ ); + } + void ReadDismiss( void ) + { + ReadBegin(); + ReadEnd(); + } + }; + } #endif diff --git a/src/proxy.cpp b/src/proxy.cpp new file mode 100755 index 0000000..5c56794 --- /dev/null +++ b/src/proxy.cpp @@ -0,0 +1,53 @@ +/* + Copyright (C) 2017 Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of 'XDHq' software. + + 'XDHq' is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 'XDHq' is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with 'XDHq'. If not, see . +*/ + +#include "proxy.h" + +#include "prtcl.h" + +#include "sclmisc.h" + +using namespace proxy; + +void proxy::Handshake_( + flw::sRFlow &Flow, + str::dString & Language ) +{ + csdcmn::sVersion Version = csdcmn::UndefinedVersion; + + if ( (Version = csdcmn::GetProtocolVersion( prtcl::ProtocolId, Flow )) != prtcl::ProtocolVersion ) + qRGnr(); + + prtcl::Get( Flow, Language ); + Flow.Dismiss(); +} + +void proxy::GetAction_( + flw::sRWFlow &Flow, + str::dString &Id, + str::dString &Action ) +{ + if ( prtcl::GetRequest( Flow ) != prtcl::rLaunch_1 ) + qRGnr(); + + prtcl::Get( Flow, Id ); + prtcl::Get( Flow, Action ); + Flow.Dismiss(); +} + diff --git a/src/proxy.h b/src/proxy.h new file mode 100755 index 0000000..61229ef --- /dev/null +++ b/src/proxy.h @@ -0,0 +1,260 @@ +/* + Copyright (C) 2017 Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of 'XDHq' software. + + 'XDHq' is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 'XDHq' is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with 'XDHq'. If not, see . +*/ + +#ifndef PROXY_INC_ +# define PROXY_INC_ + +# include "prtcl.h" + +# include "prxy_send.h" +# include "prxy_recv.h" + +# include "csdscb.h" +# include "flw.h" +# include "str.h" + +namespace proxy { + using prxy_send::rArguments; + using prxy_recv::rReturn; + + typedef tht::rReadWrite rControl_; + + // Data received from proxy. + class rRecv + : public rControl_ + { + private: + public: + rReturn Return; + str::wString // For the launching of an action. + Id, + Action; + void reset( bso::sBool P = true ) + { + rControl_::reset( P ); + tol::reset( Return, Id, Action ); + } + qCDTOR( rRecv ); + void Init( void ) + { + rControl_::Init(); + tol::Init( Return, Id, Action ); + } + }; + + // Data sent to proxy. + class rSent + : public rControl_ + { + public: + rArguments Arguments; + void reset( bso::sBool P = true ) + { + rControl_::reset( P ); + tol::reset( P, Arguments ); + } + qCDTOR( rSent ); + void Init( void ) + { + rControl_::Init(); + tol::Init( Arguments ); + } + }; + + + struct rData + { + public: + rRecv Recv; + rSent Sent; + prxy_cmn::eRequest Request; + str::wString Language; + void reset( bso::sBool P = true ) + { + tol::reset( P, Recv, Sent, Language ); + Request = prxy_cmn::r_Undefined; + } + qCDTOR( rData ); + void Init( void ) + { + reset(); + + tol::Init( Recv, Sent, Language ); + Request = prxy_cmn::r_Undefined; + } + bso::sBool IsTherePendingRequest( void ) const + { + return Request != prxy_cmn::r_Undefined; + } + }; + + void Handshake_( + flw::sRFlow &Flow, + str::dString &Language ); + + void GetAction_( + flw::sRWFlow &Flow, + str::dString &Id, + str::dString &Action ); + + template class rProcessing + : public csdscb::cProcessing + { + protected: + virtual void *CSDSCBPreProcess( + fdr::rRWDriver *IODriver, + const ntvstr::char__ *Origin ) override + { + data *Data = NULL; + qRH; + flw::sDressedRWFlow<> Flow; + qRB; + Data = PRXYNew(); + + if ( Data == NULL ) + qRAlc(); + + Data->Recv.WriteDismiss(); + + Flow.Init( *IODriver ); + Handshake_( Flow, Data->Language ); + + prtcl::PutAnswer( prtcl::aOK_1, Flow ); + Flow.Commit(); + qRR; + if ( Data != NULL ) + delete Data; + qRT; + qRE; + return Data; + } + virtual csdscb::eAction CSDSCBProcess( + fdr::rRWDriver *IODriver, + void *UP ) override + { + qRH; + flw::sDressedRWFlow<> Flow; + data &Data = *(data *)UP; + qRB; + if ( UP == NULL ) + qRGnr(); + + Flow.Init( *IODriver ); + + if ( Data.Request != prxy_cmn::r_Undefined ) { + Data.Recv.WriteBegin(); + Data.Recv.Return.Init(); + prxy_recv::Recv( Data.Request, Flow, Data.Recv.Return ); + Data.Request = prxy_cmn::r_Undefined; + Data.Recv.WriteEnd(); + PRXYOnPending( &Data ); + } else { + Data.Recv.WriteBegin(); + tol::Init( Data.Recv.Id, Data.Recv.Action ); + GetAction_( Flow, Data.Recv.Id, Data.Recv.Action ); + Data.Recv.WriteEnd(); + PRXYOnAction( &Data ); + } + + Data.Sent.ReadBegin(); + + // 'Data.Request' is set by the 'PRXYOn...' method above. + if ( Data.Request != prxy_cmn::r_Undefined ) + prxy_send::Send( Data.Request, Flow, Data.Sent.Arguments ); + else + prtcl::PutAnswer( prtcl::aOK_1, Flow ); + + Data.Sent.ReadEnd(); + qRR; + qRT; + qRE; + return csdscb::aContinue; + } + virtual bso::sBool CSDSCBPostProcess( void *UP ) override + { + data *Data = (data *)UP; + + if ( Data == NULL ) + qRGnr(); + + delete Data; + + return false; + } + virtual data *PRXYNew( void ) = 0; + virtual void PRXYOnAction( data *Data ) = 0; + virtual void PRXYOnPending( data *Data ) = 0; + public: + void reset( bso::sBool P = true ) + {} + qCVDTOR( rProcessing ); + void Init( void ) + {} + }; + + template class rSharing + { + private: + rControl_ Control_; + data *Data_; + public: + void reset( bso::sBool P = true ) + { + tol::reset( P, Control_, Data_ ); + } + qCDTOR( rSharing ); + void Init( void ) + { + Control_.Init(); + Data_ = NULL; + } + void Write( data *Data ) + { + Control_.WriteBegin(); + + if ( Data_ != NULL ) + qRGnr(); + + if ( Data == NULL ) + qRGnr(); + + Data_ = Data; + + Control_.WriteEnd(); + + } + data *Read( void ) + { + Control_.ReadBegin(); + + data *Data = Data_; + + if ( Data_ == NULL ) + qRFwk(); + + Data_ = NULL; + + Control_.ReadEnd(); + + return Data; + } + }; +} + +#endif \ No newline at end of file diff --git a/src/prtcl.cpp b/src/prtcl.cpp index aced2c8..5437b95 100755 --- a/src/prtcl.cpp +++ b/src/prtcl.cpp @@ -97,8 +97,11 @@ const char *prtcl::GetLabel( eAnswer Answer ) C( GetContents_1 ); C( SetContents_1 ); C( DressWidgets_1 ); - C( SetCastsByIds_1 ); - C( SetCastsByTags_1 ); + C( AddClasses_1 ); + C( RemoveClasses_1 ); + C( ToggleClasses_1 ); + C( EnableElements_1 ); + C( DisableElements_1 ); C( GetAttribute_1 ); C( SetAttribute_1 ); C( GetProperty_1 ); diff --git a/src/prtcl.h b/src/prtcl.h index 8842ed0..dee4de4 100755 --- a/src/prtcl.h +++ b/src/prtcl.h @@ -60,8 +60,11 @@ namespace prtcl { aGetContents_1, aSetContents_1, aDressWidgets_1, - aSetCastsByIds_1, - aSetCastsByTags_1, + aAddClasses_1, + aRemoveClasses_1, + aToggleClasses_1, + aEnableElements_1, + aDisableElements_1, aSetAttribute_1, aGetAttribute_1, aSetProperty_1, diff --git a/src/server.cpp b/src/prxy_cmn.cpp similarity index 66% rename from src/server.cpp rename to src/prxy_cmn.cpp index 5f63f4d..1dbbcb7 100755 --- a/src/server.cpp +++ b/src/prxy_cmn.cpp @@ -17,39 +17,11 @@ along with 'XDHq'. If not, see . */ -#include "server.h" - -#include "prtcl.h" +#include "prxy_cmn.h" #include "sclmisc.h" -using namespace server; - -void server::Handshake( - flw::sRFlow &Flow, - str::dString & Language ) -{ - csdcmn::sVersion Version = csdcmn::UndefinedVersion; - - if ( ( Version = csdcmn::GetProtocolVersion( prtcl::ProtocolId, Flow ) ) != prtcl::ProtocolVersion ) - qRGnr(); - - prtcl::Get( Flow, Language ); - Flow.Dismiss(); -} - -void server::GetAction( - flw::sRWFlow &Flow, - str::dString &Id, - str::dString &Action ) -{ - if ( prtcl::GetRequest( Flow ) != prtcl::rLaunch_1 ) - qRGnr(); - - prtcl::Get( Flow, Id ); - prtcl::Get( Flow, Action ); - Flow.Dismiss(); -} +using namespace prxy_cmn; namespace { void SetWithXSLContentOrFilename_( @@ -101,18 +73,18 @@ namespace { } } -void server::layout::set::S( +void prxy_cmn::layout::set::S( const str::dString &Id, const str::dString &XML, const str::dString &XSLFilename, const str::dString &Language, flw::sWFlow &Flow ) { -// SetWithXSLContent_( prtcl::aSetLayout_1, Id, XML, XSLFilename, Language, Flow ); + // SetWithXSLContent_( prtcl::aSetLayout_1, Id, XML, XSLFilename, Language, Flow ); SetWithXSLFilename_( prtcl::aSetLayout_1, Id, XML, XSLFilename, Language, Flow ); } -void server::alert::S( +void prxy_cmn::alert::S( const str::dString &Message, flw::sWFlow &Flow ) { @@ -121,7 +93,7 @@ void server::alert::S( Flow.Commit(); } -void server::confirm::S( +void prxy_cmn::confirm::S( const str::dString &Message, flw::sWFlow &Flow ) { @@ -130,7 +102,7 @@ void server::confirm::S( Flow.Commit(); } -void server::confirm::R( +void prxy_cmn::confirm::R( flw::sRFlow &Flow, str::dString &Response ) { @@ -138,7 +110,7 @@ void server::confirm::R( Flow.Dismiss(); } -void server::contents::get::S( +void prxy_cmn::contents::get::S( const str::dStrings &Ids, flw::sWFlow &Flow ) { @@ -147,7 +119,7 @@ void server::contents::get::S( Flow.Commit(); } -void server::contents::get::R( +void prxy_cmn::contents::get::R( flw::sRFlow &Flow, str::dStrings &Contents ) { @@ -155,7 +127,7 @@ void server::contents::get::R( Flow.Dismiss(); } -void server::contents::set::S( +void prxy_cmn::contents::set::S( const str::dStrings & Ids, const str::dStrings & Contents, flw::sWFlow & Flow ) @@ -166,7 +138,7 @@ void server::contents::set::S( Flow.Commit(); } -void server::widgets::dress::S( +void prxy_cmn::widgets::dress::S( const str::dString &Id, flw::sWFlow &Flow ) { @@ -175,31 +147,72 @@ void server::widgets::dress::S( Flow.Commit(); } -void server::casts_by_ids::set::S( +namespace { + void HandleClasses_( + const str::dStrings &Ids, + const str::dStrings &Classes, + prtcl::eAnswer Answer, + flw::sWFlow & Flow ) + { + prtcl::PutAnswer( Answer, Flow ); + prtcl::Put( Ids, Flow ); + prtcl::Put( Classes, Flow ); + Flow.Commit(); + } +} + +void prxy_cmn::classes::add::S( const str::dStrings &Ids, - const str::dStrings &Values, + const str::dStrings &Classes, flw::sWFlow & Flow ) { - prtcl::PutAnswer( prtcl::aSetCastsByIds_1, Flow ); - prtcl::Put( Ids, Flow ); - prtcl::Put( Values, Flow ); - Flow.Commit(); + HandleClasses_( Ids, Classes, prtcl::aAddClasses_1, Flow ); } -void server::casts_by_tags::set::S( - const str::dString &Id, - const str::dStrings &Tags, - const str::dStrings &Values, +void prxy_cmn::classes::remove::S( + const str::dStrings &Ids, + const str::dStrings &Classes, flw::sWFlow & Flow ) { - prtcl::PutAnswer( prtcl::aSetCastsByTags_1, Flow ); - prtcl::Put( Id, Flow ); - prtcl::Put( Tags, Flow ); - prtcl::Put( Values, Flow ); - Flow.Commit(); + HandleClasses_( Ids, Classes, prtcl::aRemoveClasses_1, Flow ); +} + +void prxy_cmn::classes::toggle::S( + const str::dStrings &Ids, + const str::dStrings &Classes, + flw::sWFlow & Flow ) +{ + HandleClasses_( Ids, Classes, prtcl::aToggleClasses_1, Flow ); +} + +namespace { + void HandleElements_( + const str::dStrings &Ids, + prtcl::eAnswer Answer, + flw::sWFlow & Flow ) + { + prtcl::PutAnswer( Answer, Flow ); + prtcl::Put( Ids, Flow ); + Flow.Commit(); + } } -void server::ap_::set::S( +void prxy_cmn::elements::enable::S( + const str::dStrings &Ids, + flw::sWFlow & Flow ) +{ + HandleElements_( Ids, prtcl::aEnableElements_1, Flow ); +} + +void prxy_cmn::elements::disable::S( + const str::dStrings &Ids, + flw::sWFlow & Flow ) +{ + HandleElements_( Ids, prtcl::aDisableElements_1, Flow ); +} + + +void prxy_cmn::ap_::set::S( prtcl::eAnswer Answer, const str::dString &Id, const str::dString &Name, @@ -213,7 +226,7 @@ void server::ap_::set::S( Flow.Commit(); } -void server::ap_::get::S( +void prxy_cmn::ap_::get::S( prtcl::eAnswer Answer, const str::dString &Id, const str::dString &Name, @@ -225,7 +238,7 @@ void server::ap_::get::S( Flow.Commit(); } -void server::ap_::get::R( +void prxy_cmn::ap_::get::R( flw::sRFlow &Flow, str::dString &Value ) { @@ -233,4 +246,3 @@ void server::ap_::get::R( Flow.Dismiss(); } - diff --git a/src/server.h b/src/prxy_cmn.h similarity index 68% rename from src/server.h rename to src/prxy_cmn.h index abb81f4..4c3c54b 100755 --- a/src/server.h +++ b/src/prxy_cmn.h @@ -17,23 +17,35 @@ along with 'XDHq'. If not, see . */ -#ifndef SERVER_INC_ -# define SERVER_INC_ +#ifndef PRXY_CMN_INC_ +# define PRXY_CMN_INC_ # include "prtcl.h" -# include "flw.h" # include "str.h" -namespace server { - void Handshake( - flw::sRFlow &Flow, - str::dString &Language ); - - void GetAction( - flw::sRWFlow &Flow, - str::dString &Id, - str::dString &Action ); +namespace prxy_cmn { + + qENUM( Request ) + { + rAlert, + rConfirm, + rSetLayout, + rGetContents, + rSetContents, + rDressWidgets, + rAddClasses, + rRemoveClasses, + rToggleClasses, + rEnableElements, + rDisableElements, + rGetAttribute, + rSetAttribute, + rGetProperty, + rSetProperty, + r_amount, + r_Undefined + }; // '...S' Send the request. // '...R' get the response. @@ -48,10 +60,10 @@ namespace server { } inline void Alert( - const str::dString &Script, + const str::dString &Message, flw::sRWFlow &Flow ) { - alert::S( Script, Flow ); + alert::S( Message, Flow ); alert::R( Flow ); } @@ -66,14 +78,14 @@ namespace server { } inline void Confirm( - const str::dString &Script, + const str::dString &Message, flw::sRWFlow &Flow, str::dString &Response ) { - confirm::S( Script, Flow ); + confirm::S( Message, Flow ); confirm::R( Flow, Response ); } - + namespace layout { namespace set { void S( @@ -158,48 +170,98 @@ namespace server { } } - namespace casts_by_ids { - namespace set - { + namespace classes { + namespace add { void S( const str::dStrings &Ids, - const str::dStrings &Values, + const str::dStrings &Classes, flw::sWFlow &Flow ); inline void R( flw::sRFlow &Flow ) {} } - - inline void Set( + + inline void Add( const str::dStrings &Ids, - const str::dStrings &Values, + const str::dStrings &Classes, flw::sRWFlow &Flow ) { - set::S( Ids, Values, Flow ); - set::R( Flow ); + add::S( Ids, Classes, Flow ); + add::R( Flow ); + } + + namespace remove { + void S( + const str::dStrings &Ids, + const str::dStrings &Classes, + flw::sWFlow &Flow ); + + inline void R( flw::sRFlow &Flow ) + {} + } + + inline void Remove( + const str::dStrings &Ids, + const str::dStrings &Classes, + flw::sRWFlow &Flow ) + { + remove::S( Ids, Classes, Flow ); + remove::R( Flow ); + } + + namespace toggle { + void S( + const str::dStrings &Ids, + const str::dStrings &Classes, + flw::sWFlow &Flow ); + + inline void R( flw::sRFlow &Flow ) + {} + } + + inline void Toggle( + const str::dStrings &Ids, + const str::dStrings &Classes, + flw::sRWFlow &Flow ) + { + toggle::S( Ids, Classes, Flow ); + toggle::R( Flow ); } } - namespace casts_by_tags { - namespace set { + namespace elements { + namespace enable { void S( - const str::dString &Id, - const str::dStrings &Tags, - const str::dStrings &Values, + const str::dStrings &Ids, flw::sWFlow &Flow ); inline void R( flw::sRFlow &Flow ) {} } - inline void Set( - const str::dString &Id, - const str::dStrings &Tags, - const str::dStrings &Values, + inline void Enable( + const str::dStrings &Ids, flw::sRWFlow &Flow ) { - set::S( Id, Tags, Values, Flow ); - set::R( Flow ); + enable::S( Ids, Flow ); + enable::R( Flow ); + } + + namespace disable { + void S( + const str::dStrings &Ids, + flw::sWFlow &Flow ); + + inline void R( flw::sRFlow &Flow ) + {} + } + + inline void Disable( + const str::dStrings &Id, + flw::sRWFlow &Flow ) + { + disable::S( Id, Flow ); + disable::R( Flow ); } } @@ -267,16 +329,16 @@ namespace server { { ap_::set::R( Flow ); } + } - inline void Set( - const str::dString &Id, - const str::dString &Name, - const str::dString &Value, - flw::sRWFlow &Flow ) - { - set::S( Id, Name, Value, Flow ); - set::R( Flow ); - } + inline void Set( + const str::dString &Id, + const str::dString &Name, + const str::dString &Value, + flw::sRWFlow &Flow ) + { + set::S( Id, Name, Value, Flow ); + set::R( Flow ); } namespace get { @@ -294,16 +356,16 @@ namespace server { { ap_::get::R( Flow, Value ); } + } - inline void Set( - const str::dString &Id, - const str::dString &Name, - const str::dString &Value, - flw::sRWFlow &Flow ) - { - set::S( Id, Name, Value, Flow ); - set::R( Flow ); - } + inline void Get( + const str::dString &Id, + const str::dString &Name, + flw::sRWFlow &Flow, + str::dString &Value ) + { + get::S( Id, Name, Flow ); + get::R( Flow, Value ); } } @@ -322,16 +384,16 @@ namespace server { { ap_::set::R( Flow ); } + } - inline void Set( - const str::dString &Id, - const str::dString &Name, - const str::dString &Value, - flw::sRWFlow &Flow ) - { - set::S( Id, Name, Value, Flow ); - set::R( Flow ); - } + inline void Set( + const str::dString &Id, + const str::dString &Name, + const str::dString &Value, + flw::sRWFlow &Flow ) + { + set::S( Id, Name, Value, Flow ); + set::R( Flow ); } namespace get { @@ -349,16 +411,16 @@ namespace server { { ap_::get::R( Flow, Value ); } + } - inline void Set( - const str::dString &Id, - const str::dString &Name, - const str::dString &Value, - flw::sRWFlow &Flow ) - { - set::S( Id, Name, Value, Flow ); - set::R( Flow ); - } + inline void Get( + const str::dString &Id, + const str::dString &Name, + flw::sRWFlow &Flow, + str::dString &Value ) + { + get::S( Id, Name, Flow ); + get::R( Flow, Value ); } } } diff --git a/src/prxy_recv.cpp b/src/prxy_recv.cpp new file mode 100755 index 0000000..c7ef50f --- /dev/null +++ b/src/prxy_recv.cpp @@ -0,0 +1,171 @@ +/* + Copyright (C) 2017 Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of 'XDHq' software. + + 'XDHq' is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 'XDHq' is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with 'XDHq'. If not, see . +*/ + +#include "prxy_recv.h" + +using namespace prxy_recv; + +using namespace prxy_cmn; + +namespace { + void Alert_( + flw::sRFlow &Flow, + rReturn &Return ) + { + alert::R( Flow ); + } + + void Confirm_( + flw::sRFlow &Flow, + rReturn &Return ) + { + confirm::R( Flow, Return.StringToSet() ); + } + + void SetLayout_( + flw::sRFlow &Flow, + rReturn &Return ) + { + layout::set::R( Flow ); + } + + void GetContents_( + flw::sRFlow &Flow, + rReturn &Return ) + { + contents::get::R( Flow, Return.StringsToSet() ); + } + + void SetContents_( + flw::sRFlow &Flow, + rReturn &Return ) + { + contents::set::R( Flow ); + } + + void DressWidgets_( + flw::sRFlow &Flow, + rReturn &Return ) + { + widgets::dress::R( Flow ); + } + + void AddClasses_( + flw::sRFlow &Flow, + rReturn &Return ) + { + classes::add::R( Flow ); + } + + void RemoveClasses_( + flw::sRFlow &Flow, + rReturn &Return ) + { + classes::remove::R( Flow ); + } + + void ToggleClasses_( + flw::sRFlow &Flow, + rReturn &Return ) + { + classes::toggle::R( Flow ); + } + + void EnableElements_( + flw::sRFlow &Flow, + rReturn &Return ) + { + elements::enable::R( Flow ); + } + + void DisableElements_( + flw::sRFlow &Flow, + rReturn &Return ) + { + elements::disable::R( Flow ); + } + + void GetAttribute_( + flw::sRFlow &Flow, + rReturn &Return ) + { + attribute::get::R( Flow, Return.StringToSet() ); + } + + void SetAttribute_( + flw::sRFlow &Flow, + rReturn &Return ) + { + attribute::set::R( Flow ); + } + + void GetProperty_( + flw::sRFlow &Flow, + rReturn &Return ) + { + property::get::R( Flow, Return.StringToSet() ); + } + void SetProperty_( + flw::sRFlow &Flow, + rReturn &Return ) + { + property::set::R( Flow ); + } +} + +#define H( name )\ + case r##name:\ + name##_( Flow, Return );\ + break + +void prxy_recv::Recv( + eRequest Request, + flw::sRFlow &Flow, + rReturn &Return ) +{ + if ( prtcl::GetRequest( Flow ) != prtcl::rReady_1 ) + qRGnr(); + + switch ( Request ) { + case r_Undefined: + qRGnr(); + break; + H( Alert ); + H( Confirm ); + H( SetLayout ); + H( GetContents ); + H( SetContents ); + H( DressWidgets ); + H( AddClasses ); + H( RemoveClasses ); + H( ToggleClasses ); + H( EnableElements ); + H( DisableElements ); + H( GetAttribute ); + H( SetAttribute ); + H( GetProperty ); + H( SetProperty ); + default: + qRGnr(); + break; + } +} + +#undef H + diff --git a/src/prxy_recv.h b/src/prxy_recv.h new file mode 100755 index 0000000..f45e22f --- /dev/null +++ b/src/prxy_recv.h @@ -0,0 +1,97 @@ +/* + Copyright (C) 2017 Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of 'XDHq' software. + + 'XDHq' is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 'XDHq' is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with 'XDHq'. If not, see . +*/ + +#ifndef PRXY_RECV_INC_ +# define PRXY_RECV_INC_ + +# include "prxy_cmn.h" + +namespace prxy_recv { + qENUM( Type ) + { + tString, + tStrings, + t_amount, + t_Undefined + }; + + class rReturn + { + private: + eType Type_; + str::wString String_; + str::wStrings Strings_; + void Test_( eType Type ) const + { + if ( Type_ != Type ) + qRGnr(); + } + public: + void reset( bso::sBool P = true ) + { + tol::reset( P, String_, Strings_ ); + Type_ = t_Undefined; + } + qCDTOR( rReturn ); + void Init( void ) + { + tol::Init( String_, Strings_ ); + Type_ = t_Undefined; + } + str::dString &StringToSet( void ) + { + Test_( t_Undefined ); + + Type_ = tString; + + return String_; + } + str::dStrings &StringsToSet( void ) + { + Test_( t_Undefined ); + + Type_ = tStrings; + + return Strings_; + } + eType GetType( void ) const + { + return Type_; + } + const str::dString &GetString( void ) const + { + Test_( tString ); + + return String_; + } + const str::dStrings &GetStrings( void ) const + { + Test_( tStrings ); + + return Strings_; + } + }; + + void Recv( + prxy_cmn::eRequest Request, + flw::sRFlow &Flow, + rReturn &Return ); +} + +#endif \ No newline at end of file diff --git a/src/prxy_send.cpp b/src/prxy_send.cpp new file mode 100755 index 0000000..2f8754c --- /dev/null +++ b/src/prxy_send.cpp @@ -0,0 +1,154 @@ +/* + Copyright (C) 2017 Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of 'XDHq' software. + + 'XDHq' is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 'XDHq' is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with 'XDHq'. If not, see . +*/ + +#include "prxy_send.h" + +using namespace prxy_send; + +using namespace prxy_cmn; + +namespace { + void Alert_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + alert::S( Arguments.Message, Flow ); + } + void Confirm_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + confirm::S( Arguments.Message, Flow ); + } + void SetLayout_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + layout::set::S( Arguments.Id, Arguments.XML, Arguments.XSLFilename, Arguments.Language, Flow ); + } + void GetContents_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + contents::get::S( Arguments.Ids, Flow ); + } + void SetContents_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + contents::set::S( Arguments.Ids, Arguments.Contents, Flow ); + } + void DressWidgets_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + widgets::dress::S( Arguments.Id, Flow ); + } + void AddClasses_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + classes::add::S( Arguments.Ids, Arguments.Classes, Flow ); + } + void RemoveClasses_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + classes::remove::S( Arguments.Ids, Arguments.Classes, Flow ); + } + void ToggleClasses_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + classes::toggle::S( Arguments.Ids, Arguments.Classes, Flow ); + } + void EnableElements_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + elements::enable::S( Arguments.Ids, Flow ); + } + void DisableElements_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + elements::disable::S( Arguments.Ids, Flow ); + } + void GetAttribute_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + attribute::get::S( Arguments.Id, Arguments.Name, Flow ); + } + void SetAttribute_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + attribute::set::S( Arguments.Id, Arguments.Name, Arguments.Value, Flow ); + } + void GetProperty_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + property::get::S( Arguments.Id, Arguments.Name, Flow ); + } + void SetProperty_( + flw::sWFlow &Flow, + const rArguments &Arguments ) + { + property::set::S( Arguments.Id, Arguments.Name, Arguments.Value, Flow ); + } +} + +#define H( name )\ + case r##name:\ + name##_( Flow, Arguments );\ + break + +void prxy_send::Send( + eRequest Request, + flw::sWFlow &Flow, + const rArguments &Arguments ) +{ + switch ( Request ) { + case r_Undefined: + qRGnr(); + break; + H( Alert ); + H( Confirm ); + H( SetLayout ); + H( GetContents ); + H( SetContents ); + H( DressWidgets ); + H( AddClasses ); + H( RemoveClasses ); + H( ToggleClasses ); + H( EnableElements ); + H( DisableElements ); + H( GetAttribute ); + H( SetAttribute ); + H( GetProperty ); + H( SetProperty ); + default: + qRGnr(); + break; + } +} + +#undef H diff --git a/src/prxy_send.h b/src/prxy_send.h new file mode 100755 index 0000000..9307f21 --- /dev/null +++ b/src/prxy_send.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2017 Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of 'XDHq' software. + + 'XDHq' is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 'XDHq' is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with 'XDHq'. If not, see . +*/ + +#ifndef PRXY_SEND_INC_ +# define PRXY_SEND_INC_ + +# include "prxy_cmn.h" + +namespace prxy_send { + struct rArguments + { + public: + str::wString Message, Id, XML, XSLFilename, Language, Name, Value; + str::wStrings Ids, Contents, Tags, Values, Classes; + void reset( bso::sBool P = true ) + { + tol::reset( Message, Id, XML, XSLFilename, Language, Name, Value, Ids, Contents, Tags, Values, Classes ); + } + qCDTOR( rArguments ); + void Init( void ) + { + tol::Init( Message, Id, XML, XSLFilename, Language, Name, Value, Ids, Contents, Tags, Values, Classes ); + } + }; + + void Send( + prxy_cmn::eRequest Request, + flw::sWFlow &Flow, + const rArguments &Arguments ); +} + +#endif \ No newline at end of file diff --git a/src/xdh_dws.cpp b/src/tree.cpp similarity index 91% rename from src/xdh_dws.cpp rename to src/tree.cpp index 88c6b91..b1bf92d 100755 --- a/src/xdh_dws.cpp +++ b/src/tree.cpp @@ -1,22 +1,23 @@ -/* - Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). - - This file is part of XDHq. - - XDHq is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - XDHq is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with XDHq. If not, see . -*/ - -#include "xdh_dws.h" - -using namespace xdh_dws; +/* + Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of XDHq. + + XDHq is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + XDHq is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with XDHq. If not, see . +*/ + +#include "tree.h" + +using namespace tree; + diff --git a/src/tree.h b/src/tree.h new file mode 100755 index 0000000..d49f962 --- /dev/null +++ b/src/tree.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). + + This file is part of XDHq. + + XDHq is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + XDHq is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with XDHq. If not, see . +*/ + +// TREE + +#ifndef TREE_INC_ +# define TREE_INC_ + +# include "flx.h" +# include "xml.h" + +namespace tree { + typedef xml::wWriter rWriter_; + + struct rRack + : public rWriter_ + { + private: + flx::rStringTOFlow Flow_; + str::wString XML_; + public: + void reset( bso::sBool P = true ) + { + rWriter_::reset( P ); + tol::reset( P, XML_, Flow_ ); + } + qCDTOR( rRack ); + void Init( const char *Generator ) + { + tol::bDateAndTime Buffer; + XML_.Init(); + Flow_.Init( XML_ ); + rWriter_::Init( Flow_, xml::lCompact, xml::e_Default ); + + PushTag( "XDHTML" ); + PutAttribute( "Generator", Generator ); + PutAttribute( "TimeStamp", tol::DateAndTime( Buffer ) ); + PutAttribute( "OS", cpe::GetOSDigest() ); + } + const str::dString &GetXML( str::dString &XML ) + { + rWriter_::reset(); + Flow_.reset(); + XML = XML_; + XML_.reset(); + + return XML; + } + }; +} + +#endif diff --git a/src/treep.cpp b/src/treep.cpp index b38048e..d230b68 100755 --- a/src/treep.cpp +++ b/src/treep.cpp @@ -19,6 +19,8 @@ #include "treep.h" +#include "tree.h" + #include "txf.h" #include "xml.h" #include "flx.h" @@ -26,45 +28,16 @@ using namespace treep; namespace { - typedef xml::wWriter rWriter_; - struct rTreeRack_ - : public rWriter_ + : public tree::rRack { - private: - flx::rStringTOFlow Flow_; - str::wString XML_; public: - void reset( bso::sBool P = true ) - { - rWriter_::reset( P ); - tol::reset( P, XML_, Flow_ ); - } - qCDTOR( rTreeRack_ ); void Init( void ) { - tol::bDateAndTime Buffer; - XML_.Init(); - Flow_.Init( XML_ ); - rWriter_::Init( Flow_, xml::lCompact, xml::e_Default ); - - PushTag( "XDHTML" ); - PutAttribute( "Generator", sclmisc::SCLMISCTargetName ); - PutAttribute( "TimeStamp", tol::DateAndTime( Buffer ) ); - PutAttribute( "OS", cpe::GetOSDigest() ); - } - const str::dString &GetXML( str::dString &XML ) - { - rWriter_::reset(); - Flow_.reset(); - XML = XML_; - XML_.reset(); - - return XML; + tree::rRack::Init( sclmisc::SCLMISCTargetName ); } }; } - namespace { typedef sclnjs::rObject rObject_; diff --git a/src/xdh_cmn.cpp b/src/xdh_cmn.cpp deleted file mode 100755 index b18e572..0000000 --- a/src/xdh_cmn.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). - - This file is part of XDHq. - - XDHq is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - XDHq is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with XDHq. If not, see . -*/ - -#include "xdh_cmn.h" - -#include "server.h" - -using namespace xdh_cmn; - -void *xdh_cmn::rProcessing::CSDSCBPreProcess( - fdr::rRWDriver *IODriver, - const ntvstr::char__ *Origin ) -{ - rData *Data = NULL; -qRH; - flw::sDressedRWFlow<> Flow; - str::wString Id, Action; -qRB; - Data = new rData; - - if ( Data == NULL ) - qRAlc(); - - Data->Init(); - - Flow.Init( *IODriver ); - server::Handshake( Flow, Data->Language ); - - Data->Lock(); - - S_().Upstream( Data ); - - Data->Lock(); - Data->Unlock(); - - prtcl::PutAnswer( prtcl::aOK_1, Flow ); - Flow.Commit(); -qRR; - if ( Data != NULL ) - delete Data; -qRT; -qRE; - return Data; -} - -csdscb::eAction xdh_cmn::rProcessing::CSDSCBProcess( - fdr::rRWDriver *IODriver, - void *UP ) -{ -qRH; - flw::sDressedRWFlow<> Flow; - rData &Data = *(rData *)UP; -qRB; - if ( UP == NULL ) - qRGnr(); - - Flow.Init( *IODriver ); - - Data.JS.Arguments.Init(); - - if ( !xdh_ups::Recv( Data.Server.Request, Flow, Data.JS.Arguments ) ) - server::GetAction( Flow, Data.JS.Id, Data.JS.Action ); - - Data.Server.Request = xdh_ups::r_Undefined; - - Data.Lock(); - - S_().Upstream( &Data ); - - Data.Lock(); - Data.Unlock(); - - if ( !xdh_ups::Send( Flow, Data.Server ) ) - prtcl::PutAnswer( prtcl::aOK_1, Flow ); -qRR; -qRT; -qRE; - return csdscb::aContinue; -} - -bso::sBool xdh_cmn::rProcessing::CSDSCBPostProcess( void *UP ) -{ - rData *Data = (rData *)UP; - - if ( Data == NULL ) - qRGnr(); - - delete Data; - - return false; -} - diff --git a/src/xdh_cmn.h b/src/xdh_cmn.h deleted file mode 100755 index a0cbc9c..0000000 --- a/src/xdh_cmn.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). - - This file is part of XDHq. - - XDHq is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - XDHq is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with XDHq. If not, see . -*/ - -// XDH CoMmoN. -// Merge upstream and downstream part. - -#ifndef XDH_CMN_INC_ -# define XDH_CMN_INC_ - -# include "xdh_ups.h" -# include "xdh_dws.h" - -namespace xdh_cmn { - struct rData - { - private: - mtx::rHandler Lock_; - public: - xdh_dws::rJS JS; - xdh_ups::rServer Server; - sclnjs::rObject XDH; // User overloaded 'XDH' JS class. - str::wString Language; - void reset( bso::sBool P = true ) - { - if ( P ) { - if ( Lock_ != mtx::UndefinedHandler ) - mtx::Delete( Lock_ ); - } - - tol::reset( P, JS, Server, XDH, Language ); - Lock_ = NULL; - } - qCDTOR( rData ); - void Init( void ) - { - reset(); - - tol::Init( JS, Server, XDH, Language ); - Lock_ = mtx::Create(); - } - void Lock( void ) - { - mtx::Lock( Lock_ ); - } - void Unlock( void ) - { - mtx::Unlock( Lock_ ); - } - }; - - class rSharing - { - private: - mtx::rHandler Server_, JS_; // Server upstream, JS, server downstream. - rData *Data_; - public: - void reset( bso::sBool P = true ) - { - if ( P ) { - if ( Server_ != mtx::UndefinedHandler ) - mtx::Delete( Server_ ); - - if ( JS_ != mtx::UndefinedHandler ) - mtx::Delete( JS_ ); - } - - Server_ = JS_ = NULL; - Data_ = NULL; - } - qCDTOR( rSharing ); - void Init( void ) - { - reset(); - - Server_ = mtx::Create(); - JS_ = mtx::Create(); - - Data_ = NULL; - - mtx::Lock( JS_ ); - } - // Called by server. - void Upstream( rData *Data ) - { - mtx::Lock( Server_ ); - - if ( Data_ != NULL ) - qRGnr(); - - if ( Data == NULL ) - qRGnr(); - - Data_ = Data; - - mtx::Unlock( JS_ ); - } - rData &ReadJS( void ) - { - mtx::Lock( JS_ ); - - rData &Data = *Data_; - - mtx::Unlock( Server_ ); - - if ( Data_ == NULL ) - qRFwk(); - - Data_ = NULL; - - return Data; - } - }; - - class rProcessing - : public csdscb::cProcessing - { - private: - qRMV( rSharing, S_, Sharing_ ); - protected: - virtual void *CSDSCBPreProcess( - fdr::rRWDriver *IODriver, - const ntvstr::char__ *Origin ) override; - virtual csdscb::eAction CSDSCBProcess( - fdr::rRWDriver *IODriver, - void *UP ) override; - virtual bso::sBool CSDSCBPostProcess( void *UP ) override; - public: - void reset( bso::sBool P = true ) - {} - qCVDTOR( rProcessing ); - void Init( rSharing &Sharing ) - { - Sharing_ = &Sharing; - } - }; - -} - -#endif diff --git a/src/xdh_dws.h b/src/xdh_dws.h deleted file mode 100755 index 19fe535..0000000 --- a/src/xdh_dws.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). - - This file is part of XDHq. - - XDHq is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - XDHq is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with XDHq. If not, see . -*/ - -// XDH DoWnStream. -// Stuff related to the JS part. - -#ifndef XDH_DWS_INC_ -# define XDH_DWS_INC_ - -# include"sclnjs.h" - -namespace xdh_dws { - - class rArguments - { - private: - sclnjs::wArguments Core_; - str::wString Response_; - str::wString Value_; - str::wStrings Contents_; - public: - void reset( bso::sBool P = true ) - { - tol::reset( P, Core_, Response_, Value_, Contents_ ); - } - qCDTOR( rArguments ); - void Init( void ) - { - tol::Init( Core_, Response_, Value_, Contents_ ); - } - void Add( sclnjs::rObject &Object ) - { - Core_.Add( Object ); - } - str::dString &Response( void ) - { - Core_.Add( Response_ ); - - return Response_; - } - str::dString &Value( void ) - { - Core_.Add( Value_ ); - - return Value_; - } - str::wStrings &Contents( void ) - { - Core_.Add( Contents_ ); - - return Contents_; - } - const sclnjs::dArguments &Core( void ) const - { - return Core_; - } - }; - - struct rJS - { - public: - sclnjs::rCallback Callback; - rArguments Arguments; - str::wString // For the launching of an action. - Id, - Action; - void reset( bso::sBool P = true ) - { - tol::reset( P, Callback, Arguments, Id, Action ); - Arguments.reset( P ); - } - qCDTOR( rJS ); - void Init( void ) - { - tol::Init( Callback, Arguments, Id, Action ); - } - }; -} - -#endif diff --git a/src/xdh_ups.cpp b/src/xdh_ups.cpp deleted file mode 100755 index a66a083..0000000 --- a/src/xdh_ups.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* - Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). - - This file is part of XDHq. - - XDHq is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - XDHq is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with XDHq. If not, see . -*/ - -#include "xdh_ups.h" - -#include "server.h" - -using namespace xdh_ups; - -namespace send_ { - namespace { - void Alert_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::alert::S( Arguments.Message, Flow ); - } - void Confirm_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::confirm::S( Arguments.Message, Flow ); - } - void SetLayout_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::layout::set::S( Arguments.Id, Arguments.XML, Arguments.XSLFilename, Arguments.Language, Flow ); - } - void GetContents_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::contents::get::S( Arguments.Ids, Flow ); - } - void SetContents_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::contents::set::S( Arguments.Ids, Arguments.Contents, Flow ); - } - void DressWidgets_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::widgets::dress::S( Arguments.Id, Flow ); - } - void SetCastsByIds_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::casts_by_ids::set::S( Arguments.Ids, Arguments.Values, Flow ); - } - void SetCastsByTags_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::casts_by_tags::set::S( Arguments.Id, Arguments.Tags, Arguments.Values, Flow ); - } - void GetAttribute_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::attribute::get::S( Arguments.Id, Arguments.Name, Flow ); - } - void SetAttribute_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::attribute::set::S( Arguments.Id, Arguments.Name, Arguments.Value, Flow ); - } - void GetProperty_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::property::get::S( Arguments.Id, Arguments.Name, Flow ); - } - void SetProperty_( - flw::sWFlow &Flow, - rArguments &Arguments ) - { - server::property::set::S( Arguments.Id, Arguments.Name, Arguments.Value, Flow ); - } - } -} - -#define H( name )\ - case r##name:\ - send_::name##_( Flow, Server.Arguments );\ - break - -bso::sBool xdh_ups::Send( - flw::sWFlow &Flow, - rServer &Server ) -{ - switch ( Server.Request ) { - case r_Undefined: - return false; - break; - H( Alert ); - H( Confirm ); - H( SetLayout ); - H( GetContents ); - H( SetContents ); - H( DressWidgets ); - H( SetCastsByIds ); - H( SetCastsByTags ); - H( GetAttribute ); - H( SetAttribute ); - H( GetProperty ); - H( SetProperty ); - default: - qRGnr(); - break; - } - - return true; -} - -#undef H - - -namespace recv_ { - namespace { - void Alert_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::alert::R( Flow ); - } - - void Confirm_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::confirm::R( Flow, Arguments.Response() ); - } - - void SetLayout_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::layout::set::R( Flow ); - } - - void GetContents_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::contents::get::R( Flow, Arguments.Contents() ); - } - - void SetContents_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::contents::set::R( Flow ); - } - - void DressWidgets_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::widgets::dress::R( Flow ); - } - - void SetCastsByIds_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::casts_by_ids::set::R( Flow ); - } - - void SetCastsByTags_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::casts_by_tags::set::R( Flow ); - } - - void GetAttribute_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::attribute::get::R( Flow, Arguments.Value() ); - } - - void SetAttribute_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::attribute::set::R( Flow ); - } - - void GetProperty_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::property::get::R( Flow, Arguments.Value() ); - } - void SetProperty_( - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) - { - server::property::set::R( Flow ); - } - } -} - -#define H( name )\ - case r##name:\ - recv_::name##_( Flow, Arguments );\ - break - -bso::sBool xdh_ups::Recv( - eRequest Id, - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ) -{ - if ( Id == r_Undefined ) // A new event has be detected. - return false; - else { - if ( prtcl::GetRequest( Flow ) != prtcl::rReady_1 ) - qRGnr(); - - switch ( Id ) { - H( Alert ); - H( Confirm ); - H( SetLayout ); - H( GetContents ); - H( SetContents ); - H( DressWidgets ); - H( SetCastsByIds ); - H( SetCastsByTags ); - H( GetAttribute ); - H( SetAttribute ); - H( GetProperty ); - H( SetProperty ); - default: - qRGnr(); - break; - } - - return true; - } -} - -#undef H - diff --git a/src/xdh_ups.h b/src/xdh_ups.h deleted file mode 100755 index 6939ecf..0000000 --- a/src/xdh_ups.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2017 by Claude SIMON (http://zeusw.org/epeios/contact.html). - - This file is part of XDHq. - - XDHq is free software: you can redistribute it and/or modify it - under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - XDHq is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with XDHq. If not, see . -*/ - -// XDH UPStream. -// Stuff related to the server part. - -#ifndef XDH_UPS_INC_ -# define XDH_UPS_INC_ - -# include "csdscb.h" -# include "sclnjs.h" -# include "xdh_dws.h" - -namespace xdh_ups { - qENUM( Request ) - { - rAlert, - rConfirm, - rSetLayout, - rGetContents, - rSetContents, - rDressWidgets, - rSetCastsByIds, - rSetCastsByTags, - rGetAttribute, - rSetAttribute, - rGetProperty, - rSetProperty, - r_amount, - r_Undefined - }; - - struct rArguments - { - public: - str::wString Message, Id, XML, XSLFilename, Language, Name, Value; - str::wStrings Ids, Contents, Tags, Values; - void reset( bso::sBool P = true ) - { - tol::reset( Message, Id, XML, XSLFilename, Language, Name, Value, Ids, Contents, Tags, Values ); - } - qCDTOR( rArguments ); - void Init( void ) - { - tol::Init( Message, Id, XML, XSLFilename, Language, Name, Value, Ids, Contents, Tags, Values ); - } - }; - - struct rServer - { - public: - eRequest Request; - rArguments Arguments; - void reset( bso::sBool P = true ) - { - Request = r_Undefined; - Arguments.reset( P ); - } - qCDTOR( rServer ); - void Init( void ) - { - Request = r_Undefined; - Arguments.Init(); - } - }; - - bso::sBool Send( - flw::sWFlow &Flow, - rServer & Server ); - - bso::sBool Recv( - eRequest Id, - flw::sRFlow &Flow, - xdh_dws::rArguments &Arguments ); -} - -#endif diff --git a/src/xdhp.cpp b/src/xdhp.cpp index 3d3577d..9e04a5f 100755 --- a/src/xdhp.cpp +++ b/src/xdhp.cpp @@ -20,8 +20,8 @@ #include "xdhp.h" #include "registry.h" +#include "proxy.h" #include "treep.h" -#include "xdh_cmn.h" #include "csdbns.h" #include "csdcmn.h" @@ -119,13 +119,104 @@ namespace { namespace { qCDEF( char *, Id_, "_q37XDHRack" ); + namespace { + typedef proxy::rData rPData_; + } + + qENUM( Status_ ) { + sNew, // New connexion. + sAction, // Action to be handled. + sPending, // A response of an action has to be handled. + s_amount, + s_Undefined + }; + + class rData_ + : public rPData_ + { + public: + sclnjs::rCallback Callback; + sclnjs::rObject XDH; // User overloaded 'XDH' JS class. + eStatus_ Status; + void reset( bso::sBool P = true ) + { + rPData_::reset( P ); + tol::reset( P, Callback, XDH ); + Status = s_Undefined; + } + qCVDTOR( rData_ ); + void Init( void ) + { + rPData_::Init(); + + tol::Init( Callback, XDH ); + Status = s_Undefined; + } + }; + + sclnjs::rCallback ConnectCallback_; + + proxy::rSharing Sharing_; + + namespace { + typedef proxy::rProcessing rPProcessing_; + + class rProcessing_ + : public rPProcessing_ + { + protected: + rData_ *PRXYNew( void ) override + { + rData_ *Data = new rData_; + + if ( Data == NULL ) + qRAlc(); + + Data->Init(); + Data->Status = sNew; + + Sharing_.Write( Data ); + + return Data; + } + void PRXYOnAction( rData_ *Data ) override + { + Data->Status = sAction; + ::Sharing_.Write( Data ); + } + void PRXYOnPending( rData_ *Data ) override + { + Data->Status = sPending; + Sharing_.Write( Data ); + } + }; + } + class rXDHRack_ : public sclnjs::cAsync { private: - xdh_cmn::rProcessing Processing_; + rProcessing_ Processing_; csdmns::rServer Server_; - qRMV( xdh_cmn::rData, D_, Data_ ); + qRMV( rData_, D_, Data_ ); + void SetCallbackArguments_( + const proxy::rReturn &Return, + sclnjs::dArguments &Arguments ) + { + switch ( Return.GetType() ) { + case prxy_recv::tString: + Arguments.Add( Return.GetString() ); + break; + case prxy_recv::tStrings: + Arguments.Add( Return.GetStrings() ); + break; + case prxy_recv::t_Undefined: + break; + default: + qRGnr(); + break; + } + } protected: virtual void UVQWork( void ) override { @@ -138,23 +229,16 @@ namespace { return sclnjs::bRelaunch; } public: - xdh_cmn::rSharing Sharing; - sclnjs::rCallback ConnectCallback; void reset( bso::sBool P = true ) { - tol::reset( P, Sharing, Processing_, Server_, ConnectCallback ); + tol::reset( P, Processing_, Server_ ); Data_ = NULL; } qCDTOR( rXDHRack_ ); - void Init( - csdbns::sService Service, - sclnjs::rCallback &ConnectCallback ) + void Init( csdbns::sService Service ) { - Sharing.Init(); - Processing_.Init( Sharing ); + Processing_.Init(); Server_.Init( Service, Processing_ ); - this->ConnectCallback.Init(); - this->ConnectCallback = ConnectCallback; mtk::Launch( LaunchServer_, &Server_ ); Data_ = NULL; } @@ -163,33 +247,51 @@ namespace { if ( Data_ != NULL ) qRGnr(); - Data_ = &Sharing.ReadJS(); + Data_ = (rData_ *)Sharing_.Read(); } void HandleData( void ) { qRH; sclnjs::rCallback Callback; + sclnjs::wArguments Arguments; qRB; - xdh_cmn::rData &Data = D_(); + rData_ &Data = D_(); Callback.Init(); - Callback = Data.JS.Callback; - Data.JS.Callback.reset( false ); + Callback = Data.Callback; + Data.Callback.reset( false ); - if ( Callback.HasAssignation() ) { // There is a pending callback. - Callback.VoidLaunch( Data.JS.Arguments.Core() ); - Callback.reset( false ); - } else if ( Data.JS.Action.Amount() != 0 ) { // No pending callback, but an action has to be handled launched. + switch ( Data.Status ) { + case sNew: + Data.Recv.ReadBegin(); + ConnectCallback_.ObjectLaunch( Data.XDH ); + Data.XDH.Set( Id_, &Data ); + Data.Recv.ReadEnd(); + break; + case sAction: Callback.Init(); - Callback.Assign( Get_( Data.JS.Action ) ); - Callback.VoidLaunch( Data.XDH, Data.JS.Id ); + Data.Recv.ReadBegin(); + Callback.Assign( Get_( Data.Recv.Action ) ); + Callback.VoidLaunch( Data.XDH, Data.Recv.Id ); + Data.Recv.ReadEnd(); + if ( !Data.IsTherePendingRequest() ) + Data.Sent.WriteDismiss(); Callback.reset( false ); - tol::Init( Data.JS.Id, Data.JS.Action ); - } else { // A new connection was open. - ConnectCallback.ObjectLaunch( Data.XDH, Data.JS.Arguments.Core() ); - Data.XDH.Set( Id_, &Data ); + break; + case sPending: + Arguments.Init(); + Data.Recv.ReadBegin(); + SetCallbackArguments_( Data.Recv.Return, Arguments ); + Data.Recv.ReadEnd(); + Callback.VoidLaunch( Arguments ); + if ( !Data.IsTherePendingRequest() ) + Data.Sent.WriteDismiss(); + Callback.reset( false ); + break; + default: + qRGnr(); + break; } - Data.Unlock(); Data_ = NULL; qRR; qRT; @@ -268,16 +370,13 @@ SCLNJS_F( xdhp::Listen ) qRH; csdcmn::sVersion Version = csdcmn::UndefinedVersion; str::wString Arguments; - sclnjs::rCallback Callback; qRB; - tol::Init( Callback, Arguments ); - Caller.GetArgument( Callback, Arguments ); + tol::Init( Arguments ); + Caller.GetArgument( ConnectCallback_, Arguments ); sclargmnt::FillRegistry( Arguments, sclargmnt::faIsArgument, sclargmnt::uaReport ); - Rack_.Init( sclmisc::MGetU16( registry::parameter::Service ), Callback ); - - Callback.reset( false ); // To avoid the destruction of contained items, as their are now managed by the rack. + Rack_.Init( sclmisc::MGetU16( registry::parameter::Service ) ); #if 0 while ( true ) { @@ -294,16 +393,16 @@ qRE; #endif namespace { - xdh_cmn::rData &GetData_( sclnjs::sCaller &Caller ) + rData_ &GetData_( sclnjs::sCaller &Caller ) { - xdh_cmn::rData *Data = NULL; + rData_ *Data = NULL; qRH; sclnjs::rObject Object; qRB; Object.Init(); Caller.GetArgument( Object ); - Data = (xdh_cmn::rData * )Object.Get( Id_ ); + Data = (rData_ * )Object.Get( Id_ ); if ( Data == NULL ) qRGnr(); @@ -314,120 +413,175 @@ namespace { } } -#define DATA\ - xdh_cmn::rData &Data = GetData_( Caller );\ - xdh_ups::rServer &Server = Data.Server;\ - xdh_dws::rJS &JS = Data.JS;\ - xdh_ups::rArguments &Arguments = Server.Arguments;\ +#define ARGS_BEGIN\ + rData_ &Data = GetData_( Caller );\ + Data.Sent.WriteBegin();\ + proxy::rArguments &Arguments = Data.Sent.Arguments;\ Arguments.Init(); +#define ARGS_END Data.Sent.WriteEnd() + SCLNJS_F( xdhp::Alert ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Message, Data.Callback ); - Caller.GetArgument( Arguments.Message, JS.Callback ); + Data.Request = prxy_cmn::rAlert; - Server.Request = xdh_ups::rAlert; + ARGS_END; } SCLNJS_F( xdhp::Confirm ) { - DATA; + ARGS_BEGIN; - Caller.GetArgument( Arguments.Message, JS.Callback ); - - Server.Request = xdh_ups::rConfirm; -} + Caller.GetArgument( Arguments.Message, Data.Callback ); + Data.Request = prxy_cmn::rConfirm; + ARGS_END; +} SCLNJS_F( xdhp::SetLayout ) { - DATA; + ARGS_BEGIN; Caller.GetArgument( Arguments.Id ); treep::GetXML( Caller, Arguments.XML ); - Caller.GetArgument( Server.Arguments.XSLFilename, JS.Callback ); + Caller.GetArgument( Arguments.XSLFilename, Data.Callback ); Arguments.Language = Data.Language; - Server.Request = xdh_ups::rSetLayout; + Data.Request = prxy_cmn::rSetLayout; + + ARGS_END; } SCLNJS_F( xdhp::GetContents ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Ids, Data.Callback ); + Data.Request = prxy_cmn::rGetContents; - Caller.GetArgument( Arguments.Ids, JS.Callback ); - Server.Request = xdh_ups::rGetContents; + ARGS_END; } SCLNJS_F( xdhp::SetContents ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Ids, Arguments.Contents, Data.Callback ); + Data.Request = prxy_cmn::rSetContents; - Caller.GetArgument( Arguments.Ids, Arguments.Contents, JS.Callback ); - Server.Request = xdh_ups::rSetContents; + ARGS_END; } SCLNJS_F( xdhp::DressWidgets ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Id, Data.Callback ); + Data.Request = prxy_cmn::rDressWidgets; + + ARGS_END; +} + +SCLNJS_F( xdhp::AddClasses ) +{ + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Ids, Arguments.Classes, Data.Callback ); + Data.Request = prxy_cmn::rAddClasses; + + ARGS_END; +} + +SCLNJS_F( xdhp::RemoveClasses ) +{ + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Ids, Arguments.Classes, Data.Callback ); + Data.Request = prxy_cmn::rRemoveClasses; + + ARGS_END; +} + +SCLNJS_F( xdhp::ToggleClasses ) +{ + ARGS_BEGIN; - Caller.GetArgument( Arguments.Id, JS.Callback ); - Server.Request = xdh_ups::rDressWidgets; + Caller.GetArgument( Arguments.Ids, Arguments.Classes, Data.Callback ); + Data.Request = prxy_cmn::rToggleClasses; + + ARGS_END; } -SCLNJS_F( xdhp::SetCastsByIds ) +SCLNJS_F( xdhp::EnableElements ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Ids, Data.Callback ); + Data.Request = prxy_cmn::rEnableElements; - Caller.GetArgument( Arguments.Ids, Arguments.Values, JS.Callback ); - Server.Request = xdh_ups::rSetCastsByIds; + ARGS_END; } -SCLNJS_F( xdhp::SetCastsByTags ) +SCLNJS_F( xdhp::DisableElements ) { - DATA; + ARGS_BEGIN; - Caller.GetArgument( Arguments.Id, Arguments.Tags, Arguments.Values, JS.Callback ); - Server.Request = xdh_ups::rSetCastsByTags; + Caller.GetArgument( Arguments.Ids, Data.Callback ); + Data.Request = prxy_cmn::rDisableElements; + + ARGS_END; } SCLNJS_F( xdhp::GetAttribute ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Id, Arguments.Name, Data.Callback ); + Data.Request = prxy_cmn::rGetAttribute; - Caller.GetArgument( Arguments.Id, Arguments.Name, JS.Callback ); - Server.Request = xdh_ups::rGetAttribute; + ARGS_END; } SCLNJS_F( xdhp::SetAttribute ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Id, Arguments.Name, Arguments.Value, Data.Callback ); + Data.Request = prxy_cmn::rSetAttribute; - Caller.GetArgument( Arguments.Id, Arguments.Name, Arguments.Value, JS.Callback ); - Server.Request = xdh_ups::rSetAttribute; + ARGS_END; } SCLNJS_F( xdhp::GetProperty ) { - DATA; + ARGS_BEGIN; - Caller.GetArgument( Arguments.Id, Arguments.Name, JS.Callback ); - Server.Request = xdh_ups::rGetProperty; + Caller.GetArgument( Arguments.Id, Arguments.Name, Data.Callback ); + Data.Request = prxy_cmn::rGetProperty; + + ARGS_END; } SCLNJS_F( xdhp::SetProperty ) { - DATA; + ARGS_BEGIN; + + Caller.GetArgument( Arguments.Id, Arguments.Name, Arguments.Value, Data.Callback ); + Data.Request = prxy_cmn::rSetProperty; - Caller.GetArgument( Arguments.Id, Arguments.Name, Arguments.Value, JS.Callback ); - Server.Request = xdh_ups::rSetProperty; + ARGS_END; } qGCTOR( xdhp ) { Automat_.Init(); Callbacks_.Init(); + ConnectCallback_.Init(); + Sharing_.Init(); } \ No newline at end of file diff --git a/src/xdhp.h b/src/xdhp.h index 31e3bb4..c8dca7e 100755 --- a/src/xdhp.h +++ b/src/xdhp.h @@ -27,14 +27,18 @@ namespace xdhp { SCLNJS_F( Register ); SCLNJS_F( Listen ); + SCLNJS_F( Dismiss ); SCLNJS_F( Alert ); SCLNJS_F( Confirm ); SCLNJS_F( SetLayout ); SCLNJS_F( GetContents ); SCLNJS_F( SetContents ); SCLNJS_F( DressWidgets ); - SCLNJS_F( SetCastsByIds ); - SCLNJS_F( SetCastsByTags ); + SCLNJS_F( AddClasses ); + SCLNJS_F( RemoveClasses ); + SCLNJS_F( ToggleClasses ); + SCLNJS_F( EnableElements ); + SCLNJS_F( DisableElements ); SCLNJS_F( GetAttribute ); SCLNJS_F( SetAttribute ); SCLNJS_F( GetProperty ); diff --git a/src/xdhqnjs.cpp b/src/xdhqnjs.cpp index ce5c7d8..e50131d 100755 --- a/src/xdhqnjs.cpp +++ b/src/xdhqnjs.cpp @@ -56,8 +56,9 @@ void sclnjs::SCLNJSRegister( sclnjs::sRegistrar &Registrar ) Registrar.Register( ReturnArgument_ ); Registrar.Register( treep::New, treep::Delete, treep::PushTag, treep::PopTag, treep::PutValue, treep::PutAttribute ); // 1 - 6 Registrar.Register( xdhp::Register, xdhp::Listen ); // 7 - 8 - Registrar.Register( xdhp::Alert, xdhp::Confirm, xdhp::SetLayout, xdhp::GetContents, xdhp::SetContents, xdhp::DressWidgets, xdhp::SetCastsByIds, xdhp::SetCastsByTags ); // 9 - 16 - Registrar.Register( xdhp::GetAttribute, xdhp::SetAttribute, xdhp::GetProperty, xdhp::SetProperty ); // 17 - 20 + Registrar.Register( xdhp::Alert, xdhp::Confirm, xdhp::SetLayout, xdhp::GetContents, xdhp::SetContents, xdhp::DressWidgets ); // 9 - 14 + Registrar.Register( xdhp::AddClasses, xdhp::RemoveClasses, xdhp::ToggleClasses, xdhp::EnableElements, xdhp::DisableElements ); // 15 - 19. + Registrar.Register( xdhp::GetAttribute, xdhp::SetAttribute, xdhp::GetProperty, xdhp::SetProperty ); // 20 - 23. } const char *sclmisc::SCLMISCTargetName = NAME_LC;