diff options
author | Derek Hower <drh5@cs.wisc.edu> | 2010-01-19 15:48:12 -0600 |
---|---|---|
committer | Derek Hower <drh5@cs.wisc.edu> | 2010-01-19 15:48:12 -0600 |
commit | 279f179babc9e5663156777c533c06edc91bce9a (patch) | |
tree | e6718ee514cc81678491b50562ce8c463c0b20fd /src/mem/slicc/generator/mif_gen.cc | |
parent | 5aa104e072eb20f6aca49b169521b0c2da33c844 (diff) | |
parent | 295516a590b6e47c9a881f193027447e500c749c (diff) | |
download | gem5-279f179babc9e5663156777c533c06edc91bce9a.tar.xz |
merge
Diffstat (limited to 'src/mem/slicc/generator/mif_gen.cc')
-rw-r--r-- | src/mem/slicc/generator/mif_gen.cc | 1718 |
1 files changed, 0 insertions, 1718 deletions
diff --git a/src/mem/slicc/generator/mif_gen.cc b/src/mem/slicc/generator/mif_gen.cc deleted file mode 100644 index 2dca149b4..000000000 --- a/src/mem/slicc/generator/mif_gen.cc +++ /dev/null @@ -1,1718 +0,0 @@ - -/* - * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * $Id$ - * - */ - -#include "mem/slicc/generator/mif_gen.hh" -#include "mem/slicc/symbols/State.hh" -#include "mem/slicc/symbols/Event.hh" -#include "mem/slicc/symbols/Action.hh" -#include "mem/slicc/symbols/Transition.hh" - -// -- Helper functions -string formatShorthand(const string shorthand); -string formatCellRuling(const string shorthand); - -void printStateTableMIF(const StateMachine& sm, ostream& out) -{ - const string mif_prolog1 = -"<MIFFile 5.50> # Generated by Multifacet MIF Mungers Inc\n\ -<Tbls\n\ - <Tbl\n\ - <TblID 1>\n\ - <TblTag `Format A'>\n\ - <TblFormat\n\ -\n\ - <TblAlignment Center>\n\ -\n\ - # <TblXColumnNum 0>\n\ - <TblXColumnRuling `Medium'>\n\ -\n\ - <TblLRuling `Medium'>\n\ - <TblRRuling `Medium'>\n\ - <TblTRuling `Medium'>\n\ - <TblBRuling `Medium'>\n\ -\n\ - <TblColumn\n\ - <TblColumnNum 0>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - <TblColumn\n\ - <TblColumnNum 1>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - > # end of TblFormat\n\ -\n\ - <TblNumColumns 2>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnWidth 6.00\">\n\ - <TblTitle\n\ - <TblTitleContent\n\ - <Para\n\ - <PgfTag `TableTitle'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - > # end of Pgf\n\ - <PgfNumString `TABLE 1. '>\n\ - <ParaLine\n\ - <Marker\n\ - <MType 9>\n\ - <MTypeName `Cross-Ref'>\n\ - <MCurrPage `1'>\n\ - > # end of Marker\n\ - <String `"; - - const string mif_prolog2 = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of TblTitleContent\n\ - > # end of TblTitle\n\ -\n\ - <TblH\n\ - <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.44444\">\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `State'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - <ParaLine\n\ - <String `Description'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ - > # end of TblH\n\ -\n\ - <TblBody\n\ -"; - - const string row_before_state = -" <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.22222\">\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `"; - - const string row_between_state_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <ParaLine\n\ - <String `"; - - const string row_after_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ -"; - - const string mif_epilog = -" > # end of TblBody\n\ - > # end of Tbl\n\ -> # end of Tbls\n\ -\n\ - <Para\n\ - <ParaLine\n\ - <ATbl 1>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ -\n\ -# End of MIFFile\n\ -"; - - out << mif_prolog1; - out << formatShorthand( sm.getShorthand() ); - out << " states"; - out << mif_prolog2; - - for( int i = 0; i < sm.numStates(); i++ ) - { - out << row_before_state; - out << formatShorthand( sm.getState( i ).getShorthand() ); - out << row_between_state_desc; - out << sm.getState( i ).getDescription(); - out << row_after_desc; - } - - out << mif_epilog; -} - - -void printEventTableMIF(const StateMachine& sm, ostream& out) -{ - const string mif_prolog1 = -"<MIFFile 5.50> # Generated by Multifacet MIF Mungers Inc\n\ -<Tbls\n\ - <Tbl\n\ - <TblID 1>\n\ - <TblTag `Format A'>\n\ - <TblFormat\n\ -\n\ - <TblAlignment Center>\n\ -\n\ - # <TblXColumnNum 0>\n\ - <TblXColumnRuling `Medium'>\n\ -\n\ - <TblLRuling `Medium'>\n\ - <TblRRuling `Medium'>\n\ - <TblTRuling `Medium'>\n\ - <TblBRuling `Medium'>\n\ -\n\ - <TblColumn\n\ - <TblColumnNum 0>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - <TblColumn\n\ - <TblColumnNum 1>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - > # end of TblFormat\n\ -\n\ - <TblNumColumns 2>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnWidth 6.00\">\n\ - <TblTitle\n\ - <TblTitleContent\n\ - <Para\n\ - <PgfTag `TableTitle'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - > # end of Pgf\n\ - <PgfNumString `TABLE 1. '>\n\ - <ParaLine\n\ - <Marker\n\ - <MType 9>\n\ - <MTypeName `Cross-Ref'>\n\ - <MCurrPage `1'>\n\ - > # end of Marker\n\ - <String `"; - const string mif_prolog2 = -"'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of TblTitleContent\n\ - > # end of TblTitle\n\ -\n\ - <TblH\n\ - <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.44444\">\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `Event'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <ParaLine\n\ - <String `Description'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ - > # end of TblH\n\ -\n\ - <TblBody\n\ -"; - - const string row_before_event = -" <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.22222\">\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `"; - - const string row_between_event_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <ParaLine\n\ - <String `"; - - const string row_after_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ -"; - - const string mif_epilog = -" > # end of TblBody\n\ - > # end of Tbl\n\ -> # end of Tbls\n\ -\n\ - <Para\n\ - <ParaLine\n\ - <ATbl 1>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ -\n\ -# End of MIFFile\n\ -"; - - out << mif_prolog1; - out << formatShorthand( sm.getShorthand() ); - out << " events"; - out << mif_prolog2; - - for( int i = 0; i < sm.numEvents(); i++ ) - { - out << row_before_event; - out << formatShorthand( sm.getEvent( i ).getShorthand() ); - out << row_between_event_desc; - out << sm.getEvent( i ).getDescription(); - out << row_after_desc; - } - - out << mif_epilog; -} - - -void printActionTableMIF(const StateMachine& sm, ostream& out) -{ - const string mif_prolog1 = -"<MIFFile 5.50> # Generated by Multifacet MIF Mungers Inc\n\ -<Tbls\n\ - <Tbl\n\ - <TblID 1>\n\ - <TblTag `Format A'>\n\ - <TblFormat\n\ -\n\ - <TblAlignment Center>\n\ -\n\ - # <TblXColumnNum 0>\n\ - <TblXColumnRuling `Medium'>\n\ -\n\ - <TblLRuling `Medium'>\n\ - <TblRRuling `Medium'>\n\ - <TblTRuling `Medium'>\n\ - <TblBRuling `Medium'>\n\ -\n\ - <TblColumn\n\ - <TblColumnNum 0>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - <TblColumn\n\ - <TblColumnNum 1>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - > # end of TblFormat\n\ -\n\ - <TblNumColumns 2>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnWidth 6.00\">\n\ - <TblTitle\n\ - <TblTitleContent\n\ - <Para\n\ - <PgfTag `TableTitle'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - > # end of Pgf\n\ - <PgfNumString `TABLE 1. '>\n\ - <ParaLine\n\ - <Marker\n\ - <MType 9>\n\ - <MTypeName `Cross-Ref'>\n\ - <MCurrPage `1'>\n\ - > # end of Marker\n\ - <String `"; - const string mif_prolog2 = -"'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of TblTitleContent\n\ - > # end of TblTitle\n\ -\n\ - <TblH\n\ - <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.44444\">\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `Action'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <ParaLine\n\ - <String `Description'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ - > # end of TblH\n\ -\n\ - <TblBody\n\ -"; - - const string row_before_action = -" <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.22222\">\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `"; - - const string row_between_action_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <ParaLine\n\ - <String `"; - - const string row_after_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ -"; - - const string mif_epilog = -" > # end of TblBody\n\ - > # end of Tbl\n\ -> # end of Tbls\n\ -\n\ - <Para\n\ - <ParaLine\n\ - <ATbl 1>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ -\n\ -# End of MIFFile\n\ -"; - - out << mif_prolog1; - out << formatShorthand( sm.getShorthand() ); - out << " actions"; - out << mif_prolog2; - - for( int i = 0; i < sm.numActions(); i++ ) - { - out << row_before_action; - out << formatShorthand( sm.getAction( i ).getShorthand() ); - out << row_between_action_desc; - out << sm.getAction( i ).getDescription(); - out << row_after_desc; - } - - out << mif_epilog; -} - - -void printTransitionTableMIF(const StateMachine& sm, ostream& out) -{ - const string mif_prolog = -"<MIFFile 5.50> # Generated by Multifacet MIF Mungers Inc\n\ -<Tbls\n\ - <Tbl\n\ - <TblID 1>\n\ - <TblTag `Format A'>\n\ - <TblFormat\n\ -\n\ - <TblAlignment Center>\n\ -\n\ - # <TblXColumnNum 0>\n\ - <TblXColumnRuling `Medium'>\n\ -\n\ - <TblLRuling `Medium'>\n\ - <TblRRuling `Medium'>\n\ - <TblTRuling `Medium'>\n\ - <TblBRuling `Medium'>\n\ - \n\ -"; - - const string tbl_fmt_before_col_num = -" <TblColumn\n\ - <TblColumnNum "; - - const string tbl_fmt_after_col_num = - ">\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ -"; - - const string tbl_fmt_before_num_cols = -" > # end of TblFormat\n\ -\n\ - <TblNumColumns "; - - const string tbl_fmt_each_col_width_begin = - ">\n\ - <TblColumnWidth "; - - const string tbl_fmt_each_col_width_end = "\""; - - const string tbl_before_first_header1 = - ">\n\ - <TblTitle\n\ - <TblTitleContent\n\ - <Para\n\ - <PgfTag `TableTitle'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - > # end of Pgf\n\ - <PgfNumString `TABLE 1. '>\n\ - <ParaLine\n\ - <Marker\n\ - <MType 9>\n\ - <MTypeName `Cross-Ref'>\n\ - <MCurrPage `1'>\n\ - > # end of Marker\n\ - <String `"; - - const string tbl_before_first_header2 = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of TblTitleContent\n\ - > # end of TblTitle\n\ -\n\ - <TblH\n\ - <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.44444\">"; - - const string tbl_before_each_header = -" <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `"; - - const string tbl_before_each_rot_header = -" <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellAngle 270>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <ParaLine\n\ - <String `"; - - const string tbl_after_each_header = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ -"; - - const string before_first_row = -" > # end of Row\n\ - > # end of TblH\n\ -\n\ - <TblBody\n\ -"; - - const string row_before_first_cell = -" <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.22222\">"; - - const string row_cell_before_ruling = -" <Cell\n\ -"; - - const string row_cell_before_contents = -" <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `"; - - const string row_cell_after_contents = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ -"; - - const string row_empty_cell = -" <CellFill 5>\n\ - <CellColor `Cyan'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <ParaLine\n\ - <String `'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ -"; - - const string row_after_last_cell = -" > # end of Row\n\ -"; - - - const string mif_epilog = -" > # end of TblBody\n\ - > # end of Tbl\n\ -> # end of Tbls\n\ -\n\ - <Para\n\ - <ParaLine\n\ - <ATbl 1>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ -\n\ -# End of MIFFile\n\ -"; - - int i, j, num_rows, num_cols; - string row_ruling; - string col_ruling; - - num_rows = sm.numStates(); - num_cols = sm.numEvents() + 1; - - // -- Prolog - out << mif_prolog; - - // -- Table format (for each column) - for( i = 0; i < num_cols; i++ ) - { - out << tbl_fmt_before_col_num; - out << i; - out << tbl_fmt_after_col_num; - } - - // -- Spell out width of each column - - // -- FIXME: make following constants into parameters - const float total_table_width = 7.5; // -- Total page width = 7.5" (portrait mode) - const float min_col_width = 0.35; // -- Min col width (for legibility) - const float max_col_width = 0.75; // -- Max col width (for aesthetics) - float column_width; - - // -- Calculate column width and clamp it within a range - column_width = total_table_width / num_cols; - column_width = ((column_width < min_col_width) - ? min_col_width - : ((column_width > max_col_width) - ? max_col_width - : column_width)); - - out << tbl_fmt_before_num_cols; - out << num_cols; - for( i = 0; i < num_cols; i++ ) - { - out << tbl_fmt_each_col_width_begin << column_width << tbl_fmt_each_col_width_end; - } - - // -- Column headers - out << tbl_before_first_header1; - out << formatShorthand( sm.getShorthand() ); - out << " transitions"; - out << tbl_before_first_header2; - - out << tbl_before_each_header; - out << "State"; - out << tbl_after_each_header; - - for( i = 0; i < sm.numEvents(); i++ ) - { - out << tbl_before_each_rot_header; - out << formatShorthand( sm.getEvent(i).getShorthand() ); - out << tbl_after_each_header; - } - out << before_first_row; - - - // -- Body of table - for( i = 0; i < num_rows; i++ ) - { - // -- Each row - out << row_before_first_cell; - - // -- Figure out ruling - if (sm.getState(i).existPair("format")) { - row_ruling = formatCellRuling( sm.getState(i).lookupPair("format")); - } else { - row_ruling = ""; - } - - // -- First column = state - out << row_cell_before_ruling; - out << row_ruling; - out << row_cell_before_contents; - out << formatShorthand( sm.getState(i).getShorthand() ); - out << row_cell_after_contents; - - // -- One column for each event - for( j = 0; j < sm.numEvents(); j++ ) - { - const Transition* trans_ptr = sm.getTransPtr( i, j ); - - // -- Figure out ruling - if (sm.getEvent(j).existPair("format")) { - col_ruling = formatCellRuling(sm.getEvent(j).lookupPair("format")); - } else { - col_ruling = ""; - } - - out << row_cell_before_ruling; - out << row_ruling; - out << col_ruling; - - if( trans_ptr != NULL ) - { - string actions; - string nextState; - - // -- Get the actions - actions = formatShorthand( trans_ptr->getActionShorthands() ); - - // -- Get the next state - // FIXME: should compare index, not the string - if (trans_ptr->getNextStateShorthand() != - sm.getState(i).getShorthand() ) - { - nextState = formatShorthand( trans_ptr->getNextStateShorthand() ); - } else - { - nextState = ""; - } - - // -- Print out "actions/next-state" - out << row_cell_before_contents; - out << actions; - if ((nextState.length() != 0) && (actions.length() != 0)) { - out << "/"; - } - out << nextState; - out << row_cell_after_contents; - } - else - { - out << row_empty_cell; - } - - } - - out << row_after_last_cell; - } - - // -- Epilog - out << mif_epilog; - -} -/* -void printTBETableMIF(const StateMachine& sm, const Vector<Field>& fields, ostream& out) -{ - const string mif_prolog1 = -"<MIFFile 5.50> # Generated by Multifacet MIF Mungers Inc\n\ -<Tbls\n\ - <Tbl\n\ - <TblID 1>\n\ - <TblTag `Format A'>\n\ - <TblFormat\n\ -\n\ - <TblAlignment Center>\n\ -\n\ - # # <TblXColumnNum 0>\n\ - <TblXColumnRuling `Medium'>\n\ -\n\ - <TblLRuling `Medium'>\n\ - <TblRRuling `Medium'>\n\ - <TblTRuling `Medium'>\n\ - <TblBRuling `Medium'>\n\ -\n\ - <TblColumn\n\ - <TblColumnNum 0>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - <TblColumn\n\ - <TblColumnNum 1>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnH\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnH\n\ - <TblColumnBody\n\ - <PgfTag `CellBody'>\n\ - > # end of TblColumnBody\n\ - <TblColumnF\n\ - <PgfTag `CellHeading'>\n\ - > # end of TblColumnF\n\ - > # end of TblColumn\n\ - > # end of TblFormat\n\ -\n\ - <TblNumColumns 2>\n\ - <TblColumnWidth 0.51\">\n\ - <TblColumnWidth 6.00\">\n\ - <TblTitle\n\ - <TblTitleContent\n\ - <Para\n\ - <PgfTag `TableTitle'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - > # end of Pgf\n\ - <PgfNumString `TABLE 1. '>\n\ - <ParaLine\n\ - <Marker\n\ - <MType 9>\n\ - <MTypeName `Cross-Ref'>\n\ - <MCurrPage `1'>\n\ - > # end of Marker\n\ - <String `"; - - const string mif_prolog2 = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of TblTitleContent\n\ - > # end of TblTitle\n\ -\n\ - <TblH\n\ - <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.44444\">\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `Field'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellLRuling `Medium'>\n\ - <CellBRuling `Medium'>\n\ - <CellRRuling `Medium'>\n\ - <CellTRuling `Medium'>\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellHeading'>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - <ParaLine\n\ - <String `Description'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ - > # end of TblH\n\ -\n\ - <TblBody\n\ -"; - - const string row_before_state = -" <Row\n\ - <RowMaxHeight 14.0\">\n\ - <RowHeight 0.22222\">\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <Pgf\n\ - <PgfAlignment Center>\n\ - <PgfFont \n\ - <FTag `'>\n\ - <FFamily `Times'>\n\ - <FVar `Regular'>\n\ - <FWeight `Regular'>\n\ - <FAngle `Regular'>\n\ - <FPostScriptName `Times-Roman'>\n\ - <FEncoding `FrameRoman'>\n\ - <FSize 11.0 pt>\n\ - <FUnderlining FNoUnderlining>\n\ - <FOverline No>\n\ - <FStrike No>\n\ - <FChangeBar No>\n\ - <FOutline No>\n\ - <FShadow No>\n\ - <FPairKern Yes>\n\ - <FTsume No>\n\ - <FCase FAsTyped>\n\ - <FPosition FNormal>\n\ - <FDX 0.0%>\n\ - <FDY 0.0%>\n\ - <FDW 0.0%>\n\ - <FStretch 100.0%>\n\ - <FLanguage USEnglish>\n\ - <FLocked No>\n\ - <FSeparation 0>\n\ - <FColor `Black'>\n\ - > # end of PgfFont\n\ - >\n\ - <ParaLine\n\ - <String `"; - - const string row_between_state_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - <Cell\n\ - <CellContent\n\ - <Para\n\ - <PgfTag `CellBody'>\n\ - <ParaLine\n\ - <String `"; - - const string row_after_desc = - "'>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ - > # end of CellContent\n\ - > # end of Cell\n\ - > # end of Row\n\ -"; - - const string mif_epilog = -" > # end of TblBody\n\ - > # end of Tbl\n\ -> # end of Tbls\n\ -\n\ - <Para\n\ - <ParaLine\n\ - <ATbl 1>\n\ - > # end of ParaLine\n\ - > # end of Para\n\ -\n\ -# End of MIFFile\n\ -"; - - out << mif_prolog1; - out << sm.getShorthand(); - out << " TBE"; - out << mif_prolog2; - - for( int i = 0; i < fields.size(); i++ ) { - out << row_before_state; - out << formatShorthand(fields[i].getShorthand()); - out << row_between_state_desc; - out << fields[i].getDescription(); - out << row_after_desc; - } - - out << mif_epilog; -} -*/ -// -- -// -- Helper function to do some shorthand formatting (kludge before we -// -- get the tuple attributes into the state machine language. -// -- Current convention: -// -- - each `_' indicates a toggle between normal mode and superscript -// -- - each escaped (using `\') character indicates a letter formatted -// -- using the Symbol character set. \a = alpha, \b = beta, \c = chi etc. -// -- See the FrameMaker character sets manual in the Online Manuals. -// -- - a `!' indicates extra stuff at the end which can be ignored (used -// -- for determining cell ruling and so on) -// -- -string formatShorthand(const string shorthand) -{ - string munged_shorthand = ""; - bool mode_is_normal = true; - const string mif_superscript = "'> <Font <FPosition FSuperscript> <FLocked No> > <String `"; - const string mif_normal = "'> <Font <FPosition FNormal> <FLocked No> > <String `"; - const string mif_symbol = "'> <Font <FFamily `Symbol'> <FPostScriptName `Symbol'> <FEncoding `FrameRoman'> <FLocked No> > <String `"; - const string mif_times = "'> <Font <FFamily `Times'> <FPostScriptName `Times-Roman'> <FEncoding `FrameRoman'> <FLocked No> > <String `"; - - - // -- Walk over the string, processing superscript directives - for( unsigned int i = 0; i < shorthand.length(); i++ ) - { - if( shorthand[i] == '!' ) - { - // -- Reached logical end of shorthand name - break; - } - else if( shorthand[i] == '^' ) - { - // -- Process super/subscript formatting - - mode_is_normal = !mode_is_normal; - if( mode_is_normal ) - { - // -- Back to normal mode - munged_shorthand += mif_normal; - } - else - { - // -- Going to superscript mode - munged_shorthand += mif_superscript; - } - - } - else if( shorthand[i] == '\\' ) - { - // -- Process Symbol character set - if( (i + 1) < shorthand.length() ) - { - i++; // -- Proceed to next char. Yes I know that changing the loop var is ugly! - munged_shorthand += mif_symbol; - munged_shorthand += shorthand[i]; - munged_shorthand += mif_times; - } - else - { - // -- FIXME: Add line number info later - cerr << "Encountered a `\\` without anything following it!" << endl; - exit( -1 ); - } - - } - else - { - // -- Pass on un-munged - munged_shorthand += shorthand[i]; - } - - } // -- end for all characters in shorthand - - // -- Do any other munging - - // -- Return the formatted shorthand name - return munged_shorthand; -} - - -// -- -// -- Helper function to figure out where to put rules in the table (kludge before we -// -- get the tuple attributes into the shorthand machine language. -// -- Current convention: -// -- - a `!' in the shorthand indicates the beginning of ruling information -// -- - `b' => bottom of this row is ruled -// -- - `r' => right of this column is ruled -// -- -string formatCellRuling( const string shorthand) -{ - for( unsigned int i = 0; i < shorthand.length(); i++ ) - { - if( shorthand[i] == '!' ) - { - // -- OK, found beginning of ruling information - for( unsigned int j = i+1; j < shorthand.length(); j++ ) - { - if( shorthand[j] == 'b') - { - // -- Rule the bottom - return "<CellBRuling `Medium'>\n"; - } - else if( shorthand[j] == 'r') - { - // -- Rule the bottom - return "<CellRRuling `Medium'>\n"; - } - - } - - // -- No ruling directives recognized, return default ruling - return ""; - } - - } - - // -- No ruling information found, return default ruling - return ""; -} |