diff options
Diffstat (limited to 'mixgtk')
| -rw-r--r-- | mixgtk/Makefile.am | 3 | ||||
| -rw-r--r-- | mixgtk/mixgtk.c | 9 | ||||
| -rw-r--r-- | mixgtk/mixgtk.glade | 496 | ||||
| -rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.c | 20 | ||||
| -rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.h | 6 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixal.c | 115 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixal.h | 45 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixvm.c | 83 | ||||
| -rw-r--r-- | mixgtk/mixgtk_mixvm.h | 17 | ||||
| -rw-r--r-- | mixgtk/mixgtk_widgets.c | 8 | ||||
| -rw-r--r-- | mixgtk/mixgtk_widgets.h | 8 | 
11 files changed, 554 insertions, 256 deletions
| diff --git a/mixgtk/Makefile.am b/mixgtk/Makefile.am index 881ec99..ab7d069 100644 --- a/mixgtk/Makefile.am +++ b/mixgtk/Makefile.am @@ -19,7 +19,8 @@ mixgtk_SOURCES = mixgtk.c mixgtk_gen_handlers.h mixgtk_gen_handlers.c \  		 mixgtk_cmd_dispatcher.h mixgtk_cmd_dispatcher.c \                   mixgtk_widgets.h mixgtk_widgets.c \                   mixgtk_device.h mixgtk_device.c \ -                 mixgtk_mixvm.h mixgtk_mixvm.c +                 mixgtk_mixvm.h mixgtk_mixvm.c \ +                 mixgtk_mixal.h mixgtk_mixal.c diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c index 1e4abf1..ac460ec 100644 --- a/mixgtk/mixgtk.c +++ b/mixgtk/mixgtk.c @@ -1,7 +1,7 @@  /* -*-c-*- -------------- mixgtk.c :   * Main function of the mix gtk front-end   * ------------------------------------------------------------------ - *  Last change: Time-stamp: "01/03/07 23:14:56 jose" + *  Last change: Time-stamp: "01/03/10 00:03:23 jose"   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -28,6 +28,7 @@  #include "mixgtk_cmd_dispatcher.h"  #include "mixgtk_device.h"  #include "mixgtk_mixvm.h" +#include "mixgtk_mixal.h"  int  main(int argc, char *argv[]) @@ -66,6 +67,12 @@ main(int argc, char *argv[])        g_error ("Unable to initialise application (mixvm widgets)\n");        return EXIT_FAILURE;      } + +  if (!mixgtk_mixal_init (vm)) +    { +      g_error ("Unable to initialise application (mixal widgets)\n"); +      return EXIT_FAILURE; +    }    gtk_main(); diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade index 188332e..b1d7927 100644 --- a/mixgtk/mixgtk.glade +++ b/mixgtk/mixgtk.glade @@ -177,7 +177,7 @@  	    <editable>False</editable>  	    <text_visible>True</text_visible>  	    <text_max_length>0</text_max_length> -	    <text>- 00 23</text> +	    <text></text>  	  </widget>  	  <widget> @@ -191,7 +191,7 @@  	    <editable>False</editable>  	    <text_visible>True</text_visible>  	    <text_max_length>0</text_max_length> -	    <text>+ 01 45 34 49 49</text> +	    <text></text>  	  </widget>  	  <widget> @@ -266,20 +266,6 @@  	  <widget>  	    <class>GtkEntry</class> -	    <name>rI5_entry</name> -	    <x>168</x> -	    <y>144</y> -	    <width>60</width> -	    <height>22</height> -	    <can_focus>True</can_focus> -	    <editable>False</editable> -	    <text_visible>True</text_visible> -	    <text_max_length>0</text_max_length> -	    <text></text> -	  </widget> - -	  <widget> -	    <class>GtkEntry</class>  	    <name>rI6_entry</name>  	    <x>168</x>  	    <y>200</y> @@ -421,15 +407,6 @@  	  </widget>  	  <widget> -	    <class>GtkHSeparator</class> -	    <name>hseparator1</name> -	    <x>8</x> -	    <y>232</y> -	    <width>377</width> -	    <height>16</height> -	  </widget> - -	  <widget>  	    <class>GtkVSeparator</class>  	    <name>vseparator2</name>  	    <x>0</x> @@ -530,58 +507,118 @@  	  </widget>  	  <widget> -	    <class>GtkLabel</class> -	    <name>elapsed_label</name> -	    <x>64</x> -	    <y>248</y> -	    <width>48</width> -	    <height>16</height> -	    <label>000000</label> -	    <justify>GTK_JUSTIFY_CENTER</justify> -	    <wrap>False</wrap> -	    <xalign>0.5</xalign> -	    <yalign>0.5</yalign> -	    <xpad>0</xpad> -	    <ypad>0</ypad> +	    <class>GtkVSeparator</class> +	    <name>vseparator1</name> +	    <x>376</x> +	    <y>10</y> +	    <width>16</width> +	    <height>263</height>  	  </widget>  	  <widget> -	    <class>GtkLabel</class> -	    <name>program_label</name> -	    <x>184</x> -	    <y>248</y> -	    <width>56</width> -	    <height>16</height> -	    <label>000000</label> -	    <justify>GTK_JUSTIFY_CENTER</justify> -	    <wrap>False</wrap> -	    <xalign>0.5</xalign> -	    <yalign>0.5</yalign> -	    <xpad>0</xpad> -	    <ypad>0</ypad> +	    <class>GtkScrolledWindow</class> +	    <name>memory_scroll</name> +	    <x>392</x> +	    <y>16</y> +	    <width>215</width> +	    <height>248</height> +	    <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> +	    <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> +	    <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> +	    <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + +	    <widget> +	      <class>GtkCList</class> +	      <name>memory_cells</name> +	      <width>200</width> +	      <height>248</height> +	      <can_focus>True</can_focus> +	      <columns>2</columns> +	      <column_widths>53,135</column_widths> +	      <selection_mode>GTK_SELECTION_SINGLE</selection_mode> +	      <show_titles>True</show_titles> +	      <shadow_type>GTK_SHADOW_IN</shadow_type> + +	      <widget> +		<class>GtkLabel</class> +		<child_name>CList:title</child_name> +		<name>label165</name> +		<label>address</label> +		<justify>GTK_JUSTIFY_CENTER</justify> +		<wrap>False</wrap> +		<xalign>0.5</xalign> +		<yalign>0.5</yalign> +		<xpad>0</xpad> +		<ypad>0</ypad> +	      </widget> + +	      <widget> +		<class>GtkLabel</class> +		<child_name>CList:title</child_name> +		<name>label166</name> +		<label>contents</label> +		<justify>GTK_JUSTIFY_CENTER</justify> +		<wrap>False</wrap> +		<xalign>0.5</xalign> +		<yalign>0.5</yalign> +		<xpad>0</xpad> +		<ypad>0</ypad> +	      </widget> +	    </widget>  	  </widget>  	  <widget> -	    <class>GtkLabel</class> -	    <name>uptime_label</name> -	    <x>296</x> -	    <y>248</y> -	    <width>72</width> -	    <height>16</height> -	    <label>00000000</label> -	    <justify>GTK_JUSTIFY_CENTER</justify> -	    <wrap>False</wrap> -	    <xalign>0.5</xalign> -	    <yalign>0.5</yalign> -	    <xpad>0</xpad> -	    <ypad>0</ypad> +	    <class>GtkEntry</class> +	    <name>rI5_entry</name> +	    <x>168</x> +	    <y>144</y> +	    <width>60</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkEntry</class> +	    <name>loc_entry</name> +	    <x>300</x> +	    <y>200</y> +	    <width>40</width> +	    <height>22</height> +	    <can_focus>True</can_focus> +	    <editable>False</editable> +	    <text_visible>True</text_visible> +	    <text_max_length>0</text_max_length> +	    <text></text> +	  </widget> + +	  <widget> +	    <class>GtkRadioButton</class> +	    <name>lesser_radio</name> +	    <x>264</x> +	    <y>128</y> +	    <width>35</width> +	    <height>24</height> +	    <can_focus>True</can_focus> +	    <signal> +	      <name>toggled</name> +	      <handler>on_cmp_l_toggled</handler> +	      <last_modification_time>Tue, 06 Mar 2001 21:21:51 GMT</last_modification_time> +	    </signal> +	    <label>L</label> +	    <active>False</active> +	    <draw_indicator>True</draw_indicator> +	    <group>cmp_group</group>  	  </widget>  	  <widget>  	    <class>GtkRadioButton</class>  	    <name>equal_radio</name> -	    <x>312</x> -	    <y>136</y> +	    <x>304</x> +	    <y>128</y>  	    <width>31</width>  	    <height>24</height>  	    <can_focus>True</can_focus> @@ -600,7 +637,7 @@  	    <class>GtkRadioButton</class>  	    <name>greater_radio</name>  	    <x>336</x> -	    <y>160</y> +	    <y>128</y>  	    <width>32</width>  	    <height>24</height>  	    <can_focus>True</can_focus> @@ -616,38 +653,100 @@  	  </widget>  	  <widget> -	    <class>GtkRadioButton</class> -	    <name>lesser_radio</name> -	    <x>288</x> -	    <y>160</y> -	    <width>35</width> -	    <height>24</height> +	    <class>GtkLabel</class> +	    <name>label167</name> +	    <x>256</x> +	    <y>200</y> +	    <width>48</width> +	    <height>16</height> +	    <label>LOC</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkButton</class> +	    <name>loc_arrow</name> +	    <x>346</x> +	    <y>202</y> +	    <width>29</width> +	    <height>18</height>  	    <can_focus>True</can_focus>  	    <signal> -	      <name>toggled</name> -	      <handler>on_cmp_l_toggled</handler> -	      <last_modification_time>Tue, 06 Mar 2001 21:21:51 GMT</last_modification_time> +	      <name>clicked</name> +	      <handler>on_loc_arrow_clicked</handler> +	      <last_modification_time>Fri, 09 Mar 2001 20:18:22 GMT</last_modification_time>  	    </signal> -	    <label>L</label> -	    <active>False</active> -	    <draw_indicator>True</draw_indicator> -	    <group>cmp_group</group> +	    <label>-></label> +	    <relief>GTK_RELIEF_NONE</relief>  	  </widget>  	  <widget> -	    <class>GtkVSeparator</class> -	    <name>vseparator1</name> -	    <x>376</x> -	    <y>10</y> -	    <width>16</width> -	    <height>263</height> +	    <class>GtkHSeparator</class> +	    <name>hseparator1</name> +	    <x>8</x> +	    <y>232</y> +	    <width>377</width> +	    <height>16</height> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>program_label</name> +	    <x>184</x> +	    <y>248</y> +	    <width>56</width> +	    <height>16</height> +	    <label>000000</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>elapsed_label</name> +	    <x>64</x> +	    <y>248</y> +	    <width>48</width> +	    <height>16</height> +	    <label>000000</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad> +	  </widget> + +	  <widget> +	    <class>GtkLabel</class> +	    <name>uptime_label</name> +	    <x>296</x> +	    <y>248</y> +	    <width>72</width> +	    <height>16</height> +	    <label>00000000</label> +	    <justify>GTK_JUSTIFY_CENTER</justify> +	    <wrap>False</wrap> +	    <xalign>0.5</xalign> +	    <yalign>0.5</yalign> +	    <xpad>0</xpad> +	    <ypad>0</ypad>  	  </widget>  	  <widget>  	    <class>GtkCheckButton</class>  	    <name>over_toggle</name> -	    <x>296</x> -	    <y>200</y> +	    <x>288</x> +	    <y>156</y>  	    <width>72</width>  	    <height>24</height>  	    <can_focus>True</can_focus> @@ -660,56 +759,76 @@  	    <active>False</active>  	    <draw_indicator>True</draw_indicator>  	  </widget> +	</widget> + +	<widget> +	  <class>GtkLabel</class> +	  <child_name>Notebook:tab</child_name> +	  <name>label105</name> +	  <label>MIX</label> +	  <justify>GTK_JUSTIFY_CENTER</justify> +	  <wrap>False</wrap> +	  <xalign>0.5</xalign> +	  <yalign>0.5</yalign> +	  <xpad>0</xpad> +	  <ypad>0</ypad> +	</widget> + +	<widget> +	  <class>GtkScrolledWindow</class> +	  <name>mixal_scroll</name> +	  <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> +	  <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> +	  <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> +	  <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>  	  <widget> -	    <class>GtkScrolledWindow</class> -	    <name>memory_scroll</name> -	    <x>392</x> -	    <y>16</y> -	    <width>215</width> -	    <height>248</height> -	    <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> -	    <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> -	    <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> -	    <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> +	    <class>GtkCList</class> +	    <name>mixal_clist</name> +	    <can_focus>True</can_focus> +	    <columns>3</columns> +	    <column_widths>60,114,80</column_widths> +	    <selection_mode>GTK_SELECTION_SINGLE</selection_mode> +	    <show_titles>True</show_titles> +	    <shadow_type>GTK_SHADOW_IN</shadow_type>  	    <widget> -	      <class>GtkCList</class> -	      <name>memory_cells</name> -	      <width>200</width> -	      <height>248</height> -	      <can_focus>True</can_focus> -	      <columns>2</columns> -	      <column_widths>53,135</column_widths> -	      <selection_mode>GTK_SELECTION_SINGLE</selection_mode> -	      <show_titles>True</show_titles> -	      <shadow_type>GTK_SHADOW_IN</shadow_type> +	      <class>GtkLabel</class> +	      <child_name>CList:title</child_name> +	      <name>label168</name> +	      <label>address</label> +	      <justify>GTK_JUSTIFY_CENTER</justify> +	      <wrap>False</wrap> +	      <xalign>0.5</xalign> +	      <yalign>0.5</yalign> +	      <xpad>0</xpad> +	      <ypad>0</ypad> +	    </widget> -	      <widget> -		<class>GtkLabel</class> -		<child_name>CList:title</child_name> -		<name>label165</name> -		<label>address</label> -		<justify>GTK_JUSTIFY_CENTER</justify> -		<wrap>False</wrap> -		<xalign>0.5</xalign> -		<yalign>0.5</yalign> -		<xpad>0</xpad> -		<ypad>0</ypad> -	      </widget> +	    <widget> +	      <class>GtkLabel</class> +	      <child_name>CList:title</child_name> +	      <name>label169</name> +	      <label>contents</label> +	      <justify>GTK_JUSTIFY_CENTER</justify> +	      <wrap>False</wrap> +	      <xalign>0.5</xalign> +	      <yalign>0.5</yalign> +	      <xpad>0</xpad> +	      <ypad>0</ypad> +	    </widget> -	      <widget> -		<class>GtkLabel</class> -		<child_name>CList:title</child_name> -		<name>label166</name> -		<label>contents</label> -		<justify>GTK_JUSTIFY_CENTER</justify> -		<wrap>False</wrap> -		<xalign>0.5</xalign> -		<yalign>0.5</yalign> -		<xpad>0</xpad> -		<ypad>0</ypad> -	      </widget> +	    <widget> +	      <class>GtkLabel</class> +	      <child_name>CList:title</child_name> +	      <name>label170</name> +	      <label>source</label> +	      <justify>GTK_JUSTIFY_CENTER</justify> +	      <wrap>False</wrap> +	      <xalign>0.5</xalign> +	      <yalign>0.5</yalign> +	      <xpad>0</xpad> +	      <ypad>0</ypad>  	    </widget>  	  </widget>  	</widget> @@ -717,8 +836,8 @@  	<widget>  	  <class>GtkLabel</class>  	  <child_name>Notebook:tab</child_name> -	  <name>label105</name> -	  <label>MIX</label> +	  <name>label106</name> +	  <label>MIXAL</label>  	  <justify>GTK_JUSTIFY_CENTER</justify>  	  <wrap>False</wrap>  	  <xalign>0.5</xalign> @@ -771,115 +890,6 @@  	  <xpad>0</xpad>  	  <ypad>0</ypad>  	</widget> - -	<widget> -	  <class>GtkVBox</class> -	  <name>vbox2</name> -	  <homogeneous>False</homogeneous> -	  <spacing>0</spacing> - -	  <widget> -	    <class>GtkScrolledWindow</class> -	    <name>scrolledwindow26</name> -	    <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> -	    <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> -	    <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> -	    <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> -	    <child> -	      <padding>0</padding> -	      <expand>True</expand> -	      <fill>True</fill> -	    </child> - -	    <widget> -	      <class>GtkText</class> -	      <name>mixal_text</name> -	      <can_focus>True</can_focus> -	      <editable>False</editable> -	      <text>*** sample program -             ORG  2000 -START   LDA   1000 -....</text> -	    </widget> -	  </widget> - -	  <widget> -	    <class>GtkScrolledWindow</class> -	    <name>scrolledwindow27</name> -	    <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy> -	    <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> -	    <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> -	    <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> -	    <child> -	      <padding>0</padding> -	      <expand>True</expand> -	      <fill>True</fill> -	    </child> - -	    <widget> -	      <class>GtkCList</class> -	      <name>prog_info_clist</name> -	      <can_focus>True</can_focus> -	      <columns>3</columns> -	      <column_widths>80,173,80</column_widths> -	      <selection_mode>GTK_SELECTION_SINGLE</selection_mode> -	      <show_titles>True</show_titles> -	      <shadow_type>GTK_SHADOW_IN</shadow_type> - -	      <widget> -		<class>GtkLabel</class> -		<child_name>CList:title</child_name> -		<name>label110</name> -		<label>address</label> -		<justify>GTK_JUSTIFY_CENTER</justify> -		<wrap>False</wrap> -		<xalign>0.5</xalign> -		<yalign>0.5</yalign> -		<xpad>0</xpad> -		<ypad>0</ypad> -	      </widget> - -	      <widget> -		<class>GtkLabel</class> -		<child_name>CList:title</child_name> -		<name>label111</name> -		<label>translation</label> -		<justify>GTK_JUSTIFY_CENTER</justify> -		<wrap>False</wrap> -		<xalign>0.5</xalign> -		<yalign>0.5</yalign> -		<xpad>0</xpad> -		<ypad>0</ypad> -	      </widget> - -	      <widget> -		<class>GtkLabel</class> -		<child_name>CList:title</child_name> -		<name>label112</name> -		<label>binary</label> -		<justify>GTK_JUSTIFY_CENTER</justify> -		<wrap>False</wrap> -		<xalign>0.5</xalign> -		<yalign>0.5</yalign> -		<xpad>0</xpad> -		<ypad>0</ypad> -	      </widget> -	    </widget> -	  </widget> -	</widget> - -	<widget> -	  <class>GtkLabel</class> -	  <child_name>Notebook:tab</child_name> -	  <name>label106</name> -	  <label>MIXAL</label> -	  <justify>GTK_JUSTIFY_CENTER</justify> -	  <wrap>False</wrap> -	  <xalign>0.5</xalign> -	  <yalign>0.5</yalign> -	  <xpad>0</xpad> -	  <ypad>0</ypad> -	</widget>        </widget>        <widget> diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c index dc64f2f..d14c5ee 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.c +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -1,7 +1,7 @@  /* -*-c-*- -------------- mixgtk_cmd_dispatcher.c :   * Implementation of the functions declared in mixgtk_cmd_dispatcher.h   * ------------------------------------------------------------------ - *  Last change: Time-stamp: "01/03/07 23:17:54 jose" + *  Last change: Time-stamp: "01/03/10 00:49:04 jose"   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -27,6 +27,7 @@  #include <mixlib/mix_vm_command.h>  #include "mixgtk_cmd_dispatcher.h"  #include "mixgtk_mixvm.h" +#include "mixgtk_mixal.h"  /* a mix vm command dispatcher */ @@ -85,18 +86,22 @@ static void  load_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg,  		 gpointer data)  { +  mixgtk_mixal_load_file (); +  mixgtk_mixal_update ();  }  static void  run_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg,  		 gpointer data)  { +  mixgtk_mixal_update ();  }  static void  next_post_hook_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg,  		 gpointer data)  { +  mixgtk_mixal_update ();  } @@ -119,6 +124,7 @@ mixgtk_cmd_dispatcher_init (void)        if (!out) return FALSE;        dis_data_.out = out;        dis_data_.dispatcher = mix_vm_cmd_dispatcher_new (out, out); +      mix_vm_cmd_dispatcher_print_time (dis_data_.dispatcher, FALSE);        mix_vm_cmd_dispatcher_global_pre_hook (dis_data_.dispatcher,  					     global_pre_hook_, NULL);        mix_vm_cmd_dispatcher_global_post_hook (dis_data_.dispatcher, @@ -147,6 +153,18 @@ mixgtk_cmd_dispatcher_dispatch (const gchar *command)    on_mixvm_cmd_entry_activate (entry, NULL);  } +/* get times */ +void +mixgtk_cmd_dispatcher_get_times (gint *uptime, gint *progtime, gint *laptime) +{ +  if (uptime != NULL) +    *uptime = mix_vm_cmd_dispatcher_get_uptime (dis_data_.dispatcher); +  if (progtime != NULL) +    *progtime = mix_vm_cmd_dispatcher_get_progtime (dis_data_.dispatcher); +  if (laptime != NULL) +    *laptime = mix_vm_cmd_dispatcher_get_laptime (dis_data_.dispatcher); +} +  /* get the underlying vm */  extern mix_vm_t *  mixgtk_cmd_dispatcher_get_vm (void) diff --git a/mixgtk/mixgtk_cmd_dispatcher.h b/mixgtk/mixgtk_cmd_dispatcher.h index b0beb17..686ba4d 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.h +++ b/mixgtk/mixgtk_cmd_dispatcher.h @@ -1,7 +1,7 @@  /* -*-c-*- ---------------- mixgtk_cmd_dispatcher.h :   * functions to access the command dispatcher   * ------------------------------------------------------------------ - *  Last change: Time-stamp: <01/03/06 22:29:57 jose> + *  Last change: Time-stamp: <01/03/09 22:08:08 jose>   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -36,6 +36,10 @@ mixgtk_cmd_dispatcher_init (void);  extern void  mixgtk_cmd_dispatcher_dispatch (const gchar *command); +/* get times */ +extern void +mixgtk_cmd_dispatcher_get_times (gint *uptime, gint *progtime, gint *laptime); +  /* get the underlying vm */  extern mix_vm_t *  mixgtk_cmd_dispatcher_get_vm (void); diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c new file mode 100644 index 0000000..d3ce72b --- /dev/null +++ b/mixgtk/mixgtk_mixal.c @@ -0,0 +1,115 @@ +/* -*-c-*- -------------- mixgtk_mixal.c : + * Implementation of the functions declared in mixgtk_mixal.h + * ------------------------------------------------------------------ + *  Last change: Time-stamp: "01/03/10 02:27:52 jose" + * ------------------------------------------------------------------ + * Copyright (C) 2001 Free Software Foundation, Inc. + *   + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + *   + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *   + */ + + +#include <stdlib.h> +#include "mixgtk_widgets.h" +#include "mixgtk_mixal.h" + +static const mix_vm_t *vm_; +static GtkCList *clist_; +static gulong lineno_; + + +/* initialise the mixal widgets */ +gboolean +mixgtk_mixal_init (const mix_vm_t *vm) +{ +  g_return_val_if_fail (vm != NULL, FALSE); +  vm_ = vm; +  clist_ = GTK_CLIST (mixgtk_widget_factory_get (MIXGTK_WIDGET_MIXAL)); +  g_return_val_if_fail (clist_ != NULL, FALSE); +  return TRUE; +} + +/* load the corresponding mixal file */ +void +mixgtk_mixal_load_file (void) +{ +  enum {ADDR_SIZE = 10, CONT_SIZE = 20}; +  static gchar ADDR[ADDR_SIZE], CONT[CONT_SIZE]; +  static const gchar *TEXT[3]; +   +  const mix_src_file_t *file; +   +  g_assert (vm_); +  g_assert (clist_); +   +  gtk_clist_clear (clist_); +   +  file = mix_vm_get_src_file (vm_); +  if (file != NULL) +    { +      gint k; +      mix_address_t addr; + +      lineno_ = mix_src_file_get_line_no (file); + +      gtk_clist_freeze (clist_); +      for (k = 0; k < lineno_; ++k) +	{ +	  TEXT[0] = TEXT[1] = ""; +	  TEXT[2] = mix_src_file_get_line (file, k + 1); +	  addr = mix_vm_get_lineno_address (vm_, k + 1); +	  if (addr != MIX_VM_CELL_NO) +	    { +	      snprintf (ADDR, ADDR_SIZE, "%04d", mix_short_magnitude (addr)); +	      mix_word_print_to_buffer (mix_vm_get_addr_contents (vm_, addr), +					CONT); +	      TEXT[0] = ADDR; +	      TEXT[1] = CONT; +	    } +	  gtk_clist_append (clist_, (gchar **)TEXT); +	} +      TEXT[0] = TEXT[1] = TEXT[2] = NULL; +      gtk_clist_append (clist_, (gchar **)TEXT); +       +      gtk_clist_thaw (clist_); +    } +  else +    lineno_ = 0; +} + + +/* update the widgets */ +void +mixgtk_mixal_update (void) +{ +  gint addr = 0; +  gint k = 0; +  gchar *addrval = NULL; +   +  g_assert (vm_); +  g_assert (clist_); +   +  addr = mix_short_magnitude (mix_vm_get_prog_count (vm_)); +  while (k < lineno_) +    { +      gtk_clist_get_text (clist_, k, 0, &addrval); +      if (addrval && atoi(addrval) == addr)  break; +      ++k; +    } +  gtk_clist_select_row (clist_, k, 0); +  if (gtk_clist_row_is_visible (clist_, k) != GTK_VISIBILITY_FULL) +    gtk_clist_moveto (clist_, k, 0, 0.25, 0); +} diff --git a/mixgtk/mixgtk_mixal.h b/mixgtk/mixgtk_mixal.h new file mode 100644 index 0000000..076603c --- /dev/null +++ b/mixgtk/mixgtk_mixal.h @@ -0,0 +1,45 @@ +/* -*-c-*- ---------------- mixgtk_mixal.h : + * Declarations for functions displaying the mixal source file + * ------------------------------------------------------------------ + *  Last change: Time-stamp: <01/03/09 23:57:14 jose> + * ------------------------------------------------------------------ + * Copyright (C) 2001 Free Software Foundation, Inc. + *   + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + *   + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *   + */ + + +#ifndef MIXGTK_MIXAL_H +#define MIXGTK_MIXAL_H + +#include <mixlib/mix_vm.h> + +/* initialise the mixal widgets */ +extern gboolean +mixgtk_mixal_init (const mix_vm_t *vm); + +/* load the corresponding mixal file */ +extern void +mixgtk_mixal_load_file (void); + +/* update the widgets */ +extern void +mixgtk_mixal_update (void); + + + +#endif /* MIXGTK_MIXAL_H */ + diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c index ba5023a..16fa410 100644 --- a/mixgtk/mixgtk_mixvm.c +++ b/mixgtk/mixgtk_mixvm.c @@ -1,7 +1,7 @@  /* -*-c-*- -------------- mixgtk_mixvm.c :   * Implementation of the functions declared in mixgtk_mixvm.h   * ------------------------------------------------------------------ - *  Last change: Time-stamp: "01/03/08 23:22:49 jose" + *  Last change: Time-stamp: "01/03/09 22:20:59 jose"   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -24,14 +24,19 @@  #include <mixlib/xmix_vm.h>  #include "mixgtk_widgets.h"  #include "mixgtk_mixvm.h" +#include "mixgtk_cmd_dispatcher.h"  /* register widgets */  #define REGISTER_NO_ (MIXGTK_WIDGET_rI6 - MIXGTK_WIDGET_rA + 1)  static GtkEntry *reg_entries_[REGISTER_NO_]; +static GtkEntry *loc_entry_;  static GtkToggleButton *over_button_;  static GtkToggleButton *cmp_buttons_[3];  static GtkCList *memory_; +static GtkLabel *laptime_; +static GtkLabel *progtime_; +static GtkLabel *uptime_;  static mix_vm_t *vm_; @@ -93,6 +98,18 @@ mixgtk_mixvm_init (mix_vm_t *vm)        g_return_val_if_fail (reg_entries_[k] != NULL, FALSE);      } +  loc_entry_ = GTK_ENTRY (mixgtk_widget_factory_get (MIXGTK_WIDGET_LOC)); +  g_return_val_if_fail (loc_entry_ != NULL, FALSE); + +  uptime_ = GTK_LABEL (mixgtk_widget_factory_get (MIXGTK_WIDGET_UPTIME)); +  g_return_val_if_fail (uptime_ != NULL, FALSE); + +  progtime_ = GTK_LABEL (mixgtk_widget_factory_get (MIXGTK_WIDGET_PROGTIME)); +  g_return_val_if_fail (progtime_ != NULL, FALSE); + +  laptime_ = GTK_LABEL (mixgtk_widget_factory_get (MIXGTK_WIDGET_LAPTIME)); +  g_return_val_if_fail (laptime_ != NULL, FALSE); +    over_button_ =      GTK_TOGGLE_BUTTON (mixgtk_widget_factory_get (MIXGTK_WIDGET_OVER));    g_return_val_if_fail (over_button_ != NULL, FALSE); @@ -118,7 +135,8 @@ mixgtk_mixvm_init (mix_vm_t *vm)      }    gtk_clist_thaw (memory_); -  scrol = mixgtk_widget_factory_get_by_name ("memory_scroll"); +  scrol = mixgtk_widget_factory_get (MIXGTK_WIDGET_CELLS_SCROLL); +  g_return_val_if_fail (scrol != NULL, FALSE);    adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrol));    gtk_signal_connect (GTK_OBJECT (adj), "value_changed",  		      GTK_SIGNAL_FUNC (on_mem_adj_change_), NULL); @@ -142,7 +160,7 @@ mixgtk_mixvm_update_registers (void)  void  mixgtk_mixvm_update_over_toggle (void)  { -  g_assert (over_button_ != NULL); +  g_assert (over_button_);    gtk_toggle_button_set_active (over_button_,  				mix_vm_get_overflow (vm_));  } @@ -152,6 +170,9 @@ void  mixgtk_mixvm_update_cmp (void)  {    gint toggle; +   +  g_assert (cmp_buttons_); +      toggle = mix_vm_get_cmpflag (vm_);    gtk_toggle_button_set_active (cmp_buttons_[toggle], TRUE);  } @@ -164,6 +185,8 @@ mixgtk_mixvm_update_cells (void)    static gchar BUFFER[20];    gint k = 0; +  g_assert (memory_); +      gtk_clist_freeze (memory_);    while (gtk_clist_row_is_visible (memory_, k) == GTK_VISIBILITY_NONE) ++k; @@ -177,15 +200,62 @@ mixgtk_mixvm_update_cells (void)    gtk_clist_thaw (memory_);  } +void +mixgtk_mixvm_update_cells_to_address (gint address) +{ +  g_assert (memory_); +  g_return_if_fail (address < MIX_VM_CELL_NO); +   +  gtk_clist_freeze (memory_); +  gtk_clist_moveto (memory_, address, 0, 0, 0); +  gtk_clist_thaw (memory_); +  mixgtk_mixvm_update_cells (); +} + +/* update the loc pointer */ +void +mixgtk_mixvm_update_loc (void) +{ +  enum {SIZE = 10 }; +  static gchar BUFFER[SIZE]; +  mix_short_t locval; +   +  g_assert (loc_entry_); +   +  locval = mix_vm_get_prog_count (vm_); +  snprintf (BUFFER, SIZE, "%04d", mix_short_magnitude (locval)); +  gtk_entry_set_text (loc_entry_, BUFFER); +} + +/* update times */ +void +mixgtk_mixvm_update_times (void) +{ +  enum {SIZE = 20 }; +  static gchar BUFFER[SIZE]; +  gint uptime, progtime, laptime; +   +  g_assert (uptime_ && progtime_ && laptime_); +  mixgtk_cmd_dispatcher_get_times (&uptime, &progtime, &laptime); +  snprintf (BUFFER, SIZE, "%d", uptime); +  gtk_label_set_text (uptime_, BUFFER); +  snprintf (BUFFER, SIZE, "%d", progtime); +  gtk_label_set_text (progtime_, BUFFER); +  snprintf (BUFFER, SIZE, "%d", laptime); +  gtk_label_set_text (laptime_, BUFFER); +} +  /* update all mixvm widgets */  void  mixgtk_mixvm_update_vm_widgets (void)  {    mixgtk_mixvm_update_registers (); +  mixgtk_mixvm_update_loc ();    mixgtk_mixvm_update_over_toggle ();    mixgtk_mixvm_update_cmp ();    mixgtk_mixvm_update_cells (); +  mixgtk_mixvm_update_times ();  } @@ -218,3 +288,10 @@ on_overflow_toggled (GtkWidget *widget, gpointer data)  } +void +on_loc_arrow_clicked (GtkWidget *widget, gpointer data)  +{ +  gint address = mix_short_magnitude (mix_vm_get_prog_count (vm_)); +  mixgtk_mixvm_update_cells_to_address (address); +} + diff --git a/mixgtk/mixgtk_mixvm.h b/mixgtk/mixgtk_mixvm.h index a2699cb..8207d91 100644 --- a/mixgtk/mixgtk_mixvm.h +++ b/mixgtk/mixgtk_mixvm.h @@ -1,7 +1,7 @@  /* -*-c-*- ---------------- mixgtk_mixvm.h :   * Functions dealing with the mixvm widgets   * ------------------------------------------------------------------ - *  Last change: Time-stamp: <01/03/07 23:58:35 jose> + *  Last change: Time-stamp: <01/03/09 22:12:04 jose>   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -47,12 +47,22 @@ mixgtk_mixvm_update_cmp (void);  extern void  mixgtk_mixvm_update_cells (void); +extern void +mixgtk_mixvm_update_cells_to_address (gint address); + +/* update the loc pointer */ +extern void +mixgtk_mixvm_update_loc (void); + +/* update times */ +extern void +mixgtk_mixvm_update_times (void); +  /* update all mixvm widgets */  extern void  mixgtk_mixvm_update_vm_widgets (void);  /* callbacks */ -/* cmp flag changed */  extern void  on_cmp_e_toggled (GtkWidget *widget, gpointer data); @@ -66,8 +76,7 @@ extern void  on_overflow_toggled (GtkWidget *widget, gpointer data);  extern void -on_memory_cells_scroll_vertical (GtkWidget *widget, GtkScrollType, -				 gfloat, gpointer); +on_loc_arrow_clicked (GtkWidget *widget, gpointer data); diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c index 276a6fb..3ff6436 100644 --- a/mixgtk/mixgtk_widgets.c +++ b/mixgtk/mixgtk_widgets.c @@ -1,7 +1,7 @@  /* -*-c-*- -------------- mixgtk_widgets.c :   * Implementation of the functions declared in mixgtk_widgets.h   * ------------------------------------------------------------------ - *  Last change: Time-stamp: "01/03/08 22:32:35 jose" + *  Last change: Time-stamp: "01/03/09 22:29:47 jose"   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -35,6 +35,7 @@ static const gchar *names_[] = {    "word_dialog",    "command_prompt",    "command_log", +  "mixal_clist",    "rA_entry",    "rX_entry",    "rJ_entry", @@ -49,7 +50,12 @@ static const gchar *names_[] = {    "greater_radio",    "over_toggle",    "memory_cells", +  "memory_scroll",    "devices_notebook", +  "loc_entry", +  "elapsed_label", +  "program_label", +  "uptime_label",    NULL  }; diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h index 26e8b4d..ac221cc 100644 --- a/mixgtk/mixgtk_widgets.h +++ b/mixgtk/mixgtk_widgets.h @@ -1,7 +1,7 @@  /* -*-c-*- ---------------- mixgtk_widgets.h :   * glade-based factory of mixvm widgets   * ------------------------------------------------------------------ - *  Last change: Time-stamp: <01/03/08 22:27:01 jose> + *  Last change: Time-stamp: <01/03/09 23:08:10 jose>   * ------------------------------------------------------------------   * Copyright (C) 2001 Free Software Foundation, Inc.   *   @@ -34,6 +34,7 @@ typedef enum {    MIXGTK_WIDGET_WORD_DIALOG,	/* input dialog for a mix word */    MIXGTK_WIDGET_PROMPT,		/* command prompt */    MIXGTK_WIDGET_LOG,		/* command output */ +  MIXGTK_WIDGET_MIXAL,		/* mixal source file */    MIXGTK_WIDGET_rA,    MIXGTK_WIDGET_rX,    MIXGTK_WIDGET_rJ, @@ -48,7 +49,12 @@ typedef enum {    MIXGTK_WIDGET_CMP_G,    MIXGTK_WIDGET_OVER,    MIXGTK_WIDGET_CELLS, +  MIXGTK_WIDGET_CELLS_SCROLL,    MIXGTK_WIDGET_DEVICE, +  MIXGTK_WIDGET_LOC, +  MIXGTK_WIDGET_LAPTIME, +  MIXGTK_WIDGET_PROGTIME, +  MIXGTK_WIDGET_UPTIME,    MIXGTK_WIDGET_NONE  } mixgtk_widget_id_t; | 
