Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_psengine.h

Issue 2253193003: Add llvm fuzzer for CPDF_PSEngine (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Copyright Date. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 #ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_PSENGINE_H_
8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_PSENGINE_H_
9
10 #include <vector>
Lei Zhang 2016/08/18 06:21:39 alphabetical order
Tom Sepez 2016/08/18 21:23:07 Done.
11 #include <memory>
12
13 #include "core/fxcrt/include/fx_system.h"
14
15 class CPDF_PSEngine;
16 class CPDF_PSOP;
17 class CPDF_SimpleParser;
18
19 enum PDF_PSOP {
20 PSOP_ADD,
21 PSOP_SUB,
22 PSOP_MUL,
23 PSOP_DIV,
24 PSOP_IDIV,
25 PSOP_MOD,
26 PSOP_NEG,
27 PSOP_ABS,
28 PSOP_CEILING,
29 PSOP_FLOOR,
30 PSOP_ROUND,
31 PSOP_TRUNCATE,
32 PSOP_SQRT,
33 PSOP_SIN,
34 PSOP_COS,
35 PSOP_ATAN,
36 PSOP_EXP,
37 PSOP_LN,
38 PSOP_LOG,
39 PSOP_CVI,
40 PSOP_CVR,
41 PSOP_EQ,
42 PSOP_NE,
43 PSOP_GT,
44 PSOP_GE,
45 PSOP_LT,
46 PSOP_LE,
47 PSOP_AND,
48 PSOP_OR,
49 PSOP_XOR,
50 PSOP_NOT,
51 PSOP_BITSHIFT,
52 PSOP_TRUE,
53 PSOP_FALSE,
54 PSOP_IF,
55 PSOP_IFELSE,
56 PSOP_POP,
57 PSOP_EXCH,
58 PSOP_DUP,
59 PSOP_COPY,
60 PSOP_INDEX,
61 PSOP_ROLL,
62 PSOP_PROC,
63 PSOP_CONST
64 };
65
66 constexpr uint32_t PSENGINE_STACKSIZE = 100;
67
68 class CPDF_PSProc {
69 public:
70 CPDF_PSProc();
71 ~CPDF_PSProc();
72
73 FX_BOOL Parse(CPDF_SimpleParser* parser);
74 FX_BOOL Execute(CPDF_PSEngine* pEngine);
75
76 private:
77 std::vector<std::unique_ptr<CPDF_PSOP>> m_Operators;
78 };
79
80 class CPDF_PSEngine {
81 public:
82 CPDF_PSEngine();
83 ~CPDF_PSEngine();
84
85 FX_BOOL Parse(const FX_CHAR* str, int size);
86 FX_BOOL Execute();
87 FX_BOOL DoOperator(PDF_PSOP op);
88 void Reset() { m_StackCount = 0; }
89 void Push(FX_FLOAT value);
90 void Push(int value) { Push((FX_FLOAT)value); }
91 FX_FLOAT Pop();
92 uint32_t GetStackSize() const { return m_StackCount; }
93
94 private:
95 FX_FLOAT m_Stack[PSENGINE_STACKSIZE];
96 uint32_t m_StackCount;
97 CPDF_PSProc m_MainProc;
98 };
99
100 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_PSENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_page/fpdf_page_func.cpp » ('j') | core/fpdfapi/fpdf_page/fpdf_page_func.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698