home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume12 / kterm / part07 < prev    next >
Internet Message Format  |  1991-05-08  |  52KB

  1. Path: uunet!wuarchive!cs.utexas.edu!convex!central!newstop!male!jethro!exodus!NMSU.Edu!mleisher
  2. From: mleisher@NMSU.Edu
  3. Newsgroups: comp.sources.x
  4. Subject: v12i088: kterm  - kanji xterm, Part07/18
  5. Message-ID: <12972@exodus.Eng.Sun.COM>
  6. Date: 8 May 91 02:39:29 GMT
  7. References: <csx-12i082:kterm@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 1808
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: mleisher@NMSU.Edu
  13. Posting-number: Volume 12, Issue 88
  14. Archive-name: kterm/part07
  15.  
  16. #!/bin/sh
  17. # this is kt412.07 (part 7 of kterm-4.1.2)
  18. # do not concatenate these parts, unpack them in order with /bin/sh
  19. # file kterm-4.1.2/charproc.c continued
  20. #
  21. if test ! -r _shar_seq_.tmp; then
  22.     echo 'Please unpack part 1 first!'
  23.     exit 1
  24. fi
  25. (read Scheck
  26.  if test "$Scheck" != 7; then
  27.     echo Please unpack part "$Scheck" next!
  28.     exit 1
  29.  else
  30.     exit 0
  31.  fi
  32. ) < _shar_seq_.tmp || exit 1
  33. if test ! -f _shar_wnt_.tmp; then
  34.     echo 'x - still skipping kterm-4.1.2/charproc.c'
  35. else
  36. echo 'x - continuing file kterm-4.1.2/charproc.c'
  37. sed 's/^X//' << 'SHAR_EOF' >> 'kterm-4.1.2/charproc.c' &&
  38. X    XtOffset(XtermWidget, misc.hg_m), XtRString,
  39. X    (caddr_t) NULL},
  40. {XtNhangulNtoKSTable, XtCHangulNtoKSTable, XtRString, sizeof(char *),
  41. X   XtOffset(XtermWidget, misc.hg_n2ks_tbl), XtRString,
  42. X   (caddr_t) NULL},
  43. #  endif /* KTERM_HANGUL */
  44. {XtNlineSpace, XtCLineSpace, XtRInt, sizeof(int),
  45. X    XtOffset(XtermWidget, screen.linespace),
  46. X    XtRInt, (caddr_t) &defaultLineSpace},
  47. #else /* !KTERM */
  48. {XtNfont, XtCFont, XtRString, sizeof(char *),
  49. X    XtOffset(XtermWidget, misc.f_n), XtRString,
  50. X    DEFFONT},
  51. {XtNboldFont, XtCFont, XtRString, sizeof(char *),
  52. X    XtOffset(XtermWidget, misc.f_b), XtRString,
  53. X    DEFBOLDFONT},
  54. #endif /* !KTERM */
  55. {XtNc132, XtCC132, XtRBoolean, sizeof(Boolean),
  56. X    XtOffset(XtermWidget, screen.c132),
  57. X    XtRBoolean, (caddr_t) &defaultFALSE},
  58. {XtNcharClass, XtCCharClass, XtRString, sizeof(char *),
  59. X    XtOffset(XtermWidget, screen.charClass),
  60. X    XtRString, (caddr_t) NULL},
  61. {XtNcurses, XtCCurses, XtRBoolean, sizeof(Boolean),
  62. X    XtOffset(XtermWidget, screen.curses),
  63. X    XtRBoolean, (caddr_t) &defaultFALSE},
  64. {XtNcutNewline, XtCCutNewline, XtRBoolean, sizeof(Boolean),
  65. X    XtOffset(XtermWidget, screen.cutNewline),
  66. X    XtRBoolean, (caddr_t) &defaultTRUE},
  67. {XtNcutToBeginningOfLine, XtCCutToBeginningOfLine, XtRBoolean, sizeof(Boolean),
  68. X    XtOffset(XtermWidget, screen.cutToBeginningOfLine),
  69. X    XtRBoolean, (caddr_t) &defaultTRUE},
  70. {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
  71. X    XtOffset(XtermWidget, core.background_pixel),
  72. X    XtRString, "XtDefaultBackground"},
  73. {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
  74. X    XtOffset(XtermWidget, screen.foreground),
  75. X    XtRString, "XtDefaultForeground"},
  76. {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel),
  77. X    XtOffset(XtermWidget, screen.cursorcolor),
  78. X    XtRString, "XtDefaultForeground"},
  79. #ifdef    COLOR_TEXT    /* mukawa */
  80. {XtNcolor0, XtCForeground, XtRPixel, sizeof(Pixel),
  81. X    XtOffset(XtermWidget, screen.textcolor[0]),
  82. X    XtRString, "XtDefaultForeground"},
  83. {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel),
  84. X    XtOffset(XtermWidget, screen.textcolor[1]),
  85. X    XtRString, "XtDefaultForeground"},
  86. {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel),
  87. X    XtOffset(XtermWidget, screen.textcolor[2]),
  88. X    XtRString, "XtDefaultForeground"},
  89. {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel),
  90. X    XtOffset(XtermWidget, screen.textcolor[3]),
  91. X    XtRString, "XtDefaultForeground"},
  92. {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel),
  93. X    XtOffset(XtermWidget, screen.textcolor[4]),
  94. X    XtRString, "XtDefaultForeground"},
  95. {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel),
  96. X    XtOffset(XtermWidget, screen.textcolor[5]),
  97. X    XtRString, "XtDefaultForeground"},
  98. {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel),
  99. X    XtOffset(XtermWidget, screen.textcolor[6]),
  100. X    XtRString, "XtDefaultForeground"},
  101. {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel),
  102. X    XtOffset(XtermWidget, screen.textcolor[7]),
  103. X    XtRString, "XtDefaultForeground"},
  104. #endif    /* COLOR_TEXT */
  105. {XtNeightBitInput, XtCEightBitInput, XtRBoolean, sizeof(Boolean),
  106. X    XtOffset(XtermWidget, screen.eight_bits), 
  107. X    XtRBoolean, (caddr_t) &defaultTRUE},
  108. {XtNgeometry,XtCGeometry, XtRString, sizeof(char *),
  109. X    XtOffset(XtermWidget, misc.geo_metry),
  110. X    XtRString, (caddr_t) NULL},
  111. {XtNalwaysHighlight,XtCAlwaysHighlight,XtRBoolean,
  112. X        sizeof(Boolean),XtOffset(XtermWidget, screen.always_highlight),
  113. X        XtRBoolean, (caddr_t) &defaultFALSE},
  114. {XtNtekGeometry,XtCGeometry, XtRString, sizeof(char *),
  115. X    XtOffset(XtermWidget, misc.T_geometry),
  116. X    XtRString, (caddr_t) NULL},
  117. {XtNinternalBorder,XtCBorderWidth,XtRInt, sizeof(int),
  118. X    XtOffset(XtermWidget, screen.border),
  119. X    XtRInt, (caddr_t) &defaultIntBorder},
  120. {XtNjumpScroll, XtCJumpScroll, XtRBoolean, sizeof(Boolean),
  121. X    XtOffset(XtermWidget, screen.jumpscroll),
  122. X    XtRBoolean, (caddr_t) &defaultTRUE},
  123. {XtNlogFile, XtCLogfile, XtRString, sizeof(char *),
  124. X    XtOffset(XtermWidget, screen.logfile),
  125. X    XtRString, (caddr_t) NULL},
  126. {XtNlogging, XtCLogging, XtRBoolean, sizeof(Boolean),
  127. X    XtOffset(XtermWidget, misc.log_on),
  128. X    XtRBoolean, (caddr_t) &defaultFALSE},
  129. {XtNlogInhibit, XtCLogInhibit, XtRBoolean, sizeof(Boolean),
  130. X    XtOffset(XtermWidget, misc.logInhibit),
  131. X    XtRBoolean, (caddr_t) &defaultFALSE},
  132. {XtNloginShell, XtCLoginShell, XtRBoolean, sizeof(Boolean),
  133. X    XtOffset(XtermWidget, misc.login_shell),
  134. X    XtRBoolean, (caddr_t) &defaultFALSE},
  135. {XtNmarginBell, XtCMarginBell, XtRBoolean, sizeof(Boolean),
  136. X    XtOffset(XtermWidget, screen.marginbell),
  137. X    XtRBoolean, (caddr_t) &defaultFALSE},
  138. {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel),
  139. X    XtOffset(XtermWidget, screen.mousecolor),
  140. X    XtRString, "XtDefaultForeground"},
  141. {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel),
  142. X    XtOffset(XtermWidget, screen.mousecolorback),
  143. X    XtRString, "XtDefaultBackground"},
  144. {XtNpointerShape,XtCCursor, XtRCursor, sizeof(Cursor),
  145. X    XtOffset(XtermWidget, screen.pointer_cursor),
  146. X    XtRString, (caddr_t) "xterm"},
  147. {XtNmultiClickTime,XtCMultiClickTime, XtRInt, sizeof(int),
  148. X    XtOffset(XtermWidget, screen.multiClickTime),
  149. X    XtRInt, (caddr_t) &defaultMultiClickTime},
  150. {XtNmultiScroll,XtCMultiScroll, XtRBoolean, sizeof(Boolean),
  151. X    XtOffset(XtermWidget, screen.multiscroll),
  152. X    XtRBoolean, (caddr_t) &defaultFALSE},
  153. {XtNnMarginBell,XtCColumn, XtRInt, sizeof(int),
  154. X    XtOffset(XtermWidget, screen.nmarginbell),
  155. X    XtRInt, (caddr_t) &defaultNMarginBell},
  156. {XtNreverseVideo,XtCReverseVideo,XtRBoolean, sizeof(Boolean),
  157. X    XtOffset(XtermWidget, misc.re_verse),
  158. X    XtRBoolean, (caddr_t) &defaultFALSE},
  159. {XtNreverseWrap,XtCReverseWrap, XtRBoolean, sizeof(Boolean),
  160. X    XtOffset(XtermWidget, misc.reverseWrap),
  161. X    XtRBoolean, (caddr_t) &defaultFALSE},
  162. {XtNsaveLines, XtCSaveLines, XtRInt, sizeof(int),
  163. X    XtOffset(XtermWidget, screen.savelines),
  164. X    XtRInt, (caddr_t) &defaultSaveLines},
  165. {XtNscrollBar, XtCScrollBar, XtRBoolean, sizeof(Boolean),
  166. X    XtOffset(XtermWidget, misc.scrollbar),
  167. X    XtRBoolean, (caddr_t) &defaultFALSE},
  168. {XtNscrollTtyOutput,XtCScrollCond, XtRBoolean, sizeof(Boolean),
  169. X    XtOffset(XtermWidget, screen.scrollttyoutput),
  170. X    XtRBoolean, (caddr_t) &defaultTRUE},
  171. {XtNscrollKey, XtCScrollCond, XtRBoolean, sizeof(Boolean),
  172. X    XtOffset(XtermWidget, screen.scrollkey),
  173. X    XtRBoolean, (caddr_t) &defaultFALSE},
  174. {XtNscrollLines, XtCScrollLines, XtRInt, sizeof(int),
  175. X    XtOffset(XtermWidget, screen.scrolllines),
  176. X    XtRInt, (caddr_t) &defaultScrollLines},
  177. {XtNsignalInhibit,XtCSignalInhibit,XtRBoolean, sizeof(Boolean),
  178. X    XtOffset(XtermWidget, misc.signalInhibit),
  179. X    XtRBoolean, (caddr_t) &defaultFALSE},
  180. #ifdef STATUSLINE
  181. {XtNstatusLine, XtCStatusLine, XtRBoolean, sizeof(Boolean),
  182. X    XtOffset(XtermWidget, screen.statusline),
  183. X    XtRBoolean, (caddr_t) &defaultFALSE},
  184. {XtNstatusNormal, XtCStatusNormal, XtRBoolean, sizeof(Boolean),
  185. X    XtOffset(XtermWidget, misc.statusnormal),
  186. X    XtRBoolean, (caddr_t) &defaultFALSE},
  187. #endif /* STATUSLINE */
  188. {XtNtekInhibit, XtCTekInhibit, XtRBoolean, sizeof(Boolean),
  189. X    XtOffset(XtermWidget, misc.tekInhibit),
  190. X    XtRBoolean, (caddr_t) &defaultFALSE},
  191. {XtNtekSmall, XtCTekSmall, XtRBoolean, sizeof(Boolean),
  192. X    XtOffset(XtermWidget, misc.tekSmall),
  193. X    XtRBoolean, (caddr_t) &defaultFALSE},
  194. {XtNtekStartup, XtCTekStartup, XtRBoolean, sizeof(Boolean),
  195. X    XtOffset(XtermWidget, screen.TekEmu),
  196. X    XtRBoolean, (caddr_t) &defaultFALSE},
  197. {XtNtiteInhibit, XtCTiteInhibit, XtRBoolean, sizeof(Boolean),
  198. X    XtOffset(XtermWidget, misc.titeInhibit),
  199. X    XtRBoolean, (caddr_t) &defaultFALSE},
  200. {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof(Boolean),
  201. X    XtOffset(XtermWidget, screen.visualbell),
  202. X    XtRBoolean, (caddr_t) &defaultFALSE},
  203. {XtNallowSendEvents, XtCAllowSendEvents, XtRBoolean, sizeof(Boolean),
  204. X    XtOffset(XtermWidget, screen.allowSendEvents),
  205. X    XtRBoolean, (caddr_t) &defaultFALSE},
  206. #ifdef KTERM
  207. {"fontList1", "FontList1", XtRString, sizeof(String),
  208. X    XtOffset(XtermWidget, screen.menu_font_list[fontMenu_font1]),
  209. X    XtRString, (caddr_t) NULL},
  210. {"fontList2", "FontList2", XtRString, sizeof(String),
  211. X    XtOffset(XtermWidget, screen.menu_font_list[fontMenu_font2]),
  212. X    XtRString, (caddr_t) NULL},
  213. {"fontList3", "FontList3", XtRString, sizeof(String),
  214. X    XtOffset(XtermWidget, screen.menu_font_list[fontMenu_font3]),
  215. X    XtRString, (caddr_t) NULL},
  216. {"fontList4", "FontList4", XtRString, sizeof(String),
  217. X    XtOffset(XtermWidget, screen.menu_font_list[fontMenu_font4]),
  218. X    XtRString, (caddr_t) NULL},
  219. {"boldFontList1", "FontList1", XtRString, sizeof(String),
  220. X    XtOffset(XtermWidget, screen.menu_bfont_list[fontMenu_font1]),
  221. X    XtRString, (caddr_t) NULL},
  222. {"boldFontList2", "FontList2", XtRString, sizeof(String),
  223. X    XtOffset(XtermWidget, screen.menu_bfont_list[fontMenu_font2]),
  224. X    XtRString, (caddr_t) NULL},
  225. {"boldFontList3", "FontList3", XtRString, sizeof(String),
  226. X    XtOffset(XtermWidget, screen.menu_bfont_list[fontMenu_font3]),
  227. X    XtRString, (caddr_t) NULL},
  228. {"boldFontList4", "FontList4", XtRString, sizeof(String),
  229. X    XtOffset(XtermWidget, screen.menu_bfont_list[fontMenu_font4]),
  230. X    XtRString, (caddr_t) NULL},
  231. {"font1", "Font1", XtRString, sizeof(String),
  232. X    XtOffset(XtermWidget, screen._menu_font_names[F_ISO8859_1][fontMenu_font1]),
  233. X    XtRString, (caddr_t) NULL},
  234. {"font2", "Font2", XtRString, sizeof(String),
  235. X    XtOffset(XtermWidget, screen._menu_font_names[F_ISO8859_1][fontMenu_font2]),
  236. X    XtRString, (caddr_t) NULL},
  237. {"font3", "Font3", XtRString, sizeof(String),
  238. X    XtOffset(XtermWidget, screen._menu_font_names[F_ISO8859_1][fontMenu_font3]),
  239. X    XtRString, (caddr_t) NULL},
  240. {"font4", "Font4", XtRString, sizeof(String),
  241. X    XtOffset(XtermWidget, screen._menu_font_names[F_ISO8859_1][fontMenu_font4]),
  242. X    XtRString, (caddr_t) NULL},
  243. {"boldFont1", "Font1", XtRString, sizeof(String),
  244. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_ISO8859_1][fontMenu_font1]),
  245. X    XtRString, (caddr_t) NULL},
  246. {"boldFont2", "Font2", XtRString, sizeof(String),
  247. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_ISO8859_1][fontMenu_font2]),
  248. X    XtRString, (caddr_t) NULL},
  249. {"boldFont3", "Font3", XtRString, sizeof(String),
  250. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_ISO8859_1][fontMenu_font3]),
  251. X    XtRString, (caddr_t) NULL},
  252. {"boldFont4", "Font4", XtRString, sizeof(String),
  253. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_ISO8859_1][fontMenu_font4]),
  254. X    XtRString, (caddr_t) NULL},
  255. {"romanKanaFont1", "RomanKanaFont1", XtRString, sizeof(String),
  256. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0201_0][fontMenu_font1]),
  257. X    XtRString, (caddr_t) NULL},
  258. {"romanKanaFont2", "RomanKanaFont2", XtRString, sizeof(String),
  259. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0201_0][fontMenu_font2]),
  260. X    XtRString, (caddr_t) NULL},
  261. {"romanKanaFont3", "RomanKanaFont3", XtRString, sizeof(String),
  262. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0201_0][fontMenu_font3]),
  263. X    XtRString, (caddr_t) NULL},
  264. {"romanKanaFont4", "RomanKanaFont4", XtRString, sizeof(String),
  265. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0201_0][fontMenu_font4]),
  266. X    XtRString, (caddr_t) NULL},
  267. {"romanKanaBoldFont1", "RomanKanaFont1", XtRString, sizeof(String),
  268. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0201_0][fontMenu_font1]),
  269. X    XtRString, (caddr_t) NULL},
  270. {"romanKanaBoldFont2", "RomanKanaFont2", XtRString, sizeof(String),
  271. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0201_0][fontMenu_font2]),
  272. X    XtRString, (caddr_t) NULL},
  273. {"romanKanaBoldFont3", "RomanKanaFont3", XtRString, sizeof(String),
  274. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0201_0][fontMenu_font3]),
  275. X    XtRString, (caddr_t) NULL},
  276. {"romanKanaBoldFont4", "RomanKanaFont4", XtRString, sizeof(String),
  277. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0201_0][fontMenu_font4]),
  278. X    XtRString, (caddr_t) NULL},
  279. # ifdef KTERM_KANJI
  280. {"kanjiFont1", "KanjiFont1", XtRString, sizeof(String),
  281. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0208_0][fontMenu_font1]),
  282. X    XtRString, (caddr_t) NULL},
  283. {"kanjiFont2", "KanjiFont2", XtRString, sizeof(String),
  284. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0208_0][fontMenu_font2]),
  285. X    XtRString, (caddr_t) NULL},
  286. {"kanjiFont3", "KanjiFont3", XtRString, sizeof(String),
  287. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0208_0][fontMenu_font3]),
  288. X    XtRString, (caddr_t) NULL},
  289. {"kanjiFont4", "KanjiFont4", XtRString, sizeof(String),
  290. X    XtOffset(XtermWidget, screen._menu_font_names[F_JISX0208_0][fontMenu_font4]),
  291. X    XtRString, (caddr_t) NULL},
  292. {"kanjiBoldFont1", "KanjiFont1", XtRString, sizeof(String),
  293. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0208_0][fontMenu_font1]),
  294. X    XtRString, (caddr_t) NULL},
  295. {"kanjiBoldFont2", "KanjiFont2", XtRString, sizeof(String),
  296. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0208_0][fontMenu_font2]),
  297. X    XtRString, (caddr_t) NULL},
  298. {"kanjiBoldFont3", "KanjiFont3", XtRString, sizeof(String),
  299. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0208_0][fontMenu_font3]),
  300. X    XtRString, (caddr_t) NULL},
  301. {"kanjiBoldFont4", "KanjiFont4", XtRString, sizeof(String),
  302. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_JISX0208_0][fontMenu_font4]),
  303. X    XtRString, (caddr_t) NULL},
  304. # endif /* KTERM_KANJI */
  305. # ifdef KTERM_HANZI
  306. {"hanziFont1", "HanziFont1", XtRString, sizeof(String),
  307. X    XtOffset(XtermWidget, screen._menu_font_names[F_GB2312_0][fontMenu_font1]),
  308. X    XtRString, (caddr_t) NULL},
  309. {"hanziFont2", "HanziFont2", XtRString, sizeof(String),
  310. X    XtOffset(XtermWidget, screen._menu_font_names[F_GB2312_0][fontMenu_font2]),
  311. X    XtRString, (caddr_t) NULL},
  312. {"hanziFont3", "HanziFont3", XtRString, sizeof(String),
  313. X    XtOffset(XtermWidget, screen._menu_font_names[F_GB2312_0][fontMenu_font3]),
  314. X    XtRString, (caddr_t) NULL},
  315. {"hanziFont4", "HanziFont4", XtRString, sizeof(String),
  316. X    XtOffset(XtermWidget, screen._menu_font_names[F_GB2312_0][fontMenu_font4]),
  317. X    XtRString, (caddr_t) NULL},
  318. {"hanziBoldFont1", "HanziFont1", XtRString, sizeof(String),
  319. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_GB2312_0][fontMenu_font1]),
  320. X    XtRString, (caddr_t) NULL},
  321. {"hanziBoldFont2", "HanziFont2", XtRString, sizeof(String),
  322. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_GB2312_0][fontMenu_font2]),
  323. X    XtRString, (caddr_t) NULL},
  324. {"hanziBoldFont3", "HanziFont3", XtRString, sizeof(String),
  325. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_GB2312_0][fontMenu_font3]),
  326. X    XtRString, (caddr_t) NULL},
  327. {"hanziBoldFont4", "HanziFont4", XtRString, sizeof(String),
  328. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_GB2312_0][fontMenu_font4]),
  329. X    XtRString, (caddr_t) NULL},
  330. # endif /* KTERM_HANZI */
  331. # ifdef KTERM_HANGUL
  332. {"hangulFont1", "HangulFont1", XtRString, sizeof(String),
  333. X    XtOffset(XtermWidget, screen._menu_font_names[F_KSC5601_0][fontMenu_font1]),
  334. X    XtRString, (caddr_t) NULL},
  335. {"hangulFont2", "HangulFont2", XtRString, sizeof(String),
  336. X    XtOffset(XtermWidget, screen._menu_font_names[F_KSC5601_0][fontMenu_font2]),
  337. X    XtRString, (caddr_t) NULL},
  338. {"hangulFont3", "HangulFont3", XtRString, sizeof(String),
  339. X    XtOffset(XtermWidget, screen._menu_font_names[F_KSC5601_0][fontMenu_font3]),
  340. X    XtRString, (caddr_t) NULL},
  341. {"hangulFont4", "HangulFont4", XtRString, sizeof(String),
  342. X    XtOffset(XtermWidget, screen._menu_font_names[F_KSC5601_0][fontMenu_font4]),
  343. X    XtRString, (caddr_t) NULL},
  344. {"hangulBoldFont1", "HangulFont1", XtRString, sizeof(String),
  345. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_KSC5601_0][fontMenu_font1]),
  346. X    XtRString, (caddr_t) NULL},
  347. {"hangulBoldFont2", "HangulFont2", XtRString, sizeof(String),
  348. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_KSC5601_0][fontMenu_font2]),
  349. X    XtRString, (caddr_t) NULL},
  350. {"hangulBoldFont3", "HangulFont3", XtRString, sizeof(String),
  351. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_KSC5601_0][fontMenu_font3]),
  352. X    XtRString, (caddr_t) NULL},
  353. {"hangulBoldFont4", "HangulFont4", XtRString, sizeof(String),
  354. X    XtOffset(XtermWidget, screen._menu_bfont_names[F_KSC5601_0][fontMenu_font4]),
  355. X    XtRString, (caddr_t) NULL},
  356. # endif /* KTERM_HANGUL */
  357. #else /* !KTERM */
  358. {"font1", "Font1", XtRString, sizeof(String),
  359. X    XtOffset(XtermWidget, screen.menu_font_names[fontMenu_font1]),
  360. X    XtRString, (caddr_t) NULL},
  361. {"font2", "Font2", XtRString, sizeof(String),
  362. X    XtOffset(XtermWidget, screen.menu_font_names[fontMenu_font2]),
  363. X    XtRString, (caddr_t) NULL},
  364. {"font3", "Font3", XtRString, sizeof(String),
  365. X    XtOffset(XtermWidget, screen.menu_font_names[fontMenu_font3]),
  366. X    XtRString, (caddr_t) NULL},
  367. {"font4", "Font4", XtRString, sizeof(String),
  368. X    XtOffset(XtermWidget, screen.menu_font_names[fontMenu_font4]),
  369. X    XtRString, (caddr_t) NULL},
  370. #endif /* !KTERM */
  371. };
  372. X
  373. X
  374. static void VTInitialize(), VTRealize(), VTExpose(), VTResize();
  375. static void VTDestroy();
  376. X
  377. WidgetClassRec xtermClassRec = {
  378. X  {
  379. /* core_class fields */    
  380. X    /* superclass      */    (WidgetClass) &widgetClassRec,
  381. X    /* class_name      */    "VT100",
  382. X    /* widget_size      */    sizeof(XtermWidgetRec),
  383. X    /* class_initialize   */    NULL,
  384. X    /* class_part_initialize */ NULL,
  385. X    /* class_inited       */    FALSE,
  386. X    /* initialize      */    VTInitialize,
  387. X    /* initialize_hook    */    NULL,                
  388. X    /* realize          */    VTRealize,
  389. X    /* actions          */    actionsList,
  390. X    /* num_actions      */    XtNumber(actionsList),
  391. X    /* resources      */    resources,
  392. X    /* num_resources      */    XtNumber(resources),
  393. X    /* xrm_class      */    NULLQUARK,
  394. X    /* compress_motion      */    TRUE,
  395. X    /* compress_exposure  */    FALSE,
  396. X    /* compress_enterleave */   TRUE,
  397. X    /* visible_interest      */    FALSE,
  398. X    /* destroy          */    VTDestroy,
  399. X    /* resize          */    VTResize,
  400. X    /* expose          */    VTExpose,
  401. X    /* set_values      */    NULL,
  402. X    /* set_values_hook    */    NULL,
  403. X    /* set_values_almost  */    NULL,
  404. X    /* get_values_hook    */    NULL,
  405. X    /* accept_focus      */    NULL,
  406. X    /* version            */    XtVersion,
  407. X    /* callback_offsets   */    NULL,
  408. X    /* tm_table           */    defaultTranslations,
  409. X    /* query_geometry     */    XtInheritQueryGeometry,
  410. X    /* display_accelerator*/    XtInheritDisplayAccelerator,
  411. X    /* extension          */    NULL
  412. X  }
  413. };
  414. X
  415. WidgetClass xtermWidgetClass = (WidgetClass)&xtermClassRec;
  416. X
  417. #ifdef KTERM
  418. X
  419. /*
  420. X * Added as replacement for FNUM(gs) define in ptyx.h.
  421. X * M. Leisher
  422. X */
  423. int fontno(gs)
  424. int gs;
  425. {
  426. X    switch(gs) {
  427. #ifdef KTERM_KANJI
  428. X      case GSET_KANJI:
  429. X      case GSET_OLDKANJI:
  430. X        return(F_JISX0208_0);
  431. X        break;
  432. #endif /* KTERM_KANJI */
  433. X      case GSET_JISROMAN:
  434. X      case GSET_KANA:
  435. X        return(F_JISX0201_0);
  436. X        break;
  437. #ifdef KTERM_HANZI
  438. X      case GSET_HANZI:
  439. X        return(F_GB2312_0);
  440. X        break;
  441. #endif /* KTERM_HANZI */
  442. #ifdef KTERM_HANGUL
  443. X      case GSET_HANGUL:
  444. X        return(F_KSC5601_0);
  445. X        break;
  446. #endif /* KTERM_HANGUL */
  447. X    }
  448. X    return(F_ISO8859_1);
  449. }
  450. X
  451. /*
  452. X * screen - screen
  453. X * fnum   - font number
  454. X * type   - BOLD or 0
  455. X */
  456. int
  457. FontType(screen, fnum, bold)
  458. TScreen *screen;
  459. int fnum, bold;
  460. {
  461. X    XFontStruct *ft;
  462. X
  463. X    if (bold)
  464. X      ft = screen->_fnt_bold[fnum];
  465. X    else
  466. X      ft = screen->_fnt_norm[fnum];
  467. X
  468. X    if (!ft)
  469. X      return(NONE);
  470. X    if (!ft->min_byte1 && !ft->max_byte1)
  471. X      return(NONE);
  472. X    if (ft->min_byte1 < 0x80 && ft->min_char_or_byte2 < 0x80)
  473. X      return(LOW);
  474. X    if (ft->min_byte1 > 0x80 && ft->min_char_or_byte2 > 0x80)
  475. X      return(HIGH);
  476. X    if (ft->min_byte1 > 0x80 && ft->min_char_or_byte2 < 0x80)
  477. X      return(MIXED);
  478. }
  479. X
  480. doSS(gset)
  481. short gset;
  482. {
  483. X    Char dotextbuf[2];
  484. X    register Char c, min, max;
  485. X    register Char *cp = bptr;
  486. X    register Char *dcp = dotextbuf;
  487. X
  488. X    if (gset & CS96) {
  489. X        min = 0x20; max = 0x7f;
  490. X    } else {
  491. X        min = 0x21; max = 0x7e;
  492. X    }
  493. X    if (*cp & 0x80) {
  494. X        min |= 0x80; max |= 0x80;
  495. X    }
  496. # ifdef KTERM_KANJI
  497. X    if (gset & MBCS) {
  498. X        if (bcnt == 1) {
  499. X            c = *cp;
  500. X            if (min <= c && c <= max) {
  501. X                pending_byte = c;
  502. X                bcnt = 0;
  503. X                return;
  504. X            }
  505. X        } else {
  506. X            /* first byte */
  507. X            c = *cp++;
  508. X            if (c < min || max < c) {
  509. X                cp--;
  510. X                goto end;
  511. X            }
  512. X            *dcp++ = c;
  513. X            /* second byte */
  514. X            c = *cp++;
  515. X            if (c < min || max < c) {
  516. X                /*
  517. X                 * Incomplete multi-byte character.
  518. X                 * Skip its first byte.
  519. X                 */
  520. X                dcp--;
  521. X                cp--;
  522. X                goto end;
  523. X            }
  524. X            *dcp++ = c;
  525. X            dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  526. X        }
  527. X    } else
  528. # endif /* KTERM_KANJI */
  529. X    {
  530. X        min &= 0xa0;
  531. X        c = *cp++;
  532. X        if (c < min || max < c) {
  533. X            cp--;
  534. X            goto end;
  535. X        }
  536. X        *dcp++ = c;
  537. X        dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  538. X    }
  539. X    end:
  540. X    /*
  541. X     * process SPACE or DEL characters in 94chars gset string.
  542. X     */
  543. X    if (c < min || max < c) {
  544. X        if ((c & ~0x80) == 0x20) {
  545. X        dcp = dotextbuf;
  546. X        cp++;
  547. X        *dcp++ = c;
  548. X        dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  549. X        } else if ((c & ~0x80) == 0x7f) {
  550. X        cp++;
  551. X        }
  552. X    }
  553. X    bcnt -= cp - bptr;
  554. X    bptr = cp;
  555. }
  556. X
  557. # if defined(KTERM_HANZI) || defined(KTERM_HANGUL)
  558. X
  559. doLS(gset)
  560. short gset;
  561. {
  562. X    Char dotextbuf[TEXT_BUF_SIZE];
  563. X    register int top;
  564. X    register Char c, c1, min, max, min2, max1;
  565. X    register Char *cp = bptr;
  566. X    register Char *dcp = dotextbuf;
  567. X        Char oc, oc1;
  568. X        char lang = term->misc.lang[0];
  569. X        int hzftype = FontType(&term->screen, F_GB2312_0, 0);
  570. X        int ftype = FontType(&term->screen, FNUM(gset), 0);
  571. X
  572. X        switch(lang) {
  573. #ifdef KTERM_HANZI
  574. X          case 'c': case 'C':
  575. X            if ((gset & MBCS) && (gset != GSET_HANZI))
  576. X              gset &= ~MBCS;
  577. X            break;
  578. #endif /* KTERM_HANZI */
  579. #ifdef KTERM_HANGUL
  580. X          case 'k': case 'K':
  581. X            if ((gset & MBCS) && (gset != GSET_HANGUL))
  582. X              gset &= ~MBCS;
  583. X            break;
  584. #endif /* KTERM_HANGUL */
  585. X          default:
  586. X            if ((gset & MBCS) && (gset != GSET_KANJI && gset != GSET_OLDKANJI))
  587. X              gset &= ~MBCS;
  588. X            break;
  589. X        }
  590. X
  591. X    if (gset & CS96) {
  592. X        min = 0x20; max = 0x7f;
  593. X    } else {
  594. X        min = 0x21; max = 0x7e;
  595. X    }
  596. X    if (*cp & 0x80) {
  597. X        min |= 0x80; max |= 0x80;
  598. X    }
  599. X
  600. X        min2 = min;
  601. X        max1 = max;
  602. X        if ((term->flags & BIG5_HANZI) || hzftype == MIXED) {
  603. X            max1 = 0xf9;       /* Max byte1 for BIG5 */
  604. X            min2 = 0x40;       /* Min byte2 for BIG5 */
  605. X        }
  606. X
  607. X    if (gset & MBCS) {
  608. X            if (bcnt == 1) {
  609. X                c = *cp;
  610. X                if (min <= c && c <= max) {
  611. X                    pending_byte = c;
  612. X                    bcnt = 0;
  613. X                    return;
  614. X                }
  615. X            } else {
  616. X                top = (bcnt >TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt) / 2;
  617. X                while (top > 0) {
  618. X                    /* first byte */
  619. X                    c = *cp++;
  620. X
  621. X                    /*
  622. X                     * Handle BIG5 special case by allowing out of range
  623. X                     * first bytes through so it gets converted to box
  624. X                     * char in converter() stage
  625. X                     */
  626. X                    if (c < min || max1 < c && !(term->flags & BIG5_HANZI)) {
  627. X                        cp--;
  628. X                        break;
  629. X                    }
  630. X                    /* second byte */
  631. X                    c1 = *cp++;
  632. X                    if (c1 < min2 || max < c1) {
  633. X                        /*
  634. X                         * Incomplete multi-byte character.
  635. X                         * Skip its first byte.
  636. X                         */
  637. X                        *dcp = c;
  638. X                        cp--;
  639. X                        break;
  640. X                    }
  641. X
  642. X                    /*
  643. X                     * Catch 7-bit stuff using an 8-bit font.
  644. X                     * Example:
  645. X                     *    7-bit GuoBiao text
  646. X                     *    JIS Kanji with EUC encoded font.
  647. X                     */
  648. X                    if (ftype == HIGH) {
  649. X                        c  |= 0x80;
  650. X                        c1 |= 0x80;
  651. X                    }
  652. X
  653. X                    oc = c; oc1 = c1;
  654. X                    if (hzftype == MIXED && !(term->flags & BIG5_HANZI))
  655. X
  656. X                      hzconvert(GBtoBIG,c,c1,&oc,&oc1);
  657. X
  658. X                    else if (hzftype != MIXED && (term->flags & BIG5_HANZI))
  659. X
  660. X                      /* We know we have a GB font and
  661. X                         BIG5 format chars */
  662. X                      hzconvert(BIGtoGB,c,c1,&oc,&oc1);
  663. X
  664. X                    *dcp++ = oc;
  665. X                    *dcp++ = oc1;
  666. X                    top--;
  667. X                }
  668. X                dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  669. X            }
  670. X        } else {
  671. X            min &= 0xa0;
  672. X            top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  673. X            while (top > 0) {
  674. X                c = *cp++;
  675. X                if (c < min || max < c) {
  676. X                    cp--;
  677. X                    break;
  678. X                }
  679. X                *dcp++ = c;
  680. X                top--;
  681. X            }
  682. X            dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  683. X        }
  684. X    /*
  685. X     * process SPACE or DEL characters in 94chars gset string.
  686. X     */
  687. X    if (c < min || max < c) {
  688. X        if ((c & ~0x80) == 0x20) {
  689. X        dcp = dotextbuf;
  690. X        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  691. X        while (top > 0 && *cp == c) {
  692. X            *dcp++ = c;
  693. X            cp++; top--;
  694. X        }
  695. X        dotext(&term->screen, term->flags, GSET_ASCII, dotextbuf, dcp);
  696. X        } else if ((c & ~0x80) == 0x7f) {
  697. X        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  698. X        while (top > 0 && *cp == c) {
  699. X            cp++; top--;
  700. X        }
  701. X        }
  702. X    }
  703. X    bcnt -= cp - bptr;
  704. X    bptr = cp;
  705. }
  706. X
  707. #ifdef KTERM_HANGUL
  708. doKSH()
  709. {
  710. X    Char dotextbuf[TEXT_BUF_SIZE];
  711. X    register int top;
  712. X    register Char HI, LO;
  713. X    register Char *cp = bptr;
  714. X    register Char *dcp = dotextbuf;
  715. X        unsigned char c1, c2, oc1, oc2;
  716. X
  717. #  define KSH1(c) ((c == 0xA4 || (0xB0 <= c && c <= 0xC8)))
  718. #  define KSH2(c) (0xA1 <= c && c <= 0xFE)
  719. X    if (bcnt == 1) {
  720. X        pending_byte = *cp;
  721. X        bcnt = 0;
  722. X        return;
  723. X    }
  724. X    top = (bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt) / 2;
  725. X    while (top > 0) {
  726. X        HI = *cp++;
  727. X        if (!KSH1(HI)) {
  728. X            cp--;
  729. X            break;
  730. X        }
  731. X        LO = *cp++;
  732. X        if (!KSH2(LO)) {
  733. X            /*
  734. X             * Incomplete shift-gb character.
  735. X             * Skip its first byte.
  736. X             */
  737. X            cp--;
  738. X            break;
  739. X        }
  740. X        *dcp++ = HI;
  741. X        *dcp++ = LO;
  742. X        top--;
  743. X    }
  744. X    dotext(&term->screen, term->flags, GSET_HANGUL, dotextbuf, dcp);
  745. X    bcnt -= cp - bptr;
  746. X    bptr = cp;
  747. }
  748. X
  749. doNBH()
  750. {
  751. X    Char dotextbuf[TEXT_BUF_SIZE];
  752. X    register int top, kslen;
  753. X    register Char *cp = bptr;
  754. X    unsigned char *dcp = dotextbuf;
  755. X        int nblen;
  756. X
  757. X    if (bcnt == 1) {
  758. X        pending_byte = *cp;
  759. X        bcnt = 0;
  760. X        return;
  761. X    }
  762. X    top = (bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt);
  763. X        kslen = hgconvert(cp, &dcp, &nblen);
  764. X        dcp += kslen;
  765. X        cp += nblen;
  766. X    dotext(&term->screen, term->flags, GSET_HANGUL, dotextbuf, dcp);
  767. X    bcnt -= cp - bptr;
  768. X    bptr = cp;
  769. }
  770. #endif /* KTERM_HANGUL */
  771. X
  772. doSGB()
  773. {
  774. X    Char dotextbuf[TEXT_BUF_SIZE];
  775. X    register int top;
  776. X    register Char HI, LO;
  777. X    register Char *cp = bptr;
  778. X    register Char *dcp = dotextbuf;
  779. X        unsigned char c1, c2, oc1, oc2;
  780. X
  781. #  define SGB1(c) ((0x81 <= c && c <= 0xAF))
  782. #  define SGB2(c) (0x40 <= c && c <= 0xFC && c != 0x7F)
  783. X    if (bcnt == 1) {
  784. X        pending_byte = *cp;
  785. X        bcnt = 0;
  786. X        return;
  787. X    }
  788. X    top = (bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt) / 2;
  789. X    while (top > 0) {
  790. X        HI = *cp++;
  791. X        if (!SGB1(HI)) {
  792. X            cp--;
  793. X            break;
  794. X        }
  795. X        LO = *cp++;
  796. X        if (!SGB2(LO)) {
  797. X            /*
  798. X             * Incomplete shift-gb character.
  799. X             * Skip its first byte.
  800. X             */
  801. X            cp--;
  802. X            break;
  803. X        }
  804. X                c1 = HI;
  805. X                c2 = LO;
  806. X                if (FontType(&term->screen, F_GB2312_0, 0) == MIXED)
  807. X                  hzconvert(SGBtoBIG,c1,c2,&oc1,&oc2);
  808. X                else
  809. X                  hzconvert(SGBtoGB,c1,c2,&oc1,&oc2);
  810. X        *dcp++ = oc1;
  811. X        *dcp++ = oc2;
  812. X        top--;
  813. X    }
  814. X    dotext(&term->screen, term->flags, GSET_HANZI, dotextbuf, dcp);
  815. X    bcnt -= cp - bptr;
  816. X    bptr = cp;
  817. }
  818. #  else /* !KTERM_HANZI && !KTERM_HANGUL */
  819. X
  820. doLS(gset)
  821. short gset;
  822. {
  823. X    Char dotextbuf[TEXT_BUF_SIZE];
  824. X    register int top;
  825. X    register Char c, min, max;
  826. X    register Char *cp = bptr;
  827. X    register Char *dcp = dotextbuf;
  828. X
  829. X    if (gset & CS96) {
  830. X        min = 0x20; max = 0x7f;
  831. X    } else {
  832. X        min = 0x21; max = 0x7e;
  833. X    }
  834. X    if (*cp & 0x80) {
  835. X        min |= 0x80; max |= 0x80;
  836. X    }
  837. # ifdef KTERM_KANJI
  838. X    if (gset & MBCS) {
  839. X        if (bcnt == 1) {
  840. X            c = *cp;
  841. X            if (min <= c && c <= max) {
  842. X                pending_byte = c;
  843. X                bcnt = 0;
  844. X                return;
  845. X            }
  846. X        } else {
  847. X            top = (bcnt >TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt) / 2;
  848. X            while (top > 0) {
  849. X                /* first byte */
  850. X                c = *cp++;
  851. X                if (c < min || max < c) {
  852. X                    cp--;
  853. X                    break;
  854. X                }
  855. X                *dcp++ = c;
  856. X                /* second byte */
  857. X                c = *cp++;
  858. X                if (c < min || max < c) {
  859. X                    /*
  860. X                     * Incomplete multi-byte character.
  861. X                     * Skip its first byte.
  862. X                     */
  863. X                    dcp--;
  864. X                    cp--;
  865. X                    break;
  866. X                }
  867. X                *dcp++ = c;
  868. X                top--;
  869. X            }
  870. X            dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  871. X        }
  872. X    } else
  873. # endif /* KTERM_KANJI */
  874. X    {
  875. X        min &= 0xa0;
  876. X        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  877. X        while (top > 0) {
  878. X            c = *cp++;
  879. X            if (c < min || max < c) {
  880. X                cp--;
  881. X                break;
  882. X            }
  883. X            *dcp++ = c;
  884. X            top--;
  885. X        }
  886. X        dotext(&term->screen, term->flags, gset, dotextbuf, dcp);
  887. X    }
  888. X    /*
  889. X     * process SPACE or DEL characters in 94chars gset string.
  890. X     */
  891. X    if (c < min || max < c) {
  892. X        if ((c & ~0x80) == 0x20) {
  893. X        dcp = dotextbuf;
  894. X        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  895. X        while (top > 0 && *cp == c) {
  896. X            *dcp++ = c;
  897. X            cp++; top--;
  898. X        }
  899. X        dotext(&term->screen, term->flags, GSET_ASCII, dotextbuf, dcp);
  900. X        } else if ((c & ~0x80) == 0x7f) {
  901. X        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  902. X        while (top > 0 && *cp == c) {
  903. X            cp++; top--;
  904. X        }
  905. X        }
  906. X    }
  907. X    bcnt -= cp - bptr;
  908. X    bptr = cp;
  909. }
  910. #  endif /* !KTERM_HANZI && !KTERM_HANGUL */
  911. X
  912. # ifdef KTERM_KANJI
  913. doSJIS()
  914. {
  915. X    Char dotextbuf[TEXT_BUF_SIZE];
  916. X    register int top;
  917. X    register Char HI, LO;
  918. X    register Char *cp = bptr;
  919. X    register Char *dcp = dotextbuf;
  920. X
  921. #  define SJIS1(c) ((0x81 <= c && c <= 0x9F) || (0xE0 <= c && c <= 0xEF))
  922. #  define SJIS2(c) (0x40 <= c && c <= 0xFC && c != 0x7F)
  923. X    if (bcnt == 1) {
  924. X        pending_byte = *cp;
  925. X        bcnt = 0;
  926. X        return;
  927. X    }
  928. X    top = (bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt) / 2;
  929. X    while (top > 0) {
  930. X        HI = *cp++;
  931. X        if (!SJIS1(HI)) {
  932. X            cp--;
  933. X            break;
  934. X        }
  935. X        LO = *cp++;
  936. X        if (!SJIS2(LO)) {
  937. X            /*
  938. X             * Incomplete shift-jis character.
  939. X             * Skip its first byte.
  940. X             */
  941. X            cp--;
  942. X            break;
  943. X        }
  944. X        /*
  945. X         * SJIS to JIS code conversion:
  946. X         */
  947. X        if (HI <= 0x9f)    HI = (HI-0x81)*2 + 0x21;
  948. X        else        HI = (HI-0xc1)*2 + 0x21;
  949. X        if (LO <= 0x7e)         LO -= 0x1f;
  950. X        else if (LO <= 0x9e) LO -= 0x20;
  951. X        else             LO -= 0x7e, HI += 1;
  952. X        *dcp++ = HI;
  953. X        *dcp++ = LO;
  954. X        top--;
  955. X    }
  956. X    dotext(&term->screen, term->flags, GSET_KANJI, dotextbuf, dcp);
  957. X    bcnt -= cp - bptr;
  958. X    bptr = cp;
  959. }
  960. # endif /* KTERM_KANJI */
  961. #endif /* KTERM */
  962. X
  963. X
  964. VTparse()
  965. {
  966. X    register TScreen *screen = &term->screen;
  967. X    register int *parsestate = groundtable;
  968. X    register unsigned int c;
  969. X    register unsigned char *cp;
  970. X    register int row, col, top, bot, scstype;
  971. #ifdef KTERM
  972. X    register Bchr *xp;
  973. X    int cs96 = 0;
  974. #endif /* KTERM */
  975. #ifdef KTERM_KANJI
  976. X    int mbcs = 0;
  977. X    register int ps;
  978. #endif /* KTERM_KANJI */
  979. X    extern int bitset(), bitclr(), finput(), TrackMouse();
  980. X
  981. X    if(setjmp(vtjmpbuf))
  982. X        parsestate = groundtable;
  983. #ifdef KTERM_KANJI
  984. X    pending_byte = 0;
  985. #endif /* KTERM_KANJI */
  986. X    for( ; ; ) {
  987. #ifdef KTERM_KANJI
  988. X            ps = parsestate[c = doinput()];
  989. X        if (term->flags & SJIS_KANJI && SJIS1(c)) {
  990. X            bcnt++;
  991. X            *--bptr = c;
  992. X            doSJIS();
  993. X            screen->curss = 0;
  994. X            continue;
  995. X        }
  996. #ifdef KTERM_HANZI
  997. X                if (term->flags & SGB_HANZI && SGB1(c)) {
  998. X                    bcnt++;
  999. X                    *--bptr = c;
  1000. X                    doSGB();
  1001. X                    screen->curss = 0;
  1002. X                    continue;
  1003. X                }
  1004. #endif /* KTERM_HANZI */
  1005. #ifdef KTERM_HANGUL
  1006. X                if (term->flags & KS_HANGUL && KSH1(c)) {
  1007. X                    bcnt++;
  1008. X                    *--bptr = c;
  1009. X                    doKSH();
  1010. X                    screen->curss = 0;
  1011. X                    continue;
  1012. X                }
  1013. X                if (term->flags & NBYTE_HANGUL && screen->curgl) {
  1014. X                    bcnt++;
  1015. X                    *--bptr = c;
  1016. X                    doNBH();
  1017. X                    screen->curss = screen->curgl = 0;
  1018. X                    continue;
  1019. X                }
  1020. #endif /* KTERM_HANGUL */
  1021. X
  1022. X            switch (ps) {
  1023. #else /* !KTERM_KANJI */
  1024. X            switch (parsestate[c = doinput()]) {
  1025. #endif /* !KTERM_KANJI */
  1026. X         case CASE_PRINT:
  1027. X            /* printable characters */
  1028. #ifdef KTERM
  1029. X            bcnt++;
  1030. X            *--bptr = c;
  1031. X            if(screen->curss) {
  1032. X                doSS(screen->gsets[screen->curss]);
  1033. # ifdef KTERM_KANJI
  1034. X                if (pending_byte == 0)
  1035. # endif /* KTERM_KANJI */
  1036. X                    screen->curss = 0;
  1037. X                                continue;
  1038. X            }
  1039. X            doLS(screen->gsets[c & 0x80 ? screen->curgr
  1040. X                            : screen->curgl]);
  1041. #else /* KTERM */
  1042. X            top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
  1043. X            cp = bptr;
  1044. X            *--bptr = c;
  1045. X            while(top > 0 && isprint(*cp & 0x7f)) {
  1046. X                top--;
  1047. X                bcnt--;
  1048. X                cp++;
  1049. X            }
  1050. X            if(screen->curss) {
  1051. X                dotext(screen, term->flags,
  1052. X                 screen->gsets[screen->curss], bptr, bptr + 1);
  1053. X                screen->curss = 0;
  1054. X                bptr++;
  1055. X            }
  1056. X            if(bptr < cp)
  1057. X                dotext(screen, term->flags,
  1058. X                 screen->gsets[screen->curgl], bptr, cp);
  1059. X            bptr = cp;
  1060. #endif /* !KTERM */
  1061. X            break;
  1062. X
  1063. X         case CASE_GROUND_STATE:
  1064. X            /* exit ignore mode */
  1065. X            parsestate = groundtable;
  1066. X            break;
  1067. X
  1068. X         case CASE_IGNORE_STATE:
  1069. X            /* Ies: ignore anything else */
  1070. X            parsestate = igntable;
  1071. X            break;
  1072. X
  1073. X         case CASE_IGNORE_ESC:
  1074. X            /* Ign: escape */
  1075. X            parsestate = iestable;
  1076. X            break;
  1077. X
  1078. X         case CASE_IGNORE:
  1079. X            /* Ignore character */
  1080. X            break;
  1081. X
  1082. X         case CASE_BELL:
  1083. X            /* bell */
  1084. X            Bell();
  1085. X            break;
  1086. X
  1087. X         case CASE_BS:
  1088. X            /* backspace */
  1089. X            CursorBack(screen, 1);
  1090. X            break;
  1091. X
  1092. X         case CASE_CR:
  1093. X            /* carriage return */
  1094. X            /*
  1095. X             * Tag only real new lines for selections.
  1096. X             */
  1097. X            screen->buf[screen->cur_row][screen->cur_col].attr |=
  1098. X              NL_TAG;
  1099. X            CarriageReturn(screen);
  1100. X            break;
  1101. X
  1102. X         case CASE_ESC:
  1103. X            /* escape */
  1104. X            parsestate = esctable;
  1105. X            break;
  1106. X
  1107. X         case CASE_VMOT:
  1108. X            /*
  1109. X             * form feed, line feed, vertical tab
  1110. X             */
  1111. #ifdef STATUSLINE
  1112. X              if (!screen->instatus)
  1113. #endif /* STATUSLINE */
  1114. X            Index(screen, 1);
  1115. X            if (term->flags & LINEFEED) {
  1116. X                /*
  1117. X                 * Tag only real new lines for selections.
  1118. X                 */
  1119. X                screen->buf[screen->cur_row][screen->cur_col].attr
  1120. X                  |= NL_TAG;
  1121. X                CarriageReturn(screen);
  1122. X            }
  1123. X            if (screen->display->qlen > 0 ||
  1124. X                GetBytesAvailable (screen->display->fd) > 0)
  1125. X              xevents();
  1126. X            break;
  1127. X
  1128. X         case CASE_TAB:
  1129. X            /* tab */
  1130. X            /*
  1131. X             * Tag tabs for preservation in selections.
  1132. X             */
  1133. X            screen->buf[screen->cur_row][screen->cur_col].attr |=
  1134. X              TAB_TAG;
  1135. X            screen->cur_col = TabNext(term->tabs, screen->cur_col);
  1136. X            if (screen->cur_col > screen->max_col)
  1137. X                screen->cur_col = screen->max_col;
  1138. X            break;
  1139. X
  1140. X         case CASE_SI:
  1141. X            screen->curgl = 0;
  1142. X            break;
  1143. X
  1144. X         case CASE_SO:
  1145. X            screen->curgl = 1;
  1146. X            break;
  1147. X
  1148. X         case CASE_SCR_STATE:
  1149. X            /* enter scr state */
  1150. X            parsestate = scrtable;
  1151. X            break;
  1152. X
  1153. X         case CASE_SCS0_STATE:
  1154. X            /* enter scs state 0 */
  1155. #ifdef KTERM_CTEXT
  1156. X                        /*
  1157. X                         * For X11 Compound Text encoding, a multi-byte
  1158. X                         * character set is introduced in this way:
  1159. X                         *     ESC-$-(-{A,B,C}      G0/GL designation
  1160. X                         *     ESC-$-)-{A,B,C}      G1/GR designation
  1161. X                         *
  1162. X                         * G0/GL triggers an MBCS state in the SCS0 state and
  1163. X                         * G1/GR triggers an MBCS state in the SCS1 state.
  1164. X                         *
  1165. X                         * The {A,B,C} are currently the only X11 Consortium
  1166. X                         * registered multi-byte character set compound text
  1167. X                         * sequences.  These character sets are currently
  1168. X                         * defined in GL only.
  1169. X                         *     'A' indicates Chinese GB2312-1980 encoding
  1170. X                         *     'B' indicates Japanese JISX0208-1983 encoding
  1171. X                         *     'C' indicates Korean KSC5601-1987 encoding
  1172. X                         */
  1173. X
  1174. X                        if (parsestate == mbcstable && c == '(') mbcs = 1;
  1175. #endif /* KTERM_CTEXT */
  1176. X
  1177. X            scstype = 0;
  1178. X            parsestate = scstable;
  1179. X            break;
  1180. X
  1181. X         case CASE_SCS1_STATE:
  1182. X            /* enter scs state 1 */
  1183. #ifdef KTERM
  1184. X            if (c == '-') cs96 = 1;
  1185. #endif /* KTERM */
  1186. X            scstype = 1;
  1187. X            parsestate = scstable;
  1188. X            break;
  1189. X
  1190. X         case CASE_SCS2_STATE:
  1191. X            /* enter scs state 2 */
  1192. #ifdef KTERM
  1193. X            if (c == '.') cs96 = 1;
  1194. #endif /* KTERM */
  1195. X            scstype = 2;
  1196. X            parsestate = scstable;
  1197. X            break;
  1198. X
  1199. X         case CASE_SCS3_STATE:
  1200. X            /* enter scs state 3 */
  1201. #ifdef KTERM
  1202. X            if (c == '/') cs96 = 1;
  1203. #endif /* KTERM */
  1204. X            scstype = 3;
  1205. X            parsestate = scstable;
  1206. X            break;
  1207. X
  1208. #ifdef KTERM_KANJI
  1209. X         case CASE_MBCS:
  1210. X            /* enter mbcs state */
  1211. X            mbcs = 1;
  1212. X            scstype = 0;
  1213. X            parsestate = mbcstable;
  1214. X            break;
  1215. #endif /* KTERM_KANJI */
  1216. X
  1217. X         case CASE_ESC_IGNORE:
  1218. X            /* unknown escape sequence */
  1219. X            parsestate = eigtable;
  1220. X            break;
  1221. X
  1222. X         case CASE_ESC_DIGIT:
  1223. X            /* digit in csi or dec mode */
  1224. X            if((row = param[nparam - 1]) == DEFAULT)
  1225. X                row = 0;
  1226. X            param[nparam - 1] = 10 * row + (c - '0');
  1227. X            break;
  1228. X
  1229. X         case CASE_ESC_SEMI:
  1230. X            /* semicolon in csi or dec mode */
  1231. X            param[nparam++] = DEFAULT;
  1232. X            break;
  1233. X
  1234. X         case CASE_DEC_STATE:
  1235. X            /* enter dec mode */
  1236. X            parsestate = dectable;
  1237. X            break;
  1238. X
  1239. X         case CASE_ICH:
  1240. X            /* ICH */
  1241. X            if((row = param[0]) < 1)
  1242. X                row = 1;
  1243. X            InsertChar(screen, row);
  1244. X            parsestate = groundtable;
  1245. X            break;
  1246. X
  1247. X         case CASE_CUU:
  1248. X            /* CUU */
  1249. X            if((row = param[0]) < 1)
  1250. X                row = 1;
  1251. #ifdef STATUSLINE
  1252. X              if (!screen->instatus)
  1253. #endif /* STATUSLINE */
  1254. X            CursorUp(screen, row);
  1255. X            parsestate = groundtable;
  1256. X            break;
  1257. X
  1258. X         case CASE_CUD:
  1259. X            /* CUD */
  1260. X            if((row = param[0]) < 1)
  1261. X                row = 1;
  1262. #ifdef STATUSLINE
  1263. X              if (!screen->instatus)
  1264. #endif /* STATUSLINE */
  1265. X            CursorDown(screen, row);
  1266. X            parsestate = groundtable;
  1267. X            break;
  1268. X
  1269. X         case CASE_CUF:
  1270. X            /* CUF */
  1271. X            if((row = param[0]) < 1)
  1272. X                row = 1;
  1273. X            CursorForward(screen, row);
  1274. X            parsestate = groundtable;
  1275. X            break;
  1276. X
  1277. X         case CASE_CUB:
  1278. X            /* CUB */
  1279. X            if((row = param[0]) < 1)
  1280. X                row = 1;
  1281. X            CursorBack(screen, row);
  1282. X            parsestate = groundtable;
  1283. X            break;
  1284. X
  1285. X         case CASE_CUP:
  1286. X            /* CUP | HVP */
  1287. X            if((row = param[0]) < 1)
  1288. X                row = 1;
  1289. X            if(nparam < 2 || (col = param[1]) < 1)
  1290. X                col = 1;
  1291. #ifdef STATUSLINE
  1292. X              if (!screen->instatus)
  1293. #endif /* STATUSLINE */
  1294. X            CursorSet(screen, row-1, col-1, term->flags);
  1295. X            parsestate = groundtable;
  1296. X            break;
  1297. X
  1298. X         case CASE_ED:
  1299. X            /* ED */
  1300. X            switch (param[0]) {
  1301. X             case DEFAULT:
  1302. X             case 0:
  1303. #ifdef STATUSLINE
  1304. X                  if (screen->instatus)
  1305. X                ClearRight(screen);
  1306. X                  else
  1307. #endif /* STATUSLINE */
  1308. X                ClearBelow(screen);
  1309. X                break;
  1310. X
  1311. X             case 1:
  1312. #ifdef STATUSLINE
  1313. X                  if (screen->instatus)
  1314. X                ClearLeft(screen);
  1315. X                  else
  1316. #endif /* STATUSLINE */
  1317. X                ClearAbove(screen);
  1318. X                break;
  1319. X
  1320. X             case 2:
  1321. #ifdef STATUSLINE
  1322. X                  if (screen->instatus)
  1323. X                ClearLine(screen);
  1324. X                  else
  1325. #endif /* STATUSLINE */
  1326. X                ClearScreen(screen);
  1327. X                break;
  1328. X            }
  1329. X            parsestate = groundtable;
  1330. X            break;
  1331. X
  1332. X         case CASE_EL:
  1333. X            /* EL */
  1334. X            switch (param[0]) {
  1335. X             case DEFAULT:
  1336. X             case 0:
  1337. X                ClearRight(screen);
  1338. X                break;
  1339. X             case 1:
  1340. X                ClearLeft(screen);
  1341. X                break;
  1342. X             case 2:
  1343. X                ClearLine(screen);
  1344. X                break;
  1345. X            }
  1346. X            parsestate = groundtable;
  1347. X            break;
  1348. X
  1349. X         case CASE_IL:
  1350. X            /* IL */
  1351. X            if((row = param[0]) < 1)
  1352. X                row = 1;
  1353. #ifdef STATUSLINE
  1354. X              if (!screen->instatus)
  1355. #endif /* STATUSLINE */
  1356. X            InsertLine(screen, row);
  1357. X            parsestate = groundtable;
  1358. X            break;
  1359. X
  1360. X         case CASE_DL:
  1361. X            /* DL */
  1362. X            if((row = param[0]) < 1)
  1363. X                row = 1;
  1364. #ifdef STATUSLINE
  1365. X              if (!screen->instatus)
  1366. #endif /* STATUSLINE */
  1367. X            DeleteLine(screen, row);
  1368. X            parsestate = groundtable;
  1369. X            break;
  1370. X
  1371. X         case CASE_DCH:
  1372. X            /* DCH */
  1373. X            if((row = param[0]) < 1)
  1374. X                row = 1;
  1375. X            DeleteChar(screen, row);
  1376. X            parsestate = groundtable;
  1377. X            break;
  1378. X
  1379. X         case CASE_TRACK_MOUSE:
  1380. X             /* Track mouse as long as in window and between
  1381. X               specified rows */
  1382. X            TrackMouse(param[0], param[2]-1, param[1]-1,
  1383. X             param[3]-1, param[4]-2);
  1384. X            break;
  1385. X
  1386. X         case CASE_DECID:
  1387. X            param[0] = -1;        /* Default ID parameter */
  1388. X            /* Fall through into ... */
  1389. X         case CASE_DA1:
  1390. X            /* DA1 */
  1391. X            if (param[0] <= 0) {    /* less than means DEFAULT */
  1392. X                reply.a_type   = CSI;
  1393. X                reply.a_pintro = '?';
  1394. X                reply.a_nparam = 2;
  1395. X                reply.a_param[0] = 1;        /* VT102 */
  1396. X                reply.a_param[1] = 2;        /* VT102 */
  1397. X                reply.a_inters = 0;
  1398. X                reply.a_final  = 'c';
  1399. X                unparseseq(&reply, screen->respond);
  1400. X            }
  1401. X            parsestate = groundtable;
  1402. X            break;
  1403. X
  1404. X         case CASE_TBC:
  1405. X            /* TBC */
  1406. X            if ((row = param[0]) <= 0) /* less than means default */
  1407. X                TabClear(term->tabs, screen->cur_col);
  1408. X            else if (row == 3)
  1409. X                TabZonk(term->tabs);
  1410. X            parsestate = groundtable;
  1411. X            break;
  1412. X
  1413. X         case CASE_SET:
  1414. X            /* SET */
  1415. X            modes(term, bitset);
  1416. X            parsestate = groundtable;
  1417. X            break;
  1418. X
  1419. X         case CASE_RST:
  1420. X            /* RST */
  1421. X            modes(term, bitclr);
  1422. X            parsestate = groundtable;
  1423. X            break;
  1424. X
  1425. X         case CASE_SGR:
  1426. X            /* SGR */
  1427. X            for (row=0; row<nparam; ++row) {
  1428. X                switch (param[row]) {
  1429. X                 case DEFAULT:
  1430. X                 case 0:
  1431. X                    term->flags &= ~(INVERSE|BOLD|UNDERLINE
  1432. #ifdef  COLOR_TEXT /* mukawa */
  1433. X                        |COLOR_TEXT0|COLOR_TEXT1
  1434. X                        |COLOR_TEXT2|COLOR_TEXT3
  1435. X                                                |COLOR_TEXT4|COLOR_TEXT5
  1436. X                        |COLOR_TEXT6|COLOR_TEXT7
  1437. #endif  /* COLOR_TEXT */
  1438. X                                                         );
  1439. X                    break;
  1440. X                 case 1:
  1441. X                 case 5:    /* Blink, really.    */
  1442. X                    term->flags |= BOLD;
  1443. X                    break;
  1444. X                 case 4:    /* Underscore        */
  1445. X                    term->flags |= UNDERLINE;
  1446. X                    break;
  1447. X                 case 7:
  1448. X                    term->flags |= INVERSE;
  1449. X                                        break;
  1450. #ifdef  COLOR_TEXT /* mukawa */
  1451. X                                 case 30:
  1452. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1453. X                    term->flags |= COLOR_TEXT0;
  1454. X                    break;
  1455. X                                 case 31:
  1456. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1457. X                    term->flags |= COLOR_TEXT1;
  1458. X                    break;
  1459. X                                 case 32:
  1460. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1461. X                    term->flags |= COLOR_TEXT2;
  1462. X                    break;
  1463. X                                 case 33:
  1464. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1465. X                    term->flags |= COLOR_TEXT3;
  1466. X                    break;
  1467. X                                 case 34:
  1468. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1469. X                    term->flags |= COLOR_TEXT4;
  1470. X                    break;
  1471. X                                 case 35:
  1472. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1473. X                    term->flags |= COLOR_TEXT5;
  1474. X                    break;
  1475. X                                 case 36:
  1476. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1477. X                    term->flags |= COLOR_TEXT6;
  1478. X                    break;
  1479. X                                 case 37:
  1480. X                    term->flags &= ~(COLOR_TEXT_MASK|INVERSE);
  1481. X                    term->flags |= COLOR_TEXT7;
  1482. X                    break;
  1483. X                                 case 40:
  1484. X                    term->flags &= ~COLOR_TEXT_MASK;
  1485. X                    term->flags |= (COLOR_TEXT0|INVERSE);
  1486. X                    break;
  1487. X                                 case 41:
  1488. X                    term->flags &= ~COLOR_TEXT_MASK;
  1489. X                     term->flags |= (COLOR_TEXT1|INVERSE);
  1490. X                    break;
  1491. X                                 case 42:
  1492. X                    term->flags &= ~COLOR_TEXT_MASK;
  1493. X                    term->flags |= (COLOR_TEXT2|INVERSE);
  1494. X                    break;
  1495. X                                 case 43:
  1496. X                    term->flags &= ~COLOR_TEXT_MASK;
  1497. X                    term->flags |= (COLOR_TEXT3|INVERSE);
  1498. X                    break;
  1499. X                                 case 44:
  1500. X                    term->flags &= ~COLOR_TEXT_MASK;
  1501. X                    term->flags |= (COLOR_TEXT4|INVERSE);
  1502. X                    break;
  1503. X                                 case 45:
  1504. X                    term->flags &= ~COLOR_TEXT_MASK;
  1505. X                    term->flags |= (COLOR_TEXT5|INVERSE);
  1506. X                    break;
  1507. X                                 case 46:
  1508. X                    term->flags &= ~COLOR_TEXT_MASK;
  1509. X                    term->flags |= (COLOR_TEXT6|INVERSE);
  1510. X                    break;
  1511. X                                 case 47:
  1512. X                    term->flags &= ~COLOR_TEXT_MASK;
  1513. X                    term->flags |= (COLOR_TEXT7|INVERSE);
  1514. X                    break;
  1515. #endif  /* COLOR_TEXT */
  1516. X                }
  1517. X            }
  1518. X            parsestate = groundtable;
  1519. X            break;
  1520. X
  1521. X         case CASE_CPR:
  1522. X            /* CPR */
  1523. X            if ((row = param[0]) == 5) {
  1524. X                reply.a_type = CSI;
  1525. X                reply.a_pintro = 0;
  1526. X                reply.a_nparam = 1;
  1527. X                reply.a_param[0] = 0;
  1528. X                reply.a_inters = 0;
  1529. X                reply.a_final  = 'n';
  1530. X                unparseseq(&reply, screen->respond);
  1531. X            } else if (row == 6) {
  1532. X                reply.a_type = CSI;
  1533. X                reply.a_pintro = 0;
  1534. X                reply.a_nparam = 2;
  1535. X                reply.a_param[0] = screen->cur_row+1;
  1536. X                reply.a_param[1] = screen->cur_col+1;
  1537. X                reply.a_inters = 0;
  1538. X                reply.a_final  = 'R';
  1539. X                unparseseq(&reply, screen->respond);
  1540. X            }
  1541. X            parsestate = groundtable;
  1542. X            break;
  1543. X
  1544. X         case CASE_DECSTBM:
  1545. X            /* DECSTBM */
  1546. X            if((top = param[0]) < 1)
  1547. X                top = 1;
  1548. X            if(nparam < 2 || (bot = param[1]) == DEFAULT
  1549. X               || bot > screen->max_row + 1
  1550. X               || bot == 0)
  1551. X                bot = screen->max_row+1;
  1552. #ifdef STATUSLINE
  1553. X              if (!screen->instatus)
  1554. #endif /* STATUSLINE */
  1555. X            if (bot > top) {
  1556. X                if(screen->scroll_amt)
  1557. X                    FlushScroll(screen);
  1558. X                screen->top_marg = top-1;
  1559. X                screen->bot_marg = bot-1;
  1560. X                CursorSet(screen, 0, 0, term->flags);
  1561. X            }
  1562. X            parsestate = groundtable;
  1563. X            break;
  1564. X
  1565. X         case CASE_DECREQTPARM:
  1566. X            /* DECREQTPARM */
  1567. X            if ((row = param[0]) == DEFAULT)
  1568. X                row = 0;
  1569. X            if (row == 0 || row == 1) {
  1570. X                reply.a_type = CSI;
  1571. X                reply.a_pintro = 0;
  1572. X                reply.a_nparam = 7;
  1573. X                reply.a_param[0] = row + 2;
  1574. X                reply.a_param[1] = 1;    /* no parity */
  1575. X                reply.a_param[2] = 1;    /* eight bits */
  1576. X                reply.a_param[3] = 112;    /* transmit 9600 baud */
  1577. X                reply.a_param[4] = 112;    /* receive 9600 baud */
  1578. X                reply.a_param[5] = 1;    /* clock multiplier ? */
  1579. X                reply.a_param[6] = 0;    /* STP flags ? */
  1580. X                reply.a_inters = 0;
  1581. X                reply.a_final  = 'x';
  1582. X                unparseseq(&reply, screen->respond);
  1583. X            }
  1584. X            parsestate = groundtable;
  1585. X            break;
  1586. X
  1587. X         case CASE_DECSET:
  1588. X            /* DECSET */
  1589. X            dpmodes(term, bitset);
  1590. X            parsestate = groundtable;
  1591. X            if(screen->TekEmu)
  1592. X                return;
  1593. X            break;
  1594. X
  1595. X         case CASE_DECRST:
  1596. X            /* DECRST */
  1597. X            dpmodes(term, bitclr);
  1598. X            parsestate = groundtable;
  1599. X            break;
  1600. X
  1601. X         case CASE_DECALN:
  1602. X            /* DECALN */
  1603. X            if(screen->cursor_state)
  1604. X                HideCursor();
  1605. X            for(row = screen->max_row ; row >= 0 ; row--) {
  1606. #ifdef KTERM
  1607. X                for(xp = screen->buf[row] ; col > 0 ; col--) {
  1608. X                    xp++->code = (unsigned char) 'E';
  1609. X                    xp++->gset = GSET_ASCII;
  1610. X                    xp++->attr = 0;
  1611. X                }
  1612. #else /* !KTERM */
  1613. X                bzero(screen->buf[2 * row + 1],
  1614. X                 col = screen->max_col + 1);
  1615. X                for(cp = (unsigned char *)screen->buf[2 * row] ; col > 0 ; col--)
  1616. X                    *cp++ = (unsigned char) 'E';
  1617. #endif /* !KTERM */
  1618. X            }
  1619. X            ScrnRefresh(screen, 0, 0, screen->max_row + 1,
  1620. X             screen->max_col + 1, False);
  1621. X            parsestate = groundtable;
  1622. X            break;
  1623. X
  1624. X         case CASE_GSETS:
  1625. #ifdef KTERM
  1626. X            c = GSET(c);
  1627. X            if (cs96) {
  1628. X                c |= CS96;
  1629. X                cs96 = 0;
  1630. X            }
  1631. # ifdef KTERM_KANJI
  1632. X            if (mbcs) {
  1633. X                c |= MBCS;
  1634. X                mbcs = 0;
  1635. X            }
  1636. # endif /* KTERM_KANJI */
  1637. #endif /* KTERM */
  1638. X            screen->gsets[scstype] = c;
  1639. X            parsestate = groundtable;
  1640. X            break;
  1641. X
  1642. X         case CASE_DECSC:
  1643. X            /* DECSC */
  1644. X            CursorSave(term, &screen->sc);
  1645. X            parsestate = groundtable;
  1646. X            break;
  1647. X
  1648. X         case CASE_DECRC:
  1649. X            /* DECRC */
  1650. X            CursorRestore(term, &screen->sc);
  1651. X            parsestate = groundtable;
  1652. X            break;
  1653. X
  1654. X         case CASE_DECKPAM:
  1655. X            /* DECKPAM */
  1656. X            term->keyboard.flags |= KYPD_APL;
  1657. X            update_appkeypad();
  1658. X            parsestate = groundtable;
  1659. X            break;
  1660. X
  1661. X         case CASE_DECKPNM:
  1662. X            /* DECKPNM */
  1663. X            term->keyboard.flags &= ~KYPD_APL;
  1664. X            update_appkeypad();
  1665. X            parsestate = groundtable;
  1666. X            break;
  1667. X
  1668. X         case CASE_IND:
  1669. X            /* IND */
  1670. #ifdef STATUSLINE
  1671. X              if (!screen->instatus)
  1672. #endif /* STATUSLINE */
  1673. X            Index(screen, 1);
  1674. X            if (screen->display->qlen > 0 ||
  1675. X                GetBytesAvailable (screen->display->fd) > 0)
  1676. X              xevents();
  1677. X            parsestate = groundtable;
  1678. X            break;
  1679. X
  1680. X         case CASE_NEL:
  1681. X            /* NEL */
  1682. #ifdef STATUSLINE
  1683. X              if (!screen->instatus)
  1684. #endif /* STATUSLINE */
  1685. X            Index(screen, 1);
  1686. X            /*
  1687. X             * Tag only real new lines for selections.
  1688. X             */
  1689. X            screen->buf[screen->cur_row][screen->cur_col].attr |=
  1690. X              NL_TAG;
  1691. X            CarriageReturn(screen);
  1692. X            
  1693. X            if (screen->display->qlen > 0 ||
  1694. X                GetBytesAvailable (screen->display->fd) > 0)
  1695. X              xevents();
  1696. X            parsestate = groundtable;
  1697. X            break;
  1698. X
  1699. X         case CASE_HTS:
  1700. X            /* HTS */
  1701. X            TabSet(term->tabs, screen->cur_col);
  1702. X            parsestate = groundtable;
  1703. X            break;
  1704. X
  1705. X         case CASE_RI:
  1706. X            /* RI */
  1707. #ifdef STATUSLINE
  1708. X              if (!screen->instatus)
  1709. #endif /* STATUSLINE */
  1710. X            RevIndex(screen, 1);
  1711. X            parsestate = groundtable;
  1712. X            break;
  1713. X
  1714. X         case CASE_SS2:
  1715. X            /* SS2 */
  1716. X            screen->curss = 2;
  1717. X            /*
  1718. X            dosingleshift();
  1719. X            screen->curss = 0;
  1720. X            */
  1721. X            parsestate = groundtable;
  1722. X            break;
  1723. X
  1724. X         case CASE_SS3:
  1725. X            /* SS3 */
  1726. X            screen->curss = 3;
  1727. X            /*
  1728. X            dosingleshift();
  1729. X            screen->curss = 0;
  1730. X            */
  1731. X            parsestate = groundtable;
  1732. X            break;
  1733. X
  1734. X         case CASE_CSI_STATE:
  1735. X            /* enter csi state */
  1736. X            nparam = 1;
  1737. X            param[0] = DEFAULT;
  1738. X            parsestate = csitable;
  1739. X            break;
  1740. X
  1741. X         case CASE_OSC:
  1742. X            /* do osc escapes */
  1743. X            do_osc(finput);
  1744. X            parsestate = groundtable;
  1745. X            break;
  1746. X
  1747. X         case CASE_RIS:
  1748. X            /* RIS */
  1749. X            VTReset(TRUE);
  1750. X            parsestate = groundtable;
  1751. X            break;
  1752. X
  1753. X         case CASE_LS2:
  1754. X            /* LS2 */
  1755. X            screen->curgl = 2;
  1756. X            parsestate = groundtable;
  1757. X            break;
  1758. X
  1759. X         case CASE_LS3:
  1760. X            /* LS3 */
  1761. X            screen->curgl = 3;
  1762. X            parsestate = groundtable;
  1763. X            break;
  1764. X
  1765. X         case CASE_LS3R:
  1766. X            /* LS3R */
  1767. X            screen->curgr = 3;
  1768. X            parsestate = groundtable;
  1769. X            break;
  1770. X
  1771. X         case CASE_LS2R:
  1772. X            /* LS2R */
  1773. X            screen->curgr = 2;
  1774. X            parsestate = groundtable;
  1775. X            break;
  1776. X
  1777. X         case CASE_LS1R:
  1778. X            /* LS1R */
  1779. X            screen->curgr = 1;
  1780. X            parsestate = groundtable;
  1781. X            break;
  1782. X
  1783. #ifdef STATUSLINE
  1784. X         case CASE_TO_STATUS:
  1785. X            if ((c = param[0]) < 1)
  1786. X                c = 1;
  1787. X            ToStatus(c - 1);
  1788. X            parsestate = groundtable;
  1789. X            break;
  1790. X
  1791. X         case CASE_FROM_STATUS:
  1792. X            FromStatus();
  1793. X            parsestate = groundtable;
  1794. X            break;
  1795. X
  1796. X         case CASE_SHOW_STATUS:
  1797. X            ShowStatus();
  1798. X            parsestate = groundtable;
  1799. SHAR_EOF
  1800. true || echo 'restore of kterm-4.1.2/charproc.c failed'
  1801. fi
  1802. echo 'End of kterm-4.1.2 part 7'
  1803. echo 'File kterm-4.1.2/charproc.c is continued in part 8'
  1804. echo 8 > _shar_seq_.tmp
  1805. exit 0
  1806.  
  1807.  
  1808. -----------------------------------------------------------------------------
  1809. mleisher@nmsu.edu                      "I laughed.
  1810. Mark Leisher                                I cried.
  1811. Computing Research Lab                          I fell down.
  1812. New Mexico State University                        It changed my life."
  1813. Las Cruces, NM                     - Rich [Cowboy Feng's Space Bar and Grille]
  1814.  
  1815. --
  1816. Dan Heller
  1817. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  1818. Senior Writer                President          comp-sources.x@uunet.uu.net
  1819. argv@ora.com                 argv@zipcode.com
  1820.