OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #include "xfa/src/fxfa/fm2js/xfa_program.h" | |
8 | |
9 CXFA_FMProgram::CXFA_FMProgram() : m_globalFunction(0) {} | |
10 CXFA_FMProgram::~CXFA_FMProgram() { | |
11 if (m_globalFunction != 0) { | |
12 delete m_globalFunction; | |
13 m_globalFunction = 0; | |
14 } | |
15 } | |
16 int32_t CXFA_FMProgram::Init(const CFX_WideStringC& wsFormcalc) { | |
17 return m_parse.Init(wsFormcalc, &m_pErrorInfo); | |
18 } | |
19 int32_t CXFA_FMProgram::ParseProgram() { | |
20 CFX_PtrArray* expressions = 0; | |
21 m_parse.NextToken(); | |
22 if (!m_pErrorInfo.message.IsEmpty()) { | |
23 return -1; | |
24 } | |
25 expressions = m_parse.ParseTopExpression(); | |
26 if (!m_pErrorInfo.message.IsEmpty()) { | |
27 CXFA_FMExpression* e = 0; | |
28 for (int32_t u = 0; u < expressions->GetSize(); ++u) { | |
29 e = (CXFA_FMExpression*)expressions->GetAt(u); | |
30 if (e) { | |
31 delete e; | |
32 } | |
33 } | |
34 delete expressions; | |
35 return -1; | |
36 } | |
37 m_globalFunction = | |
38 new CXFA_FMFunctionDefinition(1, 1, FX_WSTRC(L""), 0, expressions); | |
39 return 0; | |
40 } | |
41 int32_t CXFA_FMProgram::TranslateProgram(CFX_WideTextBuf& wsJavaScript) { | |
42 m_globalFunction->ToJavaScript(wsJavaScript); | |
43 wsJavaScript.AppendChar(0); | |
44 return 0; | |
45 } | |
OLD | NEW |