cdsplit.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright 2006 Adrian Thurston <thurston@complang.org>
  3. */
  4. /* This file is part of Ragel.
  5. *
  6. * Ragel is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Ragel is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Ragel; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _CDSPLIT_H
  21. #define _CDSPLIT_H
  22. #include "cdipgoto.h"
  23. class SplitCodeGen : public IpGotoCodeGen
  24. {
  25. public:
  26. SplitCodeGen( ostream &out ) : FsmCodeGen(out), IpGotoCodeGen(out) {}
  27. bool ptOutLabelUsed;
  28. std::ostream &PART_MAP();
  29. std::ostream &EXIT_STATES( int partition );
  30. std::ostream &PART_TRANS( int partition );
  31. std::ostream &TRANS_GOTO( RedTransAp *trans, int level );
  32. void GOTO_HEADER( RedStateAp *state, bool stateInPartition );
  33. std::ostream &STATE_GOTOS( int partition );
  34. std::ostream &PARTITION( int partition );
  35. std::ostream &ALL_PARTITIONS();
  36. void writeData();
  37. void writeExec();
  38. void writeParts();
  39. void setLabelsNeeded( RedStateAp *fromState, GenInlineList *inlineList );
  40. void setLabelsNeeded( RedStateAp *fromState, RedTransAp *trans );
  41. void setLabelsNeeded();
  42. int currentPartition;
  43. };
  44. struct CSplitCodeGen
  45. : public SplitCodeGen, public CCodeGen
  46. {
  47. CSplitCodeGen( ostream &out ) :
  48. FsmCodeGen(out), SplitCodeGen(out), CCodeGen(out) {}
  49. };
  50. /*
  51. * class DIpGotoCodeGen
  52. */
  53. struct DSplitCodeGen
  54. : public SplitCodeGen, public DCodeGen
  55. {
  56. DSplitCodeGen( ostream &out ) :
  57. FsmCodeGen(out), SplitCodeGen(out), DCodeGen(out) {}
  58. };
  59. /*
  60. * class D2SplitCodeGen
  61. */
  62. struct D2SplitCodeGen
  63. : public SplitCodeGen, public D2CodeGen
  64. {
  65. D2SplitCodeGen( ostream &out ) :
  66. FsmCodeGen(out), SplitCodeGen(out), D2CodeGen(out) {}
  67. };
  68. #endif