diff --git a/StateMachine/src/M_transitions.vb b/StateMachine/src/M_transitions.vb new file mode 100644 index 0000000..59dbfe4 --- /dev/null +++ b/StateMachine/src/M_transitions.vb @@ -0,0 +1,241 @@ +Imports System.IO + +Module M_transitions + +#Region "variabili locali" + + Private sz_tokens As String() + + Private objWriter As StreamWriter + + Private sz_file_name As String + +#End Region + +#Region "Strutture" + +#End Region + +#Region "Lettura file regole " + + Sub Read_rule_file_transitions(ByVal sz_filename As String) + + Dim sz_TextLine As String, sz_temp As String + Dim temp_rule As Rule, b_rules_definition As Boolean + Dim n_line As Int16 + + n_line = 0 + b_rules_definition = False + + sz_file_name = sz_filename + + If System.IO.File.Exists(sz_filename) = True Then + + Dim objfile As New System.IO.StreamReader(sz_filename) + + Do While objfile.Peek() <> -1 ' finche c'è vita + + sz_TextLine = Trim(objfile.ReadLine()) + n_line = n_line + 1 + + If (Not String.IsNullOrEmpty(sz_TextLine)) Then ' linea vuota o commento ? + + If (Trim(sz_TextLine).Chars(0) <> "#") Then + + If InStr(sz_TextLine, ControlChars.Tab) > 0 Then ' sostituzione dei tab !!!! + + sz_TextLine = sz_TextLine.Replace(ControlChars.Tab, String.Empty) + + End If + + + sz_tokens = sz_TextLine.Split(New Char() {":"c}) ' splitta sui ":" + + sz_temp = Trim(UCase$(Trim(sz_tokens(0)))) ' primo campo + + Select Case sz_temp + + Case "$DEFINITIONS" + b_rules_definition = False + + Case "$NAME" + sz_state_machine_name = UCase$(Trim(sz_tokens(1))) + + Case "$IDX" + n_state_machine_index = my_CInt(Trim(sz_tokens(1))) + + Case "$N_STATES" + n_states = my_CInt(Trim(sz_tokens(1))) + + Case "$N_BITS" + n_bits = my_CInt(Trim(sz_tokens(1))) + + Case "$BIT" + Bits.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$STATE" + States.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$EVENT" + Events_to_send.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$RULES" + b_rules_definition = True + + Case "$DO" + b_rules_definition = False + + Call evaluate_transitions() + + Case Else + + If (b_rules_definition) Then + + temp_rule.state = sz_temp + temp_rule.expression = (UCase$(Trim(sz_tokens(1)))) + temp_rule.next_state = (UCase$(Trim(sz_tokens(2)))) + temp_rule.event_to_send = (UCase$(Trim(sz_tokens(3)))) + + Rules.Add(temp_rule) + + Else + MsgBox("bad keyword or no rule on line : " & sz_TextLine, MsgBoxStyle.Critical, "ERROR on line : " & n_line.ToString) + End If + + + End Select + + End If ' commento + End If ' linea vuota + + Loop + + objfile.Close() + + Else + MsgBox(Message.Msg(4), MsgBoxStyle.Critical, sz_filename) ' file non esiste + End If ' file exists + + End Sub + +#End Region + + +#Region "Evaluate" + + Private Sub evaluate_transitions() + + Dim sz_actual_state As String, sz_actual_bit As String, sz_line + + Dim i As Int16, n_input As Int16, n As Int16, n_mask As Int16, n_bit As Int16 + + + Dim b_bit(20) As Boolean, b_invert As Boolean + + FrmMain.TextBox1.Text = "" + + Call open_mac_file(Path.GetDirectoryName(sz_file_name) & "\" & Path.GetFileNameWithoutExtension(sz_file_name) & ".csv", IniRead.sz_file_init_transitions) + + ' ciclo per ogni stato + For i = 0 To n_states - 1 + + sz_actual_state = States(i) + + ' ciclo per ogni ingresso + For n_input = 0 To ((2 ^ n_bits) - 1) + + ' calcolo true false per ogni bit dell' ingresso + n_mask = 1 + For n = 0 To (n_bits - 1) + b_bit(n) = n_input And n_mask + n_mask = n_mask << 1 + Next n + + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + FrmMain.TextBox1.Text = " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + + ' ciclo per ogni regola + For Each act_rule As Rule In Rules + + n_bit = -1 + + ' controllo se la regola attuale vale in questo stato + If ((act_rule.state = "ALL_STATES") Or (act_rule.state = sz_actual_state)) Then + + If (act_rule.state = sz_actual_state) Then + FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf + + End If + + 'recupero il bit in questione + b_invert = False + + sz_actual_bit = act_rule.expression + + If InStr(sz_actual_bit, "NOT") Then ' bit negato ??? + b_invert = True + sz_actual_bit = Trim(sz_actual_bit.Replace("NOT ", "")) + End If ' bit negato + + ' cerca il nome del bit e ne trova l' indice da 0 + n_bit = Bits.FindIndex(Function(bittolo) (sz_actual_bit.Equals(bittolo))) + + If n_bit = -1 Then + + MsgBox("Bit name error - " & sz_actual_bit & vbCrLf & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state, + MsgBoxStyle.Critical, + "ERROR - bit " & n_bit.ToString & " -- " & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString) + Exit For + End If + + ' vera la espressione ? + + If (((Not b_invert) And b_bit(n_bit)) Or (b_invert And (Not b_bit(n_bit)))) Then + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo del bit " & n_bit.ToString & " - " & Bits(n_bit) + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " ------------->>scatta la regola " & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state & vbCrLf & vbCrLf + sz_line = "" + + If (States.IndexOf(act_rule.next_state) <> i) Then ' andrei allo stesso stato ? + + ' "IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato" + + sz_line = n_state_machine_index.ToString & ";" & + i.ToString & ";" & + n_input.ToString & ";" & + Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & + States.IndexOf(act_rule.next_state).ToString() + + Call write_mac_file(sz_line) + + Else + sz_line = "----" & n_state_machine_index.ToString & ";" & + i.ToString & ";" & + n_input.ToString & ";" & + Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & + States.IndexOf(act_rule.next_state).ToString() + 'Call write_mac_file(sz_line) + + End If ' andrei allo stesso stato + + Exit For ' esco da questo caso + + End If ' vera la espressione + + End If ' vale la regola + + Next ' ciclo per tutte le regole + + Next n_input ' ciclo per ogni ingresso + + Next i ' ciclo per ogni stato + + Call close_mac_file() + + End Sub +#End Region + +End Module + + diff --git a/StateMachine/src/MapoState/MapoState.sln b/StateMachine/src/MapoState/MapoState.sln new file mode 100644 index 0000000..0a8013d --- /dev/null +++ b/StateMachine/src/MapoState/MapoState.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MapoState", "MapoState\MapoState.vbproj", "{492396EA-9B89-4318-879A-2DD7D0DBD1DD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/StateMachine/src/MapoState/MapoState/Config/Mapostate.ini b/StateMachine/src/MapoState/MapoState/Config/Mapostate.ini new file mode 100644 index 0000000..112075c --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Config/Mapostate.ini @@ -0,0 +1,28 @@ +[General] + +Program path = c:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\resource +ext = + +temp path = cd c:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\temp + +[Debug] + +debug = true +verbose = true + +[Log] +enabled = true +Log file = c:\CMS\aut_d20\temp\log + + +[RUL] +default = C:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\Resources\15.rul + +inputs = IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato + +transitions = IdxFamigliaIngresso;IdxStato;ValoreIngresso;next_IdxStato + + + + + diff --git a/StateMachine/src/MapoState/MapoState/FrmMain.Designer.vb b/StateMachine/src/MapoState/MapoState/FrmMain.Designer.vb new file mode 100644 index 0000000..744eaeb --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/FrmMain.Designer.vb @@ -0,0 +1,111 @@ + +Partial Class FrmMain + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmMain)) + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() + Me.CmdExit = New System.Windows.Forms.Button() + Me.Btn_level_inputs = New System.Windows.Forms.Button() + Me.Panel1 = New System.Windows.Forms.Panel() + Me.Btn_level_transitions = New System.Windows.Forms.Button() + Me.Panel1.SuspendLayout() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(6, 12) + Me.TextBox1.MaxLength = 1000000 + Me.TextBox1.Multiline = True + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox1.Size = New System.Drawing.Size(705, 371) + Me.TextBox1.TabIndex = 0 + ' + 'OpenFileDialog1 + ' + Me.OpenFileDialog1.FileName = "OpenFileDialog1" + ' + 'CmdExit + ' + Me.CmdExit.Location = New System.Drawing.Point(623, 3) + Me.CmdExit.Name = "CmdExit" + Me.CmdExit.Size = New System.Drawing.Size(81, 35) + Me.CmdExit.TabIndex = 18 + Me.CmdExit.Text = "Exit" + Me.CmdExit.UseVisualStyleBackColor = True + ' + 'Btn_level_inputs + ' + Me.Btn_level_inputs.Location = New System.Drawing.Point(6, 3) + Me.Btn_level_inputs.Name = "Btn_level_inputs" + Me.Btn_level_inputs.Size = New System.Drawing.Size(126, 35) + Me.Btn_level_inputs.TabIndex = 20 + Me.Btn_level_inputs.Text = "Macchina stati ingressi ( Livello 1 )" + Me.Btn_level_inputs.UseVisualStyleBackColor = True + ' + 'Panel1 + ' + Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.Panel1.Controls.Add(Me.Btn_level_transitions) + Me.Panel1.Controls.Add(Me.Btn_level_inputs) + Me.Panel1.Controls.Add(Me.CmdExit) + Me.Panel1.Location = New System.Drawing.Point(6, 400) + Me.Panel1.Name = "Panel1" + Me.Panel1.Size = New System.Drawing.Size(710, 43) + Me.Panel1.TabIndex = 21 + ' + 'Btn_level_transitions + ' + Me.Btn_level_transitions.Location = New System.Drawing.Point(155, 3) + Me.Btn_level_transitions.Name = "Btn_level_transitions" + Me.Btn_level_transitions.Size = New System.Drawing.Size(126, 35) + Me.Btn_level_transitions.TabIndex = 21 + Me.Btn_level_transitions.Text = "Macchina stati transiz. ( Livello 2 )" + Me.Btn_level_transitions.UseVisualStyleBackColor = True + ' + 'FrmMain + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(723, 451) + Me.Controls.Add(Me.Panel1) + Me.Controls.Add(Me.TextBox1) + Me.Cursor = System.Windows.Forms.Cursors.Default + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.MaximizeBox = False + Me.Name = "FrmMain" + Me.Text = "Mapo state machine builder" + Me.Panel1.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog + Friend WithEvents CmdExit As System.Windows.Forms.Button + Friend WithEvents Btn_level_inputs As System.Windows.Forms.Button + Friend WithEvents Panel1 As System.Windows.Forms.Panel + Friend WithEvents Btn_level_transitions As Button +End Class diff --git a/StateMachine/src/MapoState/MapoState/FrmMain.resx b/StateMachine/src/MapoState/MapoState/FrmMain.resx new file mode 100644 index 0000000..517d841 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/FrmMain.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + AAABAAEAICAAAAEACACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAgAQAAAAAAAAAAAAAAAEAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAMDcwADwyqYAzP//AJn//wBm//8AM///AP/M + /wDMzP8Amcz/AGbM/wAzzP8AAMz/AP+Z/wDMmf8AmZn/AGaZ/wAzmf8AAJn/AP9m/wDMZv8AmWb/AGZm + /wAzZv8AAGb/AP8z/wDMM/8AmTP/AGYz/wAzM/8AADP/AMwA/wCZAP8AZgD/ADMA/wD//8wAzP/MAJn/ + zABm/8wAZv/MADP/zAAA/8wA/8zMAMzMzACZzMwAZszMADPMzAAAzMwA/5nMAMyZzACZmcwAZpnMADOZ + zAAAmcwA/2bMAMxmzACZZswAZmbMADNmzAAAZswA/zPMAMwzzACZM8wAZjPMADMzzAAAM8wA/wDMAMwA + zACZAMwAZgDMADMAzAAAAMwA//+ZAMz/mQCZ/5kAZv+ZADP/mQAA/5kA/8yZAMzMmQCZzJkAZsyZADPM + mQAAzJkA/5mZAMyZmQCZmZkAZpmZADOZmQAAmZkA/2aZAMxmmQCZZpkAZmaZADNmmQAAZpkA/zOZAMwz + mQCZM5kAZjOZADMzmQAAM5kA/wCZAMwAmQCZAJkAZgCZADMAmQAAAJkA//9mAMz/ZgCZ/2YAZv9mADP/ + ZgAA/2YA/8xmAMzMZgCZzGYAZsxmADPMZgAAzGYA/5lmAMyZZgCZmWYAZplmADOZZgAAmWYA/2ZmAMxm + ZgCZZmYAZmZmADNmZgAAZmYA/zNmAMwzZgCZM2YAZjNmADMzZgAAM2YA/wBmAMwAZgCZAGYAZgBmADMA + ZgAAAGYA//8zAMz/MwCZ/zMAZv8zADP/MwAA/zMA/8wzAMzMMwCZzDMAZswzADPMMwAAzDMA/5kzAMyZ + MwCZmTMAZpkzADOZMwAAmTMA/2YzAMxmMwCZZjMAZmYzADNmMwAAZjMA/zMzAMwzMwCZMzMAZjMzADMz + MwAAMzMA/wAzAMwAMwCZADMAZgAzADMAMwAAADMAzP8AAJn/AABm/wAAM/8AAP/MAADMzAAAmcwAAGbM + AAAzzAAAAMwAAP+ZAADMmQAAmZkAAGaZAAAzmQAAAJkAAP9mAADMZgAAmWYAAGZmAAAAZgAAM2YAAP8z + AADMMwAAmTMAAGYzAAAzMwAAADMAAMwAAACZAAAAZgAAADMAAAAAAN0AAAC7AAAAqgAAAIgAAAB3AAAA + VQAAAEQAAAAiAADdAAAAuwAAAKoAAACIAAAAdwAAAFUAAABEAAAAIgAA3d3dAFVVVQB3d3cAd3d3AERE + RAAiIiIAERERAHcAAABVAAAARAAAACIAAADw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8AAAAAAAAAAAAA7Ozs7Ozs7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7OwAAAAAAAAA7OwAAAAA + AAAAAAAAAAAAAAAAAAAAAOwAADo6OmRkj48A7OwAAAAAAAAAAAAAAAAAAAAAAOzsADo6Ojo6ZGRkj48A + 7AAAAAAAAAAAAAAAAAAAAADsAAA6Ojr/EBAQEBAQjwDs7AAAAAAAAAAAAAAAAAAA7AAQELM6/xAQEBAQ + 7BAQEADsAAAAAAAAAAAAAAAAAOwAEBAQEP8QEBAQEPjw//8QAOwAAAAAAAAAAAAAAAAAABAQ////EBAQ + EBAQ+PgK9xAA7AAAAAAAAAAAAAAAAOwA//8KChAQEBAQEBAQ/////xAA7AAAAAAAAAAAAAAAAP8KCgoQ + EBAQEBD/7P//Cvf/EADsAAAAAAAAAAAAAAAA/woKChAQEBD/+PjsiP////cQAOzs7AAAAAAAAAAAAAD/ + CgoKEBAQ+Pjs7IgHCgr3ChCPAADs7OwAAAAAAAAAAP8KCgoQEP//7IgH/wr3/////xCPZAAA7OwAAAAA + AAAA/woKChAQ//8H//8K9/8K/////xAQOmQA7AAAAAAAAAAA/woKEBD/////Cvf/Cvf/Cv//////EADs + AAAAAAAAAAAACgoQEBAQ/////wr3/wr3////AAD/AOwAAAAAAAAAAAAA/xAQEBAQEBD/Mv8K9/8AEAAA + AAAAAAAAAAAAAAAAAAAAAAoKChAQEBD/CvcAAOGQ7OwAAAAAAAAAAAAAAAAAAAAAAAAAChAQEP//AOHh + +OGQ7AAAAAAAAAAAAAAAAAAAAAAAAAAA/xAQEP//APjh+OHs7AAAAAAAAAAAAAAAAAAAAAAAAAAA/xAQ + EBAAAPjh+ADs7AAAAAAAAAAAAAAAAAAAAAAAAAD/EBAQAOwAAPjh4QDs7AAAAAAAAAAAAAAAAAAAAAAA + AAD/EBAA7AAAAOHhiADsAAAAAAAAAAAAAAAAAAAAAAAAAAoQEI8A7AAAAIjh4ezsAAAAAAAAAAAAAAAA + AAAAAAAAAAoKCgDsAAAAAOHhAOzsAAAAAAAAAAAAAAAAAAAAAAAAAAAA7AAAAAAAAOHhAOzs7OwAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAOHhAAAAAOwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOEAQUEA + 7OwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhBQUEA7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ABgYQUEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIgHAAAYGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAACIiAAAAP+A///+AD///AAf//AAH//gAA//wAAP/4AAD/+AAA//AAAH/wAAB/8AAAH/AAAAfwAA + AD8AAAA/gAAAP8AAAD/gAAZ/8AAD//wAA///gAH//8AA///AQH//4GB//+AwP//wOB//+HwD///+Af// + /wD///+A////wP///4D////h + + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoState/FrmMain.vb b/StateMachine/src/MapoState/MapoState/FrmMain.vb new file mode 100644 index 0000000..fdf31de --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/FrmMain.vb @@ -0,0 +1,134 @@ +Imports System.IO + +Public Class FrmMain + + + + Public sz_import_file_name As String + + + + Public Sub New() + + ' This call is required by the Windows Form Designer. + InitializeComponent() + + ' Add any initialization after the InitializeComponent() call. + + ' Call My_initialize() NO !!! dà errore di ricursione sui componenti del form !!!!!!!!!!!!!!!!!!!!!!!!! + + + End Sub + + Private Sub My_initialize() Handles Me.Load + + Call L_my_convert.Init() + + ' read ini file & init global variables + Call IniRead.Ini_read() + + ' read messages + Call Message.init() + + ' inizializzazione variabili + Call Init_Var() + + ' richiamo funzione che inizializza grafica e messaggi + Call InitAspect() + + + End Sub + + Sub Init_Var() + + sz_import_file_name = IniRead.sz_program_path & "\" + + + With OpenFileDialog1 + .Reset() + .InitialDirectory = IniRead.sz_default_rul_filename + + .AddExtension = True + + ' Check to ensure that the selected file exists. Dialog box displays + + .CheckFileExists = True + .CheckPathExists = True + .DefaultExt = "rul" + .DereferenceLinks = True + .Filter = _ + "RUL files (*.rul)|*.rul|All files|*.*" + .Multiselect = False + .RestoreDirectory = True + .ShowHelp = True + .ShowReadOnly = False + .ReadOnlyChecked = False + .Title = "Select an RUL file to open" + .ValidateNames = True + End With + + + End Sub + + Sub Ask_file() + + Try + With OpenFileDialog1 + + If .ShowDialog() = Windows.Forms.DialogResult.OK Then + ' You have a choice here. You can either use the FileName or FileNames properties to get the name + ' you selected, or you can use the OpenFile method to open the file as a read-only Stream. + ' lstFiles.DataSource = .FileNames + + sz_import_file_name = .FileName + ' You could also write code like this, to loop through the selected file names: + 'Dim strName As String + 'For Each strName In .FileNames + ' lstFiles.Items.Add(strName) + 'Next + + Else + sz_import_file_name = "" + End If + + End With + Catch ex As Exception + MsgBox(ex.Message, MsgBoxStyle.Exclamation, Me.Text) + End Try + + End Sub + + + Sub ToDo() + + ' DONE + + End Sub + + Private Sub CmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdExit.Click + + Application.Exit() + + End Sub + + Private Sub Btn_level_inputs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_level_inputs.Click + + Call Ask_file() + + actual_level = LEVELS.LIVELLO_INGRESSI + + If sz_import_file_name <> "" Then Call M_files.Read_rule_file(sz_import_file_name) + + End Sub + + Private Sub Btn_level_transitions_Click(sender As Object, e As EventArgs) Handles Btn_level_transitions.Click + + Call Ask_file() + + actual_level = LEVELS.LIVELLO_TRANSIZIONI + + If sz_import_file_name <> "" Then Call M_transitions.Read_rule_file_transitions(sz_import_file_name) + + End Sub + +End Class diff --git a/StateMachine/src/MapoState/MapoState/Icone/strato_bianca.ico b/StateMachine/src/MapoState/MapoState/Icone/strato_bianca.ico new file mode 100644 index 0000000..2d0948b Binary files /dev/null and b/StateMachine/src/MapoState/MapoState/Icone/strato_bianca.ico differ diff --git a/StateMachine/src/MapoState/MapoState/MapoState.vbproj b/StateMachine/src/MapoState/MapoState/MapoState.vbproj new file mode 100644 index 0000000..a01bb2c --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/MapoState.vbproj @@ -0,0 +1,186 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {492396EA-9B89-4318-879A-2DD7D0DBD1DD} + WinExe + MapoState.My.MyApplication + MapoState + MapoState + 512 + WindowsForms + v3.5 + On + Binary + Off + On + + + false + + + + + 3.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + true + true + .\ + MapoState.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355 + + + pdbonly + false + true + true + bin\Release\ + MapoState.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355 + + + + + + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + Form + + + FrmMain.vb + Form + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + FrmMain.vb + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoState/MapoState.xml b/StateMachine/src/MapoState/MapoState/MapoState.xml new file mode 100644 index 0000000..99b7f8e --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/MapoState.xml @@ -0,0 +1,313 @@ + + + + +MapoState + + + + + + The INIReader class can read keys from and write keys to an INI file. + + + This class uses several Win32 API functions to read from and write to INI files. It will not work on Linux or FreeBSD. + + + + + The GetPrivateProfileInt function retrieves an integer associated with a key in the specified section of an initialization file. + + Pointer to a null-terminated string specifying the name of the section in the initialization file. + Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt function converts the string into an integer and returns the integer. + Specifies the default value to return if the key name cannot be found in the initialization file. + Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. + The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero. + + + + The WritePrivateProfileString function copies a string into the specified section of an initialization file. + + Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters. + Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted. + Pointer to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted. + Pointer to a null-terminated string that specifies the name of the initialization file. + If the function successfully copies the string to the initialization file, the return value is nonzero; if the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero. + + + + The GetPrivateProfileString function retrieves a string from the specified section in an initialization file. + + Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer. + Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter. + Pointer to a null-terminated default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. This parameter cannot be NULL.
Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.
+ Pointer to the buffer that receives the retrieved string. + Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter. + Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. + The return value is the number of characters copied to the buffer, not including the terminating null character. +
+ + + The GetPrivateProfileSectionNames function retrieves the names of all sections in an initialization file. + + Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character. + Specifies the size, in TCHARs, of the buffer pointed to by the lpszReturnBuffer parameter. + Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. + The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the length specified by nSize minus two. + + + + The WritePrivateProfileSection function replaces the keys and values for the specified section in an initialization file. + + Pointer to a null-terminated string specifying the name of the section in which data is written. This section name is typically the name of the calling application. + Pointer to a buffer containing the new key names and associated values that are to be written to the named section. + Pointer to a null-terminated string containing the name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory. The function does not create a file if lpFileName contains the full path and file name of a file that does not exist. + If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
+
+ + Constructs a new IniReader instance. + Specifies the full path to the INI file (the file doesn't have to exist). + + + Gets or sets the full path to the INI file. + A String representing the full path to the INI file. + + + + Gets or sets the section you're working in. (aka 'the active section') + A String representing the section you're working in. + + + + Reads an Integer from the specified key of the specified section. + The section to search in. + The key from which to return the value. + The value to return if the specified key isn't found. + Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + + Reads an Integer from the specified key of the specified section. + The section to search in. + The key from which to return the value. + Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file. + + + Reads an Integer from the specified key of the active section. + The key from which to return the value. + The section to search in. + Returns the value of the specified Key, or returns the default value if the specified Key isn't found in the active section of the INI file. + + + Reads an Integer from the specified key of the active section. + The key from which to return the value. + Returns the value of the specified key, or returns 0 if the specified key isn't found in the active section of the INI file. + + + Reads a String from the specified key of the specified section. + The section to search in. + The key from which to return the value. + The value to return if the specified key isn't found. + Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + + Reads a String from the specified key of the specified section. + The section to search in. + The key from which to return the value. + Returns the value of the specified section/key pair, or returns an empty String if the specified section/key pair isn't found in the INI file. + + + Reads a String from the specified key of the active section. + The key from which to return the value. + Returns the value of the specified key, or returns an empty String if the specified key isn't found in the active section of the INI file. + + + Reads a Long from the specified key of the specified section. + The section to search in. + The key from which to return the value. + The value to return if the specified key isn't found. + Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + + Reads a Long from the specified key of the specified section. + The section to search in. + The key from which to return the value. + Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file. + + + Reads a Long from the specified key of the active section. + The key from which to return the value. + The section to search in. + Returns the value of the specified key, or returns the default value if the specified key isn't found in the active section of the INI file. + + + Reads a Long from the specified key of the active section. + The key from which to return the value. + Returns the value of the specified Key, or returns 0 if the specified Key isn't found in the active section of the INI file. + + + Reads a Byte array from the specified key of the specified section. + The section to search in. + The key from which to return the value. + Returns the value of the specified section/key pair, or returns null (Nothing in VB.NET) if the specified section/key pair isn't found in the INI file. + + + Reads a Byte array from the specified key of the active section. + The key from which to return the value. + Returns the value of the specified key, or returns null (Nothing in VB.NET) if the specified key pair isn't found in the active section of the INI file. + + + Reads a Boolean from the specified key of the specified section. + The section to search in. + The key from which to return the value. + The value to return if the specified key isn't found. + Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + + Reads a Boolean from the specified key of the specified section. + The section to search in. + The key from which to return the value. + Returns the value of the specified section/key pair, or returns false if the specified section/key pair isn't found in the INI file. + + + Reads a Boolean from the specified key of the specified section. + The key from which to return the value. + The value to return if the specified key isn't found. + Returns the value of the specified key pair, or returns the default value if the specified key isn't found in the active section of the INI file. + + + Reads a Boolean from the specified key of the specified section. + The key from which to return the value. + Returns the value of the specified key, or returns false if the specified key isn't found in the active section of the INI file. + + + Writes an Integer to the specified key in the specified section. + The section to write in. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes an Integer to the specified key in the active section. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a String to the specified key in the specified section. + Specifies the section to write in. + Specifies the key to write to. + Specifies the value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a String to the specified key in the active section. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a Long to the specified key in the specified section. + The section to write in. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a Long to the specified key in the active section. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a Byte array to the specified key in the specified section. + The section to write in. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a Byte array to the specified key in the active section. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a Byte array to the specified key in the specified section. + The section to write in. + The key to write to. + The value to write. + An offset in value. + The number of elements of value to convert. + Returns true if the function succeeds, false otherwise. + + + Writes a Boolean to the specified key in the specified section. + The section to write in. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Writes a Boolean to the specified key in the active section. + The key to write to. + The value to write. + Returns true if the function succeeds, false otherwise. + + + Deletes a key from the specified section. + The section to delete from. + The key to delete. + Returns true if the function succeeds, false otherwise. + + + Deletes a key from the active section. + The key to delete. + Returns true if the function succeeds, false otherwise. + + + + Deletes a section from an INI file. + The section to delete. + Returns true if the function succeeds, false otherwise. + + + + Retrieves a list of all available sections in the INI file. + + + Returns an ArrayList with all available sections. + + + + + Holds the full path to the INI file. + + + + + Holds the active section name + + + + + The maximum number of bytes in a section buffer. + + + + + Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + + + + + Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. + + + + + Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le + ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. + + +
+
diff --git a/StateMachine/src/MapoState/MapoState/Module/General.vb b/StateMachine/src/MapoState/MapoState/Module/General.vb new file mode 100644 index 0000000..8b5b355 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/General.vb @@ -0,0 +1,72 @@ +Imports System.Text.RegularExpressions + +' ---------------------------------------------------------------------------------------------------------- +' Modulo utilizzato per dichiarazioni variabili globali e funzioni comuni al progetto +' ---------------------------------------------------------------------------------------------------------- + +Module General + +#Region "COSTANTI GLOBALI" + + Public Const EPSILON = 0.05 + +#End Region + +#Region "OGGETTI" + +#End Region + +#Region "STRUTTURE" + + Public Structure Rule + Public state As String + Public expression As String + Public next_state As String + Public event_to_send As String + End Structure + + Public Enum LEVELS As Short + LIVELLO_INGRESSI = 1 + LIVELLO_TRANSIZIONI = 2 + End Enum + +#End Region + +#Region "VARIABILI GLOBALI" + + Public States As New List(Of String) + Public Bits As New List(Of String) + Public Events_to_send As New List(Of String) + Public Rules As New List(Of Rule) + + Public sz_state_machine_name As String + Public n_state_machine_index As Int16 + Public n_states As Int16 + Public n_bits As Int16 + + Public actual_level As LEVELS + Public read_level As LEVELS = LEVELS.LIVELLO_INGRESSI + + +#End Region + +#Region "PROCEDURE E FUNZIONI GLOBALI" + + + ' --------------------------------------------------------------------------------------------------- + ' --------- Procedura utilizzata per Cambiare messaggi della finestra principale -------------------- + ' --------------------------------------------------------------------------------------------------- + Public Sub InitAspect() + + FrmMain.Btn_level_inputs.Text = Message.Msg(21) ' livello 1 + + FrmMain.Btn_level_transitions.Text = Message.Msg(24) ' livello 2 + + FrmMain.CmdExit.Text = Message.Msg(23) ' Exit + + + End Sub + +#End Region + +End Module diff --git a/StateMachine/src/MapoState/MapoState/Module/IniRead.vb b/StateMachine/src/MapoState/MapoState/Module/IniRead.vb new file mode 100644 index 0000000..b4ed589 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/IniRead.vb @@ -0,0 +1,77 @@ +Public Module IniRead + + Public Const OVERWRITE As Boolean = True + Public Const APPEND As Boolean = True + Public Const DO_NOT_APPEND As Boolean = False + + Public sz_program_path As String + Public sz_temporary_path As String + Public sz_allowed_extension As String + + Public b_debug As Boolean + Public b_verbose As Boolean + + Public b_offline_mode As Boolean = False + + Public b_log_enabled As Boolean + Public szLogFileName As String + + + Public lTimerInterval As Long + + Public sz_default_rul_filename As String ' default rul file + Public sz_file_init_inputs As String + Public sz_file_init_transitions As String + + + + Sub Ini_read() + + Dim ini As New IniReader(Application.StartupPath & "\config\" & Application.ProductName & ".ini") + + ini.Section = "General" '----------------------------------------------------- + + sz_program_path = clear_ending_bar(ini.ReadString("Program path")) + sz_temporary_path = clear_ending_bar(ini.ReadString("temp path")) + sz_allowed_extension = clear_starting_point(ini.ReadString(ini.Section, "ext", "").ToUpper) + + + lTimerInterval = ini.ReadLong("timer", 1000) + + b_offline_mode = ini.ReadBoolean("offline mode", False) + + + ini.Section = "Debug" '----------------------------------------------------- + + b_debug = ini.ReadBoolean("debug", False) + b_verbose = ini.ReadBoolean("verbose", False) + + ini.Section = "Log" '----------------------------------------------------- + + b_log_enabled = ini.ReadBoolean("enabled", False) + szLogFileName = ini.ReadString("Log file") + + + ini.Section = "RUL" '----------------------------------------------------- + + sz_default_rul_filename = ini.ReadString("default") + + sz_file_init_inputs = ini.ReadString("inputs") + sz_file_init_transitions = ini.ReadString("transitions") + + End Sub + + Public Function HexToStr(ByVal Data As String) As String + Dim com As String = "" + For x = 0 To Data.Length - 1 Step 2 + com &= ChrW(CInt("&H" & Data.Substring(x, 2))) + Next + Return com + End Function + +#Region "fuffa" + + +#End Region + +End Module diff --git a/StateMachine/src/MapoState/MapoState/Module/IniReader.vb b/StateMachine/src/MapoState/MapoState/Module/IniReader.vb new file mode 100644 index 0000000..e053c6e --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/IniReader.vb @@ -0,0 +1,454 @@ +' +' IniReader class + +Imports System +Imports System.Text +Imports System.Collections +Imports System.Runtime.InteropServices +Imports Microsoft.VisualBasic + + + ''' + ''' The INIReader class can read keys from and write keys to an INI file. + ''' + ''' + ''' This class uses several Win32 API functions to read from and write to INI files. It will not work on Linux or FreeBSD. + ''' + + Public Class IniReader + + ''' + ''' The GetPrivateProfileInt function retrieves an integer associated with a key in the specified section of an initialization file. + ''' + ''' Pointer to a null-terminated string specifying the name of the section in the initialization file. + ''' Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt function converts the string into an integer and returns the integer. + ''' Specifies the default value to return if the key name cannot be found in the initialization file. + ''' Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. + ''' The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero. + + Private Declare Ansi Function GetPrivateProfileInt Lib "kernel32.dll" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer + + ''' + ''' The WritePrivateProfileString function copies a string into the specified section of an initialization file. + ''' + ''' Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters. + ''' Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted. + ''' Pointer to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted. + ''' Pointer to a null-terminated string that specifies the name of the initialization file. + ''' If the function successfully copies the string to the initialization file, the return value is nonzero; if the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero. + + Private Declare Ansi Function WritePrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer + + ''' + ''' The GetPrivateProfileString function retrieves a string from the specified section in an initialization file. + ''' + ''' Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer. + ''' Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter. + ''' Pointer to a null-terminated default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. This parameter cannot be NULL.
Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.
+ ''' Pointer to the buffer that receives the retrieved string. + ''' Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter. + ''' Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. + ''' The return value is the number of characters copied to the buffer, not including the terminating null character. + + Private Declare Ansi Function GetPrivateProfileString Lib "kernel32.dll" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer + + ''' + ''' The GetPrivateProfileSectionNames function retrieves the names of all sections in an initialization file. + ''' + ''' Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character. + ''' Specifies the size, in TCHARs, of the buffer pointed to by the lpszReturnBuffer parameter. + ''' Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. + ''' The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the length specified by nSize minus two. + + Private Declare Ansi Function GetPrivateProfileSectionNames Lib "kernel32" Alias "GetPrivateProfileSectionNamesA" (ByVal lpszReturnBuffer() As Byte, ByVal nSize As Integer, ByVal lpFileName As String) As Integer + + ''' + ''' The WritePrivateProfileSection function replaces the keys and values for the specified section in an initialization file. + ''' + ''' Pointer to a null-terminated string specifying the name of the section in which data is written. This section name is typically the name of the calling application. + ''' Pointer to a buffer containing the new key names and associated values that are to be written to the named section. + ''' Pointer to a null-terminated string containing the name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory. The function does not create a file if lpFileName contains the full path and file name of a file that does not exist. + ''' If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
+ + Private Declare Ansi Function WritePrivateProfileSection Lib "kernel32.dll" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer + + ''' Constructs a new IniReader instance. + ''' Specifies the full path to the INI file (the file doesn't have to exist). + + Public Sub New(ByVal file As String) + Filename = file + End Sub + + ''' Gets or sets the full path to the INI file. + ''' A String representing the full path to the INI file. + ''' + + Public Property Filename() As String + Get + Return m_Filename + End Get + Set(ByVal Value As String) + m_Filename = Value + End Set + End Property + + ''' Gets or sets the section you're working in. (aka 'the active section') + ''' A String representing the section you're working in. + ''' + + Public Property Section() As String + Get + Return m_Section + End Get + Set(ByVal Value As String) + m_Section = Value + End Set + End Property + + ''' Reads an Integer from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' The value to return if the specified key isn't found. + ''' Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + Public Function ReadInteger(ByVal section As String, ByVal key As String, ByVal defVal As Integer) As Integer + Return GetPrivateProfileInt(section, key, defVal, Filename) + End Function + + ''' Reads an Integer from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file. + + Public Function ReadInteger(ByVal section As String, ByVal key As String) As Integer + Return ReadInteger(section, key, 0) + End Function + + ''' Reads an Integer from the specified key of the active section. + ''' The key from which to return the value. + ''' The section to search in. + ''' Returns the value of the specified Key, or returns the default value if the specified Key isn't found in the active section of the INI file. + + Public Function ReadInteger(ByVal key As String, ByVal defVal As Integer) As Integer + Return ReadInteger(Section, key, defVal) + End Function + + ''' Reads an Integer from the specified key of the active section. + ''' The key from which to return the value. + ''' Returns the value of the specified key, or returns 0 if the specified key isn't found in the active section of the INI file. + + Public Function ReadInteger(ByVal key As String) As Integer + Return ReadInteger(key, 0) + End Function + + ''' Reads a String from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' The value to return if the specified key isn't found. + ''' Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + Public Function ReadString(ByVal section As String, ByVal key As String, ByVal defVal As String) As String + Dim sb As New StringBuilder(MAX_ENTRY) + Dim Ret As Integer = GetPrivateProfileString(section, key, defVal, sb, MAX_ENTRY, Filename) + Return sb.ToString() + End Function + + ''' Reads a String from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' Returns the value of the specified section/key pair, or returns an empty String if the specified section/key pair isn't found in the INI file. + + Public Function ReadString(ByVal section As String, ByVal key As String) As String + Return ReadString(section, key, "") + End Function + + ''' Reads a String from the specified key of the active section. + ''' The key from which to return the value. + ''' Returns the value of the specified key, or returns an empty String if the specified key isn't found in the active section of the INI file. + + Public Function ReadString(ByVal key As String) As String + Return ReadString(Section, key) + End Function + + ''' Reads a Long from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' The value to return if the specified key isn't found. + ''' Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + Public Function ReadLong(ByVal section As String, ByVal key As String, ByVal defVal As Long) As Long + Return Long.Parse(ReadString(section, key, defVal.ToString())) + End Function + + ''' Reads a Long from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file. + + Public Function ReadLong(ByVal section As String, ByVal key As String) As Long + Return ReadLong(section, key, 0) + End Function + + ''' Reads a Long from the specified key of the active section. + ''' The key from which to return the value. + ''' The section to search in. + ''' Returns the value of the specified key, or returns the default value if the specified key isn't found in the active section of the INI file. + + Public Function ReadLong(ByVal key As String, ByVal defVal As Long) As Long + Return ReadLong(Section, key, defVal) + End Function + + ''' Reads a Long from the specified key of the active section. + ''' The key from which to return the value. + ''' Returns the value of the specified Key, or returns 0 if the specified Key isn't found in the active section of the INI file. + + Public Function ReadLong(ByVal key As String) As Long + Return ReadLong(key, 0) + End Function + + ''' Reads a Byte array from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' Returns the value of the specified section/key pair, or returns null (Nothing in VB.NET) if the specified section/key pair isn't found in the INI file. + + Public Function ReadByteArray(ByVal section As String, ByVal key As String) As Byte() + Try + Return Convert.FromBase64String(ReadString(section, key)) + Catch + End Try + Return Nothing + End Function + + ''' Reads a Byte array from the specified key of the active section. + ''' The key from which to return the value. + ''' Returns the value of the specified key, or returns null (Nothing in VB.NET) if the specified key pair isn't found in the active section of the INI file. + + Public Function ReadByteArray(ByVal key As String) As Byte() + Return ReadByteArray(Section, key) + End Function + + ''' Reads a Boolean from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' The value to return if the specified key isn't found. + ''' Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file. + + Public Function ReadBoolean(ByVal section As String, ByVal key As String, ByVal defVal As Boolean) As Boolean + + Dim b_ret As Boolean = False + + Try + b_ret = Boolean.Parse(ReadString(section, key, defVal.ToString())) + Catch + b_ret = False + End Try + Return b_ret + End Function + + ''' Reads a Boolean from the specified key of the specified section. + ''' The section to search in. + ''' The key from which to return the value. + ''' Returns the value of the specified section/key pair, or returns false if the specified section/key pair isn't found in the INI file. + + Public Function ReadBoolean(ByVal section As String, ByVal key As String) As Boolean + Return ReadBoolean(section, key, False) + End Function + + ''' Reads a Boolean from the specified key of the specified section. + ''' The key from which to return the value. + ''' The value to return if the specified key isn't found. + ''' Returns the value of the specified key pair, or returns the default value if the specified key isn't found in the active section of the INI file. + + Public Function ReadBoolean(ByVal key As String, ByVal defVal As Boolean) As Boolean + Return ReadBoolean(Section, key, defVal) + End Function + + ''' Reads a Boolean from the specified key of the specified section. + ''' The key from which to return the value. + ''' Returns the value of the specified key, or returns false if the specified key isn't found in the active section of the INI file. + + Public Function ReadBoolean(ByVal key As String) As Boolean + Return ReadBoolean(Section, key) + End Function + + ''' Writes an Integer to the specified key in the specified section. + ''' The section to write in. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal section As String, ByVal key As String, ByVal value As Integer) As Boolean + Return Write(section, key, value.ToString()) + End Function + + ''' Writes an Integer to the specified key in the active section. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal key As String, ByVal value As Integer) As Boolean + Return Write(Section, key, value) + End Function + + ''' Writes a String to the specified key in the specified section. + ''' Specifies the section to write in. + ''' Specifies the key to write to. + ''' Specifies the value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal section As String, ByVal key As String, ByVal value As String) As Boolean + Return (WritePrivateProfileString(section, key, value, Filename) <> 0) + End Function + + ''' Writes a String to the specified key in the active section. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal key As String, ByVal value As String) As Boolean + Return Write(Section, key, value) + End Function + + ''' Writes a Long to the specified key in the specified section. + ''' The section to write in. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal section As String, ByVal key As String, ByVal value As Long) As Boolean + Return Write(section, key, value.ToString()) + End Function + + ''' Writes a Long to the specified key in the active section. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal key As String, ByVal value As Long) As Boolean + Return Write(Section, key, value) + End Function + + ''' Writes a Byte array to the specified key in the specified section. + ''' The section to write in. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal section As String, ByVal key As String, ByVal value() As Byte) As Boolean + If value Is Nothing Then + Return Write(section, key, CType(Nothing, String)) + Else + Return Write(section, key, value, 0, value.Length) + End If + End Function + + ''' Writes a Byte array to the specified key in the active section. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal key As String, ByVal value() As Byte) As Boolean + Return Write(Section, key, value) + End Function + + ''' Writes a Byte array to the specified key in the specified section. + ''' The section to write in. + ''' The key to write to. + ''' The value to write. + ''' An offset in value. + ''' The number of elements of value to convert. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal section As String, ByVal key As String, ByVal value() As Byte, ByVal offset As Integer, ByVal length As Integer) As Boolean + If value Is Nothing Then + Return Write(section, key, CType(Nothing, String)) + Else + Return Write(section, key, Convert.ToBase64String(value, offset, length)) + End If + End Function + + ''' Writes a Boolean to the specified key in the specified section. + ''' The section to write in. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal section As String, ByVal key As String, ByVal value As Boolean) As Boolean + Return Write(section, key, value.ToString()) + End Function + + ''' Writes a Boolean to the specified key in the active section. + ''' The key to write to. + ''' The value to write. + ''' Returns true if the function succeeds, false otherwise. + + Public Function Write(ByVal key As String, ByVal value As Boolean) As Boolean + Return Write(Section, key, value) + End Function + + ''' Deletes a key from the specified section. + ''' The section to delete from. + ''' The key to delete. + ''' Returns true if the function succeeds, false otherwise. + + Public Function DeleteKey(ByVal section As String, ByVal key As String) As Boolean + Return (WritePrivateProfileString(section, key, Nothing, Filename) <> 0) + End Function + + ''' Deletes a key from the active section. + ''' The key to delete. + ''' Returns true if the function succeeds, false otherwise. + ''' + + Public Function DeleteKey(ByVal key As String) As Boolean + Return (WritePrivateProfileString(Section, key, Nothing, Filename) <> 0) + End Function + + ''' Deletes a section from an INI file. + ''' The section to delete. + ''' Returns true if the function succeeds, false otherwise. + + Public Function DeleteSection(ByVal section As String) As Boolean + Return WritePrivateProfileSection(section, Nothing, Filename) <> 0 + End Function + + ''' + ''' Retrieves a list of all available sections in the INI file. + ''' + ''' + ''' Returns an ArrayList with all available sections. + ''' + + Public Function GetSectionNames() As ArrayList + Try + Dim buffer(MAX_ENTRY) As Byte + GetPrivateProfileSectionNames(buffer, MAX_ENTRY, Filename) + Dim parts() As String = Encoding.ASCII.GetString(buffer).Trim(ControlChars.NullChar).Split(ControlChars.NullChar) + Return New ArrayList(parts) + Catch + End Try + Return Nothing + End Function + + 'Private variables and constants + + ''' + ''' Holds the full path to the INI file. + ''' + + Private m_Filename As String + + ''' + ''' Holds the active section name + ''' + + Private m_Section As String + + ''' + ''' The maximum number of bytes in a section buffer. + ''' + + Private Const MAX_ENTRY As Integer = 32768 + + End Class + diff --git a/StateMachine/src/MapoState/MapoState/Module/L_File_aux.vb b/StateMachine/src/MapoState/MapoState/Module/L_File_aux.vb new file mode 100644 index 0000000..48d33cc --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/L_File_aux.vb @@ -0,0 +1,40 @@ +Module L_File_aux + + Function clear_ending_bar(ByVal a As String) As String ' clear the eventual ending "\" in a directory name + a = Trim(a) + If (Right$(a, 1) = "\") Then + a = Left$(a, Len(a) - 1) + End If + clear_ending_bar = a + End Function + + Function clear_starting_point(ByVal a As String) As String ' clear the eventual starting "." in a file ext + a = Trim(a) + If (Left$(a, 1) = ".") Then + a = Right$(a, Len(a) - 1) + End If + clear_starting_point = a + End Function + + Function true_false_from_yes_no(ByVal a As String) As Boolean + a = UCase$(a) + true_false_from_yes_no = False + If InStr(a, "Y") Then true_false_from_yes_no = True + If InStr(a, "S") Then true_false_from_yes_no = True + End Function + + Function clear_starting_forward_bar(ByVal a As String) As String ' clear the eventual initial "/" + a = Trim(a) + If (Left$(a, 1) = "/") Then + a = Right$(a, Len(a) - 1) + End If + clear_starting_forward_bar = a + End Function + + Function trim_to_n_char(ByVal a As String, ByVal n As Integer) As String ' clear the eventual initial "/" + a = Trim(a) + If Len(a) > n Then a = Left$(a, n) + trim_to_n_char = a + End Function + +End Module diff --git a/StateMachine/src/MapoState/MapoState/Module/L_my_convert.vb b/StateMachine/src/MapoState/MapoState/Module/L_my_convert.vb new file mode 100644 index 0000000..935e880 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/L_my_convert.vb @@ -0,0 +1,63 @@ +Module L_my_convert + + Private sz_dec_sep As String, sz_other As String, sz_a As String + + Public Sub Init() + + ' simulates a format , to read the decimal separator character + ' and keep only the first character + ' + sz_a = Format(0.1, ".#") + sz_dec_sep = Left$(sz_a, 1) + + If sz_dec_sep = "." Then + sz_other = "," + Else + sz_other = "." + End If + + End Sub + + Public Function dec_separator() As String + Return sz_dec_sep + End Function + + Public Function other_separator() As String + Return sz_other + End Function + + '--------------------------------------------------------------- + ' my_Cint : non si fa fregare da stringhe vuote + '--------------------------------------------------------------- + Public Function my_CInt(ByVal sz As String) As Integer + + If sz <> "" Then + Try + my_CInt = CInt(Trim(sz)) + Catch + my_CInt = -9998 + End Try + Else + my_CInt = -9999 + End If + + End Function + + '--------------------------------------------------------------- + ' my_CDbl : non si fa fregare da stringhe vuote + '--------------------------------------------------------------- + Public Function my_CDbl(ByVal sz As String) As Double + + If sz <> "" Then + Try + my_CDbl = CDbl(Trim(sz)) + Catch + my_CDbl = -9999998.0 + End Try + Else + my_CDbl = -9999999.0 + End If + + End Function + +End Module diff --git a/StateMachine/src/MapoState/MapoState/Module/M_files.vb b/StateMachine/src/MapoState/MapoState/Module/M_files.vb new file mode 100644 index 0000000..df487b9 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/M_files.vb @@ -0,0 +1,283 @@ +Imports System.IO + +Module M_files + +#Region "variabili locali" + + Private sz_tokens As String() + + Private objWriter As StreamWriter + + Private sz_file_name As String + +#End Region + +#Region "Strutture" + +#End Region + +#Region "Lettura file regole " + + Sub Read_rule_file(ByVal sz_filename As String) + + Dim sz_TextLine As String, sz_temp As String + Dim temp_rule As Rule, b_rules_definition As Boolean + Dim n_line As Int16 + + n_line = 0 + b_rules_definition = False + + sz_file_name = sz_filename + + If System.IO.File.Exists(sz_filename) = True Then + + Dim objfile As New System.IO.StreamReader(sz_filename) + + Do While objfile.Peek() <> -1 ' finche c'è vita + + sz_TextLine = Trim(objfile.ReadLine()) + n_line = n_line + 1 + + If (Not String.IsNullOrEmpty(sz_TextLine)) Then ' linea vuota o commento ? + + If (Trim(sz_TextLine).Chars(0) <> "#") Then + + If InStr(sz_TextLine, ControlChars.Tab) > 0 Then ' sostituzione dei tab !!!! + + sz_TextLine = sz_TextLine.Replace(ControlChars.Tab, String.Empty) + + End If + + + sz_tokens = sz_TextLine.Split(New Char() {":"c}) ' splitta sui ":" + + sz_temp = Trim(UCase$(Trim(sz_tokens(0)))) ' primo campo + + Select Case sz_temp + + Case "$DEFINITIONS" + b_rules_definition = False + + Case "$NAME" + sz_state_machine_name = UCase$(Trim(sz_tokens(1))) + + Case "$IDX" + n_state_machine_index = my_CInt(Trim(sz_tokens(1))) + + Case "$N_STATES" + n_states = my_CInt(Trim(sz_tokens(1))) + + Case "$N_BITS" + n_bits = my_CInt(Trim(sz_tokens(1))) + + Case "$BIT" + Bits.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$STATE" + States.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$EVENT" + Events_to_send.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$RULES" + b_rules_definition = True + + Case "$DO" + b_rules_definition = False + + Call evaluate() + + Case Else + + If (b_rules_definition) Then + + temp_rule.state = sz_temp + temp_rule.expression = (UCase$(Trim(sz_tokens(1)))) + temp_rule.next_state = (UCase$(Trim(sz_tokens(2)))) + temp_rule.event_to_send = (UCase$(Trim(sz_tokens(3)))) + + Rules.Add(temp_rule) + + Else + MsgBox("bad keyword or no rule on line : " & sz_TextLine, MsgBoxStyle.Critical, "ERROR on line : " & n_line.ToString) + End If + + + End Select + + End If ' commento + End If ' linea vuota + + Loop + + objfile.Close() + + Else + MsgBox(Message.Msg(4), MsgBoxStyle.Critical, sz_filename) ' file non esiste + End If ' file exists + + End Sub + +#End Region + +#Region "scrittura file Mac " + + Sub open_mac_file(ByVal sz_filename As String, sz_init As String) + + Dim sz_temp As String + + Try + + objWriter = New System.IO.StreamWriter(sz_filename) + + sz_temp = sz_init + + objWriter.WriteLine(sz_temp) + + + Catch Ex As Exception + + MsgBox(Ex.Message, MsgBoxStyle.Critical, sz_filename) ' + + End Try + + End Sub + + Sub write_mac_file(ByVal sz_line As String) + + Try + objWriter.WriteLine(sz_line) + Catch Ex As Exception + MsgBox(Ex.Message, MsgBoxStyle.Critical, " output file") ' + End Try + + End Sub + + Sub close_mac_file() + + Try + objWriter.Close() + Catch Ex As Exception + MsgBox(Ex.Message, MsgBoxStyle.Critical, " output file (close)") ' + End Try + + End Sub + +#End Region + +#Region "Evaluate" + + Private Sub evaluate() + + Dim sz_actual_state As String, sz_actual_bit As String, sz_line + + Dim i As Int16, n_input As Int16, n As Int16, n_mask As Int16, n_bit As Int16 + + + Dim b_bit(20) As Boolean, b_invert As Boolean + + FrmMain.TextBox1.Text = "" + + Call open_mac_file(Path.GetDirectoryName(sz_file_name) & "\" & Path.GetFileNameWithoutExtension(sz_file_name) & ".csv", IniRead.sz_file_init_inputs) + + ' ciclo per ogni stato + For i = 0 To n_states - 1 + + sz_actual_state = States(i) + + ' ciclo per ogni ingresso + For n_input = 0 To ((2 ^ n_bits) - 1) + + ' calcolo true false per ogni bit dell' ingresso + n_mask = 1 + For n = 0 To (n_bits - 1) + b_bit(n) = n_input And n_mask + n_mask = n_mask << 1 + Next n + + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + FrmMain.TextBox1.Text = " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + + ' ciclo per ogni regola + For Each act_rule As Rule In Rules + + n_bit = -1 + + ' controllo se la regola attuale vale in questo stato + If ((act_rule.state = "ALL_STATES") Or (act_rule.state = sz_actual_state)) Then + + If (act_rule.state = sz_actual_state) Then + FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf + + End If + + 'recupero il bit in questione + b_invert = False + + sz_actual_bit = act_rule.expression + + If InStr(sz_actual_bit, "NOT") Then ' bit negato ??? + b_invert = True + sz_actual_bit = Trim(sz_actual_bit.Replace("NOT ", "")) + End If ' bit negato + + ' cerca il nome del bit e ne trova l' indice da 0 + n_bit = Bits.FindIndex(Function(bittolo) (sz_actual_bit.Equals(bittolo))) + + If n_bit = -1 Then + + MsgBox("Bit name error - " & sz_actual_bit & vbCrLf & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state, _ + MsgBoxStyle.Critical, _ + "ERROR - bit " & n_bit.ToString & " -- " & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString) + Exit For + End If + + ' vera la espressione ? + + If (((Not b_invert) And b_bit(n_bit)) Or (b_invert And (Not b_bit(n_bit)))) Then + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo del bit " & n_bit.ToString & " - " & Bits(n_bit) + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " ------------->>scatta la regola " & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state & vbCrLf & vbCrLf + sz_line = "" + + If (States.IndexOf(act_rule.next_state) <> i) Then ' andrei allo stesso stato ? + + ' "IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato" + + sz_line = n_state_machine_index.ToString & ";" & _ + i.ToString & ";" & _ + n_input.ToString & ";" & _ + Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & _ + States.IndexOf(act_rule.next_state).ToString() + + Call write_mac_file(sz_line) + + Else + sz_line = "----" & n_state_machine_index.ToString & ";" & _ + i.ToString & ";" & _ + n_input.ToString & ";" & _ + Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & _ + States.IndexOf(act_rule.next_state).ToString() + 'Call write_mac_file(sz_line) + + End If ' andrei allo stesso stato + + Exit For ' esco da questo caso + + End If ' vera la espressione + + End If ' vale la regola + + Next ' ciclo per tutte le regole + + Next n_input ' ciclo per ogni ingresso + + Next i ' ciclo per ogni stato + + Call close_mac_file() + + End Sub +#End Region + +End Module diff --git a/StateMachine/src/MapoState/MapoState/Module/M_transitions.vb b/StateMachine/src/MapoState/MapoState/Module/M_transitions.vb new file mode 100644 index 0000000..59dbfe4 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/M_transitions.vb @@ -0,0 +1,241 @@ +Imports System.IO + +Module M_transitions + +#Region "variabili locali" + + Private sz_tokens As String() + + Private objWriter As StreamWriter + + Private sz_file_name As String + +#End Region + +#Region "Strutture" + +#End Region + +#Region "Lettura file regole " + + Sub Read_rule_file_transitions(ByVal sz_filename As String) + + Dim sz_TextLine As String, sz_temp As String + Dim temp_rule As Rule, b_rules_definition As Boolean + Dim n_line As Int16 + + n_line = 0 + b_rules_definition = False + + sz_file_name = sz_filename + + If System.IO.File.Exists(sz_filename) = True Then + + Dim objfile As New System.IO.StreamReader(sz_filename) + + Do While objfile.Peek() <> -1 ' finche c'è vita + + sz_TextLine = Trim(objfile.ReadLine()) + n_line = n_line + 1 + + If (Not String.IsNullOrEmpty(sz_TextLine)) Then ' linea vuota o commento ? + + If (Trim(sz_TextLine).Chars(0) <> "#") Then + + If InStr(sz_TextLine, ControlChars.Tab) > 0 Then ' sostituzione dei tab !!!! + + sz_TextLine = sz_TextLine.Replace(ControlChars.Tab, String.Empty) + + End If + + + sz_tokens = sz_TextLine.Split(New Char() {":"c}) ' splitta sui ":" + + sz_temp = Trim(UCase$(Trim(sz_tokens(0)))) ' primo campo + + Select Case sz_temp + + Case "$DEFINITIONS" + b_rules_definition = False + + Case "$NAME" + sz_state_machine_name = UCase$(Trim(sz_tokens(1))) + + Case "$IDX" + n_state_machine_index = my_CInt(Trim(sz_tokens(1))) + + Case "$N_STATES" + n_states = my_CInt(Trim(sz_tokens(1))) + + Case "$N_BITS" + n_bits = my_CInt(Trim(sz_tokens(1))) + + Case "$BIT" + Bits.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$STATE" + States.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$EVENT" + Events_to_send.Add(UCase$(Trim(sz_tokens(2)))) + + Case "$RULES" + b_rules_definition = True + + Case "$DO" + b_rules_definition = False + + Call evaluate_transitions() + + Case Else + + If (b_rules_definition) Then + + temp_rule.state = sz_temp + temp_rule.expression = (UCase$(Trim(sz_tokens(1)))) + temp_rule.next_state = (UCase$(Trim(sz_tokens(2)))) + temp_rule.event_to_send = (UCase$(Trim(sz_tokens(3)))) + + Rules.Add(temp_rule) + + Else + MsgBox("bad keyword or no rule on line : " & sz_TextLine, MsgBoxStyle.Critical, "ERROR on line : " & n_line.ToString) + End If + + + End Select + + End If ' commento + End If ' linea vuota + + Loop + + objfile.Close() + + Else + MsgBox(Message.Msg(4), MsgBoxStyle.Critical, sz_filename) ' file non esiste + End If ' file exists + + End Sub + +#End Region + + +#Region "Evaluate" + + Private Sub evaluate_transitions() + + Dim sz_actual_state As String, sz_actual_bit As String, sz_line + + Dim i As Int16, n_input As Int16, n As Int16, n_mask As Int16, n_bit As Int16 + + + Dim b_bit(20) As Boolean, b_invert As Boolean + + FrmMain.TextBox1.Text = "" + + Call open_mac_file(Path.GetDirectoryName(sz_file_name) & "\" & Path.GetFileNameWithoutExtension(sz_file_name) & ".csv", IniRead.sz_file_init_transitions) + + ' ciclo per ogni stato + For i = 0 To n_states - 1 + + sz_actual_state = States(i) + + ' ciclo per ogni ingresso + For n_input = 0 To ((2 ^ n_bits) - 1) + + ' calcolo true false per ogni bit dell' ingresso + n_mask = 1 + For n = 0 To (n_bits - 1) + b_bit(n) = n_input And n_mask + n_mask = n_mask << 1 + Next n + + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + FrmMain.TextBox1.Text = " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + + ' ciclo per ogni regola + For Each act_rule As Rule In Rules + + n_bit = -1 + + ' controllo se la regola attuale vale in questo stato + If ((act_rule.state = "ALL_STATES") Or (act_rule.state = sz_actual_state)) Then + + If (act_rule.state = sz_actual_state) Then + FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString + FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf + + End If + + 'recupero il bit in questione + b_invert = False + + sz_actual_bit = act_rule.expression + + If InStr(sz_actual_bit, "NOT") Then ' bit negato ??? + b_invert = True + sz_actual_bit = Trim(sz_actual_bit.Replace("NOT ", "")) + End If ' bit negato + + ' cerca il nome del bit e ne trova l' indice da 0 + n_bit = Bits.FindIndex(Function(bittolo) (sz_actual_bit.Equals(bittolo))) + + If n_bit = -1 Then + + MsgBox("Bit name error - " & sz_actual_bit & vbCrLf & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state, + MsgBoxStyle.Critical, + "ERROR - bit " & n_bit.ToString & " -- " & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString) + Exit For + End If + + ' vera la espressione ? + + If (((Not b_invert) And b_bit(n_bit)) Or (b_invert And (Not b_bit(n_bit)))) Then + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo del bit " & n_bit.ToString & " - " & Bits(n_bit) + ' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " ------------->>scatta la regola " & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state & vbCrLf & vbCrLf + sz_line = "" + + If (States.IndexOf(act_rule.next_state) <> i) Then ' andrei allo stesso stato ? + + ' "IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato" + + sz_line = n_state_machine_index.ToString & ";" & + i.ToString & ";" & + n_input.ToString & ";" & + Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & + States.IndexOf(act_rule.next_state).ToString() + + Call write_mac_file(sz_line) + + Else + sz_line = "----" & n_state_machine_index.ToString & ";" & + i.ToString & ";" & + n_input.ToString & ";" & + Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & + States.IndexOf(act_rule.next_state).ToString() + 'Call write_mac_file(sz_line) + + End If ' andrei allo stesso stato + + Exit For ' esco da questo caso + + End If ' vera la espressione + + End If ' vale la regola + + Next ' ciclo per tutte le regole + + Next n_input ' ciclo per ogni ingresso + + Next i ' ciclo per ogni stato + + Call close_mac_file() + + End Sub +#End Region + +End Module + + diff --git a/StateMachine/src/MapoState/MapoState/Module/Message.vb b/StateMachine/src/MapoState/MapoState/Module/Message.vb new file mode 100644 index 0000000..03a5ed5 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/Module/Message.vb @@ -0,0 +1,36 @@ +' +' libreria : VBlib +' file : Message +' +' funzioni : gestione messaggi +' +' copyright 2008-2018 C.Viviani +' +Imports System +Imports System.IO +Imports System.IO.File + +Public Module Message + + Public msg() As String + + Sub init() + + Dim sz_filename As String + + sz_filename = Application.StartupPath & "\messages\" & Application.ProductName & ".msg" + + If File.Exists(sz_filename) Then ' + Try + msg = System.IO.File.ReadAllLines(sz_filename) + Catch e As Exception + MsgBox(e.Message, MsgBoxStyle.Critical, "Error !") + End + End Try + Else + MsgBox(" Missing message file :" & vbCrLf & sz_filename, MsgBoxStyle.Critical, "Error 3 :") + End + End If + End Sub + +End Module diff --git a/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb b/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb new file mode 100644 index 0000000..6333807 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' Il codice è stato generato da uno strumento. +' Versione runtime:4.0.30319.42000 +' +' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se +' il codice viene rigenerato. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTA: il file è generato automaticamente e non può essere modificato direttamente. Per apportare modifiche + ' o se vengono rilevati errori di compilazione nel file, passare a Progettazione progetti + ' (aprire le proprietà del progetto o fare doppio clic sul nodo Progetto in + ' Esplora soluzioni) e apportare le modifiche nella scheda Applicazione. + ' + Partial Friend Class MyApplication + + _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = false + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.MapoState.FrmMain + End Sub + End Class +End Namespace diff --git a/StateMachine/src/MapoState/MapoState/My Project/Application.myapp b/StateMachine/src/MapoState/MapoState/My Project/Application.myapp new file mode 100644 index 0000000..8f84d6b --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + FrmMain + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoState/My Project/AssemblyInfo.vb b/StateMachine/src/MapoState/MapoState/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..2c3e0dd --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/StateMachine/src/MapoState/MapoState/My Project/Resources.Designer.vb b/StateMachine/src/MapoState/MapoState/My Project/Resources.Designer.vb new file mode 100644 index 0000000..36a224c --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' Il codice è stato generato da uno strumento. +' Versione runtime:4.0.30319.42000 +' +' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se +' il codice viene rigenerato. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder. + 'tramite uno strumento quale ResGen o Visual Studio. + 'Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen + 'con l'opzione /str oppure ricompilare il progetto VS. + ''' + ''' Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MapoState.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le + ''' ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/StateMachine/src/MapoState/MapoState/My Project/Resources.resx b/StateMachine/src/MapoState/MapoState/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoState/My Project/Settings.Designer.vb b/StateMachine/src/MapoState/MapoState/My Project/Settings.Designer.vb new file mode 100644 index 0000000..0b5e616 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' Il codice è stato generato da uno strumento. +' Versione runtime:4.0.30319.42000 +' +' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se +' il codice viene rigenerato. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "Funzionalità di salvataggio automatico My.Settings" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.MapoState.My.MySettings + Get + Return Global.MapoState.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/StateMachine/src/MapoState/MapoState/My Project/Settings.settings b/StateMachine/src/MapoState/MapoState/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/StateMachine/src/MapoState/MapoState/messages/MapoState.msg b/StateMachine/src/MapoState/MapoState/messages/MapoState.msg new file mode 100644 index 0000000..b241400 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/messages/MapoState.msg @@ -0,0 +1,51 @@ +(0) - Message file !!!! +(1) +(2) +Attenzione !!! +Il File Non Esiste !! +Dati non salvati : Vuoi salvarli ? +(6) +(7) +(8) +(9) +(10) +(11) +(12) +(13) +(14) +(15) +(16) +(17) +(18) +(19) +(20) +Macchina stati ingressi ( Livello 1 ) + +Esci +Macchina stati transiz. ( Livello 2 ) +(25) +(26) +(27) +(28) +(29) +(30) +(31) +(32) +(33) +(34) +(35) +(36) +(37) +(38) +(39) +(40) +(41) +(42) +(43) +(44) +(45) +(46) +(47) +(48) +(49) +(50) diff --git a/StateMachine/src/MapoState/MapoState/resource/15.csv b/StateMachine/src/MapoState/MapoState/resource/15.csv new file mode 100644 index 0000000..e98a1f0 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/resource/15.csv @@ -0,0 +1,2305 @@ +IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato +15;0;0;14;1 +15;0;1;30;9 +15;0;2;14;1 +15;0;3;30;9 +15;0;4;14;1 +15;0;5;30;9 +15;0;6;14;1 +15;0;7;30;9 +15;0;8;14;1 +15;0;9;30;9 +15;0;10;14;1 +15;0;11;30;9 +15;0;12;14;1 +15;0;13;30;9 +15;0;14;14;1 +15;0;15;30;9 +15;0;16;14;1 +15;0;17;30;9 +15;0;18;14;1 +15;0;19;30;9 +15;0;20;14;1 +15;0;21;30;9 +15;0;22;14;1 +15;0;23;30;9 +15;0;24;14;1 +15;0;25;30;9 +15;0;26;14;1 +15;0;27;30;9 +15;0;28;14;1 +15;0;29;30;9 +15;0;30;14;1 +15;0;31;30;9 +15;0;32;14;1 +15;0;33;30;9 +15;0;34;14;1 +15;0;35;30;9 +15;0;36;14;1 +15;0;37;30;9 +15;0;38;14;1 +15;0;39;30;9 +15;0;40;14;1 +15;0;41;30;9 +15;0;42;14;1 +15;0;43;30;9 +15;0;44;14;1 +15;0;45;30;9 +15;0;46;14;1 +15;0;47;30;9 +15;0;48;14;1 +15;0;49;30;9 +15;0;50;14;1 +15;0;51;30;9 +15;0;52;14;1 +15;0;53;30;9 +15;0;54;14;1 +15;0;55;30;9 +15;0;56;14;1 +15;0;57;30;9 +15;0;58;14;1 +15;0;59;30;9 +15;0;60;14;1 +15;0;61;30;9 +15;0;62;14;1 +15;0;63;30;9 +15;0;64;14;1 +15;0;65;30;9 +15;0;66;14;1 +15;0;67;30;9 +15;0;68;14;1 +15;0;69;30;9 +15;0;70;14;1 +15;0;71;30;9 +15;0;72;14;1 +15;0;73;30;9 +15;0;74;14;1 +15;0;75;30;9 +15;0;76;14;1 +15;0;77;30;9 +15;0;78;14;1 +15;0;79;30;9 +15;0;80;14;1 +15;0;81;30;9 +15;0;82;14;1 +15;0;83;30;9 +15;0;84;14;1 +15;0;85;30;9 +15;0;86;14;1 +15;0;87;30;9 +15;0;88;14;1 +15;0;89;30;9 +15;0;90;14;1 +15;0;91;30;9 +15;0;92;14;1 +15;0;93;30;9 +15;0;94;14;1 +15;0;95;30;9 +15;0;96;14;1 +15;0;97;30;9 +15;0;98;14;1 +15;0;99;30;9 +15;0;100;14;1 +15;0;101;30;9 +15;0;102;14;1 +15;0;103;30;9 +15;0;104;14;1 +15;0;105;30;9 +15;0;106;14;1 +15;0;107;30;9 +15;0;108;14;1 +15;0;109;30;9 +15;0;110;14;1 +15;0;111;30;9 +15;0;112;14;1 +15;0;113;30;9 +15;0;114;14;1 +15;0;115;30;9 +15;0;116;14;1 +15;0;117;30;9 +15;0;118;14;1 +15;0;119;30;9 +15;0;120;14;1 +15;0;121;30;9 +15;0;122;14;1 +15;0;123;30;9 +15;0;124;14;1 +15;0;125;30;9 +15;0;126;14;1 +15;0;127;30;9 +15;0;128;14;1 +15;0;129;15;2 +15;0;130;14;1 +15;0;131;16;3 +15;0;132;14;1 +15;0;133;22;4 +15;0;134;14;1 +15;0;135;22;4 +15;0;136;14;1 +15;0;137;18;5 +15;0;138;14;1 +15;0;139;18;5 +15;0;140;14;1 +15;0;141;18;5 +15;0;142;14;1 +15;0;143;18;5 +15;0;144;14;1 +15;0;145;24;6 +15;0;146;14;1 +15;0;147;24;6 +15;0;148;14;1 +15;0;149;24;6 +15;0;150;14;1 +15;0;151;24;6 +15;0;152;14;1 +15;0;153;24;6 +15;0;154;14;1 +15;0;155;24;6 +15;0;156;14;1 +15;0;157;24;6 +15;0;158;14;1 +15;0;159;24;6 +15;0;160;14;1 +15;0;161;25;7 +15;0;162;14;1 +15;0;163;25;7 +15;0;164;14;1 +15;0;165;25;7 +15;0;166;14;1 +15;0;167;25;7 +15;0;168;14;1 +15;0;169;25;7 +15;0;170;14;1 +15;0;171;25;7 +15;0;172;14;1 +15;0;173;25;7 +15;0;174;14;1 +15;0;175;25;7 +15;0;176;14;1 +15;0;177;24;6 +15;0;178;14;1 +15;0;179;24;6 +15;0;180;14;1 +15;0;181;24;6 +15;0;182;14;1 +15;0;183;24;6 +15;0;184;14;1 +15;0;185;24;6 +15;0;186;14;1 +15;0;187;24;6 +15;0;188;14;1 +15;0;189;24;6 +15;0;190;14;1 +15;0;191;24;6 +15;0;192;14;1 +15;0;193;15;2 +15;0;194;14;1 +15;0;195;16;3 +15;0;196;14;1 +15;0;197;22;4 +15;0;198;14;1 +15;0;199;22;4 +15;0;200;14;1 +15;0;201;18;5 +15;0;202;14;1 +15;0;203;18;5 +15;0;204;14;1 +15;0;205;18;5 +15;0;206;14;1 +15;0;207;18;5 +15;0;208;14;1 +15;0;209;24;6 +15;0;210;14;1 +15;0;211;24;6 +15;0;212;14;1 +15;0;213;24;6 +15;0;214;14;1 +15;0;215;24;6 +15;0;216;14;1 +15;0;217;24;6 +15;0;218;14;1 +15;0;219;24;6 +15;0;220;14;1 +15;0;221;24;6 +15;0;222;14;1 +15;0;223;24;6 +15;0;224;14;1 +15;0;225;25;7 +15;0;226;14;1 +15;0;227;25;7 +15;0;228;14;1 +15;0;229;25;7 +15;0;230;14;1 +15;0;231;25;7 +15;0;232;14;1 +15;0;233;25;7 +15;0;234;14;1 +15;0;235;25;7 +15;0;236;14;1 +15;0;237;25;7 +15;0;238;14;1 +15;0;239;25;7 +15;0;240;14;1 +15;0;241;24;6 +15;0;242;14;1 +15;0;243;24;6 +15;0;244;14;1 +15;0;245;24;6 +15;0;246;14;1 +15;0;247;24;6 +15;0;248;14;1 +15;0;249;24;6 +15;0;250;14;1 +15;0;251;24;6 +15;0;252;14;1 +15;0;253;24;6 +15;0;254;14;1 +15;0;255;24;6 +15;1;1;30;9 +15;1;3;30;9 +15;1;5;30;9 +15;1;7;30;9 +15;1;9;30;9 +15;1;11;30;9 +15;1;13;30;9 +15;1;15;30;9 +15;1;17;30;9 +15;1;19;30;9 +15;1;21;30;9 +15;1;23;30;9 +15;1;25;30;9 +15;1;27;30;9 +15;1;29;30;9 +15;1;31;30;9 +15;1;33;30;9 +15;1;35;30;9 +15;1;37;30;9 +15;1;39;30;9 +15;1;41;30;9 +15;1;43;30;9 +15;1;45;30;9 +15;1;47;30;9 +15;1;49;30;9 +15;1;51;30;9 +15;1;53;30;9 +15;1;55;30;9 +15;1;57;30;9 +15;1;59;30;9 +15;1;61;30;9 +15;1;63;30;9 +15;1;65;30;9 +15;1;67;30;9 +15;1;69;30;9 +15;1;71;30;9 +15;1;73;30;9 +15;1;75;30;9 +15;1;77;30;9 +15;1;79;30;9 +15;1;81;30;9 +15;1;83;30;9 +15;1;85;30;9 +15;1;87;30;9 +15;1;89;30;9 +15;1;91;30;9 +15;1;93;30;9 +15;1;95;30;9 +15;1;97;30;9 +15;1;99;30;9 +15;1;101;30;9 +15;1;103;30;9 +15;1;105;30;9 +15;1;107;30;9 +15;1;109;30;9 +15;1;111;30;9 +15;1;113;30;9 +15;1;115;30;9 +15;1;117;30;9 +15;1;119;30;9 +15;1;121;30;9 +15;1;123;30;9 +15;1;125;30;9 +15;1;127;30;9 +15;1;129;15;2 +15;1;131;16;3 +15;1;133;22;4 +15;1;135;22;4 +15;1;137;18;5 +15;1;139;18;5 +15;1;141;18;5 +15;1;143;18;5 +15;1;145;24;6 +15;1;147;24;6 +15;1;149;24;6 +15;1;151;24;6 +15;1;153;24;6 +15;1;155;24;6 +15;1;157;24;6 +15;1;159;24;6 +15;1;161;25;7 +15;1;163;25;7 +15;1;165;25;7 +15;1;167;25;7 +15;1;169;25;7 +15;1;171;25;7 +15;1;173;25;7 +15;1;175;25;7 +15;1;177;24;6 +15;1;179;24;6 +15;1;181;24;6 +15;1;183;24;6 +15;1;185;24;6 +15;1;187;24;6 +15;1;189;24;6 +15;1;191;24;6 +15;1;193;15;2 +15;1;195;16;3 +15;1;197;22;4 +15;1;199;22;4 +15;1;201;18;5 +15;1;203;18;5 +15;1;205;18;5 +15;1;207;18;5 +15;1;209;24;6 +15;1;211;24;6 +15;1;213;24;6 +15;1;215;24;6 +15;1;217;24;6 +15;1;219;24;6 +15;1;221;24;6 +15;1;223;24;6 +15;1;225;25;7 +15;1;227;25;7 +15;1;229;25;7 +15;1;231;25;7 +15;1;233;25;7 +15;1;235;25;7 +15;1;237;25;7 +15;1;239;25;7 +15;1;241;24;6 +15;1;243;24;6 +15;1;245;24;6 +15;1;247;24;6 +15;1;249;24;6 +15;1;251;24;6 +15;1;253;24;6 +15;1;255;24;6 +15;2;0;14;1 +15;2;1;30;9 +15;2;2;14;1 +15;2;3;30;9 +15;2;4;14;1 +15;2;5;30;9 +15;2;6;14;1 +15;2;7;30;9 +15;2;8;14;1 +15;2;9;30;9 +15;2;10;14;1 +15;2;11;30;9 +15;2;12;14;1 +15;2;13;30;9 +15;2;14;14;1 +15;2;15;30;9 +15;2;16;14;1 +15;2;17;30;9 +15;2;18;14;1 +15;2;19;30;9 +15;2;20;14;1 +15;2;21;30;9 +15;2;22;14;1 +15;2;23;30;9 +15;2;24;14;1 +15;2;25;30;9 +15;2;26;14;1 +15;2;27;30;9 +15;2;28;14;1 +15;2;29;30;9 +15;2;30;14;1 +15;2;31;30;9 +15;2;32;14;1 +15;2;33;30;9 +15;2;34;14;1 +15;2;35;30;9 +15;2;36;14;1 +15;2;37;30;9 +15;2;38;14;1 +15;2;39;30;9 +15;2;40;14;1 +15;2;41;30;9 +15;2;42;14;1 +15;2;43;30;9 +15;2;44;14;1 +15;2;45;30;9 +15;2;46;14;1 +15;2;47;30;9 +15;2;48;14;1 +15;2;49;30;9 +15;2;50;14;1 +15;2;51;30;9 +15;2;52;14;1 +15;2;53;30;9 +15;2;54;14;1 +15;2;55;30;9 +15;2;56;14;1 +15;2;57;30;9 +15;2;58;14;1 +15;2;59;30;9 +15;2;60;14;1 +15;2;61;30;9 +15;2;62;14;1 +15;2;63;30;9 +15;2;64;14;1 +15;2;65;30;9 +15;2;66;14;1 +15;2;67;30;9 +15;2;68;14;1 +15;2;69;30;9 +15;2;70;14;1 +15;2;71;30;9 +15;2;72;14;1 +15;2;73;30;9 +15;2;74;14;1 +15;2;75;30;9 +15;2;76;14;1 +15;2;77;30;9 +15;2;78;14;1 +15;2;79;30;9 +15;2;80;14;1 +15;2;81;30;9 +15;2;82;14;1 +15;2;83;30;9 +15;2;84;14;1 +15;2;85;30;9 +15;2;86;14;1 +15;2;87;30;9 +15;2;88;14;1 +15;2;89;30;9 +15;2;90;14;1 +15;2;91;30;9 +15;2;92;14;1 +15;2;93;30;9 +15;2;94;14;1 +15;2;95;30;9 +15;2;96;14;1 +15;2;97;30;9 +15;2;98;14;1 +15;2;99;30;9 +15;2;100;14;1 +15;2;101;30;9 +15;2;102;14;1 +15;2;103;30;9 +15;2;104;14;1 +15;2;105;30;9 +15;2;106;14;1 +15;2;107;30;9 +15;2;108;14;1 +15;2;109;30;9 +15;2;110;14;1 +15;2;111;30;9 +15;2;112;14;1 +15;2;113;30;9 +15;2;114;14;1 +15;2;115;30;9 +15;2;116;14;1 +15;2;117;30;9 +15;2;118;14;1 +15;2;119;30;9 +15;2;120;14;1 +15;2;121;30;9 +15;2;122;14;1 +15;2;123;30;9 +15;2;124;14;1 +15;2;125;30;9 +15;2;126;14;1 +15;2;127;30;9 +15;2;128;14;1 +15;2;130;14;1 +15;2;131;16;3 +15;2;132;14;1 +15;2;133;22;4 +15;2;134;14;1 +15;2;135;22;4 +15;2;136;14;1 +15;2;137;18;5 +15;2;138;14;1 +15;2;139;18;5 +15;2;140;14;1 +15;2;141;18;5 +15;2;142;14;1 +15;2;143;18;5 +15;2;144;14;1 +15;2;145;24;6 +15;2;146;14;1 +15;2;147;24;6 +15;2;148;14;1 +15;2;149;24;6 +15;2;150;14;1 +15;2;151;24;6 +15;2;152;14;1 +15;2;153;24;6 +15;2;154;14;1 +15;2;155;24;6 +15;2;156;14;1 +15;2;157;24;6 +15;2;158;14;1 +15;2;159;24;6 +15;2;160;14;1 +15;2;161;25;7 +15;2;162;14;1 +15;2;163;25;7 +15;2;164;14;1 +15;2;165;25;7 +15;2;166;14;1 +15;2;167;25;7 +15;2;168;14;1 +15;2;169;25;7 +15;2;170;14;1 +15;2;171;25;7 +15;2;172;14;1 +15;2;173;25;7 +15;2;174;14;1 +15;2;175;25;7 +15;2;176;14;1 +15;2;177;24;6 +15;2;178;14;1 +15;2;179;24;6 +15;2;180;14;1 +15;2;181;24;6 +15;2;182;14;1 +15;2;183;24;6 +15;2;184;14;1 +15;2;185;24;6 +15;2;186;14;1 +15;2;187;24;6 +15;2;188;14;1 +15;2;189;24;6 +15;2;190;14;1 +15;2;191;24;6 +15;2;192;14;1 +15;2;194;14;1 +15;2;195;16;3 +15;2;196;14;1 +15;2;197;22;4 +15;2;198;14;1 +15;2;199;22;4 +15;2;200;14;1 +15;2;201;18;5 +15;2;202;14;1 +15;2;203;18;5 +15;2;204;14;1 +15;2;205;18;5 +15;2;206;14;1 +15;2;207;18;5 +15;2;208;14;1 +15;2;209;24;6 +15;2;210;14;1 +15;2;211;24;6 +15;2;212;14;1 +15;2;213;24;6 +15;2;214;14;1 +15;2;215;24;6 +15;2;216;14;1 +15;2;217;24;6 +15;2;218;14;1 +15;2;219;24;6 +15;2;220;14;1 +15;2;221;24;6 +15;2;222;14;1 +15;2;223;24;6 +15;2;224;14;1 +15;2;225;25;7 +15;2;226;14;1 +15;2;227;25;7 +15;2;228;14;1 +15;2;229;25;7 +15;2;230;14;1 +15;2;231;25;7 +15;2;232;14;1 +15;2;233;25;7 +15;2;234;14;1 +15;2;235;25;7 +15;2;236;14;1 +15;2;237;25;7 +15;2;238;14;1 +15;2;239;25;7 +15;2;240;14;1 +15;2;241;24;6 +15;2;242;14;1 +15;2;243;24;6 +15;2;244;14;1 +15;2;245;24;6 +15;2;246;14;1 +15;2;247;24;6 +15;2;248;14;1 +15;2;249;24;6 +15;2;250;14;1 +15;2;251;24;6 +15;2;252;14;1 +15;2;253;24;6 +15;2;254;14;1 +15;2;255;24;6 +15;3;0;14;1 +15;3;1;30;9 +15;3;2;14;1 +15;3;3;30;9 +15;3;4;14;1 +15;3;5;30;9 +15;3;6;14;1 +15;3;7;30;9 +15;3;8;14;1 +15;3;9;30;9 +15;3;10;14;1 +15;3;11;30;9 +15;3;12;14;1 +15;3;13;30;9 +15;3;14;14;1 +15;3;15;30;9 +15;3;16;14;1 +15;3;17;30;9 +15;3;18;14;1 +15;3;19;30;9 +15;3;20;14;1 +15;3;21;30;9 +15;3;22;14;1 +15;3;23;30;9 +15;3;24;14;1 +15;3;25;30;9 +15;3;26;14;1 +15;3;27;30;9 +15;3;28;14;1 +15;3;29;30;9 +15;3;30;14;1 +15;3;31;30;9 +15;3;32;14;1 +15;3;33;30;9 +15;3;34;14;1 +15;3;35;30;9 +15;3;36;14;1 +15;3;37;30;9 +15;3;38;14;1 +15;3;39;30;9 +15;3;40;14;1 +15;3;41;30;9 +15;3;42;14;1 +15;3;43;30;9 +15;3;44;14;1 +15;3;45;30;9 +15;3;46;14;1 +15;3;47;30;9 +15;3;48;14;1 +15;3;49;30;9 +15;3;50;14;1 +15;3;51;30;9 +15;3;52;14;1 +15;3;53;30;9 +15;3;54;14;1 +15;3;55;30;9 +15;3;56;14;1 +15;3;57;30;9 +15;3;58;14;1 +15;3;59;30;9 +15;3;60;14;1 +15;3;61;30;9 +15;3;62;14;1 +15;3;63;30;9 +15;3;64;14;1 +15;3;65;30;9 +15;3;66;14;1 +15;3;67;30;9 +15;3;68;14;1 +15;3;69;30;9 +15;3;70;14;1 +15;3;71;30;9 +15;3;72;14;1 +15;3;73;30;9 +15;3;74;14;1 +15;3;75;30;9 +15;3;76;14;1 +15;3;77;30;9 +15;3;78;14;1 +15;3;79;30;9 +15;3;80;14;1 +15;3;81;30;9 +15;3;82;14;1 +15;3;83;30;9 +15;3;84;14;1 +15;3;85;30;9 +15;3;86;14;1 +15;3;87;30;9 +15;3;88;14;1 +15;3;89;30;9 +15;3;90;14;1 +15;3;91;30;9 +15;3;92;14;1 +15;3;93;30;9 +15;3;94;14;1 +15;3;95;30;9 +15;3;96;14;1 +15;3;97;30;9 +15;3;98;14;1 +15;3;99;30;9 +15;3;100;14;1 +15;3;101;30;9 +15;3;102;14;1 +15;3;103;30;9 +15;3;104;14;1 +15;3;105;30;9 +15;3;106;14;1 +15;3;107;30;9 +15;3;108;14;1 +15;3;109;30;9 +15;3;110;14;1 +15;3;111;30;9 +15;3;112;14;1 +15;3;113;30;9 +15;3;114;14;1 +15;3;115;30;9 +15;3;116;14;1 +15;3;117;30;9 +15;3;118;14;1 +15;3;119;30;9 +15;3;120;14;1 +15;3;121;30;9 +15;3;122;14;1 +15;3;123;30;9 +15;3;124;14;1 +15;3;125;30;9 +15;3;126;14;1 +15;3;127;30;9 +15;3;128;14;1 +15;3;129;15;2 +15;3;130;14;1 +15;3;132;14;1 +15;3;133;22;4 +15;3;134;14;1 +15;3;135;22;4 +15;3;136;14;1 +15;3;137;18;5 +15;3;138;14;1 +15;3;139;18;5 +15;3;140;14;1 +15;3;141;18;5 +15;3;142;14;1 +15;3;143;18;5 +15;3;144;14;1 +15;3;145;24;6 +15;3;146;14;1 +15;3;147;24;6 +15;3;148;14;1 +15;3;149;24;6 +15;3;150;14;1 +15;3;151;24;6 +15;3;152;14;1 +15;3;153;24;6 +15;3;154;14;1 +15;3;155;24;6 +15;3;156;14;1 +15;3;157;24;6 +15;3;158;14;1 +15;3;159;24;6 +15;3;160;14;1 +15;3;161;25;7 +15;3;162;14;1 +15;3;163;25;7 +15;3;164;14;1 +15;3;165;25;7 +15;3;166;14;1 +15;3;167;25;7 +15;3;168;14;1 +15;3;169;25;7 +15;3;170;14;1 +15;3;171;25;7 +15;3;172;14;1 +15;3;173;25;7 +15;3;174;14;1 +15;3;175;25;7 +15;3;176;14;1 +15;3;177;24;6 +15;3;178;14;1 +15;3;179;24;6 +15;3;180;14;1 +15;3;181;24;6 +15;3;182;14;1 +15;3;183;24;6 +15;3;184;14;1 +15;3;185;24;6 +15;3;186;14;1 +15;3;187;24;6 +15;3;188;14;1 +15;3;189;24;6 +15;3;190;14;1 +15;3;191;24;6 +15;3;192;14;1 +15;3;193;15;2 +15;3;194;14;1 +15;3;196;14;1 +15;3;197;22;4 +15;3;198;14;1 +15;3;199;22;4 +15;3;200;14;1 +15;3;201;18;5 +15;3;202;14;1 +15;3;203;18;5 +15;3;204;14;1 +15;3;205;18;5 +15;3;206;14;1 +15;3;207;18;5 +15;3;208;14;1 +15;3;209;24;6 +15;3;210;14;1 +15;3;211;24;6 +15;3;212;14;1 +15;3;213;24;6 +15;3;214;14;1 +15;3;215;24;6 +15;3;216;14;1 +15;3;217;24;6 +15;3;218;14;1 +15;3;219;24;6 +15;3;220;14;1 +15;3;221;24;6 +15;3;222;14;1 +15;3;223;24;6 +15;3;224;14;1 +15;3;225;25;7 +15;3;226;14;1 +15;3;227;25;7 +15;3;228;14;1 +15;3;229;25;7 +15;3;230;14;1 +15;3;231;25;7 +15;3;232;14;1 +15;3;233;25;7 +15;3;234;14;1 +15;3;235;25;7 +15;3;236;14;1 +15;3;237;25;7 +15;3;238;14;1 +15;3;239;25;7 +15;3;240;14;1 +15;3;241;24;6 +15;3;242;14;1 +15;3;243;24;6 +15;3;244;14;1 +15;3;245;24;6 +15;3;246;14;1 +15;3;247;24;6 +15;3;248;14;1 +15;3;249;24;6 +15;3;250;14;1 +15;3;251;24;6 +15;3;252;14;1 +15;3;253;24;6 +15;3;254;14;1 +15;3;255;24;6 +15;4;0;14;1 +15;4;1;30;9 +15;4;2;14;1 +15;4;3;30;9 +15;4;4;14;1 +15;4;5;30;9 +15;4;6;14;1 +15;4;7;30;9 +15;4;8;14;1 +15;4;9;30;9 +15;4;10;14;1 +15;4;11;30;9 +15;4;12;14;1 +15;4;13;30;9 +15;4;14;14;1 +15;4;15;30;9 +15;4;16;14;1 +15;4;17;30;9 +15;4;18;14;1 +15;4;19;30;9 +15;4;20;14;1 +15;4;21;30;9 +15;4;22;14;1 +15;4;23;30;9 +15;4;24;14;1 +15;4;25;30;9 +15;4;26;14;1 +15;4;27;30;9 +15;4;28;14;1 +15;4;29;30;9 +15;4;30;14;1 +15;4;31;30;9 +15;4;32;14;1 +15;4;33;30;9 +15;4;34;14;1 +15;4;35;30;9 +15;4;36;14;1 +15;4;37;30;9 +15;4;38;14;1 +15;4;39;30;9 +15;4;40;14;1 +15;4;41;30;9 +15;4;42;14;1 +15;4;43;30;9 +15;4;44;14;1 +15;4;45;30;9 +15;4;46;14;1 +15;4;47;30;9 +15;4;48;14;1 +15;4;49;30;9 +15;4;50;14;1 +15;4;51;30;9 +15;4;52;14;1 +15;4;53;30;9 +15;4;54;14;1 +15;4;55;30;9 +15;4;56;14;1 +15;4;57;30;9 +15;4;58;14;1 +15;4;59;30;9 +15;4;60;14;1 +15;4;61;30;9 +15;4;62;14;1 +15;4;63;30;9 +15;4;64;14;1 +15;4;65;30;9 +15;4;66;14;1 +15;4;67;30;9 +15;4;68;14;1 +15;4;69;30;9 +15;4;70;14;1 +15;4;71;30;9 +15;4;72;14;1 +15;4;73;30;9 +15;4;74;14;1 +15;4;75;30;9 +15;4;76;14;1 +15;4;77;30;9 +15;4;78;14;1 +15;4;79;30;9 +15;4;80;14;1 +15;4;81;30;9 +15;4;82;14;1 +15;4;83;30;9 +15;4;84;14;1 +15;4;85;30;9 +15;4;86;14;1 +15;4;87;30;9 +15;4;88;14;1 +15;4;89;30;9 +15;4;90;14;1 +15;4;91;30;9 +15;4;92;14;1 +15;4;93;30;9 +15;4;94;14;1 +15;4;95;30;9 +15;4;96;14;1 +15;4;97;30;9 +15;4;98;14;1 +15;4;99;30;9 +15;4;100;14;1 +15;4;101;30;9 +15;4;102;14;1 +15;4;103;30;9 +15;4;104;14;1 +15;4;105;30;9 +15;4;106;14;1 +15;4;107;30;9 +15;4;108;14;1 +15;4;109;30;9 +15;4;110;14;1 +15;4;111;30;9 +15;4;112;14;1 +15;4;113;30;9 +15;4;114;14;1 +15;4;115;30;9 +15;4;116;14;1 +15;4;117;30;9 +15;4;118;14;1 +15;4;119;30;9 +15;4;120;14;1 +15;4;121;30;9 +15;4;122;14;1 +15;4;123;30;9 +15;4;124;14;1 +15;4;125;30;9 +15;4;126;14;1 +15;4;127;30;9 +15;4;128;14;1 +15;4;129;15;2 +15;4;130;14;1 +15;4;131;16;3 +15;4;132;14;1 +15;4;134;14;1 +15;4;136;14;1 +15;4;137;18;5 +15;4;138;14;1 +15;4;139;18;5 +15;4;140;14;1 +15;4;141;18;5 +15;4;142;14;1 +15;4;143;18;5 +15;4;144;14;1 +15;4;145;24;6 +15;4;146;14;1 +15;4;147;24;6 +15;4;148;14;1 +15;4;149;24;6 +15;4;150;14;1 +15;4;151;24;6 +15;4;152;14;1 +15;4;153;24;6 +15;4;154;14;1 +15;4;155;24;6 +15;4;156;14;1 +15;4;157;24;6 +15;4;158;14;1 +15;4;159;24;6 +15;4;160;14;1 +15;4;161;25;7 +15;4;162;14;1 +15;4;163;25;7 +15;4;164;14;1 +15;4;165;25;7 +15;4;166;14;1 +15;4;167;25;7 +15;4;168;14;1 +15;4;169;25;7 +15;4;170;14;1 +15;4;171;25;7 +15;4;172;14;1 +15;4;173;25;7 +15;4;174;14;1 +15;4;175;25;7 +15;4;176;14;1 +15;4;177;24;6 +15;4;178;14;1 +15;4;179;24;6 +15;4;180;14;1 +15;4;181;24;6 +15;4;182;14;1 +15;4;183;24;6 +15;4;184;14;1 +15;4;185;24;6 +15;4;186;14;1 +15;4;187;24;6 +15;4;188;14;1 +15;4;189;24;6 +15;4;190;14;1 +15;4;191;24;6 +15;4;192;14;1 +15;4;193;15;2 +15;4;194;14;1 +15;4;195;16;3 +15;4;196;14;1 +15;4;198;14;1 +15;4;200;14;1 +15;4;201;18;5 +15;4;202;14;1 +15;4;203;18;5 +15;4;204;14;1 +15;4;205;18;5 +15;4;206;14;1 +15;4;207;18;5 +15;4;208;14;1 +15;4;209;24;6 +15;4;210;14;1 +15;4;211;24;6 +15;4;212;14;1 +15;4;213;24;6 +15;4;214;14;1 +15;4;215;24;6 +15;4;216;14;1 +15;4;217;24;6 +15;4;218;14;1 +15;4;219;24;6 +15;4;220;14;1 +15;4;221;24;6 +15;4;222;14;1 +15;4;223;24;6 +15;4;224;14;1 +15;4;225;25;7 +15;4;226;14;1 +15;4;227;25;7 +15;4;228;14;1 +15;4;229;25;7 +15;4;230;14;1 +15;4;231;25;7 +15;4;232;14;1 +15;4;233;25;7 +15;4;234;14;1 +15;4;235;25;7 +15;4;236;14;1 +15;4;237;25;7 +15;4;238;14;1 +15;4;239;25;7 +15;4;240;14;1 +15;4;241;24;6 +15;4;242;14;1 +15;4;243;24;6 +15;4;244;14;1 +15;4;245;24;6 +15;4;246;14;1 +15;4;247;24;6 +15;4;248;14;1 +15;4;249;24;6 +15;4;250;14;1 +15;4;251;24;6 +15;4;252;14;1 +15;4;253;24;6 +15;4;254;14;1 +15;4;255;24;6 +15;5;0;14;1 +15;5;1;30;9 +15;5;2;14;1 +15;5;3;30;9 +15;5;4;14;1 +15;5;5;30;9 +15;5;6;14;1 +15;5;7;30;9 +15;5;8;14;1 +15;5;9;30;9 +15;5;10;14;1 +15;5;11;30;9 +15;5;12;14;1 +15;5;13;30;9 +15;5;14;14;1 +15;5;15;30;9 +15;5;16;14;1 +15;5;17;30;9 +15;5;18;14;1 +15;5;19;30;9 +15;5;20;14;1 +15;5;21;30;9 +15;5;22;14;1 +15;5;23;30;9 +15;5;24;14;1 +15;5;25;30;9 +15;5;26;14;1 +15;5;27;30;9 +15;5;28;14;1 +15;5;29;30;9 +15;5;30;14;1 +15;5;31;30;9 +15;5;32;14;1 +15;5;33;30;9 +15;5;34;14;1 +15;5;35;30;9 +15;5;36;14;1 +15;5;37;30;9 +15;5;38;14;1 +15;5;39;30;9 +15;5;40;14;1 +15;5;41;30;9 +15;5;42;14;1 +15;5;43;30;9 +15;5;44;14;1 +15;5;45;30;9 +15;5;46;14;1 +15;5;47;30;9 +15;5;48;14;1 +15;5;49;30;9 +15;5;50;14;1 +15;5;51;30;9 +15;5;52;14;1 +15;5;53;30;9 +15;5;54;14;1 +15;5;55;30;9 +15;5;56;14;1 +15;5;57;30;9 +15;5;58;14;1 +15;5;59;30;9 +15;5;60;14;1 +15;5;61;30;9 +15;5;62;14;1 +15;5;63;30;9 +15;5;64;14;1 +15;5;65;30;9 +15;5;66;14;1 +15;5;67;30;9 +15;5;68;14;1 +15;5;69;30;9 +15;5;70;14;1 +15;5;71;30;9 +15;5;72;14;1 +15;5;73;30;9 +15;5;74;14;1 +15;5;75;30;9 +15;5;76;14;1 +15;5;77;30;9 +15;5;78;14;1 +15;5;79;30;9 +15;5;80;14;1 +15;5;81;30;9 +15;5;82;14;1 +15;5;83;30;9 +15;5;84;14;1 +15;5;85;30;9 +15;5;86;14;1 +15;5;87;30;9 +15;5;88;14;1 +15;5;89;30;9 +15;5;90;14;1 +15;5;91;30;9 +15;5;92;14;1 +15;5;93;30;9 +15;5;94;14;1 +15;5;95;30;9 +15;5;96;14;1 +15;5;97;30;9 +15;5;98;14;1 +15;5;99;30;9 +15;5;100;14;1 +15;5;101;30;9 +15;5;102;14;1 +15;5;103;30;9 +15;5;104;14;1 +15;5;105;30;9 +15;5;106;14;1 +15;5;107;30;9 +15;5;108;14;1 +15;5;109;30;9 +15;5;110;14;1 +15;5;111;30;9 +15;5;112;14;1 +15;5;113;30;9 +15;5;114;14;1 +15;5;115;30;9 +15;5;116;14;1 +15;5;117;30;9 +15;5;118;14;1 +15;5;119;30;9 +15;5;120;14;1 +15;5;121;30;9 +15;5;122;14;1 +15;5;123;30;9 +15;5;124;14;1 +15;5;125;30;9 +15;5;126;14;1 +15;5;127;30;9 +15;5;128;14;1 +15;5;129;15;2 +15;5;130;14;1 +15;5;131;16;3 +15;5;132;14;1 +15;5;133;22;4 +15;5;134;14;1 +15;5;135;22;4 +15;5;136;14;1 +15;5;138;14;1 +15;5;140;14;1 +15;5;142;14;1 +15;5;144;14;1 +15;5;145;24;6 +15;5;146;14;1 +15;5;147;24;6 +15;5;148;14;1 +15;5;149;24;6 +15;5;150;14;1 +15;5;151;24;6 +15;5;152;14;1 +15;5;153;24;6 +15;5;154;14;1 +15;5;155;24;6 +15;5;156;14;1 +15;5;157;24;6 +15;5;158;14;1 +15;5;159;24;6 +15;5;160;14;1 +15;5;161;25;7 +15;5;162;14;1 +15;5;163;25;7 +15;5;164;14;1 +15;5;165;25;7 +15;5;166;14;1 +15;5;167;25;7 +15;5;168;14;1 +15;5;169;25;7 +15;5;170;14;1 +15;5;171;25;7 +15;5;172;14;1 +15;5;173;25;7 +15;5;174;14;1 +15;5;175;25;7 +15;5;176;14;1 +15;5;177;24;6 +15;5;178;14;1 +15;5;179;24;6 +15;5;180;14;1 +15;5;181;24;6 +15;5;182;14;1 +15;5;183;24;6 +15;5;184;14;1 +15;5;185;24;6 +15;5;186;14;1 +15;5;187;24;6 +15;5;188;14;1 +15;5;189;24;6 +15;5;190;14;1 +15;5;191;24;6 +15;5;192;14;1 +15;5;193;15;2 +15;5;194;14;1 +15;5;195;16;3 +15;5;196;14;1 +15;5;197;22;4 +15;5;198;14;1 +15;5;199;22;4 +15;5;200;14;1 +15;5;202;14;1 +15;5;204;14;1 +15;5;206;14;1 +15;5;208;14;1 +15;5;209;24;6 +15;5;210;14;1 +15;5;211;24;6 +15;5;212;14;1 +15;5;213;24;6 +15;5;214;14;1 +15;5;215;24;6 +15;5;216;14;1 +15;5;217;24;6 +15;5;218;14;1 +15;5;219;24;6 +15;5;220;14;1 +15;5;221;24;6 +15;5;222;14;1 +15;5;223;24;6 +15;5;224;14;1 +15;5;225;25;7 +15;5;226;14;1 +15;5;227;25;7 +15;5;228;14;1 +15;5;229;25;7 +15;5;230;14;1 +15;5;231;25;7 +15;5;232;14;1 +15;5;233;25;7 +15;5;234;14;1 +15;5;235;25;7 +15;5;236;14;1 +15;5;237;25;7 +15;5;238;14;1 +15;5;239;25;7 +15;5;240;14;1 +15;5;241;24;6 +15;5;242;14;1 +15;5;243;24;6 +15;5;244;14;1 +15;5;245;24;6 +15;5;246;14;1 +15;5;247;24;6 +15;5;248;14;1 +15;5;249;24;6 +15;5;250;14;1 +15;5;251;24;6 +15;5;252;14;1 +15;5;253;24;6 +15;5;254;14;1 +15;5;255;24;6 +15;6;0;14;1 +15;6;1;30;9 +15;6;2;14;1 +15;6;3;30;9 +15;6;4;14;1 +15;6;5;30;9 +15;6;6;14;1 +15;6;7;30;9 +15;6;8;14;1 +15;6;9;30;9 +15;6;10;14;1 +15;6;11;30;9 +15;6;12;14;1 +15;6;13;30;9 +15;6;14;14;1 +15;6;15;30;9 +15;6;16;14;1 +15;6;17;30;9 +15;6;18;14;1 +15;6;19;30;9 +15;6;20;14;1 +15;6;21;30;9 +15;6;22;14;1 +15;6;23;30;9 +15;6;24;14;1 +15;6;25;30;9 +15;6;26;14;1 +15;6;27;30;9 +15;6;28;14;1 +15;6;29;30;9 +15;6;30;14;1 +15;6;31;30;9 +15;6;32;14;1 +15;6;33;30;9 +15;6;34;14;1 +15;6;35;30;9 +15;6;36;14;1 +15;6;37;30;9 +15;6;38;14;1 +15;6;39;30;9 +15;6;40;14;1 +15;6;41;30;9 +15;6;42;14;1 +15;6;43;30;9 +15;6;44;14;1 +15;6;45;30;9 +15;6;46;14;1 +15;6;47;30;9 +15;6;48;14;1 +15;6;49;30;9 +15;6;50;14;1 +15;6;51;30;9 +15;6;52;14;1 +15;6;53;30;9 +15;6;54;14;1 +15;6;55;30;9 +15;6;56;14;1 +15;6;57;30;9 +15;6;58;14;1 +15;6;59;30;9 +15;6;60;14;1 +15;6;61;30;9 +15;6;62;14;1 +15;6;63;30;9 +15;6;64;14;1 +15;6;65;30;9 +15;6;66;14;1 +15;6;67;30;9 +15;6;68;14;1 +15;6;69;30;9 +15;6;70;14;1 +15;6;71;30;9 +15;6;72;14;1 +15;6;73;30;9 +15;6;74;14;1 +15;6;75;30;9 +15;6;76;14;1 +15;6;77;30;9 +15;6;78;14;1 +15;6;79;30;9 +15;6;80;14;1 +15;6;81;30;9 +15;6;82;14;1 +15;6;83;30;9 +15;6;84;14;1 +15;6;85;30;9 +15;6;86;14;1 +15;6;87;30;9 +15;6;88;14;1 +15;6;89;30;9 +15;6;90;14;1 +15;6;91;30;9 +15;6;92;14;1 +15;6;93;30;9 +15;6;94;14;1 +15;6;95;30;9 +15;6;96;14;1 +15;6;97;30;9 +15;6;98;14;1 +15;6;99;30;9 +15;6;100;14;1 +15;6;101;30;9 +15;6;102;14;1 +15;6;103;30;9 +15;6;104;14;1 +15;6;105;30;9 +15;6;106;14;1 +15;6;107;30;9 +15;6;108;14;1 +15;6;109;30;9 +15;6;110;14;1 +15;6;111;30;9 +15;6;112;14;1 +15;6;113;30;9 +15;6;114;14;1 +15;6;115;30;9 +15;6;116;14;1 +15;6;117;30;9 +15;6;118;14;1 +15;6;119;30;9 +15;6;120;14;1 +15;6;121;30;9 +15;6;122;14;1 +15;6;123;30;9 +15;6;124;14;1 +15;6;125;30;9 +15;6;126;14;1 +15;6;127;30;9 +15;6;128;14;1 +15;6;129;15;2 +15;6;130;14;1 +15;6;131;16;3 +15;6;132;14;1 +15;6;133;22;4 +15;6;134;14;1 +15;6;135;22;4 +15;6;136;14;1 +15;6;137;18;5 +15;6;138;14;1 +15;6;139;18;5 +15;6;140;14;1 +15;6;141;18;5 +15;6;142;14;1 +15;6;143;18;5 +15;6;144;14;1 +15;6;146;14;1 +15;6;148;14;1 +15;6;150;14;1 +15;6;152;14;1 +15;6;154;14;1 +15;6;156;14;1 +15;6;158;14;1 +15;6;160;14;1 +15;6;161;25;7 +15;6;162;14;1 +15;6;163;25;7 +15;6;164;14;1 +15;6;165;25;7 +15;6;166;14;1 +15;6;167;25;7 +15;6;168;14;1 +15;6;169;25;7 +15;6;170;14;1 +15;6;171;25;7 +15;6;172;14;1 +15;6;173;25;7 +15;6;174;14;1 +15;6;175;25;7 +15;6;176;14;1 +15;6;178;14;1 +15;6;180;14;1 +15;6;182;14;1 +15;6;184;14;1 +15;6;186;14;1 +15;6;188;14;1 +15;6;190;14;1 +15;6;192;14;1 +15;6;193;15;2 +15;6;194;14;1 +15;6;195;16;3 +15;6;196;14;1 +15;6;197;22;4 +15;6;198;14;1 +15;6;199;22;4 +15;6;200;14;1 +15;6;201;18;5 +15;6;202;14;1 +15;6;203;18;5 +15;6;204;14;1 +15;6;205;18;5 +15;6;206;14;1 +15;6;207;18;5 +15;6;208;14;1 +15;6;210;14;1 +15;6;212;14;1 +15;6;214;14;1 +15;6;216;14;1 +15;6;218;14;1 +15;6;220;14;1 +15;6;222;14;1 +15;6;224;14;1 +15;6;225;25;7 +15;6;226;14;1 +15;6;227;25;7 +15;6;228;14;1 +15;6;229;25;7 +15;6;230;14;1 +15;6;231;25;7 +15;6;232;14;1 +15;6;233;25;7 +15;6;234;14;1 +15;6;235;25;7 +15;6;236;14;1 +15;6;237;25;7 +15;6;238;14;1 +15;6;239;25;7 +15;6;240;14;1 +15;6;242;14;1 +15;6;244;14;1 +15;6;246;14;1 +15;6;248;14;1 +15;6;250;14;1 +15;6;252;14;1 +15;6;254;14;1 +15;7;0;14;1 +15;7;1;30;9 +15;7;2;14;1 +15;7;3;30;9 +15;7;4;14;1 +15;7;5;30;9 +15;7;6;14;1 +15;7;7;30;9 +15;7;8;14;1 +15;7;9;30;9 +15;7;10;14;1 +15;7;11;30;9 +15;7;12;14;1 +15;7;13;30;9 +15;7;14;14;1 +15;7;15;30;9 +15;7;16;14;1 +15;7;17;30;9 +15;7;18;14;1 +15;7;19;30;9 +15;7;20;14;1 +15;7;21;30;9 +15;7;22;14;1 +15;7;23;30;9 +15;7;24;14;1 +15;7;25;30;9 +15;7;26;14;1 +15;7;27;30;9 +15;7;28;14;1 +15;7;29;30;9 +15;7;30;14;1 +15;7;31;30;9 +15;7;32;14;1 +15;7;33;30;9 +15;7;34;14;1 +15;7;35;30;9 +15;7;36;14;1 +15;7;37;30;9 +15;7;38;14;1 +15;7;39;30;9 +15;7;40;14;1 +15;7;41;30;9 +15;7;42;14;1 +15;7;43;30;9 +15;7;44;14;1 +15;7;45;30;9 +15;7;46;14;1 +15;7;47;30;9 +15;7;48;14;1 +15;7;49;30;9 +15;7;50;14;1 +15;7;51;30;9 +15;7;52;14;1 +15;7;53;30;9 +15;7;54;14;1 +15;7;55;30;9 +15;7;56;14;1 +15;7;57;30;9 +15;7;58;14;1 +15;7;59;30;9 +15;7;60;14;1 +15;7;61;30;9 +15;7;62;14;1 +15;7;63;30;9 +15;7;64;14;1 +15;7;65;30;9 +15;7;66;14;1 +15;7;67;30;9 +15;7;68;14;1 +15;7;69;30;9 +15;7;70;14;1 +15;7;71;30;9 +15;7;72;14;1 +15;7;73;30;9 +15;7;74;14;1 +15;7;75;30;9 +15;7;76;14;1 +15;7;77;30;9 +15;7;78;14;1 +15;7;79;30;9 +15;7;80;14;1 +15;7;81;30;9 +15;7;82;14;1 +15;7;83;30;9 +15;7;84;14;1 +15;7;85;30;9 +15;7;86;14;1 +15;7;87;30;9 +15;7;88;14;1 +15;7;89;30;9 +15;7;90;14;1 +15;7;91;30;9 +15;7;92;14;1 +15;7;93;30;9 +15;7;94;14;1 +15;7;95;30;9 +15;7;96;14;1 +15;7;97;30;9 +15;7;98;14;1 +15;7;99;30;9 +15;7;100;14;1 +15;7;101;30;9 +15;7;102;14;1 +15;7;103;30;9 +15;7;104;14;1 +15;7;105;30;9 +15;7;106;14;1 +15;7;107;30;9 +15;7;108;14;1 +15;7;109;30;9 +15;7;110;14;1 +15;7;111;30;9 +15;7;112;14;1 +15;7;113;30;9 +15;7;114;14;1 +15;7;115;30;9 +15;7;116;14;1 +15;7;117;30;9 +15;7;118;14;1 +15;7;119;30;9 +15;7;120;14;1 +15;7;121;30;9 +15;7;122;14;1 +15;7;123;30;9 +15;7;124;14;1 +15;7;125;30;9 +15;7;126;14;1 +15;7;127;30;9 +15;7;128;14;1 +15;7;129;15;2 +15;7;130;14;1 +15;7;131;16;3 +15;7;132;14;1 +15;7;133;22;4 +15;7;134;14;1 +15;7;135;22;4 +15;7;136;14;1 +15;7;137;18;5 +15;7;138;14;1 +15;7;139;18;5 +15;7;140;14;1 +15;7;141;18;5 +15;7;142;14;1 +15;7;143;18;5 +15;7;144;14;1 +15;7;145;24;6 +15;7;146;14;1 +15;7;147;24;6 +15;7;148;14;1 +15;7;149;24;6 +15;7;150;14;1 +15;7;151;24;6 +15;7;152;14;1 +15;7;153;24;6 +15;7;154;14;1 +15;7;155;24;6 +15;7;156;14;1 +15;7;157;24;6 +15;7;158;14;1 +15;7;159;24;6 +15;7;160;14;1 +15;7;162;14;1 +15;7;164;14;1 +15;7;166;14;1 +15;7;168;14;1 +15;7;170;14;1 +15;7;172;14;1 +15;7;174;14;1 +15;7;176;14;1 +15;7;177;24;6 +15;7;178;14;1 +15;7;179;24;6 +15;7;180;14;1 +15;7;181;24;6 +15;7;182;14;1 +15;7;183;24;6 +15;7;184;14;1 +15;7;185;24;6 +15;7;186;14;1 +15;7;187;24;6 +15;7;188;14;1 +15;7;189;24;6 +15;7;190;14;1 +15;7;191;24;6 +15;7;192;14;1 +15;7;193;15;2 +15;7;194;14;1 +15;7;195;16;3 +15;7;196;14;1 +15;7;197;22;4 +15;7;198;14;1 +15;7;199;22;4 +15;7;200;14;1 +15;7;201;18;5 +15;7;202;14;1 +15;7;203;18;5 +15;7;204;14;1 +15;7;205;18;5 +15;7;206;14;1 +15;7;207;18;5 +15;7;208;14;1 +15;7;209;24;6 +15;7;210;14;1 +15;7;211;24;6 +15;7;212;14;1 +15;7;213;24;6 +15;7;214;14;1 +15;7;215;24;6 +15;7;216;14;1 +15;7;217;24;6 +15;7;218;14;1 +15;7;219;24;6 +15;7;220;14;1 +15;7;221;24;6 +15;7;222;14;1 +15;7;223;24;6 +15;7;224;14;1 +15;7;226;14;1 +15;7;228;14;1 +15;7;230;14;1 +15;7;232;14;1 +15;7;234;14;1 +15;7;236;14;1 +15;7;238;14;1 +15;7;240;14;1 +15;7;241;24;6 +15;7;242;14;1 +15;7;243;24;6 +15;7;244;14;1 +15;7;245;24;6 +15;7;246;14;1 +15;7;247;24;6 +15;7;248;14;1 +15;7;249;24;6 +15;7;250;14;1 +15;7;251;24;6 +15;7;252;14;1 +15;7;253;24;6 +15;7;254;14;1 +15;7;255;24;6 +15;8;0;14;1 +15;8;1;30;9 +15;8;2;14;1 +15;8;3;30;9 +15;8;4;14;1 +15;8;5;30;9 +15;8;6;14;1 +15;8;7;30;9 +15;8;8;14;1 +15;8;9;30;9 +15;8;10;14;1 +15;8;11;30;9 +15;8;12;14;1 +15;8;13;30;9 +15;8;14;14;1 +15;8;15;30;9 +15;8;16;14;1 +15;8;17;30;9 +15;8;18;14;1 +15;8;19;30;9 +15;8;20;14;1 +15;8;21;30;9 +15;8;22;14;1 +15;8;23;30;9 +15;8;24;14;1 +15;8;25;30;9 +15;8;26;14;1 +15;8;27;30;9 +15;8;28;14;1 +15;8;29;30;9 +15;8;30;14;1 +15;8;31;30;9 +15;8;32;14;1 +15;8;33;30;9 +15;8;34;14;1 +15;8;35;30;9 +15;8;36;14;1 +15;8;37;30;9 +15;8;38;14;1 +15;8;39;30;9 +15;8;40;14;1 +15;8;41;30;9 +15;8;42;14;1 +15;8;43;30;9 +15;8;44;14;1 +15;8;45;30;9 +15;8;46;14;1 +15;8;47;30;9 +15;8;48;14;1 +15;8;49;30;9 +15;8;50;14;1 +15;8;51;30;9 +15;8;52;14;1 +15;8;53;30;9 +15;8;54;14;1 +15;8;55;30;9 +15;8;56;14;1 +15;8;57;30;9 +15;8;58;14;1 +15;8;59;30;9 +15;8;60;14;1 +15;8;61;30;9 +15;8;62;14;1 +15;8;63;30;9 +15;8;64;14;1 +15;8;65;30;9 +15;8;66;14;1 +15;8;67;30;9 +15;8;68;14;1 +15;8;69;30;9 +15;8;70;14;1 +15;8;71;30;9 +15;8;72;14;1 +15;8;73;30;9 +15;8;74;14;1 +15;8;75;30;9 +15;8;76;14;1 +15;8;77;30;9 +15;8;78;14;1 +15;8;79;30;9 +15;8;80;14;1 +15;8;81;30;9 +15;8;82;14;1 +15;8;83;30;9 +15;8;84;14;1 +15;8;85;30;9 +15;8;86;14;1 +15;8;87;30;9 +15;8;88;14;1 +15;8;89;30;9 +15;8;90;14;1 +15;8;91;30;9 +15;8;92;14;1 +15;8;93;30;9 +15;8;94;14;1 +15;8;95;30;9 +15;8;96;14;1 +15;8;97;30;9 +15;8;98;14;1 +15;8;99;30;9 +15;8;100;14;1 +15;8;101;30;9 +15;8;102;14;1 +15;8;103;30;9 +15;8;104;14;1 +15;8;105;30;9 +15;8;106;14;1 +15;8;107;30;9 +15;8;108;14;1 +15;8;109;30;9 +15;8;110;14;1 +15;8;111;30;9 +15;8;112;14;1 +15;8;113;30;9 +15;8;114;14;1 +15;8;115;30;9 +15;8;116;14;1 +15;8;117;30;9 +15;8;118;14;1 +15;8;119;30;9 +15;8;120;14;1 +15;8;121;30;9 +15;8;122;14;1 +15;8;123;30;9 +15;8;124;14;1 +15;8;125;30;9 +15;8;126;14;1 +15;8;127;30;9 +15;8;128;14;1 +15;8;129;15;2 +15;8;130;14;1 +15;8;131;16;3 +15;8;132;14;1 +15;8;133;22;4 +15;8;134;14;1 +15;8;135;22;4 +15;8;136;14;1 +15;8;137;18;5 +15;8;138;14;1 +15;8;139;18;5 +15;8;140;14;1 +15;8;141;18;5 +15;8;142;14;1 +15;8;143;18;5 +15;8;144;14;1 +15;8;145;24;6 +15;8;146;14;1 +15;8;147;24;6 +15;8;148;14;1 +15;8;149;24;6 +15;8;150;14;1 +15;8;151;24;6 +15;8;152;14;1 +15;8;153;24;6 +15;8;154;14;1 +15;8;155;24;6 +15;8;156;14;1 +15;8;157;24;6 +15;8;158;14;1 +15;8;159;24;6 +15;8;160;14;1 +15;8;161;25;7 +15;8;162;14;1 +15;8;163;25;7 +15;8;164;14;1 +15;8;165;25;7 +15;8;166;14;1 +15;8;167;25;7 +15;8;168;14;1 +15;8;169;25;7 +15;8;170;14;1 +15;8;171;25;7 +15;8;172;14;1 +15;8;173;25;7 +15;8;174;14;1 +15;8;175;25;7 +15;8;176;14;1 +15;8;177;24;6 +15;8;178;14;1 +15;8;179;24;6 +15;8;180;14;1 +15;8;181;24;6 +15;8;182;14;1 +15;8;183;24;6 +15;8;184;14;1 +15;8;185;24;6 +15;8;186;14;1 +15;8;187;24;6 +15;8;188;14;1 +15;8;189;24;6 +15;8;190;14;1 +15;8;191;24;6 +15;8;192;14;1 +15;8;193;15;2 +15;8;194;14;1 +15;8;195;16;3 +15;8;196;14;1 +15;8;197;22;4 +15;8;198;14;1 +15;8;199;22;4 +15;8;200;14;1 +15;8;201;18;5 +15;8;202;14;1 +15;8;203;18;5 +15;8;204;14;1 +15;8;205;18;5 +15;8;206;14;1 +15;8;207;18;5 +15;8;208;14;1 +15;8;209;24;6 +15;8;210;14;1 +15;8;211;24;6 +15;8;212;14;1 +15;8;213;24;6 +15;8;214;14;1 +15;8;215;24;6 +15;8;216;14;1 +15;8;217;24;6 +15;8;218;14;1 +15;8;219;24;6 +15;8;220;14;1 +15;8;221;24;6 +15;8;222;14;1 +15;8;223;24;6 +15;8;224;14;1 +15;8;225;25;7 +15;8;226;14;1 +15;8;227;25;7 +15;8;228;14;1 +15;8;229;25;7 +15;8;230;14;1 +15;8;231;25;7 +15;8;232;14;1 +15;8;233;25;7 +15;8;234;14;1 +15;8;235;25;7 +15;8;236;14;1 +15;8;237;25;7 +15;8;238;14;1 +15;8;239;25;7 +15;8;240;14;1 +15;8;241;24;6 +15;8;242;14;1 +15;8;243;24;6 +15;8;244;14;1 +15;8;245;24;6 +15;8;246;14;1 +15;8;247;24;6 +15;8;248;14;1 +15;8;249;24;6 +15;8;250;14;1 +15;8;251;24;6 +15;8;252;14;1 +15;8;253;24;6 +15;8;254;14;1 +15;8;255;24;6 +15;9;0;14;1 +15;9;2;14;1 +15;9;4;14;1 +15;9;6;14;1 +15;9;8;14;1 +15;9;10;14;1 +15;9;12;14;1 +15;9;14;14;1 +15;9;16;14;1 +15;9;18;14;1 +15;9;20;14;1 +15;9;22;14;1 +15;9;24;14;1 +15;9;26;14;1 +15;9;28;14;1 +15;9;30;14;1 +15;9;32;14;1 +15;9;34;14;1 +15;9;36;14;1 +15;9;38;14;1 +15;9;40;14;1 +15;9;42;14;1 +15;9;44;14;1 +15;9;46;14;1 +15;9;48;14;1 +15;9;50;14;1 +15;9;52;14;1 +15;9;54;14;1 +15;9;56;14;1 +15;9;58;14;1 +15;9;60;14;1 +15;9;62;14;1 +15;9;64;14;1 +15;9;66;14;1 +15;9;68;14;1 +15;9;70;14;1 +15;9;72;14;1 +15;9;74;14;1 +15;9;76;14;1 +15;9;78;14;1 +15;9;80;14;1 +15;9;82;14;1 +15;9;84;14;1 +15;9;86;14;1 +15;9;88;14;1 +15;9;90;14;1 +15;9;92;14;1 +15;9;94;14;1 +15;9;96;14;1 +15;9;98;14;1 +15;9;100;14;1 +15;9;102;14;1 +15;9;104;14;1 +15;9;106;14;1 +15;9;108;14;1 +15;9;110;14;1 +15;9;112;14;1 +15;9;114;14;1 +15;9;116;14;1 +15;9;118;14;1 +15;9;120;14;1 +15;9;122;14;1 +15;9;124;14;1 +15;9;126;14;1 +15;9;128;14;1 +15;9;129;15;2 +15;9;130;14;1 +15;9;131;16;3 +15;9;132;14;1 +15;9;133;22;4 +15;9;134;14;1 +15;9;135;22;4 +15;9;136;14;1 +15;9;137;18;5 +15;9;138;14;1 +15;9;139;18;5 +15;9;140;14;1 +15;9;141;18;5 +15;9;142;14;1 +15;9;143;18;5 +15;9;144;14;1 +15;9;145;24;6 +15;9;146;14;1 +15;9;147;24;6 +15;9;148;14;1 +15;9;149;24;6 +15;9;150;14;1 +15;9;151;24;6 +15;9;152;14;1 +15;9;153;24;6 +15;9;154;14;1 +15;9;155;24;6 +15;9;156;14;1 +15;9;157;24;6 +15;9;158;14;1 +15;9;159;24;6 +15;9;160;14;1 +15;9;161;25;7 +15;9;162;14;1 +15;9;163;25;7 +15;9;164;14;1 +15;9;165;25;7 +15;9;166;14;1 +15;9;167;25;7 +15;9;168;14;1 +15;9;169;25;7 +15;9;170;14;1 +15;9;171;25;7 +15;9;172;14;1 +15;9;173;25;7 +15;9;174;14;1 +15;9;175;25;7 +15;9;176;14;1 +15;9;177;24;6 +15;9;178;14;1 +15;9;179;24;6 +15;9;180;14;1 +15;9;181;24;6 +15;9;182;14;1 +15;9;183;24;6 +15;9;184;14;1 +15;9;185;24;6 +15;9;186;14;1 +15;9;187;24;6 +15;9;188;14;1 +15;9;189;24;6 +15;9;190;14;1 +15;9;191;24;6 +15;9;192;14;1 +15;9;193;15;2 +15;9;194;14;1 +15;9;195;16;3 +15;9;196;14;1 +15;9;197;22;4 +15;9;198;14;1 +15;9;199;22;4 +15;9;200;14;1 +15;9;201;18;5 +15;9;202;14;1 +15;9;203;18;5 +15;9;204;14;1 +15;9;205;18;5 +15;9;206;14;1 +15;9;207;18;5 +15;9;208;14;1 +15;9;209;24;6 +15;9;210;14;1 +15;9;211;24;6 +15;9;212;14;1 +15;9;213;24;6 +15;9;214;14;1 +15;9;215;24;6 +15;9;216;14;1 +15;9;217;24;6 +15;9;218;14;1 +15;9;219;24;6 +15;9;220;14;1 +15;9;221;24;6 +15;9;222;14;1 +15;9;223;24;6 +15;9;224;14;1 +15;9;225;25;7 +15;9;226;14;1 +15;9;227;25;7 +15;9;228;14;1 +15;9;229;25;7 +15;9;230;14;1 +15;9;231;25;7 +15;9;232;14;1 +15;9;233;25;7 +15;9;234;14;1 +15;9;235;25;7 +15;9;236;14;1 +15;9;237;25;7 +15;9;238;14;1 +15;9;239;25;7 +15;9;240;14;1 +15;9;241;24;6 +15;9;242;14;1 +15;9;243;24;6 +15;9;244;14;1 +15;9;245;24;6 +15;9;246;14;1 +15;9;247;24;6 +15;9;248;14;1 +15;9;249;24;6 +15;9;250;14;1 +15;9;251;24;6 +15;9;252;14;1 +15;9;253;24;6 +15;9;254;14;1 +15;9;255;24;6 diff --git a/StateMachine/src/MapoState/MapoState/resource/15.rul b/StateMachine/src/MapoState/MapoState/resource/15.rul new file mode 100644 index 0000000..799adf0 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/resource/15.rul @@ -0,0 +1,101 @@ +# +# Donati Macchine Pul02,PUL03 ( PLC Enrico ) +# trebi con PLC nuovo +# +# v.2 28-X-2013 segnale contapezzo : non rimandare evento se già nello stato "Cycle end" +# v.3 31-X-2013 ignora magazzino grezzi vuoti +# v.4 9-XII-2013 rimessa regola : se segnale contapezzo, vale per tutti gli stati (eliminando v2) +# +# segnale contapezzo : non rimanda evento se già nello stato "Cycle end" <<<< no dalla versione 4 +# si faceva fottere da 3 o + campioni a 7 in ingresso +# primo input a 7 --> stato end cycle +# secondo input a 7 --> stato run !!! ( mancava la regola ) +# terzo input a 7 --> di nuovo stato end cycle ( e quindi un pezzo in più ) +# +$DEFINITIONS + +$NAME : enrico +$IDX : 15 +$N_STATES : 10 +$N_BITS : 8 + +#definizione bit : obbligatorio iniziare da 0 + +$BIT : 0 : power_on +$BIT : 1 : run +$BIT : 2 : end_cycle +$BIT : 3 : alarm +$BIT : 4 : manual +$BIT : 5 : output_full +$BIT : 6 : input_empty +$BIT : 7 : not_emergency + +#definizione stati : obbligatorio iniziare da 0 + +$STATE : 0 : ST_Init +$STATE : 1 : ST_Power off +$STATE : 2 : ST_Machine ready +$STATE : 3 : ST_Run +$STATE : 4 : ST_Cycle end +$STATE : 5 : ST_Alarm +$STATE : 6 : ST_Manual +$STATE : 7 : ST_Output full +$STATE : 8 : ST_Input empty +$STATE : 9 : ST_Emergency + +#definizione eventi : obbligatorio iniziare da 0 + +$EVENT : 00 : EV_00 +$EVENT : 01 : EV_01 +$EVENT : 02 : EV_02 +$EVENT : 03 : EV_03 +$EVENT : 04 : EV_04 +$EVENT : 05 : EV_05 +$EVENT : 06 : EV_06 +$EVENT : 07 : EV_07 +$EVENT : 08 : EV_08 +$EVENT : 09 : EV_09 +$EVENT : 10 : EV_10 +$EVENT : 11 : EV_11 +$EVENT : 12 : EV_12 +$EVENT : 13 : HW - init +$EVENT : 14 : HW - power off +$EVENT : 15 : HW - power on +$EVENT : 16 : HW - machining +$EVENT : 17 : HW - end machining +$EVENT : 18 : HW - error +$EVENT : 19 : Barcode - cambio operatore +$EVENT : 20 : Contapezzi +$EVENT : 21 : HW - start pallet +$EVENT : 22 : HW - end pallet +$EVENT : 23 : HW rottura nastro abrasivo +$EVENT : 24 : HW manuale +$EVENT : 25 : HW nastro scarico pieno +$EVENT : 26 : Barcode - Manca Riforn. MPD +$EVENT : 27 : Timer - timeout tempo ciclo +$EVENT : 28 : Timer - timeout TURNO by tempo ciclo +$EVENT : 29 : HW - magazzino grezzi vuoto +$EVENT : 30 : HW - emergenza + + +$RULES + +# state : input : next state : event ------------------------------------------------- + +ALL_STATES : NOT power_on : ST_Power off : HW - power off +ALL_STATES : NOT not_emergency : ST_Emergency : HW - emergenza +ALL_STATES : manual : ST_Manual : HW manuale + +#### ALL_STATES : input_empty : ST_Input empty : HW - magazzino grezzi vuoto + +ALL_STATES : output_full : ST_Output full : HW nastro scarico pieno +ALL_STATES : alarm : ST_Alarm : HW - error + +# rimetta a posto la candela ! + +ALL_STATES : end_cycle : ST_Cycle end : HW - end pallet + +ALL_STATES : run : ST_Run : HW - machining +ALL_STATES : power_on : ST_Machine ready : HW - power on + +$DO diff --git a/StateMachine/src/MapoState/MapoState/resource/geppo.rul b/StateMachine/src/MapoState/MapoState/resource/geppo.rul new file mode 100644 index 0000000..799adf0 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/resource/geppo.rul @@ -0,0 +1,101 @@ +# +# Donati Macchine Pul02,PUL03 ( PLC Enrico ) +# trebi con PLC nuovo +# +# v.2 28-X-2013 segnale contapezzo : non rimandare evento se già nello stato "Cycle end" +# v.3 31-X-2013 ignora magazzino grezzi vuoti +# v.4 9-XII-2013 rimessa regola : se segnale contapezzo, vale per tutti gli stati (eliminando v2) +# +# segnale contapezzo : non rimanda evento se già nello stato "Cycle end" <<<< no dalla versione 4 +# si faceva fottere da 3 o + campioni a 7 in ingresso +# primo input a 7 --> stato end cycle +# secondo input a 7 --> stato run !!! ( mancava la regola ) +# terzo input a 7 --> di nuovo stato end cycle ( e quindi un pezzo in più ) +# +$DEFINITIONS + +$NAME : enrico +$IDX : 15 +$N_STATES : 10 +$N_BITS : 8 + +#definizione bit : obbligatorio iniziare da 0 + +$BIT : 0 : power_on +$BIT : 1 : run +$BIT : 2 : end_cycle +$BIT : 3 : alarm +$BIT : 4 : manual +$BIT : 5 : output_full +$BIT : 6 : input_empty +$BIT : 7 : not_emergency + +#definizione stati : obbligatorio iniziare da 0 + +$STATE : 0 : ST_Init +$STATE : 1 : ST_Power off +$STATE : 2 : ST_Machine ready +$STATE : 3 : ST_Run +$STATE : 4 : ST_Cycle end +$STATE : 5 : ST_Alarm +$STATE : 6 : ST_Manual +$STATE : 7 : ST_Output full +$STATE : 8 : ST_Input empty +$STATE : 9 : ST_Emergency + +#definizione eventi : obbligatorio iniziare da 0 + +$EVENT : 00 : EV_00 +$EVENT : 01 : EV_01 +$EVENT : 02 : EV_02 +$EVENT : 03 : EV_03 +$EVENT : 04 : EV_04 +$EVENT : 05 : EV_05 +$EVENT : 06 : EV_06 +$EVENT : 07 : EV_07 +$EVENT : 08 : EV_08 +$EVENT : 09 : EV_09 +$EVENT : 10 : EV_10 +$EVENT : 11 : EV_11 +$EVENT : 12 : EV_12 +$EVENT : 13 : HW - init +$EVENT : 14 : HW - power off +$EVENT : 15 : HW - power on +$EVENT : 16 : HW - machining +$EVENT : 17 : HW - end machining +$EVENT : 18 : HW - error +$EVENT : 19 : Barcode - cambio operatore +$EVENT : 20 : Contapezzi +$EVENT : 21 : HW - start pallet +$EVENT : 22 : HW - end pallet +$EVENT : 23 : HW rottura nastro abrasivo +$EVENT : 24 : HW manuale +$EVENT : 25 : HW nastro scarico pieno +$EVENT : 26 : Barcode - Manca Riforn. MPD +$EVENT : 27 : Timer - timeout tempo ciclo +$EVENT : 28 : Timer - timeout TURNO by tempo ciclo +$EVENT : 29 : HW - magazzino grezzi vuoto +$EVENT : 30 : HW - emergenza + + +$RULES + +# state : input : next state : event ------------------------------------------------- + +ALL_STATES : NOT power_on : ST_Power off : HW - power off +ALL_STATES : NOT not_emergency : ST_Emergency : HW - emergenza +ALL_STATES : manual : ST_Manual : HW manuale + +#### ALL_STATES : input_empty : ST_Input empty : HW - magazzino grezzi vuoto + +ALL_STATES : output_full : ST_Output full : HW nastro scarico pieno +ALL_STATES : alarm : ST_Alarm : HW - error + +# rimetta a posto la candela ! + +ALL_STATES : end_cycle : ST_Cycle end : HW - end pallet + +ALL_STATES : run : ST_Run : HW - machining +ALL_STATES : power_on : ST_Machine ready : HW - power on + +$DO diff --git a/StateMachine/src/MapoState/MapoState/ship/Config/MapoState.ini b/StateMachine/src/MapoState/MapoState/ship/Config/MapoState.ini new file mode 100644 index 0000000..51ded48 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/ship/Config/MapoState.ini @@ -0,0 +1,10 @@ +[GENERAL] + +Language=ITA +inputpath = C:\Lavori\Mapo\Donati\macchine a stati\ + +Debug = 0 + +[RUL] +edefault=C:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\Resources\15.rul +default = C:\Lavori\Mapo\Donati\macchine a stati\15.rul diff --git a/StateMachine/src/MapoState/MapoState/ship/Icone/strato_bianca.ico b/StateMachine/src/MapoState/MapoState/ship/Icone/strato_bianca.ico new file mode 100644 index 0000000..2d0948b Binary files /dev/null and b/StateMachine/src/MapoState/MapoState/ship/Icone/strato_bianca.ico differ diff --git a/StateMachine/src/MapoState/MapoState/ship/messages/MapoState.ing b/StateMachine/src/MapoState/MapoState/ship/messages/MapoState.ing new file mode 100644 index 0000000..dd72a1d --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/ship/messages/MapoState.ing @@ -0,0 +1,130 @@ +1: (1) +2: (2) +3: Attention !!! +4: File Does Not Exist +5: Data modified but not saved ! Do you want to save ? +6: (6) +7: (7) +8: (8) +9: (9) +10: (10) +11: (11) +12: (12) +13: (13) +14: (14) +15: (15) +16: (16) +17: (17) +18: (18) +19: (19) +20: (20) +21: Load Typ File +22: Save Typ File +23: Exit +24: Load ACD File +25: (25) +26: (26) +27: (27) +28: (28) +29: (29) +30: (30) +31: OverStock +32: Machining +33: Actual ACD File : +34: (34) +35: (35) +36: (36) +37: (37) +38: (38) +39: (39) +40: (40) +41: (41) +42: (42) +43: (43) +44: (44) +45: (45) +46: (46) +47: (47) +48: (48) +49: (49) +50: (50) +51: +52: +53: +54: +55: +56: +57: +58: +59: +60: +61: +62: +63: +64: +65: +66: +67: +68: +69: +70: +71: +72: +73: +74: +75: +76: +77: +78: +79: Problem reading Alarm +80: +81: +82: +83: +84: +85: +86: +87: +88: +89: +90: Ok +91: Cancel +92: Wrong Data in +93: +94: +95: +96: +97: +98: +99: +100: +101: +102: +103: +104: +105: +106: +107: +108: +109: +110: +111: +112: +113: +114: +115: +116: +117: Yes +118: No +119: +120: +121: +122: +123: +124: +125: +126: +127: +128: +129: Already exists + diff --git a/StateMachine/src/MapoState/MapoState/ship/messages/MapoState.ita b/StateMachine/src/MapoState/MapoState/ship/messages/MapoState.ita new file mode 100644 index 0000000..58a2c35 --- /dev/null +++ b/StateMachine/src/MapoState/MapoState/ship/messages/MapoState.ita @@ -0,0 +1,130 @@ +1: (1) +2: (2) +3: Attenzione !!! +4: File Does Not Exist +5: Dati non salvati : Vuoi salvarli ? +6: (6) +7: (7) +8: (8) +9: (9) +10: (10) +11: (11) +12: (12) +13: (13) +14: (14) +15: (15) +16: (16) +17: (17) +18: (18) +19: (19) +20: (20) +21: Carica File regole +22: +23: Esci +24: (24) +25: (25) +26: (26) +27: (27) +28: (28) +29: (29) +30: (30) +31: (31) +32: (32) +33: (33) +34: (34) +35: (35) +36: (36) +37: (37) +38: (38) +39: (39) +40: (40) +41: (41) +42: (42) +43: (43) +44: (44) +45: (45) +46: (46) +47: (47) +48: (48) +49: (49) +50: (50) +51: +52: +53: +54: +55: +56: +57: +58: +59: +60: +61: +62: +63: +64: +65: +66: +67: +68: +69: +70: +71: +72: +73: +74: +75: +76: +77: +78: +79: Problem reading Alarm +80: +81: +82: +83: +84: +85: +86: +87: +88: +89: +90: Ok +91: Cancel +92: Wrong Data in +93: +94: +95: +96: +97: +98: +99: +100: +101: +102: +103: +104: +105: +106: +107: +108: +109: +110: +111: +112: +113: +114: +115: +116: +117: Yes +118: No +119: +120: +121: +122: +123: +124: +125: +126: +127: +128: +129: Already exists + diff --git a/StateMachine/src/MapoState/MapoState/ship/ship.dat b/StateMachine/src/MapoState/MapoState/ship/ship.dat new file mode 100644 index 0000000..89effbd Binary files /dev/null and b/StateMachine/src/MapoState/MapoState/ship/ship.dat differ diff --git a/StateMachine/src/MapoState_02.zip b/StateMachine/src/MapoState_02.zip new file mode 100644 index 0000000..3162b93 Binary files /dev/null and b/StateMachine/src/MapoState_02.zip differ