ncurses.pp 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Michael Van Canneyt
  4. member of the Free Pascal development team
  5. Unit to access the ncurses library
  6. See the file COPYING.FPC included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$mode objfpc}
  13. {
  14. Many thanks to Ken Wright for his patches !
  15. }
  16. unit ncurses;
  17. interface
  18. {$packrecords C}
  19. {$ifdef OpenBSD} // openbsd curses=ncurses. Openbsd ocurses=old curses.
  20. {$linklib curses}
  21. {$else}
  22. {$linklib ncurses}
  23. {$endif}
  24. {$linklib c}
  25. { Manually Added types }
  26. type
  27. Bool = byte;
  28. PINTEGER = ^Longint;
  29. PLongint = ^ longint;
  30. PFILE = pointer;
  31. const
  32. {$ifndef openbsd}
  33. libncurses = 'ncurses';
  34. {$else openbsd}
  35. libncurses = 'curses';
  36. {$endif openbsd}
  37. NCURSES_VERSION_MAJOR = 5;
  38. NCURSES_VERSION_MINOR = 0;
  39. NCURSES_VERSION_PATCH = 19991023;
  40. NCURSES_VERSION = '5.0';
  41. type
  42. chtype = longint;
  43. pchtype = pchar;
  44. const
  45. CXX_BUILTIN_BOOL = 1;
  46. type
  47. CXX_TYPE_OF_BOOL = char;
  48. var
  49. {$ifndef darwin}
  50. COLORS : longint; cvar; external;
  51. COLOR_PAIRS : longint; cvar; external;
  52. {$else darwin}
  53. COLORS : longint; external libncurses name 'COLORS';
  54. COLOR_PAIRS : longint; external libncurses name 'COLOR_PAIRS';
  55. {$endif darwin}
  56. const
  57. COLOR_BLACK = 0;
  58. COLOR_RED = 1;
  59. COLOR_GREEN = 2;
  60. COLOR_YELLOW = 3;
  61. COLOR_BLUE = 4;
  62. COLOR_MAGENTA = 5;
  63. COLOR_CYAN = 6;
  64. COLOR_WHITE = 7;
  65. type
  66. tacs_map = array [char] of chtype;
  67. pacs_map = ^tacs_map;
  68. var
  69. {$ifndef darwin}
  70. acs_map : tacs_map; cvar; external;
  71. {$else darwin}
  72. acs_map : tacs_map; external libncurses name 'acs_map';
  73. {$endif darwin}
  74. function ACS_ULCORNER : chtype;
  75. function ACS_LLCORNER : chtype;
  76. function ACS_URCORNER : chtype;
  77. function ACS_LRCORNER : chtype;
  78. function ACS_LTEE : chtype;
  79. function ACS_RTEE : chtype;
  80. function ACS_BTEE : chtype;
  81. function ACS_TTEE : chtype;
  82. function ACS_HLINE : chtype;
  83. function ACS_VLINE : chtype;
  84. function ACS_PLUS : chtype;
  85. function ACS_S1 : chtype;
  86. function ACS_S9 : chtype;
  87. function ACS_DIAMOND : chtype;
  88. function ACS_CKBOARD : chtype;
  89. function ACS_DEGREE : chtype;
  90. function ACS_PLMINUS : chtype;
  91. function ACS_BULLET : chtype;
  92. function ACS_LARROW : chtype;
  93. function ACS_RARROW : chtype;
  94. function ACS_DARROW : chtype;
  95. function ACS_UARROW : chtype;
  96. function ACS_BOARD : chtype;
  97. function ACS_LANTERN : chtype;
  98. function ACS_BLOCK : chtype;
  99. function ACS_S3 : chtype;
  100. function ACS_S7 : chtype;
  101. function ACS_LEQUAL : chtype;
  102. function ACS_GEQUAL : chtype;
  103. function ACS_PI : chtype;
  104. function ACS_NEQUAL : chtype;
  105. function ACS_STERLING : chtype;
  106. {
  107. Line drawing ACS names are of the form ACS_trbl, where t is the top, r
  108. is the right, b is the bottom, and l is the left. t, r, b, and l might
  109. be B (blank), S (single), D (double), or T (thick). The subset defined
  110. here only uses B and S.
  111. }
  112. {
  113. #define ACS_BSSB ACS_ULCORNER
  114. #define ACS_SSBB ACS_LLCORNER
  115. #define ACS_BBSS ACS_URCORNER
  116. #define ACS_SBBS ACS_LRCORNER
  117. #define ACS_SBSS ACS_RTEE
  118. #define ACS_SSSB ACS_LTEE
  119. #define ACS_SSBS ACS_BTEE
  120. #define ACS_BSSS ACS_TTEE
  121. #define ACS_BSBS ACS_HLINE
  122. #define ACS_SBSB ACS_VLINE
  123. #define ACS_SSSS ACS_PLUS
  124. }
  125. const
  126. ERR = -(1);
  127. OK = 0;
  128. _SUBWIN = $01;
  129. _ENDLINE = $02;
  130. _FULLWIN = $04;
  131. _SCROLLWIN = $08;
  132. _ISPAD = $10;
  133. _HASMOVED = $20;
  134. _WRAPPED = $40;
  135. {
  136. this value is used in the firstchar and lastchar fields to mark
  137. unchanged lines
  138. }
  139. _NOCHANGE = -(1);
  140. {
  141. this value is used in the oldindex field to mark lines created by insertions
  142. and scrolls.
  143. }
  144. _NEWINDEX = -(1);
  145. {
  146. typedef struct screen SCREEN;
  147. typedef struct _win_st WINDOW;
  148. }
  149. type
  150. attr_t = chtype;
  151. ldat = record
  152. text : ^chtype;
  153. firstchar : integer;
  154. lastchar : integer;
  155. oldindex : integer;
  156. end;
  157. _win_st = record
  158. _cury : integer;
  159. _curx : integer;
  160. _maxy : integer;
  161. _maxx : integer;
  162. _begy : integer;
  163. _begx : integer;
  164. _flags : integer;
  165. _attrs : attr_t;
  166. _bkgd : chtype;
  167. _notimeout : bool;
  168. _clear : bool;
  169. _leaveok : bool;
  170. _scroll : bool;
  171. _idlok : bool;
  172. _idcok : bool;
  173. _immed : bool;
  174. _sync : bool;
  175. _use_keypad : bool;
  176. _delay : longint;
  177. _line : ^ldat;
  178. _regtop : integer;
  179. _regbottom : integer;
  180. _parx : longint;
  181. _pary : longint;
  182. _parent : ^WINDOW;
  183. _pad : record
  184. _pad_y : integer;
  185. _pad_x : integer;
  186. _pad_top : integer;
  187. _pad_left : integer;
  188. _pad_bottom : integer;
  189. _pad_right : integer;
  190. end;
  191. _yoffset : integer;
  192. end;
  193. WINDOW = _win_st;
  194. PWINDOW = ^WINDOW;
  195. SCREEN=WINDOW;
  196. PSCREEN = PWINDOW;
  197. var
  198. {$ifndef darwin}
  199. stdscr : PWINDOW; cvar; external;
  200. curscr : PWINDOW; cvar; external;
  201. newscr : PWINDOW; cvar; external;
  202. LINES : longint; cvar; external;
  203. COLS : longint; cvar; external;
  204. TABSIZE : longint; cvar; external;
  205. ESCDELAY: longint; cvar; external;
  206. {$else darwin}
  207. stdscr : PWINDOW; external libncurses name 'stdscr';
  208. curscr : PWINDOW; external libncurses name 'curscr';
  209. newscr : PWINDOW; external libncurses name 'newscr';
  210. LINES : longint; external libncurses name 'LINES';
  211. COLS : longint; external libncurses name 'COLS';
  212. TABSIZE : longint; external libncurses name 'TABSIZE';
  213. ESCDELAY: longint; external libncurses name 'ESCDELAY';
  214. {$endif darwin}
  215. function define_key(_para1:pchar; _para2:longint):longint; cdecl;external libncurses;
  216. function keyok(_para1:longint; _para2:bool):longint; cdecl;external libncurses;
  217. function resizeterm(_para1:longint; _para2:longint):longint; cdecl;external libncurses;
  218. function use_default_colors:longint; cdecl;external libncurses;
  219. function wresize(_para1:pWINDOW; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  220. {
  221. extern char ttytype[];
  222. }
  223. function baudrate:longint; cdecl;external libncurses;
  224. function beep:longint; cdecl;external libncurses;
  225. function can_change_color:bool; cdecl;external libncurses;
  226. function cbreak:longint; cdecl;external libncurses;
  227. function clearok(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  228. function color_content(_para1:longint; _para2:plongint; _para3:plongint; _para4:plongint):longint; cdecl;external libncurses;
  229. function copywin(_para1:pWINDOW; _para2:pWINDOW; _para3:longint; _para4:longint; _para5:longint;
  230. _para6:longint; _para7:longint; _para8:longint; _para9:longint):longint;cdecl;external libncurses;
  231. function curs_set(_para1:longint):longint; cdecl;external libncurses;
  232. function def_prog_mode:longint; cdecl;external libncurses;
  233. function def_shell_mode:longint; cdecl;external libncurses;
  234. function delay_output(_para1:longint):longint; cdecl;external libncurses;
  235. procedure delscreen(_para1:pSCREEN);cdecl;external libncurses;
  236. function delwin(_para1:pWINDOW):longint; cdecl;external libncurses;
  237. function doupdate:longint; cdecl;external libncurses;
  238. function echo:longint; cdecl;external libncurses;
  239. function endwin:longint; cdecl;external libncurses;
  240. function erasechar:char; cdecl;external libncurses;
  241. procedure filter;cdecl;external libncurses;
  242. function flash:longint; cdecl;external libncurses;
  243. function flushinp:longint; cdecl;external libncurses;
  244. function halfdelay(_para1:longint):longint; cdecl;external libncurses;
  245. function has_colors:bool; cdecl;external libncurses;
  246. function has_ic:longint; cdecl;external libncurses;
  247. function has_il:longint; cdecl;external libncurses;
  248. procedure idcok(_para1:pWINDOW; _para2:bool);cdecl;external libncurses;
  249. function idlok(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  250. procedure immedok(_para1:pWINDOW; _para2:bool);cdecl;external libncurses;
  251. function init_color(_para1:longint; _para2:longint; _para3:longint; _para4:longint):longint; cdecl;external libncurses;
  252. function init_pair(_para1:longint; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  253. function intrflush(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  254. function isendwin:longint; cdecl;external libncurses;
  255. function is_linetouched(_para1:pWINDOW; _para2:longint):longint; cdecl;external libncurses;
  256. function is_wintouched(_para1:pWINDOW):longint; cdecl;external libncurses;
  257. function keypad(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  258. function killchar:char; cdecl;external libncurses;
  259. function leaveok(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  260. function meta(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  261. function mvcur(_para1:longint; _para2:longint; _para3:longint; _para4:longint):longint; cdecl;external libncurses;
  262. function mvderwin(_para1:pWINDOW; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  263. function mvprintw(_para1:longint;_para2:longint;_para3:pchar;_para4:array of const):longint; cdecl;external libncurses;
  264. {
  265. extern int mvscanw(int,int,const char ,...)
  266. GCC_SCANFLIKE(3,4);
  267. }
  268. function mvwin(_para1:pWINDOW; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  269. function mvwprintw(_para1:pWINDOW;_para2,_para3:longint;_para4:pchar;_para5:array of const):longint; cdecl;external libncurses;
  270. {
  271. extern int mvwprintw(WINDOW ,int,int,const char ,...)
  272. GCC_PRINTFLIKE(4,5);
  273. extern int mvwscanw(WINDOW ,int,int,const char ,...)
  274. GCC_SCANFLIKE(4,5);
  275. }
  276. function napms(_para1:longint):longint; cdecl;external libncurses;
  277. function nl:longint; cdecl;external libncurses;
  278. function nocbreak:longint; cdecl;external libncurses;
  279. function nodelay(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  280. function noecho:longint; cdecl;external libncurses;
  281. function nonl:longint; cdecl;external libncurses;
  282. function noqiflush:longint; cdecl;external libncurses;
  283. function noraw:longint; cdecl;external libncurses;
  284. function notimeout(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  285. function overlay(_para1:pWINDOW; _para2:pWINDOW):longint; cdecl;external libncurses;
  286. function overwrite(_para1:pWINDOW; _para2:pWINDOW):longint; cdecl;external libncurses;
  287. function pair_content(_para1:longint; _para2:plongint; _para3:plongint):longint; cdecl;external libncurses;
  288. function pechochar(_para1:pWINDOW; _para2:chtype):longint; cdecl;external libncurses;
  289. function pnoutrefresh(_para1:pWINDOW; _para2:longint; _para3:longint; _para4:longint; _para5:longint;
  290. _para6:longint; _para7:longint):longint;cdecl;external libncurses;
  291. function prefresh(_para1:pWINDOW; _para2:longint; _para3:longint; _para4:longint; _para5:longint;
  292. _para6:longint; _para7:longint):longint;cdecl;external libncurses;
  293. {
  294. extern int printw(const char ,...)
  295. GCC_PRINTFLIKE(1,2);
  296. }
  297. function putp(_para1:pchar):longint; cdecl;external libncurses;
  298. function putwin(_para1:pWINDOW; _para2:pFILE):longint; cdecl;external libncurses;
  299. function qiflush:longint; cdecl;external libncurses;
  300. function raw:longint; cdecl;external libncurses;
  301. function resetty:longint; cdecl;external libncurses;
  302. function reset_prog_mode:longint; cdecl;external libncurses;
  303. function reset_shell_mode:longint; cdecl;external libncurses;
  304. {
  305. function ripoffline(_para1:longint; init:function (_para1:pWINDOW; _para2:longint):longint):longint; cdecl;external libncurses;
  306. }
  307. function savetty:longint; cdecl;external libncurses;
  308. {
  309. extern int scanw(const char ,...)
  310. GCC_SCANFLIKE(1,2);
  311. }
  312. function scr_dump(_para1:pchar):longint; cdecl;external libncurses;
  313. function scr_init(_para1:pchar):longint; cdecl;external libncurses;
  314. function scrollok(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  315. function scr_restore(_para1:pchar):longint; cdecl;external libncurses;
  316. function scr_set(_para1:pchar):longint; cdecl;external libncurses;
  317. function slk_attroff(_para1:attr_t):longint; cdecl;external libncurses;
  318. function slk_attron(_para1:attr_t):longint; cdecl;external libncurses;
  319. function slk_attrset(_para1:attr_t):longint; cdecl;external libncurses;
  320. function slk_attr:attr_t; cdecl;external libncurses;
  321. function slk_clear:longint; cdecl;external libncurses;
  322. function slk_init(_para1:longint):longint; cdecl;external libncurses;
  323. function slk_noutrefresh:longint; cdecl;external libncurses;
  324. function slk_refresh:longint; cdecl;external libncurses;
  325. function slk_restore:longint; cdecl;external libncurses;
  326. function slk_set(_para1:longint; _para2:pchar; _para3:longint):longint; cdecl;external libncurses;
  327. function slk_touch:longint; cdecl;external libncurses;
  328. function start_color:longint; cdecl;external libncurses;
  329. function syncok(_para1:pWINDOW; _para2:bool):longint; cdecl;external libncurses;
  330. function termattrs:chtype; cdecl;external libncurses;
  331. function tigetflag(_para1:pchar):longint; cdecl;external libncurses;
  332. function tigetnum(_para1:pchar):longint; cdecl;external libncurses;
  333. function derwin (_para1:pWINDOW; _para2:longint; _para3:longint; _para4:longint; _para5:longint):PWINDOW; cdecl;external libncurses;
  334. function dupwin (_para1:pWINDOW):PWINDOW; cdecl;external libncurses;
  335. function getwin (_para1:pFILE):PWINDOW; cdecl;external libncurses;
  336. function initscr :PWINDOW; cdecl;external libncurses;
  337. function keyname (_para1:longint):pchar; cdecl;external libncurses;
  338. function longname :pchar; cdecl;external libncurses;
  339. function newpad (_para1:longint; _para2:longint):PWINDOW; cdecl;external libncurses;
  340. function newterm (_para1:pchar; _para2:pFILE; _para3:pFILE):PSCREEN; cdecl;external libncurses;
  341. function newwin (_para1:longint; _para2:longint; _para3:longint; _para4:longint):PWINDOW; cdecl;external libncurses;
  342. function set_term (_para1:pSCREEN):PSCREEN; cdecl;external libncurses;
  343. function slk_label (_para1:longint):pchar; cdecl;external libncurses;
  344. function subpad (_para1:pWINDOW; _para2:longint; _para3:longint; _para4:longint; _para5:longint):PWINDOW; cdecl;external libncurses;
  345. function subwin (_para1:pWINDOW; _para2:longint; _para3:longint; _para4:longint; _para5:longint):PWINDOW; cdecl;external libncurses;
  346. function termname :pchar; cdecl;external libncurses;
  347. function tigetstr (_para1:pchar):pchar; cdecl;external libncurses;
  348. function typeahead(_para1:longint):longint; cdecl;external libncurses;
  349. function ungetch(_para1:longint):longint; cdecl;external libncurses;
  350. procedure use_env(_para1:bool);cdecl;external libncurses;
  351. function vidattr(_para1:chtype):longint; cdecl;external libncurses;
  352. {
  353. function vidputs(_para1:chtype; _para2:function (_para1:longint):longint):longint; cdecl;external libncurses;
  354. }
  355. {
  356. function vwprintw(_para1:pWINDOW; _para2:pchar; _para3:va_list):longint; cdecl;external libncurses;
  357. function vwscanw(_para1:pWINDOW; _para2:pchar; _para3:va_list):longint; cdecl;external libncurses;
  358. }
  359. function waddch(_para1:pWINDOW; _para2:chtype):longint; cdecl;external libncurses;
  360. function waddchnstr(_para1:pWINDOW; _para2:pchtype; _para3:longint):longint; cdecl;external libncurses;
  361. function waddnstr(_para1:pWINDOW; _para2:pchar; _para3:longint):longint; cdecl;external libncurses;
  362. function wattr_on(_para1:pWINDOW; _para2:attr_t):longint; cdecl;external libncurses;
  363. function wattr_off(_para1:pWINDOW; _para2:attr_t):longint; cdecl;external libncurses;
  364. function wattr_set(win : pwindow; at : longint) : longint; cdecl;external libncurses;
  365. function wattron(win : pwindow;at : longint) : longint; cdecl;external libncurses;
  366. function wattroff(win : pwindow;at : longint) : longint; cdecl;external libncurses;
  367. function wattrset(win : pwindow;at : longint) : longint; cdecl;external libncurses;
  368. function wbkgd(_para1:pWINDOW; _para2:chtype):longint; cdecl;external libncurses;
  369. procedure wbkgdset(_para1:pWINDOW; _para2:chtype);cdecl;external libncurses;
  370. function wborder(_para1:pWINDOW; _para2:chtype; _para3:chtype; _para4:chtype; _para5:chtype;
  371. _para6:chtype; _para7:chtype; _para8:chtype; _para9:chtype):longint;cdecl;external libncurses;
  372. function wchgat(_para1:pWINDOW; _para2:longint; _para3:attr_t; _para4:longint; _para5:pointer):longint; cdecl;external libncurses;
  373. function wclear(_para1:pWINDOW):longint; cdecl;external libncurses;
  374. function wclrtobot(_para1:pWINDOW):longint; cdecl;external libncurses;
  375. function wclrtoeol(_para1:pWINDOW):longint; cdecl;external libncurses;
  376. procedure wcursyncup(_para1:pWINDOW);cdecl;external libncurses;
  377. function wdelch(_para1:pWINDOW):longint; cdecl;external libncurses;
  378. function wechochar(_para1:pWINDOW; _para2:chtype):longint; cdecl;external libncurses;
  379. function werase(_para1:pWINDOW):longint; cdecl;external libncurses;
  380. function wgetch(_para1:pWINDOW):longint; cdecl;external libncurses;
  381. function wgetnstr(_para1:pWINDOW; _para2:pchar; _para3:longint):longint; cdecl;external libncurses;
  382. function whline(_para1:pWINDOW; _para2:chtype; _para3:longint):longint; cdecl;external libncurses;
  383. function winch (win : PWindow) : longint; cdecl;external libncurses;
  384. function winchnstr(_para1:pWINDOW; _para2:pchtype; _para3:longint):longint; cdecl;external libncurses;
  385. function winnstr(_para1:pWINDOW; _para2:pchar; _para3:longint):longint; cdecl;external libncurses;
  386. function winsch(_para1:pWINDOW; _para2:chtype):longint; cdecl;external libncurses;
  387. function winsdelln(_para1:pWINDOW; _para2:longint):longint; cdecl;external libncurses;
  388. function winsnstr(_para1:pWINDOW; _para2:pchar; _para3:longint):longint; cdecl;external libncurses;
  389. function wmove(_para1:pWINDOW; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  390. function wnoutrefresh(_para1:pWINDOW):longint; cdecl;external libncurses;
  391. {
  392. extern int wprintw(WINDOW ,const char ,...)
  393. GCC_PRINTFLIKE(2,3);
  394. }
  395. function wredrawln(_para1:pWINDOW; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  396. function wrefresh(_para1:pWINDOW):longint; cdecl;external libncurses;
  397. {
  398. extern int wscanw(WINDOW ,const char ,...)
  399. GCC_SCANFLIKE(2,3);
  400. }
  401. function wscrl(_para1:pWINDOW; _para2:longint):longint; cdecl;external libncurses;
  402. function wsetscrreg(_para1:pWINDOW; _para2:longint; _para3:longint):longint; cdecl;external libncurses;
  403. procedure wsyncdown(_para1:pWINDOW);cdecl;external libncurses;
  404. procedure wsyncup(_para1:pWINDOW);cdecl;external libncurses;
  405. function wtimeout(_para1:pWINDOW; _para2:longint):longint; cdecl;external libncurses;
  406. function wtouchln(_para1:pWINDOW; _para2:longint; _para3:longint; _para4:longint):longint; cdecl;external libncurses;
  407. function wvline(_para1:pWINDOW; _para2:chtype; _para3:longint):longint; cdecl;external libncurses;
  408. function mvwchgat(_para1:pWINDOW; _para2:longint; _para3:longint;
  409. _para4:longint; _para5:longint; _para6:longint;
  410. _para7:longint):longint;cdecl;external libncurses;
  411. function PAIR_NUMBER(_para1:longint):longint;cdecl;external libncurses;
  412. const
  413. A_NORMAL = 0;
  414. A_ATTRIBUTES = (not 0) shl 8;
  415. A_CHARTEXT=(1 shl (0 + 8)) - 1;
  416. A_COLOR=((1 shl 8) - 1) shl 8;
  417. A_STANDOUT = 1 shl (8 + 8);
  418. A_UNDERLINE = 1 shl (9 + 8);
  419. A_REVERSE = 1 shl (10 + 8);
  420. A_BLINK = 1 shl (11 + 8);
  421. A_DIM = 1 shl (12 + 8);
  422. A_BOLD = 1 shl (13 + 8);
  423. A_ALTCHARSET = 1 shl (14 + 8);
  424. A_INVIS = 1 shl (15 + 8);
  425. A_PROTECT = 1 shl (16 + 8);
  426. A_HORIZONTAL = 1 shl (17 + 8);
  427. A_LEFT = 1 shl (18 + 8);
  428. A_LOW = 1 shl (19 + 8);
  429. A_RIGHT = 1 shl (20 + 8);
  430. A_TOP = 1 shl (21 + 8);
  431. A_VERTICAL = 1 shl (22 + 8);
  432. function color_pair(n : longint): longint;
  433. {
  434. PAIR_NUMBER = (a(@(A_COLOR))) shr 8;
  435. }
  436. {
  437. pseudo functions
  438. }
  439. function wgetstr(w : pwindow;s : pchar) : longint;
  440. function getnstr(s : pchar;n : longint) : longint;
  441. function setterm(term : longint) : longint;
  442. function fixterm : longint;
  443. function resetterm : longint;
  444. function saveterm : longint;
  445. function crmode : longint;
  446. function nocrmode : longint;
  447. procedure getyx (win : pwindow; var y,x : longint);
  448. procedure getbegyx(win : pwindow; var y,x : longint);
  449. procedure getmaxyx(win : pwindow; var y,x : longint);
  450. procedure getparyx(win : pwindow; var y,x : longint);
  451. procedure getsyx (var y,x : longint);
  452. procedure setsyx (y,x : longint);
  453. function getattrs(win : pwindow) : longint;
  454. function getcurx(win : pwindow) : longint;
  455. function getcury(win : pwindow) : longint;
  456. function getbegx(win : pwindow) : longint;
  457. function getbegy(win : pwindow) : longint;
  458. function getmaxx(win : pwindow) : longint;
  459. function getmaxy(win : pwindow) : longint;
  460. function getparx(win : pwindow) : longint;
  461. function getpary(win : pwindow) : longint;
  462. function wstandout(win : pwindow) : longint;
  463. function wstandend(win : pwindow) : longint;
  464. {kjw, 08/24/2000, changed to cdecl; external
  465. function wattr_set(win : pwindow; at : longint) : longint;
  466. function wattron(win : pwindow;at : longint) : longint;
  467. function wattroff(win : pwindow;at : longint) : longint;
  468. function wattrset(win : pwindow;at : longint) : longint;
  469. }
  470. function scroll(win : pwindow) : longint;
  471. function touchwin(win : pwindow) : longint;
  472. function touchline(win : pwindow;s,c : longint) : longint;
  473. function untouchwin(win : pwindow) : longint;
  474. function box(win : pwindow;v,h : longint) : longint;
  475. function border(ls,rs,ts,bs,tl,tr,bl,br : longint) : longint;
  476. function hline(ch,n : longint) : longint;
  477. function vline(ch,n : longint) : longint;
  478. function winstr(w : pwindow;s : pchar) : longint;
  479. function winchstr(w : pwindow;s : pchar) : longint;
  480. function winsstr(w : pwindow;s : pchar) : longint;
  481. function redrawwin(w : pwindow) : longint;
  482. function waddstr(win : pwindow;st : pchar) : longint;
  483. function waddchstr(win : pwindow;st : pchar) : longint;
  484. {
  485. pseudo functions for standard screen
  486. }
  487. function addch(ch : longint) : longint;
  488. function addchnstr(st : pchar;n : longint) : longint;
  489. function addchstr(st : pchar) : longint;
  490. function addnstr(st : pchar;n : longint) : longint;
  491. function addstr(st : pchar) : longint;
  492. function attroff(at : longint) : longint;
  493. function attron(at : longint) : longint;
  494. function attrset(at : longint) : longint;
  495. function bkgd(ch : longint) : longint;
  496. procedure bkgdset(ch : longint);
  497. function clear : longint;
  498. function clrtobot : longint;
  499. function clrtoeol : longint;
  500. function delch : longint;
  501. function deleteln : longint;
  502. function echochar(c : longint) : longint;
  503. function erase : longint;
  504. function getch : longint;
  505. function getstr(st : pchar) : longint;
  506. function inch : longint;
  507. function inchnstr(s : pchar;n : longint) : longint;
  508. function inchstr(s : pchar) : longint;
  509. function innstr(s : pchar;n : longint) : longint;
  510. function insch(c : longint) : longint;
  511. function insdelln(n : longint) : longint;
  512. function insertln : longint;
  513. function insnstr(s : pchar;n : longint) : longint;
  514. function insstr(s : pchar) : longint;
  515. function instr(s : pchar) : longint;
  516. function move(y,x : longint) : longint;
  517. function refresh : longint;
  518. function scrl(n : longint) : longint;
  519. function setscrreg(t,b : longint) : longint;
  520. function standend : longint;
  521. function standout : longint;
  522. function timeout(delay : longint) : longint;
  523. function wdeleteln(win : pwindow) : longint;
  524. function winsertln(win : pwindow) : longint;
  525. {
  526. mv functions
  527. }
  528. function mvwaddch(win : pwindow;y,x : longint; ch : chtype) : longint;
  529. function mvwaddchnstr(win : pwindow;y,x : longint;st : pchar;n : longint) : longint;
  530. function mvwaddchstr(win : pwindow;y,x : longint;st : pchar) : longint;
  531. function mvwaddnstr(win : pwindow;y,x : longint;st : pchar;n : longint) : longint;
  532. function mvwaddstr(win : pwindow;y,x : longint;st : pchar) : longint;
  533. function mvwdelch(win : pwindow;y,x : longint) : longint;
  534. function mvwgetch(win : pwindow;y,x : longint) : longint;
  535. function mvwgetnstr(win : pwindow;y,x : longint;st : pchar;n: longint) : longint;
  536. function mvwgetstr(win : pwindow;y,x : longint;st: pchar) : longint;
  537. function mvwhline(win : pwindow;y,x : longint;c : chtype;n : longint) : longint;
  538. function mvwinch(win : pwindow;y,x : longint) : longint;
  539. function mvwinchnstr(win : pwindow;y,x : longint;s : pchar; n : longint) : longint;
  540. function mvwinchstr(win : pwindow;y,x : longint;s : pchar) : longint;
  541. function mvwinnstr(win : pwindow;y,x : longint;s : pchar;n : longint) : longint;
  542. function mvwinsch(win : pwindow;y,x : longint;c : chtype) : longint;
  543. function mvwinsnstr(win : pwindow;y,x : longint;s : pchar;n : longint) : longint;
  544. function mvwinsstr(win : pwindow;y,x : longint;s : pchar) : longint;
  545. function mvwinstr(win : pwindow;y,x : longint;s : pchar) : longint;
  546. function mvwvline(win : pwindow;y,x : longint;c : chtype;n : longint) : longint;
  547. function mvaddch(y,x,ch : longint) : longint;
  548. function mvaddchnstr(y,x : longint; st: pchar;n : longint) : longint;
  549. function mvaddchstr(y,x : longint; st : pchar) : longint;
  550. function mvaddnstr(y,x : longint; st : pchar;n : longint) : longint;
  551. function mvaddstr(y,x : longint; st : pchar) : longint;
  552. function mvdelch(y,x : longint) : longint;
  553. function mvgetch(y,x : longint) : longint;
  554. function mvgetnstr(y,x : longint; st : pchar;n : longint) : longint;
  555. function mvgetstr(y,x : longint; st : pchar) : longint;
  556. function mvhline(y,x : longint;c : chtype;n : longint) : longint;
  557. function mvinch(y,x : longint) : longint;
  558. function mvinchnstr(y,x : longint; s : pchar;n : longint) : longint;
  559. function mvinchstr(y,x : longint; s : pchar) : longint;
  560. function mvinnstr(y,x : longint; s : pchar;n : longint) : longint;
  561. function mvinsch(y,x: longint;c : chtype) : longint;
  562. function mvinsnstr(y,x : longint; s : pchar;n : longint) : longint;
  563. function mvinsstr(y,x : longint; s : pchar) : longint;
  564. function mvinstr(y,x : longint; s : pchar) : longint;
  565. function mvvline(y,x,c,n : longint) : longint;
  566. function attr_get : longint;
  567. function attr_off(a : longint) : longint;
  568. function attr_on(a : longint) : longint;
  569. function attr_set(a : longint) : longint;
  570. function chgat(n,a,c,o : longint) : longint;
  571. function getbkgd(win : pwindow) : longint;
  572. function slk_attr_off(a : longint) : longint;
  573. function slk_attr_on(a : longint) : longint;
  574. function slk_attr_set(a : longint) : longint;
  575. function vid_attr(a : longint) : longint;
  576. function wattr_get(win : pwindow) : longint;
  577. {
  578. Pseudo-character tokens outside ASCII range. The curses wgetch() function
  579. will return any given one of these only if the corresponding k- capability
  580. is defined in your terminal's terminfo entry.
  581. }
  582. const {octal}
  583. KEY_CODE_YES = 256; {0400}
  584. KEY_MIN = 257; {0401}
  585. KEY_BREAK = 257; {0401}
  586. KEY_DOWN = 258; {0402}
  587. KEY_UP = 259; {0403}
  588. KEY_LEFT = 260; {0404}
  589. KEY_RIGHT = 261; {0405}
  590. KEY_HOME = 262; {0406}
  591. KEY_BACKSPACE = 263; {0407}
  592. KEY_F0 = 264; {0410}
  593. function KEY_F(n : longint) : longint;
  594. const
  595. KEY_DL = 328; {0510}
  596. KEY_IL = 329; {0511}
  597. KEY_DC = 330; {0512}
  598. KEY_IC = 331; {0513}
  599. KEY_EIC = 332; {0514}
  600. KEY_CLEAR = 333; {0515}
  601. KEY_EOS = 334; {0516}
  602. KEY_EOL = 335; {0517}
  603. KEY_SF = 336; {0520}
  604. KEY_SR = 337; {0521}
  605. KEY_NPAGE = 338; {0522}
  606. KEY_PPAGE = 339; {0523}
  607. KEY_STAB = 340; {0524}
  608. KEY_CTAB = 341; {0525}
  609. KEY_CATAB = 342; {0526}
  610. KEY_ENTER = 343; {0527}
  611. KEY_SRESET = 344; {0530}
  612. KEY_RESET = 345; {0531}
  613. KEY_PRINT = 346; {0532}
  614. KEY_LL = 347; {0533}
  615. KEY_A1 = 348; {0534}
  616. KEY_A3 = 349; {0535}
  617. KEY_B2 = 350; {0536}
  618. KEY_C1 = 351; {0537}
  619. KEY_C3 = 352; {0540}
  620. KEY_BTAB = 353; {0541}
  621. KEY_BEG = 354; {0542}
  622. KEY_CANCEL = 355; {0543}
  623. KEY_CLOSE = 356; {0544}
  624. KEY_COMMAND = 357; {0545}
  625. KEY_COPY = 358; {0546}
  626. KEY_CREATE = 359; {0547}
  627. KEY_END = 360; {0550}
  628. KEY_EXIT = 361; {0551}
  629. KEY_FIND = 362; {0552}
  630. KEY_HELP = 363; {0553}
  631. KEY_MARK = 364; {0554}
  632. KEY_MESSAGE = 365; {0555}
  633. KEY_MOVE = 366; {0556}
  634. KEY_NEXT = 367; {0557}
  635. KEY_OPEN = 368; {0560}
  636. KEY_OPTIONS = 369; {0561}
  637. KEY_PREVIOUS = 370; {0562}
  638. KEY_REDO = 371; {0563}
  639. KEY_REFERENCE = 372; {0564}
  640. KEY_REFRESH = 373; {0565}
  641. KEY_REPLACE = 374; {0566}
  642. KEY_RESTART = 375; {0567}
  643. KEY_RESUME = 376; {0570}
  644. KEY_SAVE = 377; {0571}
  645. KEY_SBEG = 378; {0572}
  646. KEY_SCANCEL = 379; {0573}
  647. KEY_SCOMMAND = 380; {0574}
  648. KEY_SCOPY = 381; {0575}
  649. KEY_SCREATE = 382; {0576}
  650. KEY_SDC = 383; {0577}
  651. KEY_SDL = 384; {0600}
  652. KEY_SELECT = 385; {0601}
  653. KEY_SEND = 386; {0602}
  654. KEY_SEOL = 387; {0603}
  655. KEY_SEXIT = 388; {0604}
  656. KEY_SFIND = 389; {0605}
  657. KEY_SHELP = 390; {0606}
  658. KEY_SHOME = 391; {0607}
  659. KEY_SIC = 392; {0610}
  660. KEY_SLEFT = 393; {0611}
  661. KEY_SMESSAGE = 394; {0612}
  662. KEY_SMOVE = 395; {0613}
  663. KEY_SNEXT = 396; {0614}
  664. KEY_SOPTIONS = 397; {0615}
  665. KEY_SPREVIOUS = 398; {0616}
  666. KEY_SPRINT = 399; {0617}
  667. KEY_SREDO = 400; {0620}
  668. KEY_SREPLACE = 401; {0621}
  669. KEY_SRIGHT = 402; {0622}
  670. KEY_SRSUME = 403; {0623}
  671. KEY_SSAVE = 404; {0624}
  672. KEY_SSUSPEND = 405; {0625}
  673. KEY_SUNDO = 406; {0626}
  674. KEY_SUSPEND = 407; {0627}
  675. KEY_UNDO = 408; {0630}
  676. KEY_MOUSE = 409; {0631}
  677. KEY_RESIZE = 410; {0632}
  678. KEY_MAX = 511; {0777}
  679. function mcprint(_para1:pchar; _para2:longint):longint;cdecl;external libncurses;
  680. function has_key(_para1:longint):longint;cdecl;external libncurses;
  681. implementation
  682. function wgetstr(w : pwindow;s : pchar) : longint;
  683. begin
  684. wgetstr:=wgetnstr(w,s,-(1));
  685. end;
  686. function getnstr(s : pchar;n : longint) : longint;
  687. begin
  688. getnstr:=wgetnstr(stdscr,s,n);
  689. end;
  690. function setterm(term : longint) : longint;
  691. begin
  692. {
  693. setterm:=setupterm(term,1,plongint(0));
  694. }
  695. setterm:=0;
  696. end;
  697. function fixterm : longint;
  698. begin
  699. fixterm:=reset_prog_mode;
  700. end;
  701. function resetterm : longint;
  702. begin
  703. resetterm:=reset_shell_mode;
  704. end;
  705. function saveterm : longint;
  706. begin
  707. saveterm:=def_prog_mode;
  708. end;
  709. function crmode : longint;
  710. begin
  711. crmode:=cbreak;
  712. end;
  713. function nocrmode : longint;
  714. begin
  715. nocrmode:=nocbreak;
  716. end;
  717. procedure getsyx(var y,x : longint);
  718. begin
  719. getyx(stdscr,y,x);
  720. end;
  721. function getattrs(win : pwindow) : longint;
  722. var
  723. if_local1 : longint;
  724. begin
  725. if win<>nil then
  726. if_local1:=win^._attrs
  727. else
  728. if_local1:=A_NORMAL;
  729. getattrs:=if_local1;
  730. end;
  731. function getcurx(win : pwindow) : longint;
  732. var
  733. if_local1 : longint;
  734. begin
  735. if win<>nil then
  736. if_local1:=win^._curx
  737. else
  738. if_local1:=ERR;
  739. getcurx:=if_local1;
  740. end;
  741. function getcury(win : pwindow) : longint;
  742. var
  743. if_local1 : longint;
  744. begin
  745. if win<>Nil then
  746. if_local1:=win^._cury
  747. else
  748. if_local1:=ERR;
  749. getcury:=if_local1;
  750. end;
  751. function getbegx(win : pwindow) : longint;
  752. var
  753. if_local1 : longint;
  754. begin
  755. if win<>Nil then
  756. if_local1:=win^._begx
  757. else
  758. if_local1:=ERR;
  759. getbegx:=if_local1;
  760. end;
  761. function getbegy(win : pwindow) : longint;
  762. var
  763. if_local1 : longint;
  764. begin
  765. if win<>Nil then
  766. if_local1:=win^._begy
  767. else
  768. if_local1:=ERR;
  769. getbegy:=if_local1;
  770. end;
  771. function getmaxx(win : pwindow) : longint;
  772. var
  773. if_local1 : longint;
  774. begin
  775. if win<>Nil then
  776. if_local1:=(win^._maxx) + 1
  777. else
  778. if_local1:=ERR;
  779. getmaxx:=if_local1;
  780. end;
  781. function getmaxy(win : pwindow) : longint;
  782. var
  783. if_local1 : longint;
  784. begin
  785. if win<>Nil then
  786. if_local1:=(win^._maxy) + 1
  787. else
  788. if_local1:=ERR;
  789. getmaxy:=if_local1;
  790. end;
  791. function getparx(win : pwindow) : longint;
  792. var
  793. if_local1 : longint;
  794. begin
  795. if win<>Nil then
  796. if_local1:=win^._parx
  797. else
  798. if_local1:=ERR;
  799. getparx:=if_local1;
  800. end;
  801. function getpary(win : pwindow) : longint;
  802. var
  803. if_local1 : longint;
  804. begin
  805. if win<>Nil then
  806. if_local1:=win^._pary
  807. else
  808. if_local1:=ERR;
  809. getpary:=if_local1;
  810. end;
  811. function wstandout(win : pwindow) : longint;
  812. begin
  813. wstandout:=wattr_set(win,A_STANDOUT);
  814. end;
  815. function wstandend(win : pwindow) : longint;
  816. begin
  817. wstandend:=wattr_set(win,A_NORMAL);
  818. end;
  819. (*
  820. function wattron(win : pwindow;at : longint) : longint;
  821. begin
  822. wattron:=wattr_on(win,at);
  823. end;
  824. function wattroff(win : pwindow;at : longint) : longint;
  825. begin
  826. wattroff:=wattr_off(win,at);
  827. end;
  828. function wattrset(win : pwindow;at : longint) : longint;
  829. begin
  830. wattrset:=wattr_set(win,at);
  831. end;
  832. *)
  833. function scroll(win : pwindow) : longint;
  834. begin
  835. scroll:=wscrl(win,1);
  836. end;
  837. function touchwin(win : pwindow) : longint;
  838. begin
  839. touchwin:=wtouchln(win,0,getmaxy(win),1);
  840. end;
  841. function touchline(win : pwindow;s,c : longint) : longint;
  842. begin
  843. touchline:=wtouchln(win,s,c,1);
  844. end;
  845. function untouchwin(win : pwindow) : longint;
  846. begin
  847. untouchwin:=wtouchln(win,0,getmaxy(win),0);
  848. end;
  849. function box(win : pwindow;v,h : longint) : longint;
  850. begin
  851. box:=wborder(win,v,v,h,h,0,0,0,0);
  852. end;
  853. function border(ls,rs,ts,bs,tl,tr,bl,br : longint) : longint;
  854. begin
  855. border:=wborder(stdscr,ls,rs,ts,bs,tl,tr,bl,br);
  856. end;
  857. function hline(ch,n : longint) : longint;
  858. begin
  859. hline:=whline(stdscr,ch,n);
  860. end;
  861. function vline(ch,n : longint) : longint;
  862. begin
  863. vline:=wvline(stdscr,ch,n);
  864. end;
  865. function winstr(w : pwindow;s : pchar) : longint;
  866. begin
  867. winstr:=winnstr(w,s,-(1));
  868. end;
  869. function winchstr(w : pwindow;s : pchar) : longint;
  870. begin
  871. winchstr:=winchnstr(w,s,-1);
  872. end;
  873. function winsstr(w : pwindow;s : pchar) : longint;
  874. begin
  875. winsstr:=winsnstr(w,s,-(1));
  876. end;
  877. function redrawwin(w : pwindow) : longint;
  878. begin
  879. redrawwin:=wredrawln(w,0,(w^._maxy) + 1);
  880. end;
  881. function waddstr(win : pwindow;st : pchar) : longint;
  882. begin
  883. waddstr:=waddnstr(win,st,-1);
  884. end;
  885. function waddchstr(win : pwindow;st : pchar) : longint;
  886. begin
  887. waddchstr:=waddchnstr(win,st,-1);
  888. end;
  889. function addch(ch : longint) : longint;
  890. begin
  891. addch:=waddch(stdscr,ch);
  892. end;
  893. function addchnstr(st : pchar;n : longint) : longint;
  894. begin
  895. addchnstr:=waddchnstr(stdscr,st,n);
  896. end;
  897. function addchstr(st : pchar) : longint;
  898. begin
  899. addchstr:=waddchstr(stdscr,st);
  900. end;
  901. function addnstr(st : pchar;n : longint) : longint;
  902. begin
  903. addnstr:=waddnstr(stdscr,st,n);
  904. end;
  905. function addstr(st : pchar) : longint;
  906. begin
  907. addstr:=waddnstr(stdscr,st,-1);
  908. end;
  909. function attroff(at : longint) : longint;
  910. begin
  911. attroff:=wattroff(stdscr,at);
  912. end;
  913. function attron(at : longint) : longint;
  914. begin
  915. attron:=wattron(stdscr,at);
  916. end;
  917. function attrset(at : longint) : longint;
  918. begin
  919. attrset:=wattrset(stdscr,at);
  920. end;
  921. function bkgd(ch : longint) : longint;
  922. begin
  923. bkgd:=wbkgd(stdscr,ch);
  924. end;
  925. procedure bkgdset(ch : longint);
  926. begin
  927. wbkgdset(stdscr,ch);
  928. end;
  929. function clear : longint;
  930. begin
  931. clear:=wclear(stdscr);
  932. end;
  933. function clrtobot : longint;
  934. begin
  935. clrtobot:=wclrtobot(stdscr);
  936. end;
  937. function clrtoeol : longint;
  938. begin
  939. clrtoeol:=wclrtoeol(stdscr);
  940. end;
  941. function delch : longint;
  942. begin
  943. delch:=wdelch(stdscr);
  944. end;
  945. function deleteln : longint;
  946. begin
  947. deleteln:=winsdelln(stdscr,-1);
  948. end;
  949. function echochar(c : longint) : longint;
  950. begin
  951. echochar:=wechochar(stdscr,c);
  952. end;
  953. function erase : longint;
  954. begin
  955. erase:=werase(stdscr);
  956. end;
  957. function getch : longint;
  958. begin
  959. getch:=wgetch(stdscr);
  960. end;
  961. function getstr(st : pchar) : longint;
  962. begin
  963. getstr:=wgetstr(stdscr,st);
  964. end;
  965. function inch : longint;
  966. begin
  967. inch:=winch(stdscr);
  968. end;
  969. function inchnstr(s : pchar;n : longint) : longint;
  970. begin
  971. inchnstr:=winchnstr(stdscr,s,n);
  972. end;
  973. function inchstr(s : pchar) : longint;
  974. begin
  975. inchstr:=winchstr(stdscr,s);
  976. end;
  977. function innstr(s : pchar;n : longint) : longint;
  978. begin
  979. innstr:=winnstr(stdscr,s,n);
  980. end;
  981. function insch(c : longint) : longint;
  982. begin
  983. insch:=winsch(stdscr,c);
  984. end;
  985. function insdelln(n : longint) : longint;
  986. begin
  987. insdelln:=winsdelln(stdscr,n);
  988. end;
  989. function insertln : longint;
  990. begin
  991. insertln:=winsdelln(stdscr,1);
  992. end;
  993. function insnstr(s : pchar;n : longint) : longint;
  994. begin
  995. insnstr:=winsnstr(stdscr,s,n);
  996. end;
  997. function insstr(s : pchar) : longint;
  998. begin
  999. insstr:=winsstr(stdscr,s);
  1000. end;
  1001. function instr(s : pchar) : longint;
  1002. begin
  1003. instr:=winstr(stdscr,s);
  1004. end;
  1005. function move(y,x : longint) : longint;
  1006. begin
  1007. move:=wmove(stdscr,y,x);
  1008. end;
  1009. function refresh : longint;
  1010. begin
  1011. refresh:=wrefresh(stdscr);
  1012. end;
  1013. function scrl(n : longint) : longint;
  1014. begin
  1015. scrl:=wscrl(stdscr,n);
  1016. end;
  1017. function setscrreg(t,b : longint) : longint;
  1018. begin
  1019. setscrreg:=wsetscrreg(stdscr,t,b);
  1020. end;
  1021. function standend : longint;
  1022. begin
  1023. standend:=wstandend(stdscr);
  1024. end;
  1025. function standout : longint;
  1026. begin
  1027. standout:=wstandout(stdscr);
  1028. end;
  1029. function timeout(delay : longint) : longint;
  1030. begin
  1031. timeout:=wtimeout(stdscr,delay);
  1032. end;
  1033. function wdeleteln(win : pwindow) : longint;
  1034. begin
  1035. wdeleteln:=winsdelln(win,-1);
  1036. end;
  1037. function winsertln(win : pwindow) : longint;
  1038. begin
  1039. winsertln:=winsdelln(win,1);
  1040. end;
  1041. function mvaddch(y,x,ch : longint) : longint;
  1042. begin
  1043. mvaddch:=mvwaddch(stdscr,y,x,ch);
  1044. end;
  1045. function mvaddchnstr(y,x: longint;st : pchar;n : longint) : longint;
  1046. begin
  1047. mvaddchnstr:=mvwaddchnstr(stdscr,y,x,st,n);
  1048. end;
  1049. function mvaddchstr(y,x : longint;st : pchar) : longint;
  1050. begin
  1051. mvaddchstr:=mvwaddchstr(stdscr,y,x,st);
  1052. end;
  1053. function mvaddnstr(y,x: longint;st : pchar; n : longint) : longint;
  1054. begin
  1055. mvaddnstr:=mvwaddnstr(stdscr,y,x,st,n);
  1056. end;
  1057. function mvaddstr(y,x : longint;st : pchar) : longint;
  1058. begin
  1059. mvaddstr:=mvwaddstr(stdscr,y,x,st);
  1060. end;
  1061. function mvdelch(y,x : longint) : longint;
  1062. begin
  1063. mvdelch:=mvwdelch(stdscr,y,x);
  1064. end;
  1065. function mvgetch(y,x : longint) : longint;
  1066. begin
  1067. mvgetch:=mvwgetch(stdscr,y,x);
  1068. end;
  1069. function mvgetnstr(y,x : longint;st : pchar;n : longint) : longint;
  1070. begin
  1071. mvgetnstr:=mvwgetnstr(stdscr,y,x,st,n);
  1072. end;
  1073. function mvgetstr(y,x: longint;st : pchar) : longint;
  1074. begin
  1075. mvgetstr:=mvwgetstr(stdscr,y,x,st);
  1076. end;
  1077. function mvhline(y,x : longint;c : chtype;n : longint) : longint;
  1078. begin
  1079. mvhline:=mvwhline(stdscr,y,x,c,n);
  1080. end;
  1081. function mvinch(y,x : longint) : longint;
  1082. begin
  1083. mvinch:=mvwinch(stdscr,y,x);
  1084. end;
  1085. function mvinchnstr(y,x : longint;s : pchar;n : longint) : longint;
  1086. begin
  1087. mvinchnstr:=mvwinchnstr(stdscr,y,x,s,n);
  1088. end;
  1089. function mvinchstr(y,x : longint;s : pchar) : longint;
  1090. begin
  1091. mvinchstr:=mvwinchstr(stdscr,y,x,s);
  1092. end;
  1093. function mvinnstr(y,x : longint;s : pchar;n : longint) : longint;
  1094. begin
  1095. mvinnstr:=mvwinnstr(stdscr,y,x,s,n);
  1096. end;
  1097. function mvinsch(y,x: longint;c : chtype) : longint;
  1098. begin
  1099. mvinsch:=mvwinsch(stdscr,y,x,c);
  1100. end;
  1101. function mvinsnstr(y,x : longint;s : pchar;n : longint) : longint;
  1102. begin
  1103. mvinsnstr:=mvwinsnstr(stdscr,y,x,s,n);
  1104. end;
  1105. function mvinsstr(y,x : longint;s : pchar) : longint;
  1106. begin
  1107. mvinsstr:=mvwinsstr(stdscr,y,x,s);
  1108. end;
  1109. function mvinstr(y,x : longint;s : pchar) : longint;
  1110. begin
  1111. mvinstr:=mvwinstr(stdscr,y,x,s);
  1112. end;
  1113. function mvvline(y,x,c,n : longint) : longint;
  1114. begin
  1115. mvvline:=mvwvline(stdscr,y,x,c,n);
  1116. end;
  1117. function attr_get : longint;
  1118. begin
  1119. attr_get:=wattr_get(stdscr);
  1120. end;
  1121. function attr_off(a : longint) : longint;
  1122. begin
  1123. attr_off:=wattr_off(stdscr,a);
  1124. end;
  1125. function attr_on(a : longint) : longint;
  1126. begin
  1127. attr_on:=wattr_on(stdscr,a);
  1128. end;
  1129. function attr_set(a : longint) : longint;
  1130. begin
  1131. attr_set:=wattr_set(stdscr,a);
  1132. end;
  1133. function chgat(n,a,c,o : longint) : longint;
  1134. begin
  1135. chgat:=wchgat(stdscr,n,a,c,pointer(ptrint(o)));
  1136. end;
  1137. function getbkgd(win : pwindow) : longint;
  1138. begin
  1139. getbkgd:=win^._bkgd;
  1140. end;
  1141. function mvchgat(y,x,n,a,c,o : longint) : longint;
  1142. begin
  1143. mvchgat:=mvwchgat(stdscr,y,x,n,a,c,o);
  1144. end;
  1145. function slk_attr_off(a : longint) : longint;
  1146. begin
  1147. slk_attr_off:=slk_attroff(a);
  1148. end;
  1149. function slk_attr_on(a : longint) : longint;
  1150. begin
  1151. slk_attr_on:=slk_attron(a);
  1152. end;
  1153. function slk_attr_set(a : longint) : longint;
  1154. begin
  1155. slk_attr_set:=slk_attrset(a);
  1156. end;
  1157. function vid_attr(a : longint) : longint;
  1158. begin
  1159. vid_attr:=vidattr(a);
  1160. end;
  1161. function wattr_get(win : pwindow) : longint;
  1162. begin
  1163. wattr_get:=win^._attrs;
  1164. end;
  1165. function KEY_F(n : longint) : longint;
  1166. begin
  1167. KEY_F:=KEY_F0 + n;
  1168. end;
  1169. procedure getyx(win : pwindow; var y,x : longint);
  1170. begin
  1171. X:=ERR;
  1172. Y:=ERR;
  1173. if Win<>Nil then
  1174. begin
  1175. Y:=win^._cury;
  1176. X:=Win^._curx;
  1177. end;
  1178. end;
  1179. procedure getbegyx(win : pwindow; var y,x : longint);
  1180. begin
  1181. X:=ERR;
  1182. Y:=ERR;
  1183. if Win<>Nil then
  1184. begin
  1185. Y:=win^._begy;
  1186. X:=Win^._begx;
  1187. end;
  1188. end;
  1189. procedure getmaxyx(win : pwindow; var y,x : longint);
  1190. begin
  1191. X:=ERR;
  1192. Y:=ERR;
  1193. if Win<>Nil then
  1194. begin
  1195. Y:=win^._maxy+1;
  1196. X:=Win^._maxx+1;
  1197. end;
  1198. end;
  1199. procedure getparyx(win : pwindow; var y,x : longint);
  1200. begin
  1201. X:=ERR;
  1202. Y:=ERR;
  1203. if Win<>Nil then
  1204. begin
  1205. Y:=win^._pary;
  1206. X:=Win^._parx;
  1207. end;
  1208. end;
  1209. (* kjw, 08/23/2000, external in v4.2
  1210. function winch (win : PWindow) : longint;
  1211. begin
  1212. if win<>nil then
  1213. winch:=win^._line[win^._cury].text[Win^ ._curx]
  1214. else
  1215. winch:=0;
  1216. end;
  1217. function wattr_set(win : pwindow; at : longint) : longint;
  1218. begin
  1219. If win<>nil then
  1220. begin
  1221. win^._attrs := at;
  1222. wattr_set:=at;
  1223. end
  1224. else
  1225. wattr_set:=0;
  1226. end;
  1227. *)
  1228. procedure setsyx (y,x : longint);
  1229. begin
  1230. stdscr^._cury := y;
  1231. stdscr^._curx := x;
  1232. end;
  1233. function mvwaddch(win : pwindow;y,x : longint; ch : chtype) : longint;
  1234. begin
  1235. if wmove(win,y,x) = ERR then
  1236. exit(ERR)
  1237. else
  1238. exit(waddch(win,ch))
  1239. end;
  1240. function mvwaddchnstr(win : pwindow;y,x : longint;st : pchar;n : longint) : longint;
  1241. begin
  1242. if wmove (win,y,x)=ERR then
  1243. exit(ERR)
  1244. else
  1245. exit(waddchnstr(win,st,n))
  1246. end;
  1247. function mvwaddchstr(win : pwindow;y,x : longint;st : pchar) : longint;
  1248. begin
  1249. if wmove (win,y,x)=ERR then
  1250. exit(ERR)
  1251. else
  1252. exit(waddchnstr(win,st,-1))
  1253. end;
  1254. function mvwaddnstr(win : pwindow;y,x : longint;st : pchar;n : longint) : longint;
  1255. begin
  1256. if wmove (win,y,x)=ERR then
  1257. exit(ERR)
  1258. else
  1259. exit(waddnstr(win,st,n))
  1260. end;
  1261. function mvwaddstr(win : pwindow;y,x : longint;st : pchar) : longint;
  1262. begin
  1263. if wmove (win,y,x)=ERR then
  1264. exit(ERR)
  1265. else
  1266. exit(waddnstr(win,st,-1))
  1267. end;
  1268. function mvwdelch(win : pwindow;y,x : longint) : longint;
  1269. begin
  1270. if wmove (win,y,x)=ERR then
  1271. exit(ERR)
  1272. else
  1273. exit(wdelch(win))
  1274. end;
  1275. function mvwgetch(win : pwindow;y,x : longint) : longint;
  1276. begin
  1277. if wmove (win,y,x)=ERR then
  1278. exit(ERR)
  1279. else
  1280. exit(wgetch(win))
  1281. end;
  1282. function mvwgetnstr(win : pwindow;y,x : longint;st : pchar;n: longint) : longint;
  1283. begin
  1284. if wmove (win,y,x)=ERR then
  1285. exit(ERR)
  1286. else
  1287. exit(wgetnstr(win,st,n))
  1288. end;
  1289. function mvwgetstr(win : pwindow;y,x : longint;st: pchar) : longint;
  1290. begin
  1291. if wmove (win,y,x)=ERR then
  1292. exit(ERR)
  1293. else
  1294. exit(wgetstr(win,st))
  1295. end;
  1296. function mvwhline(win : pwindow;y,x : longint;c : chtype;n : longint) : longint;
  1297. begin
  1298. if wmove (win,y,x)=ERR then
  1299. exit(ERR)
  1300. else
  1301. exit(whline(win,c,n))
  1302. end;
  1303. function mvwinch(win : pwindow;y,x : longint) : longint;
  1304. begin
  1305. if wmove (win,y,x)=ERR then
  1306. exit(ERR)
  1307. else
  1308. exit(winch(win))
  1309. end;
  1310. function mvwinchnstr(win : pwindow;y,x : longint;s : pchar; n : longint) : longint;
  1311. begin
  1312. if wmove (win,y,x)=ERR then
  1313. exit(ERR)
  1314. else
  1315. exit(winchnstr(win,s,n))
  1316. end;
  1317. function mvwinchstr(win : pwindow;y,x : longint;s : pchar) : longint;
  1318. begin
  1319. if wmove (win,y,x)=ERR then
  1320. exit(ERR)
  1321. else
  1322. exit(winchstr(win,s))
  1323. end;
  1324. function mvwinnstr(win : pwindow;y,x : longint;s : pchar;n : longint) : longint;
  1325. begin
  1326. if wmove (win,y,x)=ERR then
  1327. exit(ERR)
  1328. else
  1329. exit(winnstr(win,s,n))
  1330. end;
  1331. function mvwinsch(win : pwindow;y,x : longint;c : chtype) : longint;
  1332. begin
  1333. if wmove (win,y,x)=ERR then
  1334. exit(ERR)
  1335. else
  1336. exit(winsch(win,c))
  1337. end;
  1338. function mvwinsnstr(win : pwindow;y,x : longint;s : pchar;n : longint) : longint;
  1339. begin
  1340. if wmove (win,y,x)=ERR then
  1341. exit(ERR)
  1342. else
  1343. exit(winsnstr(win,s,n))
  1344. end;
  1345. function mvwinsstr(win : pwindow;y,x : longint;s : pchar) : longint;
  1346. begin
  1347. if wmove (win,y,x)=ERR then
  1348. exit(ERR)
  1349. else
  1350. exit(winsstr(win,s))
  1351. end;
  1352. function mvwinstr(win : pwindow;y,x : longint;s : pchar) : longint;
  1353. begin
  1354. if wmove (win,y,x)=ERR then
  1355. exit(ERR)
  1356. else
  1357. exit(winstr(win,s))
  1358. end;
  1359. function mvwvline(win : pwindow;y,x : longint;c : chtype;n : longint) : longint;
  1360. begin
  1361. if wmove (win,y,x)=ERR then
  1362. exit(ERR)
  1363. else
  1364. exit(wvline(win,c,n))
  1365. end;
  1366. function color_pair(n : longint): longint;
  1367. begin
  1368. color_pair:=n shl 8;
  1369. end;
  1370. function ACS_ULCORNER : chtype;
  1371. begin
  1372. ACS_ULCORNER:=acs_map['l'];
  1373. end;
  1374. function ACS_LLCORNER : chtype;
  1375. begin
  1376. ACS_LLCORNER:=acs_map['m'];
  1377. end;
  1378. function ACS_URCORNER : chtype;
  1379. begin
  1380. ACS_URCORNER:=acs_map['k'];
  1381. end;
  1382. function ACS_LRCORNER : chtype;
  1383. begin
  1384. ACS_LRCORNER:=acs_map['j'];
  1385. end;
  1386. function ACS_LTEE : chtype;
  1387. begin
  1388. ACS_LTEE:=acs_map['t'];
  1389. end;
  1390. function ACS_RTEE : chtype;
  1391. begin
  1392. ACS_RTEE:=acs_map['u'];
  1393. end;
  1394. function ACS_BTEE : chtype;
  1395. begin
  1396. ACS_BTEE:=acs_map['v'];
  1397. end;
  1398. function ACS_TTEE : chtype;
  1399. begin
  1400. ACS_TTEE:=acs_map['w'];
  1401. end;
  1402. function ACS_HLINE : chtype;
  1403. begin
  1404. ACS_HLINE:=acs_map['q'];
  1405. end;
  1406. function ACS_VLINE : chtype;
  1407. begin
  1408. ACS_VLINE:=acs_map['x'];
  1409. end;
  1410. function ACS_PLUS : chtype;
  1411. begin
  1412. ACS_PLUS:=acs_map['n'];
  1413. end;
  1414. function ACS_S1 : chtype;
  1415. begin
  1416. ACS_S1 :=acs_map['o'];
  1417. end;
  1418. function ACS_S9 : chtype;
  1419. begin
  1420. ACS_S9 :=acs_map['s'];
  1421. end;
  1422. function ACS_DIAMOND : chtype;
  1423. begin
  1424. ACS_DIAMOND:=acs_map['`'];
  1425. end;
  1426. function ACS_CKBOARD : chtype;
  1427. begin
  1428. ACS_CKBOARD:=acs_map['a'];
  1429. end;
  1430. function ACS_DEGREE : chtype;
  1431. begin
  1432. ACS_DEGREE:=acs_map['f'];
  1433. end;
  1434. function ACS_PLMINUS : chtype;
  1435. begin
  1436. ACS_PLMINUS:=acs_map['g'];
  1437. end;
  1438. function ACS_BULLET : chtype;
  1439. begin
  1440. ACS_BULLET:=acs_map['~'];
  1441. end;
  1442. function ACS_LARROW : chtype;
  1443. begin
  1444. ACS_LARROW:=acs_map[','];
  1445. end;
  1446. function ACS_RARROW : chtype;
  1447. begin
  1448. ACS_RARROW:=acs_map['+'];
  1449. end;
  1450. function ACS_DARROW : chtype;
  1451. begin
  1452. ACS_DARROW:=acs_map['.'];
  1453. end;
  1454. function ACS_UARROW : chtype;
  1455. begin
  1456. ACS_UARROW:=acs_map['-'];
  1457. end;
  1458. function ACS_BOARD : chtype;
  1459. begin
  1460. ACS_BOARD:=acs_map['h'];
  1461. end;
  1462. function ACS_LANTERN : chtype;
  1463. begin
  1464. ACS_LANTERN:=acs_map['i'];
  1465. end;
  1466. function ACS_BLOCK : chtype;
  1467. begin
  1468. ACS_BLOCK:=acs_map['0'];
  1469. end;
  1470. function ACS_S3 : chtype;
  1471. begin
  1472. ACS_S3 :=acs_map['p'];
  1473. end;
  1474. function ACS_S7 : chtype;
  1475. begin
  1476. ACS_S7 :=acs_map['r'];
  1477. end;
  1478. function ACS_LEQUAL : chtype;
  1479. begin
  1480. ACS_LEQUAL:=acs_map['y'];
  1481. end;
  1482. function ACS_GEQUAL : chtype;
  1483. begin
  1484. ACS_GEQUAL:=acs_map['z'];
  1485. end;
  1486. function ACS_PI : chtype;
  1487. begin
  1488. ACS_PI :=acs_map['{'];
  1489. end;
  1490. function ACS_NEQUAL : chtype;
  1491. begin
  1492. ACS_NEQUAL:=acs_map['|'];
  1493. end;
  1494. function ACS_STERLING : chtype;
  1495. begin
  1496. ACS_STERLING:=acs_map['}'];
  1497. end;
  1498. end.
  1499. {
  1500. $Log$
  1501. Revision 1.8 2004-12-15 21:25:31 peter
  1502. * x86_64 fixes
  1503. Revision 1.7 2004/05/08 20:50:19 jonas
  1504. * Darwin fixes by mischi
  1505. Revision 1.6 2003/10/15 17:04:40 florian
  1506. + some print functions added
  1507. Revision 1.5 2003/02/09 19:10:13 marco
  1508. OpenBSD links curses, not ncurses
  1509. Revision 1.4 2003/02/09 19:05:05 marco
  1510. * And now with new refreshing "external;" added.
  1511. Revision 1.3 2003/02/09 16:22:51 marco
  1512. * xx : thetype; external name ='xx'; to xx :thetype; cvar;
  1513. Revision 1.2 2002/09/07 15:43:01 peter
  1514. * old logs removed and tabs fixed
  1515. Revision 1.1 2002/01/29 17:55:17 peter
  1516. * splitted to base and extra
  1517. }