Exemple #1
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // r e p o r t B o d y M a p                                          //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write details of mapping to report file.                           //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void reportBodyMap(
            ReportCore.eRptFileFmt rptFileFmt,
            Object writer,
            UInt16[] symSetMap,
            UInt16 codeMin,
            UInt16 codeMax,
            Boolean flagIgnoreC0,
            Boolean flagIgnoreC1,
            Boolean flagMapHex)
        {
            const Int32 maxLineLen = 80;        // ***************** constant elsewhere ???????????????

            const Int32 lcDec = 5;
            const Int32 lcHex = 4;
            const Int32 lrDec = 5;
            const Int32 lrHex = 4;

            const Int32 colCt = 17;

            Int32 lcCol,
                  lrHddr;

            String fmtHddr,
                   fmtVal;

            Int32 mapIndx,
                  rowIndx;

            String[] colHddrs = new String [colCt];
            String[] colNames = new String [colCt];
            Int32[]  colSizes = new Int32 [colCt];

            Int32 ctItems;

            ctItems = symSetMap.Length;

            //----------------------------------------------------------------//
            //                                                                //
            // Write out the header.                                          //
            //                                                                //
            //----------------------------------------------------------------//

            ReportCore.hddrTitle(writer, rptFileFmt, true,
                                 "Mapping detail:");

            ReportCore.tableHddrPair(writer, rptFileFmt);

            ReportCore.tableRowPair(writer, rptFileFmt,
                                    "Format",
                                    (flagMapHex ? "hexadecimal" : "decimal"),
                                    _colSpanNone, _colSpanNone,
                                    _maxSizeNameTag, maxLineLen,
                                    _flagNone, _flagNone, _flagNone);

            ReportCore.tableClose(writer, rptFileFmt);

            //----------------------------------------------------------------//
            //                                                                //
            // Open the table and write the column header text.               //
            //                                                                //
            //----------------------------------------------------------------//

            if (flagMapHex)
            {
                lcCol  = lcHex;
                lrHddr = lrHex;

                fmtHddr = "x4";
                fmtVal  = "x4";

                colSizes[0] = lrHex;
                colNames[0] = "row";
                colHddrs[0] = "";

                for (Int32 i = 1; i < colCt; i++)
                {
                    colSizes[i] = lcHex;
                    colNames[i] = "col" + (i - 1).ToString("D2");
                    colHddrs[i] = "_" + (i - 1).ToString("x");
                }
            }
            else
            {
                lcCol  = lcDec;
                lrHddr = lrDec;

                fmtHddr = "";
                fmtVal  = "";

                colSizes[0] = lrDec;
                colNames[0] = "row";
                colHddrs[0] = "";

                for (Int32 i = 1; i < colCt; i++)
                {
                    colSizes[i] = lcDec;
                    colNames[i] = "col" + (i - 1).ToString("D2");
                    colHddrs[i] = "+" + (i - 1).ToString("d");
                }
            }

            ReportCore.tableHddrData(writer, rptFileFmt, true,
                                     colCt, colHddrs, colSizes);

            //----------------------------------------------------------------//
            //                                                                //
            // Write the data rows.                                           //
            //                                                                //
            //----------------------------------------------------------------//

            Int32 colCtData = colCt - 1;

            mapIndx = 0;
            rowIndx = codeMin / colCtData;

            for (Int32 i = rowIndx; mapIndx < codeMax; i++)
            {
                String[] rowData = new String [colCt];

                rowIndx = (i * colCtData);

                if (flagMapHex)
                {
                    rowData[0] = (rowIndx.ToString(fmtHddr).
                                  Substring(0, 3) + "_").
                                 PadLeft(lrHddr, ' ');
                }
                else
                {
                    rowData[0] = rowIndx.ToString(fmtHddr).
                                 PadLeft(lrHddr, ' ');
                }

                for (Int32 j = 0; j < colCtData; j++)
                {
                    String val;

                    mapIndx = rowIndx + j;

                    if ((mapIndx < codeMin) || (mapIndx > codeMax))
                    {
                        val = " ".PadLeft(lcCol, ' ');
                    }
                    else if ((flagIgnoreC1) &&
                             ((mapIndx >= cCodePointC1Min) &&
                              (mapIndx <= cCodePointC1Max)))
                    {
                        val = cCodePointUnused.
                              ToString(fmtVal).PadLeft(lcCol, ' ');
                    }
                    else
                    {
                        val = symSetMap[mapIndx].
                              ToString(fmtVal).PadLeft(lcCol, ' ');
                    }

                    rowData[j + 1] = val;
                }

                ReportCore.tableRowText(writer, rptFileFmt, colCt,
                                        rowData, colNames, colSizes);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Write any required end tags.                                   //
            //                                                                //
            //----------------------------------------------------------------//

            ReportCore.tableClose(writer, rptFileFmt);
        }