1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
/* QMC: simplification tool (by using the Quine - McClusky process)
Copyright (C) 2000 Thomas Pollak
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Auf Deutsch:
QMC: Vereinfachungsprogramm fuer logische Terme nach Quine - McClusky
Copyright (C) 2000 Thomas Pollak
Dieses Programm ist freie Software. Sie koennen es unter
den Bedingungen der GNU General Public License, wie von der
Free Software Foundation herausgegeben, weitergeben und/oder
modifizieren, entweder unter Version 2 der Lizenz oder
jeder spteren Version.
Die Verffentlichung dieses Programms erfolgt in der
Hoffnung, dass es Ihnen von Nutzen sein wird, aber OHNE JEDE
GEWAEHRLEISTUNG - sogar ohne die implizite Gewaehrleistung
der MARKTREIFE oder der EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
Details finden Sie in der GNU General Public License.
Sie sollten eine Kopie der GNU General Public License zusammen
mit diesem Programm erhalten haben. Falls nicht, schreiben Sie
an die Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
MA 02139, USA.
*/
/*
file: table.cc - handles HTML outputs
begin: 04/2000
email: thomas@pollaknet.at
web: http://qmc.pollaknet.at
*/
//Include
#include <cqmc>
#include <iostream>
using namespace std;
//Debug - Switch
//#define DEBUG
void tableinput(BOOL *var, unsigned char num_vars, unsigned short &high, bool *b_result, unsigned short help)
{
unsigned char j;
unsigned short temp;
high=0;
for(j=0;j<num_vars;j++)
{
cout << "| " << (char)(j+65) << ' ';
var[j].setid((char)(j+65));
}
cout << "| Q |" << endl;
for(j=0;j<num_vars+1;j++) cout << "+---";
cout << '+' << endl;
for(unsigned short i=0;i<help;i++)
{
temp=i;
for(j=0;j<num_vars;j++)
{
cout << "| " << temp%2 << ' ';
temp/=2;
}
cout << "| ";
cin >> b_result[i];
if(b_result[i]) high++;
}
#ifdef DEBUG
cerr <<"\n TABLEI. high: " << high << endl;
#endif
}
void tableheadoutput(BOOL *var, unsigned char num_vars, unsigned short int options)
{
unsigned char j;
if( options & TABLE_OUTPUT)
{
for(j=0;j<num_vars;j++) cout << "| " << var[j].getid() << ' ';
cout << "| Q |" << endl;
for(j=0;j<num_vars+1;j++) cout << "+---";
cout << '+' << endl;
}
else if( options & HTML_OUTPUT)
{
cout << "<HTML>" << endl << " <HEAD>" << endl << " <TITLE>QMC simplification tool (by using the Quine - McClusky process)</TITLE>" << endl;
cout << " </HEAD>" << endl << " <BODY BGCOLOR='#ffffff' TEXT='#000000'>" << endl;
cout << " <BR><BR><CENTER><I>Note: file created with qmc version " << QMC_VERSION << ", built " << QMC_DATE << ".</I></CENTER><BR><BR>" << endl;
cout << " <TABLE BORDER='1' BORDERCOLOR='#cccccc' align='center'>" << endl << " <TR>";
for(j=0;j<num_vars;j++) cout << " <TD width='25' align='center'>" << var[j].getid() << "</TD>" << endl;
cout << " <TD width='25' align='center'>" << "Q" << "</TD>" << endl << " </TR>" << endl;
}
}
void tableoutput(bool value, bool nrow, unsigned short int options)
{
if( options & TABLE_OUTPUT )
{
cout << "| " << value << " ";
if(nrow)
{
cout << "|" << endl;
}
}
else if( options & HTML_OUTPUT )
{
cout << " <TD align='center'>" << value << "</TD>" << endl;
if(nrow)
{
cout << " </TR>" << endl;
}
}
}
void tabletailoutput(char *minterm)
{
cout << " </TABLE>" << endl << " <CENTER>" << endl << " <H3>Q=" << minterm << "</H3>" <<endl;
cout << " Project Home: <A HREF='http://qmc.pollaknet.at'>http://qmc.pollaknet.at</A><BR><BR>" << endl;
cout << " <I>Please report bugs to:<A HREF='mailto:thomas@pollaknet.at'>thomas@pollaknet.at</A></I><BR><BR><BR>" << endl;
cout << " </CENTER>" << endl << " </BODY>" << endl << "</HTML>" << endl;
}
|