summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_formcalc_context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cfxjse_formcalc_context.cpp')
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp186
1 files changed, 95 insertions, 91 deletions
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 5319466cfa..40f4249ab7 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -32,6 +32,9 @@
#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
#include "xfa/fxfa/parser/xfa_utils.h"
+using pdfium::fxjse::kFuncTag;
+using pdfium::fxjse::kClassTag;
+
namespace {
const double kFinancialPrecision = 0.00000001;
@@ -218,97 +221,97 @@ const XFA_FMHtmlReserveCode kReservesForEncode[] = {
};
const FXJSE_FUNCTION_DESCRIPTOR kFormCalcFM2JSFunctions[] = {
- {"Abs", CFXJSE_FormCalcContext::Abs},
- {"Avg", CFXJSE_FormCalcContext::Avg},
- {"Ceil", CFXJSE_FormCalcContext::Ceil},
- {"Count", CFXJSE_FormCalcContext::Count},
- {"Floor", CFXJSE_FormCalcContext::Floor},
- {"Max", CFXJSE_FormCalcContext::Max},
- {"Min", CFXJSE_FormCalcContext::Min},
- {"Mod", CFXJSE_FormCalcContext::Mod},
- {"Round", CFXJSE_FormCalcContext::Round},
- {"Sum", CFXJSE_FormCalcContext::Sum},
- {"Date", CFXJSE_FormCalcContext::Date},
- {"Date2Num", CFXJSE_FormCalcContext::Date2Num},
- {"DateFmt", CFXJSE_FormCalcContext::DateFmt},
- {"IsoDate2Num", CFXJSE_FormCalcContext::IsoDate2Num},
- {"IsoTime2Num", CFXJSE_FormCalcContext::IsoTime2Num},
- {"LocalDateFmt", CFXJSE_FormCalcContext::LocalDateFmt},
- {"LocalTimeFmt", CFXJSE_FormCalcContext::LocalTimeFmt},
- {"Num2Date", CFXJSE_FormCalcContext::Num2Date},
- {"Num2GMTime", CFXJSE_FormCalcContext::Num2GMTime},
- {"Num2Time", CFXJSE_FormCalcContext::Num2Time},
- {"Time", CFXJSE_FormCalcContext::Time},
- {"Time2Num", CFXJSE_FormCalcContext::Time2Num},
- {"TimeFmt", CFXJSE_FormCalcContext::TimeFmt},
- {"Apr", CFXJSE_FormCalcContext::Apr},
- {"Cterm", CFXJSE_FormCalcContext::CTerm},
- {"FV", CFXJSE_FormCalcContext::FV},
- {"Ipmt", CFXJSE_FormCalcContext::IPmt},
- {"NPV", CFXJSE_FormCalcContext::NPV},
- {"Pmt", CFXJSE_FormCalcContext::Pmt},
- {"PPmt", CFXJSE_FormCalcContext::PPmt},
- {"PV", CFXJSE_FormCalcContext::PV},
- {"Rate", CFXJSE_FormCalcContext::Rate},
- {"Term", CFXJSE_FormCalcContext::Term},
- {"Choose", CFXJSE_FormCalcContext::Choose},
- {"Exists", CFXJSE_FormCalcContext::Exists},
- {"HasValue", CFXJSE_FormCalcContext::HasValue},
- {"Oneof", CFXJSE_FormCalcContext::Oneof},
- {"Within", CFXJSE_FormCalcContext::Within},
- {"If", CFXJSE_FormCalcContext::If},
- {"Eval", CFXJSE_FormCalcContext::Eval},
- {"Translate", CFXJSE_FormCalcContext::eval_translation},
- {"Ref", CFXJSE_FormCalcContext::Ref},
- {"UnitType", CFXJSE_FormCalcContext::UnitType},
- {"UnitValue", CFXJSE_FormCalcContext::UnitValue},
- {"At", CFXJSE_FormCalcContext::At},
- {"Concat", CFXJSE_FormCalcContext::Concat},
- {"Decode", CFXJSE_FormCalcContext::Decode},
- {"Encode", CFXJSE_FormCalcContext::Encode},
- {"Format", CFXJSE_FormCalcContext::Format},
- {"Left", CFXJSE_FormCalcContext::Left},
- {"Len", CFXJSE_FormCalcContext::Len},
- {"Lower", CFXJSE_FormCalcContext::Lower},
- {"Ltrim", CFXJSE_FormCalcContext::Ltrim},
- {"Parse", CFXJSE_FormCalcContext::Parse},
- {"Replace", CFXJSE_FormCalcContext::Replace},
- {"Right", CFXJSE_FormCalcContext::Right},
- {"Rtrim", CFXJSE_FormCalcContext::Rtrim},
- {"Space", CFXJSE_FormCalcContext::Space},
- {"Str", CFXJSE_FormCalcContext::Str},
- {"Stuff", CFXJSE_FormCalcContext::Stuff},
- {"Substr", CFXJSE_FormCalcContext::Substr},
- {"Uuid", CFXJSE_FormCalcContext::Uuid},
- {"Upper", CFXJSE_FormCalcContext::Upper},
- {"WordNum", CFXJSE_FormCalcContext::WordNum},
- {"Get", CFXJSE_FormCalcContext::Get},
- {"Post", CFXJSE_FormCalcContext::Post},
- {"Put", CFXJSE_FormCalcContext::Put},
- {"pos_op", CFXJSE_FormCalcContext::positive_operator},
- {"neg_op", CFXJSE_FormCalcContext::negative_operator},
- {"log_or_op", CFXJSE_FormCalcContext::logical_or_operator},
- {"log_and_op", CFXJSE_FormCalcContext::logical_and_operator},
- {"log_not_op", CFXJSE_FormCalcContext::logical_not_operator},
- {"eq_op", CFXJSE_FormCalcContext::equality_operator},
- {"neq_op", CFXJSE_FormCalcContext::notequality_operator},
- {"lt_op", CFXJSE_FormCalcContext::less_operator},
- {"le_op", CFXJSE_FormCalcContext::lessequal_operator},
- {"gt_op", CFXJSE_FormCalcContext::greater_operator},
- {"ge_op", CFXJSE_FormCalcContext::greaterequal_operator},
- {"plus_op", CFXJSE_FormCalcContext::plus_operator},
- {"minus_op", CFXJSE_FormCalcContext::minus_operator},
- {"mul_op", CFXJSE_FormCalcContext::multiple_operator},
- {"div_op", CFXJSE_FormCalcContext::divide_operator},
- {"asgn_val_op", CFXJSE_FormCalcContext::assign_value_operator},
- {"dot_acc", CFXJSE_FormCalcContext::dot_accessor},
- {"dotdot_acc", CFXJSE_FormCalcContext::dotdot_accessor},
- {"concat_obj", CFXJSE_FormCalcContext::concat_fm_object},
- {"is_obj", CFXJSE_FormCalcContext::is_fm_object},
- {"is_ary", CFXJSE_FormCalcContext::is_fm_array},
- {"get_val", CFXJSE_FormCalcContext::get_fm_value},
- {"get_jsobj", CFXJSE_FormCalcContext::get_fm_jsobj},
- {"var_filter", CFXJSE_FormCalcContext::fm_var_filter},
+ {kFuncTag, "Abs", CFXJSE_FormCalcContext::Abs},
+ {kFuncTag, "Avg", CFXJSE_FormCalcContext::Avg},
+ {kFuncTag, "Ceil", CFXJSE_FormCalcContext::Ceil},
+ {kFuncTag, "Count", CFXJSE_FormCalcContext::Count},
+ {kFuncTag, "Floor", CFXJSE_FormCalcContext::Floor},
+ {kFuncTag, "Max", CFXJSE_FormCalcContext::Max},
+ {kFuncTag, "Min", CFXJSE_FormCalcContext::Min},
+ {kFuncTag, "Mod", CFXJSE_FormCalcContext::Mod},
+ {kFuncTag, "Round", CFXJSE_FormCalcContext::Round},
+ {kFuncTag, "Sum", CFXJSE_FormCalcContext::Sum},
+ {kFuncTag, "Date", CFXJSE_FormCalcContext::Date},
+ {kFuncTag, "Date2Num", CFXJSE_FormCalcContext::Date2Num},
+ {kFuncTag, "DateFmt", CFXJSE_FormCalcContext::DateFmt},
+ {kFuncTag, "IsoDate2Num", CFXJSE_FormCalcContext::IsoDate2Num},
+ {kFuncTag, "IsoTime2Num", CFXJSE_FormCalcContext::IsoTime2Num},
+ {kFuncTag, "LocalDateFmt", CFXJSE_FormCalcContext::LocalDateFmt},
+ {kFuncTag, "LocalTimeFmt", CFXJSE_FormCalcContext::LocalTimeFmt},
+ {kFuncTag, "Num2Date", CFXJSE_FormCalcContext::Num2Date},
+ {kFuncTag, "Num2GMTime", CFXJSE_FormCalcContext::Num2GMTime},
+ {kFuncTag, "Num2Time", CFXJSE_FormCalcContext::Num2Time},
+ {kFuncTag, "Time", CFXJSE_FormCalcContext::Time},
+ {kFuncTag, "Time2Num", CFXJSE_FormCalcContext::Time2Num},
+ {kFuncTag, "TimeFmt", CFXJSE_FormCalcContext::TimeFmt},
+ {kFuncTag, "Apr", CFXJSE_FormCalcContext::Apr},
+ {kFuncTag, "Cterm", CFXJSE_FormCalcContext::CTerm},
+ {kFuncTag, "FV", CFXJSE_FormCalcContext::FV},
+ {kFuncTag, "Ipmt", CFXJSE_FormCalcContext::IPmt},
+ {kFuncTag, "NPV", CFXJSE_FormCalcContext::NPV},
+ {kFuncTag, "Pmt", CFXJSE_FormCalcContext::Pmt},
+ {kFuncTag, "PPmt", CFXJSE_FormCalcContext::PPmt},
+ {kFuncTag, "PV", CFXJSE_FormCalcContext::PV},
+ {kFuncTag, "Rate", CFXJSE_FormCalcContext::Rate},
+ {kFuncTag, "Term", CFXJSE_FormCalcContext::Term},
+ {kFuncTag, "Choose", CFXJSE_FormCalcContext::Choose},
+ {kFuncTag, "Exists", CFXJSE_FormCalcContext::Exists},
+ {kFuncTag, "HasValue", CFXJSE_FormCalcContext::HasValue},
+ {kFuncTag, "Oneof", CFXJSE_FormCalcContext::Oneof},
+ {kFuncTag, "Within", CFXJSE_FormCalcContext::Within},
+ {kFuncTag, "If", CFXJSE_FormCalcContext::If},
+ {kFuncTag, "Eval", CFXJSE_FormCalcContext::Eval},
+ {kFuncTag, "Translate", CFXJSE_FormCalcContext::eval_translation},
+ {kFuncTag, "Ref", CFXJSE_FormCalcContext::Ref},
+ {kFuncTag, "UnitType", CFXJSE_FormCalcContext::UnitType},
+ {kFuncTag, "UnitValue", CFXJSE_FormCalcContext::UnitValue},
+ {kFuncTag, "At", CFXJSE_FormCalcContext::At},
+ {kFuncTag, "Concat", CFXJSE_FormCalcContext::Concat},
+ {kFuncTag, "Decode", CFXJSE_FormCalcContext::Decode},
+ {kFuncTag, "Encode", CFXJSE_FormCalcContext::Encode},
+ {kFuncTag, "Format", CFXJSE_FormCalcContext::Format},
+ {kFuncTag, "Left", CFXJSE_FormCalcContext::Left},
+ {kFuncTag, "Len", CFXJSE_FormCalcContext::Len},
+ {kFuncTag, "Lower", CFXJSE_FormCalcContext::Lower},
+ {kFuncTag, "Ltrim", CFXJSE_FormCalcContext::Ltrim},
+ {kFuncTag, "Parse", CFXJSE_FormCalcContext::Parse},
+ {kFuncTag, "Replace", CFXJSE_FormCalcContext::Replace},
+ {kFuncTag, "Right", CFXJSE_FormCalcContext::Right},
+ {kFuncTag, "Rtrim", CFXJSE_FormCalcContext::Rtrim},
+ {kFuncTag, "Space", CFXJSE_FormCalcContext::Space},
+ {kFuncTag, "Str", CFXJSE_FormCalcContext::Str},
+ {kFuncTag, "Stuff", CFXJSE_FormCalcContext::Stuff},
+ {kFuncTag, "Substr", CFXJSE_FormCalcContext::Substr},
+ {kFuncTag, "Uuid", CFXJSE_FormCalcContext::Uuid},
+ {kFuncTag, "Upper", CFXJSE_FormCalcContext::Upper},
+ {kFuncTag, "WordNum", CFXJSE_FormCalcContext::WordNum},
+ {kFuncTag, "Get", CFXJSE_FormCalcContext::Get},
+ {kFuncTag, "Post", CFXJSE_FormCalcContext::Post},
+ {kFuncTag, "Put", CFXJSE_FormCalcContext::Put},
+ {kFuncTag, "pos_op", CFXJSE_FormCalcContext::positive_operator},
+ {kFuncTag, "neg_op", CFXJSE_FormCalcContext::negative_operator},
+ {kFuncTag, "log_or_op", CFXJSE_FormCalcContext::logical_or_operator},
+ {kFuncTag, "log_and_op", CFXJSE_FormCalcContext::logical_and_operator},
+ {kFuncTag, "log_not_op", CFXJSE_FormCalcContext::logical_not_operator},
+ {kFuncTag, "eq_op", CFXJSE_FormCalcContext::equality_operator},
+ {kFuncTag, "neq_op", CFXJSE_FormCalcContext::notequality_operator},
+ {kFuncTag, "lt_op", CFXJSE_FormCalcContext::less_operator},
+ {kFuncTag, "le_op", CFXJSE_FormCalcContext::lessequal_operator},
+ {kFuncTag, "gt_op", CFXJSE_FormCalcContext::greater_operator},
+ {kFuncTag, "ge_op", CFXJSE_FormCalcContext::greaterequal_operator},
+ {kFuncTag, "plus_op", CFXJSE_FormCalcContext::plus_operator},
+ {kFuncTag, "minus_op", CFXJSE_FormCalcContext::minus_operator},
+ {kFuncTag, "mul_op", CFXJSE_FormCalcContext::multiple_operator},
+ {kFuncTag, "div_op", CFXJSE_FormCalcContext::divide_operator},
+ {kFuncTag, "asgn_val_op", CFXJSE_FormCalcContext::assign_value_operator},
+ {kFuncTag, "dot_acc", CFXJSE_FormCalcContext::dot_accessor},
+ {kFuncTag, "dotdot_acc", CFXJSE_FormCalcContext::dotdot_accessor},
+ {kFuncTag, "concat_obj", CFXJSE_FormCalcContext::concat_fm_object},
+ {kFuncTag, "is_obj", CFXJSE_FormCalcContext::is_fm_object},
+ {kFuncTag, "is_ary", CFXJSE_FormCalcContext::is_fm_array},
+ {kFuncTag, "get_val", CFXJSE_FormCalcContext::get_fm_value},
+ {kFuncTag, "get_jsobj", CFXJSE_FormCalcContext::get_fm_jsobj},
+ {kFuncTag, "var_filter", CFXJSE_FormCalcContext::fm_var_filter},
};
const uint8_t kAltTableDate[] = {
@@ -607,6 +610,7 @@ double ByteStringToDouble(const ByteStringView& szStringVal) {
} // namespace
const FXJSE_CLASS_DESCRIPTOR kFormCalcFM2JSDescriptor = {
+ kClassTag, // tag
"XFA_FM2JS_FormCalcClass", // name
kFormCalcFM2JSFunctions, // methods
FX_ArraySize(kFormCalcFM2JSFunctions), // number of methods