generate grapvis from gast model
authorcharlie <charlie.gerhardus@student.ru.nl>
Sun, 20 Dec 2015 22:23:30 +0000 (23:23 +0100)
committercharlie <charlie.gerhardus@student.ru.nl>
Sun, 20 Dec 2015 22:23:30 +0000 (23:23 +0100)
a3/code/dotgen/graph.dot [new file with mode: 0644]
a3/code/dotgen/tcpmodel.icl [new file with mode: 0644]
a3/code/dotgen/tcpmodel.prj [new file with mode: 0644]
a3/code/tcpmodel.icl

diff --git a/a3/code/dotgen/graph.dot b/a3/code/dotgen/graph.dot
new file mode 100644 (file)
index 0000000..143c598
--- /dev/null
@@ -0,0 +1,65 @@
+digraph TCPModel {\r
+label="TCPModel"\r
+rankdir=LR\r
+size="50,6!"\r
+bgcolor=lightsteelblue\r
+ordering="out"\r
+outputorder="nodesfirst"\r
+4[fillcolor=grey90,fontcolor=black,label="Listen",style="filled",shape=doublecircle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+4->2[label="ACK/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+4->2[label="DATA/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+4->2[label="FIN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+4->2[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+4->5[label="SYN/[SYN,ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+0[fillcolor=grey90,fontcolor=black,label="Awaiting Close",style="filled",shape=circle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+0->1[label="ACK/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+0->2[label="DATA/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+0->2[label="FIN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+0->2[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+0->2[label="SYN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+1[fillcolor=blue,fontcolor=white,label="Closed",style="filled",shape=circle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+1->1[label="ACK/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+1->1[label="DATA/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+1->1[label="FIN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+1->1[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+1->1[label="SYN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+2[fillcolor=blue,fontcolor=white,label="Connection Error",style="filled",shape=circle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+2->2[label="ACK/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+2->2[label="DATA/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+2->2[label="FIN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+2->2[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+2->2[label="SYN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3[fillcolor=grey90,fontcolor=black,label="Established",style="filled",shape=circle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+3->2[label="ACK/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->3[label="DATA/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->3[label="DATA/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->6[label="DATA/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->0[label="FIN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->1[label="FIN/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->2[label="RST/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->2[label="RST/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->2[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->2[label="SYN/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->2[label="SYN/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+3->2[label="SYN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+5[fillcolor=grey90,fontcolor=black,label="Received SYN",style="filled",shape=circle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+5->3[label="ACK/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+5->3[label="DATA/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+5->1[label="FIN/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+5->4[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+5->2[label="SYN/[SYN,ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6[fillcolor=grey90,fontcolor=black,label="Waiting",style="filled",shape=circle,fontname="Helvetica",fontsize=11,fixedsize=true,width=1,height=1]\r
+6->3[label="ACK/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="DATA/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="DATA/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="DATA/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="FIN/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="FIN/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="FIN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="RST/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="RST/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="RST/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="SYN/[DATA]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="SYN/[ACK]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+6->2[label="SYN/[]",fontname="Helvetica",fontsize=11,labelfontname="Helvetica",labelfontsize=11,color=black,arrowsize=1.2]\r
+}\r
diff --git a/a3/code/dotgen/tcpmodel.icl b/a3/code/dotgen/tcpmodel.icl
new file mode 100644 (file)
index 0000000..2b73c25
--- /dev/null
@@ -0,0 +1,100 @@
+module tcpmodel
+
+import gast, ESMSpec, Graphviz
+
+derive bimap []
+derive gEq State
+derive gLess State
+derive genShow State
+derive ggen Input
+derive gEq Input
+derive genShow Input
+derive gEq Output
+derive genShow Output
+
+/* connection settings */
+hostIP = "192.168.0.14"
+hostPort = 1203
+
+/* states */
+:: State = Listen | ReceivedSYN | Established | Waiting | Closed | WaitClose | ConnectionError
+
+instance render State where
+       render Listen = "Listen"
+       render ReceivedSYN = "Received SYN"
+       render Established = "Established"
+       render Waiting = "Waiting"
+       render Closed = "Closed"
+       render WaitClose = "Awaiting Close"
+       render ConnectionError = "Connection Error"
+
+/* input (received from client) */
+:: Input = InSYN | InACK | InDATA | InRST | InFIN
+
+instance render Input where
+       render InSYN = "SYN"
+       render InACK = "ACK"
+       render InDATA = "DATA"
+       render InRST = "RST"
+       render InFIN = "FIN"
+
+/* output (sent to client) */
+:: Output = OutSYN | OutACK | OutDATA | OutFIN
+
+instance render Output where
+       render OutSYN = "SYN"
+       render OutACK = "ACK"
+       render OutDATA = "DATA"
+       render OutFIN = "FIN"
+
+/* state transitions */
+stateTrans :: State Input -> [Trans Output State]
+stateTrans Listen InSYN = [Pt [OutSYN, OutACK] ReceivedSYN]
+stateTrans Listen InFIN = [Pt [] ConnectionError]
+stateTrans Listen InACK = [Pt [] ConnectionError]
+stateTrans Listen InDATA = [Pt [] ConnectionError]
+stateTrans Listen InRST = [Pt [] ConnectionError]
+
+stateTrans ReceivedSYN InSYN = [Pt [OutSYN,OutACK] ConnectionError]
+stateTrans ReceivedSYN InRST = [Pt [] Listen]
+stateTrans ReceivedSYN InACK = [Pt [] Established]
+stateTrans ReceivedSYN InFIN = [Pt [OutACK] Closed]
+stateTrans ReceivedSYN InDATA = [Pt [OutACK] Established]
+
+stateTrans Established InSYN = [Pt [] ConnectionError, Pt [OutACK] ConnectionError, Pt [OutDATA] ConnectionError] // connection error returns whatever it wants?
+stateTrans Established InDATA = [Pt [OutACK] Waiting, Pt [OutDATA] Established, Pt [] Established] // last one resend?
+stateTrans Established InRST = [Pt [] ConnectionError, Pt [OutACK] ConnectionError, Pt [OutDATA] ConnectionError] // connection error returns whatever it wants?
+stateTrans Established InFIN = [Pt [OutACK] Closed, Pt [] WaitClose]
+stateTrans Established InACK = [Pt [] ConnectionError]
+
+stateTrans Waiting InACK = [Pt [] Established]
+stateTrans Waiting _ = [Pt [] ConnectionError, Pt [OutACK] ConnectionError, Pt [OutDATA] ConnectionError]
+
+stateTrans WaitClose InACK = [Pt [OutACK] Closed]
+stateTrans WaitClose _ = [Pt [] ConnectionError]
+
+stateTrans Closed _ = [Pt [] Closed]
+stateTrans ConnectionError _ = [Pt [] ConnectionError]
+
+/* state machine thingy */
+esm :: ESM State Input Output
+esm = {s_0 = Listen, d_F = stateTrans, out = \_ _ . [], pred = \_ . []}
+
+/* build transitions */
+automaton = addTransitions 50 esm [Listen] [InSYN] {trans = [], issues = []}
+
+/* build graph */
+graph = mkDigraph "TCPModel" (automaton, Listen, [], [Closed,ConnectionError], [], [])
+
+/* write list of strings to file */
+instance <<< [String] where
+       (<<<) file [] = file
+       (<<<) file [x:xs] = file <<< x <<< xs
+
+/* testing program */
+Start world
+       # (_, file, world) = fopen "graph.dot" FWriteText world
+       # file = file <<< printDigraph graph
+       # (_, world) = fclose file world
+       = world
+
diff --git a/a3/code/dotgen/tcpmodel.prj b/a3/code/dotgen/tcpmodel.prj
new file mode 100644 (file)
index 0000000..227aacf
--- /dev/null
@@ -0,0 +1,760 @@
+Version: 1.4\r
+Global\r
+       ProjectRoot:    .\r
+       Target: Gast\r
+       Exec:   {Project}\tcpmodel.exe\r
+       CodeGen\r
+               CheckStacks:    False\r
+               CheckIndexes:   True\r
+       Application\r
+               HeapSize:       2097152\r
+               StackSize:      512000\r
+               ExtraMemory:    81920\r
+               IntialHeapSize: 204800\r
+               HeapSizeMultiplier:     4096\r
+               ShowExecutionTime:      False\r
+               ShowGC: False\r
+               ShowStackSize:  False\r
+               MarkingCollector:       False\r
+               StandardRuntimeEnv:     True\r
+               Profile\r
+                       Memory: False\r
+                       MemoryMinimumHeapSize:  0\r
+                       Time:   False\r
+                       Stack:  False\r
+               Output\r
+                       Output: ShowConstructors\r
+                       Font:   Courier\r
+                       FontSize:       9\r
+                       WriteStdErr:    False\r
+       Link\r
+               LinkMethod:     Static\r
+               GenerateRelocations:    False\r
+               GenerateLinkMap:        False\r
+               LinkResources:  False\r
+               ResourceSource: \r
+               GenerateDLL:    False\r
+               ExportedNames:  \r
+       Paths\r
+               Path:   {Project}\r
+               Path:   {Application}\Libraries\Gast\r
+               Path:   {Application}\Libraries\WrapDebug\r
+               Path:   {Application}\Libraries\MersenneTwister\r
+               Path:   {Application}\Libraries\TCPIP\r
+       Precompile:     \r
+       Postlink:       \r
+MainModule\r
+       Name:   tcpmodel\r
+       Dir:    {Project}\r
+       Compiler\r
+               NeverMemoryProfile:     False\r
+               NeverTimeProfile:       False\r
+               StrictnessAnalysis:     True\r
+               ListTypes:      StrictExportTypes\r
+               ListAttributes: True\r
+               Warnings:       True\r
+               Verbose:        True\r
+               ReadableABC:    False\r
+               ReuseUniqueNodes:       True\r
+               Fusion: False\r
+OtherModules\r
+       Module\r
+               Name:   ESMSpec\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   Graphviz\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   confSM\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   gast\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   gen\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   genLibTest\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   stdProperty\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   testable\r
+               Dir:    {Application}\Libraries\Gast\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   MersenneTwister\r
+               Dir:    {Application}\Libraries\MersenneTwister\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenBimap\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenCompress\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenEq\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenFMap\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenHylo\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenLexOrd\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenLib\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenMap\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenMapSt\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenMonad\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenParse\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenPrint\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenReduce\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   GenZip\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   _Array\r
+               Dir:    {Application}\Libraries\Generics\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdArray\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdBool\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdChar\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdCharList\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdClass\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdDebug\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdEnum\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdEnv\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdFile\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdFunc\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdGeneric\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdInt\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdList\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdMisc\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdOrdList\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdOverloaded\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdReal\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdString\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdTuple\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   _SystemArray\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   _SystemEnum\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdArrayExtensions\r
+               Dir:    {Application}\Libraries\StdLib\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdLib\r
+               Dir:    {Application}\Libraries\StdLib\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdLibMisc\r
+               Dir:    {Application}\Libraries\StdLib\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdListExtensions\r
+               Dir:    {Application}\Libraries\StdLib\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdMaybe\r
+               Dir:    {Application}\Libraries\StdLib\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
index 439dde8..cf9cd89 100644 (file)
@@ -12,45 +12,66 @@ derive gEq Output
 derive genShow Output
 
 /* connection settings */
-hostIP = "127.0.0.1"
+hostIP = "192.168.0.14"
 hostPort = 1203
 
 /* states */
-:: State = Listen | ReceivedSYN | Established | Waiting | Closed
+:: State = Listen | ReceivedSYN | Established | Waiting | Closed | WaitClose | ConnectionError
+
+instance == State where
+       (==) Listen Listen = True
+       (==) ReceivedSYN ReceivedSYN = True
+       (==) Established Established = True
+       (==) Waiting Waiting = True
+       (==) Closed Closed = True
+       (==) WaitClose WaitClose = True
+       (==) ConnectionError ConnectionError = True
+       (==) _ _ = False
 
 /* input (received from client) */
-:: Input = InSYN | InACK | InRST | InFIN | InUserData
+:: Input = InSYN | InACK | InDATA | InRST | InFIN
 
 instance toString Input where
        toString InSYN = "SYN"
        toString InACK = "ACK"
        toString InRST = "RST"
        toString InFIN = "FIN"
-       toString InUserData = "DATA <some data here>"
+       toString InDATA = "DATA"
 
 /* output (sent to client) */
-:: Output = OutSYN | OutACK | OutFIN
+:: Output = OutSYN | OutACK | OutDATA | OutFIN
 
 toOutput :: String -> [Output]
 toOutput "SYN-ACK" = [OutSYN, OutACK]
-toOutput _ = []
+toOutput "ACK" = [OutACK]
+toOutput "DATA" = [OutDATA]
+toOutput "TO" = []
 
 /* state transitions */
 stateTrans :: State Input -> [Trans Output State]
 stateTrans Listen InSYN = [Pt [OutSYN, OutACK] ReceivedSYN]
-stateTrans Listen _ = [Pt [] Listen]
+stateTrans Listen InFIN = [Pt [] ConnectionError]
+stateTrans Listen InACK = [Pt [] ConnectionError]
+stateTrans Listen InDATA = [Pt [] ConnectionError]
+stateTrans Listen InRST = [Pt [] ConnectionError]
 
+stateTrans ReceivedSYN InSYN = [Pt [OutSYN,OutACK] ConnectionError]
 stateTrans ReceivedSYN InRST = [Pt [] Listen]
 stateTrans ReceivedSYN InACK = [Pt [] Established]
-stateTrans ReceivedSYN _ = [Pt [] ReceivedSYN]
+stateTrans ReceivedSYN InFIN = [Pt [OutACK] Closed]
+stateTrans ReceivedSYN InDATA = [Pt [OutACK] Established]
 
-stateTrans Established InACK = [Pt [OutACK] Established]
-stateTrans Established InUserData = [Pt [OutACK] Waiting]
-stateTrans Established InFIN = [Pt [OutACK] Closed]
-stateTrans Established _ = [Pt [] Established]
+stateTrans Established InSYN = [Pt [] ConnectionError, Pt [OutACK] ConnectionError, Pt [OutDATA] ConnectionError] // connection error returns whatever it wants?
+stateTrans Established InDATA = [Pt [OutACK] Waiting, Pt [OutDATA] Established, Pt [] Established] // last one resend?
+stateTrans Established InRST = [Pt [] ConnectionError, Pt [OutACK] ConnectionError, Pt [OutDATA] ConnectionError] // connection error returns whatever it wants?
+stateTrans Established InFIN = [Pt [OutACK] Closed, Pt [] WaitClose]
+stateTrans Established InACK = [Pt [] ConnectionError]
 
 stateTrans Waiting InACK = [Pt [] Established]
-stateTrans Waiting _ = [Pt [] Waiting]
+stateTrans Waiting _ = [Pt [] ConnectionError, Pt [OutACK] ConnectionError, Pt [OutDATA] ConnectionError]
+
+stateTrans WaitClose InACK = [Pt [OutACK] Closed]
+stateTrans WaitClose _ = [Pt [] ConnectionError]
 
 /* sut state */
 :: *SutState :== (StringSChannel, StringRChannel, *World)
@@ -68,6 +89,14 @@ reset (s, r, world)
        # (s, world) = send "SUT-RESET" s world
        = (s, r, world)
 
+/* all endstates */
+endstate :: [State] -> Bool
+endstate sts = isMember Closed sts || isMember ConnectionError sts
+
+/* testing options */
+options = [Nsequences 10000, Stop endstate]
+
+/* testing program */
 Start world
        /* open console */
        # (console, world) = stdio world
@@ -83,7 +112,7 @@ Start world
        # (_, file, world) = fopen "testOut.txt" FWriteText world
        /* perform testing */
        # st = (toStringSChannel con.sChannel, toStringRChannel con.rChannel, world)
-       # ((_, _, world), console, file) = testConfSM [] stateTrans Listen adapter st reset console file
+       # ((_, _, world), console, file) = testConfSM options stateTrans Listen adapter st reset console file
        /* close connection */
        /* close files */
        # (_, world) = fclose file world