diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.am | 4 | ||||
| -rw-r--r-- | src/ansi.c | 21 | ||||
| -rw-r--r-- | src/ansi.h | 5 | ||||
| -rw-r--r-- | src/crt.h | 7 | ||||
| -rw-r--r-- | src/prototypes.h | 9 | ||||
| -rw-r--r-- | src/ptty.c | 22 | ||||
| -rw-r--r-- | src/serial.c | 6 | 
7 files changed, 57 insertions, 17 deletions
| diff --git a/src/Makefile.am b/src/Makefile.am index ad3e0ad..7e0a3b9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,6 +8,9 @@  # $Id$  #  # $Log$ +# Revision 1.17  2008/02/24 00:42:53  james +# *** empty log message *** +#  # Revision 1.16  2008/02/22 23:39:27  james  # *** empty log message ***  # @@ -113,6 +116,7 @@ protos:  tidy: ${SRCS} ${HDRS}  	indent -i2 -ts0 ${SRCS} ${HDRS}	 +	/bin/rm -f *~  sympathy.h: ${PROJECTHDRS} sympathy.h.head sympathy.h.tail  	cat sympathy.h.head ${PROJECTHDRS} sympathy.h.tail > $@ || /bin/rm -f $@ @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";  /*   * $Log$ + * Revision 1.30  2008/02/24 00:42:53  james + * *** empty log message *** + *   * Revision 1.29  2008/02/23 11:48:37  james   * *** empty log message ***   * @@ -316,21 +319,30 @@ ansi_set_attr (ANSI * a, int attr)  } +static void +ansi_emit_noutf8 (TTY * t, uint32_t ch) +{ +  uint8_t c = (ch > 0x7f) ? '?' : ch; +  t->xmit (t, &c, 1); +}  static void  ansi_render (ANSI * a, CRT_CA ca)  {    int dif; -  if (ca.chr < 32) +  if (ca.chr < 0x20)      ca.chr = ' '; -  if (ca.chr > 126) +  if ((ca.chr > 0x7e) && (ca.chr < 0xa0))      ca.chr = ' ';    ansi_set_attr (a, ca.attr);    ansi_set_color (a, ca.color); -  a->terminal->xmit (a->terminal, &ca.chr, 1); +  if (a->utf8) +    utf8_emit (a->terminal, ca.chr); +  else +    ansi_emit_noutf8 (a->terminal, ca.chr);    a->pos.x++; @@ -883,7 +895,7 @@ ansi_free (ANSI * a)  }  ANSI * -ansi_new_from_terminal (TTY * t) +ansi_new_from_terminal (TTY * t, int utf8)  {    ANSI *ret; @@ -892,6 +904,7 @@ ansi_new_from_terminal (TTY * t)    ret->terminal = t; +  ret->utf8 = utf8;    ret->update = ansi_update;    ret->reset = ansi_reset;    ret->terminal_reset = ansi_terminal_reset; @@ -12,6 +12,9 @@  /*   * $Log$ + * Revision 1.13  2008/02/24 00:42:53  james + * *** empty log message *** + *   * Revision 1.12  2008/02/23 11:48:37  james   * *** empty log message ***   * @@ -82,6 +85,8 @@ typedef struct ANSI_struct    int attr;    int color; +  int utf8; +    int history_ptr;    FILE *file; @@ -12,6 +12,9 @@  /*   * $Log$ + * Revision 1.10  2008/02/24 00:42:53  james + * *** empty log message *** + *   * Revision 1.9  2008/02/20 19:25:09  james   * *** empty log message ***   * @@ -84,9 +87,9 @@  #define CRT_COLOR_NORMAL	CRT_MAKE_COLOR(CRT_FGCOLOR_NORMAL,CRT_BGCOLOR_NORMAL) -typedef struct +typedef struct __attribute__ ((packed))  { -  uint8_t chr; +  uint32_t chr;    uint8_t attr;    uint8_t color;  } CRT_CA; diff --git a/src/prototypes.h b/src/prototypes.h index 9c5eec4..a084d32 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -1,6 +1,6 @@  /* ansi.c */  extern int ansi_dispatch(ANSI *a, Context *c); -extern ANSI *ansi_new_from_terminal(TTY *t); +extern ANSI *ansi_new_from_terminal(TTY *t, int utf8);  /* crt.c */  extern void crt_erase(CRT *c, CRT_Pos s, CRT_Pos e, int ea, int color);  extern void crt_cls(CRT *c); @@ -37,7 +37,7 @@ extern void vt102_change_attr(VT102 *v, char *na);  extern void vt102_parse_attr_string(VT102 *v, char *buf, int len);  extern void vt102_save_state(VT102 *v);  extern void vt102_restore_state(VT102 *v); -extern void vt102_regular_char(Context *c, VT102 *v, char ch); +extern void vt102_regular_char(Context *c, VT102 *v, int ch);  extern void vt102_scs(Context *c, int g, int s);  extern void vt102_parse_esc(Context *c, int ch);  extern void vt102_parse_csi(Context *c, char *buf, int len); @@ -90,8 +90,8 @@ extern int wrap_read(int fd, void *buf, int len);  extern int wrap_write(int fd, void *buf, int len);  extern void set_nonblocking(int fd);  extern void set_blocking(int fd); -extern void raw_termios(struct termios *termios);  extern void default_termios(struct termios *termios); +extern void client_termios(struct termios *termios);  /* log.c */  extern Log *file_log_new(char *fn);  extern void log_f(Log *log, char *fmt, ...); @@ -158,5 +158,6 @@ extern void serial_lock_free(Serial_lock *l);  extern Serial_lock *serial_lock_new(char *dev, int mode);  /* utf8.c */  extern void utf8_flush(Context *c); -extern void utf8_parse(Context *c, int ch); +extern void utf8_parse(Context *c, uint32_t ch);  extern UTF8 *utf8_new(void); +extern void utf8_emit(TTY *t, int ch); @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";  /*   * $Log$ + * Revision 1.10  2008/02/24 00:42:53  james + * *** empty log message *** + *   * Revision 1.9  2008/02/23 13:05:58  staffcvs   * *** empty log message ***   * @@ -137,19 +140,16 @@ ptty_open (char *path, char *argv[])    pid_t child;    char name[1024];    struct winsize winsize = { 0 }; -  struct termios termios = { 0 }; +  struct termios ctermios = { 0 };    int fd;    char *default_argv[] = { "-", (char *) 0 }; -  default_termios (&termios); -  cfsetispeed (&termios, B9600); -  cfsetospeed (&termios, B9600); - +  client_termios (&ctermios);    winsize.ws_row = VT102_ROWS;    winsize.ws_col = VT102_COLS; -  child = forkpty (&fd, name, &termios, &winsize); +  child = forkpty (&fd, name, &ctermios, &winsize);    switch (child)      { @@ -169,6 +169,16 @@ ptty_open (char *path, char *argv[])    set_nonblocking (fd); +#if 0 +  { +    struct termios termios = { 0 }; + +    tcgetattr (fd, &termios); +    default_termios (&termios); +    tcsetattr (fd, TCSANOW, &termios); +  } +#endif +    t = (PTTY *) malloc (sizeof (PTTY));    strncpy (t->name, name, sizeof (t->name)); diff --git a/src/serial.c b/src/serial.c index 3784573..1044bb2 100644 --- a/src/serial.c +++ b/src/serial.c @@ -6,10 +6,14 @@   *   */ -static char rcsid[] = "$Id$"; +static char rcsid[] = +  "$Id$";  /*   * $Log$ + * Revision 1.9  2008/02/24 00:42:53  james + * *** empty log message *** + *   * Revision 1.8  2008/02/23 13:05:58  staffcvs   * *** empty log message ***   * | 
