home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / COMM / MISC / SRC26_2.ZIP / SRC / KEYOSK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-03  |  1.9 KB  |  140 lines

  1. /*
  2.  * keyosk.c: hterm keyboard decoder for OS-9/680x0 and OS-9000
  3.  *
  4.  * Author: HIRANO Satoshi
  5.  * (C) 1989  Halca Computer Science Laboratory TM
  6.  *           University of Tokyo
  7.  *
  8.  * Edition History:
  9.  * 1.1 90/02/03 Halca.Hirano creation
  10.  *
  11.  * $Header: keyosk.cv  1.1  90/02/03 14:01:38  hirano  Exp $
  12.  */
  13.  
  14.  
  15. #include "hterm.h"
  16.  
  17. void keyInit()
  18. /* iniz keyboard mode */
  19. {
  20.     clickFlag = DEFAULT_KEY_CLICK;
  21.     applKeypad = DEFAULT_APP_KEYBOARD;
  22.     applCursor = DEFAULT_CURSOR_KEY_MODE;
  23.     newline = DEFAULT_NEWLINE_MODE;
  24.     asckey = YES;            /* always ascii keyboard    */
  25.     mouseSpeed = DEFAULT_MOUSE_SPEED;
  26.     bsKeyCount = keyCount = 0;
  27.     bsKeyRatio = DEFAULT_BS_KEY_RATIO;
  28.  
  29.     mouseInit();
  30. }
  31.  
  32. keySetup()
  33. /* setup keyboard mode */
  34. {}
  35.  
  36. keyEnd()
  37. {
  38.     mouseEnd();
  39. }
  40.  
  41. int checkKey()
  42. /*
  43.  * return 0 if key buffer is empty
  44.  */
  45. {
  46.     if (_gs_rdy(0) == -1)
  47.         return(NO);
  48.     else
  49.         return(YES);
  50. }
  51.  
  52. short keyin()
  53. /* 
  54.  * check keyboard status and return key if available 
  55.  * return:
  56.  *    -1    key is not available
  57.  *    00xx    ASCII, kana
  58.  *    xxyy    hterm kanji code
  59.  *    xx00    special key code
  60.  */
  61. {
  62.     short        c, c2;
  63.     char         buf[2];
  64.  
  65.     if (_gs_rdy(0) == -1)
  66.         return(-1);
  67.  
  68.     read(0, buf, 1);
  69.     c = buf[0];
  70.  
  71.     timerValue = timerLoadValue;
  72.     keyCount++;
  73.  
  74.     if (clickFlag == YES)
  75.         click();
  76.  
  77. #ifdef KANJI
  78.     if (isSJIS1(c)) {        /*if kanji start */
  79.         while (_gs_rdy(0) == -1)
  80.             ;
  81.         read(0, buf, 1);
  82.         c2 = buf[0];
  83.         return(SJIStoJIS(c, c2));
  84.     }
  85.     return((u_short)c);
  86. }
  87.  
  88. keyMode()
  89. {
  90.     /* nothing to do */
  91. }
  92.  
  93. setBSDel()
  94. {
  95.     /* not needed */
  96. }
  97.  
  98. editPFKey()
  99. {
  100. }
  101.  
  102. editSPFKey()
  103. {
  104. }
  105.  
  106. editCursorKey()
  107. {
  108. }
  109.  
  110. editAppCursorKey()
  111. {
  112. }
  113.  
  114. editAppKeyPad()
  115. {
  116. }
  117.  
  118. saveKey(fd)
  119. int fd;
  120. /*
  121.  * save key pad string, cursor key string, pf key string
  122.  */
  123. {
  124. }
  125.  
  126. loadKey(fd)
  127. int fd;
  128. /*
  129.  * load key pad string, cursor key string, pf key string
  130.  */
  131. {
  132. }
  133.  
  134. void FAR mouseEvent() {}
  135. mouseOnOff() {}
  136. mouseSetPosition() {}
  137. mouseEnd() {}
  138. mouseInit() {}
  139.  
  140.