/[smarc]/smarc/src/smarcgui/src/main.cc
ViewVC logotype

Diff of /smarc/src/smarcgui/src/main.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by misto, Fri Jan 3 22:20:52 2003 UTC revision 1.8 by misto, Sat Jan 4 03:57:36 2003 UTC
# Line 295  void reinit_codelist( void ) Line 295  void reinit_codelist( void )
295          gtk_clist_clear( codelist );          gtk_clist_clear( codelist );
296                    
297          if ( vm.is_on() ){          if ( vm.is_on() ){
298                  char  buf[3][100], *ptrs[4] = {0};                  char  buf[3][100], *ptrs[5] = {0};
299                  vector<unsigned long> mem = bin_loader.get_instr();                  vector<unsigned long> mem = bin_loader.get_instr();
300                  despasm despasma(mem, 1);                  despasm despasma(mem, 1);
301    
302                  ptrs[0] = buf[0];                  ptrs[0] = buf[0];
303                  ptrs[1] = buf[1];                  ptrs[1] = NULL;
304                  ptrs[3] = buf[2];                  ptrs[2] = buf[1];
305                    ptrs[4] = buf[2];
306                                    
307                  for( int i = 0 ; i < mem.size() ; i++ ){                  for( int i = 0 ; i < mem.size() ; i++ ){
308                          sprintf( buf[0], "%08X:", i*4 );                          sprintf( buf[0], "%08X:", i*4 );
309                          strcpy( buf[1], despasma.getline(i).c_str() );                          strcpy( buf[1], despasma.getline(i).c_str() );
310    
311                          ptrs[2] = strchr( buf[1], '\t' );                          ptrs[3] = strchr( buf[1], '\t' );
312                          if (ptrs[2]){                          if (ptrs[3]){
313                                  ptrs[2][0] = '\0';                                  ptrs[3][0] = '\0';
314                                  ptrs[2]++;                                  ptrs[3]++;
315                          }                          }
316                          sprintf( buf[2], "%08X", mem[i] );                          sprintf( buf[2], "%08X", mem[i] );
317                                                    
# Line 318  void reinit_codelist( void ) Line 319  void reinit_codelist( void )
319                          gtk_clist_set_background(codelist, i, &colors );                          gtk_clist_set_background(codelist, i, &colors );
320                  }                  }
321    
322                  for( int i = 0 ; i < 4 ; i++ )                  for( int i = 0 ; i < 5 ; i++ )
323                          gtk_clist_set_column_auto_resize(codelist, i, true );                          gtk_clist_set_column_auto_resize(codelist, i, true );
324                                    
325                  gtk_clist_set_column_justification(codelist, 3,                  gtk_clist_set_column_justification(codelist, 4,
326                                  GTK_JUSTIFY_CENTER);                                  GTK_JUSTIFY_CENTER);
327          }          }
328                    
329          gtk_clist_thaw( codelist );          gtk_clist_thaw( codelist );
330  }  }
331    void refresh_codelist_addtext( char *s_no, char *s_yes, int row )
332    {
333            GtkCList *codelist;
334            codelist = GTK_CLIST(lookup_widget( window_main, "clist_code"));
335            char *s_old;
336    
337            gtk_clist_get_text( codelist, row, 1 , &s_old);
338    
339            if ( s_old == NULL || strlen(s_old) == 0 )
340                    gtk_clist_set_text( codelist, row, 1 , s_no);
341            else {
342                    char buf[100];
343                    sprintf(buf, "%s%s", s_old, s_yes );
344                    gtk_clist_set_text( codelist, row, 1 , buf);
345            }
346            
347    }
348  void refresh_codelist( void )  void refresh_codelist( void )
349  {  {
350          GtkCList *codelist;          GtkCList *codelist;
# Line 345  void refresh_codelist( void ) Line 363  void refresh_codelist( void )
363    
364          gdk_colormap_alloc_colors( sys, colors, 6, FALSE, TRUE, dummy );          gdk_colormap_alloc_colors( sys, colors, 6, FALSE, TRUE, dummy );
365    
366            gtk_clist_freeze( codelist );
367    
368          int rows = bin_loader.get_instr().size();          int rows = bin_loader.get_instr().size();
369          for( int i = 0; i < rows ; i++)          for( int i = 0; i < rows ; i++){
370                  gtk_clist_set_background(codelist, i, &(colors[0]) );                  gtk_clist_set_background(codelist, i, &(colors[0]) );
371                    gtk_clist_set_text(codelist, i, 1, "" );
372            }
373    
374          if (vm.is_active(vmachine::WB))          if (vm.is_active( vmachine::IF )){
375                  gtk_clist_set_background(codelist,                  gtk_clist_set_background(codelist,
376                                  vm.get_pppPC()/4, &(colors[5]) );                                  vm.get_nPC()/4, &(colors[1]) );
377                    if (vm.is_stall( vmachine::IF ))
378                            refresh_codelist_addtext( "!IF", "/!IF",
379                                                    vm.get_nPC()/4 );
380                    else
381                            refresh_codelist_addtext( "IF", "/IF", vm.get_nPC()/4 );
382            }
383                    
384          if (vm.is_active(vmachine::MA))          if (vm.is_active(vmachine::ID)){
385                  gtk_clist_set_background(codelist,                  gtk_clist_set_background(codelist,
386                                  vm.get_ppPC()/4, &(colors[4]) );                                  vm.get_PC()/4, &(colors[2]) );
387                    if (vm.is_stall( vmachine::ID ))
388                            refresh_codelist_addtext( "!ID", "/!ID",
389                                                    vm.get_PC()/4 );
390                    else
391                            refresh_codelist_addtext( "ID", "/ID", vm.get_PC()/4 );
392            }
393                    
394          if (vm.is_active(vmachine::EX))          if (vm.is_active(vmachine::EX)){
395                  gtk_clist_set_background(codelist,                  gtk_clist_set_background(codelist,
396                                  vm.get_pPC()/4, &(colors[3]) );                                  vm.get_pPC()/4, &(colors[3]) );
397                    if (vm.is_stall( vmachine::EX ))
398          if (vm.is_active(vmachine::ID))                          refresh_codelist_addtext( "!EX", "/!EX",
399                                                    vm.get_pPC()/4 );
400                    else
401                            refresh_codelist_addtext( "EX", "/EX", vm.get_pPC()/4 );
402            }
403            
404            if (vm.is_active(vmachine::MA)){
405                  gtk_clist_set_background(codelist,                  gtk_clist_set_background(codelist,
406                                  vm.get_PC()/4, &(colors[2]) );                                  vm.get_ppPC()/4, &(colors[4]) );
407                    if (vm.is_stall( vmachine::MA ))
408                            refresh_codelist_addtext( "!MA", "/!MA",
409                                                    vm.get_ppPC()/4 );
410                    else
411                            refresh_codelist_addtext( "MA", "/MA",
412                                                    vm.get_ppPC()/4 );
413            }
414    
415          if (vm.is_active( vmachine::IF ))          if (vm.is_active(vmachine::WB)){
416                  gtk_clist_set_background(codelist,                  gtk_clist_set_background(codelist,
417                                  vm.get_nPC()/4, &(colors[1]) );                                  vm.get_pppPC()/4, &(colors[5]) );
418                    if (vm.is_stall( vmachine::WB ))
419                            refresh_codelist_addtext( "!WB", "/!WB",
420                                                    vm.get_pppPC()/4 );
421                    else
422                            refresh_codelist_addtext( "WB", "/WB",
423                                                    vm.get_pppPC()/4 );
424            }
425            
426    
427          gtk_clist_moveto( codelist, vm.get_nPC()/4, 0, 0.8, 0);          gtk_clist_moveto( codelist, vm.get_nPC()/4, 0, 0.8, 0);
428    
429            gtk_clist_thaw( codelist );
430  }  }
431  void refresh_memory( void )  void refresh_memory( void )
432  {  {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26