Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ttyio.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. Copyright (c) 1990-2004 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2000-Apr-09 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. /*
  9. ttyio.h
  10. */
  11. #ifndef __ttyio_h /* don't include more than once */
  12. #define __ttyio_h
  13. #ifndef __crypt_h
  14. # include "crypt.h" /* ensure that encryption header file has been seen */
  15. #endif
  16. #if (CRYPT || (defined(UNZIP) && !defined(FUNZIP)))
  17. /*
  18. * Non-echo keyboard/console input support is needed and enabled.
  19. */
  20. #ifndef __G /* UnZip only, for now (DLL stuff) */
  21. # define __G
  22. # define __G__
  23. # define __GDEF
  24. # define __GPRO void
  25. # define __GPRO__
  26. #endif
  27. #ifndef ZCONST /* UnZip only (until have configure script like Zip) */
  28. # define ZCONST const
  29. #endif
  30. #if (defined(MSDOS) || defined(OS2) || defined(WIN32))
  31. # ifndef DOS_OS2_W32
  32. # define DOS_OS2_W32
  33. # endif
  34. #endif
  35. #if (defined(DOS_OS2_W32) || defined(__human68k__))
  36. # ifndef DOS_H68_OS2_W32
  37. # define DOS_H68_OS2_W32
  38. # endif
  39. #endif
  40. #if (defined(DOS_OS2_W32) || defined(FLEXOS))
  41. # ifndef DOS_FLX_OS2_W32
  42. # define DOS_FLX_OS2_W32
  43. # endif
  44. #endif
  45. #if (defined(DOS_H68_OS2_W32) || defined(FLEXOS))
  46. # ifndef DOS_FLX_H68_OS2_W32
  47. # define DOS_FLX_H68_OS2_W32
  48. # endif
  49. #endif
  50. #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
  51. # ifndef ATH_BEO_UNX
  52. # define ATH_BEO_UNX
  53. # endif
  54. #endif
  55. #if (defined(VM_CMS) || defined(MVS))
  56. # ifndef CMS_MVS
  57. # define CMS_MVS
  58. # endif
  59. #endif
  60. /* Function prototypes */
  61. /* The following systems supply a `non-echo' character input function "getch()"
  62. * (or an alias) and do not need the echoff() / echon() function pair.
  63. */
  64. #ifdef AMIGA
  65. # define echoff(f)
  66. # define echon()
  67. # define getch() Agetch()
  68. # define HAVE_WORKING_GETCH
  69. #endif /* AMIGA */
  70. #ifdef ATARI
  71. # define echoff(f)
  72. # define echon()
  73. # include <osbind.h>
  74. # define getch() (Cnecin() & 0x000000ff)
  75. # define HAVE_WORKING_GETCH
  76. #endif
  77. #ifdef MACOS
  78. # define echoff(f)
  79. # define echon()
  80. # define getch() macgetch()
  81. # define HAVE_WORKING_GETCH
  82. #endif
  83. #ifdef NLM
  84. # define echoff(f)
  85. # define echon()
  86. # define HAVE_WORKING_GETCH
  87. #endif
  88. #ifdef QDOS
  89. # define echoff(f)
  90. # define echon()
  91. # define HAVE_WORKING_GETCH
  92. #endif
  93. #ifdef RISCOS
  94. # define echoff(f)
  95. # define echon()
  96. # define getch() SWI_OS_ReadC()
  97. # define HAVE_WORKING_GETCH
  98. #endif
  99. #ifdef DOS_H68_OS2_W32
  100. # define echoff(f)
  101. # define echon()
  102. # ifdef WIN32
  103. # ifndef getch
  104. # define getch() getch_win32()
  105. # endif
  106. # else /* !WIN32 */
  107. # ifdef __EMX__
  108. # ifndef getch
  109. # define getch() _read_kbd(0, 1, 0)
  110. # endif
  111. # else /* !__EMX__ */
  112. # ifdef __GO32__
  113. # include <pc.h>
  114. # define getch() getkey()
  115. # else /* !__GO32__ */
  116. # include <conio.h>
  117. # endif /* ?__GO32__ */
  118. # endif /* ?__EMX__ */
  119. # endif /* ?WIN32 */
  120. # define HAVE_WORKING_GETCH
  121. #endif /* DOS_H68_OS2_W32 */
  122. #ifdef FLEXOS
  123. # define echoff(f)
  124. # define echon()
  125. # define getch() getchar() /* not correct, but may not be on a console */
  126. # define HAVE_WORKING_GETCH
  127. #endif
  128. /* For VM/CMS and MVS, we do not (yet) have any support to switch terminal
  129. * input echo on and off. The following "fake" definitions allow inclusion
  130. * of crypt support and UnZip's "pause prompting" features, but without
  131. * any echo suppression.
  132. */
  133. #ifdef CMS_MVS
  134. # define echoff(f)
  135. # define echon()
  136. #endif
  137. #ifdef TANDEM
  138. # define echoff(f)
  139. # define echon()
  140. # define getch() zgetch() /* defined in TANDEMC */
  141. # define HAVE_WORKING_GETCH
  142. #endif
  143. /* The THEOS C runtime library supplies the function conmask() to toggle
  144. * terminal input echo on (conmask("e")) and off (conmask("n")). But,
  145. * since THEOS C RTL also contains a working non-echo getch() function,
  146. * the echo toggles are not needed.
  147. */
  148. #ifdef THEOS
  149. # define echoff(f)
  150. # define echon()
  151. # define HAVE_WORKING_GETCH
  152. #endif
  153. /* VMS has a single echo() function in ttyio.c to toggle terminal
  154. * input echo on and off.
  155. */
  156. #ifdef VMS
  157. # define echoff(f) echo(0)
  158. # define echon() echo(1)
  159. # define getch() tt_getch()
  160. # define FGETCH(f) tt_getch()
  161. int echo OF((int));
  162. int tt_getch OF((void));
  163. #endif
  164. /* For all other systems, ttyio.c supplies the two functions Echoff() and
  165. * Echon() for suppressing and (re)enabling console input echo.
  166. */
  167. #ifndef echoff
  168. # define echoff(f) Echoff(__G__ f)
  169. # define echon() Echon(__G)
  170. void Echoff OF((__GPRO__ int f));
  171. void Echon OF((__GPRO));
  172. #endif
  173. /* this stuff is used by MORE and also now by the ctrl-S code; fileio.c only */
  174. #if (defined(UNZIP) && !defined(FUNZIP))
  175. # ifdef HAVE_WORKING_GETCH
  176. # define FGETCH(f) getch()
  177. # endif
  178. # ifndef FGETCH
  179. /* default for all systems where no getch()-like function is available */
  180. int zgetch OF((__GPRO__ int f));
  181. # define FGETCH(f) zgetch(__G__ f)
  182. # endif
  183. #endif /* UNZIP && !FUNZIP */
  184. #if (CRYPT && !defined(WINDLL))
  185. char *getp OF((__GPRO__ ZCONST char *m, char *p, int n));
  186. #endif
  187. #else /* !(CRYPT || (UNZIP && !FUNZIP)) */
  188. /*
  189. * No need for non-echo keyboard/console input; provide dummy definitions.
  190. */
  191. #define echoff(f)
  192. #define echon()
  193. #endif /* ?(CRYPT || (UNZIP && !FUNZIP)) */
  194. #endif /* !__ttyio_h */