|
|
@@ -166,29 +166,18 @@ void write_html_header(struct session *ses, FILE *fp)
|
|
|
"<head>\n"
|
|
|
"<meta http-equiv='content-type' content='text/html; charset=%s'>\n"
|
|
|
"<meta name='viewport' content='width=device-width, initial-scale=1.0'>\n"
|
|
|
- "<meta name='description' content='Generated by TinTin++ "CLIENT_VERSION" - http://tintin.sourceforge.net'>\n"
|
|
|
"<style type='text/css'>\n"
|
|
|
- "body {font-family:Consolas;font-size:12pt;}\n"
|
|
|
- "a {text-decoration:none;}\n"
|
|
|
- "a:link {color:#06b;}\n"
|
|
|
- "a:visited {color:#6b0;}\n"
|
|
|
- "a:hover {text-decoration:underline;}\n"
|
|
|
- "a:active {color:#b06;}\n"
|
|
|
- ".d30{ color: #000; } .l30{ color: #555; } .b40{ background-color: #000; } .b50{ background-color: #555 }\n"
|
|
|
- ".d31{ color: #B00; } .l31{ color: #F55; } .b41{ background-color: #B00; } .b51{ background-color: #F55 }\n"
|
|
|
- ".d32{ color: #0B0; } .l32{ color: #5F5; } .b42{ background-color: #0B0; } .b52{ background-color: #5F5 }\n"
|
|
|
- ".d33{ color: #BB0; } .l33{ color: #FF5; } .b43{ background-color: #BB0; } .b53{ background-color: #FF5 }\n"
|
|
|
- ".d34{ color: #00B; } .l34{ color: #55F; } .b44{ background-color: #00B; } .b54{ background-color: #55F }\n"
|
|
|
- ".d35{ color: #B0B; } .l35{ color: #F5F; } .b45{ background-color: #B0B; } .b55{ background-color: #F5F }\n"
|
|
|
- ".d36{ color: #0BB; } .l36{ color: #5FF; } .b46{ background-color: #0BB; } .b56{ background-color: #5FF }\n"
|
|
|
- ".d37{ color: #BBB; } .l37{ color: #FFF; } .b47{ background-color: #BBB; } .b57{ background-color: #FFF }\n"
|
|
|
- ".d38{ color: #FFF; } .l38{ color: #FFF; } .b48{ background-color: #000; } .b58{ background-color: #000 }\n"
|
|
|
- ".d39{ color: #FFF; } .l39{ color: #FFF; } .b49{ background-color: #000; } .b59{ background-color: #000 }\n"
|
|
|
+ "body {font-family:Consolas;font-size:12pt}\n"
|
|
|
+ "a {text-decoration:none}\n"
|
|
|
+ "a:link {color:#06b}\n"
|
|
|
+ "a:visited {color:#6b0}\n"
|
|
|
+ "a:hover {text-decoration:underline}\n"
|
|
|
+ "a:active {color:#b06}\n"
|
|
|
"</style>\n"
|
|
|
"<body bgcolor='#000000'>\n"
|
|
|
"</head>\n"
|
|
|
"<pre>\n"
|
|
|
- "<span class='b49'><span class='d39'>\n",
|
|
|
+ "<span style='background-color:#000'><span style='color:#FFF'>\n",
|
|
|
HAS_BIT(gtd->ses->charset, CHARSET_FLAG_UTF8) ? "utf-8" :
|
|
|
HAS_BIT(ses->charset, CHARSET_FLAG_BIG5) ? "big5" :
|
|
|
HAS_BIT(ses->charset, CHARSET_FLAG_GBK1) ? "gb18030" : "iso-8859-1");
|
|
|
@@ -200,7 +189,9 @@ void write_html_header(struct session *ses, FILE *fp)
|
|
|
void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
{
|
|
|
char tmp[BUFFER_SIZE], *pti, *pto;
|
|
|
- char xtc[] = { '0', '6', '8', 'B', 'D', 'F' };
|
|
|
+ char xtc[6] = { '0', '6', '8', 'B', 'D', 'F' };
|
|
|
+ char *ans[16] = { "000", "A00", "0A0", "AA0", "00A", "A0A", "0AA", "AAA", "555", "F55", "5F5", "FF5", "55F", "F5F", "5FF", "FFF" };
|
|
|
+
|
|
|
int vtc, fgc, bgc, cnt;
|
|
|
int rgb[6] = { 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
|
@@ -292,8 +283,8 @@ void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
{
|
|
|
case 0:
|
|
|
vtc = 0;
|
|
|
- fgc = 39;
|
|
|
- bgc = 49;
|
|
|
+ fgc = 7;
|
|
|
+ bgc = 0;
|
|
|
break;
|
|
|
case 1:
|
|
|
SET_BIT(vtc, COL_BLD);
|
|
|
@@ -339,13 +330,16 @@ void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
DEL_BIT(vtc, COL_REV);
|
|
|
break;
|
|
|
case 38:
|
|
|
+ case 39:
|
|
|
SET_BIT(vtc, COL_XTF_5|COL_TCF_2);
|
|
|
- fgc = 38;
|
|
|
+ fgc = 7;
|
|
|
break;
|
|
|
case 48:
|
|
|
+ case 49:
|
|
|
SET_BIT(vtc, COL_XTB_5|COL_TCB_2);
|
|
|
- bgc = 48;
|
|
|
+ bgc = 0;
|
|
|
break;
|
|
|
+
|
|
|
default:
|
|
|
switch (atoi(tmp) / 10)
|
|
|
{
|
|
|
@@ -360,22 +354,21 @@ void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
}
|
|
|
if (atoi(tmp) / 10 == 4)
|
|
|
{
|
|
|
- bgc = atoi(tmp);
|
|
|
+ bgc = atoi(tmp) % 10;
|
|
|
}
|
|
|
- if (atoi(tmp) / 10 == 10)
|
|
|
+ else if (atoi(tmp) / 10 == 10)
|
|
|
{
|
|
|
- bgc = atoi(tmp) - 50;
|
|
|
+ bgc = atoi(tmp) % 10;
|
|
|
}
|
|
|
-
|
|
|
- if (atoi(tmp) / 10 == 3)
|
|
|
+ else if (atoi(tmp) / 10 == 3)
|
|
|
{
|
|
|
- fgc = atoi(tmp);
|
|
|
+ fgc = atoi(tmp) % 10;
|
|
|
}
|
|
|
- if (atoi(tmp) / 10 == 9)
|
|
|
+ else if (atoi(tmp) / 10 == 9)
|
|
|
{
|
|
|
SET_BIT(vtc, COL_BLD);
|
|
|
|
|
|
- fgc = atoi(tmp) - 60;
|
|
|
+ fgc = atoi(tmp) % 10;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -391,8 +384,8 @@ void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
if (!HAS_BIT(vtc, COL_REV) && HAS_BIT(ses->vtc, COL_REV))
|
|
|
{
|
|
|
cnt = fgc;
|
|
|
- fgc = ses->fgc = bgc - 10;
|
|
|
- bgc = ses->bgc = cnt + 10;
|
|
|
+ fgc = ses->fgc = bgc;
|
|
|
+ bgc = ses->bgc = cnt;
|
|
|
}
|
|
|
|
|
|
if (bgc != ses->bgc || fgc != ses->fgc || vtc != ses->vtc)
|
|
|
@@ -404,66 +397,58 @@ void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
{
|
|
|
if (HAS_BIT(vtc, COL_XTB))
|
|
|
{
|
|
|
- if (bgc < 8)
|
|
|
+ if (bgc < 16)
|
|
|
{
|
|
|
- sprintf(pto, "</span><span class='b%d'>", 40+bgc);
|
|
|
- }
|
|
|
- else if (bgc < 16)
|
|
|
- {
|
|
|
- sprintf(pto, "</span><span class='b%d'>", 50+bgc-8);
|
|
|
+ sprintf(pto, "</span><span style='background-color: #%s'>", ans[bgc]);
|
|
|
}
|
|
|
else if (bgc < 232)
|
|
|
{
|
|
|
- sprintf(pto, "</span><span style='background-color: #%c%c%c;'>", xtc[(bgc-16) / 36], xtc[(bgc-16) % 36 / 6], xtc[(bgc-16) % 6]);
|
|
|
+ sprintf(pto, "</span><span style='background-color: #%c%c%c'>", xtc[(bgc-16) / 36], xtc[(bgc-16) % 36 / 6], xtc[(bgc-16) % 6]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- sprintf(pto, "</span><span style='background-color: rgb(%d,%d,%d);'>", (bgc-232) * 10 + 8, (bgc-232) * 10 + 8,(bgc-232) * 10 + 8);
|
|
|
+ sprintf(pto, "</span><span style='background-color: rgb(%d,%d,%d)'>", (bgc-232) * 10 + 8, (bgc-232) * 10 + 8, (bgc-232) * 10 + 8);
|
|
|
}
|
|
|
}
|
|
|
else if (HAS_BIT(vtc, COL_TCB))
|
|
|
{
|
|
|
- sprintf(pto, "</span><span style='background-color: rgb(%d,%d,%d);'>", rgb[3], rgb[4], rgb[5]);
|
|
|
+ sprintf(pto, "</span><span style='background-color:#%02x%02x%02x'>", rgb[3], rgb[4], rgb[5]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- sprintf(pto, "</span><span class='b%d'>", bgc);
|
|
|
+ sprintf(pto, "</span><span style='background-color:#%s'>", ans[bgc]);
|
|
|
}
|
|
|
pto += strlen(pto);
|
|
|
}
|
|
|
|
|
|
if (HAS_BIT(vtc, COL_XTF))
|
|
|
{
|
|
|
- if (fgc < 8)
|
|
|
- {
|
|
|
- sprintf(pto, "<span class='d%d'>", 30+fgc);
|
|
|
- }
|
|
|
- else if (fgc < 16)
|
|
|
+ if (fgc < 16)
|
|
|
{
|
|
|
- sprintf(pto, "<span class='l%d'>", 30+fgc-8);
|
|
|
+ sprintf(pto, "</span><span style='color:#%s'>", ans[fgc]);
|
|
|
}
|
|
|
else if (fgc < 232)
|
|
|
{
|
|
|
- sprintf(pto, "<span style='color: #%c%c%c;'>", xtc[(fgc-16) / 36], xtc[(fgc-16) % 36 / 6], xtc[(fgc-16) % 6]);
|
|
|
+ sprintf(pto, "<span style='color:#%c%c%c'>", xtc[(fgc-16) / 36], xtc[(fgc-16) % 36 / 6], xtc[(fgc-16) % 6]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- sprintf(pto, "<span style='color: rgb(%d,%d,%d);'>", (fgc-232) * 10 + 8, (fgc-232) * 10 + 8,(fgc-232) * 10 + 8);
|
|
|
+ sprintf(pto, "<span style='color:rgb(%d,%d,%d)'>", (fgc-232) * 10 + 8, (fgc-232) * 10 + 8,(fgc-232) * 10 + 8);
|
|
|
}
|
|
|
}
|
|
|
else if (HAS_BIT(vtc, COL_TCF))
|
|
|
{
|
|
|
- sprintf(pto, "<span style='color: rgb(%d,%d,%d);'>", fgc / 256 / 256, fgc / 256 % 256, fgc % 256);
|
|
|
+ sprintf(pto, "<span style='color:#%02x%02x%02x'>", rgb[0], rgb[1], rgb[2]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (HAS_BIT(vtc, COL_BLD))
|
|
|
{
|
|
|
- sprintf(pto, "<span class='l%d'>", fgc);
|
|
|
+ sprintf(pto, "<span style='color:#%s'>", ans[fgc+8]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- sprintf(pto, "<span class='d%d'>", fgc);
|
|
|
+ sprintf(pto, "<span style='color:#%s'>", ans[fgc]);
|
|
|
}
|
|
|
}
|
|
|
pto += strlen(pto);
|
|
|
@@ -472,8 +457,8 @@ void vt102_to_html(struct session *ses, char *txt, char *out)
|
|
|
if (HAS_BIT(vtc, COL_REV) && !HAS_BIT(ses->vtc, COL_REV))
|
|
|
{
|
|
|
cnt = fgc;
|
|
|
- fgc = ses->fgc = bgc - 10;
|
|
|
- bgc = ses->bgc = cnt + 10;
|
|
|
+ fgc = ses->fgc = bgc;
|
|
|
+ bgc = ses->bgc = cnt;
|
|
|
}
|
|
|
|
|
|
ses->vtc = vtc;
|