1 /*  This is an inclusion for Curses.c.
2 **
3 **
4 **  CursesFun.c -- the functions
5 **
6 **  This is an inclusion for Curses.c
7 **
8 **  Copyright (c) 1994-2000  William Setzer
9 **
10 **  You may distribute under the terms of either the Artistic License
11 **  or the GNU General Public License, as specified in the README file.
12 */
13 
14 /* curs_addch */
15 
XS(XS_Curses_addch)16 XS(XS_Curses_addch)
17 {
18     dXSARGS;
19 #ifdef C_ADDCH
20     c_countargs("addch", items, 1);
21     {
22     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
23     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
24     chtype  ch  = c_sv2chtype(ST(c_arg));
25     int ret = c_mret == ERR ? ERR : waddch(win, ch);
26 
27     ST(0) = sv_newmortal();
28     sv_setiv(ST(0), (IV)ret);
29     }
30     XSRETURN(1);
31 #else
32     c_fun_not_there("addch");
33     XSRETURN(0);
34 #endif
35 }
36 
XS(XS_Curses_echochar)37 XS(XS_Curses_echochar)
38 {
39     dXSARGS;
40 #ifdef C_ECHOCHAR
41     c_countargs("echochar", items, 1);
42     {
43     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
44     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
45     chtype  ch  = c_sv2chtype(ST(c_arg));
46     int ret = c_mret == ERR ? ERR : wechochar(win, ch);
47 
48     ST(0) = sv_newmortal();
49     sv_setiv(ST(0), (IV)ret);
50     }
51     XSRETURN(1);
52 #else
53     c_fun_not_there("echochar");
54     XSRETURN(0);
55 #endif
56 }
57 
58 
59 /* curs_addchstr */
60 
XS(XS_Curses_addchstr)61 XS(XS_Curses_addchstr)
62 {
63     dXSARGS;
64 #ifdef C_ADDCHSTR
65     c_countargs("addchstr", items, 1);
66     {
67     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
68     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
69     chtype *str = (chtype *)SvPV_nolen(ST(c_arg));
70     int ret = c_mret == ERR ? ERR : waddchstr(win, str);
71 
72     ST(0) = sv_newmortal();
73     sv_setiv(ST(0), (IV)ret);
74     }
75     XSRETURN(1);
76 #else
77     c_fun_not_there("addchstr");
78     XSRETURN(0);
79 #endif
80 }
81 
XS(XS_Curses_addchnstr)82 XS(XS_Curses_addchnstr)
83 {
84     dXSARGS;
85 #ifdef C_ADDCHNSTR
86     c_countargs("addchnstr", items, 2);
87     {
88     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
89     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
90     chtype *str = (chtype *)SvPV_nolen(ST(c_arg));
91     int n   = (int)SvIV(ST(c_arg+1));
92     int ret = c_mret == ERR ? ERR : waddchnstr(win, str, n);
93 
94     ST(0) = sv_newmortal();
95     sv_setiv(ST(0), (IV)ret);
96     }
97     XSRETURN(1);
98 #else
99     c_fun_not_there("addchnstr");
100     XSRETURN(0);
101 #endif
102 }
103 
104 
105 /* curs_addstr */
106 
XS(XS_Curses_addstr)107 XS(XS_Curses_addstr)
108 {
109     dXSARGS;
110 #ifdef C_ADDSTR
111     c_countargs("addstr", items, 1);
112     {
113     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
114     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
115     char *  str = (char *)SvPV_nolen(ST(c_arg));
116     int ret = c_mret == ERR ? ERR : waddstr(win, str);
117 
118     ST(0) = sv_newmortal();
119     sv_setiv(ST(0), (IV)ret);
120     }
121     XSRETURN(1);
122 #else
123     c_fun_not_there("addstr");
124     XSRETURN(0);
125 #endif
126 }
127 
XS(XS_Curses_addnstr)128 XS(XS_Curses_addnstr)
129 {
130     dXSARGS;
131 #ifdef C_ADDNSTR
132     c_countargs("addnstr", items, 2);
133     {
134     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
135     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
136     char *  str = (char *)SvPV_nolen(ST(c_arg));
137     int n   = (int)SvIV(ST(c_arg+1));
138     int ret = c_mret == ERR ? ERR : waddnstr(win, str, n);
139 
140     ST(0) = sv_newmortal();
141     sv_setiv(ST(0), (IV)ret);
142     }
143     XSRETURN(1);
144 #else
145     c_fun_not_there("addnstr");
146     XSRETURN(0);
147 #endif
148 }
149 
150 
151 /* curs_attr */
152 
XS(XS_Curses_attroff)153 XS(XS_Curses_attroff)
154 {
155     dXSARGS;
156 #ifdef C_ATTROFF
157     c_countargs("attroff", items, 1);
158     {
159     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
160     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
161     int attrs   = (int)SvIV(ST(c_arg));
162     int ret = c_mret == ERR ? ERR : wattroff(win, attrs);
163 
164     ST(0) = sv_newmortal();
165     sv_setiv(ST(0), (IV)ret);
166     }
167     XSRETURN(1);
168 #else
169     c_fun_not_there("attroff");
170     XSRETURN(0);
171 #endif
172 }
173 
XS(XS_Curses_attron)174 XS(XS_Curses_attron)
175 {
176     dXSARGS;
177 #ifdef C_ATTRON
178     c_countargs("attron", items, 1);
179     {
180     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
181     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
182     int attrs   = (int)SvIV(ST(c_arg));
183     int ret = c_mret == ERR ? ERR : wattron(win, attrs);
184 
185     ST(0) = sv_newmortal();
186     sv_setiv(ST(0), (IV)ret);
187     }
188     XSRETURN(1);
189 #else
190     c_fun_not_there("attron");
191     XSRETURN(0);
192 #endif
193 }
194 
XS(XS_Curses_attrset)195 XS(XS_Curses_attrset)
196 {
197     dXSARGS;
198 #ifdef C_ATTRSET
199     c_countargs("attrset", items, 1);
200     {
201     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
202     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
203     int attrs   = (int)SvIV(ST(c_arg));
204     int ret = c_mret == ERR ? ERR : wattrset(win, attrs);
205 
206     ST(0) = sv_newmortal();
207     sv_setiv(ST(0), (IV)ret);
208     }
209     XSRETURN(1);
210 #else
211     c_fun_not_there("attrset");
212     XSRETURN(0);
213 #endif
214 }
215 
XS(XS_Curses_standend)216 XS(XS_Curses_standend)
217 {
218     dXSARGS;
219 #ifdef C_STANDEND
220     c_countargs("standend", items, 0);
221     {
222     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
223     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
224     int ret = c_mret == ERR ? ERR : (int)wstandend(win);
225 
226     ST(0) = sv_newmortal();
227     sv_setiv(ST(0), (IV)ret);
228     }
229     XSRETURN(1);
230 #else
231     c_fun_not_there("standend");
232     XSRETURN(0);
233 #endif
234 }
235 
XS(XS_Curses_standout)236 XS(XS_Curses_standout)
237 {
238     dXSARGS;
239 #ifdef C_STANDOUT
240     c_countargs("standout", items, 0);
241     {
242     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
243     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
244     int ret = c_mret == ERR ? ERR : (int)wstandout(win);
245 
246     ST(0) = sv_newmortal();
247     sv_setiv(ST(0), (IV)ret);
248     }
249     XSRETURN(1);
250 #else
251     c_fun_not_there("standout");
252     XSRETURN(0);
253 #endif
254 }
255 
XS(XS_Curses_attr_get)256 XS(XS_Curses_attr_get)
257 {
258     dXSARGS;
259 #ifdef C_ATTR_GET
260     c_countargs("attr_get", items, 3);
261     {
262     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
263     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
264     attr_t  attrs   = 0;
265     short   color   = 0;
266     void *  opts    = 0;
267     int ret = c_mret == ERR ? ERR : wattr_get(win, &attrs, &color, opts);
268 
269     sv_setiv(ST(c_arg), (IV)attrs);;
270     sv_setiv(ST(c_arg+1), (IV)color);;
271     ST(0) = sv_newmortal();
272     sv_setiv(ST(0), (IV)ret);
273     }
274     XSRETURN(1);
275 #else
276     c_fun_not_there("attr_get");
277     XSRETURN(0);
278 #endif
279 }
280 
XS(XS_Curses_attr_off)281 XS(XS_Curses_attr_off)
282 {
283     dXSARGS;
284 #ifdef C_ATTR_OFF
285     c_countargs("attr_off", items, 2);
286     {
287     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
288     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
289     attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
290     void *  opts    = 0;
291     int ret = c_mret == ERR ? ERR : wattr_off(win, attrs, opts);
292 
293     ST(0) = sv_newmortal();
294     sv_setiv(ST(0), (IV)ret);
295     }
296     XSRETURN(1);
297 #else
298     c_fun_not_there("attr_off");
299     XSRETURN(0);
300 #endif
301 }
302 
XS(XS_Curses_attr_on)303 XS(XS_Curses_attr_on)
304 {
305     dXSARGS;
306 #ifdef C_ATTR_ON
307     c_countargs("attr_on", items, 2);
308     {
309     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
310     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
311     attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
312     void *  opts    = 0;
313     int ret = c_mret == ERR ? ERR : wattr_on(win, attrs, opts);
314 
315     ST(0) = sv_newmortal();
316     sv_setiv(ST(0), (IV)ret);
317     }
318     XSRETURN(1);
319 #else
320     c_fun_not_there("attr_on");
321     XSRETURN(0);
322 #endif
323 }
324 
XS(XS_Curses_attr_set)325 XS(XS_Curses_attr_set)
326 {
327     dXSARGS;
328 #ifdef C_ATTR_SET
329     c_countargs("attr_set", items, 3);
330     {
331     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
332     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
333     attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
334     short   color   = (short)SvIV(ST(c_arg+1));
335     void *  opts    = 0;
336     int ret = c_mret == ERR ? ERR : wattr_set(win, attrs, color, opts);
337 
338     ST(0) = sv_newmortal();
339     sv_setiv(ST(0), (IV)ret);
340     }
341     XSRETURN(1);
342 #else
343     c_fun_not_there("attr_set");
344     XSRETURN(0);
345 #endif
346 }
347 
XS(XS_Curses_chgat)348 XS(XS_Curses_chgat)
349 {
350     dXSARGS;
351 #ifdef C_CHGAT
352     /* Our 4th argument is meaningless.  It mirrors the meaningless "opts"
353        argument in the Curses C library.
354 
355        In Perl Curses 1.16, we tried reducing this to 3 as a user thought
356        a 3-argument call ought to work, and we thought this number might
357        just be the _minimum_ argument count.  Well, it's not.  So for
358        backward compatibility if nothing else, it has to be 4.  Fixed
359        back to 4 in 1.18.
360     */
361     c_countargs("chgat", items, 4);
362     {
363     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
364     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
365     int n   = (int)SvIV(ST(c_arg));
366     attr_t  attrs   = (attr_t)SvIV(ST(c_arg+1));
367     short   color   = (short)SvIV(ST(c_arg+2));
368     void *  opts    = 0;
369     int ret = c_mret == ERR ? ERR : wchgat(win, n, attrs, color, opts);
370 
371     ST(0) = sv_newmortal();
372     sv_setiv(ST(0), (IV)ret);
373     }
374     XSRETURN(1);
375 #else
376     c_fun_not_there("chgat");
377     XSRETURN(0);
378 #endif
379 }
380 
XS(XS_Curses_COLOR_PAIR)381 XS(XS_Curses_COLOR_PAIR)
382 {
383     dXSARGS;
384 #ifdef C_COLOR_PAIR
385     c_exactargs("COLOR_PAIR", items, 1);
386     {
387     int n   = (int)SvIV(ST(0));
388     int ret = COLOR_PAIR(n);
389 
390     ST(0) = sv_newmortal();
391     sv_setiv(ST(0), (IV)ret);
392     }
393     XSRETURN(1);
394 #else
395     c_fun_not_there("COLOR_PAIR");
396     XSRETURN(0);
397 #endif
398 }
399 
XS(XS_Curses_PAIR_NUMBER)400 XS(XS_Curses_PAIR_NUMBER)
401 {
402     dXSARGS;
403 #ifdef C_PAIR_NUMBER
404     c_exactargs("PAIR_NUMBER", items, 1);
405     {
406     int attrs   = (int)SvIV(ST(0));
407     int ret = PAIR_NUMBER(attrs);
408 
409     ST(0) = sv_newmortal();
410     sv_setiv(ST(0), (IV)ret);
411     }
412     XSRETURN(1);
413 #else
414     c_fun_not_there("PAIR_NUMBER");
415     XSRETURN(0);
416 #endif
417 }
418 
419 
420 /* curs_beep */
421 
XS(XS_Curses_beep)422 XS(XS_Curses_beep)
423 {
424     dXSARGS;
425 #ifdef C_BEEP
426     c_exactargs("beep", items, 0);
427     {
428     int ret = beep();
429 
430     ST(0) = sv_newmortal();
431     sv_setiv(ST(0), (IV)ret);
432     }
433     XSRETURN(1);
434 #else
435     c_fun_not_there("beep");
436     XSRETURN(0);
437 #endif
438 }
439 
XS(XS_Curses_flash)440 XS(XS_Curses_flash)
441 {
442     dXSARGS;
443 #ifdef C_FLASH
444     c_exactargs("flash", items, 0);
445     {
446     int ret = flash();
447 
448     ST(0) = sv_newmortal();
449     sv_setiv(ST(0), (IV)ret);
450     }
451     XSRETURN(1);
452 #else
453     c_fun_not_there("flash");
454     XSRETURN(0);
455 #endif
456 }
457 
458 
459 /* curs_bkgd */
460 
XS(XS_Curses_bkgd)461 XS(XS_Curses_bkgd)
462 {
463     dXSARGS;
464 #ifdef C_BKGD
465     c_countargs("bkgd", items, 1);
466     {
467     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
468     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
469     chtype  ch  = c_sv2chtype(ST(c_arg));
470     int ret = c_mret == ERR ? ERR : wbkgd(win, ch);
471 
472     ST(0) = sv_newmortal();
473     sv_setiv(ST(0), (IV)ret);
474     }
475     XSRETURN(1);
476 #else
477     c_fun_not_there("bkgd");
478     XSRETURN(0);
479 #endif
480 }
481 
XS(XS_Curses_bkgdset)482 XS(XS_Curses_bkgdset)
483 {
484     dXSARGS;
485 #ifdef C_BKGDSET
486     c_countargs("bkgdset", items, 1);
487     {
488     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
489     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
490     chtype  ch  = c_sv2chtype(ST(c_arg));
491 
492     if (c_mret == OK) { wbkgdset(win, ch); }
493     }
494     XSRETURN(0);
495 #else
496     c_fun_not_there("bkgdset");
497     XSRETURN(0);
498 #endif
499 }
500 
XS(XS_Curses_getbkgd)501 XS(XS_Curses_getbkgd)
502 {
503     dXSARGS;
504 #ifdef C_GETBKGD
505     c_countargs("getbkgd", items, 0);
506     {
507     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
508     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
509     chtype  ret = c_mret == ERR ? ERR : getbkgd(win);
510 
511     ST(0) = sv_newmortal();
512     c_chtype2sv(ST(0), ret);
513     }
514     XSRETURN(1);
515 #else
516     c_fun_not_there("getbkgd");
517     XSRETURN(0);
518 #endif
519 }
520 
521 
522 /* curs_border */
523 
XS(XS_Curses_border)524 XS(XS_Curses_border)
525 {
526     dXSARGS;
527 #ifdef C_BORDER
528     c_countargs("border", items, 8);
529     {
530     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
531     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
532     chtype  ls  = c_sv2chtype(ST(c_arg));
533     chtype  rs_ = c_sv2chtype(ST(c_arg+1));
534     chtype  ts  = c_sv2chtype(ST(c_arg+2));
535     chtype  bs  = c_sv2chtype(ST(c_arg+3));
536     chtype  tl  = c_sv2chtype(ST(c_arg+4));
537     chtype  tr  = c_sv2chtype(ST(c_arg+5));
538     chtype  bl  = c_sv2chtype(ST(c_arg+6));
539     chtype  br  = c_sv2chtype(ST(c_arg+7));
540     int ret = c_mret == ERR ? ERR : wborder(win, ls, rs_, ts, bs, tl, tr, bl, br);
541 
542     ST(0) = sv_newmortal();
543     sv_setiv(ST(0), (IV)ret);
544     }
545     XSRETURN(1);
546 #else
547     c_fun_not_there("border");
548     XSRETURN(0);
549 #endif
550 }
551 
XS(XS_Curses_box)552 XS(XS_Curses_box)
553 {
554     dXSARGS;
555 #ifdef C_BOX
556     c_countargs("box", items, 2);
557     {
558     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
559     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
560     chtype  verch   = c_sv2chtype(ST(c_arg));
561     chtype  horch   = c_sv2chtype(ST(c_arg+1));
562     int ret = c_mret == ERR ? ERR : box(win, verch, horch);
563 
564     ST(0) = sv_newmortal();
565     sv_setiv(ST(0), (IV)ret);
566     }
567     XSRETURN(1);
568 #else
569     c_fun_not_there("box");
570     XSRETURN(0);
571 #endif
572 }
573 
XS(XS_Curses_hline)574 XS(XS_Curses_hline)
575 {
576     dXSARGS;
577 #ifdef C_HLINE
578     c_countargs("hline", items, 2);
579     {
580     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
581     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
582     chtype  ch  = c_sv2chtype(ST(c_arg));
583     int n   = (int)SvIV(ST(c_arg+1));
584     int ret = c_mret == ERR ? ERR : whline(win, ch, n);
585 
586     ST(0) = sv_newmortal();
587     sv_setiv(ST(0), (IV)ret);
588     }
589     XSRETURN(1);
590 #else
591     c_fun_not_there("hline");
592     XSRETURN(0);
593 #endif
594 }
595 
XS(XS_Curses_vline)596 XS(XS_Curses_vline)
597 {
598     dXSARGS;
599 #ifdef C_VLINE
600     c_countargs("vline", items, 2);
601     {
602     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
603     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
604     chtype  ch  = c_sv2chtype(ST(c_arg));
605     int n   = (int)SvIV(ST(c_arg+1));
606     int ret = c_mret == ERR ? ERR : wvline(win, ch, n);
607 
608     ST(0) = sv_newmortal();
609     sv_setiv(ST(0), (IV)ret);
610     }
611     XSRETURN(1);
612 #else
613     c_fun_not_there("vline");
614     XSRETURN(0);
615 #endif
616 }
617 
618 
619 /* curs_clear */
620 
XS(XS_Curses_erase)621 XS(XS_Curses_erase)
622 {
623     dXSARGS;
624 #ifdef C_ERASE
625     c_countargs("erase", items, 0);
626     {
627     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
628     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
629     int ret = c_mret == ERR ? ERR : werase(win);
630 
631     ST(0) = sv_newmortal();
632     sv_setiv(ST(0), (IV)ret);
633     }
634     XSRETURN(1);
635 #else
636     c_fun_not_there("erase");
637     XSRETURN(0);
638 #endif
639 }
640 
XS(XS_Curses_clear)641 XS(XS_Curses_clear)
642 {
643     dXSARGS;
644 #ifdef C_CLEAR
645     c_countargs("clear", items, 0);
646     {
647     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
648     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
649     int ret = c_mret == ERR ? ERR : wclear(win);
650 
651     ST(0) = sv_newmortal();
652     sv_setiv(ST(0), (IV)ret);
653     }
654     XSRETURN(1);
655 #else
656     c_fun_not_there("clear");
657     XSRETURN(0);
658 #endif
659 }
660 
XS(XS_Curses_clrtobot)661 XS(XS_Curses_clrtobot)
662 {
663     dXSARGS;
664 #ifdef C_CLRTOBOT
665     c_countargs("clrtobot", items, 0);
666     {
667     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
668     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
669     int ret = c_mret == ERR ? ERR : wclrtobot(win);
670 
671     ST(0) = sv_newmortal();
672     sv_setiv(ST(0), (IV)ret);
673     }
674     XSRETURN(1);
675 #else
676     c_fun_not_there("clrtobot");
677     XSRETURN(0);
678 #endif
679 }
680 
XS(XS_Curses_clrtoeol)681 XS(XS_Curses_clrtoeol)
682 {
683     dXSARGS;
684 #ifdef C_CLRTOEOL
685     c_countargs("clrtoeol", items, 0);
686     {
687     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
688     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
689     int ret = c_mret == ERR ? ERR : wclrtoeol(win);
690 
691     ST(0) = sv_newmortal();
692     sv_setiv(ST(0), (IV)ret);
693     }
694     XSRETURN(1);
695 #else
696     c_fun_not_there("clrtoeol");
697     XSRETURN(0);
698 #endif
699 }
700 
701 
702 /* curs_color */
703 
XS(XS_Curses_start_color)704 XS(XS_Curses_start_color)
705 {
706     dXSARGS;
707 #ifdef C_START_COLOR
708     c_exactargs("start_color", items, 0);
709     {
710     int ret = start_color();
711 
712     ST(0) = sv_newmortal();
713     sv_setiv(ST(0), (IV)ret);
714     }
715     XSRETURN(1);
716 #else
717     c_fun_not_there("start_color");
718     XSRETURN(0);
719 #endif
720 }
721 
XS(XS_Curses_init_pair)722 XS(XS_Curses_init_pair)
723 {
724     dXSARGS;
725 #ifdef C_INIT_PAIR
726     c_exactargs("init_pair", items, 3);
727     {
728     short   pair    = (short)SvIV(ST(0));
729     short   f   = (short)SvIV(ST(1));
730     short   b   = (short)SvIV(ST(2));
731     int ret = init_pair(pair, f, b);
732 
733     ST(0) = sv_newmortal();
734     sv_setiv(ST(0), (IV)ret);
735     }
736     XSRETURN(1);
737 #else
738     c_fun_not_there("init_pair");
739     XSRETURN(0);
740 #endif
741 }
742 
XS(XS_Curses_init_color)743 XS(XS_Curses_init_color)
744 {
745     dXSARGS;
746 #ifdef C_INIT_COLOR
747     c_exactargs("init_color", items, 4);
748     {
749     short   color   = (short)SvIV(ST(0));
750     short   r   = (short)SvIV(ST(1));
751     short   g   = (short)SvIV(ST(2));
752     short   b   = (short)SvIV(ST(3));
753     int ret = init_color(color, r, g, b);
754 
755     ST(0) = sv_newmortal();
756     sv_setiv(ST(0), (IV)ret);
757     }
758     XSRETURN(1);
759 #else
760     c_fun_not_there("init_color");
761     XSRETURN(0);
762 #endif
763 }
764 
XS(XS_Curses_has_colors)765 XS(XS_Curses_has_colors)
766 {
767     dXSARGS;
768 #ifdef C_HAS_COLORS
769     c_exactargs("has_colors", items, 0);
770     {
771     bool    ret = has_colors();
772 
773     ST(0) = sv_newmortal();
774     sv_setiv(ST(0), (IV)ret);
775     }
776     XSRETURN(1);
777 #else
778     c_fun_not_there("has_colors");
779     XSRETURN(0);
780 #endif
781 }
782 
XS(XS_Curses_can_change_color)783 XS(XS_Curses_can_change_color)
784 {
785     dXSARGS;
786 #ifdef C_CAN_CHANGE_COLOR
787     c_exactargs("can_change_color", items, 0);
788     {
789     bool    ret = can_change_color();
790 
791     ST(0) = sv_newmortal();
792     sv_setiv(ST(0), (IV)ret);
793     }
794     XSRETURN(1);
795 #else
796     c_fun_not_there("can_change_color");
797     XSRETURN(0);
798 #endif
799 }
800 
XS(XS_Curses_color_content)801 XS(XS_Curses_color_content)
802 {
803     dXSARGS;
804 #ifdef C_COLOR_CONTENT
805     c_exactargs("color_content", items, 4);
806     {
807     short   color   = (short)SvIV(ST(0));
808     short   r   = 0;
809     short   g   = 0;
810     short   b   = 0;
811     int ret = color_content(color, &r, &g, &b);
812 
813     sv_setiv(ST(1), (IV)r);;
814     sv_setiv(ST(2), (IV)g);;
815     sv_setiv(ST(3), (IV)b);;
816     ST(0) = sv_newmortal();
817     sv_setiv(ST(0), (IV)ret);
818     }
819     XSRETURN(1);
820 #else
821     c_fun_not_there("color_content");
822     XSRETURN(0);
823 #endif
824 }
825 
XS(XS_Curses_pair_content)826 XS(XS_Curses_pair_content)
827 {
828     dXSARGS;
829 #ifdef C_PAIR_CONTENT
830     c_exactargs("pair_content", items, 3);
831     {
832     short   pair    = (short)SvIV(ST(0));
833     short   f   = 0;
834     short   b   = 0;
835     int ret = pair_content(pair, &f, &b);
836 
837     sv_setiv(ST(1), (IV)f);;
838     sv_setiv(ST(2), (IV)b);;
839     ST(0) = sv_newmortal();
840     sv_setiv(ST(0), (IV)ret);
841     }
842     XSRETURN(1);
843 #else
844     c_fun_not_there("pair_content");
845     XSRETURN(0);
846 #endif
847 }
848 
849 
850 /* curs_delch */
851 
XS(XS_Curses_delch)852 XS(XS_Curses_delch)
853 {
854     dXSARGS;
855 #ifdef C_DELCH
856     c_countargs("delch", items, 0);
857     {
858     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
859     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
860     int ret = c_mret == ERR ? ERR : wdelch(win);
861 
862     ST(0) = sv_newmortal();
863     sv_setiv(ST(0), (IV)ret);
864     }
865     XSRETURN(1);
866 #else
867     c_fun_not_there("delch");
868     XSRETURN(0);
869 #endif
870 }
871 
872 
873 /* curs_deleteln */
874 
XS(XS_Curses_deleteln)875 XS(XS_Curses_deleteln)
876 {
877     dXSARGS;
878 #ifdef C_DELETELN
879     c_countargs("deleteln", items, 0);
880     {
881     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
882     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
883     int ret = c_mret == ERR ? ERR : wdeleteln(win);
884 
885     ST(0) = sv_newmortal();
886     sv_setiv(ST(0), (IV)ret);
887     }
888     XSRETURN(1);
889 #else
890     c_fun_not_there("deleteln");
891     XSRETURN(0);
892 #endif
893 }
894 
XS(XS_Curses_insdelln)895 XS(XS_Curses_insdelln)
896 {
897     dXSARGS;
898 #ifdef C_INSDELLN
899     c_countargs("insdelln", items, 1);
900     {
901     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
902     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
903     int n   = (int)SvIV(ST(c_arg));
904     int ret = c_mret == ERR ? ERR : winsdelln(win, n);
905 
906     ST(0) = sv_newmortal();
907     sv_setiv(ST(0), (IV)ret);
908     }
909     XSRETURN(1);
910 #else
911     c_fun_not_there("insdelln");
912     XSRETURN(0);
913 #endif
914 }
915 
XS(XS_Curses_insertln)916 XS(XS_Curses_insertln)
917 {
918     dXSARGS;
919 #ifdef C_INSERTLN
920     c_countargs("insertln", items, 0);
921     {
922     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
923     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
924     int ret = c_mret == ERR ? ERR : winsertln(win);
925 
926     ST(0) = sv_newmortal();
927     sv_setiv(ST(0), (IV)ret);
928     }
929     XSRETURN(1);
930 #else
931     c_fun_not_there("insertln");
932     XSRETURN(0);
933 #endif
934 }
935 
936 
937 /* curs_getch */
938 
XS(XS_Curses_getch)939 XS(XS_Curses_getch)
940 {
941     dXSARGS;
942 #ifdef C_GETCH
943     c_countargs("getch", items, 0);
944     {
945     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
946     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
947     chtype  ret = c_mret == ERR ? ERR : wgetch(win);
948 
949     ST(0) = sv_newmortal();
950     c_chtype2sv(ST(0), ret);
951     }
952     XSRETURN(1);
953 #else
954     c_fun_not_there("getch");
955     XSRETURN(0);
956 #endif
957 }
958 
XS(XS_Curses_ungetch)959 XS(XS_Curses_ungetch)
960 {
961     dXSARGS;
962 #ifdef C_UNGETCH
963     c_exactargs("ungetch", items, 1);
964     {
965     chtype  ch  = c_sv2chtype(ST(0));
966     int ret = ungetch(ch);
967 
968     ST(0) = sv_newmortal();
969     sv_setiv(ST(0), (IV)ret);
970     }
971     XSRETURN(1);
972 #else
973     c_fun_not_there("ungetch");
974     XSRETURN(0);
975 #endif
976 }
977 
XS(XS_Curses_has_key)978 XS(XS_Curses_has_key)
979 {
980     dXSARGS;
981 #ifdef C_HAS_KEY
982     c_exactargs("has_key", items, 1);
983     {
984     int ch  = (int)SvIV(ST(0));
985     int ret = has_key(ch);
986 
987     ST(0) = sv_newmortal();
988     sv_setiv(ST(0), (IV)ret);
989     }
990     XSRETURN(1);
991 #else
992     c_fun_not_there("has_key");
993     XSRETURN(0);
994 #endif
995 }
996 
XS(XS_Curses_KEY_F)997 XS(XS_Curses_KEY_F)
998 {
999     dXSARGS;
1000 #ifdef C_KEY_F
1001     c_exactargs("KEY_F", items, 1);
1002     {
1003     int n   = (int)SvIV(ST(0));
1004     chtype  ret = KEY_F(n);
1005 
1006     ST(0) = sv_newmortal();
1007     c_chtype2sv(ST(0), ret);
1008     }
1009     XSRETURN(1);
1010 #else
1011     c_fun_not_there("KEY_F");
1012     XSRETURN(0);
1013 #endif
1014 }
1015 
1016 
1017 /* curs_getstr */
1018 
XS(XS_Curses_getstr)1019 XS(XS_Curses_getstr)
1020 {
1021     dXSARGS;
1022 #ifdef C_GETSTR
1023     c_countargs("getstr", items, 1);
1024     {
1025     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1026     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1027     char *  str = (char *)sv_grow(ST(c_arg), 250);
1028     int ret = c_mret == ERR ? ERR : wgetstr(win, str);
1029 
1030     c_setchar(ST(c_arg), str);
1031     ST(0) = sv_newmortal();
1032     sv_setiv(ST(0), (IV)ret);
1033     }
1034     XSRETURN(1);
1035 #else
1036     c_fun_not_there("getstr");
1037     XSRETURN(0);
1038 #endif
1039 }
1040 
XS(XS_Curses_getnstr)1041 XS(XS_Curses_getnstr)
1042 {
1043     dXSARGS;
1044 #ifdef C_GETNSTR
1045     c_countargs("getnstr", items, 2);
1046     {
1047     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1048     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1049     int n   = (int)SvIV(ST(c_arg+1));
1050     char *  str = (char *)sv_grow(ST(c_arg), n+1);
1051     int ret = c_mret == ERR ? ERR : wgetnstr(win, str, n);
1052 
1053     c_setchar(ST(c_arg), str);
1054     ST(0) = sv_newmortal();
1055     sv_setiv(ST(0), (IV)ret);
1056     }
1057     XSRETURN(1);
1058 #else
1059     c_fun_not_there("getnstr");
1060     XSRETURN(0);
1061 #endif
1062 }
1063 
1064 
1065 /* curs_getyx */
1066 
XS(XS_Curses_getyx)1067 XS(XS_Curses_getyx)
1068 {
1069     dXSARGS;
1070 #ifdef C_GETYX
1071     c_countargs("getyx", items, 2);
1072     {
1073     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1074     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1075     int y   = 0;
1076     int x   = 0;
1077 
1078     if (c_mret == OK) { getyx(win, y, x); }
1079     sv_setiv(ST(c_arg), (IV)y);;
1080     sv_setiv(ST(c_arg+1), (IV)x);;
1081     }
1082     XSRETURN(0);
1083 #else
1084     c_fun_not_there("getyx");
1085     XSRETURN(0);
1086 #endif
1087 }
1088 
XS(XS_Curses_getparyx)1089 XS(XS_Curses_getparyx)
1090 {
1091     dXSARGS;
1092 #ifdef C_GETPARYX
1093     c_countargs("getparyx", items, 2);
1094     {
1095     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1096     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1097     int y   = 0;
1098     int x   = 0;
1099 
1100     if (c_mret == OK) { getparyx(win, y, x); }
1101     sv_setiv(ST(c_arg), (IV)y);;
1102     sv_setiv(ST(c_arg+1), (IV)x);;
1103     }
1104     XSRETURN(0);
1105 #else
1106     c_fun_not_there("getparyx");
1107     XSRETURN(0);
1108 #endif
1109 }
1110 
XS(XS_Curses_getbegyx)1111 XS(XS_Curses_getbegyx)
1112 {
1113     dXSARGS;
1114 #ifdef C_GETBEGYX
1115     c_countargs("getbegyx", items, 2);
1116     {
1117     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1118     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1119     int y   = 0;
1120     int x   = 0;
1121 
1122     if (c_mret == OK) { getbegyx(win, y, x); }
1123     sv_setiv(ST(c_arg), (IV)y);;
1124     sv_setiv(ST(c_arg+1), (IV)x);;
1125     }
1126     XSRETURN(0);
1127 #else
1128     c_fun_not_there("getbegyx");
1129     XSRETURN(0);
1130 #endif
1131 }
1132 
XS(XS_Curses_getmaxyx)1133 XS(XS_Curses_getmaxyx)
1134 {
1135     dXSARGS;
1136 #ifdef C_GETMAXYX
1137     c_countargs("getmaxyx", items, 2);
1138     {
1139     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1140     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1141     int y   = 0;
1142     int x   = 0;
1143 
1144     if (c_mret == OK) { getmaxyx(win, y, x); }
1145     sv_setiv(ST(c_arg), (IV)y);;
1146     sv_setiv(ST(c_arg+1), (IV)x);;
1147     }
1148     XSRETURN(0);
1149 #else
1150     c_fun_not_there("getmaxyx");
1151     XSRETURN(0);
1152 #endif
1153 }
1154 
1155 
1156 /* curs_inch */
1157 
XS(XS_Curses_inch)1158 XS(XS_Curses_inch)
1159 {
1160     dXSARGS;
1161 #ifdef C_INCH
1162     c_countargs("inch", items, 0);
1163     {
1164     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1165     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1166     chtype  ret = c_mret == ERR ? ERR : winch(win);
1167 
1168     ST(0) = sv_newmortal();
1169     c_chtype2sv(ST(0), ret);
1170     }
1171     XSRETURN(1);
1172 #else
1173     c_fun_not_there("inch");
1174     XSRETURN(0);
1175 #endif
1176 }
1177 
1178 
1179 /* curs_inchstr */
1180 
XS(XS_Curses_inchstr)1181 XS(XS_Curses_inchstr)
1182 {
1183     dXSARGS;
1184 #ifdef C_INCHSTR
1185     c_countargs("inchstr", items, 1);
1186     {
1187     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1188     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1189     chtype *str = (chtype *)sv_grow(ST(c_arg), (250)*sizeof(chtype));
1190     int ret = c_mret == ERR ? ERR : winchstr(win, str);
1191 
1192     c_setchtype(ST(c_arg), str);
1193     ST(0) = sv_newmortal();
1194     sv_setiv(ST(0), (IV)ret);
1195     }
1196     XSRETURN(1);
1197 #else
1198     c_fun_not_there("inchstr");
1199     XSRETURN(0);
1200 #endif
1201 }
1202 
XS(XS_Curses_inchnstr)1203 XS(XS_Curses_inchnstr)
1204 {
1205     dXSARGS;
1206 #ifdef C_INCHNSTR
1207     c_countargs("inchnstr", items, 2);
1208     {
1209     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1210     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1211     int n   = (int)SvIV(ST(c_arg+1));
1212     chtype *str = (chtype *)sv_grow(ST(c_arg), (n+1)*sizeof(chtype));
1213     int ret = c_mret == ERR ? ERR : winchnstr(win, str, n);
1214 
1215     c_setchtype(ST(c_arg), str);
1216     ST(0) = sv_newmortal();
1217     sv_setiv(ST(0), (IV)ret);
1218     }
1219     XSRETURN(1);
1220 #else
1221     c_fun_not_there("inchnstr");
1222     XSRETURN(0);
1223 #endif
1224 }
1225 
1226 
1227 /* curs_initscr */
1228 
XS(XS_Curses_initscr)1229 XS(XS_Curses_initscr)
1230 {
1231     dXSARGS;
1232 #ifdef C_INITSCR
1233     c_exactargs("initscr", items, 0);
1234     {
1235     WINDOW *    ret = initscr();
1236 
1237     ST(0) = sv_newmortal();
1238     c_window2sv(ST(0), ret);
1239     }
1240     XSRETURN(1);
1241 #else
1242     c_fun_not_there("initscr");
1243     XSRETURN(0);
1244 #endif
1245 }
1246 
XS(XS_Curses_endwin)1247 XS(XS_Curses_endwin)
1248 {
1249     dXSARGS;
1250 #ifdef C_ENDWIN
1251     c_exactargs("endwin", items, 0);
1252     {
1253     int ret = endwin();
1254 
1255     ST(0) = sv_newmortal();
1256     sv_setiv(ST(0), (IV)ret);
1257     }
1258     XSRETURN(1);
1259 #else
1260     c_fun_not_there("endwin");
1261     XSRETURN(0);
1262 #endif
1263 }
1264 
XS(XS_Curses_isendwin)1265 XS(XS_Curses_isendwin)
1266 {
1267     dXSARGS;
1268 #ifdef C_ISENDWIN
1269     c_exactargs("isendwin", items, 0);
1270     {
1271     int ret = isendwin();
1272 
1273     ST(0) = sv_newmortal();
1274     sv_setiv(ST(0), (IV)ret);
1275     }
1276     XSRETURN(1);
1277 #else
1278     c_fun_not_there("isendwin");
1279     XSRETURN(0);
1280 #endif
1281 }
1282 
XS(XS_Curses_newterm)1283 XS(XS_Curses_newterm)
1284 {
1285     dXSARGS;
1286 #ifdef C_NEWTERM
1287     c_exactargs("newterm", items, 3);
1288     {
1289     char *  type    = ST(0) != &PL_sv_undef ? (char *)SvPV_nolen(ST(0)) : NULL;
1290 
1291     /* IoIFP() returns a FILE * with some Perl cores, and PerlIo with
1292        others.  We need FILE *.  PerlIO_findFILE() takes either a FILE * or
1293        PerlIo as input and returns a FILE *.
1294     */
1295     FILE *  outfd   = PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
1296     FILE *  infd    = PerlIO_findFILE(IoIFP(sv_2io(ST(2))));
1297     SCREEN *    ret = newterm(type, outfd, infd);
1298 
1299     ST(0) = sv_newmortal();
1300     c_screen2sv(ST(0), ret);
1301     }
1302     XSRETURN(1);
1303 #else
1304     c_fun_not_there("newterm");
1305     XSRETURN(0);
1306 #endif
1307 }
1308 
XS(XS_Curses_set_term)1309 XS(XS_Curses_set_term)
1310 {
1311     dXSARGS;
1312 #ifdef C_SET_TERM
1313     c_exactargs("set_term", items, 1);
1314     {
1315     SCREEN *new = c_sv2screen(ST(0), 0);
1316     SCREEN *    ret = set_term(new);
1317 
1318     ST(0) = sv_newmortal();
1319     c_screen2sv(ST(0), ret);
1320     }
1321     XSRETURN(1);
1322 #else
1323     c_fun_not_there("set_term");
1324     XSRETURN(0);
1325 #endif
1326 }
1327 
XS(XS_Curses_delscreen)1328 XS(XS_Curses_delscreen)
1329 {
1330     dXSARGS;
1331 #ifdef C_DELSCREEN
1332     c_exactargs("delscreen", items, 1);
1333     {
1334     SCREEN *sp  = c_sv2screen(ST(0), 0);
1335 
1336     delscreen(sp);
1337     }
1338     XSRETURN(0);
1339 #else
1340     c_fun_not_there("delscreen");
1341     XSRETURN(0);
1342 #endif
1343 }
1344 
1345 
1346 /* curs_inopts */
1347 
1348 #ifdef C_INTCBREAK
XS(XS_Curses_cbreak)1349 XS(XS_Curses_cbreak)
1350 {
1351     dXSARGS;
1352 #ifdef C_CBREAK
1353     c_exactargs("cbreak", items, 0);
1354     {
1355     int ret = cbreak();
1356 
1357     ST(0) = sv_newmortal();
1358     sv_setiv(ST(0), (IV)ret);
1359     }
1360     XSRETURN(1);
1361 #else
1362     c_fun_not_there("cbreak");
1363     XSRETURN(0);
1364 #endif
1365 }
1366 
1367 #else
XS(XS_Curses_cbreak)1368 XS(XS_Curses_cbreak)
1369 {
1370     dXSARGS;
1371 #ifdef C_CBREAK
1372     c_exactargs("cbreak", items, 0);
1373     {
1374     cbreak();
1375     }
1376     XSRETURN(0);
1377 #else
1378     c_fun_not_there("cbreak");
1379     XSRETURN(0);
1380 #endif
1381 }
1382 
1383 #endif
1384 #ifdef C_INTNOCBREAK
XS(XS_Curses_nocbreak)1385 XS(XS_Curses_nocbreak)
1386 {
1387     dXSARGS;
1388 #ifdef C_NOCBREAK
1389     c_exactargs("nocbreak", items, 0);
1390     {
1391     int ret = nocbreak();
1392 
1393     ST(0) = sv_newmortal();
1394     sv_setiv(ST(0), (IV)ret);
1395     }
1396     XSRETURN(1);
1397 #else
1398     c_fun_not_there("nocbreak");
1399     XSRETURN(0);
1400 #endif
1401 }
1402 
1403 #else
XS(XS_Curses_nocbreak)1404 XS(XS_Curses_nocbreak)
1405 {
1406     dXSARGS;
1407 #ifdef C_NOCBREAK
1408     c_exactargs("nocbreak", items, 0);
1409     {
1410     nocbreak();
1411     }
1412     XSRETURN(0);
1413 #else
1414     c_fun_not_there("nocbreak");
1415     XSRETURN(0);
1416 #endif
1417 }
1418 
1419 #endif
1420 #ifdef C_INTECHO
XS(XS_Curses_echo)1421 XS(XS_Curses_echo)
1422 {
1423     dXSARGS;
1424 #ifdef C_ECHO
1425     c_exactargs("echo", items, 0);
1426     {
1427     int ret = echo();
1428 
1429     ST(0) = sv_newmortal();
1430     sv_setiv(ST(0), (IV)ret);
1431     }
1432     XSRETURN(1);
1433 #else
1434     c_fun_not_there("echo");
1435     XSRETURN(0);
1436 #endif
1437 }
1438 
1439 #else
XS(XS_Curses_echo)1440 XS(XS_Curses_echo)
1441 {
1442     dXSARGS;
1443 #ifdef C_ECHO
1444     c_exactargs("echo", items, 0);
1445     {
1446     echo();
1447     }
1448     XSRETURN(0);
1449 #else
1450     c_fun_not_there("echo");
1451     XSRETURN(0);
1452 #endif
1453 }
1454 
1455 #endif
1456 #ifdef C_INTNOECHO
XS(XS_Curses_noecho)1457 XS(XS_Curses_noecho)
1458 {
1459     dXSARGS;
1460 #ifdef C_NOECHO
1461     c_exactargs("noecho", items, 0);
1462     {
1463     int ret = noecho();
1464 
1465     ST(0) = sv_newmortal();
1466     sv_setiv(ST(0), (IV)ret);
1467     }
1468     XSRETURN(1);
1469 #else
1470     c_fun_not_there("noecho");
1471     XSRETURN(0);
1472 #endif
1473 }
1474 
1475 #else
XS(XS_Curses_noecho)1476 XS(XS_Curses_noecho)
1477 {
1478     dXSARGS;
1479 #ifdef C_NOECHO
1480     c_exactargs("noecho", items, 0);
1481     {
1482     noecho();
1483     }
1484     XSRETURN(0);
1485 #else
1486     c_fun_not_there("noecho");
1487     XSRETURN(0);
1488 #endif
1489 }
1490 
1491 #endif
XS(XS_Curses_halfdelay)1492 XS(XS_Curses_halfdelay)
1493 {
1494     dXSARGS;
1495 #ifdef C_HALFDELAY
1496     c_exactargs("halfdelay", items, 1);
1497     {
1498     int tenths  = (int)SvIV(ST(0));
1499     int ret = halfdelay(tenths);
1500 
1501     ST(0) = sv_newmortal();
1502     sv_setiv(ST(0), (IV)ret);
1503     }
1504     XSRETURN(1);
1505 #else
1506     c_fun_not_there("halfdelay");
1507     XSRETURN(0);
1508 #endif
1509 }
1510 
XS(XS_Curses_intrflush)1511 XS(XS_Curses_intrflush)
1512 {
1513     dXSARGS;
1514 #ifdef C_INTRFLUSH
1515     c_countargs("intrflush", items, 1);
1516     {
1517     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1518     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1519     bool    bf  = (int)SvIV(ST(c_arg));
1520     int ret = c_mret == ERR ? ERR : intrflush(win, bf);
1521 
1522     ST(0) = sv_newmortal();
1523     sv_setiv(ST(0), (IV)ret);
1524     }
1525     XSRETURN(1);
1526 #else
1527     c_fun_not_there("intrflush");
1528     XSRETURN(0);
1529 #endif
1530 }
1531 
XS(XS_Curses_keypad)1532 XS(XS_Curses_keypad)
1533 {
1534     dXSARGS;
1535 #ifdef C_KEYPAD
1536     c_countargs("keypad", items, 1);
1537     {
1538     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1539     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1540     bool    bf  = (int)SvIV(ST(c_arg));
1541     int ret = c_mret == ERR ? ERR : keypad(win, bf);
1542 
1543     ST(0) = sv_newmortal();
1544     sv_setiv(ST(0), (IV)ret);
1545     }
1546     XSRETURN(1);
1547 #else
1548     c_fun_not_there("keypad");
1549     XSRETURN(0);
1550 #endif
1551 }
1552 
XS(XS_Curses_meta)1553 XS(XS_Curses_meta)
1554 {
1555     dXSARGS;
1556 #ifdef C_META
1557     c_countargs("meta", items, 1);
1558     {
1559     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1560     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1561     bool    bf  = (int)SvIV(ST(c_arg));
1562     int ret = c_mret == ERR ? ERR : meta(win, bf);
1563 
1564     ST(0) = sv_newmortal();
1565     sv_setiv(ST(0), (IV)ret);
1566     }
1567     XSRETURN(1);
1568 #else
1569     c_fun_not_there("meta");
1570     XSRETURN(0);
1571 #endif
1572 }
1573 
XS(XS_Curses_nodelay)1574 XS(XS_Curses_nodelay)
1575 {
1576     dXSARGS;
1577 #ifdef C_NODELAY
1578     c_countargs("nodelay", items, 1);
1579     {
1580     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1581     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1582     bool    bf  = (int)SvIV(ST(c_arg));
1583     int ret = c_mret == ERR ? ERR : nodelay(win, bf);
1584 
1585     ST(0) = sv_newmortal();
1586     sv_setiv(ST(0), (IV)ret);
1587     }
1588     XSRETURN(1);
1589 #else
1590     c_fun_not_there("nodelay");
1591     XSRETURN(0);
1592 #endif
1593 }
1594 
XS(XS_Curses_notimeout)1595 XS(XS_Curses_notimeout)
1596 {
1597     dXSARGS;
1598 #ifdef C_NOTIMEOUT
1599     c_countargs("notimeout", items, 1);
1600     {
1601     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1602     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1603     bool    bf  = (int)SvIV(ST(c_arg));
1604     int ret = c_mret == ERR ? ERR : notimeout(win, bf);
1605 
1606     ST(0) = sv_newmortal();
1607     sv_setiv(ST(0), (IV)ret);
1608     }
1609     XSRETURN(1);
1610 #else
1611     c_fun_not_there("notimeout");
1612     XSRETURN(0);
1613 #endif
1614 }
1615 
1616 #ifdef C_INTRAW
XS(XS_Curses_raw)1617 XS(XS_Curses_raw)
1618 {
1619     dXSARGS;
1620 #ifdef C_RAW
1621     c_exactargs("raw", items, 0);
1622     {
1623     int ret = raw();
1624 
1625     ST(0) = sv_newmortal();
1626     sv_setiv(ST(0), (IV)ret);
1627     }
1628     XSRETURN(1);
1629 #else
1630     c_fun_not_there("raw");
1631     XSRETURN(0);
1632 #endif
1633 }
1634 
1635 #else
XS(XS_Curses_raw)1636 XS(XS_Curses_raw)
1637 {
1638     dXSARGS;
1639 #ifdef C_RAW
1640     c_exactargs("raw", items, 0);
1641     {
1642     raw();
1643     }
1644     XSRETURN(0);
1645 #else
1646     c_fun_not_there("raw");
1647     XSRETURN(0);
1648 #endif
1649 }
1650 
1651 #endif
1652 #ifdef C_INTNORAW
XS(XS_Curses_noraw)1653 XS(XS_Curses_noraw)
1654 {
1655     dXSARGS;
1656 #ifdef C_NORAW
1657     c_exactargs("noraw", items, 0);
1658     {
1659     int ret = noraw();
1660 
1661     ST(0) = sv_newmortal();
1662     sv_setiv(ST(0), (IV)ret);
1663     }
1664     XSRETURN(1);
1665 #else
1666     c_fun_not_there("noraw");
1667     XSRETURN(0);
1668 #endif
1669 }
1670 
1671 #else
XS(XS_Curses_noraw)1672 XS(XS_Curses_noraw)
1673 {
1674     dXSARGS;
1675 #ifdef C_NORAW
1676     c_exactargs("noraw", items, 0);
1677     {
1678     noraw();
1679     }
1680     XSRETURN(0);
1681 #else
1682     c_fun_not_there("noraw");
1683     XSRETURN(0);
1684 #endif
1685 }
1686 
1687 #endif
XS(XS_Curses_qiflush)1688 XS(XS_Curses_qiflush)
1689 {
1690     dXSARGS;
1691 #ifdef C_QIFLUSH
1692     c_exactargs("qiflush", items, 0);
1693     {
1694     qiflush();
1695     }
1696     XSRETURN(0);
1697 #else
1698     c_fun_not_there("qiflush");
1699     XSRETURN(0);
1700 #endif
1701 }
1702 
XS(XS_Curses_noqiflush)1703 XS(XS_Curses_noqiflush)
1704 {
1705     dXSARGS;
1706 #ifdef C_NOQIFLUSH
1707     c_exactargs("noqiflush", items, 0);
1708     {
1709     noqiflush();
1710     }
1711     XSRETURN(0);
1712 #else
1713     c_fun_not_there("noqiflush");
1714     XSRETURN(0);
1715 #endif
1716 }
1717 
XS(XS_Curses_timeout)1718 XS(XS_Curses_timeout)
1719 {
1720     dXSARGS;
1721 #ifdef C_TIMEOUT
1722     c_countargs("timeout", items, 1);
1723     {
1724     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1725     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1726     int delay   = (int)SvIV(ST(c_arg));
1727 
1728     if (c_mret == OK) { wtimeout(win, delay); }
1729     }
1730     XSRETURN(0);
1731 #else
1732     c_fun_not_there("timeout");
1733     XSRETURN(0);
1734 #endif
1735 }
1736 
XS(XS_Curses_typeahead)1737 XS(XS_Curses_typeahead)
1738 {
1739     dXSARGS;
1740 #ifdef C_TYPEAHEAD
1741     c_exactargs("typeahead", items, 1);
1742     {
1743     int fd  = (int)SvIV(ST(0));
1744     int ret = typeahead(fd);
1745 
1746     ST(0) = sv_newmortal();
1747     sv_setiv(ST(0), (IV)ret);
1748     }
1749     XSRETURN(1);
1750 #else
1751     c_fun_not_there("typeahead");
1752     XSRETURN(0);
1753 #endif
1754 }
1755 
1756 
1757 /* curs_insch */
1758 
XS(XS_Curses_insch)1759 XS(XS_Curses_insch)
1760 {
1761     dXSARGS;
1762 #ifdef C_INSCH
1763     c_countargs("insch", items, 1);
1764     {
1765     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1766     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1767     chtype  ch  = c_sv2chtype(ST(c_arg));
1768     int ret = c_mret == ERR ? ERR : winsch(win, ch);
1769 
1770     ST(0) = sv_newmortal();
1771     sv_setiv(ST(0), (IV)ret);
1772     }
1773     XSRETURN(1);
1774 #else
1775     c_fun_not_there("insch");
1776     XSRETURN(0);
1777 #endif
1778 }
1779 
1780 
1781 /* curs_insstr */
1782 
XS(XS_Curses_insstr)1783 XS(XS_Curses_insstr)
1784 {
1785     dXSARGS;
1786 #ifdef C_INSSTR
1787     c_countargs("insstr", items, 1);
1788     {
1789     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1790     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1791     char *  str = (char *)SvPV_nolen(ST(c_arg));
1792     int ret = c_mret == ERR ? ERR : winsstr(win, str);
1793 
1794     ST(0) = sv_newmortal();
1795     sv_setiv(ST(0), (IV)ret);
1796     }
1797     XSRETURN(1);
1798 #else
1799     c_fun_not_there("insstr");
1800     XSRETURN(0);
1801 #endif
1802 }
1803 
XS(XS_Curses_insnstr)1804 XS(XS_Curses_insnstr)
1805 {
1806     dXSARGS;
1807 #ifdef C_INSNSTR
1808     c_countargs("insnstr", items, 2);
1809     {
1810     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1811     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1812     char *  str = (char *)SvPV_nolen(ST(c_arg));
1813     int n   = (int)SvIV(ST(c_arg+1));
1814     int ret = c_mret == ERR ? ERR : winsnstr(win, str, n);
1815 
1816     ST(0) = sv_newmortal();
1817     sv_setiv(ST(0), (IV)ret);
1818     }
1819     XSRETURN(1);
1820 #else
1821     c_fun_not_there("insnstr");
1822     XSRETURN(0);
1823 #endif
1824 }
1825 
1826 
1827 /* curs_instr */
1828 
XS(XS_Curses_instr)1829 XS(XS_Curses_instr)
1830 {
1831     dXSARGS;
1832 #ifdef C_INSTR
1833     c_countargs("instr", items, 1);
1834     {
1835     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1836     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1837     char *  str = (char *)sv_grow(ST(c_arg), 250);
1838     int ret = c_mret == ERR ? ERR : winstr(win, str);
1839 
1840     c_setchar(ST(c_arg), str);
1841     ST(0) = sv_newmortal();
1842     sv_setiv(ST(0), (IV)ret);
1843     }
1844     XSRETURN(1);
1845 #else
1846     c_fun_not_there("instr");
1847     XSRETURN(0);
1848 #endif
1849 }
1850 
XS(XS_Curses_innstr)1851 XS(XS_Curses_innstr)
1852 {
1853     dXSARGS;
1854 #ifdef C_INNSTR
1855     c_countargs("innstr", items, 2);
1856     {
1857     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
1858     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
1859     int n   = (int)SvIV(ST(c_arg+1));
1860     char *  str = (char *)sv_grow(ST(c_arg), n+1);
1861     int ret = c_mret == ERR ? ERR : winnstr(win, str, n);
1862 
1863     c_setchar(ST(c_arg), str);
1864     ST(0) = sv_newmortal();
1865     sv_setiv(ST(0), (IV)ret);
1866     }
1867     XSRETURN(1);
1868 #else
1869     c_fun_not_there("innstr");
1870     XSRETURN(0);
1871 #endif
1872 }
1873 
1874 
1875 /* curs_kernel */
1876 
XS(XS_Curses_def_prog_mode)1877 XS(XS_Curses_def_prog_mode)
1878 {
1879     dXSARGS;
1880 #ifdef C_DEF_PROG_MODE
1881     c_exactargs("def_prog_mode", items, 0);
1882     {
1883     int ret = def_prog_mode();
1884 
1885     ST(0) = sv_newmortal();
1886     sv_setiv(ST(0), (IV)ret);
1887     }
1888     XSRETURN(1);
1889 #else
1890     c_fun_not_there("def_prog_mode");
1891     XSRETURN(0);
1892 #endif
1893 }
1894 
XS(XS_Curses_def_shell_mode)1895 XS(XS_Curses_def_shell_mode)
1896 {
1897     dXSARGS;
1898 #ifdef C_DEF_SHELL_MODE
1899     c_exactargs("def_shell_mode", items, 0);
1900     {
1901     int ret = def_shell_mode();
1902 
1903     ST(0) = sv_newmortal();
1904     sv_setiv(ST(0), (IV)ret);
1905     }
1906     XSRETURN(1);
1907 #else
1908     c_fun_not_there("def_shell_mode");
1909     XSRETURN(0);
1910 #endif
1911 }
1912 
XS(XS_Curses_reset_prog_mode)1913 XS(XS_Curses_reset_prog_mode)
1914 {
1915     dXSARGS;
1916 #ifdef C_RESET_PROG_MODE
1917     c_exactargs("reset_prog_mode", items, 0);
1918     {
1919     int ret = reset_prog_mode();
1920 
1921     ST(0) = sv_newmortal();
1922     sv_setiv(ST(0), (IV)ret);
1923     }
1924     XSRETURN(1);
1925 #else
1926     c_fun_not_there("reset_prog_mode");
1927     XSRETURN(0);
1928 #endif
1929 }
1930 
XS(XS_Curses_reset_shell_mode)1931 XS(XS_Curses_reset_shell_mode)
1932 {
1933     dXSARGS;
1934 #ifdef C_RESET_SHELL_MODE
1935     c_exactargs("reset_shell_mode", items, 0);
1936     {
1937     int ret = reset_shell_mode();
1938 
1939     ST(0) = sv_newmortal();
1940     sv_setiv(ST(0), (IV)ret);
1941     }
1942     XSRETURN(1);
1943 #else
1944     c_fun_not_there("reset_shell_mode");
1945     XSRETURN(0);
1946 #endif
1947 }
1948 
XS(XS_Curses_resetty)1949 XS(XS_Curses_resetty)
1950 {
1951     dXSARGS;
1952 #ifdef C_RESETTY
1953     c_exactargs("resetty", items, 0);
1954     {
1955     int ret = resetty();
1956 
1957     ST(0) = sv_newmortal();
1958     sv_setiv(ST(0), (IV)ret);
1959     }
1960     XSRETURN(1);
1961 #else
1962     c_fun_not_there("resetty");
1963     XSRETURN(0);
1964 #endif
1965 }
1966 
XS(XS_Curses_savetty)1967 XS(XS_Curses_savetty)
1968 {
1969     dXSARGS;
1970 #ifdef C_SAVETTY
1971     c_exactargs("savetty", items, 0);
1972     {
1973     int ret = savetty();
1974 
1975     ST(0) = sv_newmortal();
1976     sv_setiv(ST(0), (IV)ret);
1977     }
1978     XSRETURN(1);
1979 #else
1980     c_fun_not_there("savetty");
1981     XSRETURN(0);
1982 #endif
1983 }
1984 
1985 #ifdef C_INTGETSYX
XS(XS_Curses_getsyx)1986 XS(XS_Curses_getsyx)
1987 {
1988     dXSARGS;
1989 #ifdef C_GETSYX
1990     c_exactargs("getsyx", items, 2);
1991     {
1992     int y   = 0;
1993     int x   = 0;
1994     int ret = getsyx(y, x);
1995 
1996     sv_setiv(ST(0), (IV)y);;
1997     sv_setiv(ST(1), (IV)x);;
1998     ST(0) = sv_newmortal();
1999     sv_setiv(ST(0), (IV)ret);
2000     }
2001     XSRETURN(1);
2002 #else
2003     c_fun_not_there("getsyx");
2004     XSRETURN(0);
2005 #endif
2006 }
2007 
2008 #else
XS(XS_Curses_getsyx)2009 XS(XS_Curses_getsyx)
2010 {
2011     dXSARGS;
2012 #ifdef C_GETSYX
2013     c_exactargs("getsyx", items, 2);
2014     {
2015     int y   = 0;
2016     int x   = 0;
2017 
2018     getsyx(y, x);
2019     sv_setiv(ST(0), (IV)y);;
2020     sv_setiv(ST(1), (IV)x);;
2021     }
2022     XSRETURN(0);
2023 #else
2024     c_fun_not_there("getsyx");
2025     XSRETURN(0);
2026 #endif
2027 }
2028 
2029 #endif
2030 #ifdef C_INTSETSYX
XS(XS_Curses_setsyx)2031 XS(XS_Curses_setsyx)
2032 {
2033     dXSARGS;
2034 #ifdef C_SETSYX
2035     c_exactargs("setsyx", items, 2);
2036     {
2037     int y   = (int)SvIV(ST(0));
2038     int x   = (int)SvIV(ST(1));
2039     int ret = setsyx(y, x);
2040 
2041     ST(0) = sv_newmortal();
2042     sv_setiv(ST(0), (IV)ret);
2043     }
2044     XSRETURN(1);
2045 #else
2046     c_fun_not_there("setsyx");
2047     XSRETURN(0);
2048 #endif
2049 }
2050 
2051 #else
XS(XS_Curses_setsyx)2052 XS(XS_Curses_setsyx)
2053 {
2054     dXSARGS;
2055 #ifdef C_SETSYX
2056     c_exactargs("setsyx", items, 2);
2057     {
2058     int y   = (int)SvIV(ST(0));
2059     int x   = (int)SvIV(ST(1));
2060 
2061     setsyx(y, x);
2062     }
2063     XSRETURN(0);
2064 #else
2065     c_fun_not_there("setsyx");
2066     XSRETURN(0);
2067 #endif
2068 }
2069 
2070 #endif
XS(XS_Curses_curs_set)2071 XS(XS_Curses_curs_set)
2072 {
2073     dXSARGS;
2074 #ifdef C_CURS_SET
2075     c_exactargs("curs_set", items, 1);
2076     {
2077     int visibility  = (int)SvIV(ST(0));
2078     int ret = curs_set(visibility);
2079 
2080     ST(0) = sv_newmortal();
2081     sv_setiv(ST(0), (IV)ret);
2082     }
2083     XSRETURN(1);
2084 #else
2085     c_fun_not_there("curs_set");
2086     XSRETURN(0);
2087 #endif
2088 }
2089 
XS(XS_Curses_napms)2090 XS(XS_Curses_napms)
2091 {
2092     dXSARGS;
2093 #ifdef C_NAPMS
2094     c_exactargs("napms", items, 1);
2095     {
2096     int ms  = (int)SvIV(ST(0));
2097     int ret = napms(ms);
2098 
2099     ST(0) = sv_newmortal();
2100     sv_setiv(ST(0), (IV)ret);
2101     }
2102     XSRETURN(1);
2103 #else
2104     c_fun_not_there("napms");
2105     XSRETURN(0);
2106 #endif
2107 }
2108 
2109 
2110 /* curs_move */
2111 
XS(XS_Curses_move)2112 XS(XS_Curses_move)
2113 {
2114     dXSARGS;
2115 #ifdef C_MOVE
2116     c_countargs("move", items, 2);
2117     {
2118     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2119     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2120     int y   = (int)SvIV(ST(c_arg));
2121     int x   = (int)SvIV(ST(c_arg+1));
2122     int ret = c_mret == ERR ? ERR : wmove(win, y, x);
2123 
2124     ST(0) = sv_newmortal();
2125     sv_setiv(ST(0), (IV)ret);
2126     }
2127     XSRETURN(1);
2128 #else
2129     c_fun_not_there("move");
2130     XSRETURN(0);
2131 #endif
2132 }
2133 
2134 
2135 /* curs_outopts */
2136 
XS(XS_Curses_clearok)2137 XS(XS_Curses_clearok)
2138 {
2139     dXSARGS;
2140 #ifdef C_CLEAROK
2141     c_countargs("clearok", items, 1);
2142     {
2143     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2144     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2145     bool    bf  = (int)SvIV(ST(c_arg));
2146     int ret = c_mret == ERR ? ERR : clearok(win, bf);
2147 
2148     ST(0) = sv_newmortal();
2149     sv_setiv(ST(0), (IV)ret);
2150     }
2151     XSRETURN(1);
2152 #else
2153     c_fun_not_there("clearok");
2154     XSRETURN(0);
2155 #endif
2156 }
2157 
2158 #ifdef C_INTIDLOK
XS(XS_Curses_idlok)2159 XS(XS_Curses_idlok)
2160 {
2161     dXSARGS;
2162 #ifdef C_IDLOK
2163     c_countargs("idlok", items, 1);
2164     {
2165     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2166     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2167     bool    bf  = (int)SvIV(ST(c_arg));
2168     int ret = c_mret == ERR ? ERR : idlok(win, bf);
2169 
2170     ST(0) = sv_newmortal();
2171     sv_setiv(ST(0), (IV)ret);
2172     }
2173     XSRETURN(1);
2174 #else
2175     c_fun_not_there("idlok");
2176     XSRETURN(0);
2177 #endif
2178 }
2179 
2180 #else
XS(XS_Curses_idlok)2181 XS(XS_Curses_idlok)
2182 {
2183     dXSARGS;
2184 #ifdef C_IDLOK
2185     c_countargs("idlok", items, 1);
2186     {
2187     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2188     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2189     bool    bf  = (int)SvIV(ST(c_arg));
2190 
2191     if (c_mret == OK) { idlok(win, bf); }
2192     }
2193     XSRETURN(0);
2194 #else
2195     c_fun_not_there("idlok");
2196     XSRETURN(0);
2197 #endif
2198 }
2199 
2200 #endif
XS(XS_Curses_idcok)2201 XS(XS_Curses_idcok)
2202 {
2203     dXSARGS;
2204 #ifdef C_IDCOK
2205     c_countargs("idcok", items, 1);
2206     {
2207     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2208     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2209     bool    bf  = (int)SvIV(ST(c_arg));
2210 
2211     if (c_mret == OK) { idcok(win, bf); }
2212     }
2213     XSRETURN(0);
2214 #else
2215     c_fun_not_there("idcok");
2216     XSRETURN(0);
2217 #endif
2218 }
2219 
XS(XS_Curses_immedok)2220 XS(XS_Curses_immedok)
2221 {
2222     dXSARGS;
2223 #ifdef C_IMMEDOK
2224     c_countargs("immedok", items, 1);
2225     {
2226     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2227     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2228     bool    bf  = (int)SvIV(ST(c_arg));
2229 
2230     if (c_mret == OK) { immedok(win, bf); }
2231     }
2232     XSRETURN(0);
2233 #else
2234     c_fun_not_there("immedok");
2235     XSRETURN(0);
2236 #endif
2237 }
2238 
XS(XS_Curses_leaveok)2239 XS(XS_Curses_leaveok)
2240 {
2241     dXSARGS;
2242 #ifdef C_LEAVEOK
2243     c_countargs("leaveok", items, 1);
2244     {
2245     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2246     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2247     bool    bf  = (int)SvIV(ST(c_arg));
2248     int ret = c_mret == ERR ? ERR : leaveok(win, bf);
2249 
2250     ST(0) = sv_newmortal();
2251     sv_setiv(ST(0), (IV)ret);
2252     }
2253     XSRETURN(1);
2254 #else
2255     c_fun_not_there("leaveok");
2256     XSRETURN(0);
2257 #endif
2258 }
2259 
XS(XS_Curses_setscrreg)2260 XS(XS_Curses_setscrreg)
2261 {
2262     dXSARGS;
2263 #ifdef C_SETSCRREG
2264     c_countargs("setscrreg", items, 2);
2265     {
2266     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2267     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2268     int top = (int)SvIV(ST(c_arg));
2269     int bot = (int)SvIV(ST(c_arg+1));
2270     int ret = c_mret == ERR ? ERR : wsetscrreg(win, top, bot);
2271 
2272     ST(0) = sv_newmortal();
2273     sv_setiv(ST(0), (IV)ret);
2274     }
2275     XSRETURN(1);
2276 #else
2277     c_fun_not_there("setscrreg");
2278     XSRETURN(0);
2279 #endif
2280 }
2281 
XS(XS_Curses_scrollok)2282 XS(XS_Curses_scrollok)
2283 {
2284     dXSARGS;
2285 #ifdef C_SCROLLOK
2286     c_countargs("scrollok", items, 1);
2287     {
2288     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2289     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2290     bool    bf  = (int)SvIV(ST(c_arg));
2291     int ret = c_mret == ERR ? ERR : scrollok(win, bf);
2292 
2293     ST(0) = sv_newmortal();
2294     sv_setiv(ST(0), (IV)ret);
2295     }
2296     XSRETURN(1);
2297 #else
2298     c_fun_not_there("scrollok");
2299     XSRETURN(0);
2300 #endif
2301 }
2302 
2303 #ifdef C_INTNL
XS(XS_Curses_nl)2304 XS(XS_Curses_nl)
2305 {
2306     dXSARGS;
2307 #ifdef C_NL
2308     c_exactargs("nl", items, 0);
2309     {
2310     int ret = nl();
2311 
2312     ST(0) = sv_newmortal();
2313     sv_setiv(ST(0), (IV)ret);
2314     }
2315     XSRETURN(1);
2316 #else
2317     c_fun_not_there("nl");
2318     XSRETURN(0);
2319 #endif
2320 }
2321 
2322 #else
XS(XS_Curses_nl)2323 XS(XS_Curses_nl)
2324 {
2325     dXSARGS;
2326 #ifdef C_NL
2327     c_exactargs("nl", items, 0);
2328     {
2329     nl();
2330     }
2331     XSRETURN(0);
2332 #else
2333     c_fun_not_there("nl");
2334     XSRETURN(0);
2335 #endif
2336 }
2337 
2338 #endif
2339 #ifdef C_INTNONL
XS(XS_Curses_nonl)2340 XS(XS_Curses_nonl)
2341 {
2342     dXSARGS;
2343 #ifdef C_NONL
2344     c_exactargs("nonl", items, 0);
2345     {
2346     int ret = nonl();
2347 
2348     ST(0) = sv_newmortal();
2349     sv_setiv(ST(0), (IV)ret);
2350     }
2351     XSRETURN(1);
2352 #else
2353     c_fun_not_there("nonl");
2354     XSRETURN(0);
2355 #endif
2356 }
2357 
2358 #else
XS(XS_Curses_nonl)2359 XS(XS_Curses_nonl)
2360 {
2361     dXSARGS;
2362 #ifdef C_NONL
2363     c_exactargs("nonl", items, 0);
2364     {
2365     nonl();
2366     }
2367     XSRETURN(0);
2368 #else
2369     c_fun_not_there("nonl");
2370     XSRETURN(0);
2371 #endif
2372 }
2373 
2374 #endif
2375 
2376 /* curs_overlay */
2377 
XS(XS_Curses_overlay)2378 XS(XS_Curses_overlay)
2379 {
2380     dXSARGS;
2381 #ifdef C_OVERLAY
2382     c_exactargs("overlay", items, 2);
2383     {
2384     WINDOW *srcwin  = c_sv2window(ST(0), 0);
2385     WINDOW *dstwin  = c_sv2window(ST(1), 1);
2386     int ret = overlay(srcwin, dstwin);
2387 
2388     ST(0) = sv_newmortal();
2389     sv_setiv(ST(0), (IV)ret);
2390     }
2391     XSRETURN(1);
2392 #else
2393     c_fun_not_there("overlay");
2394     XSRETURN(0);
2395 #endif
2396 }
2397 
XS(XS_Curses_overwrite)2398 XS(XS_Curses_overwrite)
2399 {
2400     dXSARGS;
2401 #ifdef C_OVERWRITE
2402     c_exactargs("overwrite", items, 2);
2403     {
2404     WINDOW *srcwin  = c_sv2window(ST(0), 0);
2405     WINDOW *dstwin  = c_sv2window(ST(1), 1);
2406     int ret = overwrite(srcwin, dstwin);
2407 
2408     ST(0) = sv_newmortal();
2409     sv_setiv(ST(0), (IV)ret);
2410     }
2411     XSRETURN(1);
2412 #else
2413     c_fun_not_there("overwrite");
2414     XSRETURN(0);
2415 #endif
2416 }
2417 
XS(XS_Curses_copywin)2418 XS(XS_Curses_copywin)
2419 {
2420     dXSARGS;
2421 #ifdef C_COPYWIN
2422     c_exactargs("copywin", items, 9);
2423     {
2424     WINDOW *srcwin  = c_sv2window(ST(0), 0);
2425     WINDOW *dstwin  = c_sv2window(ST(1), 1);
2426     int sminrow = (int)SvIV(ST(2));
2427     int smincol = (int)SvIV(ST(3));
2428     int dminrow = (int)SvIV(ST(4));
2429     int dmincol = (int)SvIV(ST(5));
2430     int dmaxrow = (int)SvIV(ST(6));
2431     int dmaxcol = (int)SvIV(ST(7));
2432     int overlay = (int)SvIV(ST(8));
2433     int ret = copywin(srcwin, dstwin, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, overlay);
2434 
2435     ST(0) = sv_newmortal();
2436     sv_setiv(ST(0), (IV)ret);
2437     }
2438     XSRETURN(1);
2439 #else
2440     c_fun_not_there("copywin");
2441     XSRETURN(0);
2442 #endif
2443 }
2444 
2445 
2446 /* curs_pad */
2447 
XS(XS_Curses_newpad)2448 XS(XS_Curses_newpad)
2449 {
2450     dXSARGS;
2451 #ifdef C_NEWPAD
2452     c_exactargs("newpad", items, 2);
2453     {
2454     int lines_  = (int)SvIV(ST(0));
2455     int cols    = (int)SvIV(ST(1));
2456     WINDOW *    ret = newpad(lines_, cols);
2457 
2458     ST(0) = sv_newmortal();
2459     c_window2sv(ST(0), ret);
2460     }
2461     XSRETURN(1);
2462 #else
2463     c_fun_not_there("newpad");
2464     XSRETURN(0);
2465 #endif
2466 }
2467 
XS(XS_Curses_subpad)2468 XS(XS_Curses_subpad)
2469 {
2470     dXSARGS;
2471 #ifdef C_SUBPAD
2472     c_exactargs("subpad", items, 5);
2473     {
2474     WINDOW *orig    = c_sv2window(ST(0), 0);
2475     int lines_  = (int)SvIV(ST(1));
2476     int cols    = (int)SvIV(ST(2));
2477     int beginy  = (int)SvIV(ST(3));
2478     int beginx  = (int)SvIV(ST(4));
2479     WINDOW *    ret = subpad(orig, lines_, cols, beginy, beginx);
2480 
2481     ST(0) = sv_newmortal();
2482     c_window2sv(ST(0), ret);
2483     }
2484     XSRETURN(1);
2485 #else
2486     c_fun_not_there("subpad");
2487     XSRETURN(0);
2488 #endif
2489 }
2490 
XS(XS_Curses_prefresh)2491 XS(XS_Curses_prefresh)
2492 {
2493     dXSARGS;
2494 #ifdef C_PREFRESH
2495     c_exactargs("prefresh", items, 7);
2496     {
2497     WINDOW *pad = c_sv2window(ST(0), 0);
2498     int pminrow = (int)SvIV(ST(1));
2499     int pmincol = (int)SvIV(ST(2));
2500     int sminrow = (int)SvIV(ST(3));
2501     int smincol = (int)SvIV(ST(4));
2502     int smaxrow = (int)SvIV(ST(5));
2503     int smaxcol = (int)SvIV(ST(6));
2504     int ret = prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
2505 
2506     ST(0) = sv_newmortal();
2507     sv_setiv(ST(0), (IV)ret);
2508     }
2509     XSRETURN(1);
2510 #else
2511     c_fun_not_there("prefresh");
2512     XSRETURN(0);
2513 #endif
2514 }
2515 
XS(XS_Curses_pnoutrefresh)2516 XS(XS_Curses_pnoutrefresh)
2517 {
2518     dXSARGS;
2519 #ifdef C_PNOUTREFRESH
2520     c_exactargs("pnoutrefresh", items, 7);
2521     {
2522     WINDOW *pad = c_sv2window(ST(0), 0);
2523     int pminrow = (int)SvIV(ST(1));
2524     int pmincol = (int)SvIV(ST(2));
2525     int sminrow = (int)SvIV(ST(3));
2526     int smincol = (int)SvIV(ST(4));
2527     int smaxrow = (int)SvIV(ST(5));
2528     int smaxcol = (int)SvIV(ST(6));
2529     int ret = pnoutrefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
2530 
2531     ST(0) = sv_newmortal();
2532     sv_setiv(ST(0), (IV)ret);
2533     }
2534     XSRETURN(1);
2535 #else
2536     c_fun_not_there("pnoutrefresh");
2537     XSRETURN(0);
2538 #endif
2539 }
2540 
XS(XS_Curses_pechochar)2541 XS(XS_Curses_pechochar)
2542 {
2543     dXSARGS;
2544 #ifdef C_PECHOCHAR
2545     c_exactargs("pechochar", items, 2);
2546     {
2547     WINDOW *pad = c_sv2window(ST(0), 0);
2548     chtype  ch  = c_sv2chtype(ST(1));
2549     int ret = pechochar(pad, ch);
2550 
2551     ST(0) = sv_newmortal();
2552     sv_setiv(ST(0), (IV)ret);
2553     }
2554     XSRETURN(1);
2555 #else
2556     c_fun_not_there("pechochar");
2557     XSRETURN(0);
2558 #endif
2559 }
2560 
2561 
2562 /* curs_printw */
2563 
2564 /* done in perl */
2565 
2566 /* curs_refresh */
2567 
XS(XS_Curses_refresh)2568 XS(XS_Curses_refresh)
2569 {
2570     dXSARGS;
2571 #ifdef C_REFRESH
2572     c_countargs("refresh", items, 0);
2573     {
2574     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2575     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2576     int ret = c_mret == ERR ? ERR : wrefresh(win);
2577 
2578     ST(0) = sv_newmortal();
2579     sv_setiv(ST(0), (IV)ret);
2580     }
2581     XSRETURN(1);
2582 #else
2583     c_fun_not_there("refresh");
2584     XSRETURN(0);
2585 #endif
2586 }
2587 
XS(XS_Curses_noutrefresh)2588 XS(XS_Curses_noutrefresh)
2589 {
2590     dXSARGS;
2591 #ifdef C_NOUTREFRESH
2592     c_countargs("noutrefresh", items, 0);
2593     {
2594     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2595     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2596     int ret = c_mret == ERR ? ERR : wnoutrefresh(win);
2597 
2598     ST(0) = sv_newmortal();
2599     sv_setiv(ST(0), (IV)ret);
2600     }
2601     XSRETURN(1);
2602 #else
2603     c_fun_not_there("noutrefresh");
2604     XSRETURN(0);
2605 #endif
2606 }
2607 
XS(XS_Curses_doupdate)2608 XS(XS_Curses_doupdate)
2609 {
2610     dXSARGS;
2611 #ifdef C_DOUPDATE
2612     c_exactargs("doupdate", items, 0);
2613     {
2614     int ret = doupdate();
2615 
2616     ST(0) = sv_newmortal();
2617     sv_setiv(ST(0), (IV)ret);
2618     }
2619     XSRETURN(1);
2620 #else
2621     c_fun_not_there("doupdate");
2622     XSRETURN(0);
2623 #endif
2624 }
2625 
XS(XS_Curses_redrawwin)2626 XS(XS_Curses_redrawwin)
2627 {
2628     dXSARGS;
2629 #ifdef C_REDRAWWIN
2630     c_countargs("redrawwin", items, 0);
2631     {
2632     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2633     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2634     int ret = c_mret == ERR ? ERR : redrawwin(win);
2635 
2636     ST(0) = sv_newmortal();
2637     sv_setiv(ST(0), (IV)ret);
2638     }
2639     XSRETURN(1);
2640 #else
2641     c_fun_not_there("redrawwin");
2642     XSRETURN(0);
2643 #endif
2644 }
2645 
XS(XS_Curses_redrawln)2646 XS(XS_Curses_redrawln)
2647 {
2648     dXSARGS;
2649 #ifdef C_REDRAWLN
2650     c_countargs("redrawln", items, 2);
2651     {
2652     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2653     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2654     int beg_line    = (int)SvIV(ST(c_arg));
2655     int num_lines   = (int)SvIV(ST(c_arg+1));
2656     int ret = c_mret == ERR ? ERR : wredrawln(win, beg_line, num_lines);
2657 
2658     ST(0) = sv_newmortal();
2659     sv_setiv(ST(0), (IV)ret);
2660     }
2661     XSRETURN(1);
2662 #else
2663     c_fun_not_there("redrawln");
2664     XSRETURN(0);
2665 #endif
2666 }
2667 
2668 
2669 /* curs_scanw */
2670 
2671 /* done in perl */
2672 
2673 /* curs_scr_dump */
2674 
XS(XS_Curses_scr_dump)2675 XS(XS_Curses_scr_dump)
2676 {
2677     dXSARGS;
2678 #ifdef C_SCR_DUMP
2679     c_exactargs("scr_dump", items, 1);
2680     {
2681     char *  filename    = (char *)SvPV_nolen(ST(0));
2682     int ret = scr_dump(filename);
2683 
2684     ST(0) = sv_newmortal();
2685     sv_setiv(ST(0), (IV)ret);
2686     }
2687     XSRETURN(1);
2688 #else
2689     c_fun_not_there("scr_dump");
2690     XSRETURN(0);
2691 #endif
2692 }
2693 
XS(XS_Curses_scr_restore)2694 XS(XS_Curses_scr_restore)
2695 {
2696     dXSARGS;
2697 #ifdef C_SCR_RESTORE
2698     c_exactargs("scr_restore", items, 1);
2699     {
2700     char *  filename    = (char *)SvPV_nolen(ST(0));
2701     int ret = scr_restore(filename);
2702 
2703     ST(0) = sv_newmortal();
2704     sv_setiv(ST(0), (IV)ret);
2705     }
2706     XSRETURN(1);
2707 #else
2708     c_fun_not_there("scr_restore");
2709     XSRETURN(0);
2710 #endif
2711 }
2712 
XS(XS_Curses_scr_init)2713 XS(XS_Curses_scr_init)
2714 {
2715     dXSARGS;
2716 #ifdef C_SCR_INIT
2717     c_exactargs("scr_init", items, 1);
2718     {
2719     char *  filename    = (char *)SvPV_nolen(ST(0));
2720     int ret = scr_init(filename);
2721 
2722     ST(0) = sv_newmortal();
2723     sv_setiv(ST(0), (IV)ret);
2724     }
2725     XSRETURN(1);
2726 #else
2727     c_fun_not_there("scr_init");
2728     XSRETURN(0);
2729 #endif
2730 }
2731 
XS(XS_Curses_scr_set)2732 XS(XS_Curses_scr_set)
2733 {
2734     dXSARGS;
2735 #ifdef C_SCR_SET
2736     c_exactargs("scr_set", items, 1);
2737     {
2738     char *  filename    = (char *)SvPV_nolen(ST(0));
2739     int ret = scr_set(filename);
2740 
2741     ST(0) = sv_newmortal();
2742     sv_setiv(ST(0), (IV)ret);
2743     }
2744     XSRETURN(1);
2745 #else
2746     c_fun_not_there("scr_set");
2747     XSRETURN(0);
2748 #endif
2749 }
2750 
2751 
2752 /* curs_scroll */
2753 
XS(XS_Curses_scroll)2754 XS(XS_Curses_scroll)
2755 {
2756     dXSARGS;
2757 #ifdef C_SCROLL
2758     c_countargs("scroll", items, 0);
2759     {
2760     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2761     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2762     int ret = c_mret == ERR ? ERR : scroll(win);
2763 
2764     ST(0) = sv_newmortal();
2765     sv_setiv(ST(0), (IV)ret);
2766     }
2767     XSRETURN(1);
2768 #else
2769     c_fun_not_there("scroll");
2770     XSRETURN(0);
2771 #endif
2772 }
2773 
XS(XS_Curses_scrl)2774 XS(XS_Curses_scrl)
2775 {
2776     dXSARGS;
2777 #ifdef C_SCRL
2778     c_countargs("scrl", items, 1);
2779     {
2780     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
2781     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
2782     int n   = (int)SvIV(ST(c_arg));
2783     int ret = c_mret == ERR ? ERR : wscrl(win, n);
2784 
2785     ST(0) = sv_newmortal();
2786     sv_setiv(ST(0), (IV)ret);
2787     }
2788     XSRETURN(1);
2789 #else
2790     c_fun_not_there("scrl");
2791     XSRETURN(0);
2792 #endif
2793 }
2794 
2795 
2796 /* curs_slk */
2797 
XS(XS_Curses_slk_init)2798 XS(XS_Curses_slk_init)
2799 {
2800     dXSARGS;
2801 #ifdef C_SLK_INIT
2802     c_exactargs("slk_init", items, 1);
2803     {
2804     int fmt = (int)SvIV(ST(0));
2805     int ret = slk_init(fmt);
2806 
2807     ST(0) = sv_newmortal();
2808     sv_setiv(ST(0), (IV)ret);
2809     }
2810     XSRETURN(1);
2811 #else
2812     c_fun_not_there("slk_init");
2813     XSRETURN(0);
2814 #endif
2815 }
2816 
XS(XS_Curses_slk_set)2817 XS(XS_Curses_slk_set)
2818 {
2819     dXSARGS;
2820 #ifdef C_SLK_SET
2821     c_exactargs("slk_set", items, 3);
2822     {
2823     int labnum  = (int)SvIV(ST(0));
2824     char *  label   = (char *)SvPV_nolen(ST(1));
2825     int fmt = (int)SvIV(ST(2));
2826     int ret = slk_set(labnum, label, fmt);
2827 
2828     ST(0) = sv_newmortal();
2829     sv_setiv(ST(0), (IV)ret);
2830     }
2831     XSRETURN(1);
2832 #else
2833     c_fun_not_there("slk_set");
2834     XSRETURN(0);
2835 #endif
2836 }
2837 
XS(XS_Curses_slk_refresh)2838 XS(XS_Curses_slk_refresh)
2839 {
2840     dXSARGS;
2841 #ifdef C_SLK_REFRESH
2842     c_exactargs("slk_refresh", items, 0);
2843     {
2844     int ret = slk_refresh();
2845 
2846     ST(0) = sv_newmortal();
2847     sv_setiv(ST(0), (IV)ret);
2848     }
2849     XSRETURN(1);
2850 #else
2851     c_fun_not_there("slk_refresh");
2852     XSRETURN(0);
2853 #endif
2854 }
2855 
XS(XS_Curses_slk_noutrefresh)2856 XS(XS_Curses_slk_noutrefresh)
2857 {
2858     dXSARGS;
2859 #ifdef C_SLK_NOUTREFRESH
2860     c_exactargs("slk_noutrefresh", items, 0);
2861     {
2862     int ret = slk_noutrefresh();
2863 
2864     ST(0) = sv_newmortal();
2865     sv_setiv(ST(0), (IV)ret);
2866     }
2867     XSRETURN(1);
2868 #else
2869     c_fun_not_there("slk_noutrefresh");
2870     XSRETURN(0);
2871 #endif
2872 }
2873 
XS(XS_Curses_slk_label)2874 XS(XS_Curses_slk_label)
2875 {
2876     dXSARGS;
2877 #ifdef C_SLK_LABEL
2878     c_exactargs("slk_label", items, 1);
2879     {
2880     int labnum  = (int)SvIV(ST(0));
2881     char *  ret = slk_label(labnum);
2882 
2883     ST(0) = sv_newmortal();
2884     sv_setpv((SV*)ST(0), ret);
2885     }
2886     XSRETURN(1);
2887 #else
2888     c_fun_not_there("slk_label");
2889     XSRETURN(0);
2890 #endif
2891 }
2892 
XS(XS_Curses_slk_clear)2893 XS(XS_Curses_slk_clear)
2894 {
2895     dXSARGS;
2896 #ifdef C_SLK_CLEAR
2897     c_exactargs("slk_clear", items, 0);
2898     {
2899     int ret = slk_clear();
2900 
2901     ST(0) = sv_newmortal();
2902     sv_setiv(ST(0), (IV)ret);
2903     }
2904     XSRETURN(1);
2905 #else
2906     c_fun_not_there("slk_clear");
2907     XSRETURN(0);
2908 #endif
2909 }
2910 
XS(XS_Curses_slk_restore)2911 XS(XS_Curses_slk_restore)
2912 {
2913     dXSARGS;
2914 #ifdef C_SLK_RESTORE
2915     c_exactargs("slk_restore", items, 0);
2916     {
2917     int ret = slk_restore();
2918 
2919     ST(0) = sv_newmortal();
2920     sv_setiv(ST(0), (IV)ret);
2921     }
2922     XSRETURN(1);
2923 #else
2924     c_fun_not_there("slk_restore");
2925     XSRETURN(0);
2926 #endif
2927 }
2928 
XS(XS_Curses_slk_touch)2929 XS(XS_Curses_slk_touch)
2930 {
2931     dXSARGS;
2932 #ifdef C_SLK_TOUCH
2933     c_exactargs("slk_touch", items, 0);
2934     {
2935     int ret = slk_touch();
2936 
2937     ST(0) = sv_newmortal();
2938     sv_setiv(ST(0), (IV)ret);
2939     }
2940     XSRETURN(1);
2941 #else
2942     c_fun_not_there("slk_touch");
2943     XSRETURN(0);
2944 #endif
2945 }
2946 
XS(XS_Curses_slk_attron)2947 XS(XS_Curses_slk_attron)
2948 {
2949     dXSARGS;
2950 #ifdef C_SLK_ATTRON
2951     c_exactargs("slk_attron", items, 1);
2952     {
2953     chtype  attrs   = c_sv2chtype(ST(0));
2954     int ret = slk_attron(attrs);
2955 
2956     ST(0) = sv_newmortal();
2957     sv_setiv(ST(0), (IV)ret);
2958     }
2959     XSRETURN(1);
2960 #else
2961     c_fun_not_there("slk_attron");
2962     XSRETURN(0);
2963 #endif
2964 }
2965 
XS(XS_Curses_slk_attrset)2966 XS(XS_Curses_slk_attrset)
2967 {
2968     dXSARGS;
2969 #ifdef C_SLK_ATTRSET
2970     c_exactargs("slk_attrset", items, 1);
2971     {
2972     chtype  attrs   = c_sv2chtype(ST(0));
2973     int ret = slk_attrset(attrs);
2974 
2975     ST(0) = sv_newmortal();
2976     sv_setiv(ST(0), (IV)ret);
2977     }
2978     XSRETURN(1);
2979 #else
2980     c_fun_not_there("slk_attrset");
2981     XSRETURN(0);
2982 #endif
2983 }
2984 
XS(XS_Curses_slk_attr)2985 XS(XS_Curses_slk_attr)
2986 {
2987     dXSARGS;
2988 #ifdef C_SLK_ATTR
2989     c_exactargs("slk_attr", items, 0);
2990     {
2991     attr_t  ret = slk_attr();
2992 
2993     ST(0) = sv_newmortal();
2994     sv_setiv(ST(0), (IV)ret);
2995     }
2996     XSRETURN(1);
2997 #else
2998     c_fun_not_there("slk_attr");
2999     XSRETURN(0);
3000 #endif
3001 }
3002 
XS(XS_Curses_slk_attroff)3003 XS(XS_Curses_slk_attroff)
3004 {
3005     dXSARGS;
3006 #ifdef C_SLK_ATTROFF
3007     c_exactargs("slk_attroff", items, 1);
3008     {
3009     chtype  attrs   = c_sv2chtype(ST(0));
3010     int ret = slk_attroff(attrs);
3011 
3012     ST(0) = sv_newmortal();
3013     sv_setiv(ST(0), (IV)ret);
3014     }
3015     XSRETURN(1);
3016 #else
3017     c_fun_not_there("slk_attroff");
3018     XSRETURN(0);
3019 #endif
3020 }
3021 
XS(XS_Curses_slk_color)3022 XS(XS_Curses_slk_color)
3023 {
3024     dXSARGS;
3025 #ifdef C_SLK_COLOR
3026     c_exactargs("slk_color", items, 1);
3027     {
3028     short   color_pair_number   = (short)SvIV(ST(0));
3029     int ret = slk_color(color_pair_number);
3030 
3031     ST(0) = sv_newmortal();
3032     sv_setiv(ST(0), (IV)ret);
3033     }
3034     XSRETURN(1);
3035 #else
3036     c_fun_not_there("slk_color");
3037     XSRETURN(0);
3038 #endif
3039 }
3040 
3041 
3042 /* curs_termattrs */
3043 
XS(XS_Curses_baudrate)3044 XS(XS_Curses_baudrate)
3045 {
3046     dXSARGS;
3047 #ifdef C_BAUDRATE
3048     c_exactargs("baudrate", items, 0);
3049     {
3050     int ret = baudrate();
3051 
3052     ST(0) = sv_newmortal();
3053     sv_setiv(ST(0), (IV)ret);
3054     }
3055     XSRETURN(1);
3056 #else
3057     c_fun_not_there("baudrate");
3058     XSRETURN(0);
3059 #endif
3060 }
3061 
XS(XS_Curses_erasechar)3062 XS(XS_Curses_erasechar)
3063 {
3064     dXSARGS;
3065 #ifdef C_ERASECHAR
3066     c_exactargs("erasechar", items, 0);
3067     {
3068     char    ret = erasechar();
3069 
3070     ST(0) = sv_newmortal();
3071     sv_setpvn(ST(0), (char *)&ret, 1);
3072     }
3073     XSRETURN(1);
3074 #else
3075     c_fun_not_there("erasechar");
3076     XSRETURN(0);
3077 #endif
3078 }
3079 
XS(XS_Curses_has_ic)3080 XS(XS_Curses_has_ic)
3081 {
3082     dXSARGS;
3083 #ifdef C_HAS_IC
3084     c_exactargs("has_ic", items, 0);
3085     {
3086     int ret = has_ic();
3087 
3088     ST(0) = sv_newmortal();
3089     sv_setiv(ST(0), (IV)ret);
3090     }
3091     XSRETURN(1);
3092 #else
3093     c_fun_not_there("has_ic");
3094     XSRETURN(0);
3095 #endif
3096 }
3097 
XS(XS_Curses_has_il)3098 XS(XS_Curses_has_il)
3099 {
3100     dXSARGS;
3101 #ifdef C_HAS_IL
3102     c_exactargs("has_il", items, 0);
3103     {
3104     int ret = has_il();
3105 
3106     ST(0) = sv_newmortal();
3107     sv_setiv(ST(0), (IV)ret);
3108     }
3109     XSRETURN(1);
3110 #else
3111     c_fun_not_there("has_il");
3112     XSRETURN(0);
3113 #endif
3114 }
3115 
XS(XS_Curses_killchar)3116 XS(XS_Curses_killchar)
3117 {
3118     dXSARGS;
3119 #ifdef C_KILLCHAR
3120     c_exactargs("killchar", items, 0);
3121     {
3122     char    ret = killchar();
3123 
3124     ST(0) = sv_newmortal();
3125     sv_setpvn(ST(0), (char *)&ret, 1);
3126     }
3127     XSRETURN(1);
3128 #else
3129     c_fun_not_there("killchar");
3130     XSRETURN(0);
3131 #endif
3132 }
3133 
3134 #ifdef C_LONG0ARGS
XS(XS_Curses_longname)3135 XS(XS_Curses_longname)
3136 {
3137     dXSARGS;
3138 #ifdef C_LONGNAME
3139     c_exactargs("longname", items, 0);
3140     {
3141     char *  ret = longname();
3142 
3143     ST(0) = sv_newmortal();
3144     sv_setpv((SV*)ST(0), ret);
3145     }
3146     XSRETURN(1);
3147 #else
3148     c_fun_not_there("longname");
3149     XSRETURN(0);
3150 #endif
3151 }
3152 
3153 #else
XS(XS_Curses_longname)3154 XS(XS_Curses_longname)
3155 {
3156     dXSARGS;
3157 #ifdef C_LONGNAME
3158     c_exactargs("longname", items, 2);
3159     {
3160     char *  a   = (char *)SvPV_nolen(ST(0));
3161     char *  b   = (char *)SvPV_nolen(ST(1));
3162     char *  ret = longname(a, b);
3163 
3164     ST(0) = sv_newmortal();
3165     sv_setpv((SV*)ST(0), ret);
3166     }
3167     XSRETURN(1);
3168 #else
3169     c_fun_not_there("longname");
3170     XSRETURN(0);
3171 #endif
3172 }
3173 
3174 #endif
3175 
XS(XS_Curses_termattrs)3176 XS(XS_Curses_termattrs)
3177 {
3178     dXSARGS;
3179 #ifdef C_TERMATTRS
3180     c_exactargs("termattrs", items, 0);
3181     {
3182     chtype  ret = termattrs();
3183 
3184     ST(0) = sv_newmortal();
3185     c_chtype2sv(ST(0), ret);
3186     }
3187     XSRETURN(1);
3188 #else
3189     c_fun_not_there("termattrs");
3190     XSRETURN(0);
3191 #endif
3192 }
3193 
XS(XS_Curses_termname)3194 XS(XS_Curses_termname)
3195 {
3196     dXSARGS;
3197 #ifdef C_TERMNAME
3198     c_exactargs("termname", items, 0);
3199     {
3200     char *  ret = termname();
3201 
3202     ST(0) = sv_newmortal();
3203     sv_setpv((SV*)ST(0), ret);
3204     }
3205     XSRETURN(1);
3206 #else
3207     c_fun_not_there("termname");
3208     XSRETURN(0);
3209 #endif
3210 }
3211 
3212 
3213 /* curs_touch */
3214 
XS(XS_Curses_touchwin)3215 XS(XS_Curses_touchwin)
3216 {
3217     dXSARGS;
3218 #ifdef C_TOUCHWIN
3219     c_countargs("touchwin", items, 0);
3220     {
3221     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3222     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3223     int ret = c_mret == ERR ? ERR : touchwin(win);
3224 
3225     ST(0) = sv_newmortal();
3226     sv_setiv(ST(0), (IV)ret);
3227     }
3228     XSRETURN(1);
3229 #else
3230     c_fun_not_there("touchwin");
3231     XSRETURN(0);
3232 #endif
3233 }
3234 
3235 #ifdef C_TOUCH3ARGS
XS(XS_Curses_touchline)3236 XS(XS_Curses_touchline)
3237 {
3238     dXSARGS;
3239 #ifdef C_TOUCHLINE
3240     c_countargs("touchline", items, 2);
3241     {
3242     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3243     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3244     int start   = (int)SvIV(ST(c_arg));
3245     int count   = (int)SvIV(ST(c_arg+1));
3246     int ret = c_mret == ERR ? ERR : touchline(win, start, count);
3247 
3248     ST(0) = sv_newmortal();
3249     sv_setiv(ST(0), (IV)ret);
3250     }
3251     XSRETURN(1);
3252 #else
3253     c_fun_not_there("touchline");
3254     XSRETURN(0);
3255 #endif
3256 }
3257 
3258 #else
XS(XS_Curses_touchline)3259 XS(XS_Curses_touchline)
3260 {
3261     dXSARGS;
3262 #ifdef C_TOUCHLINE
3263     c_countargs("touchline", items, 3);
3264     {
3265     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3266     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3267     int y   = (int)SvIV(ST(c_arg));
3268     int sx  = (int)SvIV(ST(c_arg+1));
3269     int ex  = (int)SvIV(ST(c_arg+2));
3270     int ret = c_mret == ERR ? ERR : touchline(win, y, sx, ex);
3271 
3272     ST(0) = sv_newmortal();
3273     sv_setiv(ST(0), (IV)ret);
3274     }
3275     XSRETURN(1);
3276 #else
3277     c_fun_not_there("touchline");
3278     XSRETURN(0);
3279 #endif
3280 }
3281 
3282 #endif
3283 
XS(XS_Curses_untouchwin)3284 XS(XS_Curses_untouchwin)
3285 {
3286     dXSARGS;
3287 #ifdef C_UNTOUCHWIN
3288     c_countargs("untouchwin", items, 0);
3289     {
3290     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3291     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3292     int ret = c_mret == ERR ? ERR : untouchwin(win);
3293 
3294     ST(0) = sv_newmortal();
3295     sv_setiv(ST(0), (IV)ret);
3296     }
3297     XSRETURN(1);
3298 #else
3299     c_fun_not_there("untouchwin");
3300     XSRETURN(0);
3301 #endif
3302 }
3303 
XS(XS_Curses_touchln)3304 XS(XS_Curses_touchln)
3305 {
3306     dXSARGS;
3307 #ifdef C_TOUCHLN
3308     c_countargs("touchln", items, 3);
3309     {
3310     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3311     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3312     int y   = (int)SvIV(ST(c_arg));
3313     int n   = (int)SvIV(ST(c_arg+1));
3314     int changed = (int)SvIV(ST(c_arg+2));
3315     int ret = c_mret == ERR ? ERR : wtouchln(win, y, n, changed);
3316 
3317     ST(0) = sv_newmortal();
3318     sv_setiv(ST(0), (IV)ret);
3319     }
3320     XSRETURN(1);
3321 #else
3322     c_fun_not_there("touchln");
3323     XSRETURN(0);
3324 #endif
3325 }
3326 
XS(XS_Curses_is_linetouched)3327 XS(XS_Curses_is_linetouched)
3328 {
3329     dXSARGS;
3330 #ifdef C_IS_LINETOUCHED
3331     c_countargs("is_linetouched", items, 1);
3332     {
3333     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3334     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3335     int line    = (int)SvIV(ST(c_arg));
3336     int ret = c_mret == ERR ? ERR : is_linetouched(win, line);
3337 
3338     ST(0) = sv_newmortal();
3339     sv_setiv(ST(0), (IV)ret);
3340     }
3341     XSRETURN(1);
3342 #else
3343     c_fun_not_there("is_linetouched");
3344     XSRETURN(0);
3345 #endif
3346 }
3347 
XS(XS_Curses_is_wintouched)3348 XS(XS_Curses_is_wintouched)
3349 {
3350     dXSARGS;
3351 #ifdef C_IS_WINTOUCHED
3352     c_countargs("is_wintouched", items, 0);
3353     {
3354     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3355     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3356     int ret = c_mret == ERR ? ERR : is_wintouched(win);
3357 
3358     ST(0) = sv_newmortal();
3359     sv_setiv(ST(0), (IV)ret);
3360     }
3361     XSRETURN(1);
3362 #else
3363     c_fun_not_there("is_wintouched");
3364     XSRETURN(0);
3365 #endif
3366 }
3367 
3368 
3369 /* curs_util */
3370 
3371 
3372 
XS(XS_Curses_unctrl)3373 XS(XS_Curses_unctrl) {
3374 
3375     dXSARGS;
3376 #ifdef C_UNCTRL
3377     c_exactargs("unctrl", items, 1);
3378     {
3379         chtype const ch = c_sv2chtype(ST(0));
3380         const char * const ret = unctrl(ch);
3381 
3382         ST(0) = sv_newmortal();
3383         sv_setpv((SV*)ST(0), ret);
3384     }
3385     XSRETURN(1);
3386 #else
3387     c_fun_not_there("unctrl");
3388     XSRETURN(0);
3389 #endif
3390 }
3391 
3392 
3393 
XS(XS_Curses_keyname)3394 XS(XS_Curses_keyname)
3395 {
3396     dXSARGS;
3397 #ifdef C_KEYNAME
3398     c_exactargs("keyname", items, 1);
3399     {
3400     int k   = (int)SvIV(ST(0));
3401     char *  ret = (char *)keyname(k);
3402 
3403     ST(0) = sv_newmortal();
3404     sv_setpv((SV*)ST(0), ret);
3405     }
3406     XSRETURN(1);
3407 #else
3408     c_fun_not_there("keyname");
3409     XSRETURN(0);
3410 #endif
3411 }
3412 
3413 #ifdef C_INTFILTER
XS(XS_Curses_filter)3414 XS(XS_Curses_filter)
3415 {
3416     dXSARGS;
3417 #ifdef C_FILTER
3418     c_exactargs("filter", items, 0);
3419     {
3420     int ret = filter();
3421 
3422     ST(0) = sv_newmortal();
3423     sv_setiv(ST(0), (IV)ret);
3424     }
3425     XSRETURN(1);
3426 #else
3427     c_fun_not_there("filter");
3428     XSRETURN(0);
3429 #endif
3430 }
3431 
3432 #else
XS(XS_Curses_filter)3433 XS(XS_Curses_filter)
3434 {
3435     dXSARGS;
3436 #ifdef C_FILTER
3437     c_exactargs("filter", items, 0);
3438     {
3439     filter();
3440     }
3441     XSRETURN(0);
3442 #else
3443     c_fun_not_there("filter");
3444     XSRETURN(0);
3445 #endif
3446 }
3447 
3448 #endif
XS(XS_Curses_use_env)3449 XS(XS_Curses_use_env)
3450 {
3451     dXSARGS;
3452 #ifdef C_USE_ENV
3453     c_exactargs("use_env", items, 1);
3454     {
3455     bool    bf  = (int)SvIV(ST(0));
3456 
3457     use_env(bf);
3458     }
3459     XSRETURN(0);
3460 #else
3461     c_fun_not_there("use_env");
3462     XSRETURN(0);
3463 #endif
3464 }
3465 
XS(XS_Curses_putwin)3466 XS(XS_Curses_putwin)
3467 {
3468     dXSARGS;
3469 #ifdef C_PUTWIN
3470     c_exactargs("putwin", items, 2);
3471     {
3472     WINDOW *win = c_sv2window(ST(0), 0);
3473     /* See explanation of PerlIO_findFILE in newterm() */
3474     FILE *  filep   = PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
3475     int ret = putwin(win, filep);
3476 
3477     ST(0) = sv_newmortal();
3478     sv_setiv(ST(0), (IV)ret);
3479     }
3480     XSRETURN(1);
3481 #else
3482     c_fun_not_there("putwin");
3483     XSRETURN(0);
3484 #endif
3485 }
3486 
XS(XS_Curses_getwin)3487 XS(XS_Curses_getwin)
3488 {
3489     dXSARGS;
3490 #ifdef C_GETWIN
3491     c_exactargs("getwin", items, 1);
3492     {
3493     /* See explanation of PerlIO_findFILE in newterm() */
3494     FILE *  filep   = PerlIO_findFILE(IoIFP(sv_2io(ST(0))));
3495     WINDOW *    ret = getwin(filep);
3496 
3497     ST(0) = sv_newmortal();
3498     c_window2sv(ST(0), ret);
3499     }
3500     XSRETURN(1);
3501 #else
3502     c_fun_not_there("getwin");
3503     XSRETURN(0);
3504 #endif
3505 }
3506 
XS(XS_Curses_delay_output)3507 XS(XS_Curses_delay_output)
3508 {
3509     dXSARGS;
3510 #ifdef C_DELAY_OUTPUT
3511     c_exactargs("delay_output", items, 1);
3512     {
3513     int ms  = (int)SvIV(ST(0));
3514     int ret = delay_output(ms);
3515 
3516     ST(0) = sv_newmortal();
3517     sv_setiv(ST(0), (IV)ret);
3518     }
3519     XSRETURN(1);
3520 #else
3521     c_fun_not_there("delay_output");
3522     XSRETURN(0);
3523 #endif
3524 }
3525 
XS(XS_Curses_flushinp)3526 XS(XS_Curses_flushinp)
3527 {
3528     dXSARGS;
3529 #ifdef C_FLUSHINP
3530     c_exactargs("flushinp", items, 0);
3531     {
3532     int ret = flushinp();
3533 
3534     ST(0) = sv_newmortal();
3535     sv_setiv(ST(0), (IV)ret);
3536     }
3537     XSRETURN(1);
3538 #else
3539     c_fun_not_there("flushinp");
3540     XSRETURN(0);
3541 #endif
3542 }
3543 
3544 
3545 /* curs_window */
3546 
XS(XS_Curses_newwin)3547 XS(XS_Curses_newwin)
3548 {
3549     dXSARGS;
3550 #ifdef C_NEWWIN
3551     c_exactargs("newwin", items, 4);
3552     {
3553     int nlines  = (int)SvIV(ST(0));
3554     int ncols   = (int)SvIV(ST(1));
3555     int beginy  = (int)SvIV(ST(2));
3556     int beginx  = (int)SvIV(ST(3));
3557     WINDOW *    ret = newwin(nlines, ncols, beginy, beginx);
3558 
3559     ST(0) = sv_newmortal();
3560     c_window2sv(ST(0), ret);
3561     }
3562     XSRETURN(1);
3563 #else
3564     c_fun_not_there("newwin");
3565     XSRETURN(0);
3566 #endif
3567 }
3568 
XS(XS_Curses_delwin)3569 XS(XS_Curses_delwin)
3570 {
3571     dXSARGS;
3572 #ifdef C_DELWIN
3573     c_countargs("delwin", items, 0);
3574     {
3575     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3576     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3577     int ret = c_mret == ERR ? ERR : delwin(win);
3578 
3579     ST(0) = sv_newmortal();
3580     sv_setiv(ST(0), (IV)ret);
3581     }
3582     XSRETURN(1);
3583 #else
3584     c_fun_not_there("delwin");
3585     XSRETURN(0);
3586 #endif
3587 }
3588 
XS(XS_Curses_mvwin)3589 XS(XS_Curses_mvwin)
3590 {
3591     dXSARGS;
3592 #ifdef C_MVWIN
3593     c_countargs("mvwin", items, 2);
3594     {
3595     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3596     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3597     int y   = (int)SvIV(ST(c_arg));
3598     int x   = (int)SvIV(ST(c_arg+1));
3599     int ret = c_mret == ERR ? ERR : mvwin(win, y, x);
3600 
3601     ST(0) = sv_newmortal();
3602     sv_setiv(ST(0), (IV)ret);
3603     }
3604     XSRETURN(1);
3605 #else
3606     c_fun_not_there("mvwin");
3607     XSRETURN(0);
3608 #endif
3609 }
3610 
XS(XS_Curses_subwin)3611 XS(XS_Curses_subwin)
3612 {
3613     dXSARGS;
3614 #ifdef C_SUBWIN
3615     c_countargs("subwin", items, 4);
3616     {
3617     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3618     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3619     int nlines  = (int)SvIV(ST(c_arg));
3620     int ncols   = (int)SvIV(ST(c_arg+1));
3621     int beginy  = (int)SvIV(ST(c_arg+2));
3622     int beginx  = (int)SvIV(ST(c_arg+3));
3623     WINDOW *    ret = c_mret == ERR ? NULL : subwin(win, nlines, ncols, beginy, beginx);
3624 
3625     ST(0) = sv_newmortal();
3626     c_window2sv(ST(0), ret);
3627     }
3628     XSRETURN(1);
3629 #else
3630     c_fun_not_there("subwin");
3631     XSRETURN(0);
3632 #endif
3633 }
3634 
XS(XS_Curses_derwin)3635 XS(XS_Curses_derwin)
3636 {
3637     dXSARGS;
3638 #ifdef C_DERWIN
3639     c_countargs("derwin", items, 4);
3640     {
3641     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3642     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3643     int nlines  = (int)SvIV(ST(c_arg));
3644     int ncols   = (int)SvIV(ST(c_arg+1));
3645     int beginy  = (int)SvIV(ST(c_arg+2));
3646     int beginx  = (int)SvIV(ST(c_arg+3));
3647     WINDOW *    ret = c_mret == ERR ? NULL : derwin(win, nlines, ncols, beginy, beginx);
3648 
3649     ST(0) = sv_newmortal();
3650     c_window2sv(ST(0), ret);
3651     }
3652     XSRETURN(1);
3653 #else
3654     c_fun_not_there("derwin");
3655     XSRETURN(0);
3656 #endif
3657 }
3658 
XS(XS_Curses_mvderwin)3659 XS(XS_Curses_mvderwin)
3660 {
3661     dXSARGS;
3662 #ifdef C_MVDERWIN
3663     c_countargs("mvderwin", items, 2);
3664     {
3665     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3666     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3667     int par_y   = (int)SvIV(ST(c_arg));
3668     int par_x   = (int)SvIV(ST(c_arg+1));
3669     int ret = c_mret == ERR ? ERR : mvderwin(win, par_y, par_x);
3670 
3671     ST(0) = sv_newmortal();
3672     sv_setiv(ST(0), (IV)ret);
3673     }
3674     XSRETURN(1);
3675 #else
3676     c_fun_not_there("mvderwin");
3677     XSRETURN(0);
3678 #endif
3679 }
3680 
XS(XS_Curses_dupwin)3681 XS(XS_Curses_dupwin)
3682 {
3683     dXSARGS;
3684 #ifdef C_DUPWIN
3685     c_countargs("dupwin", items, 0);
3686     {
3687     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3688     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3689     WINDOW *    ret = c_mret == ERR ? NULL : dupwin(win);
3690 
3691     ST(0) = sv_newmortal();
3692     c_window2sv(ST(0), ret);
3693     }
3694     XSRETURN(1);
3695 #else
3696     c_fun_not_there("dupwin");
3697     XSRETURN(0);
3698 #endif
3699 }
3700 
XS(XS_Curses_syncup)3701 XS(XS_Curses_syncup)
3702 {
3703     dXSARGS;
3704 #ifdef C_SYNCUP
3705     c_countargs("syncup", items, 0);
3706     {
3707     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3708     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3709 
3710     if (c_mret == OK) { wsyncup(win); }
3711     }
3712     XSRETURN(0);
3713 #else
3714     c_fun_not_there("syncup");
3715     XSRETURN(0);
3716 #endif
3717 }
3718 
XS(XS_Curses_syncok)3719 XS(XS_Curses_syncok)
3720 {
3721     dXSARGS;
3722 #ifdef C_SYNCOK
3723     c_countargs("syncok", items, 1);
3724     {
3725     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3726     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3727     bool    bf  = (int)SvIV(ST(c_arg));
3728     int ret = c_mret == ERR ? ERR : syncok(win, bf);
3729 
3730     ST(0) = sv_newmortal();
3731     sv_setiv(ST(0), (IV)ret);
3732     }
3733     XSRETURN(1);
3734 #else
3735     c_fun_not_there("syncok");
3736     XSRETURN(0);
3737 #endif
3738 }
3739 
XS(XS_Curses_cursyncup)3740 XS(XS_Curses_cursyncup)
3741 {
3742     dXSARGS;
3743 #ifdef C_CURSYNCUP
3744     c_countargs("cursyncup", items, 0);
3745     {
3746     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3747     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3748 
3749     if (c_mret == OK) { wcursyncup(win); }
3750     }
3751     XSRETURN(0);
3752 #else
3753     c_fun_not_there("cursyncup");
3754     XSRETURN(0);
3755 #endif
3756 }
3757 
XS(XS_Curses_syncdown)3758 XS(XS_Curses_syncdown)
3759 {
3760     dXSARGS;
3761 #ifdef C_SYNCDOWN
3762     c_countargs("syncdown", items, 0);
3763     {
3764     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3765     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3766 
3767     if (c_mret == OK) { wsyncdown(win); }
3768     }
3769     XSRETURN(0);
3770 #else
3771     c_fun_not_there("syncdown");
3772     XSRETURN(0);
3773 #endif
3774 }
3775 
3776 
3777 /* ncurses extension functions */
3778 
XS(XS_Curses_getmouse)3779 XS(XS_Curses_getmouse)
3780 {
3781     dXSARGS;
3782 #ifdef C_GETMOUSE
3783     c_exactargs("getmouse", items, 1);
3784     {
3785     MEVENT *event   = (MEVENT *)sv_grow(ST(0), 2 * sizeof(MEVENT));
3786     int ret = getmouse(event);
3787 
3788     c_setmevent(ST(0));
3789     ST(0) = sv_newmortal();
3790     sv_setiv(ST(0), (IV)ret);
3791     }
3792     XSRETURN(1);
3793 #else
3794     c_fun_not_there("getmouse");
3795     XSRETURN(0);
3796 #endif
3797 }
3798 
XS(XS_Curses_ungetmouse)3799 XS(XS_Curses_ungetmouse)
3800 {
3801     dXSARGS;
3802 #ifdef C_UNGETMOUSE
3803     c_exactargs("ungetmouse", items, 1);
3804     {
3805     MEVENT *event   = (MEVENT *)SvPV_nolen(ST(0));
3806     int ret = ungetmouse(event);
3807 
3808     ST(0) = sv_newmortal();
3809     sv_setiv(ST(0), (IV)ret);
3810     }
3811     XSRETURN(1);
3812 #else
3813     c_fun_not_there("ungetmouse");
3814     XSRETURN(0);
3815 #endif
3816 }
3817 
XS(XS_Curses_mousemask)3818 XS(XS_Curses_mousemask)
3819 {
3820     dXSARGS;
3821 #ifdef C_MOUSEMASK
3822     c_exactargs("mousemask", items, 2);
3823     {
3824     mmask_t newmask = (mmask_t)SvIV(ST(0));
3825     mmask_t oldmask = 0;
3826     mmask_t ret = mousemask(newmask, &oldmask);
3827 
3828     sv_setiv(ST(1), (IV)oldmask);;
3829     ST(0) = sv_newmortal();
3830     sv_setiv(ST(0), (IV)ret);
3831     }
3832     XSRETURN(1);
3833 #else
3834     c_fun_not_there("mousemask");
3835     XSRETURN(0);
3836 #endif
3837 }
3838 
XS(XS_Curses_enclose)3839 XS(XS_Curses_enclose)
3840 {
3841     dXSARGS;
3842 #ifdef C_ENCLOSE
3843     c_countargs("enclose", items, 2);
3844     {
3845     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3846     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3847     int y   = (int)SvIV(ST(c_arg));
3848     int x   = (int)SvIV(ST(c_arg+1));
3849     /* We don't have any way to return an error, so if we couldn't move the
3850        window, we just say the window does not enclose the location.
3851     */
3852     bool    ret = c_mret == ERR ? false : wenclose(win, y, x);
3853 
3854     ST(0) = sv_newmortal();
3855     sv_setiv(ST(0), (IV)ret);
3856     }
3857     XSRETURN(1);
3858 #else
3859     c_fun_not_there("enclose");
3860     XSRETURN(0);
3861 #endif
3862 }
3863 
XS(XS_Curses_mouse_trafo)3864 XS(XS_Curses_mouse_trafo)
3865 {
3866     dXSARGS;
3867 #ifdef C_MOUSE_TRAFO
3868     c_countargs("mouse_trafo", items, 3);
3869     {
3870     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
3871     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
3872     int pY  = 0;
3873     int pX  = 0;
3874     bool    to_screen   = (int)SvIV(ST(c_arg+2));
3875     bool    ret = c_mret == ERR ? false : wmouse_trafo(win, &pY, &pX, to_screen);
3876 
3877     sv_setiv(ST(c_arg), (IV)pY);;
3878     sv_setiv(ST(c_arg+1), (IV)pX);;
3879     ST(0) = sv_newmortal();
3880     sv_setiv(ST(0), (IV)ret);
3881     }
3882     XSRETURN(1);
3883 #else
3884     c_fun_not_there("mouse_trafo");
3885     XSRETURN(0);
3886 #endif
3887 }
3888 
XS(XS_Curses_mouseinterval)3889 XS(XS_Curses_mouseinterval)
3890 {
3891     dXSARGS;
3892 #ifdef C_MOUSEINTERVAL
3893     c_exactargs("mouseinterval", items, 1);
3894     {
3895     int erval   = (int)SvIV(ST(0));
3896     int ret = mouseinterval(erval);
3897 
3898     ST(0) = sv_newmortal();
3899     sv_setiv(ST(0), (IV)ret);
3900     }
3901     XSRETURN(1);
3902 #else
3903     c_fun_not_there("mouseinterval");
3904     XSRETURN(0);
3905 #endif
3906 }
3907 
XS(XS_Curses_BUTTON_RELEASE)3908 XS(XS_Curses_BUTTON_RELEASE)
3909 {
3910     dXSARGS;
3911 #ifdef C_BUTTON_RELEASE
3912     c_exactargs("BUTTON_RELEASE", items, 2);
3913     {
3914     mmask_t e   = (mmask_t)SvIV(ST(0));
3915     int x   = (int)SvIV(ST(1));
3916     int ret = BUTTON_RELEASE(e, x);
3917 
3918     ST(0) = sv_newmortal();
3919     sv_setiv(ST(0), (IV)ret);
3920     }
3921     XSRETURN(1);
3922 #else
3923     c_fun_not_there("BUTTON_RELEASE");
3924     XSRETURN(0);
3925 #endif
3926 }
3927 
XS(XS_Curses_BUTTON_PRESS)3928 XS(XS_Curses_BUTTON_PRESS)
3929 {
3930     dXSARGS;
3931 #ifdef C_BUTTON_PRESS
3932     c_exactargs("BUTTON_PRESS", items, 2);
3933     {
3934     mmask_t e   = (mmask_t)SvIV(ST(0));
3935     int x   = (int)SvIV(ST(1));
3936     int ret = BUTTON_PRESS(e, x);
3937 
3938     ST(0) = sv_newmortal();
3939     sv_setiv(ST(0), (IV)ret);
3940     }
3941     XSRETURN(1);
3942 #else
3943     c_fun_not_there("BUTTON_PRESS");
3944     XSRETURN(0);
3945 #endif
3946 }
3947 
XS(XS_Curses_BUTTON_CLICK)3948 XS(XS_Curses_BUTTON_CLICK)
3949 {
3950     dXSARGS;
3951 #ifdef C_BUTTON_CLICK
3952     c_exactargs("BUTTON_CLICK", items, 2);
3953     {
3954     mmask_t e   = (mmask_t)SvIV(ST(0));
3955     int x   = (int)SvIV(ST(1));
3956     int ret = BUTTON_CLICK(e, x);
3957 
3958     ST(0) = sv_newmortal();
3959     sv_setiv(ST(0), (IV)ret);
3960     }
3961     XSRETURN(1);
3962 #else
3963     c_fun_not_there("BUTTON_CLICK");
3964     XSRETURN(0);
3965 #endif
3966 }
3967 
XS(XS_Curses_BUTTON_DOUBLE_CLICK)3968 XS(XS_Curses_BUTTON_DOUBLE_CLICK)
3969 {
3970     dXSARGS;
3971 #ifdef C_BUTTON_DOUBLE_CLICK
3972     c_exactargs("BUTTON_DOUBLE_CLICK", items, 2);
3973     {
3974     mmask_t e   = (mmask_t)SvIV(ST(0));
3975     int x   = (int)SvIV(ST(1));
3976     int ret = BUTTON_DOUBLE_CLICK(e, x);
3977 
3978     ST(0) = sv_newmortal();
3979     sv_setiv(ST(0), (IV)ret);
3980     }
3981     XSRETURN(1);
3982 #else
3983     c_fun_not_there("BUTTON_DOUBLE_CLICK");
3984     XSRETURN(0);
3985 #endif
3986 }
3987 
XS(XS_Curses_BUTTON_TRIPLE_CLICK)3988 XS(XS_Curses_BUTTON_TRIPLE_CLICK)
3989 {
3990     dXSARGS;
3991 #ifdef C_BUTTON_TRIPLE_CLICK
3992     c_exactargs("BUTTON_TRIPLE_CLICK", items, 2);
3993     {
3994     mmask_t e   = (mmask_t)SvIV(ST(0));
3995     int x   = (int)SvIV(ST(1));
3996     int ret = BUTTON_TRIPLE_CLICK(e, x);
3997 
3998     ST(0) = sv_newmortal();
3999     sv_setiv(ST(0), (IV)ret);
4000     }
4001     XSRETURN(1);
4002 #else
4003     c_fun_not_there("BUTTON_TRIPLE_CLICK");
4004     XSRETURN(0);
4005 #endif
4006 }
4007 
XS(XS_Curses_BUTTON_RESERVED_EVENT)4008 XS(XS_Curses_BUTTON_RESERVED_EVENT)
4009 {
4010     dXSARGS;
4011 #ifdef C_BUTTON_RESERVED_EVENT
4012     c_exactargs("BUTTON_RESERVED_EVENT", items, 2);
4013     {
4014     mmask_t e   = (mmask_t)SvIV(ST(0));
4015     int x   = (int)SvIV(ST(1));
4016     int ret = BUTTON_RESERVED_EVENT(e, x);
4017 
4018     ST(0) = sv_newmortal();
4019     sv_setiv(ST(0), (IV)ret);
4020     }
4021     XSRETURN(1);
4022 #else
4023     c_fun_not_there("BUTTON_RESERVED_EVENT");
4024     XSRETURN(0);
4025 #endif
4026 }
4027 
4028 
XS(XS_Curses_use_default_colors)4029 XS(XS_Curses_use_default_colors)
4030 {
4031     dXSARGS;
4032 #ifdef C_USE_DEFAULT_COLORS
4033     c_exactargs("use_default_colors", items, 0);
4034     {
4035     int ret = use_default_colors();
4036 
4037     ST(0) = sv_newmortal();
4038     sv_setiv(ST(0), (IV)ret);
4039     }
4040     XSRETURN(1);
4041 #else
4042     c_fun_not_there("use_default_colors");
4043     XSRETURN(0);
4044 #endif
4045 }
4046 
XS(XS_Curses_assume_default_colors)4047 XS(XS_Curses_assume_default_colors)
4048 {
4049     dXSARGS;
4050 #ifdef C_ASSUME_DEFAULT_COLORS
4051     c_exactargs("assume_default_colors", items, 2);
4052     {
4053     int fg  = (int)SvIV(ST(0));
4054     int bg  = (int)SvIV(ST(1));
4055     int ret = assume_default_colors(fg, bg);
4056 
4057     ST(0) = sv_newmortal();
4058     sv_setiv(ST(0), (IV)ret);
4059     }
4060     XSRETURN(1);
4061 #else
4062     c_fun_not_there("assume_default_colors");
4063     XSRETURN(0);
4064 #endif
4065 }
4066 
XS(XS_Curses_define_key)4067 XS(XS_Curses_define_key)
4068 {
4069     dXSARGS;
4070 #ifdef C_DEFINE_KEY
4071     c_exactargs("define_key", items, 2);
4072     {
4073     char *  definition  = (char *)SvPV_nolen(ST(0));
4074     int keycode = (int)SvIV(ST(1));
4075     int ret = define_key(definition, keycode);
4076 
4077     ST(0) = sv_newmortal();
4078     sv_setiv(ST(0), (IV)ret);
4079     }
4080     XSRETURN(1);
4081 #else
4082     c_fun_not_there("define_key");
4083     XSRETURN(0);
4084 #endif
4085 }
4086 
XS(XS_Curses_keybound)4087 XS(XS_Curses_keybound)
4088 {
4089     dXSARGS;
4090 #ifdef C_KEYBOUND
4091     c_exactargs("keybound", items, 2);
4092     {
4093     int keycode = (int)SvIV(ST(0));
4094     int count   = (int)SvIV(ST(1));
4095     char *  ret = keybound(keycode, count);
4096 
4097     ST(0) = sv_newmortal();
4098     sv_setpv((SV*)ST(0), ret);
4099     }
4100     XSRETURN(1);
4101 #else
4102     c_fun_not_there("keybound");
4103     XSRETURN(0);
4104 #endif
4105 }
4106 
XS(XS_Curses_keyok)4107 XS(XS_Curses_keyok)
4108 {
4109     dXSARGS;
4110 #ifdef C_KEYOK
4111     c_exactargs("keyok", items, 2);
4112     {
4113     int keycode = (int)SvIV(ST(0));
4114     bool    enable  = (int)SvIV(ST(1));
4115     int ret = keyok(keycode, enable);
4116 
4117     ST(0) = sv_newmortal();
4118     sv_setiv(ST(0), (IV)ret);
4119     }
4120     XSRETURN(1);
4121 #else
4122     c_fun_not_there("keyok");
4123     XSRETURN(0);
4124 #endif
4125 }
4126 
XS(XS_Curses_resizeterm)4127 XS(XS_Curses_resizeterm)
4128 {
4129     dXSARGS;
4130 #ifdef C_RESIZETERM
4131     c_exactargs("resizeterm", items, 2);
4132     {
4133     int lines   = (int)SvIV(ST(0));
4134     int cols    = (int)SvIV(ST(1));
4135     int ret = resizeterm(lines, cols);
4136 
4137     ST(0) = sv_newmortal();
4138     sv_setiv(ST(0), (IV)ret);
4139     }
4140     XSRETURN(1);
4141 #else
4142     c_fun_not_there("resizeterm");
4143     XSRETURN(0);
4144 #endif
4145 }
4146 
XS(XS_Curses_resize)4147 XS(XS_Curses_resize)
4148 {
4149     dXSARGS;
4150 #ifdef C_RESIZE
4151     c_countargs("resize", items, 2);
4152     {
4153     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
4154     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
4155     int lines_  = (int)SvIV(ST(c_arg));
4156     int columns = (int)SvIV(ST(c_arg+1));
4157     int ret = c_mret == ERR ? ERR : wresize(win, lines_, columns);
4158 
4159     ST(0) = sv_newmortal();
4160     sv_setiv(ST(0), (IV)ret);
4161     }
4162     XSRETURN(1);
4163 #else
4164     c_fun_not_there("resize");
4165     XSRETURN(0);
4166 #endif
4167 }
4168 
4169 
4170 /* DEC curses, I think */
4171 
XS(XS_Curses_getmaxy)4172 XS(XS_Curses_getmaxy)
4173 {
4174     dXSARGS;
4175 #ifdef C_GETMAXY
4176     c_countargs("getmaxy", items, 0);
4177     {
4178     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
4179     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
4180     int ret = c_mret == ERR ? ERR : getmaxy(win);
4181 
4182     ST(0) = sv_newmortal();
4183     sv_setiv(ST(0), (IV)ret);
4184     }
4185     XSRETURN(1);
4186 #else
4187     c_fun_not_there("getmaxy");
4188     XSRETURN(0);
4189 #endif
4190 }
4191 
XS(XS_Curses_getmaxx)4192 XS(XS_Curses_getmaxx)
4193 {
4194     dXSARGS;
4195 #ifdef C_GETMAXX
4196     c_countargs("getmaxx", items, 0);
4197     {
4198     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
4199     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
4200     int ret = c_mret == ERR ? ERR : getmaxx(win);
4201 
4202     ST(0) = sv_newmortal();
4203     sv_setiv(ST(0), (IV)ret);
4204     }
4205     XSRETURN(1);
4206 #else
4207     c_fun_not_there("getmaxx");
4208     XSRETURN(0);
4209 #endif
4210 }
4211 
4212 
4213 /* old BSD curses calls */
4214 
XS(XS_Curses_flusok)4215 XS(XS_Curses_flusok)
4216 {
4217     dXSARGS;
4218 #ifdef C_FLUSOK
4219     c_countargs("flusok", items, 1);
4220     {
4221     WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
4222     int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
4223     bool    bf  = (int)SvIV(ST(c_arg));
4224 
4225     if (c_mret == OK) { flusok(win, bf); }
4226     }
4227     XSRETURN(0);
4228 #else
4229     c_fun_not_there("flusok");
4230     XSRETURN(0);
4231 #endif
4232 }
4233 
XS(XS_Curses_getcap)4234 XS(XS_Curses_getcap)
4235 {
4236     dXSARGS;
4237 #ifdef C_GETCAP
4238     c_exactargs("getcap", items, 1);
4239     {
4240     char *  term    = (char *)SvPV_nolen(ST(0));
4241     char *  ret = (char *)getcap(term);
4242 
4243     ST(0) = sv_newmortal();
4244     sv_setpv((SV*)ST(0), ret);
4245     }
4246     XSRETURN(1);
4247 #else
4248     c_fun_not_there("getcap");
4249     XSRETURN(0);
4250 #endif
4251 }
4252 
XS(XS_Curses_touchoverlap)4253 XS(XS_Curses_touchoverlap)
4254 {
4255     dXSARGS;
4256 #ifdef C_TOUCHOVERLAP
4257     c_exactargs("touchoverlap", items, 2);
4258     {
4259     WINDOW *src = c_sv2window(ST(0), 0);
4260     WINDOW *dst = c_sv2window(ST(1), 1);
4261     int ret = touchoverlap(src, dst);
4262 
4263     ST(0) = sv_newmortal();
4264     sv_setiv(ST(0), (IV)ret);
4265     }
4266     XSRETURN(1);
4267 #else
4268     c_fun_not_there("touchoverlap");
4269     XSRETURN(0);
4270 #endif
4271 }
4272 
4273 
4274 /* Panel functions */
4275 
XS(XS_Curses_new_panel)4276 XS(XS_Curses_new_panel)
4277 {
4278     dXSARGS;
4279 #ifdef C_NEW_PANEL
4280     c_exactargs("new_panel", items, 1);
4281     {
4282     WINDOW *win = c_sv2window(ST(0), 0);
4283     PANEL * ret = new_panel(win);
4284 
4285     ST(0) = sv_newmortal();
4286     c_panel2sv(ST(0), ret);
4287     }
4288     XSRETURN(1);
4289 #else
4290     c_fun_not_there("new_panel");
4291     XSRETURN(0);
4292 #endif
4293 }
4294 
XS(XS_Curses_bottom_panel)4295 XS(XS_Curses_bottom_panel)
4296 {
4297     dXSARGS;
4298 #ifdef C_BOTTOM_PANEL
4299     c_exactargs("bottom_panel", items, 1);
4300     {
4301     PANEL * pan = c_sv2panel(ST(0), 0);
4302     int ret = bottom_panel(pan);
4303 
4304     ST(0) = sv_newmortal();
4305     sv_setiv(ST(0), (IV)ret);
4306     }
4307     XSRETURN(1);
4308 #else
4309     c_fun_not_there("bottom_panel");
4310     XSRETURN(0);
4311 #endif
4312 }
4313 
XS(XS_Curses_top_panel)4314 XS(XS_Curses_top_panel)
4315 {
4316     dXSARGS;
4317 #ifdef C_TOP_PANEL
4318     c_exactargs("top_panel", items, 1);
4319     {
4320     PANEL * pan = c_sv2panel(ST(0), 0);
4321     int ret = top_panel(pan);
4322 
4323     ST(0) = sv_newmortal();
4324     sv_setiv(ST(0), (IV)ret);
4325     }
4326     XSRETURN(1);
4327 #else
4328     c_fun_not_there("top_panel");
4329     XSRETURN(0);
4330 #endif
4331 }
4332 
XS(XS_Curses_show_panel)4333 XS(XS_Curses_show_panel)
4334 {
4335     dXSARGS;
4336 #ifdef C_SHOW_PANEL
4337     c_exactargs("show_panel", items, 1);
4338     {
4339     PANEL * pan = c_sv2panel(ST(0), 0);
4340     int ret = show_panel(pan);
4341 
4342     ST(0) = sv_newmortal();
4343     sv_setiv(ST(0), (IV)ret);
4344     }
4345     XSRETURN(1);
4346 #else
4347     c_fun_not_there("show_panel");
4348     XSRETURN(0);
4349 #endif
4350 }
4351 
XS(XS_Curses_update_panels)4352 XS(XS_Curses_update_panels)
4353 {
4354     dXSARGS;
4355 #ifdef C_UPDATE_PANELS
4356     c_exactargs("update_panels", items, 0);
4357     {
4358     update_panels();
4359     }
4360     XSRETURN(0);
4361 #else
4362     c_fun_not_there("update_panels");
4363     XSRETURN(0);
4364 #endif
4365 }
4366 
XS(XS_Curses_hide_panel)4367 XS(XS_Curses_hide_panel)
4368 {
4369     dXSARGS;
4370 #ifdef C_HIDE_PANEL
4371     c_exactargs("hide_panel", items, 1);
4372     {
4373     PANEL * pan = c_sv2panel(ST(0), 0);
4374     int ret = hide_panel(pan);
4375 
4376     ST(0) = sv_newmortal();
4377     sv_setiv(ST(0), (IV)ret);
4378     }
4379     XSRETURN(1);
4380 #else
4381     c_fun_not_there("hide_panel");
4382     XSRETURN(0);
4383 #endif
4384 }
4385 
XS(XS_Curses_panel_window)4386 XS(XS_Curses_panel_window)
4387 {
4388     dXSARGS;
4389 #ifdef C_PANEL_WINDOW
4390     c_exactargs("panel_window", items, 1);
4391     {
4392     PANEL * pan = c_sv2panel(ST(0), 0);
4393     WINDOW *    ret = panel_window(pan);
4394 
4395     ST(0) = sv_newmortal();
4396     c_window2sv(ST(0), ret);
4397     }
4398     XSRETURN(1);
4399 #else
4400     c_fun_not_there("panel_window");
4401     XSRETURN(0);
4402 #endif
4403 }
4404 
XS(XS_Curses_replace_panel)4405 XS(XS_Curses_replace_panel)
4406 {
4407     dXSARGS;
4408 #ifdef C_REPLACE_PANEL
4409     c_exactargs("replace_panel", items, 2);
4410     {
4411     PANEL * pan = c_sv2panel(ST(0), 0);
4412     WINDOW *window  = c_sv2window(ST(1), 1);
4413     int ret = replace_panel(pan, window);
4414 
4415     ST(0) = sv_newmortal();
4416     sv_setiv(ST(0), (IV)ret);
4417     }
4418     XSRETURN(1);
4419 #else
4420     c_fun_not_there("replace_panel");
4421     XSRETURN(0);
4422 #endif
4423 }
4424 
XS(XS_Curses_move_panel)4425 XS(XS_Curses_move_panel)
4426 {
4427     dXSARGS;
4428 #ifdef C_MOVE_PANEL
4429     c_exactargs("move_panel", items, 3);
4430     {
4431     PANEL * pan = c_sv2panel(ST(0), 0);
4432     int starty  = (int)SvIV(ST(1));
4433     int startx  = (int)SvIV(ST(2));
4434     int ret = move_panel(pan, starty, startx);
4435 
4436     ST(0) = sv_newmortal();
4437     sv_setiv(ST(0), (IV)ret);
4438     }
4439     XSRETURN(1);
4440 #else
4441     c_fun_not_there("move_panel");
4442     XSRETURN(0);
4443 #endif
4444 }
4445 
XS(XS_Curses_panel_hidden)4446 XS(XS_Curses_panel_hidden)
4447 {
4448     dXSARGS;
4449 #ifdef C_PANEL_HIDDEN
4450     c_exactargs("panel_hidden", items, 1);
4451     {
4452     PANEL * pan = c_sv2panel(ST(0), 0);
4453     int ret = panel_hidden(pan);
4454 
4455     ST(0) = sv_newmortal();
4456     sv_setiv(ST(0), (IV)ret);
4457     }
4458     XSRETURN(1);
4459 #else
4460     c_fun_not_there("panel_hidden");
4461     XSRETURN(0);
4462 #endif
4463 }
4464 
XS(XS_Curses_panel_above)4465 XS(XS_Curses_panel_above)
4466 {
4467     dXSARGS;
4468 #ifdef C_PANEL_ABOVE
4469     c_exactargs("panel_above", items, 1);
4470     {
4471     PANEL * pan = ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
4472     PANEL * ret = panel_above(pan);
4473 
4474     ST(0) = sv_newmortal();
4475     c_panel2sv(ST(0), ret);
4476     }
4477     XSRETURN(1);
4478 #else
4479     c_fun_not_there("panel_above");
4480     XSRETURN(0);
4481 #endif
4482 }
4483 
XS(XS_Curses_panel_below)4484 XS(XS_Curses_panel_below)
4485 {
4486     dXSARGS;
4487 #ifdef C_PANEL_BELOW
4488     c_exactargs("panel_below", items, 1);
4489     {
4490     PANEL * pan = ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
4491     PANEL * ret = panel_below(pan);
4492 
4493     ST(0) = sv_newmortal();
4494     c_panel2sv(ST(0), ret);
4495     }
4496     XSRETURN(1);
4497 #else
4498     c_fun_not_there("panel_below");
4499     XSRETURN(0);
4500 #endif
4501 }
4502 
XS(XS_Curses_set_panel_userptr)4503 XS(XS_Curses_set_panel_userptr)
4504 {
4505     dXSARGS;
4506 #ifdef C_SET_PANEL_USERPTR
4507     c_exactargs("set_panel_userptr", items, 2);
4508     {
4509     PANEL * pan = c_sv2panel(ST(0), 0);
4510     char *  ptr = (char *)SvPV_nolen(ST(1));
4511     int ret = set_panel_userptr(pan, ptr);
4512 
4513     ST(0) = sv_newmortal();
4514     sv_setiv(ST(0), (IV)ret);
4515     }
4516     XSRETURN(1);
4517 #else
4518     c_fun_not_there("set_panel_userptr");
4519     XSRETURN(0);
4520 #endif
4521 }
4522 
XS(XS_Curses_panel_userptr)4523 XS(XS_Curses_panel_userptr)
4524 {
4525     dXSARGS;
4526 #ifdef C_PANEL_USERPTR
4527     c_exactargs("panel_userptr", items, 1);
4528     {
4529     PANEL * pan = c_sv2panel(ST(0), 0);
4530     char *  ret = (char *)panel_userptr(pan);
4531 
4532     ST(0) = sv_newmortal();
4533     sv_setpv((SV*)ST(0), ret);
4534     }
4535     XSRETURN(1);
4536 #else
4537     c_fun_not_there("panel_userptr");
4538     XSRETURN(0);
4539 #endif
4540 }
4541 
XS(XS_Curses_del_panel)4542 XS(XS_Curses_del_panel)
4543 {
4544     dXSARGS;
4545 #ifdef C_DEL_PANEL
4546     c_exactargs("del_panel", items, 1);
4547     {
4548     PANEL * pan = c_sv2panel(ST(0), 0);
4549     int ret = del_panel(pan);
4550 
4551     ST(0) = sv_newmortal();
4552     sv_setiv(ST(0), (IV)ret);
4553     }
4554     XSRETURN(1);
4555 #else
4556     c_fun_not_there("del_panel");
4557     XSRETURN(0);
4558 #endif
4559 }
4560 
4561 
4562 /* Menu functions */
4563 
4564 /* menu_attributes */
4565 
XS(XS_Curses_set_menu_fore)4566 XS(XS_Curses_set_menu_fore)
4567 {
4568     dXSARGS;
4569 #ifdef C_SET_MENU_FORE
4570     c_exactargs("set_menu_fore", items, 2);
4571     {
4572     MENU *  menu    = c_sv2menu(ST(0), 0);
4573     chtype  attr    = c_sv2chtype(ST(1));
4574     int ret = set_menu_fore(menu, attr);
4575 
4576     ST(0) = sv_newmortal();
4577     sv_setiv(ST(0), (IV)ret);
4578     }
4579     XSRETURN(1);
4580 #else
4581     c_fun_not_there("set_menu_fore");
4582     XSRETURN(0);
4583 #endif
4584 }
4585 
XS(XS_Curses_menu_fore)4586 XS(XS_Curses_menu_fore)
4587 {
4588     dXSARGS;
4589 #ifdef C_MENU_FORE
4590     c_exactargs("menu_fore", items, 1);
4591     {
4592     MENU *  menu    = c_sv2menu(ST(0), 0);
4593     chtype  ret = menu_fore(menu);
4594 
4595     ST(0) = sv_newmortal();
4596     c_chtype2sv(ST(0), ret);
4597     }
4598     XSRETURN(1);
4599 #else
4600     c_fun_not_there("menu_fore");
4601     XSRETURN(0);
4602 #endif
4603 }
4604 
XS(XS_Curses_set_menu_back)4605 XS(XS_Curses_set_menu_back)
4606 {
4607     dXSARGS;
4608 #ifdef C_SET_MENU_BACK
4609     c_exactargs("set_menu_back", items, 2);
4610     {
4611     MENU *  menu    = c_sv2menu(ST(0), 0);
4612     chtype  attr    = c_sv2chtype(ST(1));
4613     int ret = set_menu_back(menu, attr);
4614 
4615     ST(0) = sv_newmortal();
4616     sv_setiv(ST(0), (IV)ret);
4617     }
4618     XSRETURN(1);
4619 #else
4620     c_fun_not_there("set_menu_back");
4621     XSRETURN(0);
4622 #endif
4623 }
4624 
XS(XS_Curses_menu_back)4625 XS(XS_Curses_menu_back)
4626 {
4627     dXSARGS;
4628 #ifdef C_MENU_BACK
4629     c_exactargs("menu_back", items, 1);
4630     {
4631     MENU *  menu    = c_sv2menu(ST(0), 0);
4632     chtype  ret = menu_back(menu);
4633 
4634     ST(0) = sv_newmortal();
4635     c_chtype2sv(ST(0), ret);
4636     }
4637     XSRETURN(1);
4638 #else
4639     c_fun_not_there("menu_back");
4640     XSRETURN(0);
4641 #endif
4642 }
4643 
XS(XS_Curses_set_menu_grey)4644 XS(XS_Curses_set_menu_grey)
4645 {
4646     dXSARGS;
4647 #ifdef C_SET_MENU_GREY
4648     c_exactargs("set_menu_grey", items, 2);
4649     {
4650     MENU *  menu    = c_sv2menu(ST(0), 0);
4651     chtype  attr    = c_sv2chtype(ST(1));
4652     int ret = set_menu_grey(menu, attr);
4653 
4654     ST(0) = sv_newmortal();
4655     sv_setiv(ST(0), (IV)ret);
4656     }
4657     XSRETURN(1);
4658 #else
4659     c_fun_not_there("set_menu_grey");
4660     XSRETURN(0);
4661 #endif
4662 }
4663 
XS(XS_Curses_menu_grey)4664 XS(XS_Curses_menu_grey)
4665 {
4666     dXSARGS;
4667 #ifdef C_MENU_GREY
4668     c_exactargs("menu_grey", items, 1);
4669     {
4670     MENU *  menu    = c_sv2menu(ST(0), 0);
4671     chtype  ret = menu_grey(menu);
4672 
4673     ST(0) = sv_newmortal();
4674     c_chtype2sv(ST(0), ret);
4675     }
4676     XSRETURN(1);
4677 #else
4678     c_fun_not_there("menu_grey");
4679     XSRETURN(0);
4680 #endif
4681 }
4682 
XS(XS_Curses_set_menu_pad)4683 XS(XS_Curses_set_menu_pad)
4684 {
4685     dXSARGS;
4686 #ifdef C_SET_MENU_PAD
4687     c_exactargs("set_menu_pad", items, 2);
4688     {
4689     MENU *  menu    = c_sv2menu(ST(0), 0);
4690     int pad = (int)SvIV(ST(1));
4691     int ret = set_menu_pad(menu, pad);
4692 
4693     ST(0) = sv_newmortal();
4694     sv_setiv(ST(0), (IV)ret);
4695     }
4696     XSRETURN(1);
4697 #else
4698     c_fun_not_there("set_menu_pad");
4699     XSRETURN(0);
4700 #endif
4701 }
4702 
XS(XS_Curses_menu_pad)4703 XS(XS_Curses_menu_pad)
4704 {
4705     dXSARGS;
4706 #ifdef C_MENU_PAD
4707     c_exactargs("menu_pad", items, 1);
4708     {
4709     MENU *  menu    = c_sv2menu(ST(0), 0);
4710     int ret = menu_pad(menu);
4711 
4712     ST(0) = sv_newmortal();
4713     sv_setiv(ST(0), (IV)ret);
4714     }
4715     XSRETURN(1);
4716 #else
4717     c_fun_not_there("menu_pad");
4718     XSRETURN(0);
4719 #endif
4720 }
4721 
4722 
4723 /* menu_cursor */
4724 
XS(XS_Curses_pos_menu_cursor)4725 XS(XS_Curses_pos_menu_cursor)
4726 {
4727     dXSARGS;
4728 #ifdef C_POS_MENU_CURSOR
4729     c_exactargs("pos_menu_cursor", items, 1);
4730     {
4731     MENU *  menu    = c_sv2menu(ST(0), 0);
4732     int ret = pos_menu_cursor(menu);
4733 
4734     ST(0) = sv_newmortal();
4735     sv_setiv(ST(0), (IV)ret);
4736     }
4737     XSRETURN(1);
4738 #else
4739     c_fun_not_there("pos_menu_cursor");
4740     XSRETURN(0);
4741 #endif
4742 }
4743 
4744 
4745 /* menu_driver */
4746 
XS(XS_Curses_menu_driver)4747 XS(XS_Curses_menu_driver)
4748 {
4749     dXSARGS;
4750 #ifdef C_MENU_DRIVER
4751     c_exactargs("menu_driver", items, 2);
4752     {
4753     MENU *  menu    = c_sv2menu(ST(0), 0);
4754     int c   = (int)SvIV(ST(1));
4755     int ret = menu_driver(menu, c);
4756 
4757     ST(0) = sv_newmortal();
4758     sv_setiv(ST(0), (IV)ret);
4759     }
4760     XSRETURN(1);
4761 #else
4762     c_fun_not_there("menu_driver");
4763     XSRETURN(0);
4764 #endif
4765 }
4766 
4767 
4768 /* menu_format */
4769 
XS(XS_Curses_set_menu_format)4770 XS(XS_Curses_set_menu_format)
4771 {
4772     dXSARGS;
4773 #ifdef C_SET_MENU_FORMAT
4774     c_exactargs("set_menu_format", items, 3);
4775     {
4776     MENU *  menu    = c_sv2menu(ST(0), 0);
4777     int rows    = (int)SvIV(ST(1));
4778     int cols    = (int)SvIV(ST(2));
4779     int ret = set_menu_format(menu, rows, cols);
4780 
4781     ST(0) = sv_newmortal();
4782     sv_setiv(ST(0), (IV)ret);
4783     }
4784     XSRETURN(1);
4785 #else
4786     c_fun_not_there("set_menu_format");
4787     XSRETURN(0);
4788 #endif
4789 }
4790 
XS(XS_Curses_menu_format)4791 XS(XS_Curses_menu_format)
4792 {
4793     dXSARGS;
4794 #ifdef C_MENU_FORMAT
4795     c_exactargs("menu_format", items, 3);
4796     {
4797     MENU *  menu    = c_sv2menu(ST(0), 0);
4798     int rows    = 0;
4799     int cols    = 0;
4800 
4801     menu_format(menu, &rows, &cols);
4802     sv_setiv(ST(1), (IV)rows);;
4803     sv_setiv(ST(2), (IV)cols);;
4804     }
4805     XSRETURN(0);
4806 #else
4807     c_fun_not_there("menu_format");
4808     XSRETURN(0);
4809 #endif
4810 }
4811 
4812 
4813 /* menu_items */
4814 
XS(XS_Curses_set_menu_items)4815 XS(XS_Curses_set_menu_items)
4816 {
4817     dXSARGS;
4818 #ifdef C_SET_MENU_ITEMS
4819     c_exactargs("set_menu_items", items, 2);
4820     {
4821     MENU *  menu    = c_sv2menu(ST(0), 0);
4822     ITEM ** items   = (ITEM **)SvPV_nolen(ST(1));
4823     int ret = set_menu_items(menu, items);
4824 
4825     ST(0) = sv_newmortal();
4826     sv_setiv(ST(0), (IV)ret);
4827     }
4828     XSRETURN(1);
4829 #else
4830     c_fun_not_there("set_menu_items");
4831     XSRETURN(0);
4832 #endif
4833 }
4834 
XS(XS_Curses_menu_items)4835 XS(XS_Curses_menu_items)
4836 {
4837     dXSARGS;
4838 #ifdef C_MENU_ITEMS
4839     c_exactargs("menu_items", items, 1);
4840     {
4841     MENU *  menu    = c_sv2menu(ST(0), 0);
4842     ITEM ** ret = menu_items(menu);
4843 
4844     ST(0) = sv_newmortal();
4845     sv_setpv((SV*)ST(0), (char *)ret);
4846     }
4847     XSRETURN(1);
4848 #else
4849     c_fun_not_there("menu_items");
4850     XSRETURN(0);
4851 #endif
4852 }
4853 
XS(XS_Curses_item_count)4854 XS(XS_Curses_item_count)
4855 {
4856     dXSARGS;
4857 #ifdef C_ITEM_COUNT
4858     c_exactargs("item_count", items, 1);
4859     {
4860     MENU *  menu    = c_sv2menu(ST(0), 0);
4861     int ret = item_count(menu);
4862 
4863     ST(0) = sv_newmortal();
4864     sv_setiv(ST(0), (IV)ret);
4865     }
4866     XSRETURN(1);
4867 #else
4868     c_fun_not_there("item_count");
4869     XSRETURN(0);
4870 #endif
4871 }
4872 
4873 
4874 /* menu_mark */
4875 
XS(XS_Curses_set_menu_mark)4876 XS(XS_Curses_set_menu_mark)
4877 {
4878     dXSARGS;
4879 #ifdef C_SET_MENU_MARK
4880     c_exactargs("set_menu_mark", items, 2);
4881     {
4882     MENU *  menu    = c_sv2menu(ST(0), 0);
4883     char *  mark    = (char *)SvPV_nolen(ST(1));
4884     int ret = set_menu_mark(menu, mark);
4885 
4886     ST(0) = sv_newmortal();
4887     sv_setiv(ST(0), (IV)ret);
4888     }
4889     XSRETURN(1);
4890 #else
4891     c_fun_not_there("set_menu_mark");
4892     XSRETURN(0);
4893 #endif
4894 }
4895 
XS(XS_Curses_menu_mark)4896 XS(XS_Curses_menu_mark)
4897 {
4898     dXSARGS;
4899 #ifdef C_MENU_MARK
4900     c_exactargs("menu_mark", items, 1);
4901     {
4902     MENU *  menu    = c_sv2menu(ST(0), 0);
4903     char *  ret = (char *)menu_mark(menu);
4904 
4905     ST(0) = sv_newmortal();
4906     sv_setpv((SV*)ST(0), ret);
4907     }
4908     XSRETURN(1);
4909 #else
4910     c_fun_not_there("menu_mark");
4911     XSRETURN(0);
4912 #endif
4913 }
4914 
4915 
4916 
XS(XS_Curses_new_menu)4917 XS(XS_Curses_new_menu)
4918 {
4919     dXSARGS;
4920 #ifdef C_NEW_MENU
4921     c_exactargs("new_menu", items, 1);
4922     {
4923         ITEM ** items   = (ITEM **)SvPV_nolen(ST(0));
4924         MENU *  ret = new_menu(items);
4925 
4926         ST(0) = sv_newmortal();
4927         c_menu2sv(ST(0), ret);
4928     }
4929     XSRETURN(1);
4930 #else
4931     c_fun_not_there("new_menu");
4932     XSRETURN(0);
4933 #endif
4934 }
4935 
4936 
4937 
XS(XS_Curses_free_menu)4938 XS(XS_Curses_free_menu)
4939 {
4940     dXSARGS;
4941 #ifdef C_FREE_MENU
4942     c_exactargs("free_menu", items, 1);
4943     {
4944     MENU *  menu    = c_sv2menu(ST(0), 0);
4945     int ret = free_menu(menu);
4946 
4947     ST(0) = sv_newmortal();
4948     sv_setiv(ST(0), (IV)ret);
4949     }
4950     XSRETURN(1);
4951 #else
4952     c_fun_not_there("free_menu");
4953     XSRETURN(0);
4954 #endif
4955 }
4956 
4957 
4958 /* menu_opts */
4959 
XS(XS_Curses_menu_opts)4960 XS(XS_Curses_menu_opts)
4961 {
4962     dXSARGS;
4963 #ifdef C_MENU_OPTS
4964     c_exactargs("menu_opts", items, 1);
4965     {
4966     MENU *  menu    = c_sv2menu(ST(0), 0);
4967     int ret = menu_opts(menu);
4968 
4969     ST(0) = sv_newmortal();
4970     sv_setiv(ST(0), (IV)ret);
4971     }
4972     XSRETURN(1);
4973 #else
4974     c_fun_not_there("menu_opts");
4975     XSRETURN(0);
4976 #endif
4977 }
4978 
XS(XS_Curses_set_menu_opts)4979 XS(XS_Curses_set_menu_opts)
4980 {
4981     dXSARGS;
4982 #ifdef C_SET_MENU_OPTS
4983     c_exactargs("set_menu_opts", items, 2);
4984     {
4985     MENU *  menu    = c_sv2menu(ST(0), 0);
4986     int opts    = (int)SvIV(ST(1));
4987     int ret = set_menu_opts(menu, opts);
4988 
4989     ST(0) = sv_newmortal();
4990     sv_setiv(ST(0), (IV)ret);
4991     }
4992     XSRETURN(1);
4993 #else
4994     c_fun_not_there("set_menu_opts");
4995     XSRETURN(0);
4996 #endif
4997 }
4998 
XS(XS_Curses_menu_opts_on)4999 XS(XS_Curses_menu_opts_on)
5000 {
5001     dXSARGS;
5002 #ifdef C_MENU_OPTS_ON
5003     c_exactargs("menu_opts_on", items, 2);
5004     {
5005     MENU *  menu    = c_sv2menu(ST(0), 0);
5006     int opts    = (int)SvIV(ST(1));
5007     int ret = menu_opts_on(menu, opts);
5008 
5009     ST(0) = sv_newmortal();
5010     sv_setiv(ST(0), (IV)ret);
5011     }
5012     XSRETURN(1);
5013 #else
5014     c_fun_not_there("menu_opts_on");
5015     XSRETURN(0);
5016 #endif
5017 }
5018 
XS(XS_Curses_menu_opts_off)5019 XS(XS_Curses_menu_opts_off)
5020 {
5021     dXSARGS;
5022 #ifdef C_MENU_OPTS_OFF
5023     c_exactargs("menu_opts_off", items, 2);
5024     {
5025     MENU *  menu    = c_sv2menu(ST(0), 0);
5026     int opts    = (int)SvIV(ST(1));
5027     int ret = menu_opts_off(menu, opts);
5028 
5029     ST(0) = sv_newmortal();
5030     sv_setiv(ST(0), (IV)ret);
5031     }
5032     XSRETURN(1);
5033 #else
5034     c_fun_not_there("menu_opts_off");
5035     XSRETURN(0);
5036 #endif
5037 }
5038 
5039 
5040 /* menu_pattern */
5041 
XS(XS_Curses_set_menu_pattern)5042 XS(XS_Curses_set_menu_pattern)
5043 {
5044     dXSARGS;
5045 #ifdef C_SET_MENU_PATTERN
5046     c_exactargs("set_menu_pattern", items, 2);
5047     {
5048     MENU *  menu    = c_sv2menu(ST(0), 0);
5049     char *  pattern = (char *)SvPV_nolen(ST(1));
5050     int ret = set_menu_pattern(menu, pattern);
5051 
5052     ST(0) = sv_newmortal();
5053     sv_setiv(ST(0), (IV)ret);
5054     }
5055     XSRETURN(1);
5056 #else
5057     c_fun_not_there("set_menu_pattern");
5058     XSRETURN(0);
5059 #endif
5060 }
5061 
XS(XS_Curses_menu_pattern)5062 XS(XS_Curses_menu_pattern)
5063 {
5064     dXSARGS;
5065 #ifdef C_MENU_PATTERN
5066     c_exactargs("menu_pattern", items, 1);
5067     {
5068     MENU *  menu    = c_sv2menu(ST(0), 0);
5069     char *  ret = menu_pattern(menu);
5070 
5071     ST(0) = sv_newmortal();
5072     sv_setpv((SV*)ST(0), ret);
5073     }
5074     XSRETURN(1);
5075 #else
5076     c_fun_not_there("menu_pattern");
5077     XSRETURN(0);
5078 #endif
5079 }
5080 
5081 
5082 /* menu_post */
5083 
XS(XS_Curses_post_menu)5084 XS(XS_Curses_post_menu)
5085 {
5086     dXSARGS;
5087 #ifdef C_POST_MENU
5088     c_exactargs("post_menu", items, 1);
5089     {
5090     MENU *  menu    = c_sv2menu(ST(0), 0);
5091     int ret = post_menu(menu);
5092 
5093     ST(0) = sv_newmortal();
5094     sv_setiv(ST(0), (IV)ret);
5095     }
5096     XSRETURN(1);
5097 #else
5098     c_fun_not_there("post_menu");
5099     XSRETURN(0);
5100 #endif
5101 }
5102 
XS(XS_Curses_unpost_menu)5103 XS(XS_Curses_unpost_menu)
5104 {
5105     dXSARGS;
5106 #ifdef C_UNPOST_MENU
5107     c_exactargs("unpost_menu", items, 1);
5108     {
5109     MENU *  menu    = c_sv2menu(ST(0), 0);
5110     int ret = unpost_menu(menu);
5111 
5112     ST(0) = sv_newmortal();
5113     sv_setiv(ST(0), (IV)ret);
5114     }
5115     XSRETURN(1);
5116 #else
5117     c_fun_not_there("unpost_menu");
5118     XSRETURN(0);
5119 #endif
5120 }
5121 
5122 
5123 /* menu_userptr */
5124 
XS(XS_Curses_set_menu_userptr)5125 XS(XS_Curses_set_menu_userptr)
5126 {
5127     dXSARGS;
5128 #ifdef C_SET_MENU_USERPTR
5129     c_exactargs("set_menu_userptr", items, 2);
5130     {
5131     MENU *  item    = c_sv2menu(ST(0), 0);
5132     char *  userptr = (char *)SvPV_nolen(ST(1));
5133     int ret = set_menu_userptr(item, userptr);
5134 
5135     ST(0) = sv_newmortal();
5136     sv_setiv(ST(0), (IV)ret);
5137     }
5138     XSRETURN(1);
5139 #else
5140     c_fun_not_there("set_menu_userptr");
5141     XSRETURN(0);
5142 #endif
5143 }
5144 
XS(XS_Curses_menu_userptr)5145 XS(XS_Curses_menu_userptr)
5146 {
5147     dXSARGS;
5148 #ifdef C_MENU_USERPTR
5149     c_exactargs("menu_userptr", items, 1);
5150     {
5151     MENU *  item    = c_sv2menu(ST(0), 0);
5152     char *  ret = menu_userptr(item);
5153 
5154     ST(0) = sv_newmortal();
5155     sv_setpv((SV*)ST(0), ret);
5156     }
5157     XSRETURN(1);
5158 #else
5159     c_fun_not_there("menu_userptr");
5160     XSRETURN(0);
5161 #endif
5162 }
5163 
5164 
5165 /* menu_win */
5166 
XS(XS_Curses_set_menu_win)5167 XS(XS_Curses_set_menu_win)
5168 {
5169     dXSARGS;
5170 #ifdef C_SET_MENU_WIN
5171     c_exactargs("set_menu_win", items, 2);
5172     {
5173     MENU *  menu    = c_sv2menu(ST(0), 0);
5174     WINDOW *win = c_sv2window(ST(1), 1);
5175     int ret = set_menu_win(menu, win);
5176 
5177     ST(0) = sv_newmortal();
5178     sv_setiv(ST(0), (IV)ret);
5179     }
5180     XSRETURN(1);
5181 #else
5182     c_fun_not_there("set_menu_win");
5183     XSRETURN(0);
5184 #endif
5185 }
5186 
XS(XS_Curses_menu_win)5187 XS(XS_Curses_menu_win)
5188 {
5189     dXSARGS;
5190 #ifdef C_MENU_WIN
5191     c_exactargs("menu_win", items, 1);
5192     {
5193     MENU *  menu    = c_sv2menu(ST(0), 0);
5194     WINDOW *    ret = menu_win(menu);
5195 
5196     ST(0) = sv_newmortal();
5197     c_window2sv(ST(0), ret);
5198     }
5199     XSRETURN(1);
5200 #else
5201     c_fun_not_there("menu_win");
5202     XSRETURN(0);
5203 #endif
5204 }
5205 
XS(XS_Curses_set_menu_sub)5206 XS(XS_Curses_set_menu_sub)
5207 {
5208     dXSARGS;
5209 #ifdef C_SET_MENU_SUB
5210     c_exactargs("set_menu_sub", items, 2);
5211     {
5212     MENU *  menu    = c_sv2menu(ST(0), 0);
5213     WINDOW *win = c_sv2window(ST(1), 1);
5214     int ret = set_menu_sub(menu, win);
5215 
5216     ST(0) = sv_newmortal();
5217     sv_setiv(ST(0), (IV)ret);
5218     }
5219     XSRETURN(1);
5220 #else
5221     c_fun_not_there("set_menu_sub");
5222     XSRETURN(0);
5223 #endif
5224 }
5225 
XS(XS_Curses_menu_sub)5226 XS(XS_Curses_menu_sub)
5227 {
5228     dXSARGS;
5229 #ifdef C_MENU_SUB
5230     c_exactargs("menu_sub", items, 1);
5231     {
5232     MENU *  menu    = c_sv2menu(ST(0), 0);
5233     WINDOW *    ret = menu_sub(menu);
5234 
5235     ST(0) = sv_newmortal();
5236     c_window2sv(ST(0), ret);
5237     }
5238     XSRETURN(1);
5239 #else
5240     c_fun_not_there("menu_sub");
5241     XSRETURN(0);
5242 #endif
5243 }
5244 
XS(XS_Curses_scale_menu)5245 XS(XS_Curses_scale_menu)
5246 {
5247     dXSARGS;
5248 #ifdef C_SCALE_MENU
5249     c_exactargs("scale_menu", items, 3);
5250     {
5251     MENU *  menu    = c_sv2menu(ST(0), 0);
5252     int rows    = 0;
5253     int cols    = 0;
5254     int ret = scale_menu(menu, &rows, &cols);
5255 
5256     sv_setiv(ST(1), (IV)rows);;
5257     sv_setiv(ST(2), (IV)cols);;
5258     ST(0) = sv_newmortal();
5259     sv_setiv(ST(0), (IV)ret);
5260     }
5261     XSRETURN(1);
5262 #else
5263     c_fun_not_there("scale_menu");
5264     XSRETURN(0);
5265 #endif
5266 }
5267 
5268 
5269 /* menu_item_current */
5270 
XS(XS_Curses_set_current_item)5271 XS(XS_Curses_set_current_item)
5272 {
5273     dXSARGS;
5274 #ifdef C_SET_CURRENT_ITEM
5275     c_exactargs("set_current_item", items, 2);
5276     {
5277     MENU *  menu    = c_sv2menu(ST(0), 0);
5278     ITEM *  item    = c_sv2item(ST(1), 1);
5279     int ret = set_current_item(menu, item);
5280 
5281     ST(0) = sv_newmortal();
5282     sv_setiv(ST(0), (IV)ret);
5283     }
5284     XSRETURN(1);
5285 #else
5286     c_fun_not_there("set_current_item");
5287     XSRETURN(0);
5288 #endif
5289 }
5290 
XS(XS_Curses_current_item)5291 XS(XS_Curses_current_item)
5292 {
5293     dXSARGS;
5294 #ifdef C_CURRENT_ITEM
5295     c_exactargs("current_item", items, 1);
5296     {
5297     MENU *  menu    = c_sv2menu(ST(0), 0);
5298     ITEM *  ret = current_item(menu);
5299 
5300     ST(0) = sv_newmortal();
5301     c_item2sv(ST(0), ret);
5302     }
5303     XSRETURN(1);
5304 #else
5305     c_fun_not_there("current_item");
5306     XSRETURN(0);
5307 #endif
5308 }
5309 
XS(XS_Curses_set_top_row)5310 XS(XS_Curses_set_top_row)
5311 {
5312     dXSARGS;
5313 #ifdef C_SET_TOP_ROW
5314     c_exactargs("set_top_row", items, 2);
5315     {
5316     MENU *  menu    = c_sv2menu(ST(0), 0);
5317     int row = (int)SvIV(ST(1));
5318     int ret = set_top_row(menu, row);
5319 
5320     ST(0) = sv_newmortal();
5321     sv_setiv(ST(0), (IV)ret);
5322     }
5323     XSRETURN(1);
5324 #else
5325     c_fun_not_there("set_top_row");
5326     XSRETURN(0);
5327 #endif
5328 }
5329 
XS(XS_Curses_top_row)5330 XS(XS_Curses_top_row)
5331 {
5332     dXSARGS;
5333 #ifdef C_TOP_ROW
5334     c_exactargs("top_row", items, 1);
5335     {
5336     MENU *  menu    = c_sv2menu(ST(0), 0);
5337     int ret = top_row(menu);
5338 
5339     ST(0) = sv_newmortal();
5340     sv_setiv(ST(0), (IV)ret);
5341     }
5342     XSRETURN(1);
5343 #else
5344     c_fun_not_there("top_row");
5345     XSRETURN(0);
5346 #endif
5347 }
5348 
XS(XS_Curses_item_index)5349 XS(XS_Curses_item_index)
5350 {
5351     dXSARGS;
5352 #ifdef C_ITEM_INDEX
5353     c_exactargs("item_index", items, 1);
5354     {
5355     ITEM *  item    = c_sv2item(ST(0), 0);
5356     int ret = item_index(item);
5357 
5358     ST(0) = sv_newmortal();
5359     sv_setiv(ST(0), (IV)ret);
5360     }
5361     XSRETURN(1);
5362 #else
5363     c_fun_not_there("item_index");
5364     XSRETURN(0);
5365 #endif
5366 }
5367 
5368 
5369 /* menu_item_name */
5370 
XS(XS_Curses_item_name)5371 XS(XS_Curses_item_name)
5372 {
5373     dXSARGS;
5374 #ifdef C_ITEM_NAME
5375     c_exactargs("item_name", items, 1);
5376     {
5377     ITEM *  item    = c_sv2item(ST(0), 0);
5378     char *  ret = (char *)item_name(item);
5379 
5380     ST(0) = sv_newmortal();
5381     sv_setpv((SV*)ST(0), ret);
5382     }
5383     XSRETURN(1);
5384 #else
5385     c_fun_not_there("item_name");
5386     XSRETURN(0);
5387 #endif
5388 }
5389 
XS(XS_Curses_item_description)5390 XS(XS_Curses_item_description)
5391 {
5392     dXSARGS;
5393 #ifdef C_ITEM_DESCRIPTION
5394     c_exactargs("item_description", items, 1);
5395     {
5396     ITEM *  item    = c_sv2item(ST(0), 0);
5397     char *  ret = (char *)item_description(item);
5398 
5399     ST(0) = sv_newmortal();
5400     sv_setpv((SV*)ST(0), ret);
5401     }
5402     XSRETURN(1);
5403 #else
5404     c_fun_not_there("item_description");
5405     XSRETURN(0);
5406 #endif
5407 }
5408 
5409 
5410 /* menu_item_new */
5411 
XS(XS_Curses_new_item)5412 XS(XS_Curses_new_item)
5413 {
5414     dXSARGS;
5415 #ifdef C_NEW_ITEM
5416     c_exactargs("new_item", items, 2);
5417     {
5418         char *  name    = (char *)SvPV_nolen(ST(0));
5419         char *  descr   = (char *)SvPV_nolen(ST(1));
5420 
5421         ITEM *  ret = new_item(name, descr);
5422 
5423         ST(0) = sv_newmortal();
5424         c_item2sv(ST(0), ret);
5425     }
5426     XSRETURN(1);
5427 #else
5428     c_fun_not_there("new_item");
5429     XSRETURN(0);
5430 #endif
5431 }
5432 
XS(XS_Curses_free_item)5433 XS(XS_Curses_free_item)
5434 {
5435     dXSARGS;
5436 #ifdef C_FREE_ITEM
5437     c_exactargs("free_item", items, 1);
5438     {
5439     ITEM *  item    = c_sv2item(ST(0), 0);
5440     int ret = free_item(item);
5441 
5442     ST(0) = sv_newmortal();
5443     sv_setiv(ST(0), (IV)ret);
5444     }
5445     XSRETURN(1);
5446 #else
5447     c_fun_not_there("free_item");
5448     XSRETURN(0);
5449 #endif
5450 }
5451 
5452 
5453 /* menu_item_opts */
5454 
XS(XS_Curses_set_item_opts)5455 XS(XS_Curses_set_item_opts)
5456 {
5457     dXSARGS;
5458 #ifdef C_SET_ITEM_OPTS
5459     c_exactargs("set_item_opts", items, 2);
5460     {
5461     ITEM *  item    = c_sv2item(ST(0), 0);
5462     int opts    = (int)SvIV(ST(1));
5463     int ret = set_item_opts(item, opts);
5464 
5465     ST(0) = sv_newmortal();
5466     sv_setiv(ST(0), (IV)ret);
5467     }
5468     XSRETURN(1);
5469 #else
5470     c_fun_not_there("set_item_opts");
5471     XSRETURN(0);
5472 #endif
5473 }
5474 
XS(XS_Curses_item_opts_on)5475 XS(XS_Curses_item_opts_on)
5476 {
5477     dXSARGS;
5478 #ifdef C_ITEM_OPTS_ON
5479     c_exactargs("item_opts_on", items, 2);
5480     {
5481     ITEM *  item    = c_sv2item(ST(0), 0);
5482     int opts    = (int)SvIV(ST(1));
5483     int ret = item_opts_on(item, opts);
5484 
5485     ST(0) = sv_newmortal();
5486     sv_setiv(ST(0), (IV)ret);
5487     }
5488     XSRETURN(1);
5489 #else
5490     c_fun_not_there("item_opts_on");
5491     XSRETURN(0);
5492 #endif
5493 }
5494 
XS(XS_Curses_item_opts_off)5495 XS(XS_Curses_item_opts_off)
5496 {
5497     dXSARGS;
5498 #ifdef C_ITEM_OPTS_OFF
5499     c_exactargs("item_opts_off", items, 2);
5500     {
5501     ITEM *  item    = c_sv2item(ST(0), 0);
5502     int opts    = (int)SvIV(ST(1));
5503     int ret = item_opts_off(item, opts);
5504 
5505     ST(0) = sv_newmortal();
5506     sv_setiv(ST(0), (IV)ret);
5507     }
5508     XSRETURN(1);
5509 #else
5510     c_fun_not_there("item_opts_off");
5511     XSRETURN(0);
5512 #endif
5513 }
5514 
XS(XS_Curses_item_opts)5515 XS(XS_Curses_item_opts)
5516 {
5517     dXSARGS;
5518 #ifdef C_ITEM_OPTS
5519     c_exactargs("item_opts", items, 1);
5520     {
5521     ITEM *  item    = c_sv2item(ST(0), 0);
5522     int ret = item_opts(item);
5523 
5524     ST(0) = sv_newmortal();
5525     sv_setiv(ST(0), (IV)ret);
5526     }
5527     XSRETURN(1);
5528 #else
5529     c_fun_not_there("item_opts");
5530     XSRETURN(0);
5531 #endif
5532 }
5533 
5534 
5535 /* menu_item_userptr */
5536 
XS(XS_Curses_item_userptr)5537 XS(XS_Curses_item_userptr)
5538 {
5539     dXSARGS;
5540 #ifdef C_ITEM_USERPTR
5541     c_exactargs("item_userptr", items, 1);
5542     {
5543     ITEM *  item    = c_sv2item(ST(0), 0);
5544     char *  ret = (char *)item_userptr(item);
5545 
5546     ST(0) = sv_newmortal();
5547     sv_setpv((SV*)ST(0), ret);
5548     }
5549     XSRETURN(1);
5550 #else
5551     c_fun_not_there("item_userptr");
5552     XSRETURN(0);
5553 #endif
5554 }
5555 
XS(XS_Curses_set_item_userptr)5556 XS(XS_Curses_set_item_userptr)
5557 {
5558     dXSARGS;
5559 #ifdef C_SET_ITEM_USERPTR
5560     c_exactargs("set_item_userptr", items, 2);
5561     {
5562     ITEM *  item    = c_sv2item(ST(0), 0);
5563     char *  ptr = (char *)SvPV_nolen(ST(1));
5564     int ret = set_item_userptr(item, ptr);
5565 
5566     ST(0) = sv_newmortal();
5567     sv_setiv(ST(0), (IV)ret);
5568     }
5569     XSRETURN(1);
5570 #else
5571     c_fun_not_there("set_item_userptr");
5572     XSRETURN(0);
5573 #endif
5574 }
5575 
5576 
5577 /* menu_item_value */
5578 
XS(XS_Curses_set_item_value)5579 XS(XS_Curses_set_item_value)
5580 {
5581     dXSARGS;
5582 #ifdef C_SET_ITEM_VALUE
5583     c_exactargs("set_item_value", items, 2);
5584     {
5585     ITEM *  item    = c_sv2item(ST(0), 0);
5586     bool    val = (int)SvIV(ST(1));
5587     int ret = set_item_value(item, val);
5588 
5589     ST(0) = sv_newmortal();
5590     sv_setiv(ST(0), (IV)ret);
5591     }
5592     XSRETURN(1);
5593 #else
5594     c_fun_not_there("set_item_value");
5595     XSRETURN(0);
5596 #endif
5597 }
5598 
XS(XS_Curses_item_value)5599 XS(XS_Curses_item_value)
5600 {
5601     dXSARGS;
5602 #ifdef C_ITEM_VALUE
5603     c_exactargs("item_value", items, 1);
5604     {
5605     ITEM *  item    = c_sv2item(ST(0), 0);
5606     bool    ret = item_value(item);
5607 
5608     ST(0) = sv_newmortal();
5609     sv_setiv(ST(0), (IV)ret);
5610     }
5611     XSRETURN(1);
5612 #else
5613     c_fun_not_there("item_value");
5614     XSRETURN(0);
5615 #endif
5616 }
5617 
5618 
5619 /* menu_item_visible */
5620 
XS(XS_Curses_item_visible)5621 XS(XS_Curses_item_visible)
5622 {
5623     dXSARGS;
5624 #ifdef C_ITEM_VISIBLE
5625     c_exactargs("item_visible", items, 1);
5626     {
5627     ITEM *  item    = c_sv2item(ST(0), 0);
5628     bool    ret = item_visible(item);
5629 
5630     ST(0) = sv_newmortal();
5631     sv_setiv(ST(0), (IV)ret);
5632     }
5633     XSRETURN(1);
5634 #else
5635     c_fun_not_there("item_visible");
5636     XSRETURN(0);
5637 #endif
5638 }
5639 
5640 
5641 /* ncurses menu extension functions */
5642 
XS(XS_Curses_menu_request_name)5643 XS(XS_Curses_menu_request_name)
5644 {
5645     dXSARGS;
5646 #ifdef C_MENU_REQUEST_NAME
5647     c_exactargs("menu_request_name", items, 1);
5648     {
5649     int request = (int)SvIV(ST(0));
5650     char *  ret = (char *)menu_request_name(request);
5651 
5652     ST(0) = sv_newmortal();
5653     sv_setpv((SV*)ST(0), ret);
5654     }
5655     XSRETURN(1);
5656 #else
5657     c_fun_not_there("menu_request_name");
5658     XSRETURN(0);
5659 #endif
5660 }
5661 
XS(XS_Curses_menu_request_by_name)5662 XS(XS_Curses_menu_request_by_name)
5663 {
5664     dXSARGS;
5665 #ifdef C_MENU_REQUEST_BY_NAME
5666     c_exactargs("menu_request_by_name", items, 1);
5667     {
5668     char *  name    = (char *)SvPV_nolen(ST(0));
5669     int ret = menu_request_by_name(name);
5670 
5671     ST(0) = sv_newmortal();
5672     sv_setiv(ST(0), (IV)ret);
5673     }
5674     XSRETURN(1);
5675 #else
5676     c_fun_not_there("menu_request_by_name");
5677     XSRETURN(0);
5678 #endif
5679 }
5680 
XS(XS_Curses_set_menu_spacing)5681 XS(XS_Curses_set_menu_spacing)
5682 {
5683     dXSARGS;
5684 #ifdef C_SET_MENU_SPACING
5685     c_exactargs("set_menu_spacing", items, 4);
5686     {
5687     MENU *  menu    = c_sv2menu(ST(0), 0);
5688     int descr   = (int)SvIV(ST(1));
5689     int rows    = (int)SvIV(ST(2));
5690     int cols    = (int)SvIV(ST(3));
5691     int ret = set_menu_spacing(menu, descr, rows, cols);
5692 
5693     ST(0) = sv_newmortal();
5694     sv_setiv(ST(0), (IV)ret);
5695     }
5696     XSRETURN(1);
5697 #else
5698     c_fun_not_there("set_menu_spacing");
5699     XSRETURN(0);
5700 #endif
5701 }
5702 
XS(XS_Curses_menu_spacing)5703 XS(XS_Curses_menu_spacing)
5704 {
5705     dXSARGS;
5706 #ifdef C_MENU_SPACING
5707     c_exactargs("menu_spacing", items, 4);
5708     {
5709     MENU *  menu    = c_sv2menu(ST(0), 0);
5710     int descr   = 0;
5711     int rows    = 0;
5712     int cols    = 0;
5713     int ret = menu_spacing(menu, &descr, &rows, &cols);
5714 
5715     sv_setiv(ST(1), (IV)descr);;
5716     sv_setiv(ST(2), (IV)rows);;
5717     sv_setiv(ST(3), (IV)cols);;
5718     ST(0) = sv_newmortal();
5719     sv_setiv(ST(0), (IV)ret);
5720     }
5721     XSRETURN(1);
5722 #else
5723     c_fun_not_there("menu_spacing");
5724     XSRETURN(0);
5725 #endif
5726 }
5727 
5728 
5729 /* Form functions */
5730 
5731 /* form_cursor */
5732 
XS(XS_Curses_pos_form_cursor)5733 XS(XS_Curses_pos_form_cursor)
5734 {
5735     dXSARGS;
5736 #ifdef C_POS_FORM_CURSOR
5737     c_exactargs("pos_form_cursor", items, 1);
5738     {
5739     FORM *  form    = c_sv2form(ST(0), 0);
5740     int ret = pos_form_cursor(form);
5741 
5742     ST(0) = sv_newmortal();
5743     sv_setiv(ST(0), (IV)ret);
5744     }
5745     XSRETURN(1);
5746 #else
5747     c_fun_not_there("pos_form_cursor");
5748     XSRETURN(0);
5749 #endif
5750 }
5751 
5752 
5753 /* form_data */
5754 
XS(XS_Curses_data_ahead)5755 XS(XS_Curses_data_ahead)
5756 {
5757     dXSARGS;
5758 #ifdef C_DATA_AHEAD
5759     c_exactargs("data_ahead", items, 1);
5760     {
5761     FORM *  form    = c_sv2form(ST(0), 0);
5762     bool    ret = data_ahead(form);
5763 
5764     ST(0) = sv_newmortal();
5765     sv_setiv(ST(0), (IV)ret);
5766     }
5767     XSRETURN(1);
5768 #else
5769     c_fun_not_there("data_ahead");
5770     XSRETURN(0);
5771 #endif
5772 }
5773 
XS(XS_Curses_data_behind)5774 XS(XS_Curses_data_behind)
5775 {
5776     dXSARGS;
5777 #ifdef C_DATA_BEHIND
5778     c_exactargs("data_behind", items, 1);
5779     {
5780     FORM *  form    = c_sv2form(ST(0), 0);
5781     bool    ret = data_behind(form);
5782 
5783     ST(0) = sv_newmortal();
5784     sv_setiv(ST(0), (IV)ret);
5785     }
5786     XSRETURN(1);
5787 #else
5788     c_fun_not_there("data_behind");
5789     XSRETURN(0);
5790 #endif
5791 }
5792 
5793 
5794 /* form_driver */
5795 
XS(XS_Curses_form_driver)5796 XS(XS_Curses_form_driver)
5797 {
5798     dXSARGS;
5799 #ifdef C_FORM_DRIVER
5800     c_exactargs("form_driver", items, 2);
5801     {
5802     FORM *  form    = c_sv2form(ST(0), 0);
5803     int c   = (int)SvIV(ST(1));
5804     int ret = form_driver(form, c);
5805 
5806     ST(0) = sv_newmortal();
5807     sv_setiv(ST(0), (IV)ret);
5808     }
5809     XSRETURN(1);
5810 #else
5811     c_fun_not_there("form_driver");
5812     XSRETURN(0);
5813 #endif
5814 }
5815 
5816 
5817 /* form_field */
5818 
XS(XS_Curses_set_form_fields)5819 XS(XS_Curses_set_form_fields)
5820 {
5821     dXSARGS;
5822 #ifdef C_SET_FORM_FIELDS
5823     c_exactargs("set_form_fields", items, 2);
5824     {
5825     FORM *  form    = c_sv2form(ST(0), 0);
5826     FIELD **fields  = (FIELD **)SvPV_nolen(ST(1));
5827     int ret = set_form_fields(form, fields);
5828 
5829     ST(0) = sv_newmortal();
5830     sv_setiv(ST(0), (IV)ret);
5831     }
5832     XSRETURN(1);
5833 #else
5834     c_fun_not_there("set_form_fields");
5835     XSRETURN(0);
5836 #endif
5837 }
5838 
XS(XS_Curses_form_fields)5839 XS(XS_Curses_form_fields)
5840 {
5841     dXSARGS;
5842 #ifdef C_FORM_FIELDS
5843     c_exactargs("form_fields", items, 1);
5844     {
5845     FORM *  form    = c_sv2form(ST(0), 0);
5846     FIELD **    ret = form_fields(form);
5847 
5848     ST(0) = sv_newmortal();
5849     sv_setpv((SV*)ST(0), (char *)ret);
5850     }
5851     XSRETURN(1);
5852 #else
5853     c_fun_not_there("form_fields");
5854     XSRETURN(0);
5855 #endif
5856 }
5857 
XS(XS_Curses_field_count)5858 XS(XS_Curses_field_count)
5859 {
5860     dXSARGS;
5861 #ifdef C_FIELD_COUNT
5862     c_exactargs("field_count", items, 1);
5863     {
5864     FORM *  form    = c_sv2form(ST(0), 0);
5865     int ret = field_count(form);
5866 
5867     ST(0) = sv_newmortal();
5868     sv_setiv(ST(0), (IV)ret);
5869     }
5870     XSRETURN(1);
5871 #else
5872     c_fun_not_there("field_count");
5873     XSRETURN(0);
5874 #endif
5875 }
5876 
XS(XS_Curses_move_field)5877 XS(XS_Curses_move_field)
5878 {
5879     dXSARGS;
5880 #ifdef C_MOVE_FIELD
5881     c_exactargs("move_field", items, 3);
5882     {
5883     FIELD * field   = c_sv2field(ST(0), 0);
5884     int frow    = (int)SvIV(ST(1));
5885     int fcol    = (int)SvIV(ST(2));
5886     int ret = move_field(field, frow, fcol);
5887 
5888     ST(0) = sv_newmortal();
5889     sv_setiv(ST(0), (IV)ret);
5890     }
5891     XSRETURN(1);
5892 #else
5893     c_fun_not_there("move_field");
5894     XSRETURN(0);
5895 #endif
5896 }
5897 
5898 
5899 /* form_new */
5900 
XS(XS_Curses_new_form)5901 XS(XS_Curses_new_form) {
5902     dXSARGS;
5903 #ifdef C_NEW_FORM
5904     c_exactargs("new_form", items, 1);
5905     {
5906         FIELD ** fields  = (FIELD **)SvPV_nolen(ST(0));
5907         FORM *  ret = new_form(fields);
5908 
5909         ST(0) = sv_newmortal();
5910         c_form2sv(ST(0), ret);
5911     }
5912     XSRETURN(1);
5913 #else
5914     c_fun_not_there("new_form");
5915     XSRETURN(0);
5916 #endif
5917 }
5918 
XS(XS_Curses_free_form)5919 XS(XS_Curses_free_form)
5920 {
5921     dXSARGS;
5922 #ifdef C_FREE_FORM
5923     c_exactargs("free_form", items, 1);
5924     {
5925     FORM *  form    = c_sv2form(ST(0), 0);
5926     int ret = free_form(form);
5927 
5928     ST(0) = sv_newmortal();
5929     sv_setiv(ST(0), (IV)ret);
5930     }
5931     XSRETURN(1);
5932 #else
5933     c_fun_not_there("free_form");
5934     XSRETURN(0);
5935 #endif
5936 }
5937 
5938 
5939 /* form_new_page */
5940 
XS(XS_Curses_set_new_page)5941 XS(XS_Curses_set_new_page)
5942 {
5943     dXSARGS;
5944 #ifdef C_SET_NEW_PAGE
5945     c_exactargs("set_new_page", items, 2);
5946     {
5947     FIELD * field   = c_sv2field(ST(0), 0);
5948     bool    new_page_flag   = (int)SvIV(ST(1));
5949     int ret = set_new_page(field, new_page_flag);
5950 
5951     ST(0) = sv_newmortal();
5952     sv_setiv(ST(0), (IV)ret);
5953     }
5954     XSRETURN(1);
5955 #else
5956     c_fun_not_there("set_new_page");
5957     XSRETURN(0);
5958 #endif
5959 }
5960 
XS(XS_Curses_new_page)5961 XS(XS_Curses_new_page)
5962 {
5963     dXSARGS;
5964 #ifdef C_NEW_PAGE
5965     c_exactargs("new_page", items, 1);
5966     {
5967     FIELD * field   = c_sv2field(ST(0), 0);
5968     bool    ret = new_page(field);
5969 
5970     ST(0) = sv_newmortal();
5971     sv_setiv(ST(0), (IV)ret);
5972     }
5973     XSRETURN(1);
5974 #else
5975     c_fun_not_there("new_page");
5976     XSRETURN(0);
5977 #endif
5978 }
5979 
5980 
5981 /* form_opts */
5982 
XS(XS_Curses_set_form_opts)5983 XS(XS_Curses_set_form_opts)
5984 {
5985     dXSARGS;
5986 #ifdef C_SET_FORM_OPTS
5987     c_exactargs("set_form_opts", items, 2);
5988     {
5989     FORM *  form    = c_sv2form(ST(0), 0);
5990     int opts    = (int)SvIV(ST(1));
5991     int ret = set_form_opts(form, opts);
5992 
5993     ST(0) = sv_newmortal();
5994     sv_setiv(ST(0), (IV)ret);
5995     }
5996     XSRETURN(1);
5997 #else
5998     c_fun_not_there("set_form_opts");
5999     XSRETURN(0);
6000 #endif
6001 }
6002 
XS(XS_Curses_form_opts_on)6003 XS(XS_Curses_form_opts_on)
6004 {
6005     dXSARGS;
6006 #ifdef C_FORM_OPTS_ON
6007     c_exactargs("form_opts_on", items, 2);
6008     {
6009     FORM *  form    = c_sv2form(ST(0), 0);
6010     int opts    = (int)SvIV(ST(1));
6011     int ret = form_opts_on(form, opts);
6012 
6013     ST(0) = sv_newmortal();
6014     sv_setiv(ST(0), (IV)ret);
6015     }
6016     XSRETURN(1);
6017 #else
6018     c_fun_not_there("form_opts_on");
6019     XSRETURN(0);
6020 #endif
6021 }
6022 
XS(XS_Curses_form_opts_off)6023 XS(XS_Curses_form_opts_off)
6024 {
6025     dXSARGS;
6026 #ifdef C_FORM_OPTS_OFF
6027     c_exactargs("form_opts_off", items, 2);
6028     {
6029     FORM *  form    = c_sv2form(ST(0), 0);
6030     int opts    = (int)SvIV(ST(1));
6031     int ret = form_opts_off(form, opts);
6032 
6033     ST(0) = sv_newmortal();
6034     sv_setiv(ST(0), (IV)ret);
6035     }
6036     XSRETURN(1);
6037 #else
6038     c_fun_not_there("form_opts_off");
6039     XSRETURN(0);
6040 #endif
6041 }
6042 
XS(XS_Curses_form_opts)6043 XS(XS_Curses_form_opts)
6044 {
6045     dXSARGS;
6046 #ifdef C_FORM_OPTS
6047     c_exactargs("form_opts", items, 1);
6048     {
6049     FORM *  form    = c_sv2form(ST(0), 0);
6050     int ret = form_opts(form);
6051 
6052     ST(0) = sv_newmortal();
6053     sv_setiv(ST(0), (IV)ret);
6054     }
6055     XSRETURN(1);
6056 #else
6057     c_fun_not_there("form_opts");
6058     XSRETURN(0);
6059 #endif
6060 }
6061 
6062 
6063 /* form_page */
6064 
XS(XS_Curses_set_current_field)6065 XS(XS_Curses_set_current_field)
6066 {
6067     dXSARGS;
6068 #ifdef C_SET_CURRENT_FIELD
6069     c_exactargs("set_current_field", items, 2);
6070     {
6071     FORM *  form    = c_sv2form(ST(0), 0);
6072     FIELD * field   = c_sv2field(ST(1), 1);
6073     int ret = set_current_field(form, field);
6074 
6075     ST(0) = sv_newmortal();
6076     sv_setiv(ST(0), (IV)ret);
6077     }
6078     XSRETURN(1);
6079 #else
6080     c_fun_not_there("set_current_field");
6081     XSRETURN(0);
6082 #endif
6083 }
6084 
XS(XS_Curses_current_field)6085 XS(XS_Curses_current_field)
6086 {
6087     dXSARGS;
6088 #ifdef C_CURRENT_FIELD
6089     c_exactargs("current_field", items, 1);
6090     {
6091     FORM *  form    = c_sv2form(ST(0), 0);
6092     FIELD * ret = current_field(form);
6093 
6094     ST(0) = sv_newmortal();
6095     c_field2sv(ST(0), ret);
6096     }
6097     XSRETURN(1);
6098 #else
6099     c_fun_not_there("current_field");
6100     XSRETURN(0);
6101 #endif
6102 }
6103 
XS(XS_Curses_set_form_page)6104 XS(XS_Curses_set_form_page)
6105 {
6106     dXSARGS;
6107 #ifdef C_SET_FORM_PAGE
6108     c_exactargs("set_form_page", items, 2);
6109     {
6110     FORM *  form    = c_sv2form(ST(0), 0);
6111     int n   = (int)SvIV(ST(1));
6112     int ret = set_form_page(form, n);
6113 
6114     ST(0) = sv_newmortal();
6115     sv_setiv(ST(0), (IV)ret);
6116     }
6117     XSRETURN(1);
6118 #else
6119     c_fun_not_there("set_form_page");
6120     XSRETURN(0);
6121 #endif
6122 }
6123 
XS(XS_Curses_form_page)6124 XS(XS_Curses_form_page)
6125 {
6126     dXSARGS;
6127 #ifdef C_FORM_PAGE
6128     c_exactargs("form_page", items, 1);
6129     {
6130     FORM *  form    = c_sv2form(ST(0), 0);
6131     int ret = form_page(form);
6132 
6133     ST(0) = sv_newmortal();
6134     sv_setiv(ST(0), (IV)ret);
6135     }
6136     XSRETURN(1);
6137 #else
6138     c_fun_not_there("form_page");
6139     XSRETURN(0);
6140 #endif
6141 }
6142 
XS(XS_Curses_field_index)6143 XS(XS_Curses_field_index)
6144 {
6145     dXSARGS;
6146 #ifdef C_FIELD_INDEX
6147     c_exactargs("field_index", items, 1);
6148     {
6149     FIELD * field   = c_sv2field(ST(0), 0);
6150     int ret = field_index(field);
6151 
6152     ST(0) = sv_newmortal();
6153     sv_setiv(ST(0), (IV)ret);
6154     }
6155     XSRETURN(1);
6156 #else
6157     c_fun_not_there("field_index");
6158     XSRETURN(0);
6159 #endif
6160 }
6161 
6162 
6163 /* form_post */
6164 
XS(XS_Curses_post_form)6165 XS(XS_Curses_post_form)
6166 {
6167     dXSARGS;
6168 #ifdef C_POST_FORM
6169     c_exactargs("post_form", items, 1);
6170     {
6171     FORM *  form    = c_sv2form(ST(0), 0);
6172     int ret = post_form(form);
6173 
6174     ST(0) = sv_newmortal();
6175     sv_setiv(ST(0), (IV)ret);
6176     }
6177     XSRETURN(1);
6178 #else
6179     c_fun_not_there("post_form");
6180     XSRETURN(0);
6181 #endif
6182 }
6183 
XS(XS_Curses_unpost_form)6184 XS(XS_Curses_unpost_form)
6185 {
6186     dXSARGS;
6187 #ifdef C_UNPOST_FORM
6188     c_exactargs("unpost_form", items, 1);
6189     {
6190     FORM *  form    = c_sv2form(ST(0), 0);
6191     int ret = unpost_form(form);
6192 
6193     ST(0) = sv_newmortal();
6194     sv_setiv(ST(0), (IV)ret);
6195     }
6196     XSRETURN(1);
6197 #else
6198     c_fun_not_there("unpost_form");
6199     XSRETURN(0);
6200 #endif
6201 }
6202 
6203 
6204 /* form_userptr */
6205 
XS(XS_Curses_set_form_userptr)6206 XS(XS_Curses_set_form_userptr)
6207 {
6208     dXSARGS;
6209 #ifdef C_SET_FORM_USERPTR
6210     c_exactargs("set_form_userptr", items, 2);
6211     {
6212     FORM *  form    = c_sv2form(ST(0), 0);
6213     char *  userptr = (char *)SvPV_nolen(ST(1));
6214     int ret = set_form_userptr(form, userptr);
6215 
6216     ST(0) = sv_newmortal();
6217     sv_setiv(ST(0), (IV)ret);
6218     }
6219     XSRETURN(1);
6220 #else
6221     c_fun_not_there("set_form_userptr");
6222     XSRETURN(0);
6223 #endif
6224 }
6225 
XS(XS_Curses_form_userptr)6226 XS(XS_Curses_form_userptr)
6227 {
6228     dXSARGS;
6229 #ifdef C_FORM_USERPTR
6230     c_exactargs("form_userptr", items, 1);
6231     {
6232     FORM *  form    = c_sv2form(ST(0), 0);
6233     char *  ret = form_userptr(form);
6234 
6235     ST(0) = sv_newmortal();
6236     sv_setpv((SV*)ST(0), ret);
6237     }
6238     XSRETURN(1);
6239 #else
6240     c_fun_not_there("form_userptr");
6241     XSRETURN(0);
6242 #endif
6243 }
6244 
6245 
6246 /* form_win */
6247 
XS(XS_Curses_set_form_win)6248 XS(XS_Curses_set_form_win)
6249 {
6250     dXSARGS;
6251 #ifdef C_SET_FORM_WIN
6252     c_exactargs("set_form_win", items, 2);
6253     {
6254     FORM *  form    = c_sv2form(ST(0), 0);
6255     WINDOW *win = c_sv2window(ST(1), 1);
6256     int ret = set_form_win(form, win);
6257 
6258     ST(0) = sv_newmortal();
6259     sv_setiv(ST(0), (IV)ret);
6260     }
6261     XSRETURN(1);
6262 #else
6263     c_fun_not_there("set_form_win");
6264     XSRETURN(0);
6265 #endif
6266 }
6267 
XS(XS_Curses_form_win)6268 XS(XS_Curses_form_win)
6269 {
6270     dXSARGS;
6271 #ifdef C_FORM_WIN
6272     c_exactargs("form_win", items, 1);
6273     {
6274     FORM *  form    = c_sv2form(ST(0), 0);
6275     WINDOW *    ret = form_win(form);
6276 
6277     ST(0) = sv_newmortal();
6278     c_window2sv(ST(0), ret);
6279     }
6280     XSRETURN(1);
6281 #else
6282     c_fun_not_there("form_win");
6283     XSRETURN(0);
6284 #endif
6285 }
6286 
XS(XS_Curses_set_form_sub)6287 XS(XS_Curses_set_form_sub)
6288 {
6289     dXSARGS;
6290 #ifdef C_SET_FORM_SUB
6291     c_exactargs("set_form_sub", items, 2);
6292     {
6293     FORM *  form    = c_sv2form(ST(0), 0);
6294     WINDOW *sub = c_sv2window(ST(1), 1);
6295     int ret = set_form_sub(form, sub);
6296 
6297     ST(0) = sv_newmortal();
6298     sv_setiv(ST(0), (IV)ret);
6299     }
6300     XSRETURN(1);
6301 #else
6302     c_fun_not_there("set_form_sub");
6303     XSRETURN(0);
6304 #endif
6305 }
6306 
XS(XS_Curses_form_sub)6307 XS(XS_Curses_form_sub)
6308 {
6309     dXSARGS;
6310 #ifdef C_FORM_SUB
6311     c_exactargs("form_sub", items, 1);
6312     {
6313     FORM *  form    = c_sv2form(ST(0), 0);
6314     WINDOW *    ret = form_sub(form);
6315 
6316     ST(0) = sv_newmortal();
6317     c_window2sv(ST(0), ret);
6318     }
6319     XSRETURN(1);
6320 #else
6321     c_fun_not_there("form_sub");
6322     XSRETURN(0);
6323 #endif
6324 }
6325 
XS(XS_Curses_scale_form)6326 XS(XS_Curses_scale_form)
6327 {
6328     dXSARGS;
6329 #ifdef C_SCALE_FORM
6330     c_exactargs("scale_form", items, 3);
6331     {
6332     FORM *  form    = c_sv2form(ST(0), 0);
6333     int rows    = 0;
6334     int cols    = 0;
6335     int ret = scale_form(form, &rows, &cols);
6336 
6337     sv_setiv(ST(1), (IV)rows);;
6338     sv_setiv(ST(2), (IV)cols);;
6339     ST(0) = sv_newmortal();
6340     sv_setiv(ST(0), (IV)ret);
6341     }
6342     XSRETURN(1);
6343 #else
6344     c_fun_not_there("scale_form");
6345     XSRETURN(0);
6346 #endif
6347 }
6348 
6349 
6350 /* form_field_attributes */
6351 
XS(XS_Curses_set_field_fore)6352 XS(XS_Curses_set_field_fore)
6353 {
6354     dXSARGS;
6355 #ifdef C_SET_FIELD_FORE
6356     c_exactargs("set_field_fore", items, 2);
6357     {
6358     FIELD * field   = c_sv2field(ST(0), 0);
6359     chtype  attr    = c_sv2chtype(ST(1));
6360     int ret = set_field_fore(field, attr);
6361 
6362     ST(0) = sv_newmortal();
6363     sv_setiv(ST(0), (IV)ret);
6364     }
6365     XSRETURN(1);
6366 #else
6367     c_fun_not_there("set_field_fore");
6368     XSRETURN(0);
6369 #endif
6370 }
6371 
XS(XS_Curses_field_fore)6372 XS(XS_Curses_field_fore)
6373 {
6374     dXSARGS;
6375 #ifdef C_FIELD_FORE
6376     c_exactargs("field_fore", items, 1);
6377     {
6378     FIELD * field   = c_sv2field(ST(0), 0);
6379     chtype  ret = field_fore(field);
6380 
6381     ST(0) = sv_newmortal();
6382     c_chtype2sv(ST(0), ret);
6383     }
6384     XSRETURN(1);
6385 #else
6386     c_fun_not_there("field_fore");
6387     XSRETURN(0);
6388 #endif
6389 }
6390 
XS(XS_Curses_set_field_back)6391 XS(XS_Curses_set_field_back)
6392 {
6393     dXSARGS;
6394 #ifdef C_SET_FIELD_BACK
6395     c_exactargs("set_field_back", items, 2);
6396     {
6397     FIELD * field   = c_sv2field(ST(0), 0);
6398     chtype  attr    = c_sv2chtype(ST(1));
6399     int ret = set_field_back(field, attr);
6400 
6401     ST(0) = sv_newmortal();
6402     sv_setiv(ST(0), (IV)ret);
6403     }
6404     XSRETURN(1);
6405 #else
6406     c_fun_not_there("set_field_back");
6407     XSRETURN(0);
6408 #endif
6409 }
6410 
XS(XS_Curses_field_back)6411 XS(XS_Curses_field_back)
6412 {
6413     dXSARGS;
6414 #ifdef C_FIELD_BACK
6415     c_exactargs("field_back", items, 1);
6416     {
6417     FIELD * field   = c_sv2field(ST(0), 0);
6418     chtype  ret = field_back(field);
6419 
6420     ST(0) = sv_newmortal();
6421     c_chtype2sv(ST(0), ret);
6422     }
6423     XSRETURN(1);
6424 #else
6425     c_fun_not_there("field_back");
6426     XSRETURN(0);
6427 #endif
6428 }
6429 
XS(XS_Curses_set_field_pad)6430 XS(XS_Curses_set_field_pad)
6431 {
6432     dXSARGS;
6433 #ifdef C_SET_FIELD_PAD
6434     c_exactargs("set_field_pad", items, 2);
6435     {
6436     FIELD * field   = c_sv2field(ST(0), 0);
6437     int pad = (int)SvIV(ST(1));
6438     int ret = set_field_pad(field, pad);
6439 
6440     ST(0) = sv_newmortal();
6441     sv_setiv(ST(0), (IV)ret);
6442     }
6443     XSRETURN(1);
6444 #else
6445     c_fun_not_there("set_field_pad");
6446     XSRETURN(0);
6447 #endif
6448 }
6449 
XS(XS_Curses_field_pad)6450 XS(XS_Curses_field_pad)
6451 {
6452     dXSARGS;
6453 #ifdef C_FIELD_PAD
6454     c_exactargs("field_pad", items, 1);
6455     {
6456     FIELD * field   = c_sv2field(ST(0), 0);
6457     chtype  ret = field_pad(field);
6458 
6459     ST(0) = sv_newmortal();
6460     c_chtype2sv(ST(0), ret);
6461     }
6462     XSRETURN(1);
6463 #else
6464     c_fun_not_there("field_pad");
6465     XSRETURN(0);
6466 #endif
6467 }
6468 
6469 
6470 /* form_field_buffer */
6471 
XS(XS_Curses_set_field_buffer)6472 XS(XS_Curses_set_field_buffer)
6473 {
6474     dXSARGS;
6475 #ifdef C_SET_FIELD_BUFFER
6476     c_exactargs("set_field_buffer", items, 3);
6477     {
6478     FIELD * field   = c_sv2field(ST(0), 0);
6479     int buf = (int)SvIV(ST(1));
6480     char *  value   = (char *)SvPV_nolen(ST(2));
6481     int ret = set_field_buffer(field, buf, value);
6482 
6483     ST(0) = sv_newmortal();
6484     sv_setiv(ST(0), (IV)ret);
6485     }
6486     XSRETURN(1);
6487 #else
6488     c_fun_not_there("set_field_buffer");
6489     XSRETURN(0);
6490 #endif
6491 }
6492 
XS(XS_Curses_field_buffer)6493 XS(XS_Curses_field_buffer)
6494 {
6495     dXSARGS;
6496 #ifdef C_FIELD_BUFFER
6497     c_exactargs("field_buffer", items, 2);
6498     {
6499     FIELD * field   = c_sv2field(ST(0), 0);
6500     int buffer  = (int)SvIV(ST(1));
6501     char *  ret = field_buffer(field, buffer);
6502 
6503     ST(0) = sv_newmortal();
6504     sv_setpv((SV*)ST(0), ret);
6505     }
6506     XSRETURN(1);
6507 #else
6508     c_fun_not_there("field_buffer");
6509     XSRETURN(0);
6510 #endif
6511 }
6512 
XS(XS_Curses_set_field_status)6513 XS(XS_Curses_set_field_status)
6514 {
6515     dXSARGS;
6516 #ifdef C_SET_FIELD_STATUS
6517     c_exactargs("set_field_status", items, 2);
6518     {
6519     FIELD * field   = c_sv2field(ST(0), 0);
6520     bool    status  = (int)SvIV(ST(1));
6521     int ret = set_field_status(field, status);
6522 
6523     ST(0) = sv_newmortal();
6524     sv_setiv(ST(0), (IV)ret);
6525     }
6526     XSRETURN(1);
6527 #else
6528     c_fun_not_there("set_field_status");
6529     XSRETURN(0);
6530 #endif
6531 }
6532 
XS(XS_Curses_field_status)6533 XS(XS_Curses_field_status)
6534 {
6535     dXSARGS;
6536 #ifdef C_FIELD_STATUS
6537     c_exactargs("field_status", items, 1);
6538     {
6539     FIELD * field   = c_sv2field(ST(0), 0);
6540     bool    ret = field_status(field);
6541 
6542     ST(0) = sv_newmortal();
6543     sv_setiv(ST(0), (IV)ret);
6544     }
6545     XSRETURN(1);
6546 #else
6547     c_fun_not_there("field_status");
6548     XSRETURN(0);
6549 #endif
6550 }
6551 
XS(XS_Curses_set_max_field)6552 XS(XS_Curses_set_max_field)
6553 {
6554     dXSARGS;
6555 #ifdef C_SET_MAX_FIELD
6556     c_exactargs("set_max_field", items, 2);
6557     {
6558     FIELD * field   = c_sv2field(ST(0), 0);
6559     int max = (int)SvIV(ST(1));
6560     int ret = set_max_field(field, max);
6561 
6562     ST(0) = sv_newmortal();
6563     sv_setiv(ST(0), (IV)ret);
6564     }
6565     XSRETURN(1);
6566 #else
6567     c_fun_not_there("set_max_field");
6568     XSRETURN(0);
6569 #endif
6570 }
6571 
6572 
6573 /* form_field_info */
6574 
XS(XS_Curses_field_info)6575 XS(XS_Curses_field_info)
6576 {
6577     dXSARGS;
6578 #ifdef C_FIELD_INFO
6579     c_exactargs("field_info", items, 7);
6580     {
6581     FIELD * field   = c_sv2field(ST(0), 0);
6582     int rows    = 0;
6583     int cols    = 0;
6584     int frow    = 0;
6585     int fcol    = 0;
6586     int nrow    = 0;
6587     int nbuf    = 0;
6588     int ret = field_info(field, &rows, &cols, &frow, &fcol, &nrow, &nbuf);
6589 
6590     sv_setiv(ST(1), (IV)rows);;
6591     sv_setiv(ST(2), (IV)cols);;
6592     sv_setiv(ST(3), (IV)frow);;
6593     sv_setiv(ST(4), (IV)fcol);;
6594     sv_setiv(ST(5), (IV)nrow);;
6595     sv_setiv(ST(6), (IV)nbuf);;
6596     ST(0) = sv_newmortal();
6597     sv_setiv(ST(0), (IV)ret);
6598     }
6599     XSRETURN(1);
6600 #else
6601     c_fun_not_there("field_info");
6602     XSRETURN(0);
6603 #endif
6604 }
6605 
XS(XS_Curses_dynamic_field_info)6606 XS(XS_Curses_dynamic_field_info)
6607 {
6608     dXSARGS;
6609 #ifdef C_DYNAMIC_FIELD_INFO
6610     c_exactargs("dynamic_field_info", items, 4);
6611     {
6612     FIELD * field   = c_sv2field(ST(0), 0);
6613     int rows    = 0;
6614     int cols    = 0;
6615     int max = 0;
6616     int ret = dynamic_field_info(field, &rows, &cols, &max);
6617 
6618     sv_setiv(ST(1), (IV)rows);;
6619     sv_setiv(ST(2), (IV)cols);;
6620     sv_setiv(ST(3), (IV)max);;
6621     ST(0) = sv_newmortal();
6622     sv_setiv(ST(0), (IV)ret);
6623     }
6624     XSRETURN(1);
6625 #else
6626     c_fun_not_there("dynamic_field_info");
6627     XSRETURN(0);
6628 #endif
6629 }
6630 
6631 
6632 /* form_field_just */
6633 
XS(XS_Curses_set_field_just)6634 XS(XS_Curses_set_field_just)
6635 {
6636     dXSARGS;
6637 #ifdef C_SET_FIELD_JUST
6638     c_exactargs("set_field_just", items, 2);
6639     {
6640     FIELD * field   = c_sv2field(ST(0), 0);
6641     int justif  = (int)SvIV(ST(1));
6642     int ret = set_field_just(field, justif);
6643 
6644     ST(0) = sv_newmortal();
6645     sv_setiv(ST(0), (IV)ret);
6646     }
6647     XSRETURN(1);
6648 #else
6649     c_fun_not_there("set_field_just");
6650     XSRETURN(0);
6651 #endif
6652 }
6653 
XS(XS_Curses_field_just)6654 XS(XS_Curses_field_just)
6655 {
6656     dXSARGS;
6657 #ifdef C_FIELD_JUST
6658     c_exactargs("field_just", items, 1);
6659     {
6660     FIELD * field   = c_sv2field(ST(0), 0);
6661     int ret = field_just(field);
6662 
6663     ST(0) = sv_newmortal();
6664     sv_setiv(ST(0), (IV)ret);
6665     }
6666     XSRETURN(1);
6667 #else
6668     c_fun_not_there("field_just");
6669     XSRETURN(0);
6670 #endif
6671 }
6672 
6673 
6674 /* form_field_new */
6675 
XS(XS_Curses_new_field)6676 XS(XS_Curses_new_field)
6677 {
6678     dXSARGS;
6679 #ifdef C_NEW_FIELD
6680     c_exactargs("new_field", items, 6);
6681     {
6682         int const height    = (int)SvIV(ST(0));
6683         int const width     = (int)SvIV(ST(1));
6684         int const toprow    = (int)SvIV(ST(2));
6685         int const leftcol   = (int)SvIV(ST(3));
6686         int const offscreen = (int)SvIV(ST(4));
6687         int const nbuffers  = (int)SvIV(ST(5));
6688         FIELD * ret = new_field(height, width, toprow, leftcol, offscreen, nbuffers);
6689         ST(0) = sv_newmortal();
6690         c_field2sv(ST(0), ret);
6691     }
6692     XSRETURN(1);
6693 #else
6694     c_fun_not_there("new_field");
6695     XSRETURN(0);
6696 #endif
6697 }
6698 
XS(XS_Curses_dup_field)6699 XS(XS_Curses_dup_field)
6700 {
6701     dXSARGS;
6702 #ifdef C_DUP_FIELD
6703     c_exactargs("dup_field", items, 3);
6704     {
6705     FIELD * field   = c_sv2field(ST(0), 0);
6706     int toprow  = (int)SvIV(ST(1));
6707     int leftcol = (int)SvIV(ST(2));
6708     FIELD * ret = dup_field(field, toprow, leftcol);
6709 
6710     ST(0) = sv_newmortal();
6711     c_field2sv(ST(0), ret);
6712     }
6713     XSRETURN(1);
6714 #else
6715     c_fun_not_there("dup_field");
6716     XSRETURN(0);
6717 #endif
6718 }
6719 
XS(XS_Curses_link_field)6720 XS(XS_Curses_link_field)
6721 {
6722     dXSARGS;
6723 #ifdef C_LINK_FIELD
6724     c_exactargs("link_field", items, 3);
6725     {
6726     FIELD * field   = c_sv2field(ST(0), 0);
6727     int toprow  = (int)SvIV(ST(1));
6728     int leftcol = (int)SvIV(ST(2));
6729     FIELD * ret = link_field(field, toprow, leftcol);
6730 
6731     ST(0) = sv_newmortal();
6732     c_field2sv(ST(0), ret);
6733     }
6734     XSRETURN(1);
6735 #else
6736     c_fun_not_there("link_field");
6737     XSRETURN(0);
6738 #endif
6739 }
6740 
XS(XS_Curses_free_field)6741 XS(XS_Curses_free_field)
6742 {
6743     dXSARGS;
6744 #ifdef C_FREE_FIELD
6745     c_exactargs("free_field", items, 1);
6746     {
6747     FIELD * field   = c_sv2field(ST(0), 0);
6748     int ret = free_field(field);
6749 
6750     ST(0) = sv_newmortal();
6751     sv_setiv(ST(0), (IV)ret);
6752     }
6753     XSRETURN(1);
6754 #else
6755     c_fun_not_there("free_field");
6756     XSRETURN(0);
6757 #endif
6758 }
6759 
6760 
6761 /* form_field_opts */
6762 
XS(XS_Curses_set_field_opts)6763 XS(XS_Curses_set_field_opts)
6764 {
6765     dXSARGS;
6766 #ifdef C_SET_FIELD_OPTS
6767     c_exactargs("set_field_opts", items, 2);
6768     {
6769     FIELD * field   = c_sv2field(ST(0), 0);
6770     int opts    = (int)SvIV(ST(1));
6771     int ret = set_field_opts(field, opts);
6772 
6773     ST(0) = sv_newmortal();
6774     sv_setiv(ST(0), (IV)ret);
6775     }
6776     XSRETURN(1);
6777 #else
6778     c_fun_not_there("set_field_opts");
6779     XSRETURN(0);
6780 #endif
6781 }
6782 
XS(XS_Curses_field_opts_on)6783 XS(XS_Curses_field_opts_on)
6784 {
6785     dXSARGS;
6786 #ifdef C_FIELD_OPTS_ON
6787     c_exactargs("field_opts_on", items, 2);
6788     {
6789     FIELD * field   = c_sv2field(ST(0), 0);
6790     int opts    = (int)SvIV(ST(1));
6791     int ret = field_opts_on(field, opts);
6792 
6793     ST(0) = sv_newmortal();
6794     sv_setiv(ST(0), (IV)ret);
6795     }
6796     XSRETURN(1);
6797 #else
6798     c_fun_not_there("field_opts_on");
6799     XSRETURN(0);
6800 #endif
6801 }
6802 
XS(XS_Curses_field_opts_off)6803 XS(XS_Curses_field_opts_off)
6804 {
6805     dXSARGS;
6806 #ifdef C_FIELD_OPTS_OFF
6807     c_exactargs("field_opts_off", items, 2);
6808     {
6809     FIELD * field   = c_sv2field(ST(0), 0);
6810     int opts    = (int)SvIV(ST(1));
6811     int ret = field_opts_off(field, opts);
6812 
6813     ST(0) = sv_newmortal();
6814     sv_setiv(ST(0), (IV)ret);
6815     }
6816     XSRETURN(1);
6817 #else
6818     c_fun_not_there("field_opts_off");
6819     XSRETURN(0);
6820 #endif
6821 }
6822 
XS(XS_Curses_field_opts)6823 XS(XS_Curses_field_opts)
6824 {
6825     dXSARGS;
6826 #ifdef C_FIELD_OPTS
6827     c_exactargs("field_opts", items, 1);
6828     {
6829     FIELD * field   = c_sv2field(ST(0), 0);
6830     int ret = field_opts(field);
6831 
6832     ST(0) = sv_newmortal();
6833     sv_setiv(ST(0), (IV)ret);
6834     }
6835     XSRETURN(1);
6836 #else
6837     c_fun_not_there("field_opts");
6838     XSRETURN(0);
6839 #endif
6840 }
6841 
6842 
6843 /* form_field_userptr */
6844 
XS(XS_Curses_set_field_userptr)6845 XS(XS_Curses_set_field_userptr)
6846 {
6847     dXSARGS;
6848 #ifdef C_SET_FIELD_USERPTR
6849     c_exactargs("set_field_userptr", items, 2);
6850     {
6851     FIELD * field   = c_sv2field(ST(0), 0);
6852     char *  userptr = (char *)SvPV_nolen(ST(1));
6853     int ret = set_field_userptr(field, userptr);
6854 
6855     ST(0) = sv_newmortal();
6856     sv_setiv(ST(0), (IV)ret);
6857     }
6858     XSRETURN(1);
6859 #else
6860     c_fun_not_there("set_field_userptr");
6861     XSRETURN(0);
6862 #endif
6863 }
6864 
XS(XS_Curses_field_userptr)6865 XS(XS_Curses_field_userptr)
6866 {
6867     dXSARGS;
6868 #ifdef C_FIELD_USERPTR
6869     c_exactargs("field_userptr", items, 1);
6870     {
6871     FIELD * field   = c_sv2field(ST(0), 0);
6872     char *  ret = field_userptr(field);
6873 
6874     ST(0) = sv_newmortal();
6875     sv_setpv((SV*)ST(0), ret);
6876     }
6877     XSRETURN(1);
6878 #else
6879     c_fun_not_there("field_userptr");
6880     XSRETURN(0);
6881 #endif
6882 }
6883 
6884 
6885 /* form_field_validation */
6886 
XS(XS_Curses_field_arg)6887 XS(XS_Curses_field_arg)
6888 {
6889     dXSARGS;
6890 #ifdef C_FIELD_ARG
6891     c_exactargs("field_arg", items, 1);
6892     {
6893     FIELD * field   = c_sv2field(ST(0), 0);
6894     char *  ret = field_arg(field);
6895 
6896     ST(0) = sv_newmortal();
6897     sv_setpv((SV*)ST(0), ret);
6898     }
6899     XSRETURN(1);
6900 #else
6901     c_fun_not_there("field_arg");
6902     XSRETURN(0);
6903 #endif
6904 }
6905 
6906 
6907 /* ncurses form extension functions */
6908 
XS(XS_Curses_form_request_name)6909 XS(XS_Curses_form_request_name)
6910 {
6911     dXSARGS;
6912 #ifdef C_FORM_REQUEST_NAME
6913     c_exactargs("form_request_name", items, 1);
6914     {
6915     int request = (int)SvIV(ST(0));
6916     char *  ret = (char *)form_request_name(request);
6917 
6918     ST(0) = sv_newmortal();
6919     sv_setpv((SV*)ST(0), ret);
6920     }
6921     XSRETURN(1);
6922 #else
6923     c_fun_not_there("form_request_name");
6924     XSRETURN(0);
6925 #endif
6926 }
6927 
XS(XS_Curses_form_request_by_name)6928 XS(XS_Curses_form_request_by_name)
6929 {
6930     dXSARGS;
6931 #ifdef C_FORM_REQUEST_BY_NAME
6932     c_exactargs("form_request_by_name", items, 1);
6933     {
6934     char *  name    = (char *)SvPV_nolen(ST(0));
6935     int ret = form_request_by_name(name);
6936 
6937     ST(0) = sv_newmortal();
6938     sv_setiv(ST(0), (IV)ret);
6939     }
6940     XSRETURN(1);
6941 #else
6942     c_fun_not_there("form_request_by_name");
6943     XSRETURN(0);
6944 #endif
6945 }
6946 
6947