1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/graphite2/src/inc/Pass.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,98 @@ 1.4 +/* GRAPHITE2 LICENSING 1.5 + 1.6 + Copyright 2010, SIL International 1.7 + All rights reserved. 1.8 + 1.9 + This library is free software; you can redistribute it and/or modify 1.10 + it under the terms of the GNU Lesser General Public License as published 1.11 + by the Free Software Foundation; either version 2.1 of License, or 1.12 + (at your option) any later version. 1.13 + 1.14 + This program is distributed in the hope that it will be useful, 1.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of 1.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.17 + Lesser General Public License for more details. 1.18 + 1.19 + You should also have received a copy of the GNU Lesser General Public 1.20 + License along with this library in the file named "LICENSE". 1.21 + If not, write to the Free Software Foundation, 51 Franklin Street, 1.22 + Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 1.23 + internet at http://www.fsf.org/licenses/lgpl.html. 1.24 + 1.25 +Alternatively, the contents of this file may be used under the terms of the 1.26 +Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public 1.27 +License, as published by the Free Software Foundation, either version 2 1.28 +of the License or (at your option) any later version. 1.29 +*/ 1.30 +#pragma once 1.31 + 1.32 +#include <cstdlib> 1.33 +#include "inc/Code.h" 1.34 + 1.35 +namespace graphite2 { 1.36 + 1.37 +class Segment; 1.38 +class Face; 1.39 +class Silf; 1.40 +struct Rule; 1.41 +struct RuleEntry; 1.42 +struct State; 1.43 +class FiniteStateMachine; 1.44 +class Error; 1.45 + 1.46 +class Pass 1.47 +{ 1.48 +public: 1.49 + Pass(); 1.50 + ~Pass(); 1.51 + 1.52 + bool readPass(const byte * pPass, size_t pass_length, size_t subtable_base, Face & face, Error &e); 1.53 + void runGraphite(vm::Machine & m, FiniteStateMachine & fsm) const; 1.54 + void init(Silf *silf) { m_silf = silf; } 1.55 + byte spaceContextuals() const { return (m_flags & 0x0E) >> 1; } 1.56 + 1.57 + CLASS_NEW_DELETE 1.58 +private: 1.59 + void findNDoRule(Slot* & iSlot, vm::Machine &, FiniteStateMachine& fsm) const; 1.60 + int doAction(const vm::Machine::Code* codeptr, Slot * & slot_out, vm::Machine &) const; 1.61 + bool testPassConstraint(vm::Machine & m) const; 1.62 + bool testConstraint(const Rule & r, vm::Machine &) const; 1.63 + bool readRules(const byte * rule_map, const size_t num_entries, 1.64 + const byte *precontext, const uint16 * sort_key, 1.65 + const uint16 * o_constraint, const byte *constraint_data, 1.66 + const uint16 * o_action, const byte * action_data, 1.67 + Face &, Error &e); 1.68 + bool readStates(const byte * starts, const byte * states, const byte * o_rule_map, Face &, Error &e); 1.69 + bool readRanges(const byte * ranges, size_t num_ranges, Error &e); 1.70 + uint16 glyphToCol(const uint16 gid) const; 1.71 + bool runFSM(FiniteStateMachine & fsm, Slot * slot) const; 1.72 + void dumpRuleEventConsidered(const FiniteStateMachine & fsm, const RuleEntry & re) const; 1.73 + void dumpRuleEventOutput(const FiniteStateMachine & fsm, const Rule & r, Slot * os) const; 1.74 + void adjustSlot(int delta, Slot * & slot_out, SlotMap &) const; 1.75 + const Silf* m_silf; 1.76 + uint16 * m_cols; 1.77 + Rule * m_rules; // rules 1.78 + RuleEntry * m_ruleMap; 1.79 + uint16 * m_startStates; // prectxt length 1.80 + uint16 * m_transitions; 1.81 + State * m_states; 1.82 + 1.83 + byte m_flags; 1.84 + byte m_iMaxLoop; 1.85 + uint16 m_numGlyphs; 1.86 + uint16 m_numRules; 1.87 + uint16 m_numStates; 1.88 + uint16 m_numTransition; 1.89 + uint16 m_numSuccess; 1.90 + uint16 m_successStart; 1.91 + uint16 m_numColumns; 1.92 + byte m_minPreCtxt; 1.93 + byte m_maxPreCtxt; 1.94 + vm::Machine::Code m_cPConstraint; 1.95 + 1.96 +private: //defensive 1.97 + Pass(const Pass&); 1.98 + Pass& operator=(const Pass&); 1.99 +}; 1.100 + 1.101 +} // namespace graphite2