with Gtk.Menu_Item; use Gtk.Menu_Item; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Glib.Error; use Glib.Error; with Gtk.Widget; use Gtk.Widget; with Gtk.Dialog; use Gtk.Dialog; with Gtk.About_Dialog; use Gtk.About_Dialog; with Gtk.Label; use Gtk.Label; with Glib.Object; use Glib.Object; with Gtk.Text_Buffer; use Gtk.Text_Buffer; with Gtk.Combo_Box; use Gtk.Combo_Box; with Gtk.Text_Iter; use Gtk.Text_Iter; with Gtk.List_Store; use Gtk.List_Store; with Gtk.Tree_Model; use Gtk.Tree_Model; with Gtk.Tree_View; use Gtk.Tree_View; with Gtk.Tree_View_Column; use Gtk.Tree_View_Column; with Glib; use Glib; with Glib.Object; use Glib.Object; with Glib.Values; use Glib.Values; with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with unbounded_strings; use unbounded_strings; with standards_io; use standards_io; with Ada.Numerics.Aux; use Ada.Numerics.Aux; with Processors; use Processors; with Processors.extended; use Processors.extended; --with Update_Processors_Set_Pkg.Callbacks.Integrity_Checks; with unbounded_strings; use unbounded_strings; use unbounded_strings.strings_table_package; with Framework_Config; use Framework_Config; with Buffer_Set; use Buffer_Set; use Buffer_Set.Generic_Buffer_Set; with Resource_Set; use Resource_Set; use Resource_Set.Generic_Resource_Set; with GNAT.Current_Exception; use GNAT.Current_Exception; with Translate; use Translate; with Networks; use Networks; with Task_Set; use Task_Set; use Task_Set.Generic_Task_Set; with Scheduler; use Scheduler; with Scheduler.user_defined.interpreted.pipeline; use Scheduler.user_defined.interpreted.pipeline; with Scheduler.user_defined.interpreted.Automata; use Scheduler.user_defined.interpreted.Automata; with Scheduler_Interface; use Scheduler_Interface; with Processor_Set; use Processor_Set; with standards_io; use standards_io; use standards_io.double_io; with graphical_editor.user_message; use graphical_editor.user_message; with GNAT.Current_Exception; use GNAT.Current_Exception; with core_units; use core_units; package body graphical_editor.cores is core_table_length : constant natural :=16; procedure Initialize_Core(my_tab: in out table_widget_id ; Object : access Gtkada_Builder_Record'Class) is ob1: GObject:= Get_Object(Object, "textbuffer1"); ob2: GObject:= Get_Object(Object, "combobox1"); ob3: GObject:= Get_Object(Object, "textbuffer2"); ob4: GObject:= Get_Object(Object, "combobox2"); ob5: GObject:= Get_Object(Object, "textbuffer3"); ob6: GObject:= Get_Object(Object, "textbuffer4"); ob7: GObject:= Get_Object(Object, "textbuffer5"); --ob8: GObject:= Get_Object(Object, "combobox3"); ob8: GObject:= Get_Object(Object, "textbuffer11"); ob9: GObject:= Get_Object(Object, "textbuffer6"); ob10: GObject:= Get_Object(Object, "textbuffer7"); ob11: GObject:= Get_Object(Object, "textbuffer8"); ob12: GObject:= Get_Object(Object, "textbuffer9"); ob13: GObject:= Get_Object(Object, "textbuffer10"); ob14: GObject:= Get_Object(Object, "liststore4"); ob15: GObject:= Get_Object(Object, "treeview1"); wid1: t_widget := (ptype => buffer_string, buffer_value => Gtk_Text_Buffer(ob1)); wid2: t_widget := (ptype => combo, combo_value => Gtk_Combo_Box(ob2)); wid3: t_widget := (ptype => buffer_integer, buffer_value => Gtk_Text_Buffer(ob3)); wid4: t_widget := (ptype => combo, combo_value => Gtk_Combo_Box(ob4)); wid5: t_widget := (ptype => buffer_string, buffer_value => Gtk_Text_Buffer(ob5)); wid6: t_widget := (ptype => buffer_integer, buffer_value => Gtk_Text_Buffer(ob6)); wid7: t_widget := (ptype => buffer_integer, buffer_value => Gtk_Text_Buffer(ob7)); --wid8: t_widget := (ptype => combo, combo_value => Gtk_Combo_Box(ob8)); wid8: t_widget := (ptype => buffer_integer, buffer_value => Gtk_Text_Buffer(ob8)); wid9: t_widget := (ptype => buffer_string, buffer_value => Gtk_Text_Buffer(ob9)); wid10: t_widget := (ptype => buffer_string, buffer_value => Gtk_Text_Buffer(ob10)); wid11: t_widget := (ptype => buffer_integer, buffer_value => Gtk_Text_Buffer(ob11)); wid12: t_widget := (ptype => buffer_integer, buffer_value => Gtk_Text_Buffer(ob12)); wid13: t_widget := (ptype => buffer_string, buffer_value => Gtk_Text_Buffer(ob13)); wid14: t_widget := (ptype => lists, list_value => Gtk_List_Store(ob14)); wid15: t_widget := (ptype => view, view_value => Gtk_Tree_View(ob15)); wid16: t_widget := (ptype => window, window_value => core_window); begin my_tab(1..core_table_length) := (new t_widget'(wid1), new t_widget'(wid2), new t_widget'(wid3), new t_widget'(wid4), new t_widget'(wid5), new t_widget'(wid6), new t_widget'(wid7), new t_widget'(wid8), new t_widget'(wid9), new t_widget'(wid10), new t_widget'(wid11), new t_widget'(wid12), new t_widget'(wid13), new t_widget'(wid14), new t_widget'(wid15), new t_widget'(wid16)); end initialize_Core; procedure Check_Core(my_tab: in out table_widget_id ; Object : access Gtkada_Builder_Record'Class; Error_Message: in out Unbounded_String; Ok: in out Boolean) is core_scheduler_string, core_string, speed_string, quantum_string, period_string, capacity_string, core_name, core_file_name, core_preemptive_string, core_automaton, core_priority_string: Unbounded_String; core_preemptive: Preemptives_Type; core_speed: Double; core_capacity, core_period, core_priority, core_quantum: Integer; core_scheduler: Schedulers_Type; Integer_Ok : Boolean; double_Ok : Boolean; begin --Ok := True; core_name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(1).buffer_value)); if (core_name = "") then Ok := False; Error_Message := Lb_core_units_name_Mandatory (Current_Language); return; end if; -- end if; core_scheduler_string := to_unbounded_string(Get_Active_Text(Gtk_Combo_Box(my_tab(2).combo_value))); if (core_scheduler_string = "") then Ok := False; Error_Message := Lb_scheduler_type_Mandatory (Current_Language); return; end if; --core_scheduler := Schedulers_Type'value(Get_Active_Text(Gtk_Combo_Box(my_tab(2).combo_value))); -- plutot get compatible de core_scheduler_string core_scheduler := get_compatible_scheduler(Get_Active_Text(Gtk_Combo_Box(my_tab(2).combo_value))); quantum_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(3).buffer_value)); if (Quantum_String = "") then Core_Quantum := 0; else to_integer (Quantum_String, Core_Quantum, Integer_Ok); if not Integer_Ok then Ok := False; Error_Message := "Quantum" & Lb_Must_Be_Numeric (Current_Language); return; end if; end if; core_preemptive_string := to_unbounded_string(Get_Active_Text(Gtk_Combo_Box(my_tab(4).combo_value))); if (core_preemptive_string = "") then Ok := False; Error_Message := Lb_preemptive_type_Mandatory (Current_Language); return; end if; core_preemptive := get_compatible_preemptive(to_unbounded_string(Get_Active_Text(Gtk_Combo_Box(my_tab(4).combo_value)))); speed_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(12).buffer_value)); if (speed_String = "") then Core_speed := 0.0; else to_double (speed_String, Core_speed, double_Ok); if not double_Ok then Error_Message := "Speed" & Lb_Must_Be_Numeric (Current_Language); Ok := False; return; end if; end if; capacity_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(6).buffer_value)); if (capacity_String = "") then core_capacity := 0; else to_integer (capacity_String, Core_capacity, Integer_Ok); if not Integer_Ok then Ok := False; Error_Message := Lb_Capacity (Current_Language) & Lb_Must_Be_Numeric (Current_Language); return; end if; end if; period_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(7).buffer_value)); if (period_String = "") then core_period := 0; else to_integer (period_String, core_period, Integer_Ok); if not Integer_Ok then Ok := False; Error_Message := Lb_Period (Current_Language) & Lb_Must_Be_Numeric (Current_Language); return; end if; end if; --core_priority_string := to_unbounded_string(Get_Active_Text(Gtk_Combo_Box(my_tab(8).combo_value))); --if (core_priority_string = "") then -- Ok := False; -- Error_Message := Lb_priority_Mandatory (Current_Language); -- return; --end if; --core_priority := Integer'value(Get_Active_Text(Gtk_Combo_Box(my_tab(8).combo_value))); core_priority_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(8).buffer_value)); if (core_priority_String = "") then core_priority := 0; else to_integer (core_priority_String, core_priority, Integer_Ok); if not Integer_Ok then Ok := False; Error_Message := Lb_priority (Current_Language) & Lb_Must_Be_Numeric (Current_Language); return; end if; end if; core_file_name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(10).buffer_value)); core_automaton := get_value_buffer_string(Gtk_Text_Buffer(my_tab(5).buffer_value)); Check_core_unit (core_name, core_preemptive, core_quantum, core_speed, core_capacity, core_period, core_priority, core_file_name, core_scheduler, core_automaton); exception when Processor_Set.Invalid_Parameter => begin Ok := False; Error_Message := To_Unbounded_String (Exception_Message); return; end; when others => begin Ok := False; Error_Message := To_Unbounded_String (Exception_Name & Exception_Message); return; end; end Check_Core; -- pour eviter ce pb d'affichage meme quand c'est pas correct, utiliser plutot un add_in_sys qui -- prend juste tab et objet, recupere les valeurs deja checke, ajoute avant d'afficher ... procedure Add_In_Sys_Core(my_tab: in out table_widget_id ; Object : access Gtkada_Builder_Record'Class) is core_scheduler_string, core_string, speed_string, quantum_string, period_string, capacity_string, core_name, core_file_name, core_preemptive_string, core_automaton, core_priority_string: Unbounded_String; core_preemptive: Preemptives_Type; core_speed: Double; core_capacity, core_period, core_priority, core_quantum: Integer; core_scheduler: Schedulers_Type; Integer_Ok : Boolean; double_Ok : Boolean; begin core_name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(1).buffer_value)); core_preemptive := get_compatible_preemptive(to_unbounded_string(Get_Active_Text(Gtk_Combo_Box(my_tab(4).combo_value)))); quantum_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(3).buffer_value)); if (Quantum_String = "") then Core_Quantum := 0; else to_integer (Quantum_String, Core_Quantum, Integer_Ok); --if not Integer_Ok then --Ok := False; -- Error_Message := "Quantum" & --Lb_Must_Be_Numeric (Current_Language); -- return; -- end if; end if; speed_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(12).buffer_value)); if (speed_String = "") then Core_speed := 0.0; else to_double (speed_String, Core_speed, double_Ok); -- if not double_Ok then -- Error_Message := "Speed" & Lb_Must_Be_Numeric (Current_Language); -- Ok := False; -- return; -- end if; end if; capacity_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(6).buffer_value)); if (capacity_String = "") then core_capacity := 0; else to_integer (capacity_String, Core_capacity, Integer_Ok); -- if not Integer_Ok then --Ok := False; -- Error_Message := Lb_Capacity (Current_Language) & -- Lb_Must_Be_Numeric (Current_Language); -- return; -- end if; end if; period_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(7).buffer_value)); if (period_String = "") then core_period := 0; else to_integer (period_String, core_period, Integer_Ok); -- if not Integer_Ok then --Ok := False; -- Error_Message := Lb_Period (Current_Language) & -- Lb_Must_Be_Numeric (Current_Language); -- return; -- end if; end if; --core_priority := Integer'value(Get_Active_Text(Gtk_Combo_Box(my_tab(8).combo_value))); core_priority_string := get_value_buffer_string(Gtk_Text_Buffer(my_tab(8).buffer_value)); if (core_priority_String = "") then core_priority := 0; else to_integer (core_priority_String, core_priority, Integer_Ok); end if; core_file_name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(10).buffer_value)); core_scheduler := get_compatible_scheduler(Get_Active_Text(Gtk_Combo_Box(my_tab(2).combo_value))); core_automaton := get_value_buffer_string(Gtk_Text_Buffer(my_tab(5).buffer_value)); Processor_set.Add_core_unit (sys.Core_units, core_name, core_preemptive, core_quantum, Double(Core_speed), core_capacity, core_period, core_priority, core_file_name, core_scheduler, core_automaton); exception when Processor_Set.Invalid_Parameter => begin Show_Message_Box (Exception_Message); return; end; when others => begin Show_Message_Box (Exception_Name & Exception_Message); return; end; end Add_In_Sys_Core; procedure Deleted_In_Sys_Core(my_tab: in out table_widget_id ; Object : access Gtkada_Builder_Record'Class) is --My_Iterator : core_units_Iterator; A_Core : Core_Unit_Ptr; name_co, name_cmp: unbounded_string; begin name_co := get_value_buffer_string(Gtk_Text_Buffer(my_tab(1).buffer_value)); A_Core := Search_core_unit (sys.core_units, name_co); Delete_core_unit (Sys, A_Core); end Deleted_In_Sys_Core; procedure Show_In_Sys_Core(my_tab: in out table_widget_id ; Object : access Gtkada_Builder_Record'Class) is begin null; end Show_In_Sys_Core; procedure Modify_In_Sys_Core(my_tab: in out table_widget_id ; Object : access Gtkada_Builder_Record'Class; name: unbounded_string) is A_Core, A_Core_Buffer : Core_Unit_Ptr; begin A_Core := Search_core_unit (sys.core_units, name); A_Core_Buffer := A_Core; A_Core_Buffer.cheddar_private_id := A_Core.cheddar_private_id; A_Core_Buffer.name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(1).buffer_value)); A_Core_Buffer.scheduling.preemptive_type := get_compatible_preemptive(to_unbounded_string(Get_Active_Text(Gtk_Combo_Box(my_tab(4).combo_value)))); A_Core_Buffer.scheduling.quantum := get_value_buffer_integer(Gtk_Text_Buffer(my_tab(3).buffer_value)); A_Core_Buffer.speed := get_value_buffer_double(Gtk_Text_Buffer(my_tab(12).buffer_value)); A_Core_Buffer.scheduling.capacity := get_value_buffer_integer(Gtk_Text_Buffer(my_tab(6).buffer_value)); A_Core_Buffer.scheduling.period := get_value_buffer_integer(Gtk_Text_Buffer(my_tab(7).buffer_value)); A_Core_Buffer.scheduling.priority := Priority_Range'value(to_string(get_value_buffer_string(Gtk_Text_Buffer(my_tab(8).buffer_value)))); A_Core_Buffer.scheduling.user_defined_scheduler_source_file_name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(10).buffer_value)); A_Core_Buffer.scheduling.Scheduler_Type := get_compatible_scheduler(Get_Active_Text(Gtk_Combo_Box(my_tab(2).combo_value))); A_Core_Buffer.scheduling.automaton_name := get_value_buffer_string(Gtk_Text_Buffer(my_tab(5).buffer_value)); Check_core_unit (A_Core_Buffer.name, A_Core_Buffer.scheduling.preemptive_type, A_Core_Buffer.scheduling.quantum, A_Core_Buffer.speed, A_Core_Buffer.scheduling.capacity, A_Core_Buffer.scheduling.period, integer(A_Core_Buffer.scheduling.priority), A_Core_Buffer.scheduling.user_defined_scheduler_source_file_name, A_Core_Buffer.scheduling.Scheduler_Type, A_Core_Buffer.scheduling.automaton_name); Delete_core_unit (Sys, A_Core); --Processor_set.Add_core_unit (sys.Core_units, A_Core_Buffer.name, A_Core_Buffer.scheduling.preemptive_type, A_Core_Buffer.scheduling.quantum, A_Core_Buffer.speed, A_Core_Buffer.scheduling.capacity, A_Core_Buffer.scheduling.period, integer(A_Core_Buffer.scheduling.priority), A_Core_Buffer.scheduling.user_defined_scheduler_source_file_name, A_Core_Buffer.scheduling.Scheduler_Type, A_Core_Buffer.scheduling.automaton_name); add (sys.Core_units, A_core_buffer); exception when Processor_Set.Invalid_Parameter => begin Show_Message_Box (Exception_Message); return; end; when others => begin Show_Message_Box (Exception_Name & Exception_Message); return; end; end Modify_In_Sys_Core; function get_compatible_scheduler(myscheduler: String) return Schedulers_Type is myscheduler_sched : Schedulers_Type; begin if to_Unbounded_String(myscheduler) = to_Unbounded_String("Compiled User Defined Protocol") then myscheduler_sched := Compiled_User_Defined_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Automata User Defined Protocol") then myscheduler_sched := Automata_User_Defined_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Pipeline User Defined Protocol") then myscheduler_sched := Pipeline_User_Defined_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("User Defined Protocol") then myscheduler_sched := User_Defined_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Earliest Deadline First Protocol") then myscheduler_sched := Earliest_Deadline_First_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Least Laxity First Protocol") then myscheduler_sched := Least_Laxity_First_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Rate Monotonic Protocol") then myscheduler_sched := Rate_Monotonic_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Deadline Monotonic Protocol") then myscheduler_sched := Deadline_Monotonic_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Round Robin Protocol") then myscheduler_sched := Round_Robin_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Time Sharing Based On Wait Time Protocol") then myscheduler_sched := Time_Sharing_Based_On_Wait_Time_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Posix 1003 Highest Priority First Protocol") then myscheduler_sched := Posix_1003_Highest_Priority_First_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("D Over Protocol") then myscheduler_sched := D_Over_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Maximum Urgency First Based On Laxity Protocol") then myscheduler_sched := Maximum_Urgency_First_Based_On_Laxity_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Maximum Urgency First Based On Deadline Protocol") then myscheduler_sched := Maximum_Urgency_First_Based_On_Deadline_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Time Sharing Based On Cpu Usage Protocol") then myscheduler_sched := Time_Sharing_Based_On_Cpu_Usage_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("No Scheduling Protocol") then myscheduler_sched := No_Scheduling_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Cyclic Protocol") then myscheduler_sched := Hierarchical_Cyclic_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Round Robin Protocol") then myscheduler_sched := Hierarchical_Round_Robin_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Fixed Priority Protocol") then myscheduler_sched := Hierarchical_Fixed_Priority_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Polling Aperiodic Server Protocol") then myscheduler_sched := Hierarchical_Polling_Aperiodic_Server_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Priority Exchange Aperiodic Server Protocol") then myscheduler_sched := Hierarchical_Priority_Exchange_Aperiodic_Server_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Sporadic Aperiodic Server Protocol") then myscheduler_sched := Hierarchical_Sporadic_Aperiodic_Server_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Hierarchical Deferrable Aperiodic Server Protocol") then myscheduler_sched := Hierarchical_Deferrable_Aperiodic_Server_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Proportionate Fair PF Protocol") then myscheduler_sched := Proportionate_Fair_PF_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Proportionate Fair PD Protocol") then myscheduler_sched := Proportionate_Fair_PD_Protocol; end if; if to_Unbounded_String(myscheduler) = to_Unbounded_String("Proportionate Fair PD2 Protocol") then myscheduler_sched := Proportionate_Fair_PD2_Protocol; end if; return myscheduler_sched; end get_compatible_scheduler; function get_compatible_scheduler(myscheduler: Gvalue) return Schedulers_Type is begin return get_compatible_scheduler(Get_String(myscheduler)); end get_compatible_scheduler; function get_compatible_scheduler(myscheduler: schedulers_type) return unbounded_string is myscheduler_string: unbounded_string; begin --myscheduler_string:=to_Unbounded_String(schedulers_type'image(myscheduler)); if myscheduler = Compiled_User_Defined_Protocol then myscheduler_string:= to_Unbounded_String("Compiled User Defined Protocol"); end if; if myscheduler = Automata_User_Defined_Protocol then myscheduler_string:= to_Unbounded_String("Automata User Defined Protocol"); end if; if myscheduler = Pipeline_User_Defined_Protocol then myscheduler_string:= to_Unbounded_String("Pipeline User Defined Protocol"); end if; if myscheduler = User_Defined_Protocol then myscheduler_string:= to_Unbounded_String("User Defined Protocol"); end if; if myscheduler = Earliest_Deadline_First_Protocol then myscheduler_string:= to_Unbounded_String("Earliest Deadline First Protocol"); end if; if myscheduler = Least_Laxity_First_Protocol then myscheduler_string:= to_Unbounded_String("Least Laxity First Protocol"); end if; if myscheduler = Rate_Monotonic_Protocol then myscheduler_string:= to_Unbounded_String("Rate Monotonic Protocol"); end if; if myscheduler = Deadline_Monotonic_Protocol then myscheduler_string:= to_Unbounded_String("Deadline Monotonic Protocol"); end if; if myscheduler = Round_Robin_Protocol then myscheduler_string:= to_Unbounded_String("Round Robin Protocol"); end if; if myscheduler = Time_Sharing_Based_On_Wait_Time_Protocol then myscheduler_string:= to_Unbounded_String("Time Sharing Based On Wait Time Protocol"); end if; if myscheduler = Posix_1003_Highest_Priority_First_Protocol then myscheduler_string:= to_Unbounded_String("Posix 1003 Highest Priority First Protocol"); end if; if myscheduler = D_Over_Protocol then myscheduler_string:= to_Unbounded_String("D Over Protocol"); end if; if myscheduler = Maximum_Urgency_First_Based_On_Laxity_Protocol then myscheduler_string:= to_Unbounded_String("Maximum Urgency First Based On Laxity Protocol"); end if; if myscheduler = Maximum_Urgency_First_Based_On_Deadline_Protocol then myscheduler_string:= to_Unbounded_String("Maximum Urgency First Based On Deadline Protocol"); end if; if myscheduler = Time_Sharing_Based_On_Cpu_Usage_Protocol then myscheduler_string:= to_Unbounded_String("Time Sharing Based On Cpu Usage Protocol"); end if; if myscheduler = No_Scheduling_Protocol then myscheduler_string:= to_Unbounded_String("No Scheduling Protocol"); end if; if myscheduler = Hierarchical_Cyclic_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Cyclic Protocol"); end if; if myscheduler = Hierarchical_Round_Robin_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Round Robin Protocol"); end if; if myscheduler = Hierarchical_Fixed_Priority_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Fixed Priority Protocol"); end if; if myscheduler = Hierarchical_Polling_Aperiodic_Server_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Polling Aperiodic Server Protocol"); end if; if myscheduler = Hierarchical_Priority_Exchange_Aperiodic_Server_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Priority Exchange Aperiodic Server Protocol"); end if; if myscheduler = Hierarchical_Sporadic_Aperiodic_Server_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Sporadic Aperiodic Server Protocol"); end if; if myscheduler = Hierarchical_Deferrable_Aperiodic_Server_Protocol then myscheduler_string:= to_Unbounded_String("Hierarchical Deferrable Aperiodic Server Protocol"); end if; if myscheduler = Proportionate_Fair_PF_Protocol then myscheduler_string:= to_Unbounded_String("Proportionate Fair PF Protocol"); end if; if myscheduler = Proportionate_Fair_PD_Protocol then myscheduler_string:= to_Unbounded_String("Proportionate Fair PD Protocol"); end if; if myscheduler = Proportionate_Fair_PD2_Protocol then myscheduler_string:= to_Unbounded_String("Proportionate Fair PD2 Protocol"); end if; return myscheduler_string; end get_compatible_scheduler; function get_compatible_preemptive(mypreemptive: preemptives_type) return unbounded_string is mypreemptive_string: Unbounded_String; begin --mypreemptive_string:=to_Unbounded_String(preemptives_type'image(mypreemptive)); if mypreemptive = preemptive then mypreemptive_string:= to_Unbounded_String("Preemptive"); end if; if mypreemptive = not_preemptive then mypreemptive_string:= to_Unbounded_String("Not Preemptive"); end if; return mypreemptive_string; end get_compatible_preemptive; function get_compatible_preemptive(mypreemptive: Unbounded_String) return preemptives_type is mypreemptive_prem: preemptives_type; begin if mypreemptive = to_Unbounded_String("Preemptive") then mypreemptive_prem := preemptive; end if; if mypreemptive = to_Unbounded_String("Not Preemptive") then mypreemptive_prem := not_preemptive; end if; return mypreemptive_prem; end get_compatible_preemptive; function get_compatible_preemptive(mypreemptive: GValue) return preemptives_type is mypreemptive_prem: preemptives_type; begin if to_Unbounded_String(Get_String(mypreemptive)) = to_Unbounded_String("Preemptive") then mypreemptive_prem := preemptive; end if; if to_Unbounded_String(Get_String(mypreemptive)) = to_Unbounded_String("Not Preemptive") then mypreemptive_prem := not_preemptive; end if; return mypreemptive_prem; end get_compatible_preemptive; package core_callbacks is new generic_callbacks(Number_of_widget => core_table_length, Initialize => initialize_Core, Check => Check_Core, Add_In_Sys => Add_In_Sys_Core, Deleted_In_Sys => Deleted_In_Sys_Core, Modify_In_Sys => Modify_In_Sys_Core, Show_In_Sys => Show_In_Sys_Core); use core_callbacks; procedure Show_Core_Widget is Builder : Gtkada_Builder; Error : Glib.Error.GError; tree_iter: Gtk_Tree_Iter; A_Core : Core_Unit_Ptr; My_Iterator : core_units_Iterator; liststore: GObject; --My_Scheduler : Generic_Scheduler_Ptr; begin Gtk.Main.Init; Gtk_New (Builder); Error := Add_From_File (Builder, to_string(Glade_path) & "core.glade"); if Error /= null then Ada.Text_IO.Put_Line ("Error : " & Get_Message (Error)); Error_Free (Error); return; end if; Sys_buffer := sys; Set_Active (Gtk_Combo_Box(Get_Object(Builder, "combobox1")), 0); Set_Active (Gtk_Combo_Box(Get_Object(Builder, "combobox2")), 0); liststore:= Get_Object(Builder, "liststore4"); reset_iterator (sys.Core_units, My_Iterator); if not is_empty (sys.Core_units) then loop current_element (sys.Core_units, A_Core, My_Iterator); --My_Scheduler := extended_Core_Unit_Ptr (A_Core).scheduler; Append(Gtk_List_Store(liststore), tree_iter); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 0, To_String (A_Core.name)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 1, To_String(get_compatible_scheduler (A_Core.scheduling.Scheduler_Type))); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 2, Gint(A_Core.scheduling.quantum)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 3, To_String(get_compatible_preemptive (A_Core.scheduling.preemptive_type))); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 4, To_String(A_Core.scheduling.automaton_name)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 5, Gint(A_Core.scheduling.capacity)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 6, Gint(A_Core.scheduling.period)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 7, Gint(A_Core.scheduling.priority)); --Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 7, Priority_Range'image(A_Core.scheduling.priority)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 8, To_String(A_Core.scheduling.user_defined_scheduler_source)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 9, To_String (A_Core.scheduling.user_defined_scheduler_source_file_name)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 10, Gint(A_Core.scheduling.start_time)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 11, Gint(A_Core.speed)); Gtk.List_Store.Set(Gtk_List_Store(liststore), tree_iter, 12, To_String (A_Core.l1_cache_system_name)); exit when is_last_element (sys.Core_units, My_Iterator); next_element (sys.Core_units, My_Iterator); end loop; end if; Gtkada.Builder.Register_Handler (Builder => Builder, Handler_Name => "on_button6_clicked", Handler => core_callbacks.Add_View'Access); Gtkada.Builder.Register_Handler (Builder => Builder, Handler_Name => "on_button4_clicked", Handler => core_callbacks.Delected_Lign_Selected'Access); --Gtkada.Builder.Register_Handler --(Builder => Builder, --Handler_Name => "on_button3_clicked", --Handler => core_callbacks.Show_View'Access); Gtkada.Builder.Register_Handler (Builder => Builder, Handler_Name => "on_button2_clicked", Handler => core_callbacks.Cancel_View'Access); Gtkada.Builder.Register_Handler (Builder => Builder, Handler_Name => "on_treeview1_cursor_changed", Handler => core_callbacks.Show_Lign_Selected'Access); Gtkada.Builder.Register_Handler (Builder => Builder, Handler_Name => "on_button5_clicked", Handler => core_callbacks.Modify_Lign'Access); Gtkada.Builder.Register_Handler (Builder => Builder, Handler_Name => "on_button1_clicked", Handler => core_callbacks.Close_View'Access); Do_Connect (Builder); Gtk.Widget.Show_All (Get_Widget (Builder, "window1")); Gtk.Main.Main; Unref (Builder); end Show_Core_Widget; end graphical_editor.cores;