aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <>2008-02-24 00:47:14 +0000
committerjames <>2008-02-24 00:47:14 +0000
commitd338f6d46af0d6b5e746203748ba7cc9242020cb (patch)
tree3400ccf8db2c56670adfff5ced8a236d936b7588
parent3240b828391da405d093356eae0b90af5abc7a32 (diff)
downloadsympathy-d338f6d46af0d6b5e746203748ba7cc9242020cb.tar.gz
sympathy-d338f6d46af0d6b5e746203748ba7cc9242020cb.tar.bz2
sympathy-d338f6d46af0d6b5e746203748ba7cc9242020cb.zip
*** empty log message ***
-rw-r--r--apps/mainloop.c6
-rw-r--r--apps/sympathy.c7
-rw-r--r--apps/usage.c10
-rw-r--r--src/serial.c6
-rw-r--r--src/utf8.c46
-rw-r--r--src/utf8.h5
-rw-r--r--src/util.c46
-rw-r--r--src/vt102.c7
-rw-r--r--src/vt102.h5
9 files changed, 110 insertions, 28 deletions
diff --git a/apps/mainloop.c b/apps/mainloop.c
index e674b2e..73b2236 100644
--- a/apps/mainloop.c
+++ b/apps/mainloop.c
@@ -6,10 +6,14 @@
*
*/
-static char rcsid[] = "$Id$";
+static char rcsid[] =
+ "$Id$";
/*
* $Log$
+ * Revision 1.11 2008/02/24 00:43:55 james
+ * *** empty log message ***
+ *
* Revision 1.10 2008/02/23 13:05:57 staffcvs
* *** empty log message ***
*
diff --git a/apps/sympathy.c b/apps/sympathy.c
index b92dbe4..13b54ef 100644
--- a/apps/sympathy.c
+++ b/apps/sympathy.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.14 2008/02/24 00:43:55 james
+ * *** empty log message ***
+ *
* Revision 1.13 2008/02/24 00:42:53 james
* *** empty log message ***
*
@@ -483,7 +486,9 @@ main (int argc, char *argv[])
else
{
terminal_register_handlers ();
- ansi = ansi_new_from_terminal (terminal_open (0, 1),oflags['u'] ? 0:1);
+ ansi =
+ ansi_new_from_terminal (terminal_open (0, 1),
+ oflags['u'] ? 0 : 1);
ansi->reset (ansi, NULL);
}
}
diff --git a/apps/usage.c b/apps/usage.c
index 114f81d..07da7fa 100644
--- a/apps/usage.c
+++ b/apps/usage.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/24 00:43:55 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/24 00:42:53 james
* *** empty log message ***
*
@@ -46,7 +49,7 @@ usage (void)
fprintf (stderr, "Usage:\n"
"sympathy -t [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-u]\n"
"sympathy -s [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-u] [-F]\n"
- " [-k skt] [-n hlines]\n"
+ " [-k skt] [-n hlines]\n"
"sympathy [-s -c] [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-u] [-k skt]\n"
" [-n hlines]\n"
"sympathy -c [-H] [-u] -k skt\n"
@@ -89,9 +92,8 @@ usage (void)
" -L log activity on the device to the file log\n"
" -n hlines the number of lines of history to store in the\n"
" server, that are replayed on connexion\n"
- " -u don't emit utf-8 instead map all non ascii characters as ?\n"
-);
-
+ " -u don't emit utf-8 instead map all non ascii characters as ?\n");
+
exit (1);
}
diff --git a/src/serial.c b/src/serial.c
index 1044bb2..ab06e60 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -6,11 +6,13 @@
*
*/
-static char rcsid[] =
- "$Id$";
+static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.10 2008/02/24 00:47:14 james
+ * *** empty log message ***
+ *
* Revision 1.9 2008/02/24 00:42:53 james
* *** empty log message ***
*
diff --git a/src/utf8.c b/src/utf8.c
index 52ba398..ff8a2ec 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.5 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/23 13:05:58 staffcvs
* *** empty log message ***
*
@@ -61,7 +64,7 @@ utf8_flush (Context * c)
}
void
-utf8_parse (Context * c, int ch)
+utf8_parse (Context * c, uint32_t ch)
{
UTF8 *u = c->u;
@@ -74,7 +77,8 @@ utf8_parse (Context * c, int ch)
if (!u->in_utf8)
{
- /*FIXME: for the moment we bodge utf8 support */
+ /*FIXME: for the moment we bodge utf8 support - need to do */
+ /* L->R and R->L and double width characters */
if (ch == 0xb9)
{ /*CSI, not a valid utf8 start char */
vt102_parse_char (c, ch);
@@ -123,7 +127,7 @@ utf8_parse (Context * c, int ch)
u->in_utf8--;
if (!u->in_utf8)
- vt102_parse_char (c, ch);
+ vt102_parse_char (c, u->ch);
}
}
}
@@ -140,3 +144,39 @@ utf8_new (void)
ret->in_utf8 = 0;
}
+
+
+
+void
+utf8_emit (TTY * t, int ch)
+{
+ uint8_t buf[4];
+
+ if (ch < 0x80)
+ {
+ buf[0] = ch;
+ t->xmit (t, buf, 1);
+ }
+ else if (ch < 0x800)
+ {
+ buf[0] = 0xc0 | (ch >> 6);
+ buf[1] = 0x80 | (ch & 0x3f);
+
+ t->xmit (t, buf, 2);
+ }
+ else if (ch < 0x10000)
+ {
+ buf[0] = 0xe0 | (ch >> 12);
+ buf[1] = 0x80 | ((ch >> 6) & 0x3f);
+ buf[2] = 0x80 | (ch & 0x3f);
+ t->xmit (t, buf, 3);
+ }
+ else if (ch < 0x1fffff)
+ {
+ buf[0] = 0xf0 | (ch >> 18);
+ buf[1] = 0x80 | ((ch >> 12) & 0x3f);
+ buf[2] = 0x80 | ((ch >> 6) & 0x3f);
+ buf[3] = 0x80 | (ch & 0x3f);
+ t->xmit (t, buf, 4);
+ }
+}
diff --git a/src/utf8.h b/src/utf8.h
index 4fbf378..22ee915 100644
--- a/src/utf8.h
+++ b/src/utf8.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.4 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.3 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -35,7 +38,7 @@ typedef struct
uint8_t utf_buf[4];
int utf_ptr;
- int ch;
+ uint32_t ch;
int sh;
} UTF8;
diff --git a/src/util.c b/src/util.c
index ba1e309..e8b221a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.5 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/23 13:05:58 staffcvs
* *** empty log message ***
*
@@ -78,17 +81,15 @@ set_blocking (int fd)
fcntl (fd, F_SETFL, arg);
}
+
+
void
-raw_termios (struct termios *termios)
+default_termios (struct termios *termios)
{
-
- termios->c_iflag = 0;
-/*ICRNL | IXON;*/
+ termios->c_iflag = PARMRK | INPCK;
termios->c_oflag = NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
termios->c_lflag = 0;
-/*
- ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
-*/
+ termios->c_cflag = CS8 | CREAD | CLOCAL;
termios->c_cc[VINTR] = 003;
termios->c_cc[VQUIT] = 034;
@@ -105,19 +106,36 @@ raw_termios (struct termios *termios)
termios->c_cc[VREPRINT] = 022;
termios->c_cc[VDISCARD] = 017;
+
}
void
-default_termios (struct termios *termios)
+client_termios (struct termios *termios)
{
+ memset (termios, 0, sizeof (termios));
-// memset (termios, 0, sizeof (termios));
+ termios->c_iflag = ICRNL | IXON | PARMRK | INPCK;
+ termios->c_oflag = OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
+ termios->c_lflag =
+ ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
+ termios->c_cflag = CS8 | CREAD | CLOCAL;
- raw_termios (termios);
+ termios->c_cc[VINTR] = 003;
+ termios->c_cc[VQUIT] = 034;
+ termios->c_cc[VERASE] = 0177;
+ termios->c_cc[VKILL] = 025;
+ termios->c_cc[VEOF] = 004;
+ termios->c_cc[VEOL] = 0;
+ termios->c_cc[VEOL2] = 0;
+ termios->c_cc[VSTART] = 021;
+ termios->c_cc[VSTOP] = 023;
+ termios->c_cc[VSUSP] = 032;
+ termios->c_cc[VLNEXT] = 026;
+ termios->c_cc[VWERASE] = 027;
+ termios->c_cc[VREPRINT] = 022;
+ termios->c_cc[VDISCARD] = 017;
- termios->c_cflag = CS8 | CREAD | CLOCAL;
- termios->c_iflag |= PARMRK | INPCK;
- //cfsetispeed (termios, B9600);
- //cfsetospeed (termios, B9600);
+ cfsetispeed (termios, B9600);
+ cfsetospeed (termios, B9600);
}
diff --git a/src/vt102.c b/src/vt102.c
index 9b316ce..5a2ab37 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.35 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.34 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -894,7 +897,7 @@ vt102_restore_state (VT102 * v)
}
void
-vt102_regular_char (Context * c, VT102 * v, char ch)
+vt102_regular_char (Context * c, VT102 * v, int ch)
{
vt102_do_pending_wrap (c);
@@ -1307,10 +1310,12 @@ vt102_parse_char (Context * c, int ch)
#endif
/* Turn anything non-ascii into '?' */
+#if 0
if ((ch != SYM_CHAR_RESET) && (ch != 0xb9) && (ch > 127))
{
ch = '?';
}
+#endif
if (ch == SYM_CHAR_RESET)
diff --git a/src/vt102.h b/src/vt102.h
index 6343e6d..d12182a 100644
--- a/src/vt102.h
+++ b/src/vt102.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.15 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.14 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -107,7 +110,7 @@ typedef struct
int application_keypad_mode;
- char last_reg_char;
+ int last_reg_char;
int xn_glitch;
} VT102;