qmc-0.94/AUTHORS0100644000000000000000000000004307730057117012001 0ustar rootrootThomas Pollak qmc-0.94/COPYING0100644000000000000000000003540507730057117011776 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. qmc-0.94/ChangeLog0100744000000000000000000000235507750227607012521 0ustar rootrootChangeLog: 30.10.2003: 0.94 - new dummy option for tcltk widget (which is in the archive) - new parameter management - minor bug fixes - major code changes: submain now in core.cc remdub.cc is not used anymore (eval_dub.cc provides now a better solution) - speed improvements - improved runtime output (verbose parameter) 11.09.2003: 0.93 - preparser implemented -> converts "/1" to "0", "/0" to "1" and removes "//" - timer option available - output with astericks (avoid astericks option available) - removed critical bug in core-engine (compare.cc) - some changes in the debug output - minor code changes and some small bugfixes 01.09.2003: 0.92c beta - minor code changes - many bugfixes - functions, vars and file names translated from german to english - blanks in the input string are now ignored 04.05.2002: 0.92 (MS Windows) - Berthold Jaksch created a gui port for MS Windows of Version 0.92 14.06.2001: 0.92b Beta 3 - added english comments 21.05.2001: 0.92a Beta 3 - minor code changes - improved data output 20.05.2001: 0.92 Beta 3 - ported to Linux (thanx to Andreas Romeyke) - development procceds under Linux 24.06.2000: 0.9 Beta 3 (DOS) - first working version for MS-DOS qmc-0.94/INSTALL0100644000000000000000000000057507750231250011766 0ustar rootrootINSTALL EXAMPLE extract the archive (XX stands for the version string): # tar xjvf qmc-XX.tar.bz2 compile the source: # cd qmc-XX # g++ -Wall -O3 -I. -c *.cc # g++ -o qmc *.o copy the executable to your bin directory # cp qmc /bin/ done! show help in order to start work (-: #qmc --help new tcl/tk widget is also located in the source directory simply type: #wish qmc-gui.tcl qmc-0.94/README0100644000000000000000000000025007750225536011615 0ustar rootrootqmc 0.94 ======== for install instructions look into the INSTALL file README still under construction... in order to get help use the following command: #qmc --help qmc-0.94/TODO0100644000000000000000000000031107750225402011413 0ustar rootrootTODO: - enhance core engine in order to run faster and work with more vars - implement "Peano-Russell-Notation" for input - implement "Polish-Notation" for input - add inputsyntax for set theory qmc-0.94/analyse.cc0100744000000000000000000002614207750226644012712 0ustar rootroot/* 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 spaeteren Version. Die Veroeffentlichung 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: analyse.cc begin: 01/2000 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Headers #include /* analyse */ //DEBUG SWITCH //#define DEBUG #include using namespace std; bool analyse(char *expression_buffer, unsigned char num_vars, BOOL *BO_var, unsigned char pos1, unsigned char pos2) { //local variables unsigned char i,/* j,*/ chksum=0, index; bool inv=0; #ifdef DEBUG cerr << "\nanalyse.cc [analyse]: starting function!\n<"; for(i=0;i\nTerm: "; for(i=pos1;i<=pos2;i++) { cerr << expression_buffer[i]; } #endif //one char left if((pos2-pos1)==0) { //search for the id #ifdef DEBUG cerr << "\nanalyse.cc [analyse]: Var -"; #endif i=0; do { //return if equal if(BO_var[i].getid()==expression_buffer[pos1]) { #ifdef DEBUG cerr << " found! " << BO_var[i].getid() << "->(" << BO_var[i].value() << ')'; #endif return(BO_var[i].value()); } if(expression_buffer[pos1]==SYMB_TRUE) { #ifdef DEBUG cerr << " constant! (1)"; #endif return(1); } if(expression_buffer[pos1]==SYMB_FALSE) { #ifdef DEBUG cerr << " constant! (0)"; #endif return(0); } i++; }while(i" << expression_buffer[pos1+1]; #endif cout << endl << "program-error in modul analyse.cc" << endl << flush; return(0); } //two chars left if((pos2-pos1)==1) { #ifdef DEBUG cerr << "\nanalyse.cc [analyse]: two chars left!"; #endif //check not char if(expression_buffer[pos1]==SYMB_NOT) { //search for the id and invert #ifdef DEBUG cerr << "\nanalyse.cc [analyse]: inverted BO_var -"; #endif i=0; do { //return if equal if(BO_var[i].getid()==expression_buffer[pos1+1]) { #ifdef DEBUG cerr << " found! (/" << BO_var[i].value() << ')'; #endif return(BO_var[i].value()^1); } //now done by preparser... /* if(expression_buffer[pos1]==SYMB_TRUE) { #ifdef DEBUG cerr << " constant! (/1)"; #endif return(0); } if(expression_buffer[pos1]==SYMB_FALSE) { #ifdef DEBUG cerr << " constant! (/0)"; #endif return(1); } */ i++; }while(i" << expression_buffer[pos1] << expression_buffer[pos1+1]; #endif cout << endl << "program-error in modul analyse.cc" << endl << flush; return(0); } //AND control char else { #ifdef DEBUG cerr << "\n analyse.cc [analyse]: * AND without operator! (2)"; #endif return(analyse(expression_buffer,num_vars,BO_var,pos1,pos1)&analyse(expression_buffer,num_vars,BO_var,pos2,pos2)); } } #ifdef DEBUG cerr << "\n analyse.cc [analyse]: search for OR (+)"; #endif //or section for(i=pos1;i 1 ) { #ifdef DEBUG cerr << "\n analyse.cc [analyse]: *and found! last p without op cut: " << (unsigned short)pos1 << ' ' << (unsigned short)pos1 << " ][ " << (unsigned short)pos1+1 << ' ' << (unsigned short)pos2 << " ohne Operator (letzte Instantz)"; #endif if(expression_buffer[pos1]==SYMB_NOT) { return(analyse(expression_buffer,num_vars,BO_var,pos1,pos1+1)&analyse(expression_buffer,num_vars,BO_var,pos1+2,pos2)); } else { return(analyse(expression_buffer,num_vars,BO_var,pos1,pos1)&analyse(expression_buffer,num_vars,BO_var,pos1+1,pos2)); } } #ifdef DEBUG cerr << "\n\nanalyse.cc [analyse]: error!!"; #endif cout << endl << "program-error in modul analyse.cc" << endl << flush; return(0); } /* invert array */ void invert_array(bool *barray, unsigned short int array_length) { for(unsigned short int index=0; index < array_length; index++) barray[index] = !barray[index]; } qmc-0.94/bool.cc0100744000000000000000000000627207730057117012206 0ustar rootroot/* 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 spaeteren Version. Die Veroeffentlichung 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: bool.cc - main file begin: 01/2000 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Headers #include using namespace std; /********** * * * BOOL * * * **********/ BOOL::BOOL(bool v, char i) { val=v; //set start value id=i; } /************ * * * SETVALUE * * * ************/ void BOOL::setvalue(bool v) { val=v; } /********* * * * VALUE * * * *********/ bool BOOL::value() { return(val); } /********* * * * SETID * * * *********/ void BOOL::setid(char i) { id=i; } /********* * * * GETID * * * *********/ char BOOL::getid() { return(id); } /**************** * * * UND operator * * * ****************/ /* BOOL operator*(BOOL a, BOOL b) { return(a.val&b.value()); } BOOL operator*(bool a, BOOL b) { return(a&b.value()); } BOOL operator*(BOOL a, bool b) { return(a.value()&b); } */ /***************** * * * ODER operator * * * *****************/ /* BOOL operator+(BOOL a, BOOL b) { return(a.value()|b.value()); } BOOL operator+(bool a, BOOL b) { return(a|b.value()); } BOOL operator+(BOOL a, bool b) { return(a.value()|b); } */ /****************** * * * NICHT operator * * * ******************/ void BOOL::invert() { if(val==1) val=0; else val=1; } qmc-0.94/compare.cc0100744000000000000000000001514507750226052012676 0ustar rootroot/* 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 spaeteren Version. Die Veroeffentlichung 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: compare.cc - engine file begin: 03/2000 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Headers #include #include //#include using namespace std; //Debug - switch //#define DEBUG //#define DEBUG2 /* compare (engine) */ //new sub function (temporary solution) void* resize(BOOL *old_array, unsigned short int size, unsigned short int size_add) { unsigned short int cnt; BOOL *new_array=NULL; new_array = new BOOL[size+size_add]; for(cnt=0;cnt disj_expr, final, disj_temp, disj_swap; //local variables bool *check = NULL, prgm_error = 0; unsigned char index=0, dindex = 0, diff, h=0; unsigned short i=0, j=0, ready = 0, t=0; //iso-fix check = new bool[high]; #ifdef DEBUG cerr << endl << endl << "compare.cc [compare]: STARTING FUNCTION"; cerr << " num_vars=" << (unsigned short)num_vars << "; current comb's " << high; cerr << "; running test..."; for(i=0;i #include #include #include #include using namespace std; /* unsigned short pow(unsigned short x, unsigned short y) { return( y>1 ? pow(x,--y)*x : x ); } */ unsigned short dual_pow(unsigned char x) { unsigned short int result = 2; while( --x > 0 ) result *= 2; return result; } /* core (old submain) */ int core(char *expression_buffer, unsigned short int options) { /************** * variables * **************/ bool *b_result = NULL, optimize=0; char *vars = NULL, *simple_expression_buffer = NULL; unsigned char num_vars, expr_length, j, check; unsigned short i, help, high, index, temp; clock_t start_time, stop_time; BOOL *BO_var = NULL, *lh = NULL; #ifdef DEBUG cerr << "\ncore started"; cerr << "\ncore.cc [core]: input_buffer [" << expression_buffer; cerr << "], strlen " <> expression_buffer; } /******************* * check brackets * *******************/ if( options & TABLE_INPUT ) { cout << "\nnumber of variables: "; cin >> help; num_vars = (unsigned char)help; //create object arry BO_var = new BOOL[num_vars]; //number of possibilities //help=pow((unsigned short)2,(unsigned short)num_vars); help = dual_pow(num_vars); //create boolean array b_result = new bool[help]; //call input procedure tableinput(BO_var,num_vars,high,b_result,help); //strcpy(expression_buffer,"NOTHING"); } //start timer start_time = clock(); if( !( options & TABLE_INPUT ) ) { //allocate memory for the variables vars = new char[MAX_NUM_VARS+1] ; #ifdef DEBUG cerr << "\ncore.cc [core]: expression_buffer=" << expression_buffer << "; (from input)"; #endif //remove any blank charakter from input buffer remove_blanks(expression_buffer, INPUT_BUFFER_SIZE); #ifdef DEBUG cerr << "\ncore.cc [core]: expression_buffer=" << expression_buffer << "; (without blanks)"; #endif //preparse the string preparse(expression_buffer); #ifdef DEBUG cerr << "\ncore.cc [core]: expression_buffer=" << expression_buffer << "; (parsed)"; #endif if(strlen(expression_buffer)<1) { cout << "nothing to calc!" << endl; //program ends return(0); } //check the input string if((check=bracket_check(expression_buffer,num_vars,vars))!=0) { cout << "bad input, use the correct syntax and try again. code: "; cout << (unsigned short)check << endl; //program ends return(0); } //Status verbose_msg("\nsyntax checked...", options); #ifdef DEBUG cerr << "\ncore.cc [core]: bracket check executed"; #endif //create object array BO_var= new BOOL[num_vars]; #ifdef DEBUG cerr << " - transfering ID to boolean objects "; #endif //transfering to objects for(i=0;i"; #endif //if analyse==1 then increase high if((b_result[i]=analyse(expression_buffer,num_vars,BO_var,0,expr_length-1))==1) { high++; //create entry for boolean table (at the end) tableoutput(1,1,options); } else { //create entry for boolean table (at the end) tableoutput(0,1,options); } if( !(i%4) ) verbose_msg(".", options); #ifdef DEBUG cerr << "\ncore.cc [core]: b_result[" << i << "]=" << b_result[i]; #endif } } /****************** * optimize table * ******************/ if( high+1 == help ) { optimize=1; verbose_msg("\nrecalculating...", options); invert_array(b_result,help); high = help - high; } /* if( high > (help/2) ) { optimize=1; verbose_msg("\nrecalculating...", options); invert_array(b_result,help); high = help - high; } */ /****************** * set LOW, HIGH * ******************/ #ifdef DEBUG cerr << "\ncore.cc [core]: analyse process finished!"; cerr << "\ncore.cc [core]: number of true comb's: " << high << "; num_vars="; cerr << (unsigned short)num_vars << "; product=" << high*num_vars << ";" << endl; #endif //create boolean array to compare //lh = new BOOL[(high+1)*num_vars]; lh = new BOOL[high*num_vars]; index=0; //Status verbose_msg("\npreparing for comparison...", options); //loop for (number of possibilties) for(i=0;i using namespace std; #endif #ifndef cqmc #define cqmc //size of input string #define INPUT_BUFFER_SIZE 128 //allowed variables #define MAX_NUM_VARS 16 //Syntax #define SYMB_AND '*' #define SYMB_OR '+' #define SYMB_NOT '/' #define SYMB_BEGIN_SUB '[' #define SYMB_END_SUB ']' #define SYMB_TRUE '1' #define SYMB_FALSE '0' //Strings #define QMC_VERSION "0.94" #define QMC_URL "http://qmc.pollaknet.at" #define QMC_DATE "30.10.2003" //others #define BLANK_CHAR ' ' //program options #define PROTOCOL 0x0001 #define TABLE_INPUT 0x0002 #define INTERACTIVE 0x0004 #define TIMER 0x0008 #define TABLE_OUTPUT 0x0010 #define HTML_OUTPUT 0x0020 #define AVOID_ASTERICKS 0x0040 //class BOOL class BOOL { bool val; //boolean value of the BOOL object char id; //id of BOOL object public: BOOL(bool v=0, char i='#'); void setvalue(bool v); bool value(); void setid(char i); char getid(); //void operator=(BOOL); //UND Operator /* friend BOOL operator* (BOOL a, BOOL b); friend BOOL operator* (bool a, BOOL b); friend BOOL operator* (BOOL a, bool b); //ODER Operator friend BOOL operator+ (BOOL a, BOOL b); friend BOOL operator+ (bool a, BOOL b); friend BOOL operator+ (BOOL a, bool b); */ //Nicht Operator void invert(); }; /************* * * * Prototyps * * * *************/ //core function extern int core(char *expression_buffer, unsigned short int options); //parser functions extern void remove_blanks(char *buffer, unsigned short int max); extern void preparse(char* buffer); //analyse functions extern unsigned char bracket_check(char *term, unsigned char &anz, char *variablen); extern bool analyse(char *term, unsigned char anz, BOOL *var, unsigned char pos1, unsigned char pos2); extern void invert_array(bool *barray, unsigned short int array_length); extern unsigned char param(int argc, char *argv[], unsigned short int &options, char *expression_buffer); //engine funtions extern void *compare(BOOL *lh, unsigned char anz, unsigned short &high, unsigned short int options); extern void remdub(BOOL *lh, char anz, unsigned short &high, unsigned short int options); extern bool eval_dub(BOOL *newlh, unsigned short int high, BOOL *lh, unsigned short int comp, unsigned char num_vars); //result generator function extern void create_result(BOOL *BO_var, BOOL *lh, unsigned char num_vars, unsigned short high, char *term, bool optimize, unsigned short int options); //table functions extern void tableinput(BOOL *var, unsigned char anz, unsigned short &high, bool *erg, unsigned short help); extern void tableheadoutput(BOOL *var, unsigned char anz, unsigned short int options); extern void tableoutput(bool value, bool option, unsigned short int options); extern void tabletailoutput(char *minterm); //msg functions extern void version_msg(void); extern void help_msg(void); extern void usage_msg(void); extern void syntax_msg(void); extern void verbose_msg(char *msg, unsigned short int options); //extern void errormsg(char *msg, short ecode); #endif qmc-0.94/createmin.cc0100744000000000000000000001200407750226323013207 0ustar rootroot/* 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 spaeteren Version. Die Veroeffentlichung 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: createmin.cc begin: 03/2000 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Headers #include //Debug - Switch //#define DEBUG //#define DEBUG2 #ifdef DEBUG #include #endif using namespace std; /* create simple expresion (the result) */ void create_result(BOOL *BO_var, BOOL *lh, unsigned char num_vars, unsigned short high, char *buffer, bool optimize, unsigned short int options) { //local variables bool expr; unsigned char j, check=0; unsigned short i, tindex=0; #ifdef DEBUG cerr << "\ncreatemin.cc [create_result]: high=" << high << "; check..."; for(i=0;i #include //Debug - switch //#define DEBUG using namespace std; /* eval dublicated entries (replacement for remdub - prevents dublications in compare) */ bool eval_dub(BOOL *newlh, unsigned short int high, BOOL *lh, unsigned short int comp, unsigned char num_vars) { unsigned short int i; unsigned char h, diff; for(i=0;i #include /* bracket_check */ //Debug - Switch //#define DEBUG #ifdef DEBUG #include #endif using namespace std; //check brackets unsigned char bracket_check(char *expression_buffer, unsigned char &num_vars, char *vars) { //local variables char chksum = 0; unsigned char counter ,i , swap=0; num_vars = 0 ; //initialize array for(counter=0; counterMAX_NUM_VARS) { counter=0; while(vars[counter]!='#') { counter++; //end function if the maximum of variables is reached if(counter>MAX_NUM_VARS) return(3); } vars[counter]=expression_buffer[i]; num_vars++; } } swap=0; } //end function if there is a mistake with the brackets if(chksum<0) { // negative result of brackets! return(2); } #ifdef DEBUG cerr << "\ninputpr.cc [bracket_check]: runtime variables: " << vars << " number: " << (unsigned short)num_vars << " - run " << (unsigned short)i << " of " << strlen(expression_buffer)-1; #endif } //end function if not zero if(chksum!=0) { //result is not zero! (chksum!=0) return(2); } //end-check if(expression_buffer[strlen(expression_buffer)-1]==SYMB_AND || expression_buffer[strlen(expression_buffer)-1]==SYMB_OR || expression_buffer[strlen(expression_buffer)-1]==SYMB_NOT) { //last char inpossible return(6); } //end function if there is no variable /*if(num_vars==0) { //no variable found! return(1); }*/ #ifdef DEBUG cerr << endl; #endif //send OK to the main function return(0); } /* remove blanks from buffer */ void remove_blanks(char *buffer, unsigned short int max) { unsigned short int counter=0;//, new_counter=0; // char *new_buffer=NULL; // new_buffer = new char[strlen(buffer)]; #ifdef DEBUG cerr << "\ninputpr.cc [remove_blanks]: buffer with blanks [" << buffer << "], strlen " << strlen(buffer); cerr << "\ninputpr.cc [remove_blanks]: max allowed size is " << max << endl; #endif while( buffer[counter]!=0 || counter>max ) { if( buffer[counter] == BLANK_CHAR ) { buffer[counter]=0; //if(counter+1<(unsigned short int)strlen(buffer)) buffer=strcat(buffer,&buffer[counter+1]); buffer=strcat(buffer,&buffer[counter+1]); } else { counter ++; } } /* while(buffer[counter]!=0 || counter>max) { if(buffer[counter++]!=BLANK_CHAR) { new_buffer[new_counter++]=buffer[counter-1]; } } new_buffer[new_counter]=0; strcpy(buffer,new_buffer); */ #ifdef DEBUG cerr << "\ninputpr.cc [remove_blanks]: buffer without blanks [" << new_buffer << "], strlen " << strlen(new_buffer); cerr << "\ninputpr.cc [remove_blanks]: max allowed size is " << max << endl; #endif } //preparser void preparse(char* expression_buffer) { unsigned char counter = 0; while( expression_buffer[counter+1] != 0 ) { if( expression_buffer[counter] == '/' ) { switch( expression_buffer[counter+1] ) { case '/': expression_buffer[counter]=0; expression_buffer = strcat(expression_buffer,&expression_buffer[counter+2]); counter--; break; case '1': expression_buffer[counter]='0'; expression_buffer[counter+1]=0; expression_buffer = strcat(expression_buffer,&expression_buffer[counter+1]); break; case '0': expression_buffer[counter]='1'; expression_buffer[counter+1]=0; expression_buffer = strcat(expression_buffer,&expression_buffer[counter+2]); break; default: break; } } counter++; } } qmc-0.94/main.cc0100744000000000000000000000452407750226105012172 0ustar rootroot/* 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, weitb_resulteben und/oder modifizieren, entweder unter Version 2 der Lizenz oder jeder spaeteren Version. Die Veroeffentlichung 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: main.cc - main file begin: 01/2000 redesign: 10/2003 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Include #include #include using namespace std; /* main */ int main(int argc, char *argv[]) { unsigned short int options=0; char expression_buffer[INPUT_BUFFER_SIZE]; argc--; if( !param( argc, argv, options, expression_buffer) ) { return 0; } //start the program if( expression_buffer != NULL || options&TABLE_INPUT || options&INTERACTIVE) { return core(expression_buffer, options); } else { cout << "no input found" << endl; } return 0; } qmc-0.94/msg.cc0100744000000000000000000001306207750225753012041 0ustar rootroot/* 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 späteren Version. Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen von Nutzen sein wird, aber OHNE JEDE GEWAEHRLEISTUNG - sogar ohne die implizite Gewährleistung 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: msg.cc begin: 04/2000 redesign: 10/2003 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Headers #include #include using namespace std; //output verion information void version_msg(void) { cout << "QMC: simplification tool (by using the Quine - McClusky process)" <in some cases the Quine-McClusky procedure enlarges the result<" << endl; } //output help information void help_msg(void) { cout << "Usage: qmc [OPTION]" << endl; cout << "Simplification tool by using the Quine - McClusky process." << endl << endl; cout << " -a, --avoidast avoid astericks at the output" << endl; cout << " -d, --describesyntax descibe the syntax for the EQU" << endl; cout << " -g, --gettable get boolean table" << endl; cout << " -G --gethtmltable get boolean table as HTML output" << endl; cout << " -h, --help display this help and exit" << endl; cout << " -p, --prompt prompt for equation" << endl; cout << " -s, --source EQU set one side of the equation" << endl; cout << " -t, --table set boolean table" << endl; cout << " -T, --time display used time" << endl; cout << " -v, --verbose print progress" << endl; cout << " --version output version information and exit" << endl << endl; cout << "A few samples:" << endl; cout << " qmc -s \"/[a+b]*[/b*c]\"" << endl; cout << " qmc -g -s \"x + //y * [ z + /z * y ] * 1\"" << endl; cout << " qmc -T -s \"a*/b+c+d+e*/c+f*e\"" << endl; cout << " qmc -p" << endl << endl; cout << " (symbols are recognized as single char's)" << endl << endl; cout << "Project Home: http://qmc.pollaknet.at" << endl; cout << "Please report bugs to ." << endl << flush; } //output usage info void usage_msg(void) { cout << "qmc: too few arguments" << endl; cout << "Try `qmc --help' for more information." << endl << flush; } //universal verbose msgs void verbose_msg(char *msg, unsigned short int options) { if( options & PROTOCOL && ! ( options & HTML_OUTPUT ) ) cout << msg << flush; } qmc-0.94/parameter.cc0100744000000000000000000001112107750230160013211 0ustar rootroot/* 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 k”nnen 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 spaeteren Version. Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen von Nutzen sein wird, aber OHNE JEDE GEWŽHRLEISTUNG - 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: param.cc - parameter check begin: 05/2000 email: thomas@pollaknet.at web: http://qmc.pollaknet.at */ //Headrs #include #include #include using namespace std; /************************ * * * parameter check * * * ************************/ unsigned char param(int argc, char *argv[], unsigned short int &options, char *expression_buffer) { int counter; //some input parameters? if(argc) { //check each parameter for(counter=1; counter<=argc; counter++) { if(!strcmp(argv[counter],"--version")) { version_msg(); return 0; } else if( !strcmp(argv[counter],"-s") || !strcmp(argv[counter],"--source") ) { if(argc>counter) { //copy buffer if valid if(strlen(argv[++counter])<=INPUT_BUFFER_SIZE) { //equ = new char[strlen(argv[counter])+1]; strcpy(expression_buffer, argv[counter]); } else { cout << "input buffer too big" << endl; return 0; } #ifdef DEBUG cerr << "\nimput buffer successfully transfered"; cerr << "\nparameter.cc [main]: expression_buffer ["; cerr << equ << "], strlen " << strlen(expression_buffer) << endl; #endif } else { cout << "no input found" << endl; return 0; } } else if( !strcmp(argv[counter],"-v") || !strcmp(argv[counter],"--verbose") ) { options |= PROTOCOL; } else if( !strcmp(argv[counter],"-t") || !strcmp(argv[counter],"--table") ) { options |= TABLE_INPUT; } else if( !strcmp(argv[counter],"-g") || !strcmp(argv[counter],"--gettable") ) { options |= TABLE_OUTPUT; } else if( !strcmp(argv[counter],"-G") || !strcmp(argv[counter],"--gethtmltable") ) { options |= HTML_OUTPUT; } else if( !strcmp(argv[counter],"-p") || !strcmp(argv[counter],"--prompt") ) { options |= INTERACTIVE; } else if( !strcmp(argv[counter],"-T") || !strcmp(argv[counter],"--time") ) { options|= TIMER; } else if( !strcmp(argv[counter],"-a") || !strcmp(argv[counter],"--avoidast") ) { options |= AVOID_ASTERICKS; } else if( !strcmp(argv[counter],"-D") || !strcmp(argv[counter],"--dummy") ) { //nothing... dummy entry } else if( !strcmp(argv[counter],"-d") || !strcmp(argv[counter],"--describesyntax") ) { syntax_msg(); return 0; } else if(!strcmp(argv[counter],"-h") || !strcmp(argv[counter],"--help")) { help_msg(); return 0; } else { usage_msg(); return 0; } } } else { usage_msg(); return 0; } return 1; } qmc-0.94/qmc-gui.tcl0100644000000000000000000000730207750227215013004 0ustar rootroot#!/bin/sh #\ exec wish "$0" set qmc(status) "Status: waiting for input" set qmc(output) "" #proc run_calc { action } { proc run_calc { } { global qmc # set qmc(status) "Status: calculating..." if {$qmc(opt_browser) > 0} { exec "qmc" -G $qmc(opt_time) $qmc(opt_av_ast) -s $qmc(equation) > ~/.qmc_gui_tmp exec "konqueror" "~/.qmc_gui_tmp" & } else { exec "qmc" $qmc(opt_table) $qmc(opt_time) $qmc(opt_av_ast) -s $qmc(equation) > ~/.qmc_gui_tmp set fp [open "~/.qmc_gui_tmp" r] set qmc(output) [read $fp] close $fp .output_frame.output_text insert 1.0 "$qmc(output)\n" } # set qmc(status) "Status: waiting for input" } proc run_about { } { global qmc exec "qmc" "--version" > ~/.qmc_gui_tmp set fp [open "~/.qmc_gui_tmp" r] set qmc(output) [read $fp] close $fp .output_frame.output_text insert 1.0 "$qmc(output)\n" } proc run_desc { } { global qmc exec "qmc" "-d" | "head" "-n" "9" > ~/.qmc_gui_tmp set fp [open "~/.qmc_gui_tmp" r] set qmc(output) [read $fp] close $fp .output_frame.output_text insert 1.0 "$qmc(output)\n" } #frames frame .menu_frame -borderwidth 1 -relief raised frame .equation_frame -borderwidth 1 -relief raised frame .options_frame -borderwidth 1 -relief raised frame .output_frame -borderwidth 1 -relief raised frame .action_frame -borderwidth 1 -relief raised frame .status_frame -borderwidth 1 -relief raised #pack frames pack .menu_frame -side top -fill x pack .equation_frame -side top -fill x pack .options_frame -side top -fill x pack .output_frame -side top -fill x pack .action_frame -side top -fill x pack .status_frame -side top -fill x button .calc_button -text Calculate -command { run_calc} button .quit_button -text Quit -command exit bind .calc_button run_calc pack .calc_button -in .action_frame -side left -fill x -expand yes pack .quit_button -in .action_frame -side right -fill x -expand yes menubutton .file_menu -text File -menu .file_menu.file_menu_dropdown menu .file_menu.file_menu_dropdown .file_menu.file_menu_dropdown add command -label "Syntax Help" -command run_desc .file_menu.file_menu_dropdown add command -label "About qmc" -command run_about .file_menu.file_menu_dropdown add separator .file_menu.file_menu_dropdown add command -label "Quit" -command exit pack .file_menu -in .menu_frame -side left #equation input label .equation_frame.equation_label -text "Q=" entry .equation_frame.equation_entry_field -textvariable qmc(equation) pack .equation_frame.equation_label -side left pack .equation_frame.equation_entry_field -side right -fill x -expand yes checkbutton .opt_table_box -text "output as table" -variable qmc(opt_table) -onvalue "-g" -offvalue "-D" checkbutton .opt_time_box -text "enable timer" -variable qmc(opt_time) -onvalue "-T" -offvalue "-D" checkbutton .opt_av_ast_box -text "avoid astericks" -variable qmc(opt_av_ast) -onvalue "-a" -offvalue "-D" checkbutton .opt_browser_box -text "show result in konqueror" -variable qmc(opt_browser) grid .opt_table_box -in .options_frame -row 0 -column 0 -sticky sw grid .opt_time_box -in .options_frame -row 0 -column 1 -sticky w grid .opt_av_ast_box -in .options_frame -row 1 -column 0 -sticky sw grid .opt_browser_box -in .options_frame -row 1 -column 1 -sticky w text .output_frame.output_text -width 40 -height 20 -relief sunken -bd 2 -yscrollcommand ".output_frame.scroll set" scrollbar .output_frame.scroll -command ".output_frame.output_text yview" pack .output_frame.output_text -side left -fill x -expand yes pack .output_frame.scroll -side right -fill y label .status_frame.status_label -textvariable qmc(status) pack .status_frame.status_label -side left -fill x -fill y #change title wm title . "qmc-gui" qmc-0.94/table.cc0100744000000000000000000001071307750226032012331 0ustar rootroot/* 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 späteren Version. Die Veröffentlichung 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 #include 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> 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" << endl << " " << endl << " QMC simplification tool (by using the Quine - McClusky process)" << endl; cout << " " << endl << " " << endl; cout << "

Note: file created with qmc version " << QMC_VERSION << ", built " << QMC_DATE << ".


" << endl; cout << " " << endl << " "; for(j=0;j" << var[j].getid() << "" << endl; cout << " " << endl << " " << 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 << " " << endl; if(nrow) { cout << " " << endl; } } } void tabletailoutput(char *minterm) { cout << "
" << "Q" << "
" << value << "
" << endl << "
" << endl << "

Q=" << minterm << "

" <http://qmc.pollaknet.at

" << endl; cout << " Please report bugs to:thomas@pollaknet.at


" << endl; cout << "
" << endl << " " << endl << "" << endl; }