home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume4 / kterm / part04 < prev    next >
Encoding:
Text File  |  1989-05-31  |  43.9 KB  |  1,498 lines

  1. Path: uunet!island!argv
  2. From: argv@island.uu.net (Dan Heller)
  3. Newsgroups: comp.sources.x
  4. Subject: v04i013:  kterm -- Kanji (japanese) xterm, Part04/04
  5. Message-ID: <782@island.uu.net>
  6. Date: 31 May 89 06:02:35 GMT
  7. Sender: news@island.uu.net
  8. Organization: Island Graphics, Marin County, California
  9. Lines: 1486
  10. Approved: island!argv@sun.com
  11.  
  12. Submitted-by: Hiroto Kagotani <kagotani@cs.titech.ac.jp>
  13. Posting-number: Volume 4, Issue 13
  14. Archive-name: kterm/part04
  15.  
  16. diff -rc ../xterm/data.c ./data.c
  17. *** ../xterm/data.c    Wed Sep  7 06:08:02 1988
  18. --- ./data.c    Tue May 30 14:53:39 1989
  19. ***************
  20. *** 1,5 ****
  21. --- 1,6 ----
  22.   /*
  23.    *    $XConsortium: data.c,v 1.4 88/09/06 17:08:01 jim Exp $
  24. +  *    $Header: data.c,v 1.1 89/05/30 14:53:38 kagotani Rel $
  25.    */
  26.   
  27.   #include <X11/copyright.h>
  28. ***************
  29. *** 35,40 ****
  30. --- 36,42 ----
  31.   
  32.   #ifndef lint
  33.   static char rcs_id[] = "$XConsortium: data.c,v 1.4 88/09/06 17:08:01 jim Exp $";
  34. + static char kterm_id[] = "$Header: data.c,v 1.1 89/05/30 14:53:38 kagotani Rel $";
  35.   #endif    /* lint */
  36.   
  37.   XPoint T_boxlarge[NBOX] = {
  38. ***************
  39. *** 84,89 ****
  40. --- 86,109 ----
  41.       {0, 0},
  42.       {0, 0},
  43.   };
  44. + #ifdef    KANJI    /* sano */
  45. + XPoint VTwbox[NBOX] = {
  46. +     {0, 0},
  47. +     {0, 0},
  48. +     {0, 0},
  49. +     {0, 0},
  50. +     {0, 0},
  51. + };
  52. + #endif    KANJI
  53. + #ifdef    STATUSLINE    /* michael */
  54. + XPoint status_box[NBOX] = {
  55. +     {0, 0},
  56. +     {0, 0},
  57. +     {0, 0},
  58. +     {0, 0},
  59. +     {0, 0},
  60. + };
  61. + #endif    STATUSLINE
  62.   T_fontsize Tfontsize[TEKNUMFONTS] = {
  63.       {9, 15},    /* large */
  64.       {8, 13},    /* #2 */
  65. diff -rc ../xterm/data.h ./data.h
  66. *** ../xterm/data.h    Wed Sep  7 06:08:03 1988
  67. --- ./data.h    Tue May 30 14:53:40 1989
  68. ***************
  69. *** 1,5 ****
  70. --- 1,6 ----
  71.   /*
  72.    *    $XConsortium: data.h,v 1.3 88/09/06 17:08:02 jim Exp $
  73. +  *    $Header: data.h,v 1.1 89/05/30 14:53:40 kagotani Rel $
  74.    */
  75.   
  76.   
  77. ***************
  78. *** 38,44 ****
  79. --- 39,51 ----
  80.   extern XPoint T_boxlarge[];
  81.   extern XPoint T_boxsmall[];
  82.   extern XPoint VTbox[];
  83. + #ifdef    KANJI    /* sano */
  84. + extern XPoint VTwbox[];
  85. + #endif    KANJI
  86.   extern T_fontsize Tfontsize[];
  87. + #ifdef    STATUSLINE    /* michael */
  88. + extern XPoint status_box[];
  89. + #endif    STATUSLINE
  90.   extern char *Tbptr;
  91.   extern char *Tbuffer;
  92.   extern char *Tpushb;
  93. diff -rc ../xterm/main.c ./main.c
  94. *** ../xterm/main.c    Fri May  5 00:43:59 1989
  95. --- ./main.c    Tue May 30 14:53:47 1989
  96. ***************
  97. *** 1,5 ****
  98. --- 1,6 ----
  99.   #ifndef lint
  100.   static char rcs_id[] = "$XConsortium: main.c,v 1.99 89/01/04 14:33:47 jim Exp $";
  101. + static char kterm_id[] = "$Header: main.c,v 1.1 89/05/30 14:53:43 kagotani Rel $";
  102.   #endif    /* lint */
  103.   
  104.   /*
  105. ***************
  106. *** 121,126 ****
  107. --- 122,131 ----
  108.   #endif
  109.   #endif
  110.   
  111. + #ifdef KEEPALIVE
  112. + #include <sys/socket.h>
  113. + #endif
  114.   #include "ptyx.h"
  115.   #include "data.h"
  116.   #include "error.h"
  117. ***************
  118. *** 271,276 ****
  119. --- 276,284 ----
  120.       char *tty_modes;
  121.       Boolean utmpInhibit;
  122.       Boolean sunFunctionKeys;    /* %%% should be widget resource? */
  123. + #ifdef KEEPALIVE
  124. +     Boolean keepalive;
  125. + #endif
  126.   } resource;
  127.   
  128.   #ifndef GETTY_EXE
  129. ***************
  130. *** 285,291 ****
  131. --- 293,303 ----
  132.   
  133.   static XtResource application_resources[] = {
  134.       {"name", "Name", XtRString, sizeof(char *),
  135. + #ifdef    KANJI    /* sano */
  136. +     offset(xterm_name), XtRString, "kterm"},
  137. + #else    KANJI
  138.       offset(xterm_name), XtRString, "xterm"},
  139. + #endif    KANJI
  140.       {"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
  141.       offset(icon_geometry), XtRString, (caddr_t) NULL},
  142.       {XtNtitle, XtCTitle, XtRString, sizeof(char *),
  143. ***************
  144. *** 300,305 ****
  145. --- 312,321 ----
  146.       offset(utmpInhibit), XtRString, "false"},
  147.       {"sunFunctionKeys", "SunFunctionKeys", XtRBoolean, sizeof (Boolean),
  148.       offset(sunFunctionKeys), XtRString, "false"},
  149. + #ifdef KEEPALIVE
  150. +     {"keepAlive", "KeepAlive", XtRBoolean, sizeof (Boolean),
  151. +     offset(keepalive), XtRString, "false"},
  152. + #endif
  153.   };
  154.   #undef offset
  155.   
  156. ***************
  157. *** 323,330 ****
  158. --- 339,357 ----
  159.   {"+cu",        "*curses",    XrmoptionNoArg,        (caddr_t) "off"},
  160.   {"-e",        NULL,        XrmoptionSkipLine,    (caddr_t) NULL},
  161.   {"-fb",        "*boldFont",    XrmoptionSepArg,    (caddr_t) NULL},
  162. + #ifdef    KANJI    /* sano */
  163. + {"-fr",        "*kanaFont",    XrmoptionSepArg,    (caddr_t) NULL},
  164. + {"-frb",    "*kanaboldFont",XrmoptionSepArg,    (caddr_t) NULL},
  165. + {"-fk",        "*kanjiFont",    XrmoptionSepArg,    (caddr_t) NULL},
  166. + {"-fkb",    "*kanjiboldFont", XrmoptionSepArg,    (caddr_t) NULL},
  167. + {"-km",        "*kanjiMode",    XrmoptionSepArg,    (caddr_t) NULL},
  168. + #endif    KANJI
  169.   {"-j",        "*jumpScroll",    XrmoptionNoArg,        (caddr_t) "on"},
  170.   {"+j",        "*jumpScroll",    XrmoptionNoArg,        (caddr_t) "off"},
  171. + #ifdef KEEPALIVE
  172. + {"-ka",        "*keepAlive",    XrmoptionNoArg,        (caddr_t) "on"},
  173. + {"+ka",        "*keepAlive",    XrmoptionNoArg,        (caddr_t) "off"},
  174. + #endif
  175.   {"-l",        "*logging",    XrmoptionNoArg,        (caddr_t) "on"},
  176.   {"+l",        "*logging",    XrmoptionNoArg,        (caddr_t) "off"},
  177.   {"-lf",        "*logFile",    XrmoptionSepArg,    (caddr_t) NULL},
  178. ***************
  179. *** 347,352 ****
  180. --- 374,385 ----
  181.   {"+si",        "*scrollInput",    XrmoptionNoArg,        (caddr_t) "on"},
  182.   {"-sk",        "*scrollKey",    XrmoptionNoArg,        (caddr_t) "on"},
  183.   {"+sk",        "*scrollKey",    XrmoptionNoArg,        (caddr_t) "off"},
  184. + #ifdef    STATUSLINE    /* michael */
  185. + {"-st",        "*statusLine",    XrmoptionNoArg,        (caddr_t) "on"},
  186. + {"+st",        "*statusLine",    XrmoptionNoArg,        (caddr_t) "off"},
  187. + {"-sn",        "*statusNormal",XrmoptionNoArg,        (caddr_t) "on"},
  188. + {"+sn",        "*statusNormal",XrmoptionNoArg,        (caddr_t) "off"},
  189. + #endif    STATUSLINE
  190.   {"-sl",        "*saveLines",    XrmoptionSepArg,    (caddr_t) NULL},
  191.   {"-t",        "*tekStartup",    XrmoptionNoArg,        (caddr_t) "on"},
  192.   {"+t",        "*tekStartup",    XrmoptionNoArg,        (caddr_t) "off"},
  193. ***************
  194. *** 395,401 ****
  195. --- 428,444 ----
  196.   { "-cr color",             "text cursor color" },
  197.   { "-/+cu",                 "turn on/off curses emulation" },
  198.   { "-fb fontname",          "bold text font" },
  199. + #ifdef    KANJI    /* sano */
  200. + { "-fr fontname",          "normal kana font" },
  201. + { "-frb fontname",         "bold kana font" },
  202. + { "-fk fontname",          "normal kanji font" },
  203. + { "-fkb fontname",         "bold kanji font" },
  204. + { "-km kanjimode",         "input kanji code (jis|euc|sjis)" },
  205. + #endif    KANJI
  206.   { "-/+j",                  "turn on/off jump scroll" },
  207. + #ifdef KEEPALIVE
  208. + { "-/+ka",                  "turn on/off keeping connection alive" },
  209. + #endif
  210.   { "-/+l",                  "turn on/off logging" },
  211.   { "-lf filename",          "logging filename" },
  212.   { "-/+ls",                 "turn on/off login shell" },
  213. ***************
  214. *** 410,415 ****
  215. --- 453,462 ----
  216.   { "-/+si",                 "turn on/off scroll-on-input inhibit" },
  217.   { "-/+sk",                 "turn on/off scroll-on-keypress" },
  218.   { "-sl number",            "number of scrolled lines to save" },
  219. + #ifdef    STATUSLINE    /* michael */
  220. + { "-sn",                   "make status line normal video" },
  221. + { "-st",                   "turn on status line" },
  222. + #endif    STATUSLINE
  223.   { "-/+t",                  "turn on/off Tek emulation window" },
  224.   { "-tm string",            "terminal mode keywords and characters" },
  225.   { "-tn name",              "TERM environment variable name" },
  226. ***************
  227. *** 627,638 ****
  228. --- 674,701 ----
  229.           }
  230.       }
  231.       /* Init the Toolkit. */
  232. + #ifdef    KANJI    /* sano */
  233. +     toplevel = XtInitialize("xterm", "KTerm",
  234. + #else    KANJI
  235.       toplevel = XtInitialize("xterm", "XTerm",
  236. + #endif    KANJI
  237.           optionDescList, XtNumber(optionDescList), &argc, argv);
  238.   
  239.       XtGetApplicationResources( toplevel, &resource, application_resources,
  240.                      XtNumber(application_resources), NULL, 0 );
  241.   
  242. + #ifdef KEEPALIVE
  243. +     if (resource.keepalive) {
  244. +         int     on = 1;
  245. +         (void)setsockopt(ConnectionNumber(XtDisplay(toplevel)),
  246. +                 SOL_SOCKET, SO_KEEPALIVE,
  247. +                 (char *)&on, sizeof(on));
  248. +     }
  249. + #endif
  250. + #ifdef KANJI
  251. +     /* Atom Initialize */
  252. +     SelAtomInitialize();
  253. + #endif
  254.       /*
  255.        * fill in terminal modes
  256.        */
  257. ***************
  258. *** 649,655 ****
  259. --- 712,722 ----
  260.   
  261.       xterm_name = resource.xterm_name;
  262.       sunFunctionKeys = resource.sunFunctionKeys;
  263. + #ifdef    KANJI    /* sano */
  264. +     if (strcmp(xterm_name, "-") == 0) xterm_name = "kterm";
  265. + #else    KANJI
  266.       if (strcmp(xterm_name, "-") == 0) xterm_name = "xterm";
  267. + #endif    KANJI
  268.       if (resource.icon_geometry != NULL) {
  269.           int scr, junk;
  270.           Arg args[2];
  271. ***************
  272. *** 743,748 ****
  273. --- 810,831 ----
  274.   #endif /* DO_AUTOREPEAT */
  275.       if (!screen->jumpscroll)    term->flags |= SMOOTHSCROLL;
  276.       if (term->misc.reverseWrap)        term->flags |= REVERSEWRAP;
  277. + #ifdef    KANJI    /* sano */
  278. +     /*
  279. +      * Reflect the kanji mode into the flags.
  280. +      * Note that SJIS_KANJI and EUC_KANJI are mutually exclusive.
  281. +      * Reset both bits if `jis' is specified.
  282. +      */
  283. +     if (term->misc.k_m)
  284. +         if (strcmp(term->misc.k_m, "euc") == 0) {
  285. +             term->flags &= ~SJIS_KANJI;
  286. +             term->flags |= EUC_KANJI;
  287. +         } else if (strcmp(term->misc.k_m, "sjis") == 0) {
  288. +             term->flags &= ~EUC_KANJI;
  289. +             term->flags |= SJIS_KANJI;
  290. +         } else if (strcmp(term->misc.k_m, "jis") == 0)
  291. +             term->flags &= ~(EUC_KANJI | SJIS_KANJI);
  292. + #endif
  293.   
  294.       inhibit = 0;
  295.       if (term->misc.logInhibit)            inhibit |= I_LOG;
  296. ***************
  297. *** 749,754 ****
  298. --- 832,841 ----
  299.       if (term->misc.signalInhibit)        inhibit |= I_SIGNAL;
  300.       if (term->misc.tekInhibit)            inhibit |= I_TEK;
  301.   
  302. + #ifdef    STATUSLINE    /* michael */
  303. +     screen->reversestatus = !term->misc.statusnormal;
  304. + #endif    STATUSLINE
  305.       term->initflags = term->flags;
  306.   
  307.   /*
  308. ***************
  309. *** 1035,1040 ****
  310. --- 1122,1130 ----
  311.   };
  312.   
  313.   static char *vtterm[] = {
  314. + #ifdef    KANJI    /* sano */
  315. +     "kterm",
  316. + #endif    KANJI
  317.   #ifdef USE_X11TERM
  318.       "x11term",        /* for people who want special term name */
  319.   #endif
  320. ***************
  321. *** 1537,1543 ****
  322. --- 1627,1642 ----
  323.               }
  324.   #endif    /* TIOCCONS */
  325.   #else    /* USE_SYSV_TERMIO */
  326. + #ifdef    KANJI    /* michael */
  327. +             /*
  328. +              * EUC and SJIS require 8bit transparent pty module.
  329. +              * Even in such a case, parity should not be specified.
  330. +              */
  331. +             sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW
  332. +                     | EVENP | ODDP);
  333. + #else    KANJI
  334.               sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW);
  335. + #endif    KANJI
  336.               sg.sg_flags |= ECHO | CRMOD;
  337.               /* make sure speed is set on pty so that editors work right*/
  338.               sg.sg_ispeed = B9600;
  339. diff -rc ../xterm/main.h ./main.h
  340. *** ../xterm/main.h    Wed Sep  7 06:08:13 1988
  341. --- ./main.h    Tue May 30 14:53:49 1989
  342. ***************
  343. *** 1,5 ****
  344. --- 1,6 ----
  345.   /*
  346.    *    $XConsortium: main.h,v 1.3 88/09/06 17:08:12 jim Exp $
  347. +  *    $Header: main.h,v 1.1 89/05/30 14:53:48 kagotani Rel $
  348.    */
  349.   
  350.   
  351. ***************
  352. *** 30,36 ****
  353. --- 31,48 ----
  354.   
  355.   /* @(#)main.h\tX10/6.6\t11/10/86 */
  356.   
  357. + #ifdef    KANJI
  358. + #define    DEFBOLDFONT        " "
  359. + #define    DEFBORDER        2
  360. + #define    DEFBORDERWIDTH        1
  361. + #define    DEFFONT            "a14"
  362. + #define    DEFKANAFONT        "kana14"
  363. + #define    DEFKANABOLDFONT        " "
  364. + #define    DEFKANJIFONT        "k14"
  365. + #define    DEFKANJIBOLDFONT    " "
  366. + #else    KANJI
  367.   #define    DEFBOLDFONT        "fixed"
  368.   #define    DEFBORDER        2
  369.   #define    DEFBORDERWIDTH        2
  370.   #define    DEFFONT            "fixed"
  371. + #endif    KANJI
  372. diff -rc ../xterm/ptyx.h ./ptyx.h
  373. *** ../xterm/ptyx.h    Mon Nov 21 13:12:07 1988
  374. --- ./ptyx.h    Tue May 30 14:53:52 1989
  375. ***************
  376. *** 1,5 ****
  377. --- 1,6 ----
  378.   /*
  379.    *    $XConsortium: ptyx.h,v 1.20 88/11/16 18:13:26 rws Exp $
  380. +  *    $Header: ptyx.h,v 1.1 89/05/30 14:53:51 kagotani Rel $
  381.    */
  382.   
  383.   #include <X11/copyright.h>
  384. ***************
  385. *** 106,111 ****
  386. --- 107,119 ----
  387.   #endif    /* !hpux */
  388.   #endif    /* !PTYCHAR2 */
  389.   
  390. + #ifdef KANJI
  391. + #ifndef WCHAR_T
  392. + #define WCHAR_T
  393. + typedef unsigned short    wchar_t;
  394. + #endif
  395. + #endif
  396.   /* Until the translation manager comes along, I have to do my own translation of
  397.    * mouse events into the proper routines. */
  398.   
  399. ***************
  400. *** 164,170 ****
  401. --- 172,182 ----
  402.       unsigned    flags;    /* Vt100 saves graphics rendition. Ugh! */
  403.       char        curgl;
  404.       char        curgr;
  405. + #ifdef    KANJI    /* sano */
  406. +     short        gsets[4];
  407. + #else    KANJI
  408.       char        gsets[4];
  409. + #endif    KANJI
  410.   } SavedCursor;
  411.   
  412.   #define    TEKNUMFONTS    4
  413. ***************
  414. *** 205,212 ****
  415. --- 217,240 ----
  416.       GC        reverseGC;    /* reverse painting        */
  417.       GC        normalboldGC;    /* normal painting, bold font    */
  418.       GC        reverseboldGC;    /* reverse painting, bold font    */
  419. + #ifdef    KANJI    /* sano */
  420. +     GC        r_normalGC;    /* normal GR painting        */
  421. +     GC        r_reverseGC;    /* reverse GR painting        */
  422. +     GC        r_normalboldGC;    /* normal GR painting, bold font*/
  423. +     GC        r_reverseboldGC;/* reverse GR painting, bold font*/
  424. +     GC        w_normalGC;    /* normal kanji painting    */
  425. +     GC        w_reverseGC;    /* reverse kanji painting    */
  426. +     GC        w_normalboldGC;    /* normal kanji, bold font    */
  427. +     GC        w_reverseboldGC;/* reverse kanji, bold font    */
  428. + #endif    KANJI
  429.       GC        cursorGC;    /* normal cursor painting    */
  430.       GC        reversecursorGC;/* reverse cursor painting    */
  431. + #ifdef    KANJI    /* michael */
  432. +     GC        r_cursorGC;    /* normal kana cursor painting    */
  433. +     GC        r_reversecursorGC;/* reverse kana cursor     */
  434. +     GC        w_cursorGC;    /* normal kanji cursor painting    */
  435. +     GC        w_reversecursorGC;/* reverse kanji cursor     */
  436. + #endif    KANJI
  437.       GC        cursoroutlineGC;/* for painting lines around    */
  438.       Pixel        foreground;    /* foreground color        */
  439.       Pixel        cursorcolor;    /* Cursor color            */
  440. ***************
  441. *** 242,248 ****
  442. --- 270,287 ----
  443.       /* Terminal fonts must be of the same size and of fixed width */
  444.       XFontStruct    *fnt_norm;    /* normal font of terminal    */
  445.       XFontStruct    *fnt_bold;    /* bold font of terminal    */
  446. + #ifdef    KANJI    /* sano */
  447. +     XFontStruct    *fnt_r_norm;    /* normal GR font of terminal    */
  448. +     XFontStruct    *fnt_r_bold;    /* bold GR font of terminal    */
  449. +     XFontStruct    *fnt_w_norm;    /* normal kanji font of terminal*/
  450. +     XFontStruct    *fnt_w_bold;    /* bold kanji font of terminal    */
  451. + #endif    KANJI
  452.       int        enbolden;    /* overstrike for bold font    */
  453. + #ifdef    KANJI    /* sano */
  454. +     int        r_enbolden;    /* overstrike for GR bold    */
  455. +     int        w_enbolden;    /* overstrike for kanji bold    */
  456. +     XPoint        *w_box;        /* draw unselected cursor    */
  457. + #endif    KANJI
  458.       XPoint        *box;        /* draw unselected cursor    */
  459.   
  460.       int        cursor_state;    /* ON or OFF            */
  461. ***************
  462. *** 283,291 ****
  463. --- 322,341 ----
  464.       int        scrolls;    /* outstanding scroll count    */
  465.       SavedCursor    sc;        /* data for restore cursor    */
  466.       int        save_modes[19];    /* save dec private modes    */
  467. + #ifdef    STATUSLINE    /* michael */
  468. +     Boolean        statusline;    /* status line showing        */
  469. +     int        statusheight;    /* status line height        */
  470. +     Boolean        instatus;    /* cursor in status line    */
  471. +     SavedCursor    statussc;    /* status line restore cursor    */
  472. +     Boolean        reversestatus;    /* status line reversed        */
  473. + #endif    STATUSLINE
  474.   
  475.       /* Improved VT100 emulation stuff.                */
  476. + #ifdef    KANJI    /* sano */
  477. +     short        gsets[4];    /* G0 through G3.        */
  478. + #else    KANJI
  479.       char        gsets[4];    /* G0 through G3.        */
  480. + #endif    KANJI
  481.       char        curgl;        /* Current GL setting.        */
  482.       char        curgr;        /* Current GR setting.        */
  483.       char        curss;        /* Current single shift.    */
  484. ***************
  485. *** 334,340 ****
  486. --- 384,394 ----
  487.       char        *charClass;    /* for overriding word selection */
  488.       Boolean        cutNewline;    /* whether or not line cut has \n */
  489.       Boolean        cutToBeginningOfLine;  /* line cuts to BOL? */
  490. + #ifdef KANJI
  491. +     wchar_t        *selection;    /* the current selection */
  492. + #else
  493.       char        *selection;    /* the current selection */
  494. + #endif
  495.       int        selection_size; /* size of allocated buffer */
  496.       int        selection_length; /* number of significant bytes */
  497.       int        selection_time;    /* latest event timestamp */
  498. ***************
  499. *** 362,367 ****
  500. --- 416,428 ----
  501.       char *T_geometry;
  502.       char *f_n;
  503.       char *f_b;
  504. + #ifdef    KANJI    /* sano */
  505. +     char *f_rn;
  506. +     char *f_rb;
  507. +     char *f_kn;
  508. +     char *f_kb;
  509. +     char *k_m;
  510. + #endif
  511.       Boolean log_on;
  512.       Boolean login_shell;
  513.       Boolean re_verse;
  514. ***************
  515. *** 371,376 ****
  516. --- 432,440 ----
  517.       Boolean tekInhibit;
  518.       Boolean scrollbar;
  519.       Boolean titeInhibit;
  520. + #ifdef    STATUSLINE    /* michael */
  521. +     Boolean statusnormal;
  522. + #endif    STATUSLINE
  523.   } Misc;
  524.   
  525.   typedef struct {int foo;} XtermClassPart, TekClassPart;
  526. ***************
  527. *** 418,423 ****
  528. --- 482,504 ----
  529.   #define INVERSE        0x01    /* invert the characters to be output */
  530.   #define UNDERLINE    0x02    /* true if underlining */
  531.   #define BOLD        0x04
  532. + #ifdef    KANJI    /* sano */
  533. + #define    KCS        0x18    /* true if on KANJI char */
  534. + #define    KCS1        0x08    /* true if on the first byte of a Kanji char */
  535. + #define    KCS2        0x10    /* true if on the second byte of a Kanji char */
  536. + #define    KANACS        0x20    /* true if on KANA char */
  537. + #define WRAPAROUND    0x2000
  538. + #define REVERSE_VIDEO    0x4000    /* true if screen white on black */
  539. + #define ORIGIN        0x8000    /* true if in origin mode */
  540. + #define INSERT        0x10000    /* true if in insert mode */
  541. + #define SMOOTHSCROLL    0x20000    /* true if in smooth scroll mode */
  542. + #define AUTOREPEAT    0x40000    /* true if in autorepeat mode */
  543. + #define IN132COLUMNS    0x80000    /* true if in 132 column mode */
  544. + #define LINEFEED    0x100000
  545. + #define    REVERSEWRAP    0x200000/* true if reverse wraparound mode */
  546. + #define    EUC_KANJI    0x400000/* true if in EUC mode */
  547. + #define    SJIS_KANJI    0x800000/* true if in SJIS mode */
  548. + #else    KANJI
  549.   #define WRAPAROUND    0x08
  550.   #define REVERSE_VIDEO    0x10    /* true if screen white on black */
  551.   #define ORIGIN        0x20    /* true if in origin mode */
  552. ***************
  553. *** 429,438 ****
  554. --- 510,528 ----
  555.   #define IN132COLUMNS    0x200    /* true if in 132 column mode */
  556.   #define LINEFEED    0x400
  557.   #define    REVERSEWRAP    0x800    /* true if reverse wraparound mode */
  558. + #endif    KANJI
  559.   
  560. + #ifdef    KANJI    /* sano */
  561. + #define    ATTRIBUTES    0x3f    /* attributes mask including KCS/KANACS */
  562. + #else    KANJI
  563.   #define    ATTRIBUTES    0x07    /* attributes mask */
  564. + #endif    KANJI
  565.   #define CHAR        0177
  566.   
  567. + #ifdef    KANJI    /* sano */
  568. + #define    MBCS        0x80    /* MBCS stands for Multi Byte Character Set */
  569. + #endif    KANJI
  570.   #define VWindow(screen)        (screen->fullVwin.window)
  571.   #define VShellWindow        term->core.parent->core.window
  572.   #define TextWindow(screen)      (screen->fullVwin.window)
  573. ***************
  574. *** 452,459 ****
  575. --- 542,556 ----
  576.   
  577.   #define CursorX(screen,col) ((col) * FontWidth(screen) + screen->border \
  578.               + screen->scrollbar)
  579. + #ifdef    STATUSLINE    /* michael */
  580. + #define    CursorY(screen,row) ((screen->instatus?\
  581. +             ((row) * FontHeight(screen) + 1)\
  582. +             : (((row) - screen->topline) * FontHeight(screen)))\
  583. +             + screen->border)
  584. + #else    STATUSLINE
  585.   #define CursorY(screen,row) ((((row) - screen->topline) * FontHeight(screen)) \
  586.               + screen->border)
  587. + #endif    STATUSLINE
  588.   
  589.   #define    TWINDOWEVENTS    (KeyPressMask | ExposureMask | ButtonPressMask |\
  590.                ButtonReleaseMask | StructureNotifyMask |\
  591. diff -rc ../xterm/screen.c ./screen.c
  592. *** ../xterm/screen.c    Thu May  4 20:19:27 1989
  593. --- ./screen.c    Tue May 30 14:53:54 1989
  594. ***************
  595. *** 1,5 ****
  596. --- 1,6 ----
  597.   /*
  598.    *    $XConsortium: screen.c,v 1.10 89/01/03 16:18:06 jim Exp $
  599. +  *    $Header: screen.c,v 1.1 89/05/30 14:53:53 kagotani Rel $
  600.    */
  601.   
  602.   #include <X11/copyright.h>
  603. ***************
  604. *** 31,36 ****
  605. --- 32,38 ----
  606.   
  607.   #ifndef lint
  608.   static char rcs_id[] = "$XConsortium: screen.c,v 1.10 89/01/03 16:18:06 jim Exp $";
  609. + static char kterm_id[] = "$Header: screen.c,v 1.1 89/05/30 14:53:53 kagotani Rel $";
  610.   #endif    /* lint */
  611.   
  612.   #include <X11/Xlib.h>
  613. ***************
  614. *** 57,62 ****
  615. --- 59,67 ----
  616.   {
  617.       register ScrnBuf base;
  618.   
  619. + #ifdef    STATUSLINE    /* kato */
  620. +     nrow++;
  621. + #endif    STATUSLINE
  622.       if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 2), sizeof (char *))) == 0)
  623.           SysError (ERROR_SCALLOC);
  624.   
  625. ***************
  626. *** 90,95 ****
  627. --- 95,109 ----
  628.       att = screen->buf[avail + 1] + screen->cur_col;
  629.       flags &= ATTRIBUTES;
  630.       Bcopy(str, col, length);
  631. + #ifdef    KANJI    /* sano */
  632. +     if (flags & KCS) {
  633. +         while (length > 0) {
  634. +             *att++ = flags & ~KCS2;
  635. +             *att++ = flags & ~KCS1;
  636. +             length -= 2;
  637. +         }
  638. +     } else
  639. + #endif    KANJI
  640.       while(length-- > 0)
  641.           *att++ = flags;
  642.   }
  643. ***************
  644. *** 224,234 ****
  645. --- 238,260 ----
  646.       int maxrow = toprow + nrows - 1;
  647.       int scrollamt = screen->scroll_amt;
  648.       int max = screen->max_row;
  649. + #ifdef    STATUSLINE    /* michael */
  650. +     int dostatus = 0, left, width;
  651. + #endif    STATUSLINE
  652.   
  653. + #ifdef    STATUSLINE    /* michael */
  654. +     if (screen->statusline && maxrow == screen->max_row + 1) {
  655. +         dostatus++;
  656. +         maxrow--;
  657. +     }
  658. + #endif    STATUSLINE
  659.       if(screen->cursor_col >= leftcol && screen->cursor_col <=
  660.        (leftcol + ncols - 1) && screen->cursor_row >= toprow + topline &&
  661.        screen->cursor_row <= maxrow + topline)
  662.           screen->cursor_state = OFF;
  663. + #ifdef    STATUSLINE    /* michael */
  664. +     for ( ; ; ) {
  665. + #endif    STATUSLINE
  666.       for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) {
  667.          register char *chars;
  668.          register char *att;
  669. ***************
  670. *** 283,297 ****
  671.              hilite = True;
  672.          }
  673.   
  674.          if (col > maxcol) continue;
  675.   
  676.          flags = att[col];
  677.   
  678.          if ( (!hilite && (flags & INVERSE) != 0) ||
  679.               (hilite && (flags & INVERSE) == 0) )
  680.              if (flags & BOLD) gc = screen->reverseboldGC;
  681.              else gc = screen->reverseGC;
  682. !        else 
  683.              if (flags & BOLD) gc = screen->normalboldGC;
  684.              else gc = screen->normalGC;
  685.   
  686. --- 309,377 ----
  687.              hilite = True;
  688.          }
  689.   
  690. + #ifdef    KANJI    /* sano */
  691. +        if ((att[col] & KCS2) && col != 0)
  692. +            col--;
  693. +        if (att[maxcol] & KCS1)
  694. +            maxcol++;
  695. + #endif
  696.          if (col > maxcol) continue;
  697.   
  698.          flags = att[col];
  699.   
  700. + #ifdef    KANJI    /* sano */
  701. +        if (flags & KCS)
  702. + #ifdef    STATUSLINE    /* michael */
  703. +         if ((!hilite && (flags & INVERSE) != 0
  704. +             || hilite && (flags & INVERSE) == 0)
  705. +             ^ (dostatus < 0 && screen->reversestatus)) {
  706. + #else    STATUSLINE
  707. +         if (!hilite && (flags & INVERSE) != 0
  708. +             || hilite && (flags & INVERSE) == 0) {
  709. + #endif    STATUSLINE
  710. +             if (flags & BOLD)
  711. +                 gc = screen->w_reverseboldGC;
  712. +             else
  713. +                 gc = screen->w_reverseGC;
  714. +         } else {
  715. +             if (flags & BOLD)
  716. +                 gc = screen->w_normalboldGC;
  717. +             else
  718. +                 gc = screen->w_normalGC;
  719. +         }
  720. +        else if (flags & KANACS)
  721. + #ifdef    STATUSLINE    /* michael */
  722. +         if ((!hilite && (flags & INVERSE) != 0
  723. +             || hilite && (flags & INVERSE) == 0)
  724. +             ^ (dostatus < 0 && screen->reversestatus)) {
  725. + #else    STATUSLINE
  726. +         if (!hilite && (flags & INVERSE) != 0
  727. +             || hilite && (flags & INVERSE) == 0) {
  728. + #endif    STATUSLINE
  729. +             if (flags & BOLD)
  730. +                 gc = screen->r_reverseboldGC;
  731. +             else
  732. +                 gc = screen->r_reverseGC;
  733. +         } else {
  734. +             if (flags & BOLD)
  735. +                 gc = screen->r_normalboldGC;
  736. +             else
  737. +                 gc = screen->r_normalGC;
  738. +         }
  739. +     else
  740. + #endif    KANJI
  741. + #ifdef    STATUSLINE    /* michael */
  742. +         if ((!hilite && (flags & INVERSE) != 0
  743. +             || hilite && (flags & INVERSE) == 0)
  744. +             ^ (dostatus < 0 && screen->reversestatus))
  745. + #else    STATUSLINE
  746.          if ( (!hilite && (flags & INVERSE) != 0) ||
  747.               (hilite && (flags & INVERSE) == 0) )
  748. + #endif    STATUSLINE
  749.              if (flags & BOLD) gc = screen->reverseboldGC;
  750.              else gc = screen->reverseGC;
  751. !        else
  752.              if (flags & BOLD) gc = screen->normalboldGC;
  753.              else gc = screen->normalGC;
  754.   
  755. ***************
  756. *** 300,310 ****
  757. --- 380,409 ----
  758.   
  759.          for (; col <= maxcol; col++) {
  760.           if (att[col] != flags) {
  761. + #ifdef    KANJI    /* sano */
  762. +            if (flags & KCS) {
  763. +             XDrawImageString16(screen->display, TextWindow(screen),
  764. +                 gc, x, y, (XChar2b *)&chars[lastind],
  765. +                 (n = col - lastind) / 2);
  766. +             if ((flags & BOLD) && screen->w_enbolden)
  767. +                 XDrawString16(screen->display, TextWindow(screen),
  768. +                 gc, x + 1, y, (XChar2b *)&chars[lastind], n/2);
  769. +            } else if (flags & KANACS) {
  770. +                XDrawImageString(screen->display, TextWindow(screen),
  771. +                 gc, x, y, &chars[lastind], n = col - lastind);
  772. +                if ((flags & BOLD) && screen->r_enbolden)
  773. +                  XDrawString(screen->display, TextWindow(screen),
  774. +                      gc, x + 1, y, &chars[lastind], n);
  775. +            } else {
  776. + #endif    KANJI
  777.              XDrawImageString(screen->display, TextWindow(screen), 
  778.                       gc, x, y, &chars[lastind], n = col - lastind);
  779.              if((flags & BOLD) && screen->enbolden)
  780.                XDrawString(screen->display, TextWindow(screen), 
  781.                gc, x + 1, y, &chars[lastind], n);
  782. + #ifdef    KANJI    /* sano */
  783. +            }
  784. + #endif    KANJI
  785.              if(flags & UNDERLINE) 
  786.               XDrawLine(screen->display, TextWindow(screen), 
  787.                gc, x, y+1, x+n*FontWidth(screen), y+1);
  788. ***************
  789. *** 315,322 ****
  790.   
  791.              flags = att[col];
  792.   
  793. !               if ((!hilite && (flags & INVERSE) != 0) ||
  794. !                (hilite && (flags & INVERSE) == 0) )
  795.                      if (flags & BOLD) gc = screen->reverseboldGC;
  796.                      else gc = screen->reverseGC;
  797.                 else 
  798. --- 414,469 ----
  799.   
  800.              flags = att[col];
  801.   
  802. ! #ifdef    KANJI    /* sano */
  803. !            if (flags & KCS)
  804. ! #ifdef    STATUSLINE    /* michael */
  805. !             if ((!hilite && (flags & INVERSE) != 0
  806. !                 || hilite && (flags & INVERSE) == 0)
  807. !                 ^ (dostatus < 0 && screen->reversestatus)) {
  808. ! #else    STATUSLINE
  809. !             if (!hilite && (flags & INVERSE) != 0
  810. !                 || hilite && (flags & INVERSE) == 0) {
  811. ! #endif    STATUSLINE
  812. !                 if (flags & BOLD)
  813. !                 gc = screen->w_reverseboldGC;
  814. !                 else
  815. !                 gc = screen->w_reverseGC;
  816. !             } else {
  817. !                 if (flags & BOLD)
  818. !                 gc = screen->w_normalboldGC;
  819. !                 else
  820. !                 gc = screen->w_normalGC;
  821. !             }
  822. !             else if (flags & KANACS)
  823. ! #ifdef    STATUSLINE    /* michael */
  824. !             if ((!hilite && (flags & INVERSE) != 0
  825. !                 || hilite && (flags & INVERSE) == 0)
  826. !                 ^ (dostatus < 0 && screen->reversestatus)) {
  827. ! #else    STATUSLINE
  828. !             if (!hilite && (flags & INVERSE) != 0
  829. !                 || hilite && (flags & INVERSE) == 0) {
  830. ! #endif    STATUSLINE
  831. !                 if (flags & BOLD)
  832. !                 gc = screen->r_reverseboldGC;
  833. !                 else
  834. !                 gc = screen->r_reverseGC;
  835. !             } else {
  836. !                 if (flags & BOLD)
  837. !                 gc = screen->r_normalboldGC;
  838. !                 else
  839. !                 gc = screen->r_normalGC;
  840. !             }
  841. !             else
  842. ! #endif    KANJI
  843. !                 
  844. ! #ifdef    STATUSLINE    /* michael */
  845. !             if ((!hilite && (flags & INVERSE) != 0
  846. !             || hilite && (flags & INVERSE) == 0)
  847. !             ^ (dostatus < 0 && screen->reversestatus))
  848. ! #else    STATUSLINE
  849. !                if (!hilite && (flags & INVERSE) != 0
  850. !                 || hilite && (flags & INVERSE) == 0)
  851. ! #endif    STATUSLINE
  852.                      if (flags & BOLD) gc = screen->reverseboldGC;
  853.                      else gc = screen->reverseGC;
  854.                 else 
  855. ***************
  856. *** 326,350 ****
  857.   
  858.           if(chars[col] == 0)
  859.               chars[col] = ' ';
  860.          }
  861.   
  862.   
  863. !        if ( (!hilite && (flags & INVERSE) != 0) ||
  864. !             (hilite && (flags & INVERSE) == 0) )
  865.              if (flags & BOLD) gc = screen->reverseboldGC;
  866.              else gc = screen->reverseGC;
  867.          else 
  868.              if (flags & BOLD) gc = screen->normalboldGC;
  869.              else gc = screen->normalGC;
  870.          XDrawImageString(screen->display, TextWindow(screen), gc, 
  871.                x, y, &chars[lastind], n = col - lastind);
  872.          if((flags & BOLD) && screen->enbolden)
  873.           XDrawString(screen->display, TextWindow(screen), gc,
  874.           x + 1, y, &chars[lastind], n);
  875.          if(flags & UNDERLINE) 
  876.           XDrawLine(screen->display, TextWindow(screen), gc, 
  877.            x, y+1, x + n * FontWidth(screen), y+1);
  878.       }
  879.   }
  880.   
  881.   ClearBufRows (screen, first, last)
  882. --- 473,592 ----
  883.   
  884.           if(chars[col] == 0)
  885.               chars[col] = ' ';
  886. + #ifdef    KANJI    /* sano */
  887. +         if (att[col] & KCS1)
  888. +             col++;
  889. + #endif    KANJI
  890.          }
  891.   
  892.   
  893. ! #ifdef    KANJI    /* sano */
  894. !        if (flags & KCS)
  895. ! #ifdef    STATUSLINE    /* michael */
  896. !         if ((!hilite && (flags & INVERSE) != 0
  897. !              || hilite && (flags & INVERSE) == 0)
  898. !             ^ (dostatus < 0 && screen->reversestatus)) {
  899. ! #else    STATUSLINE
  900. !         if (!hilite && (flags & INVERSE) != 0
  901. !             || hilite && (flags & INVERSE) == 0) {
  902. ! #endif    STATUSLINE
  903. !             if (flags & BOLD)
  904. !             gc = screen->w_reverseboldGC;
  905. !             else
  906. !             gc = screen->w_reverseGC;
  907. !         } else {
  908. !             if (flags & BOLD)
  909. !             gc = screen->w_normalboldGC;
  910. !             else
  911. !             gc = screen->w_normalGC;
  912. !         }
  913. !        else if (flags & KANACS)
  914. ! #ifdef    STATUSLINE    /* michael */
  915. !         if ((!hilite && (flags & INVERSE) != 0
  916. !              || hilite && (flags & INVERSE) == 0)
  917. !             ^ (dostatus < 0 && screen->reversestatus)) {
  918. ! #else    STATUSLINE
  919. !         if (!hilite && (flags & INVERSE) != 0
  920. !             || hilite && (flags & INVERSE) == 0) {
  921. ! #endif    STATUSLINE
  922. !             if (flags & BOLD)
  923. !             gc = screen->r_reverseboldGC;
  924. !             else
  925. !             gc = screen->r_reverseGC;
  926. !         } else {
  927. !             if (flags & BOLD)
  928. !             gc = screen->r_normalboldGC;
  929. !             else
  930. !             gc = screen->r_normalGC;
  931. !         }
  932. !        else
  933. ! #endif    KANJI
  934. !         
  935. ! #ifdef    STATUSLINE    /* michael */
  936. !         if ((!hilite && (flags & INVERSE) != 0
  937. !          || hilite && (flags & INVERSE) == 0)
  938. !         ^ (dostatus < 0 && screen->reversestatus))
  939. ! #else    STATUSLINE
  940. !        if (!hilite && (flags & INVERSE) != 0
  941. !            || hilite && (flags & INVERSE) == 0)
  942. ! #endif    STATUSLINE
  943.              if (flags & BOLD) gc = screen->reverseboldGC;
  944.              else gc = screen->reverseGC;
  945.          else 
  946.              if (flags & BOLD) gc = screen->normalboldGC;
  947.              else gc = screen->normalGC;
  948. + #ifdef    KANJI    /* sano */
  949. +        if (flags & KCS) {
  950. +         XDrawImageString16(screen->display, TextWindow(screen), gc,
  951. +             x, y, (XChar2b *)&chars[lastind],
  952. +             (n = col - lastind) / 2);
  953. +         if ((flags & BOLD) && screen->w_enbolden)
  954. +             XDrawString16(screen->display, TextWindow(screen), gc,
  955. +             x + 1, y, (XChar2b *)&chars[lastind], n / 2);
  956. +        } else if (flags & KANACS) {
  957. +            XDrawImageString(screen->display, TextWindow(screen), gc, 
  958. +                  x, y, &chars[lastind], n = col - lastind);
  959. +            if((flags & BOLD) && screen->r_enbolden)
  960. +             XDrawString(screen->display, TextWindow(screen), gc,
  961. +             x + 1, y, &chars[lastind], n);
  962. +        } else {
  963. + #endif    KANJI
  964.          XDrawImageString(screen->display, TextWindow(screen), gc, 
  965.                x, y, &chars[lastind], n = col - lastind);
  966.          if((flags & BOLD) && screen->enbolden)
  967.           XDrawString(screen->display, TextWindow(screen), gc,
  968.           x + 1, y, &chars[lastind], n);
  969. + #ifdef    KANJI    /* sano */
  970. +        }
  971. + #endif    KANJI
  972.          if(flags & UNDERLINE) 
  973.           XDrawLine(screen->display, TextWindow(screen), gc, 
  974.            x, y+1, x + n * FontWidth(screen), y+1);
  975.       }
  976. + #ifdef    STATUSLINE    /* michael */
  977. +     if (dostatus <= 0)
  978. +         break;
  979. +     dostatus = -1;
  980. +     topline = 0;
  981. +     scrollamt = 0;
  982. +     toprow = maxrow = max = screen->max_row + 1;
  983. +     left = CursorX(screen, leftcol);
  984. +     width = ncols * FontWidth(screen);
  985. +     if (leftcol == 0) {
  986. +         left--;
  987. +         width++;
  988. +     }
  989. +     if (leftcol + ncols - 1 >= screen->max_col)
  990. +         width++;
  991. +     XFillRectangle(screen->display, TextWindow(screen),
  992. +         screen->reversestatus ? screen->normalGC : screen->reverseGC,
  993. +         left, y - screen->fnt_norm->max_bounds.ascent,
  994. +         width, screen->statusheight);
  995. +     if (!screen->reversestatus)
  996. +         StatusBox(screen);
  997. +     y++;
  998. +     }    /* end of for(;;) { */
  999. + #endif    STATUSLINE
  1000.   }
  1001.   
  1002.   ClearBufRows (screen, first, last)
  1003. ***************
  1004. *** 390,395 ****
  1005. --- 632,640 ----
  1006.       register int x;
  1007.       int border = 2 * screen->border;
  1008.       int i, j, k;
  1009. + #ifdef    STATUSLINE    /* michael */
  1010. +     register char *s10, *s11;    /* keep status line */
  1011. + #endif    STATUSLINE
  1012.   #ifdef sun
  1013.   #ifdef TIOCSSIZE
  1014.       struct ttysize ts;
  1015. ***************
  1016. *** 414,420 ****
  1017. --- 659,669 ----
  1018.   
  1019.       /* round so that it is unlikely the screen will change size on  */
  1020.       /* small mouse movements.                    */
  1021. + #ifdef    STATUSLINE    /* michael */
  1022. +     rows = (height + FontHeight(screen) / 2 - border - screen->statusheight) /
  1023. + #else    STATUSLINE
  1024.       rows = (height + FontHeight(screen) / 2 - border) /
  1025. + #endif    STATUSLINE
  1026.        FontHeight(screen);
  1027.       cols = (width + FontWidth(screen) / 2 - border - screen->scrollbar) /
  1028.        FontWidth(screen);
  1029. ***************
  1030. *** 452,458 ****
  1031. --- 701,711 ----
  1032.               }
  1033.           }
  1034.           /* resize current lines */
  1035. + #ifdef    STATUSLINE    /* michael */
  1036. +                 k += savelines + 1;    /* includes status line */
  1037. + #else    STATUSLINE
  1038.                   k += savelines;
  1039. + #endif    STATUSLINE
  1040.           for (index = x = 0; index <= k; x += 2, index++) {
  1041.               if ((sb[x] = realloc(sb[x], (unsigned) cols)) == NULL)
  1042.                   SysError(ERROR_SREALLOC3);
  1043. ***************
  1044. *** 463,470 ****
  1045. --- 716,731 ----
  1046.                   bzero (sb [x + 1] + j, i);
  1047.               }
  1048.           }
  1049. + #ifdef    STATUSLINE    /* michael */
  1050. +         /* save status line */
  1051. +         s10 = sb[i = 2 * (savelines + screen->max_row + 1)];
  1052. +         s11 = sb[i + 1];
  1053.           /* discard excess bottom rows */
  1054. +         for (index = rows, x = 2 * (k - 1); index <= screen->max_row;
  1055. + #else    STATUSLINE
  1056. +         /* discard excess bottom rows */
  1057.           for (index = rows, x = 2 * k; index <= screen->max_row;
  1058. + #endif    STATUSLINE
  1059.            x += 2, index++) {
  1060.              free (sb [x]);
  1061.              free (sb [x + 1]);
  1062. ***************
  1063. *** 475,481 ****
  1064. --- 736,746 ----
  1065.               SysError (ERROR_RESIZE);
  1066.               screen->altbuf = ab;
  1067.           }
  1068. + #ifdef    STATUSLINE    /* michael */
  1069. +         k = 2 * (rows + savelines + 1);    /* includes status line */
  1070. + #else    STATUSLINE
  1071.           k = 2 * (rows + savelines);
  1072. + #endif    STATUSLINE
  1073.           /* resize sb */
  1074.           if((sb = (ScrnBuf)realloc((char *) sb, (unsigned) k * sizeof(char *)))
  1075.             == NULL)
  1076. ***************
  1077. *** 504,509 ****
  1078. --- 769,778 ----
  1079.   
  1080.           screen->max_row = rows - 1;
  1081.           screen->max_col = cols - 1;
  1082. + #ifdef    STATUSLINE    /* michael */
  1083. +         sb[i = 2 * (savelines + screen->max_row + 1)] = s10;
  1084. +         sb[i + 1] = s11;
  1085. + #endif    STATUSLINE
  1086.       
  1087.           /* adjust scrolling region */
  1088.           screen->top_marg = 0;
  1089. ***************
  1090. *** 510,521 ****
  1091. --- 779,799 ----
  1092.           screen->bot_marg = screen->max_row;
  1093.           *flags &= ~ORIGIN;
  1094.       
  1095. + #ifdef    STATUSLINE    /* michael */
  1096. +         if (screen->instatus)
  1097. +             screen->cur_row = screen->max_row + 1;
  1098. +         else
  1099. + #endif    STATUSLINE
  1100.           if (screen->cur_row > screen->max_row)
  1101.               screen->cur_row = screen->max_row;
  1102.           if (screen->cur_col > screen->max_col)
  1103.               screen->cur_col = screen->max_col;
  1104.       
  1105. + #ifdef    STATUSLINE    /* michael */
  1106. +         screen->fullVwin.height = height - border - screen->statusheight;
  1107. + #else    STATUSLINE
  1108.           screen->fullVwin.height = height - border;
  1109. + #endif    STATUSLINE
  1110.           screen->fullVwin.width = width - border - screen->scrollbar;
  1111.   
  1112.       } else if(FullHeight(screen) == height && FullWidth(screen) == width)
  1113. diff -rc ../xterm/scrollbar.c ./scrollbar.c
  1114. *** ../xterm/scrollbar.c    Thu May  4 20:19:28 1989
  1115. --- ./scrollbar.c    Tue May 30 14:53:56 1989
  1116. ***************
  1117. *** 1,5 ****
  1118. --- 1,6 ----
  1119.   /*
  1120.    *    $XConsortium: scrollbar.c,v 1.17 88/11/23 13:56:05 rws Exp $
  1121. +  *    $Header: scrollbar.c,v 1.1 89/05/30 14:53:55 kagotani Rel $
  1122.    */
  1123.   
  1124.   #include <X11/copyright.h>
  1125. ***************
  1126. *** 43,48 ****
  1127. --- 44,50 ----
  1128.   
  1129.   #ifndef lint
  1130.   static char rcs_id[] = "$XConsortium: scrollbar.c,v 1.17 88/11/23 13:56:05 rws Exp $";
  1131. + static char kterm_id[] = "$Header: scrollbar.c,v 1.1 89/05/30 14:53:55 kagotani Rel $";
  1132.   #endif    /* lint */
  1133.   
  1134.   /* Event handlers */
  1135. ***************
  1136. *** 63,69 ****
  1137. --- 65,75 ----
  1138.    * appropriate WM_SIZE_HINTS and taking advantage of bit gravity.
  1139.    */
  1140.   
  1141. + #ifdef    STATUSLINE    /* michael */
  1142. + void ResizeScreen(xw, min_width, min_height )
  1143. + #else    STATUSLINE
  1144.   static void ResizeScreen(xw, min_width, min_height )
  1145. + #endif    STATUSLINE
  1146.       register XtermWidget xw;
  1147.       int min_width, min_height;
  1148.   {
  1149. ***************
  1150. *** 94,108 ****
  1151.                    &sizehints))
  1152.           sizehints.flags = 0;
  1153.       sizehints.min_width = min_width;
  1154.       sizehints.min_height = min_height;
  1155.       sizehints.width_inc = FontWidth(screen);
  1156.       sizehints.height_inc = FontHeight(screen);
  1157.       sizehints.width =  (screen->max_col + 1) * FontWidth(screen)
  1158.                   + min_width;
  1159.       sizehints.height = FontHeight(screen) * (screen->max_row + 1)
  1160.                   + min_height;
  1161.       sizehints.flags |= PMinSize|PResizeInc;
  1162. ! #endif
  1163.   
  1164.       argList[0].value = (XtArgVal)min_width;
  1165.       argList[1].value = (XtArgVal)min_height;
  1166. --- 100,121 ----
  1167.                    &sizehints))
  1168.           sizehints.flags = 0;
  1169.       sizehints.min_width = min_width;
  1170. + #ifdef    STATUSLINE    /* michael */
  1171. +     sizehints.min_height = min_height + screen->statusheight;
  1172. + #else    STATUSLINE
  1173.       sizehints.min_height = min_height;
  1174. + #endif    STATUSLINE
  1175.       sizehints.width_inc = FontWidth(screen);
  1176.       sizehints.height_inc = FontHeight(screen);
  1177.       sizehints.width =  (screen->max_col + 1) * FontWidth(screen)
  1178.                   + min_width;
  1179.       sizehints.height = FontHeight(screen) * (screen->max_row + 1)
  1180. + #ifdef    STATUSLINE    /* michael */
  1181. +                 + screen->statusheight
  1182. + #endif    STATUSLINE
  1183.                   + min_height;
  1184.       sizehints.flags |= PMinSize|PResizeInc;
  1185. ! #endif    nothack
  1186.   
  1187.       argList[0].value = (XtArgVal)min_width;
  1188.       argList[1].value = (XtArgVal)min_height;
  1189. ***************
  1190. *** 115,121 ****
  1191. --- 128,138 ----
  1192.   
  1193.       newAttributes.event_mask =
  1194.           oldAttributes.your_event_mask | StructureNotifyMask;
  1195. + #ifdef    STATUSLINE    /* michael */
  1196. +     newAttributes.bit_gravity = NorthEastGravity;
  1197. + #else    STATUSLINE
  1198.       newAttributes.bit_gravity = EastGravity;
  1199. + #endif    STATUSLINE
  1200.   
  1201.           /* The following statement assumes scrollbar is on Left! 
  1202.              If we ever have scrollbars on the right, then the
  1203. ***************
  1204. *** 126,132 ****
  1205. --- 143,154 ----
  1206.       oldWidth = xw->core.width;
  1207.       oldHeight = xw->core.height;
  1208.       reqWidth = (screen->max_col + 1) * FontWidth(screen) + min_width;
  1209. + #ifdef    STATUSLINE    /* michael */
  1210. +     reqHeight = FontHeight(screen) * (screen->max_row + 1)
  1211. +             + screen->statusheight + min_height;
  1212. + #else    STATUSLINE
  1213.       reqHeight = FontHeight(screen) * (screen->max_row + 1) + min_height;
  1214. + #endif    STATUSLINE
  1215.       geomreqresult = XtMakeResizeRequest ((Widget)xw, reqWidth, reqHeight,
  1216.                            &repWidth, &repHeight);
  1217.   
  1218. ***************
  1219. *** 342,350 ****
  1220. --- 364,379 ----
  1221.       }
  1222.   
  1223.       ResizeScrollBar (screen->scrollWidget, -1, -1, 
  1224. + #ifdef    STATUSLINE    /* michael */
  1225. +              Height (screen) + border + screen->statusheight);
  1226. + #else    STATUSLINE
  1227.                Height (screen) + border);
  1228. + #endif    STATUSLINE
  1229.       RealizeScrollBar (screen->scrollWidget, screen);
  1230.       screen->scrollbar = screen->scrollWidget->core.width;
  1231. + #ifdef    STATUSLINE    /* michael */
  1232. +     status_box[0].x += screen->scrollbar;
  1233. + #endif    STATUSLINE
  1234.   
  1235.       ScrollBarDrawThumb(screen->scrollWidget);
  1236.       ResizeScreen (xw, border + screen->scrollWidget->core.width, border);
  1237. ***************
  1238. *** 359,364 ****
  1239. --- 388,396 ----
  1240.   
  1241.       if(!screen->scrollbar)
  1242.           return;
  1243. + #ifdef    STATUSLINE    /* michael */
  1244. +     status_box[0].x -= screen->scrollbar;
  1245. + #endif    STATUSLINE
  1246.       screen->scrollbar = 0;
  1247.       XUnmapWindow(screen->display, XtWindow(screen->scrollWidget));
  1248.       ResizeScreen( term, border, border );
  1249. diff -rc ../xterm/termcap ./termcap
  1250. *** ../xterm/termcap    Sat Oct  8 02:26:20 1988
  1251. --- ./termcap    Tue May 30 14:53:57 1989
  1252. ***************
  1253. *** 8,13 ****
  1254. --- 8,15 ----
  1255.   #
  1256.   #     :ic=\E[@:\
  1257.   #
  1258. + vk|kterm|kterm| (X window system):\
  1259. +     :KJ:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:TY=ascii:tc=xterms:
  1260.   vs|xterm|vs100|xterm terminal emulator (X window system):\
  1261.       :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:MT:UP=\E[%dA:\
  1262.       :al=\E[L:am:\
  1263. diff -rc ../xterm/util.c ./util.c
  1264. *** ../xterm/util.c    Fri Oct  7 21:20:55 1988
  1265. --- ./util.c    Tue May 30 14:53:59 1989
  1266. ***************
  1267. *** 1,5 ****
  1268. --- 1,6 ----
  1269.   /*
  1270.    *    $XConsortium: util.c,v 1.10 88/10/07 08:20:08 swick Exp $
  1271. +  *    $Header: util.c,v 1.1 89/05/30 14:53:58 kagotani Rel $
  1272.    */
  1273.   
  1274.   #include <X11/copyright.h>
  1275. ***************
  1276. *** 31,36 ****
  1277. --- 32,38 ----
  1278.   
  1279.   #ifndef lint
  1280.   static char rcs_id[] = "$XConsortium: util.c,v 1.10 88/10/07 08:20:08 swick Exp $";
  1281. + static char kterm_id[] = "$Header: util.c,v 1.1 89/05/30 14:53:58 kagotani Rel $";
  1282.   #endif    /* lint */
  1283.   
  1284.   #include <stdio.h>
  1285. ***************
  1286. *** 158,164 ****
  1287. --- 160,170 ----
  1288.       register int amount = screen->refresh_amt;
  1289.       register int row = screen->cur_row;
  1290.   
  1291. + #ifdef    STATUSLINE    /* michael */
  1292. +     if(amount == 0 || screen->instatus)
  1293. + #else    STATUSLINE
  1294.       if(amount == 0)
  1295. + #endif    STATUSLINE
  1296.           return(0);
  1297.       if(amount > 0) {
  1298.           register int bottom;
  1299. ***************
  1300. *** 572,578 ****
  1301. --- 578,589 ----
  1302.       if(screen->cursor_state)
  1303.           HideCursor();
  1304.       screen->do_wrap = 0;
  1305. + #ifdef    STATUSLINE    /* michael */
  1306. +     if(screen->cur_row - screen->topline <= screen->max_row ||
  1307. +        screen->instatus) {
  1308. + #else    STATUSLINE
  1309.       if(screen->cur_row - screen->topline <= screen->max_row) {
  1310. + #endif    STATUSLINE
  1311.           if(!AddToRefresh(screen)) {
  1312.           if(screen->scroll_amt)
  1313.               FlushScroll(screen);
  1314. ***************
  1315. *** 595,600 ****
  1316. --- 606,614 ----
  1317.           XFillRectangle(
  1318.               screen->display,
  1319.               TextWindow(screen), 
  1320. + #ifdef    STATUSLINE    /* michael */
  1321. +             screen->instatus ? screen->normalGC :
  1322. + #endif    STATUSLINE
  1323.               screen->reverseGC,
  1324.               cx, cy,
  1325.               (unsigned) width, (unsigned) FontHeight(screen));
  1326. ***************
  1327. *** 620,626 ****
  1328. --- 634,645 ----
  1329.       if (n > (width = screen->max_col + 1 - screen->cur_col))
  1330.             n = width;
  1331.           
  1332. + #ifdef    STATUSLINE    /* michael */
  1333. +     if(screen->cur_row - screen->topline <= screen->max_row ||
  1334. +        screen->instatus) {
  1335. + #else    STATUSLINE
  1336.       if(screen->cur_row - screen->topline <= screen->max_row) {
  1337. + #endif    STATUSLINE
  1338.           if(!AddToRefresh(screen)) {
  1339.           if(screen->scroll_amt)
  1340.               FlushScroll(screen);
  1341. ***************
  1342. *** 641,646 ****
  1343. --- 660,668 ----
  1344.                FontHeight(screen), 
  1345.                cx, cy);
  1346.           XFillRectangle (screen->display, TextWindow(screen),
  1347. + #ifdef    STATUSLINE    /* michael */
  1348. +              screen->instatus? screen->normalGC :
  1349. + #endif    STATUSLINE
  1350.                screen->reverseGC,
  1351.                screen->border + screen->scrollbar + Width(screen) - width,
  1352.                cy, width, FontHeight(screen));
  1353. ***************
  1354. *** 710,720 ****
  1355. --- 732,750 ----
  1356.       if(screen->cursor_state)
  1357.           HideCursor();
  1358.       screen->do_wrap = 0;
  1359. + #ifdef    STATUSLINE    /* michael */
  1360. +     if(screen->cur_row - screen->topline <= screen->max_row ||
  1361. +        screen->instatus) {
  1362. + #else    STATUSLINE
  1363.       if(screen->cur_row - screen->topline <= screen->max_row) {
  1364. + #endif    STATUSLINE
  1365.           if(!AddToRefresh(screen)) {
  1366.       if(screen->scroll_amt)
  1367.           FlushScroll(screen);
  1368.           XFillRectangle(screen->display, TextWindow(screen),
  1369. + #ifdef    STATUSLINE    /* michael */
  1370. +         screen->instatus ? screen->normalGC :
  1371. + #endif    STATUSLINE
  1372.             screen->reverseGC,
  1373.            CursorX(screen, screen->cur_col),
  1374.            CursorY(screen, screen->cur_row),
  1375. ***************
  1376. *** 737,747 ****
  1377. --- 767,785 ----
  1378.       if(screen->cursor_state)
  1379.           HideCursor();
  1380.       screen->do_wrap = 0;
  1381. + #ifdef    STATUSLINE    /* michael */
  1382. +     if(screen->cur_row - screen->topline <= screen->max_row ||
  1383. +        screen->instatus) {
  1384. + #else    STATUSLINE
  1385.       if(screen->cur_row - screen->topline <= screen->max_row) {
  1386. + #endif    STATUSLINE
  1387.           if(!AddToRefresh(screen)) {
  1388.           if(screen->scroll_amt)
  1389.               FlushScroll(screen);
  1390.           XFillRectangle (screen->display, TextWindow(screen),
  1391. + #ifdef    STATUSLINE    /* michael */
  1392. +              screen->instatus ? screen->normalGC :
  1393. + #endif    STATUSLINE
  1394.                screen->reverseGC,
  1395.                screen->border + screen->scrollbar,
  1396.                 CursorY (screen, screen->cur_row),
  1397. ***************
  1398. *** 762,772 ****
  1399. --- 800,819 ----
  1400.       if(screen->cursor_state)
  1401.           HideCursor();
  1402.       screen->do_wrap = 0;
  1403. + #ifdef    STATUSLINE    /* michael */
  1404. +     if(screen->cur_row - screen->topline <= screen->max_row ||
  1405. +        screen->instatus) {
  1406. + #else    STATUSLINE
  1407.       if(screen->cur_row - screen->topline <= screen->max_row) {
  1408. + #endif    STATUSLINE
  1409.           if(!AddToRefresh(screen)) {
  1410.           if(screen->scroll_amt)
  1411.               FlushScroll(screen);
  1412.           XFillRectangle (screen->display, TextWindow(screen), 
  1413. + #ifdef    STATUSLINE    /* michael & kato */
  1414. +              screen->instatus && screen->reversestatus ?
  1415. +              screen->normalGC :
  1416. + #endif    STATUSLINE
  1417.                screen->reverseGC,
  1418.                screen->border + screen->scrollbar,
  1419.                 CursorY (screen, screen->cur_row),
  1420. ***************
  1421. *** 788,794 ****
  1422. --- 835,845 ----
  1423.       if((top = -screen->topline) <= screen->max_row) {
  1424.           if(screen->scroll_amt)
  1425.               FlushScroll(screen);
  1426. + #ifdef    STATUSLINE    /* michael */
  1427. +         if(top == 0 && !screen->statusline)
  1428. + #else    STATUSLINE
  1429.           if(top == 0)
  1430. + #endif    STATUSLINE
  1431.               XClearWindow(screen->display, TextWindow(screen));
  1432.           else
  1433.               XClearArea(screen->display, TextWindow(screen),
  1434. ***************
  1435. *** 863,869 ****
  1436. --- 914,924 ----
  1437.           toprow = 0;
  1438.       }
  1439.       if (toprow + nrows - 1 > screen->max_row)
  1440. + #ifdef    STATUSLINE    /* michael */
  1441. +         nrows = screen->max_row - toprow + 1 + screen->statusline;
  1442. + #else    STATUSLINE
  1443.           nrows = screen->max_row - toprow + 1;
  1444. + #endif    STATUSLINE
  1445.       if (leftcol + ncols - 1 > screen->max_col)
  1446.           ncols = screen->max_col - leftcol + 1;
  1447.   
  1448. ***************
  1449. *** 901,907 ****
  1450. --- 956,983 ----
  1451.       tmpGC = screen->normalboldGC;
  1452.       screen->normalboldGC = screen->reverseboldGC;
  1453.       screen->reverseboldGC = tmpGC;
  1454. + /*
  1455. +  * Bug fix by michael
  1456. +  * 3 non null lines are inserted.
  1457. +  */
  1458. +     tmpGC = screen->cursorGC;
  1459. +     screen->cursorGC = screen->reversecursorGC;
  1460. +     screen->reversecursorGC = tmpGC;
  1461.   
  1462. + #ifdef    KANJI    /* ariza & michael */
  1463. +     tmpGC = screen->w_normalGC;
  1464. +     screen->w_normalGC = screen->w_reverseGC;
  1465. +     screen->w_reverseGC = tmpGC;
  1466. +     tmpGC = screen->w_normalboldGC;
  1467. +     screen->w_normalboldGC = screen->w_reverseboldGC;
  1468. +     screen->w_reverseboldGC = tmpGC;
  1469. +     tmpGC = screen->w_cursorGC;
  1470. +     screen->w_cursorGC = screen->w_reversecursorGC;
  1471. +     screen->w_reversecursorGC = tmpGC;
  1472. + #endif    KANJI
  1473.       {
  1474.           unsigned long fg, bg;
  1475.           bg = term->core.background_pixel;
  1476. ***************
  1477. *** 945,951 ****
  1478. --- 1021,1031 ----
  1479.           TekReverseVideo(screen);
  1480.       }
  1481.       XClearWindow(screen->display, TextWindow(screen));
  1482. + #ifdef    STATUSLINE    /* michael */
  1483. +     ScrnRefresh (screen, 0, 0, screen->max_row + 1 + screen->statusline,
  1484. + #else    STATUSLINE
  1485.       ScrnRefresh (screen, 0, 0, screen->max_row + 1,
  1486. + #endif    STATUSLINE
  1487.        screen->max_col + 1, False);
  1488.       if(screen->Tshow) {
  1489.           XClearWindow(screen->display, tek);
  1490.