/[gxemul]/trunk/src/console.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/console.c

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

revision 31 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: console.c,v 1.16 2006/05/05 21:28:09 debug Exp $   *  $Id: console.c,v 1.21 2006/10/31 08:26:38 debug Exp $
29   *   *
30   *  Generic console support functions.   *  Generic console support functions.
31   *   *
# Line 92  static struct termios console_slave_tios Line 92  static struct termios console_slave_tios
92  static int console_slave_outputd;  static int console_slave_outputd;
93    
94  static int console_initialized = 0;  static int console_initialized = 0;
95    static struct settings *console_settings = NULL;
96  static int console_stdout_pending;  static int console_stdout_pending;
97    
98  #define CONSOLE_FIFO_LEN        4096  #define CONSOLE_FIFO_LEN        4096
99    
 /*  Mouse coordinates:  */  
 static int console_framebuffer_mouse_x;         /*  absolute x, 0-based  */  
 static int console_framebuffer_mouse_y;         /*  absolute y, 0-based  */  
 static int console_framebuffer_mouse_fb_nr;     /*  fb_number of last  
                                                     framebuffer cursor update */  
   
100  static int console_mouse_x;             /*  absolute x, 0-based  */  static int console_mouse_x;             /*  absolute x, 0-based  */
101  static int console_mouse_y;             /*  absolute y, 0-based  */  static int console_mouse_y;             /*  absolute y, 0-based  */
102  static int console_mouse_fb_nr;         /*  framebuffer number of  static int console_mouse_fb_nr;         /*  framebuffer number of
# Line 139  static int n_console_handles = 0; Line 134  static int n_console_handles = 0;
134    
135    
136  /*  /*
137   *  console_deinit():   *  console_deinit_main():
138   *   *
139   *  Restore host's console settings.   *  Restore host's console settings.
140   */   */
141  void console_deinit(void)  void console_deinit_main(void)
142  {  {
143          if (!console_initialized)          if (!console_initialized)
144                  return;                  return;
# Line 158  void console_deinit(void) Line 153  void console_deinit(void)
153   *  console_sigcont():   *  console_sigcont():
154   *   *
155   *  If the user presses CTRL-Z (to stop the emulator process) and then   *  If the user presses CTRL-Z (to stop the emulator process) and then
156   *  continues, we have to make sure that the right termios settings are   *  continues, the termios settings might have been invalidated. This
157   *  active.  (This should be set as the SIGCONT signal handler in src/emul.c.)   *  function restores them.
158     *
159     *  (This function should be set as the SIGCONT signal handler in src/emul.c.)
160   */   */
161  void console_sigcont(int x)  void console_sigcont(int x)
162  {  {
163          if (!console_initialized)          if (!console_initialized)
164                  return;                  return;
165    
166          /*  Make sure our 'current' termios setting is active:  */          /*  Make sure that the correct (current) termios setting is active:  */
167          tcsetattr(STDIN_FILENO, TCSANOW, &console_curtermios);          tcsetattr(STDIN_FILENO, TCSANOW, &console_curtermios);
168    
169          /*  Reset the signal handler:  */          /*  Reset the signal handler:  */
# Line 489  void console_mouse_button(int button, in Line 486  void console_mouse_button(int button, in
486    
487    
488  /*  /*
  *  console_get_framebuffer_mouse():  
  *  
  *  TODO: Comment  
  */  
 void console_get_framebuffer_mouse(int *x, int *y, int *fb_nr)  
 {  
         *x = console_framebuffer_mouse_x;  
         *y = console_framebuffer_mouse_y;  
         *fb_nr = console_framebuffer_mouse_fb_nr;  
 }  
   
   
 /*  
  *  console_set_framebuffer_mouse():  
  *  
  *  A framebuffer device calls this function when it sets the  
  *  position of a cursor (ie a mouse cursor).  
  */  
 void console_set_framebuffer_mouse(int x, int y, int fb_nr)  
 {  
         console_framebuffer_mouse_x = x;  
         console_framebuffer_mouse_y = y;  
         console_framebuffer_mouse_fb_nr = fb_nr;  
 }  
   
   
 /*  
489   *  console_getmouse():   *  console_getmouse():
490   *   *
491   *  Puts current mouse data into the variables pointed to by   *  Puts current mouse data into the variables pointed to by
# Line 572  void console_slave(char *arg) Line 542  void console_slave(char *arg)
542          int inputd;          int inputd;
543          int len;          int len;
544          char *p;          char *p;
545          char buf[400];          char buf[16384];
546    
547          /*  arg = '3,6' or similar, input and output descriptors  */          /*  arg = '3,6' or similar, input and output descriptors  */
548          /*  printf("console_slave(): arg = '%s'\n", arg);  */          /*  printf("console_slave(): arg = '%s'\n", arg);  */
# Line 618  void console_slave(char *arg) Line 588  void console_slave(char *arg)
588                          write(console_slave_outputd, buf, len);                          write(console_slave_outputd, buf, len);
589                  }                  }
590    
591                  usleep(100);                  usleep(10000);
592          }          }
593  }  }
594    
# Line 714  int console_start_slave(struct machine * Line 684  int console_start_slave(struct machine *
684                  chp->outputonly = 1;                  chp->outputonly = 1;
685                  chp->in_use_for_input = 0;                  chp->in_use_for_input = 0;
686          }          }
687          chp->machine_name = strdup(machine->machine_name);  
688            if (machine->machine_name != NULL)
689                    chp->machine_name = strdup(machine->machine_name);
690            else
691                    chp->machine_name = strdup("");
692    
693          chp->name = strdup(consolename);          chp->name = strdup(consolename);
694    
695          if (allow_slaves)          if (allow_slaves)
# Line 973  void console_init(void) Line 948  void console_init(void)
948  {  {
949          int handle;          int handle;
950          struct console_handle *chp;          struct console_handle *chp;
951          struct settings *console_settings = settings_new();  
952            console_settings = settings_new();
953    
954          settings_add(global_settings, "console", 1,          settings_add(global_settings, "console", 1,
955              SETTINGS_TYPE_SUBSETTINGS, 0, console_settings);              SETTINGS_TYPE_SUBSETTINGS, 0, console_settings);
# Line 991  void console_init(void) Line 967  void console_init(void)
967          chp->in_use_for_input = 1;          chp->in_use_for_input = 1;
968  }  }
969    
970    
971    /*
972     *  console_deinit():
973     *
974     *  Unregister settings registered by console_init().
975     */
976    void console_deinit(void)
977    {
978            settings_remove(console_settings, "allow_slaves");
979            settings_remove(global_settings, "console");
980    }
981    

Legend:
Removed from v.31  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26