Added new project: Hazard

Die Klassen PrimImplikant und PrimImplikantCollection sind weitestgehend
fertig.
This commit is contained in:
Jonny007-MKD 2013-11-12 20:56:28 +01:00
parent 771d2cb28c
commit 696610967d
21 changed files with 862 additions and 70 deletions

76
.gitignore vendored
View File

@ -1,38 +1,3 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
@ -50,6 +15,9 @@ build/
[Bb]in/
[Oo]bj/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
@ -165,9 +133,9 @@ UpgradeLog*.htm
App_Data/*.mdf
App_Data/*.ldf
#############
## Windows detritus
#############
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
@ -181,35 +149,3 @@ $RECYCLE.BIN/
# Mac crap
.DS_Store
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg

20
Hazard/Hazard.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hazard", "Hazard\Hazard.vcxproj", "{504179E7-6D11-4B2C-9172-3293E8739C3F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{504179E7-6D11-4B2C-9172-3293E8739C3F}.Debug|Win32.ActiveCfg = Debug|Win32
{504179E7-6D11-4B2C-9172-3293E8739C3F}.Debug|Win32.Build.0 = Debug|Win32
{504179E7-6D11-4B2C-9172-3293E8739C3F}.Release|Win32.ActiveCfg = Release|Win32
{504179E7-6D11-4B2C-9172-3293E8739C3F}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

319
Hazard/Hazard/CParser.cpp Normal file
View File

@ -0,0 +1,319 @@
#include "stdafx.h"
#pragma warning(disable:4786)
#include <string>
#include <map>
#include "CParser.h"
using namespace std;
#define Getc(s) getc(s)
#define Ungetc(c) {ungetc(c,IP_Input); ugetflag=1;}
// Adds a character to the string value
void CParser::PushString(char c)
{
yylval.s += c;
}
//------------------------------------------------------------------------
void CParser::Load_tokenentry(string str,int index)
{
IP_Token_table[str]=index;
IP_revToken_table[index]=str;
}
void CParser::IP_init_token_table()
{
Load_tokenentry("STRING1",STRING1);
Load_tokenentry("IDENTIFIER",IDENTIFIER);
Load_tokenentry("INTEGER1",INTEGER1);
Load_tokenentry("Variables",VARIABLES);
Load_tokenentry("Terms",TERMS);
}
//------------------------------------------------------------------------
void CParser::pr_tokentable()
{
typedef map<string,int>::const_iterator CI;
const char* buf;
printf( "Symbol Table ---------------------------------------------\n");
for(CI p=IP_Token_table.begin(); p!=IP_Token_table.end(); ++p){
buf = p->first.c_str();
printf(" key:%s", buf);
printf(" val:%d\n", p->second);;
}
}
//------------------------------------------------------------------------
int CParser::yyparse()
{
int tok;
if(prflag)fprintf(IP_List,"%5d ",(int)IP_LineNumber);
/*
* Go parse things!
*/
parsestate pState = P_START;
while ((tok=yylex())!=0){
switch (pState)
{
case P_START:
switch (tok)
{
case VARIABLES:
pState = P_VARIABLES;
break;
case TERMS:
pState = P_TERMS_KEY;
break;
}
break;
case P_VARIABLES:
switch(tok)
{
case IDENTIFIER:
printf("Variable %s",yylval.s.c_str());
break;
case TERMS:
pState = P_TERMS_KEY;
break;
}
break;
case P_TERMS_KEY:
switch(tok)
{
case STRING1:
printf("Term Key %s",yylval.s.c_str());
break;
case INTEGER1:
printf("Term Key %d",yylval.i);
break;
case (int)'>':
pState = P_TERMS_VALUE;
break;
case VARIABLES:
pState = P_VARIABLES;
break;
}
break;
case P_TERMS_VALUE:
if (tok == INTEGER1)
{
printf("Term Value %d",yylval.i);
pState = P_TERMS_KEY;
}
break;
}
printf("\n");
}
return 0;
}
//------------------------------------------------------------------------
/*
* Parse Initfile:
*
* This builds the context tree and then calls the real parser.
* It is passed two file streams, the first is where the input comes
* from; the second is where error messages get printed.
*/
void CParser::InitParse(FILE *inp,FILE *err,FILE *lst)
{
/*
* Set up the file state to something useful.
*/
IP_Input = inp;
IP_Error = err;
IP_List = lst;
IP_LineNumber = 1;
ugetflag=0;
/*
* Define both the enabled token and keyword strings.
*/
IP_init_token_table();
}
//------------------------------------------------------------------------
/*
* yyerror:
*
* Standard error reporter, it prints out the passed string
* preceeded by the current filename and line number.
*/
void CParser::yyerror(char *ers)
{
fprintf(IP_Error,"line %d: %s\n",IP_LineNumber,ers);
}
//------------------------------------------------------------------------
int CParser::IP_MatchToken(string &tok)
{
int retval;
if( IP_Token_table.find(tok) != IP_Token_table.end()){
retval = (IP_Token_table[tok]);
}else{
retval = (0);
}
return retval;
}
//------------------------------------------------------------------------
/*
* yylex:
*
*/
int CParser::yylex()
{
//Locals
int c;
lexstate s;
/*
* Keep on sucking up characters until we find something which
* explicitly forces us out of this function.
*/
yytext = "";
yylval.s = "";
yylval.i = 0;
for (s = L_START; 1;){
c = Getc(IP_Input);
yytext = yytext + (char)c;
if(!ugetflag) {
if(c != EOF)if(prflag)fprintf(IP_List,"%c",c);
}else ugetflag = 0;
switch (s){
//Starting state, look for something resembling a token.
case L_START:
yytext = (char)c;
if (isdigit(c)){
s = L_INT;
}else if (isalpha(c) || c == '\\' ){
s = L_IDENT;
}else if (isspace(c)){
if (c == '\n'){
IP_LineNumber += 1;
if(prflag)
fprintf(IP_List,"%5d ",(int)IP_LineNumber);
s = L_START;
yytext = "";
}
}else if (c == '/'){
yytext = "";
s = L_COMMENT;
}else if (c == '"'){
s = L_STRING;
}else if (c == EOF){
return ('\0');
}else{
s = L_START;
yytext = "";
return (c);
}
break;
case L_COMMENT:
if (c == '/')
s = L_LINE_COMMENT;
else if(c == '*')
s = L_TEXT_COMMENT;
else{
Ungetc(c);
return('/'); /* its the division operator not a comment */
}
break;
case L_LINE_COMMENT:
if ( c == '\n'){
s = L_START;
Ungetc(c);
}
yytext = "";
break;
case L_TEXT_COMMENT:
if ( c == '\n'){
IP_LineNumber += 1;
}else if (c == '*')
s = L_END_TEXT_COMMENT;
yytext = "";
break;
case L_END_TEXT_COMMENT:
if (c == '/'){
s = L_START;
}else{
s = L_TEXT_COMMENT;
}
yytext = "";
break;
/*
* Suck up the integer digits.
*/
case L_INT:
if (isdigit(c)){
break;
}else {
Ungetc(c);
yylval.s = yytext.substr(0,yytext.size()-1);
yylval.i = atoi(yylval.s.c_str());
return (INTEGER1);
}
break;
/*
* Grab an identifier, see if the current context enables
* it with a specific token value.
*/
case L_IDENT:
if (isalpha(c) || isdigit(c) || c == '_')
break;
Ungetc(c);
yytext = yytext.substr(0,yytext.size()-1);
yylval.s = yytext;
if (c = IP_MatchToken(yytext)){
return (c);
}else{
return (IDENTIFIER);
}
/*
* Suck up string characters but once resolved they should
* be deposited in the string bucket because they can be
* arbitrarily long.
*/
case L_STRING2:
s = L_STRING;
if(c == '"'){
PushString((char)c);
}else{
if(c == '\\'){
PushString((char)c);
}else{
PushString((char)'\\');
PushString((char)c);
}
}
break;
case L_STRING:
if (c == '\n')
IP_LineNumber += 1;
else if (c == '\r')
;
else if (c == '"' || c == EOF){
return (STRING1);
} else if(c=='\\'){
s = L_STRING2;
//PushString((char)c);
}else
PushString((char)c);
break;
default: printf("***Fatal Error*** Wrong case label in yylex\n");
}
}
}

56
Hazard/Hazard/Cparser.h Normal file
View File

@ -0,0 +1,56 @@
// k7scan1.cpp : Definiert den Einsprungpunkt für die Konsolenanwendung.
//
#include "stdafx.h"
#pragma warning(disable:4786)
#include <string>
#include <map>
using namespace std;
#define Getc(s) getc(s)
#define Ungetc(c) {ungetc(c,IP_Input); ugetflag=1;}
/*
* Lexical analyzer states.
*/
enum lexstate{L_START,L_INT,L_IDENT,L_STRING,L_STRING2,
L_COMMENT,L_TEXT_COMMENT,L_LINE_COMMENT,L_END_TEXT_COMMENT};
enum parsestate{P_START,P_VARIABLES,P_TERMS_KEY,P_TERMS_VALUE};
const int STRING1=3;
const int IDENTIFIER=4;
const int INTEGER1=5;
const int VARIABLES=300;
const int TERMS=301;
class CParser
{
public:
string yytext; //input buffer
struct tyylval{ //value return
string s; //structure
int i;
}yylval;
FILE *IP_Input; //Input File
FILE *IP_Error; //Error Output
FILE *IP_List; //List Output
int IP_LineNumber; //Line counter
int ugetflag; //checks ungets
int prflag; //controls printing
map<string,int> IP_Token_table; //Tokendefinitions
map<int,string> IP_revToken_table; //reverse Tokendefinitions
int CParser::yylex(); //lexial analyser
void CParser::yyerror(char *ers); //error reporter
int CParser::IP_MatchToken(string &tok); //checks the token
void CParser::InitParse(FILE *inp,FILE *err,FILE *lst);
int CParser::yyparse(); //parser
void CParser::pr_tokentable(); //test output for tokens
void CParser::IP_init_token_table(); //loads the tokens
void CParser::Load_tokenentry(string str,int index);//load one token
void CParser::PushString(char c); //Used for dtring assembly
CParser(){IP_LineNumber = 1;ugetflag=0;prflag=0;}; //Constructor
};

73
Hazard/Hazard/Hazard.cpp Normal file
View File

@ -0,0 +1,73 @@
// Hazard.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include "CParser.h"
#include "PrimImplikant.h"
#include "PrimImplikantCollection.h"
int _tmain(int argc, _TCHAR* argv[])
{
FILE * input;
FILE * error;
FILE * list;
fopen_s(&input, "input.txt", "r");
if (input == 0)
{
cout << "Fehler Inputdatei";
system("pause");
return -1;
}
fopen_s(&error, "error.txt", "w");
if (error == 0)
{
cout << "Fehler Fehlerdatei";
system("pause");
return -1;
}
fopen_s(&list, "list.txt", "w");
if (list == 0)
{
cout << "Fehler Listdatei";
system("pause");
return -1;
}
CParser parser;
parser.IP_init_token_table();
parser.pr_tokentable();
parser.InitParse(input, error, list);
parser.yyparse();
system("pause");
PrimImplikantCollection pic;
pic.add(7);
pic.add("0x1");
pic.add("100");
pic.add("00x");
pic.add(4);
PrimImplikant prim7(7);
PrimImplikant prim13("0x1");
PrimImplikant prim4("100");
PrimImplikant prim4567("1xx");
pic.add(prim4567);
for (int p = 0; p < 8; p++)
{
//printf("Pos %d: prim7=%d, prim13=%d, prim4=%d, prim4567=%d, pic=%d\n", p, prim7.valueAt(p), prim13.valueAt(p), prim4.valueAt(p), prim4567.valueAt(p), pic.valueAt(p));
printf("Pos %d: Matching collections: ", p);
vector<PrimImplikant> matchingPIs = pic.primImplikantenAt(p);
for (vector<PrimImplikant>::iterator i = matchingPIs.begin(); i < matchingPIs.end(); i++)
//cout << i->name < ", ";
printf("%s, ", i->name.c_str());
cout << endl;
}
system("pause");
return 0;
}

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{504179E7-6D11-4B2C-9172-3293E8739C3F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Hazard</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Cparser.h" />
<ClInclude Include="PrimImplikant.h" />
<ClInclude Include="PrimImplikantCollection.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CParser.cpp" />
<ClCompile Include="Hazard.cpp" />
<ClCompile Include="PrimImplikant.cpp" />
<ClCompile Include="PrimImplikantCollection.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Quelldateien">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Headerdateien">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Ressourcendateien">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="PrimImplikant.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="PrimImplikantCollection.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Cparser.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="Hazard.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="CParser.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="PrimImplikant.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="PrimImplikantCollection.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,43 @@
#include <string>
#include <vector>
#include "stdafx.h"
#include "PrimImplikant.h"
using namespace std;
bool PrimImplikant::valueAt(int pos) {
for (vector<int>::iterator i = implikanten.begin(); i < implikanten.end(); ++i)
{
if (*i == pos)
return true;
}
return false;
}
void PrimImplikant::parser(string input) { // Analyser
int implikant = 0;
string text0 = "";
string text1 = "";
for (int i = 0; i < input.size(); i++)
{
char c = input[i];
if (c == 'x' || c == 'X')
{
text0 = input;
text1 = input;
text0[i] = '0';
text1[i] = '1';
parser(text0);
parser(text1);
return;
}
if (c != '0' && c != '1')
{
printf("**** FATAL ERROR **** %s is not binary\n", input);
return;
}
implikant <<= 1; // *2
implikant += (int)c - (int)'0';
}
implikanten.push_back(implikant);
}

View File

@ -0,0 +1,35 @@
#ifndef PRIMIMPLIKANT
#define PRIMIMPLIKANT
#include <string>
#include <vector>
using namespace std;
class PrimImplikant
{
public:
string name;
PrimImplikant(string input)
{
name = input;
parser(input);
}
PrimImplikant(int input)
{
char nameC[sizeof(int)*8+1];
_itoa_s(input, nameC, sizeof(int)*8+1, 10);
name = nameC;
implikanten.push_back(input);
}
bool PrimImplikant::valueAt(int position);
void PrimImplikant::parser(string input);
private:
vector<int> implikanten;
};
#endif

View File

@ -0,0 +1,44 @@
#include "stdafx.h"
#include <string>
#include <vector>
#include "PrimImplikantCollection.h"
using namespace std;
void PrimImplikantCollection::add(PrimImplikant &PI)
{
PIVector.push_back(PI);
}
void PrimImplikantCollection::add(string input)
{
PrimImplikant PI(input);
PIVector.push_back(PI);
}
void PrimImplikantCollection::add(int input)
{
PrimImplikant PI(input);
PIVector.push_back(PI);
}
bool PrimImplikantCollection::valueAt(int position)
{
for (vector<PrimImplikant>::iterator i = PIVector.begin(); i < PIVector.end(); i++)
if (i->valueAt(position))
return true;
return false;
}
vector<PrimImplikant> PrimImplikantCollection::primImplikantenAt(int position)
{
vector<PrimImplikant> pic;
for (vector<PrimImplikant>::iterator i = PIVector.begin(); i < PIVector.end(); i++)
if (i->valueAt(position))
pic.push_back(*i);
return pic;
}
PrimImplikant PrimImplikantCollection::solveNextHazard()
{
PrimImplikant PI(0);
return PI;
}

View File

@ -0,0 +1,25 @@
#ifndef PRIMIMPLIKANTCOLLEC
#define PRIMIMPLIKANTCOLLEC
#include <string>
#include <vector>
#include "PrimImplikant.h"
using namespace std;
class PrimImplikantCollection{
public:
void add(PrimImplikant &PI);
void add(string input);
void add(int input);
bool valueAt(int position);
vector<PrimImplikant> primImplikantenAt(int position);
PrimImplikant solveNextHazard();
private:
vector<PrimImplikant> PIVector;
};
#endif

32
Hazard/Hazard/ReadMe.txt Normal file
View File

@ -0,0 +1,32 @@
========================================================================
KONSOLENANWENDUNG: Hazard-Projektübersicht
========================================================================
Diese Hazard-Anwendung wurde vom Anwendungs-Assistenten für Sie erstellt.
Diese Datei bietet eine Übersicht über den Inhalt der einzelnen Dateien, aus
denen Ihre Hazard-Anwendung besteht.
Hazard.vcxproj
Dies ist die Hauptprojektdatei für VC++-Projekte, die mit dem Anwendungs-Assistenten generiert werden. Sie enthält Informationen über die Version von Visual C++, mit der die Datei generiert wurde, sowie über die Plattformen, Konfigurationen und Projektfunktionen, die im Anwendungs-Assistenten ausgewählt wurden.
Hazard.vcxproj.filters
Dies ist die Filterdatei für VC++-Projekte, die mithilfe eines Anwendungs-Assistenten erstellt werden. Sie enthält Informationen über die Zuordnung zwischen den Dateien im Projekt und den Filtern. Diese Zuordnung wird in der IDE zur Darstellung der Gruppierung von Dateien mit ähnlichen Erweiterungen unter einem bestimmten Knoten verwendet (z. B. sind CPP-Dateien dem Filter "Quelldateien" zugeordnet).
Hazard.cpp
Dies ist die Hauptquelldatei der Anwendung.
/////////////////////////////////////////////////////////////////////////////
Andere Standarddateien:
StdAfx.h, StdAfx.cpp
Mit diesen Dateien werden eine vorkompilierte Headerdatei (PCH) mit dem Namen Hazard.pch und eine vorkompilierte Typendatei mit dem Namen StdAfx.obj erstellt.
/////////////////////////////////////////////////////////////////////////////
Weitere Hinweise:
Der Anwendungs-Assistent weist Sie mit "TODO:"-Kommentaren auf Teile des
Quellcodes hin, die Sie ergänzen oder anpassen sollten.
/////////////////////////////////////////////////////////////////////////////

0
Hazard/Hazard/error.txt Normal file
View File

6
Hazard/Hazard/input.txt Normal file
View File

@ -0,0 +1,6 @@
Variables: a, b, c, d
Terms:
"0010">1
7>1
1234>1
"0123">1

0
Hazard/Hazard/list.txt Normal file
View File

8
Hazard/Hazard/stdafx.cpp Normal file
View File

@ -0,0 +1,8 @@
// stdafx.cpp : Quelldatei, die nur die Standard-Includes einbindet.
// Hazard.pch ist der vorkompilierte Header.
// stdafx.obj enthält die vorkompilierten Typinformationen.
#include "stdafx.h"
// TODO: Auf zusätzliche Header verweisen, die in STDAFX.H
// und nicht in dieser Datei erforderlich sind.

15
Hazard/Hazard/stdafx.h Normal file
View File

@ -0,0 +1,15 @@
// stdafx.h : Includedatei für Standardsystem-Includedateien
// oder häufig verwendete projektspezifische Includedateien,
// die nur in unregelmäßigen Abständen geändert werden.
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen.

View File

@ -0,0 +1,8 @@
#pragma once
// Durch Einbeziehen von"SDKDDKVer.h" wird die höchste verfügbare Windows-Plattform definiert.
// Wenn Sie die Anwendung für eine frühere Windows-Plattform erstellen möchten, schließen Sie "WinSDKVer.h" ein, und
// legen Sie das _WIN32_WINNT-Makro auf die zu unterstützende Plattform fest, bevor Sie "SDKDDKVer.h" einschließen.
#include <SDKDDKVer.h>

6
Hazard/input.txt Normal file
View File

@ -0,0 +1,6 @@
Variables: a, b, c, d
Terms:
"0010">1
7>1
1234>1
"0123">1

6
Hazard/res/input.txt Normal file
View File

@ -0,0 +1,6 @@
Variables: a, b, c, d
Terms:
"0010">1
7>1
1234>1
"0123">1

5
Roadmap.txt Normal file
View File

@ -0,0 +1,5 @@
Programmfunktionen klären: Wieviele Eingänge (variabel?), wieviele Zwischenvariablen
Klassendefinition
Ausgabe KV-Diagramm
Einlesen der Daten
Algorithmus implementieren