summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/xfa_program.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-14 14:14:16 -0400
committerDan Sinclair <dsinclair@chromium.org>2016-03-14 14:14:16 -0400
commit1770c021cf998ff1b33855b1397f6ea8ff9f7cd7 (patch)
tree285e39abd4b5872d8cd632b9e331b0667fdc3eae /xfa/fxfa/fm2js/xfa_program.cpp
parentf766ad219f66543654520f6a1955836f519e26d1 (diff)
downloadpdfium-1770c021cf998ff1b33855b1397f6ea8ff9f7cd7.tar.xz
Move xfa/src up to xfa/.
This CL moves the xfa/src files up to the xfa/ directory and fixes the includes, include guards, and build files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1803723002 .
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_program.cpp')
-rw-r--r--xfa/fxfa/fm2js/xfa_program.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/xfa/fxfa/fm2js/xfa_program.cpp b/xfa/fxfa/fm2js/xfa_program.cpp
new file mode 100644
index 0000000000..ef5efb214c
--- /dev/null
+++ b/xfa/fxfa/fm2js/xfa_program.cpp
@@ -0,0 +1,45 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/fm2js/xfa_program.h"
+
+CXFA_FMProgram::CXFA_FMProgram() : m_globalFunction(0) {}
+CXFA_FMProgram::~CXFA_FMProgram() {
+ if (m_globalFunction != 0) {
+ delete m_globalFunction;
+ m_globalFunction = 0;
+ }
+}
+int32_t CXFA_FMProgram::Init(const CFX_WideStringC& wsFormcalc) {
+ return m_parse.Init(wsFormcalc, &m_pErrorInfo);
+}
+int32_t CXFA_FMProgram::ParseProgram() {
+ CFX_PtrArray* expressions = 0;
+ m_parse.NextToken();
+ if (!m_pErrorInfo.message.IsEmpty()) {
+ return -1;
+ }
+ expressions = m_parse.ParseTopExpression();
+ if (!m_pErrorInfo.message.IsEmpty()) {
+ CXFA_FMExpression* e = 0;
+ for (int32_t u = 0; u < expressions->GetSize(); ++u) {
+ e = (CXFA_FMExpression*)expressions->GetAt(u);
+ if (e) {
+ delete e;
+ }
+ }
+ delete expressions;
+ return -1;
+ }
+ m_globalFunction =
+ new CXFA_FMFunctionDefinition(1, 1, FX_WSTRC(L""), 0, expressions);
+ return 0;
+}
+int32_t CXFA_FMProgram::TranslateProgram(CFX_WideTextBuf& wsJavaScript) {
+ m_globalFunction->ToJavaScript(wsJavaScript);
+ wsJavaScript.AppendChar(0);
+ return 0;
+}