![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/keeview_app/html/ |
Upload File : |
if (function () { var core = { fcall: {} }; core.getfunc = function (core) { return function (n) { var i, st; if (core.fcall[n] === undefined) { st = "return func("; for (i = 0; i < n; i++) { if (i > 0) st += ", "; st += "params[" + i + "]"; } st += ");"; core.fcall[n] = new Function("func", "params", st); } return core.fcall[n]; } } (core); core.funcCall = function (core) { return function (host, varfunc, funcdata, params) { var i, n = params.length, v = [], f; for (i = 0; i < n; i++) { v.push(host.calc(params[i], varfunc)); } f = core.getfunc(n); try { v = f(funcdata.calc, v); return v; } catch (e) { console.error(e); } return NaN; } } (core); core.afuncCall = function (core) { return function (host, varfunc, funcdata, params, callbackfunc) { var fetch = { index: 0, r: [], host: host, varfunc: varfunc, funcdata: funcdata, params: params, callbackfunc: callbackfunc }; fetch.run = function (fetch) { return function () { var i, n, v, f; if (fetch.r.length < fetch.params.length) { setTimeout(function (fetch) { return function () { fetch.host.acalc(fetch.params[fetch.r.length], fetch.varfunc, function (value) { fetch.r.push(value); setTimeout (function () { fetch.run(); }, 0); }); } } (fetch), 0); return; } if (fetch.funcdata.acalc === undefined) { f = core.getfunc(fetch.r.length); try { v = f(fetch.funcdata.calc, fetch.r); setTimeout (function (value, fetch) { return function () { fetch.callbackfunc(value); } } (v, fetch), 0); return; } catch (e) { console.error(e); } setTimeout (function (fetch) { return function () { fetch.callbackfunc(NaN); } } (fetch), 0); return; } fetch.r.unshift(function (fetch) { return function (value) { setTimeout (function (value, fetch) { return function () { fetch.callbackfunc(value); } } (value, fetch), 0); } } (fetch)); f = core.getfunc(fetch.r.length); f(fetch.funcdata.acalc, fetch.r); } } (fetch); setTimeout(function (fetch) { return function () { fetch.run(); } } (fetch), 0); } } (core); core.oprCall = function (core) { return function (host, varfunc, opr, params) { var v1, v2; try { if (opr.isSingle) { v2 = host.calc(params[1], varfunc); v1 = opr.calc(v2); } else { v1 = host.calc(params[0], varfunc); v2 = host.calc(params[1], varfunc); v1 = opr.calc(v1, v2); } return v1; } catch (e) { console.error(e); } return NaN; } } (core); core.aoprCall = function (core) { return function (host, varfunc, opr, params, callbackfunc) { var fetch = { host: host, varfunc: varfunc, opr: opr, params: params, callbackfunc: callbackfunc } if (opr.isSingle) { fetch.r = [0]; } else { fetch.r = []; } fetch.run = function (fetch) { var v; return function () { if (fetch.r.length < fetch.params.length) { setTimeout(function (fetch) { return function () { fetch.host.acalc(fetch.params[fetch.r.length], fetch.varfunc, function (value) { fetch.r.push(value); setTimeout (function () { fetch.run(); }, 0); }); } } (fetch), 0); return; } if (fetch.opr.isSingle) { if (fetch.opr.acalc === undefined) { v = fetch.opr.calc(fetch.r[1]); setTimeout(function (value, callbackfunc) { return function () { callbackfunc(value); } } (v, fetch.callbackfunc), 0); return; } fetch.opr.acalc( function (fetch) { return function (value) { setTimeout (function (value, fetch) { return function () { fetch.callbackfunc(value); } } (value, fetch), 0); } } (fetch), fetch.r[1] ); return; } if (fetch.opr.acalc === undefined) { v = fetch.opr.calc(fetch.r[0], fetch.r[1]); setTimeout(function (value, callbackfunc) { return function () { callbackfunc(value); } } (v, fetch.callbackfunc), 0); return; } fetch.opr.acalc( function (fetch) { return function (value) { setTimeout (function (value, fetch) { return function () { fetch.callbackfunc(value); } } (value, fetch), 0); } } (fetch), fetch.r[0], fetch.r[1] ); } } (fetch); setTimeout(function (fetch) { return function () { fetch.run(); } } (fetch), 0); } } (core); var createExpressionObject = function (core) { return function () { var host = { lastparsed : "", oprs: [], oprsl: [], odict: {}, funcs: [], fdict: {}, lastpriority: 10 }; host.setCaseInsensitive = function (host) { return function () { host.caseInsensitive = true; } } (host); host.newPriority = function (host) { return function () { return ++host.lastpriority; } } (host) host.addOperator = function (host) { return function (oprdata) { var i, l, index, ok = false; var temp = { symbols: oprdata.symbols, priority: host.lastpriority, calc: oprdata.calc }; if (oprdata.isSingle === true) { temp.isSingle = true; temp.priority = 1000000; } else { temp.isSingle = false; } host.odict[oprdata.symbols] = temp; host.oprs.push(temp); } } (host); host.addFunction = function (host) { return function (funcdata) { var fname = funcdata.name; if (host.caseInsensitive) fname = fname.toLowerCase(); var temp = { name: fname, calc: funcdata.calc }; host.fdict[fname] = temp; host.funcs.push(temp); } } (host); host.isopr = function (host) { return function (str, cStack) { var i, sl, index; var forceSingle = false; if (cStack.length == 0) { forceSingle = true; } else if ((cStack[cStack.length - 1].type == "opr") && (cStack[cStack.length - 1].value != ")")) { forceSingle = true; } if (!forceSingle) { for (i = 0; i < host.oprs.length; i++) { index = host.oprsl[i]; if (host.oprs[index].isSingle === true) continue; sl = host.oprs[index].symbols.length; if (str.substr(0, sl) == host.oprs[index].symbols) { return index; } } } for (i = 0; i < host.oprs.length; i++) { index = host.oprsl[i]; if (host.oprs[index].isSingle !== true) continue; sl = host.oprs[index].symbols.length; if (str.substr(0, sl) == host.oprs[index].symbols) { return index; } } return -1; } } (host); host.parse = function (host) { return function (st) { var is = [], sx, sa, so, f1, pos, olds, startpos, priority; var buffer, stack, slen; var oindex; host.lastparsed = ""; if (st === undefined) null; if (st == null) return null; olds = st; pos = 0; while (st != "") { so = st; sx = st.substr(0, 1); st = st.substr(1); startpos = pos++; if (st != "") sa = st.substr(0, 1); else sa = ""; if (sx == " ") continue; if (sx == "\r") continue; if (sx == "\n") continue; if (sx == "\t") continue; if (sx == "\"") { // string sx = ""; while (sa != "\"") { sx += sa; if (st != "") { st = st.substr(1); sa = st.substr(0, 1); pos++; } else { host.lastparsed = olds.substr(0, startpos + 1); return null; } } st = st.substr(1); sa = st.substr(0, 1); pos++; if (is.length > 0) { if (is[is.length - 1].type != "opr") { host.lastparsed = olds.substr(0, startpos + 1); return null; } if (is[is.length - 1].value == ")") { host.lastparsed = olds.substr(0, startpos + 1); return null; } } is.push({ type: "string", startpos: startpos, endpos: pos, value: sx }); } else if (sx == "'") { // string sx = ""; while (sa != "'") { sx += sa; if (st != "") { st = st.substr(1); sa = st.substr(0, 1); pos++; } else { host.lastparsed = olds.substr(0, startpos + 1); return null; } } st = st.substr(1); sa = st.substr(0, 1); pos++; if (is.length > 0) { if (is[is.length - 1].type != "opr") { host.lastparsed = olds.substr(0, startpos + 1); return null; } if (is[is.length - 1].value == ")") { host.lastparsed = olds.substr(0, startpos + 1); return null; } } is.push({ type: "string", startpos: startpos, endpos: pos, value: sx }); } else if (("0" <= sx) && (sx <= "9")) { // number f1 = 0; while ((("0" <= sa) && (sa <= "9")) || (sa == ".")) { if (sa == ".") { if (f1 == 1) { host.lastparsed = olds.substr(0, pos); return null; } f1 = 1; } sx += sa; if (st != "") { st = st.substr(1); sa = st.substr(0, 1); pos++; } else sa = ""; } if (is.length > 0) { if (is[is.length - 1].type != "opr") { host.lastparsed = olds.substr(0, startpos + 1); return null; } if (is[is.length - 1].value == ")") { host.lastparsed = olds.substr(0, startpos + 1); return null; } } is.push({ type: "number", startpos: startpos, endpos: pos, value: parseFloat(sx) }); } else if ((("a" <= sx) && (sx <= "z")) || (("A" <= sx) && (sx <= "Z")) || (sx == "_")) { // variable / function while ((("a" <= sa) && (sa <= "z")) || (("A" <= sa) && (sa <= "Z")) || (sa == "_") || (("0" <= sa) && (sa <= "9"))) { sx += sa; if (st != "") { st = st.substr(1); sa = st.substr(0, 1); pos++; } else sa = ""; } if (is.length > 0) { if (is[is.length - 1].type != "opr") { host.lastparsed = olds.substr(0, startpos + 1); return null; } if (is[is.length - 1].value == ")") { host.lastparsed = olds.substr(0, startpos + 1); return null; } } is.push({ type: "variable", startpos: startpos, endpos: pos, value: sx }); } else if ((oindex = host.isopr(so, is)) >= 0) { sx = host.oprs[oindex].symbols; st = so.substr(sx.length); if (host.oprs[oindex].isSingle) { if (is.length > 0) { if (is[is.length - 1].type != "opr") { host.lastparsed = olds.substr(0, startpos + 1); return null; } if (is[is.length - 1].value == ")") { host.lastparsed = olds.substr(0, startpos + 1); return null; } } is.push({ type: "number", priority: 999999, startpos: startpos, endpos: startpos + 1, value: 0 }); priority = host.lastpriority + 1000001; if (is.length >= 2) { if ((is[is.length - 2].type == "opr") && (is[is.length - 2].priority >= priority)) { priority = is[is.length - 2].priority + 1; } } } else { priority = host.oprs[oindex].priority; } is.push({ type: "opr", index: oindex, priority: priority, startpos: startpos, endpos: startpos + sx.length, value: sx }); pos += sx.length - 1; } else if (sx == "(") { if (is.length > 0) { if (is[is.length-1].type == "variable") { is[is.length-1].type = "function"; is.push({ type: "opr", priority: host.lastpriority + 1000001, startpos: pos, endpos: pos, value: "fconnector" }); } } is.push({ type: "opr", priority: 0, startpos: startpos, endpos: pos, value: sx }); } else if (sx == ",") { is.push({ type: "opr", priority: 1, startpos: startpos, endpos: pos, value: sx }); } else if (sx == ")") { if (is.length == 0) { host.lastparsed = olds.substr(0, startpos + 1); return null; } if ((is[is.length-1].type == "opr") && (is[is.length-1].value == "(")) { host.lastparsed = olds.substr(0, startpos + 1); return null; } is.push({ type: "opr", priority: 0, startpos: startpos, endpos: pos, value: sx }); } } if (is.length == 0) return null; buffer = []; stack = []; for (i = 0; i < is.length; i++) { if ((is[i].type != "variable") && (is[i].type != "number") && (is[i].type != "string") && (is[i].type != "function")) { if (stack.length > 0) { if (is[i].value == ")") { while (stack.length > 0) { if (stack[stack.length - 1].value != "(") { buffer.push(stack.pop()); } else { break; } } if (stack.length == 0) { host.lastparsed = olds.substr(0, is[i].startpos + 1); return null; } stack.pop(); } else if (is[i].value == "(") { stack.push(is[i]); } else { if (stack.length == 0) { host.lastparsed = olds.substr(0, is[i].startpos + 1); return null; } while (stack.length > 0) { if ((is[i].priority == 1000000) && (stack[stack.length - 1].priority == 1000000)) break; if (is[i].priority <= stack[stack.length - 1].priority) { buffer.push(stack.pop()); } else { break; } } stack.push(is[i]); } } else if (is[i].value != ")") { stack = [is[i]]; } else { host.lastparsed = olds.substr(0, is[i].startpos + 1); return null; } } else { buffer.push(is[i]); } } while (stack.length > 0) buffer.push(stack.pop()); for (i = 0; i < buffer.length; i++) { if ((buffer[i].type == "variable") || (buffer[i].type == "number") || (buffer[i].type == "string") || (buffer[i].type == "function")) { stack.push(buffer[i]); } else { if (stack.length < 2) return null; sa = stack.pop(); sx = stack.pop(); switch (buffer[i].value) { case ",": if (sx.type == "paramlist") { sx.params.push(sa); stack.push(sx); } else { stack.push({ type: "paramlist", params: [sx, sa] }); } break; case "fconnector": if (sa.type == "paramlist") { stack.push({ type: "function", name: sx.value, params: sa.params }); } else { stack.push({ type: "function", name: sx.value, params: [sa] }); } break; default: stack.push({ type: "opr", name: buffer[i].value, params: [sx, sa] }); } } } if (stack.length == 1) { sx = {}; sx.check = function (host, content) { return function (varfunc) { return host.check(content, varfunc); }; } (host, stack[0]); sx.calc = function (host, content) { return function (varfunc) { return host.calc(content, varfunc); }; } (host, stack[0]); sx.acalc = function (host, content) { return function (varfunc, callbackfunc) { return host.acalc(content, varfunc, callbackfunc); }; } (host, stack[0]); sx.getContent = function (content) { return function () { return EncodingClass.string.duplicate(content); } } (stack); stack = []; return sx; } return null; } } (host); host.check = function (host) { return function (exp, varfunc) { var i, fname; switch (exp.type) { case "number": case "string": return true; case "variable": fname = exp.value; if (host.caseInsensitive !== undefined) fname = fname.toLowerCase(); return varfunc(fname); case "function": if (exp.params === undefined) return false; fname = exp.name; if (host.caseInsensitive !== undefined) fname = fname.toLowerCase(); for (i = 0; i < exp.params.length; i++) { if (host.check(exp.params[i], varfunc) == false) return false; } if (fname == "if") return true; if (host.fdict[fname] === undefined) return false; return true; case "opr": if (exp.params === undefined) return false; for (i = 0; i < exp.params.length; i++) { if (host.check(exp.params[i], varfunc) == false) return false; } return true; default: return false; } } } (host); host.isvalid = function (host) { return function (expressionstring, varfunc) { var x = host.parse(expressionstring); if (x == null) return false; return x.check(varfunc); } } (host); host.calc = function (host, core) { return function (exp, varfunc) { var i, v, fname; switch (exp.type) { case "number": case "string": return exp.value; case "variable": fname = exp.value; if (host.caseInsensitive !== undefined) fname = fname.toLowerCase(); return varfunc(fname); case "function": fname = exp.name; if (host.caseInsensitive !== undefined) fname = fname.toLowerCase(); if (host.fdict[fname] !== undefined) return core.funcCall(host, varfunc, host.fdict[fname], exp.params); if (fname == "if") { if (host.calc(exp.params[0], varfunc)) { return host.calc(exp.params[1], varfunc); } else { return host.calc(exp.params[2], varfunc); } } return NaN; case "opr": return core.oprCall(host, varfunc, host.odict[exp.name], exp.params); } return NaN; } } (host, core); host.acalc = function (host, core) { return function (exp, varfunc, callbackfunc) { var i, v, fname; switch (exp.type) { case "number": case "string": setTimeout(function (value, callbackfunc) { return function () { callbackfunc(value); } } (exp.value, callbackfunc), 0); break; case "variable": fname = exp.value; if (host.caseInsensitive !== undefined) fname = fname.toLowerCase(); setTimeout(function (varfunc, fname, callbackfunc) { return function () { varfunc( function (callbackfunc) { return function (value) { setTimeout(function (value, callbackfunc) { return function () { callbackfunc(value); } } (value, callbackfunc), 0); } } (callbackfunc), fname ); } } (varfunc, fname, callbackfunc), 0); break; case "function": fname = exp.name; if (host.caseInsensitive !== undefined) fname = fname.toLowerCase(); if (host.fdict[fname] !== undefined) { core.afuncCall(host, varfunc, host.fdict[fname], exp.params, callbackfunc); break; } if (fname == "if") { host.acalc(exp.params[0], varfunc, function (exp, varfunc, callbackfunc) { return function (value) { if (value) { host.acalc(exp.params[1], varfunc, callbackfunc); } else { host.acalc(exp.params[2], varfunc, callbackfunc); } } } (exp, varfunc, callbackfunc)); break; } setTimeout(function (callbackfunc) { return function () { callbackfunc(NaN); } } (callbackfunc), 0); break; case "opr": core.aoprCall(host, varfunc, host.odict[exp.name], exp.params, callbackfunc); break; default: setTimeout(function (callbackfunc) { return function () { callbackfunc(NaN); } } (callbackfunc), 0); } } } (host, core); host.build = function (host) { return function () { var i, n = host.oprs.length; var r = {}; host.oprsl = []; for (i = 0; i < n; i++) { host.oprsl.push(i); } host.oprsl.sort(function (host) { return function (a, b) { return host.oprs[b].symbols.length - host.oprs[a].symbols.length; } } (host)); r.parse = function (host) { return function (varfunc) { return host.parse(varfunc); } } (host); r.isvalid = function (host) { return function (expressionstring, varfunc) { return host.isvalid(expressionstring, varfunc); } } (host); return r; } } (host); host.getFunctions = function (host) { return function (implicit) { var t = Object.keys(host.fdict); if (implicit === undefined) implicit = true; if (implicit) { if (host.fdict["if"] === undefined) t.push("if"); } t.sort(); return t; } } (host); var retval = {}; retval.setCaseInsensitive = function (host) { return function () { return host.setCaseInsensitive(); } } (host); retval.newPriority = function (host) { return function () { return host.newPriority(); } } (host); retval.addOperator = function (host) { return function (oprdata) { return host.addOperator(oprdata); } } (host); retval.addFunction = function (host) { return function (funcdata) { return host.addFunction(funcdata); } } (host); retval.build = function (host) { return function () { return host.build(); } } (host); retval.getFunctions = function (host) { return function (implicit) { return host.getFunctions(implicit); } } (host); return retval; } } (core); var sample = createExpressionObject(); sample.addOperator({ symbols: "!", isSingle: true, calc: (v) => !v }); sample.addOperator({ symbols: "~", isSingle: true, calc: (v) => ~v }); sample.addOperator({ symbols: "-", isSingle: true, calc: (v) => -v }); sample.addOperator({ symbols: "&", calc: (a, b) => (a & b) }); sample.addOperator({ symbols: "&&", calc: (a, b) => (a && b) }); sample.addOperator({ symbols: "|", calc: (a, b) => (a | b) }); sample.addOperator({ symbols: "||", calc: (a, b) => (a || b) }); sample.newPriority(); sample.addOperator({ symbols: "=", calc: (a, b) => (a == b) }); sample.addOperator({ symbols: "==", calc: (a, b) => (a == b) }); sample.addOperator({ symbols: "<", calc: (a, b) => (a < b) }); sample.addOperator({ symbols: ">", calc: (a, b) => (a > b) }); sample.addOperator({ symbols: "<=", calc: (a, b) => (a <= b) }); sample.addOperator({ symbols: ">=", calc: (a, b) => (a >= b) }); sample.addOperator({ symbols: "!=", calc: (a, b) => (a != b) }); sample.addOperator({ symbols: "<>", calc: (a, b) => (a != b) }); sample.newPriority(); sample.addOperator({ symbols: "+", calc: (a, b) => (a + b) }); sample.addOperator({ symbols: "-", calc: (a, b) => (a - b) }); sample.newPriority(); sample.addOperator({ symbols: "*", calc: (a, b) => (a * b) }); sample.addOperator({ symbols: "/", calc: (a, b) => (a / b) }); sample.addOperator({ symbols: "%", calc: (a, b) => (a % b) }); sample.setCaseInsensitive(); sample.addFunction({ name: "round", calc: (a) => Math.round(a) }); sample.addFunction({ name: "floor", calc: (a) => Math.floor(a) }); sample.addFunction({ name: "ceil", calc: (a) => Math.ceil(a) }); sample.addFunction({ name: "sqr", calc: (a) => (a * a) }); sample.addFunction({ name: "sqrt", calc: (a) => Math.sqrt(a) }); sample.addFunction({ name: "exp", calc: (a) => Math.exp(a) }); sample.addFunction({ name: "pow", calc: (a, b) => Math.pow(a, b) }); sample.addFunction({ name: "ln", calc: (a) => Math.log(a) }); sample.addFunction({ name: "log", calc: (a, b) => Math.log(b) / Math.log(a) }); sample.addFunction({ name: "min", calc: (...args) => Math.min(...args) }); sample.addFunction({ name: "max", calc: (...args) => Math.max(...args) }); var compatibleExpression = sample.build(); compatibleExpression.check = function (parsedContent, varfunc) { return parsedContent.check(varfunc); } compatibleExpression.calc = function (parsedContent, varfunc) { return parsedContent.calc(varfunc); } compatibleExpression.makeVarFunc = function (varContent) { var retval = {}; retval.check = function (varContent) { return function (varname) { return varContent[varname] !== undefined; } } (varContent); retval.calc = function (varContent) { return function (varname) { if (varContent[varname] === undefined) return NaN; return varContent[varname]; } } (varContent); retval.acalc = function (calc) { return function (callbackfunc, varname) { setTimeout(function () { var v = calc(varname); callbackfunc(v); }, 0); } } (retval.calc); return retval; } window.MathClass = Object.freeze({ Expression: Object.freeze(compatibleExpression), createExpressionObject: createExpressionObject, }); return 0; } () == 0) ; function mathFunctionsListText() { return ""; } function mathCheckDisplayTimeThread() { } function mathDisplayFunctionList() { }