Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
e3b18934
Commit
e3b18934
authored
Jun 06, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_checkCAreaArg -> _checkArguments
parent
b695e918
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
58 deletions
+64
-58
cell/model/FormulaObjects/mathematicFunctions.js
cell/model/FormulaObjects/mathematicFunctions.js
+8
-27
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+56
-31
No files found.
cell/model/FormulaObjects/mathematicFunctions.js
View file @
e3b18934
...
...
@@ -628,10 +628,7 @@
cBASE
.
prototype
.
argumentsMax
=
3
;
cBASE
.
prototype
.
isXLFN
=
true
;
cBASE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
argClone
[
2
]
=
this
.
_checkCAreaArg
(
arg
[
2
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
...
...
@@ -789,10 +786,7 @@
cCEILING_MATH
.
prototype
.
argumentsMax
=
3
;
cCEILING_MATH
.
prototype
.
isXLFN
=
true
;
cCEILING_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
argClone
[
2
]
=
this
.
_checkCAreaArg
(
arg
[
2
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
if
(
!
argClone
[
1
]){
...
...
@@ -848,9 +842,7 @@
cCEILING_PRECISE
.
prototype
.
argumentsMax
=
2
;
cCEILING_PRECISE
.
prototype
.
isXLFN
=
true
;
cCEILING_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
...
...
@@ -987,9 +979,7 @@
cCOMBINA
.
prototype
.
argumentsMax
=
2
;
cCOMBINA
.
prototype
.
isXLFN
=
true
;
cCOMBINA
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
...
...
@@ -1352,9 +1342,7 @@
cDECIMAL
.
prototype
.
argumentsMax
=
2
;
cDECIMAL
.
prototype
.
isXLFN
=
true
;
cDECIMAL
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocString
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
...
...
@@ -1825,9 +1813,7 @@
cFLOOR_PRECISE
.
prototype
.
argumentsMax
=
2
;
cFLOOR_PRECISE
.
prototype
.
isXLFN
=
true
;
cFLOOR_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
...
...
@@ -1873,10 +1859,7 @@
cFLOOR_MATH
.
prototype
.
argumentsMax
=
3
;
cFLOOR_MATH
.
prototype
.
isXLFN
=
true
;
cFLOOR_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
argClone
[
2
]
=
this
.
_checkCAreaArg
(
arg
[
2
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
if
(
!
argClone
[
1
]){
...
...
@@ -2080,9 +2063,7 @@
cISO_CEILING
.
prototype
.
argumentsMax
=
2
;
//cISO_CEILING.prototype.isXLFN = true;
cISO_CEILING
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
...
...
cell/model/FormulaObjects/parserFormula.js
View file @
e3b18934
...
...
@@ -2292,6 +2292,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this
.
name
=
name
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
this
.
findArgArrayIndex
=
null
;
// this.isXLFN = rx_sFuncPref.test(this.name);
}
...
...
@@ -2371,48 +2373,71 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
};
cBaseFunction
.
prototype
.
_findArrayInNumberArguments
=
function
(
inputArguments
,
calculateFunc
,
dNotCheckNumberType
){
var
argsArray
=
[];
for
(
var
i
=
0
;
i
<
inputArguments
.
length
;
i
++
){
if
(
cElementType
.
array
===
inputArguments
[
i
].
type
){
inputArguments
[
i
].
foreach
(
function
(
elem
,
r
,
c
)
{
var
arg
;
argsArray
=
[];
for
(
var
j
=
0
;
j
<
inputArguments
.
length
;
j
++
){
if
(
i
===
j
){
arg
=
elem
;
}
else
if
(
cElementType
.
array
===
inputArguments
[
j
].
type
){
arg
=
inputArguments
[
j
].
getElementRowCol
(
r
,
c
);
}
else
{
arg
=
inputArguments
[
j
];
}
if
(
arg
&&
((
dNotCheckNumberType
)
||
(
cElementType
.
number
===
arg
.
type
&&
!
dNotCheckNumberType
))){
argsArray
[
j
]
=
arg
.
getValue
();
}
else
{
argsArray
=
null
;
break
;
}
var
parseArray
=
function
(
array
){
array
.
foreach
(
function
(
elem
,
r
,
c
)
{
var
arg
;
argsArray
=
[];
for
(
var
j
=
0
;
j
<
inputArguments
.
length
;
j
++
){
if
(
i
===
j
){
arg
=
elem
;
}
else
if
(
cElementType
.
array
===
inputArguments
[
j
].
type
){
arg
=
inputArguments
[
j
].
getElementRowCol
(
r
,
c
);
}
else
{
arg
=
inputArguments
[
j
];
}
this
.
array
[
r
][
c
]
=
null
===
argsArray
?
new
cError
(
cErrorType
.
wrong_value_type
)
:
calculateFunc
(
argsArray
);
});
return
inputArguments
[
i
];
}
else
{
if
(
cElementType
.
string
===
inputArguments
[
i
].
type
&&
!
dNotCheckNumberType
){
return
new
cError
(
cErrorType
.
wrong_value_type
);
if
(
arg
&&
((
dNotCheckNumberType
)
||
(
cElementType
.
number
===
arg
.
type
&&
!
dNotCheckNumberType
))){
argsArray
[
j
]
=
arg
.
getValue
();
}
else
{
argsArray
=
null
;
break
;
}
}
this
.
array
[
r
][
c
]
=
null
===
argsArray
?
new
cError
(
cErrorType
.
wrong_value_type
)
:
calculateFunc
(
argsArray
);
});
return
array
;
};
if
(
null
!==
this
.
findArgArrayIndex
){
return
parseArray
(
inputArguments
[
this
.
findArgArrayIndex
]);
}
else
{
for
(
var
i
=
0
;
i
<
inputArguments
.
length
;
i
++
){
if
(
cElementType
.
array
===
inputArguments
[
i
].
type
){
return
parseArray
(
inputArguments
[
i
]);
}
else
{
argsArray
[
i
]
=
inputArguments
[
i
].
getValue
();
if
(
cElementType
.
string
===
inputArguments
[
i
].
type
&&
!
dNotCheckNumberType
){
return
new
cError
(
cErrorType
.
wrong_value_type
);
}
else
{
argsArray
[
i
]
=
inputArguments
[
i
].
getValue
();
}
}
}
}
return
calculateFunc
(
argsArray
);
};
cBaseFunction
.
prototype
.
_checkCAreaArg
=
function
(
arg
,
arg1
)
{
if
(
arg
instanceof
cArea
||
arg
instanceof
cArea3D
)
{
arg
=
arg
.
cross
(
arg1
);
cBaseFunction
.
prototype
.
_checkArguments
=
function
(
args
,
arg1
)
{
var
newArgs
=
[];
this
.
findArgArrayIndex
=
null
;
for
(
var
i
=
0
;
i
<
args
.
length
;
i
++
){
var
arg
=
args
[
i
];
if
(
cElementType
.
cellsRange
===
arg
.
type
||
cElementType
.
cellsRange3D
===
arg
.
type
)
{
newArgs
[
i
]
=
arg
.
cross
(
arg1
);
}
else
if
(
cElementType
.
array
===
arg
.
type
){
this
.
findArgArrayIndex
=
i
;
newArgs
[
i
]
=
arg
;
}
else
{
newArgs
[
i
]
=
arg
;
}
}
return
arg
;
return
newArgs
;
};
cBaseFunction
.
prototype
.
_checkErrorArg
=
function
(
argArray
)
{
for
(
var
i
=
0
;
i
<
argArray
.
length
;
i
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment