home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Snippets / Quine-McClusky 1.2 / qmPrime.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-29  |  2.5 KB  |  91 lines  |  [TEXT/MPCC]

  1. /****************************************************************************
  2.  *
  3.  *     qmPrime.h
  4.  *
  5.  *     By:        John A. Schlack
  6.  *     Dates:    October 1994
  7.  *
  8.  *     Description:
  9.  *
  10.  *        This module contains the definition for a structure used in developing
  11.  *        the irredundant form.  This data will initially be developed when
  12.  *        passing all prime implicants to the reducing functions (which retain
  13.  *        this data format until the program completes).
  14.  *
  15.  *    Release Notes:
  16.  *
  17.  *        1.10    10/28/94    Created to store program-wide macros, structures,
  18.  *                            and prototypes.
  19.  *
  20.  ****************************************************************************/
  21.  
  22.  
  23. #ifndef QMPRIME_H
  24. #define QMPRIME_H
  25.  
  26.  
  27. /* --------------------------------------------------------------------------------------------- */
  28.  
  29.  
  30. #define DEBUG        0
  31.  
  32. #define MAX_VARS    8
  33. #define MAX_COMBOS    (1L << (MAX_VARS - 1))
  34.  
  35. #ifndef MAIN_C
  36.     #include <stdio.h>
  37.     extern FILE *        fp;
  38. #endif
  39.  
  40.  
  41. /* --------------------------------------------------------------------------------------------- */
  42.  
  43.  
  44. /* Structures for Deriving Irredundant Form */
  45.  
  46. typedef struct irElement
  47. {
  48.     unsigned char *    decimal;
  49.     unsigned char *    difference;
  50.     short            level;            // list level of prime implicant (determines number of entries in "decimal"
  51.     short            uniqueCount;    // number of unique decimal functions this prime specifies
  52.     short            amtInOutput;    // number of decimal functions in current output list
  53.     char            inOutput;        // prime implicant is used in output
  54. } irElement;
  55.  
  56.  
  57. typedef struct irredundant
  58. {
  59.     irElement *    irArray;            // array of prime implicnats
  60.     short        len;                // number of prime implicants
  61. } irredundant;
  62.  
  63.  
  64. typedef struct decimalArray
  65. {
  66.     short *    array;
  67.     short    len;
  68. } decimalArray;
  69.  
  70.  
  71. /* --------------------------------------------------------------------------------------------- */
  72.  
  73.  
  74. /* PROTOTYPES */
  75.  
  76. void     QuineMcClusky( decimalArray * output, decimalArray * dontCare, short actualVars );
  77. void     lowMemory( void );
  78. void     paramError( char * funcName, short param );
  79. void     blockMove( char * dst, char * src, size_t len );
  80. void     printNumbers( FILE * fout, unsigned char * numStr, short len );
  81. void     printEntry( unsigned char * decimal, unsigned char * difference, short level, short vars,
  82.             short * minLevel );
  83. irredundant *     doDecimal( short * decFunction, short decCount, short actualVars );
  84. short    irredundantForm( irredundant * ir, short * function, short funcLen, short actualVars );
  85.  
  86.  
  87. /* --------------------------------------------------------------------------------------------- */
  88.  
  89.  
  90. #endif
  91.