Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5d3a828

Browse files
authored
Fix hopcroft DFA minimization and add plot graph function
1 parent 99a2d46 commit 5d3a828

File tree

16 files changed

+522
-72
lines changed

16 files changed

+522
-72
lines changed

‎InhaCC/InhaCC/App.config‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
44
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
55
</startup>
6+
<appSettings>
7+
<add key="graphVizLocation" value="C:\Program Files (x86)\Graphviz2.38\bin"/>
8+
</appSettings>
69
</configuration>

‎InhaCC/InhaCC/Graph.cs‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
3+
Copyright (C) 2019. rollrat All Rights Reserved.
4+
5+
Author: Jeong HyunJun
6+
7+
*/
8+
9+
using GraphVizWrapper;
10+
using GraphVizWrapper.Commands;
11+
using GraphVizWrapper.Queries;
12+
using System;
13+
using System.Collections.Generic;
14+
using System.Drawing;
15+
using System.IO;
16+
using System.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
20+
namespace InhaCC
21+
{
22+
public class Graph
23+
{
24+
public static Bitmap ToImage(string str)
25+
{
26+
var getStartProcessQuery = new GetStartProcessQuery();
27+
var getProcessStartInfoQuery = new GetProcessStartInfoQuery();
28+
var registerLayoutPluginCommand = new RegisterLayoutPluginCommand(getProcessStartInfoQuery, getStartProcessQuery);
29+
30+
var wrapper = new GraphGeneration(getStartProcessQuery,
31+
getProcessStartInfoQuery,
32+
registerLayoutPluginCommand);
33+
34+
byte[] output = wrapper.GenerateGraph(str /*"digraph{a -> b; b -> c; c -> a;}"*/, Enums.GraphReturnType.Png);
35+
36+
return ByteToImage(output);
37+
}
38+
39+
40+
private static Bitmap ByteToImage(byte[] blob)
41+
{
42+
MemoryStream mStream = new MemoryStream();
43+
byte[] pData = blob;
44+
mStream.Write(pData, 0, Convert.ToInt32(pData.Length));
45+
Bitmap bm = new Bitmap(mStream, false);
46+
mStream.Dispose();
47+
return bm;
48+
}
49+
50+
}
51+
}

‎InhaCC/InhaCC/InhaCC.csproj‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
3535
<ItemGroup>
36+
<Reference Include="GraphVizWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
37+
<HintPath>..\packages\GraphViz.NET.1.0.0\lib\net40\GraphVizWrapper.dll</HintPath>
38+
</Reference>
3639
<Reference Include="System" />
40+
<Reference Include="System.Collections.Immutable, Version=1.0.34.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
41+
<HintPath>..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
42+
</Reference>
3743
<Reference Include="System.Core" />
3844
<Reference Include="System.Xml.Linq" />
3945
<Reference Include="System.Data.DataSetExtensions" />
@@ -48,6 +54,7 @@
4854
<ItemGroup>
4955
<Compile Include="cc\ParserGenerator.cs" />
5056
<Compile Include="cc\ScannerGenerator.cs" />
57+
<Compile Include="Graph.cs" />
5158
<Compile Include="MainForm.cs">
5259
<SubType>Form</SubType>
5360
</Compile>
@@ -69,6 +76,7 @@
6976
<DependentUpon>Resources.resx</DependentUpon>
7077
<DesignTime>True</DesignTime>
7178
</Compile>
79+
<None Include="packages.config" />
7280
<None Include="Properties\Settings.settings">
7381
<Generator>SettingsSingleFileGenerator</Generator>
7482
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

‎InhaCC/InhaCC/MainForm.Designer.cs‎

Lines changed: 117 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /