Commit 2d2e3fc4 authored by Alexander.Trofimov's avatar Alexander.Trofimov

argumentsMin, argumentsMax move to prototype

parent f823b7cf
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
* @param {undefined} undefined * @param {undefined} undefined
*/ */
function (window, undefined) { function (window, undefined) {
var cElementType = AscCommonExcel.cElementType;
var cBaseFunction = AscCommonExcel.cBaseFunction; var cBaseFunction = AscCommonExcel.cBaseFunction;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup; var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
...@@ -52,9 +51,7 @@ ...@@ -52,9 +51,7 @@
function cCUBEKPIMEMBER() { function cCUBEKPIMEMBER() {
this.name = "CUBEKPIMEMBER"; this.name = "CUBEKPIMEMBER";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBEKPIMEMBER.prototype = Object.create(cBaseFunction.prototype); cCUBEKPIMEMBER.prototype = Object.create(cBaseFunction.prototype);
...@@ -67,9 +64,7 @@ ...@@ -67,9 +64,7 @@
function cCUBEMEMBER() { function cCUBEMEMBER() {
this.name = "CUBEMEMBER"; this.name = "CUBEMEMBER";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBEMEMBER.prototype = Object.create(cBaseFunction.prototype); cCUBEMEMBER.prototype = Object.create(cBaseFunction.prototype);
...@@ -82,9 +77,7 @@ ...@@ -82,9 +77,7 @@
function cCUBEMEMBERPROPERTY() { function cCUBEMEMBERPROPERTY() {
this.name = "CUBEMEMBERPROPERTY"; this.name = "CUBEMEMBERPROPERTY";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBEMEMBERPROPERTY.prototype = Object.create(cBaseFunction.prototype); cCUBEMEMBERPROPERTY.prototype = Object.create(cBaseFunction.prototype);
...@@ -97,9 +90,7 @@ ...@@ -97,9 +90,7 @@
function cCUBERANKEDMEMBER() { function cCUBERANKEDMEMBER() {
this.name = "CUBERANKEDMEMBER"; this.name = "CUBERANKEDMEMBER";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBERANKEDMEMBER.prototype = Object.create(cBaseFunction.prototype); cCUBERANKEDMEMBER.prototype = Object.create(cBaseFunction.prototype);
...@@ -112,9 +103,7 @@ ...@@ -112,9 +103,7 @@
function cCUBESET() { function cCUBESET() {
this.name = "CUBESET"; this.name = "CUBESET";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBESET.prototype = Object.create(cBaseFunction.prototype); cCUBESET.prototype = Object.create(cBaseFunction.prototype);
...@@ -127,9 +116,7 @@ ...@@ -127,9 +116,7 @@
function cCUBESETCOUNT() { function cCUBESETCOUNT() {
this.name = "CUBESETCOUNT"; this.name = "CUBESETCOUNT";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBESETCOUNT.prototype = Object.create(cBaseFunction.prototype); cCUBESETCOUNT.prototype = Object.create(cBaseFunction.prototype);
...@@ -142,9 +129,7 @@ ...@@ -142,9 +129,7 @@
function cCUBEVALUE() { function cCUBEVALUE() {
this.name = "CUBEVALUE"; this.name = "CUBEVALUE";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBEVALUE.prototype = Object.create(cBaseFunction.prototype); cCUBEVALUE.prototype = Object.create(cBaseFunction.prototype);
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
* @param {undefined} undefined * @param {undefined} undefined
*/ */
function (window, undefined) { function (window, undefined) {
var cElementType = AscCommonExcel.cElementType;
var cErrorType = AscCommonExcel.cErrorType; var cErrorType = AscCommonExcel.cErrorType;
var cNumber = AscCommonExcel.cNumber; var cNumber = AscCommonExcel.cNumber;
var cString = AscCommonExcel.cString; var cString = AscCommonExcel.cString;
...@@ -62,13 +61,13 @@ ...@@ -62,13 +61,13 @@
function cERROR_TYPE() { function cERROR_TYPE() {
this.name = "ERROR.TYPE"; this.name = "ERROR.TYPE";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cERROR_TYPE.prototype = Object.create(cBaseFunction.prototype); cERROR_TYPE.prototype = Object.create(cBaseFunction.prototype);
cERROR_TYPE.prototype.constructor = cERROR_TYPE; cERROR_TYPE.prototype.constructor = cERROR_TYPE;
cERROR_TYPE.prototype.argumentsMin = 1;
cERROR_TYPE.prototype.argumentsMax = 1;
cERROR_TYPE.prototype.Calculate = function (arg) { cERROR_TYPE.prototype.Calculate = function (arg) {
function typeError(elem) { function typeError(elem) {
if (elem instanceof cError) { if (elem instanceof cError) {
...@@ -127,13 +126,13 @@ ...@@ -127,13 +126,13 @@
function cISBLANK() { function cISBLANK() {
this.name = "ISBLANK"; this.name = "ISBLANK";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISBLANK.prototype = Object.create(cBaseFunction.prototype); cISBLANK.prototype = Object.create(cBaseFunction.prototype);
cISBLANK.prototype.constructor = cISBLANK; cISBLANK.prototype.constructor = cISBLANK;
cISBLANK.prototype.argumentsMin = 1;
cISBLANK.prototype.argumentsMax = 1;
cISBLANK.prototype.Calculate = function (arg) { cISBLANK.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArea || arg0 instanceof cArea3D) { if (arg0 instanceof cArea || arg0 instanceof cArea3D) {
...@@ -160,13 +159,13 @@ ...@@ -160,13 +159,13 @@
function cISERR() { function cISERR() {
this.name = "ISERR"; this.name = "ISERR";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISERR.prototype = Object.create(cBaseFunction.prototype); cISERR.prototype = Object.create(cBaseFunction.prototype);
cISERR.prototype.constructor = cISERR; cISERR.prototype.constructor = cISERR;
cISERR.prototype.argumentsMin = 1;
cISERR.prototype.argumentsMax = 1;
cISERR.prototype.Calculate = function (arg) { cISERR.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -196,13 +195,13 @@ ...@@ -196,13 +195,13 @@
function cISERROR() { function cISERROR() {
this.name = "ISERROR"; this.name = "ISERROR";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISERROR.prototype = Object.create(cBaseFunction.prototype); cISERROR.prototype = Object.create(cBaseFunction.prototype);
cISERROR.prototype.constructor = cISERROR; cISERROR.prototype.constructor = cISERROR;
cISERROR.prototype.argumentsMin = 1;
cISERROR.prototype.argumentsMax = 1;
cISERROR.prototype.Calculate = function (arg) { cISERROR.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -232,13 +231,13 @@ ...@@ -232,13 +231,13 @@
function cISEVEN() { function cISEVEN() {
this.name = "ISEVEN"; this.name = "ISEVEN";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISEVEN.prototype = Object.create(cBaseFunction.prototype); cISEVEN.prototype = Object.create(cBaseFunction.prototype);
cISEVEN.prototype.constructor = cISEVEN; cISEVEN.prototype.constructor = cISEVEN;
cISEVEN.prototype.argumentsMin = 1;
cISEVEN.prototype.argumentsMax = 1;
cISEVEN.prototype.Calculate = function (arg) { cISEVEN.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -273,13 +272,13 @@ ...@@ -273,13 +272,13 @@
function cISLOGICAL() { function cISLOGICAL() {
this.name = "ISLOGICAL"; this.name = "ISLOGICAL";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISLOGICAL.prototype = Object.create(cBaseFunction.prototype); cISLOGICAL.prototype = Object.create(cBaseFunction.prototype);
cISLOGICAL.prototype.constructor = cISLOGICAL; cISLOGICAL.prototype.constructor = cISLOGICAL;
cISLOGICAL.prototype.argumentsMin = 1;
cISLOGICAL.prototype.argumentsMax = 1;
cISLOGICAL.prototype.Calculate = function (arg) { cISLOGICAL.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -309,13 +308,13 @@ ...@@ -309,13 +308,13 @@
function cISNA() { function cISNA() {
this.name = "ISNA"; this.name = "ISNA";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISNA.prototype = Object.create(cBaseFunction.prototype); cISNA.prototype = Object.create(cBaseFunction.prototype);
cISNA.prototype.constructor = cISNA; cISNA.prototype.constructor = cISNA;
cISNA.prototype.argumentsMin = 1;
cISNA.prototype.argumentsMax = 1;
cISNA.prototype.Calculate = function (arg) { cISNA.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -345,13 +344,13 @@ ...@@ -345,13 +344,13 @@
function cISNONTEXT() { function cISNONTEXT() {
this.name = "ISNONTEXT"; this.name = "ISNONTEXT";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISNONTEXT.prototype = Object.create(cBaseFunction.prototype); cISNONTEXT.prototype = Object.create(cBaseFunction.prototype);
cISNONTEXT.prototype.constructor = cISNONTEXT; cISNONTEXT.prototype.constructor = cISNONTEXT;
cISNONTEXT.prototype.argumentsMin = 1;
cISNONTEXT.prototype.argumentsMax = 1;
cISNONTEXT.prototype.Calculate = function (arg) { cISNONTEXT.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -380,13 +379,13 @@ ...@@ -380,13 +379,13 @@
function cISNUMBER() { function cISNUMBER() {
this.name = "ISNUMBER"; this.name = "ISNUMBER";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISNUMBER.prototype = Object.create(cBaseFunction.prototype); cISNUMBER.prototype = Object.create(cBaseFunction.prototype);
cISNUMBER.prototype.constructor = cISNUMBER; cISNUMBER.prototype.constructor = cISNUMBER;
cISNUMBER.prototype.argumentsMin = 1;
cISNUMBER.prototype.argumentsMax = 1;
cISNUMBER.prototype.Calculate = function (arg) { cISNUMBER.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -416,13 +415,13 @@ ...@@ -416,13 +415,13 @@
function cISODD() { function cISODD() {
this.name = "ISODD"; this.name = "ISODD";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISODD.prototype = Object.create(cBaseFunction.prototype); cISODD.prototype = Object.create(cBaseFunction.prototype);
cISODD.prototype.constructor = cISODD; cISODD.prototype.constructor = cISODD;
cISODD.prototype.argumentsMin = 1;
cISODD.prototype.argumentsMax = 1;
cISODD.prototype.Calculate = function (arg) { cISODD.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -457,13 +456,13 @@ ...@@ -457,13 +456,13 @@
function cISREF() { function cISREF() {
this.name = "ISREF"; this.name = "ISREF";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISREF.prototype = Object.create(cBaseFunction.prototype); cISREF.prototype = Object.create(cBaseFunction.prototype);
cISREF.prototype.constructor = cISREF; cISREF.prototype.constructor = cISREF;
cISREF.prototype.argumentsMin = 1;
cISREF.prototype.argumentsMax = 1;
cISREF.prototype.Calculate = function (arg) { cISREF.prototype.Calculate = function (arg) {
if ((arg[0] instanceof cRef || arg[0] instanceof cArea || arg[0] instanceof cArea3D || if ((arg[0] instanceof cRef || arg[0] instanceof cArea || arg[0] instanceof cArea3D ||
arg[0] instanceof cRef3D) && arg[0].isValid && arg[0].isValid()) { arg[0] instanceof cRef3D) && arg[0].isValid && arg[0].isValid()) {
...@@ -485,13 +484,13 @@ ...@@ -485,13 +484,13 @@
function cISTEXT() { function cISTEXT() {
this.name = "ISTEXT"; this.name = "ISTEXT";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cISTEXT.prototype = Object.create(cBaseFunction.prototype); cISTEXT.prototype = Object.create(cBaseFunction.prototype);
cISTEXT.prototype.constructor = cISTEXT; cISTEXT.prototype.constructor = cISTEXT;
cISTEXT.prototype.argumentsMin = 1;
cISTEXT.prototype.argumentsMax = 1;
cISTEXT.prototype.Calculate = function (arg) { cISTEXT.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -521,13 +520,13 @@ ...@@ -521,13 +520,13 @@
function cN() { function cN() {
this.name = "N"; this.name = "N";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cN.prototype = Object.create(cBaseFunction.prototype); cN.prototype = Object.create(cBaseFunction.prototype);
cN.prototype.constructor = cN; cN.prototype.constructor = cN;
cN.prototype.argumentsMin = 1;
cN.prototype.argumentsMax = 1;
cN.prototype.numFormat = AscCommonExcel.cNumFormatNone; cN.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cN.prototype.Calculate = function (arg) { cN.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
...@@ -571,13 +570,12 @@ ...@@ -571,13 +570,12 @@
function cNA() { function cNA() {
this.name = "NA"; this.name = "NA";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 0;
} }
cNA.prototype = Object.create(cBaseFunction.prototype); cNA.prototype = Object.create(cBaseFunction.prototype);
cNA.prototype.constructor = cNA; cNA.prototype.constructor = cNA;
cNA.prototype.argumentsMax = 0;
cNA.prototype.Calculate = function () { cNA.prototype.Calculate = function () {
return this.value = new cError(cErrorType.not_available); return this.value = new cError(cErrorType.not_available);
}; };
...@@ -594,13 +592,13 @@ ...@@ -594,13 +592,13 @@
function cTYPE() { function cTYPE() {
this.name = "TYPE"; this.name = "TYPE";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cTYPE.prototype = Object.create(cBaseFunction.prototype); cTYPE.prototype = Object.create(cBaseFunction.prototype);
cTYPE.prototype.constructor = cTYPE; cTYPE.prototype.constructor = cTYPE;
cTYPE.prototype.argumentsMin = 1;
cTYPE.prototype.argumentsMax = 1;
cTYPE.prototype.Calculate = function (arg) { cTYPE.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArea || arg0 instanceof cArea3D) { if (arg0 instanceof cArea || arg0 instanceof cArea3D) {
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
* @param {undefined} undefined * @param {undefined} undefined
*/ */
function (window, undefined) { function (window, undefined) {
var cElementType = AscCommonExcel.cElementType;
var cErrorType = AscCommonExcel.cErrorType; var cErrorType = AscCommonExcel.cErrorType;
var cNumber = AscCommonExcel.cNumber; var cNumber = AscCommonExcel.cNumber;
var cString = AscCommonExcel.cString; var cString = AscCommonExcel.cString;
...@@ -60,13 +59,12 @@ ...@@ -60,13 +59,12 @@
function cAND() { function cAND() {
this.name = "AND"; this.name = "AND";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cAND.prototype = Object.create(cBaseFunction.prototype); cAND.prototype = Object.create(cBaseFunction.prototype);
cAND.prototype.constructor = cAND; cAND.prototype.constructor = cAND;
cAND.prototype.argumentsMin = 1;
cAND.prototype.Calculate = function (arg) { cAND.prototype.Calculate = function (arg) {
var argResult = null; var argResult = null;
for (var i = 0; i < arg.length; i++) { for (var i = 0; i < arg.length; i++) {
...@@ -139,13 +137,12 @@ ...@@ -139,13 +137,12 @@
function cFALSE() { function cFALSE() {
this.name = "FALSE"; this.name = "FALSE";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 0;
} }
cFALSE.prototype = Object.create(cBaseFunction.prototype); cFALSE.prototype = Object.create(cBaseFunction.prototype);
cFALSE.prototype.constructor = cFALSE; cFALSE.prototype.constructor = cFALSE;
cFALSE.prototype.argumentsMax = 0;
cFALSE.prototype.Calculate = function () { cFALSE.prototype.Calculate = function () {
return this.value = new cBool(false); return this.value = new cBool(false);
}; };
...@@ -162,13 +159,13 @@ ...@@ -162,13 +159,13 @@
function cIF() { function cIF() {
this.name = "IF"; this.name = "IF";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 3;
} }
cIF.prototype = Object.create(cBaseFunction.prototype); cIF.prototype = Object.create(cBaseFunction.prototype);
cIF.prototype.constructor = cIF; cIF.prototype.constructor = cIF;
cIF.prototype.argumentsMin = 1;
cIF.prototype.argumentsMax = 3;
cIF.prototype.Calculate = function (arg) { cIF.prototype.Calculate = function (arg) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2]; var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
...@@ -208,13 +205,13 @@ ...@@ -208,13 +205,13 @@
function cIFERROR() { function cIFERROR() {
this.name = "IFERROR"; this.name = "IFERROR";
this.value = null; this.value = null;
this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 2;
} }
cIFERROR.prototype = Object.create(cBaseFunction.prototype); cIFERROR.prototype = Object.create(cBaseFunction.prototype);
cIFERROR.prototype.constructor = cIFERROR; cIFERROR.prototype.constructor = cIFERROR;
cIFERROR.prototype.argumentsMin = 2;
cIFERROR.prototype.argumentsMax = 2;
cIFERROR.prototype.Calculate = function (arg) { cIFERROR.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -246,13 +243,13 @@ ...@@ -246,13 +243,13 @@
function cNOT() { function cNOT() {
this.name = "NOT"; this.name = "NOT";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cNOT.prototype = Object.create(cBaseFunction.prototype); cNOT.prototype = Object.create(cBaseFunction.prototype);
cNOT.prototype.constructor = cNOT; cNOT.prototype.constructor = cNOT;
cNOT.prototype.argumentsMin = 1;
cNOT.prototype.argumentsMax = 1;
cNOT.prototype.Calculate = function (arg) { cNOT.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
if (arg0 instanceof cArray) { if (arg0 instanceof cArray) {
...@@ -289,13 +286,12 @@ ...@@ -289,13 +286,12 @@
function cOR() { function cOR() {
this.name = "OR"; this.name = "OR";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cOR.prototype = Object.create(cBaseFunction.prototype); cOR.prototype = Object.create(cBaseFunction.prototype);
cOR.prototype.constructor = cOR; cOR.prototype.constructor = cOR;
cOR.prototype.argumentsMin = 1;
cOR.prototype.Calculate = function (arg) { cOR.prototype.Calculate = function (arg) {
var argResult = null; var argResult = null;
for (var i = 0; i < arg.length; i++) { for (var i = 0; i < arg.length; i++) {
...@@ -365,13 +361,12 @@ ...@@ -365,13 +361,12 @@
function cTRUE() { function cTRUE() {
this.name = "TRUE"; this.name = "TRUE";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 0;
} }
cTRUE.prototype = Object.create(cBaseFunction.prototype); cTRUE.prototype = Object.create(cBaseFunction.prototype);
cTRUE.prototype.constructor = cTRUE; cTRUE.prototype.constructor = cTRUE;
cTRUE.prototype.argumentsMax = 0;
cTRUE.prototype.Calculate = function () { cTRUE.prototype.Calculate = function () {
return this.value = new cBool(true); return this.value = new cBool(true);
}; };
......
...@@ -101,13 +101,13 @@ ...@@ -101,13 +101,13 @@
function cADDRESS() { function cADDRESS() {
this.name = "ADDRESS"; this.name = "ADDRESS";
this.value = null; this.value = null;
this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 5;
} }
cADDRESS.prototype = Object.create(cBaseFunction.prototype); cADDRESS.prototype = Object.create(cBaseFunction.prototype);
cADDRESS.prototype.constructor = cADDRESS; cADDRESS.prototype.constructor = cADDRESS;
cADDRESS.prototype.argumentsMin = 2;
cADDRESS.prototype.argumentsMax = 5;
cADDRESS.prototype.Calculate = function (arg) { cADDRESS.prototype.Calculate = function (arg) {
var rowNumber = arg[0], colNumber = arg[1], refType = arg[2] ? arg[2] : new cNumber(1), A1RefType = arg[3] ? var rowNumber = arg[0], colNumber = arg[1], refType = arg[2] ? arg[2] : new cNumber(1), A1RefType = arg[3] ?
arg[3] : new cBool(true), sheetName = arg[4] ? arg[4] : new cEmpty(); arg[3] : new cBool(true), sheetName = arg[4] ? arg[4] : new cEmpty();
...@@ -232,13 +232,13 @@ ...@@ -232,13 +232,13 @@
function cCHOOSE() { function cCHOOSE() {
this.name = "CHOOSE"; this.name = "CHOOSE";
this.value = null; this.value = null;
this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 30;
} }
cCHOOSE.prototype = Object.create(cBaseFunction.prototype); cCHOOSE.prototype = Object.create(cBaseFunction.prototype);
cCHOOSE.prototype.constructor = cCHOOSE; cCHOOSE.prototype.constructor = cCHOOSE;
cCHOOSE.prototype.argumentsMin = 2;
cCHOOSE.prototype.argumentsMax = 30;
cCHOOSE.prototype.Calculate = function (arg) { cCHOOSE.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
...@@ -274,13 +274,12 @@ ...@@ -274,13 +274,12 @@
function cCOLUMN() { function cCOLUMN() {
this.name = "COLUMN"; this.name = "COLUMN";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cCOLUMN.prototype = Object.create(cBaseFunction.prototype); cCOLUMN.prototype = Object.create(cBaseFunction.prototype);
cCOLUMN.prototype.constructor = cCOLUMN; cCOLUMN.prototype.constructor = cCOLUMN;
cCOLUMN.prototype.argumentsMax = 1;
cCOLUMN.prototype.Calculate = function (arg) { cCOLUMN.prototype.Calculate = function (arg) {
var arg0; var arg0;
if (this.argumentsCurrent == 0) { if (this.argumentsCurrent == 0) {
...@@ -308,13 +307,13 @@ ...@@ -308,13 +307,13 @@
function cCOLUMNS() { function cCOLUMNS() {
this.name = "COLUMNS"; this.name = "COLUMNS";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cCOLUMNS.prototype = Object.create(cBaseFunction.prototype); cCOLUMNS.prototype = Object.create(cBaseFunction.prototype);
cCOLUMNS.prototype.constructor = cCOLUMNS; cCOLUMNS.prototype.constructor = cCOLUMNS;
cCOLUMNS.prototype.argumentsMin = 1;
cCOLUMNS.prototype.argumentsMax = 1;
cCOLUMNS.prototype.Calculate = function (arg) { cCOLUMNS.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
var range; var range;
...@@ -351,13 +350,13 @@ ...@@ -351,13 +350,13 @@
function cHLOOKUP() { function cHLOOKUP() {
this.name = "HLOOKUP"; this.name = "HLOOKUP";
this.value = null; this.value = null;
this.argumentsMin = 3;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 4;
} }
cHLOOKUP.prototype = Object.create(cBaseFunction.prototype); cHLOOKUP.prototype = Object.create(cBaseFunction.prototype);
cHLOOKUP.prototype.constructor = cHLOOKUP; cHLOOKUP.prototype.constructor = cHLOOKUP;
cHLOOKUP.prototype.argumentsMin = 3;
cHLOOKUP.prototype.argumentsMax = 4;
cHLOOKUP.prototype.Calculate = function (arg) { cHLOOKUP.prototype.Calculate = function (arg) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2]; var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
var arg3 = this.argumentsCurrent == 4 ? arg[3].tocBool().value : true; var arg3 = this.argumentsCurrent == 4 ? arg[3].tocBool().value : true;
...@@ -474,13 +473,13 @@ ...@@ -474,13 +473,13 @@
function cINDEX() { function cINDEX() {
this.name = "INDEX"; this.name = "INDEX";
this.value = null; this.value = null;
this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 4;
} }
cINDEX.prototype = Object.create(cBaseFunction.prototype); cINDEX.prototype = Object.create(cBaseFunction.prototype);
cINDEX.prototype.constructor = cINDEX; cINDEX.prototype.constructor = cINDEX;
cINDEX.prototype.argumentsMin = 2;
cINDEX.prototype.argumentsMax = 4;
cINDEX.prototype.Calculate = function (arg) { cINDEX.prototype.Calculate = function (arg) {
var arg0 = arg[0], arg1 = arg[1] && (cElementType.empty !== arg[1].type) ? arg[1] : var arg0 = arg[0], arg1 = arg[1] && (cElementType.empty !== arg[1].type) ? arg[1] :
new cNumber(1), arg2 = arg[2] && (cElementType.empty !== arg[2].type) ? arg[2] : new cNumber(1), arg2 = arg[2] && (cElementType.empty !== arg[2].type) ? arg[2] :
...@@ -561,13 +560,13 @@ ...@@ -561,13 +560,13 @@
function cINDIRECT() { function cINDIRECT() {
this.name = "INDIRECT"; this.name = "INDIRECT";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 2;
} }
cINDIRECT.prototype = Object.create(cBaseFunction.prototype); cINDIRECT.prototype = Object.create(cBaseFunction.prototype);
cINDIRECT.prototype.constructor = cINDIRECT; cINDIRECT.prototype.constructor = cINDIRECT;
cINDIRECT.prototype.argumentsMin = 1;
cINDIRECT.prototype.argumentsMax = 2;
cINDIRECT.prototype.Calculate = function (arg) { cINDIRECT.prototype.Calculate = function (arg) {
var t = this, arg0 = arg[0].tocString(), arg1 = arg[1] ? arg[1] : var t = this, arg0 = arg[0].tocString(), arg1 = arg[1] ? arg[1] :
new cBool(true), r1 = arguments[1], wb = r1.worksheet.workbook, o = { new cBool(true), r1 = arguments[1], wb = r1.worksheet.workbook, o = {
...@@ -639,13 +638,13 @@ ...@@ -639,13 +638,13 @@
function cLOOKUP() { function cLOOKUP() {
this.name = "LOOKUP"; this.name = "LOOKUP";
this.value = null; this.value = null;
this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 3;
} }
cLOOKUP.prototype = Object.create(cBaseFunction.prototype); cLOOKUP.prototype = Object.create(cBaseFunction.prototype);
cLOOKUP.prototype.constructor = cLOOKUP; cLOOKUP.prototype.constructor = cLOOKUP;
cLOOKUP.prototype.argumentsMin = 2;
cLOOKUP.prototype.argumentsMax = 3;
cLOOKUP.prototype.Calculate = function (arg) { cLOOKUP.prototype.Calculate = function (arg) {
var arg0 = arg[0], arg1 = arg[1], arg2 = this.argumentsCurrent == 2 ? arg1 : arg[2], resC = -1, resR = -1; var arg0 = arg[0], arg1 = arg[1], arg2 = this.argumentsCurrent == 2 ? arg1 : arg[2], resC = -1, resR = -1;
...@@ -789,13 +788,13 @@ ...@@ -789,13 +788,13 @@
function cMATCH() { function cMATCH() {
this.name = "MATCH"; this.name = "MATCH";
this.value = null; this.value = null;
this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 3;
} }
cMATCH.prototype = Object.create(cBaseFunction.prototype); cMATCH.prototype = Object.create(cBaseFunction.prototype);
cMATCH.prototype.constructor = cMATCH; cMATCH.prototype.constructor = cMATCH;
cMATCH.prototype.argumentsMin = 2;
cMATCH.prototype.argumentsMax = 3;
cMATCH.prototype.Calculate = function (arg) { cMATCH.prototype.Calculate = function (arg) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : new cNumber(1); var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : new cNumber(1);
...@@ -899,13 +898,13 @@ ...@@ -899,13 +898,13 @@
function cOFFSET() { function cOFFSET() {
this.name = "OFFSET"; this.name = "OFFSET";
this.value = null; this.value = null;
this.argumentsMin = 3;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 5;
} }
cOFFSET.prototype = Object.create(cBaseFunction.prototype); cOFFSET.prototype = Object.create(cBaseFunction.prototype);
cOFFSET.prototype.constructor = cOFFSET; cOFFSET.prototype.constructor = cOFFSET;
cOFFSET.prototype.argumentsMin = 3;
cOFFSET.prototype.argumentsMax = 5;
cOFFSET.prototype.Calculate = function (arg) { cOFFSET.prototype.Calculate = function (arg) {
function validBBOX(bbox) { function validBBOX(bbox) {
...@@ -1003,13 +1002,12 @@ ...@@ -1003,13 +1002,12 @@
function cROW() { function cROW() {
this.name = "ROW"; this.name = "ROW";
this.value = null; this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cROW.prototype = Object.create(cBaseFunction.prototype); cROW.prototype = Object.create(cBaseFunction.prototype);
cROW.prototype.constructor = cROW; cROW.prototype.constructor = cROW;
cROW.prototype.argumentsMax = 1;
cROW.prototype.Calculate = function (arg) { cROW.prototype.Calculate = function (arg) {
var arg0; var arg0;
if (this.argumentsCurrent == 0) { if (this.argumentsCurrent == 0) {
...@@ -1037,13 +1035,13 @@ ...@@ -1037,13 +1035,13 @@
function cROWS() { function cROWS() {
this.name = "ROWS"; this.name = "ROWS";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cROWS.prototype = Object.create(cBaseFunction.prototype); cROWS.prototype = Object.create(cBaseFunction.prototype);
cROWS.prototype.constructor = cROWS; cROWS.prototype.constructor = cROWS;
cROWS.prototype.argumentsMin = 1;
cROWS.prototype.argumentsMax = 1;
cROWS.prototype.Calculate = function (arg) { cROWS.prototype.Calculate = function (arg) {
var arg0 = arg[0]; var arg0 = arg[0];
var range; var range;
...@@ -1080,13 +1078,13 @@ ...@@ -1080,13 +1078,13 @@
function cTRANSPOSE() { function cTRANSPOSE() {
this.name = "TRANSPOSE"; this.name = "TRANSPOSE";
this.value = null; this.value = null;
this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1;
} }
cTRANSPOSE.prototype = Object.create(cBaseFunction.prototype); cTRANSPOSE.prototype = Object.create(cBaseFunction.prototype);
cTRANSPOSE.prototype.constructor = cTRANSPOSE; cTRANSPOSE.prototype.constructor = cTRANSPOSE;
cTRANSPOSE.prototype.argumentsMin = 1;
cTRANSPOSE.prototype.argumentsMax = 1;
cTRANSPOSE.prototype.numFormat = AscCommonExcel.cNumFormatNone; cTRANSPOSE.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cTRANSPOSE.prototype.Calculate = function (arg) { cTRANSPOSE.prototype.Calculate = function (arg) {
...@@ -1220,13 +1218,13 @@ ...@@ -1220,13 +1218,13 @@
function cVLOOKUP() { function cVLOOKUP() {
this.name = "VLOOKUP"; this.name = "VLOOKUP";
this.value = null; this.value = null;
this.argumentsMin = 3;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 4;
} }
cVLOOKUP.prototype = Object.create(cBaseFunction.prototype); cVLOOKUP.prototype = Object.create(cBaseFunction.prototype);
cVLOOKUP.prototype.constructor = cVLOOKUP; cVLOOKUP.prototype.constructor = cVLOOKUP;
cVLOOKUP.prototype.argumentsMin = 3;
cVLOOKUP.prototype.argumentsMax = 4;
cVLOOKUP.prototype.Calculate = function (arg) { cVLOOKUP.prototype.Calculate = function (arg) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2]; var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
var arg3 = this.argumentsCurrent == 4 ? arg[3].tocBool().value : true; var arg3 = this.argumentsCurrent == 4 ? arg[3].tocBool().value : true;
......
...@@ -2278,16 +2278,16 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -2278,16 +2278,16 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}; };
/** @constructor */ /** @constructor */
function cBaseFunction(name, argMin, argMax) { function cBaseFunction(name) {
this.name = name; this.name = name;
this.value = null; this.value = null;
this.argumentsMin = argMin ? argMin : 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = argMax ? argMax : 255;
// this.isXLFN = rx_sFuncPref.test(this.name); // this.isXLFN = rx_sFuncPref.test(this.name);
} }
cBaseFunction.prototype.type = cElementType.func; cBaseFunction.prototype.type = cElementType.func;
cBaseFunction.prototype.argumentsMin = 0;
cBaseFunction.prototype.argumentsMax = 255;
cBaseFunction.prototype.numFormat = AscCommonExcel.cNumFormatFirstCell; cBaseFunction.prototype.numFormat = AscCommonExcel.cNumFormatFirstCell;
cBaseFunction.prototype.Calculate = function () { cBaseFunction.prototype.Calculate = function () {
this.value = new cError(cErrorType.wrong_name); this.value = new cError(cErrorType.wrong_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment