



ML1(addch,err,chtype)
ML2(waddch,err,window,chtype)
ML3(mvaddch,err,int,int,chtype)
ML4(mvwaddch,err,window,int,int,chtype)
ML1(echochar,err,chtype)
ML2(wechochar,err,window,chtype)
ML1d(addchstr,err,chtype array)
BEG1 int i,c=Wosize_val(aa),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(aa,i+0)); t[i]=0; r=addchstr(t); free(t); r_err(r); END
ML2d(waddchstr,err,window,chtype array)
BEG2 int i,c=Wosize_val(ab),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(ab,i+0)); t[i]=0; r=waddchstr(a_window(aa),t); free(t); r_err(r); END
ML3d(mvaddchstr,err,int,int,chtype array)
BEG3 int i,c=Wosize_val(ac),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(ac,i+0)); t[i]=0; r=mvaddchstr(a_int(aa),a_int(ab),t); free(t); r_err(r); END
ML4d(mvwaddchstr,err,window,int,int,chtype array)
BEG4 int i,c=Wosize_val(ad),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(ad,i+0)); t[i]=0;
  r=mvwaddchstr(a_window(aa),a_int(ab),a_int(ac),t); free(t); r_err(r); END
ML3d(addchnstr,err,chtype array,int,int)
BEG3 int i0=Int_val(ab);
  int i,c=Int_val(ac),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(aa,i+i0)); t[i]=0;
  r=addchnstr(t,Int_val(ac)); free(t); r_err(r); END
ML4d(waddchnstr,err,window,chtype array,int,int)
BEG4 int i0=Int_val(ac);
  int i,c=Int_val(ad),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(ab,i+i0)); t[i]=0;
  r=waddchnstr(a_window(aa),t,Int_val(ad)); free(t); r_err(r); END
ML5d(mvaddchnstr,err,int,int,chtype array,int,int)
BEG5 int i0=Int_val(ad);
  int i,c=Int_val(ae),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(ac,i+i0)); t[i]=0;
  r=mvaddchnstr(a_int(aa),a_int(ab),t,Int_val(ae)); free(t); r_err(r); END
ML6d(mvwaddchnstr,err,window,int,int,chtype array,int,int)
BEG6 int i0=Int_val(ae);
  int i,c=Int_val(af),r; chtype *t=malloc((c+1)*sizeof(chtype)); if(t==NULL) failwith("Out of memory"); for(i=0;i<c;i++) t[i]=Int_val(Field(ad,i+i0)); t[i]=0;
  r=mvwaddchnstr(a_window(aa),a_int(ab),a_int(ac),t,Int_val(af)); free(t); r_err(r); END
ML1(addstr,err,string)
ML2(waddstr,err,window,string)
ML3(mvaddstr,err,int,int,string)
ML4(mvwaddstr,err,window,int,int,string)
ML3d(addnstr,err,string,int,int)
BEG3 r_err(addnstr(a_string(aa)+a_int(ab),a_int(ac))); END
ML4d(waddnstr,err,window,string,int,int)
BEG4 r_err(waddnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); END
ML5d(mvaddnstr,err,int,int,string,int,int)
BEG5 r_err(mvaddnstr(a_int(aa),a_int(ab),
  a_string(ac)+a_int(ad),a_int(ae))); END
ML6d(mvwaddnstr,err,window,int,int,string,int,int)
BEG6 r_err(mvwaddnstr(a_window(aa),a_int(ab),a_int(ac),
  a_string(ad)+a_int(ae),a_int(af))); END
ML1(attroff,unit,int)
ML2(wattroff,unit,window,int)
ML1(attron,unit,int)
ML2(wattron,unit,window,int)
ML1(attrset,unit,int)
ML2(wattrset,unit,window,int)
ML0(standend,unit)
ML1(wstandend,unit,window)
ML0(standout,unit)
ML1(wstandout,unit,window)
ML1d(attr_off,unit,attr_t)
BEG1 attr_off(a_attr_t(aa),NULL); CAMLreturn(Val_unit); END
ML2d(wattr_off,unit,window,attr_t)
BEG2 wattr_off(a_window(aa),a_attr_t(ab),NULL); CAMLreturn(Val_unit); END
ML1d(attr_on,unit,attr_t)
BEG1 attr_on(a_attr_t(aa),NULL); CAMLreturn(Val_unit); END
ML2d(wattr_on,unit,window,attr_t)
BEG2 wattr_on(a_window(aa),a_attr_t(ab),NULL); CAMLreturn(Val_unit); END
ML2d(attr_set,unit,attr_t,int)
BEG2 attr_set(a_attr_t(aa),a_int(ab),NULL); CAMLreturn(Val_unit); END
ML3d(wattr_set,unit,window,attr_t,int)
BEG3 wattr_set(a_window(aa),a_attr_t(ab),a_int(ac),NULL); CAMLreturn(Val_unit); END
ML3d(chgat,unit,int,attr_t,int)
BEG3 chgat(a_int(aa),a_attr_t(ab),a_int(ac),NULL); CAMLreturn(Val_unit); END
ML4d(wchgat,unit,window,int,attr_t,int)
BEG4 wchgat(a_window(aa),a_int(ab),a_attr_t(ac),a_int(ad),NULL);
  CAMLreturn(Val_unit); END
ML5d(mvchgat,unit,int,int,int,attr_t,int)
BEG5 mvchgat(a_int(aa),a_int(ab),a_int(ac),a_attr_t(ad),a_int(ae),NULL);
  CAMLreturn(Val_unit); END
ML6d(mvwchgat,unit,window,int,int,int,attr_t,int)
BEG6 mvwchgat(a_window(aa),a_int(ab),a_int(ac),a_int(ad),a_attr_t(ae),
  a_int(af),NULL); CAMLreturn(Val_unit); END
ML0(beep,err)
ML0(flash,err)
ML1(bkgdset,unit,chtype)
ML2(wbkgdset,unit,window,chtype)
ML1(bkgd,unit,chtype)
ML2(wbkgd,unit,window,chtype)
ML1(getbkgd,chtype,window)
ML8(border,unit,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype)
ML9(wborder,unit,window,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype)
ML3(box,unit,window,chtype,chtype)
ML2(hline,unit,chtype,int)
ML3(whline,unit,window,chtype,int)
ML2(vline,unit,chtype,int)
ML3(wvline,unit,window,chtype,int)
ML4(mvhline,unit,int,int,chtype,int)
ML5(mvwhline,unit,window,int,int,chtype,int)
ML4(mvvline,unit,int,int,chtype,int)
ML5(mvwvline,unit,window,int,int,chtype,int)
ML0(erase,unit)
ML1(werase,unit,window)
ML0(clear,unit)
ML1(wclear,unit,window)
ML0(clrtobot,unit)
ML1(wclrtobot,unit,window)
ML0(clrtoeol,unit)
ML1(wclrtoeol,unit,window)
ML0(start_color,err)
ML3(init_pair,err,int,int,int)
ML4(init_color,err,int,int,int,int)
ML0(has_colors,bool)
ML0(can_change_color,bool)
ML1d(color_content,int*int*int,int)
BEG1 short x,y,z; if(color_content(Int_val(aa),&x,&y,&z)==ERR)
  x=y=z=-1; r_int_int_int(x,y,z); END
ML1d(pair_content,int*int,int)
BEG1 short x,y; if(pair_content(Int_val(aa),&y,&x)==ERR) x=y=-1;
  r_int_int(x,y); END
ML0d(colors,int) BEG0 r_int(COLORS); END
ML0d(color_pairs,int) BEG0 r_int(COLOR_PAIRS); END
ML0(use_default_colors,err)
ML0(delch,err)
ML1(wdelch,err,window)
ML2(mvdelch,err,int,int)
ML3(mvwdelch,err,window,int,int)
ML0(deleteln,err)
ML1(wdeleteln,err,window)
ML1(insdelln,err,int)
ML2(winsdelln,err,window,int)
ML0(insertln,err)
ML1(winsertln,err,window)
ML2(mvgetch,int,int,int)
ML3(mvwgetch,int,window,int,int)
ML1(ungetch,err,int)
ML1d(getstr,err,string)
BEG1 r_err(getnstr(a_string(aa),string_length(aa))); END
ML2d(wgetstr,err,window,string)
BEG2 r_err(wgetnstr(a_window(aa),a_string(ab),string_length(ab))); END
ML3d(mvgetstr,err,int,int,string)
BEG3 r_err(mvgetnstr(a_int(aa),a_int(ab),a_string(ac),string_length(ac))); END
ML4d(mvwgetstr,err,window,int,int,string)
BEG4 r_err(mvwgetnstr(a_window(aa),a_int(ab),a_int(ac),a_string(ad),
  string_length(ad))); END
ML3d(getnstr,err,string,int,int)
BEG3 r_err(getnstr(a_string(aa)+a_int(ab),a_int(ac))); END
ML4d(wgetnstr,err,window,string,int,int)
BEG4 r_err(wgetnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); END
ML5d(mvgetnstr,err,int,int,string,int,int)
BEG5 r_err(mvgetnstr(a_int(aa),a_int(ab),a_string(ac)+a_int(ad),
  a_int(ae))); END
ML6d(mvwgetnstr,err,window,int,int,string,int,int)
BEG6 r_err(mvwgetnstr(a_window(aa),a_int(ab),a_int(ac),a_string(ad)+a_int(ae),
  a_int(af))); END
ML1d(getyx,int*int,window)
BEG1 int x,y; getyx(a_window(aa),y,x); r_int_int(x,y); END
ML1d(getparyx,int*int,window)
BEG1 int x,y; getparyx(a_window(aa),y,x); r_int_int(x,y); END
ML1d(getbegyx,int*int,window)
BEG1 int x,y; getbegyx(a_window(aa),y,x); r_int_int(x,y); END
ML1d(getmaxyx,int*int,window)
BEG1 int x,y; getmaxyx(a_window(aa),y,x); r_int_int(x,y); END
ML0(inch,chtype)
ML1(winch,chtype,window)
ML2(mvinch,chtype,int,int)
ML3(mvwinch,chtype,window,int,int)
ML1d(inchstr,err,chtype array)
BEG1 int i,ne=Wosize_val(aa); chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=inchnstr(tbl,ne);
  for(i=0;i<ne;i++) Store_field(aa,i+0,Val_int(tbl[i])); r_err(ret); END
ML2d(winchstr,err,window,chtype array)
BEG2 int i,ne=Wosize_val(ab); chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=winchnstr(a_window(aa),tbl,ne);
  for(i=0;i<ne;i++) Store_field(ab,i+0,Val_int(tbl[i])); r_err(ret); END
ML3d(mvinchstr,err,int,int,chtype array)
BEG3 int i,ne=Wosize_val(ac); chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=mvinchnstr(a_int(aa),a_int(ab),tbl,ne);
  for(i=0;i<ne;i++) Store_field(ac,i+0,Val_int(tbl[i])); r_err(ret); END
ML4d(mvwinchstr,err,window,int,int,chtype array)
BEG4 int i,ne=Wosize_val(ad); chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=mvwinchnstr(a_window(aa),a_int(ab),a_int(ac),tbl,ne);
  for(i=0;i<ne;i++) Store_field(ad,i+0,Val_int(tbl[i])); r_err(ret); END
ML3d(inchnstr,err,chtype array,int,int)
BEG3 int i0=a_int(ab);
  int i,ne=Wosize_val(aa)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=inchnstr(tbl,a_int(ac));
  for(i=0;i<ne;i++) Store_field(aa,i+i0,Val_int(tbl[i])); r_err(ret); END
ML4d(winchnstr,err,window,chtype array,int,int)
BEG4 int i0=a_int(ac);
  int i,ne=Wosize_val(ab)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=winchnstr(a_window(aa),tbl,a_int(ad));
  for(i=0;i<ne;i++) Store_field(ab,i+i0,Val_int(tbl[i])); r_err(ret); END
ML5d(mvinchnstr,err,int,int,chtype array,int,int)
BEG5 int i0=a_int(ad);
  int i,ne=Wosize_val(ac)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=mvinchnstr(a_int(aa),a_int(ab),tbl,a_int(ae));
  for(i=0;i<ne;i++) Store_field(ac,i+i0,Val_int(tbl[i])); r_err(ret); END
ML6d(mvwinchnstr,err,window,int,int,chtype array,int,int)
BEG6 int i0=a_int(ae);
  int i,ne=Wosize_val(ad)-i0; chtype *tbl=malloc((ne+1)*sizeof(chtype));
  int ret=mvwinchnstr(a_window(aa),a_int(ab),a_int(ac),tbl,a_int(af));
  for(i=0;i<ne;i++) Store_field(ad,i+i0,Val_int(tbl[i])); r_err(ret); END
ML1(insch,err,chtype)
ML2(winsch,err,window,chtype)
ML3(mvinsch,err,int,int,chtype)
ML4(mvwinsch,err,window,int,int,chtype)
ML0(initscr,window)
ML0(endwin,unit)
ML0(isendwin,bool)
ML3d(newterm,screen,string,Unix.file_descr,Unix.file_descr)
BEG3
  CAMLlocal1(r);
  int fda=dup(a_int(ab)),fdb=dup(a_int(ac));
  FILE *fa=fdopen(fda,"w"),*fb=fdopen(fdb,"r");
  SCREEN *s;
  AWB(r);
  r=alloc_tuple(3);
  Store_field(r,0,Val_int(fa));
  Store_field(r,1,Val_int(fb));
  s=newterm(a_string(aa),fa,fb);
  if(s==NULL){ fclose(fa); fclose(fb); failwith("newterm"); }
  Store_field(r,2,(value)s);
  CAMLreturn(r); END
ML1(set_term,unit,screen)
ML1d(delscreen,unit,screen)
BEG1 delscreen(a_screen(aa));
  fclose((FILE * )Field(aa,0)); fclose((FILE * )Field(aa,1));
  CAMLreturn(Val_unit); END
ML0d(stdscr,window)
BEG0 r_window(stdscr); END
ML0d(null_window,window) BEG0 r_window(NULL); END
ML1d(insstr,err,string)
BEG1 r_err(insnstr(a_string(aa),string_length(aa))); END
ML2d(winsstr,err,window,string)
BEG2 r_err(winsnstr(a_window(aa),a_string(ab),string_length(ab))); END
ML3d(mvinsstr,err,int,int,string)
BEG3 r_err(mvinsnstr(a_int(aa),a_int(ab),a_string(ac),string_length(ac))); END
ML4d(mvwinsstr,err,window,int,int,string)
BEG4 r_err(mvwinsnstr(a_window(aa),a_int(ab),a_int(ac),
  a_string(ad),string_length(ad))); END
ML3d(insnstr,err,string,int,int)
BEG3 r_err(insnstr(a_string(aa)+a_int(ab),a_int(ac))); END
ML4d(winsnstr,err,window,string,int,int)
BEG4 r_err(winsnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); END
ML5d(mvinsnstr,err,int,int,string,int,int)
BEG5 r_err(mvinsnstr(a_int(aa),a_int(ab),a_string(ac)+a_int(ad),a_int(ae))); END
ML6d(mvwinsnstr,err,window,int,int,string,int,int)
BEG6 r_err(mvwinsnstr(a_window(aa),a_int(ab),a_int(ac),
  a_string(ad)+a_int(ae),a_int(af))); END
ML1d(instr,err,string)
BEG1 r_err(innstr(a_string(aa),string_length(aa))); END
ML2d(winstr,err,window,string)
BEG2 r_err(winnstr(a_window(aa),a_string(ab),string_length(ab))); END
ML3d(mvinstr,err,int,int,string)
BEG3 r_err(mvinnstr(a_int(aa),a_int(ab),a_string(ac),string_length(ac))); END
ML4d(mvwinstr,err,window,int,int,string)
BEG4 r_err(mvwinnstr(a_window(aa),a_int(ab),a_int(ac),
  a_string(ad),string_length(ad))); END
ML3d(innstr,err,string,int,int)
BEG3 r_err(innstr(a_string(aa)+a_int(ab),a_int(ac))); END
ML4d(winnstr,err,window,string,int,int)
BEG4 r_err(winnstr(a_window(aa),a_string(ab)+a_int(ac),a_int(ad))); END
ML5d(mvinnstr,err,int,int,string,int,int)
BEG5 r_err(mvinnstr(a_int(aa),a_int(ab),a_string(ac)+a_int(ad),a_int(ae))); END
ML6d(mvwinnstr,err,window,int,int,string,int,int)
BEG6 r_err(mvwinnstr(a_window(aa),a_int(ab),a_int(ac),
  a_string(ad)+a_int(ae),a_int(af))); END
ML0(cbreak,err)
ML0(nocbreak,err)
ML0(echo,err)
ML0(noecho,err)
ML1(halfdelay,err,int)
ML2(intrflush,err,window,bool)
ML2(keypad,err,window,bool)
ML2(meta,err,window,bool)
ML2(nodelay,err,window,bool)
ML0(raw,err)
ML0(noraw,err)
ML0(noqiflush,unit)
ML0(qiflush,unit)
ML2(notimeout,err,window,bool)
ML1(timeout,unit,int)
ML2(wtimeout,unit,window,int)
ML1d(typeahead,err,Unix.file_descr)
BEG1 r_err(typeahead(a_int(aa))); END
ML0d(notypeahead,err)
BEG0 r_err(typeahead(-1)); END
ML0(def_prog_mode,unit)
ML0(def_shell_mode,unit)
ML0(reset_prog_mode,unit)
ML0(reset_shell_mode,unit)
ML0(resetty,unit)
ML0(savetty,unit)
ML0d(getsyx,int*int)
BEG0 int x,y; getsyx(y,x); r_int_int(x,y); END
ML2(setsyx,unit,int,int)
ML1(curs_set,err,int)
ML1(napms,unit,int)
ML1d(ripoffline,unit,bool)
BEG1 ripoffline(Bool_val(aa)?1:-1,ripoff_callback); CAMLreturn(Val_unit); END
ML0d(get_ripoff,window*int)
BEG0 if(ripoff_niv==0) failwith("get_ripoff"); ripoff_niv--;
  r_int_int(ripoff_w[ripoff_niv],ripoff_l[ripoff_niv]); END
ML1d(mousemask,int*int,int)
BEG1 mmask_t r=1234,n=Int_val(aa); n=mousemask(n,&r); r_int_int(n,r); END
ML2(move,err,int,int)
ML3(wmove,err,window,int,int)
ML2(clearok,unit,window,bool)
ML2(idlok,unit,window,bool)
ML2(idcok,unit,window,bool)
ML2(immedok,unit,window,bool)
ML2(leaveok,unit,window,bool)
ML2(setscrreg,err,int,int)
ML3(wsetscrreg,err,window,int,int)
ML2(scrollok,unit,window,bool)
ML0(nl,unit)
ML0(nonl,unit)
ML2(overlay,err,window,window)
ML2(overwrite,err,window,window)
ML9(copywin,err,window,window,int,int,int,int,int,int,bool)
ML2(newpad,window,int,int)
ML5(subpad,window,window,int,int,int,int)
ML7(prefresh,err,window,int,int,int,int,int,int)
ML7(pnoutrefresh,err,window,int,int,int,int,int,int)
ML2(pechochar,err,window,chtype)
ML0(refresh,err)
ML1(wrefresh,err,window)
ML1(wnoutrefresh,err,window)
ML0(doupdate,err)
ML1(redrawwin,err,window)
ML3(wredrawln,err,window,int,int)
ML3(wresize,err,window,int,int)
ML2(resizeterm,err,int,int)
ML1(scr_dump,err,string)
ML1(scr_restore,err,string)
ML1(scr_init,err,string)
ML1(scr_set,err,string)
ML1(scroll,err,window)
ML1(scrl,err,int)
ML2(wscrl,err,window,int)
ML1(slk_init,err,int)
ML3(slk_set,err,int,string,int)
ML0(slk_refresh,err)
ML0(slk_noutrefresh,err)
ML1(slk_label,string,int)
ML0(slk_clear,err)
ML0(slk_restore,err)
ML0(slk_touch,err)
ML1(slk_attron,err,attr_t)
ML1(slk_attroff,err,attr_t)
ML1(slk_attrset,err,attr_t)
ML0(baudrate,int)
ML0(erasechar,char)
ML0(has_ic,bool)
ML0(has_il,bool)
ML0(killchar,char)
ML0(longname,string)
ML0(termattrs,attr_t)
ML0(termname,string)
ML1d(tgetent,bool,string)
BEG1 CAMLreturn(Val_bool(tgetent(NULL,String_val(aa))==1)); END
ML1(tgetflag,bool,string)
ML1(tgetnum,int,string)
ML1d(tgetstr,bool,string)
BEG1 r_string(tgetstr(String_val(aa),NULL)); END
ML3(tgoto,string,string,int,int)
ML2d(setupterm,err,string,Unix.file_descr)
BEG2 int r; r_err(setupterm(a_string(aa),a_int(ab),&r)); END
ML1(setterm,err,string)
ML0d(cur_term,terminal)
BEG0 r_terminal(cur_term); END
ML1(set_curterm,terminal,terminal)
ML1(del_curterm,err,terminal)
ML2d(restartterm,err,string,Unix.file_descr)
BEG2 int r; r_err(restartterm(a_string(aa),a_int(ab),&r)); END
ML1(putp,err,string)
ML1(vidattr,err,chtype)
ML4(mvcur,err,int,int,int,int)
ML1d(tigetflag,bool,string)
BEG1 r_bool(tigetflag(a_string(aa))>0); END
ML1(tigetnum,int,string)
ML1d(tigetstr,string,string)
BEG1 char *s=tigetstr(a_string(aa));
  if((s==NULL)||(s==(char * )-1)) failwith("tigetstr");
  CAMLreturn(copy_string(s)); END
ML3d(tputs,err,string,int,(char->unit))
BEG3 putc_function=ac;
  r_err(tputs(a_string(aa),a_int(ab),putc_callback)); END
ML2d(vidputs,err,chtype,(char->unit))
BEG2 putc_function=ab;
  r_err(vidputs(a_chtype(aa),putc_callback)); END
ML2d(tparm,string,string,int array)
BEG2 int t[10],i,n=Wosize_val(ab);
  if(n>10) n=10;
  for(i=0;i<n;i++) t[i]=a_int(Field(ab,i));
  r_string(tparm(a_string(aa),t[0],t[1],t[2],t[3],t[4],
    t[5],t[6],t[7],t[8],t[9])); END
ML1d(bool_terminfo_variable,string*string*string,int) BEG1 CAMLlocal1(s); int n=a_int(aa); AWB(s) s=alloc_tuple(3); Store_field(s,0,Val_unit); Store_field(s,1,Val_unit); Store_field(s,2,Val_unit); if((boolnames[n]==NULL)||(boolcodes[n]==NULL)||(boolfnames[n]==NULL)){ CAMLlocal1(ns); AWB(ns) ns=copy_string(""); Store_field(s,0,ns); Store_field(s,1,ns); Store_field(s,2,ns); }else{ Store_field(s,0,copy_string(boolnames[n])); Store_field(s,1,copy_string(boolcodes[n])); Store_field(s,2,copy_string(boolfnames[n])); } CAMLreturn(s); END
ML1d(num_terminfo_variable,string*string*string,int) BEG1 CAMLlocal1(s); int n=a_int(aa); AWB(s) s=alloc_tuple(3); Store_field(s,0,Val_unit); Store_field(s,1,Val_unit); Store_field(s,2,Val_unit); if((numnames[n]==NULL)||(numcodes[n]==NULL)||(numfnames[n]==NULL)){ CAMLlocal1(ns); AWB(ns) ns=copy_string(""); Store_field(s,0,ns); Store_field(s,1,ns); Store_field(s,2,ns); }else{ Store_field(s,0,copy_string(numnames[n])); Store_field(s,1,copy_string(numcodes[n])); Store_field(s,2,copy_string(numfnames[n])); } CAMLreturn(s); END
ML1d(str_terminfo_variable,string*string*string,int) BEG1 CAMLlocal1(s); int n=a_int(aa); AWB(s) s=alloc_tuple(3); Store_field(s,0,Val_unit); Store_field(s,1,Val_unit); Store_field(s,2,Val_unit); if((strnames[n]==NULL)||(strcodes[n]==NULL)||(strfnames[n]==NULL)){ CAMLlocal1(ns); AWB(ns) ns=copy_string(""); Store_field(s,0,ns); Store_field(s,1,ns); Store_field(s,2,ns); }else{ Store_field(s,0,copy_string(strnames[n])); Store_field(s,1,copy_string(strcodes[n])); Store_field(s,2,copy_string(strfnames[n])); } CAMLreturn(s); END
ML1(touchwin,err,window)
ML3(touchline,err,window,int,int)
ML1(untouchwin,err,window)
ML4(wtouchln,err,window,int,int,bool)
ML2(is_linetouched,int,window,int)
ML1(is_wintouched,bool,window)
ML1(unctrl,string,chtype)
ML1(keyname,string,int)
ML0(filter,unit)
ML1(use_env,unit,bool)
ML2d(putwin,err,window,Unix.file_descr)
BEG2 int fd=dup(a_int(ab)); FILE *f=fdopen(fd,"w");
  int r=putwin(a_window(aa),f); fclose(f); r_err(r); END
ML1d(getwin,window,Unix.file_descr)
BEG1 int fd=dup(a_int(aa)); FILE *f=fdopen(fd,"r");
  int r=putwin(a_window(aa),f); fclose(f); r_err(r); END
ML1(delay_output,err,int)
ML0(flushinp,unit)
ML4(newwin,window,int,int,int,int)
ML1(delwin,err,window)
ML3(mvwin,err,window,int,int)
ML5(subwin,window,window,int,int,int,int)
ML5(derwin,window,window,int,int,int,int)
ML3(mvderwin,err,window,int,int)
ML1(dupwin,window,window)
ML1(wsyncup,unit,window)
ML2(syncok,err,window,bool)
ML1(wcursyncup,unit,window)
ML1(wsyncdown,unit,window)
ML0d(get_acs_codes,Acs.acs)
BEG0 CAMLlocal1(tr); AWB(tr)
  tr=alloc_tuple(32);
Store_field(tr,0,Val_int(ACS_ULCORNER)); Store_field(tr,1,Val_int(ACS_LLCORNER)); Store_field(tr,2,Val_int(ACS_URCORNER)); Store_field(tr,3,Val_int(ACS_LRCORNER));
Store_field(tr,4,Val_int(ACS_LTEE)); Store_field(tr,5,Val_int(ACS_RTEE)); Store_field(tr,6,Val_int(ACS_BTEE)); Store_field(tr,7,Val_int(ACS_TTEE));
Store_field(tr,8,Val_int(ACS_HLINE)); Store_field(tr,9,Val_int(ACS_VLINE)); Store_field(tr,10,Val_int(ACS_PLUS)); Store_field(tr,11,Val_int(ACS_S1));
Store_field(tr,12,Val_int(ACS_S9)); Store_field(tr,13,Val_int(ACS_DIAMOND)); Store_field(tr,14,Val_int(ACS_CKBOARD)); Store_field(tr,15,Val_int(ACS_DEGREE));
Store_field(tr,16,Val_int(ACS_PLMINUS)); Store_field(tr,17,Val_int(ACS_BULLET)); Store_field(tr,18,Val_int(ACS_LARROW)); Store_field(tr,19,Val_int(ACS_RARROW));
Store_field(tr,20,Val_int(ACS_DARROW)); Store_field(tr,21,Val_int(ACS_UARROW)); Store_field(tr,22,Val_int(ACS_BOARD)); Store_field(tr,23,Val_int(ACS_LANTERN));
Store_field(tr,24,Val_int(ACS_BLOCK)); Store_field(tr,25,Val_int(ACS_S3)); Store_field(tr,26,Val_int(ACS_S7)); Store_field(tr,27,Val_int(ACS_LEQUAL));
Store_field(tr,28,Val_int(ACS_GEQUAL)); Store_field(tr,29,Val_int(ACS_PI)); Store_field(tr,30,Val_int(ACS_NEQUAL)); Store_field(tr,31,Val_int(ACS_STERLING));
  CAMLreturn(tr);
END
ML0d(winch_handler_on,unit)
BEG0 signal(SIGWINCH,winch_handler); CAMLreturn(Val_unit); END
ML0d(winch_handler_off,unit)
BEG0 signal(SIGWINCH,SIG_IGN); CAMLreturn(Val_unit); END
ML0d(get_size,int*int)
BEG0 struct winsize ws;
  ioctl(0,TIOCGWINSZ,&ws);
  r_int_int(ws.ws_row,ws.ws_col);
END
ML1d(get_size_fd,int*int,Unix.file_descr)
BEG1 struct winsize ws;
  ioctl(a_int(aa),TIOCGWINSZ,&ws);
  r_int_int(ws.ws_row,ws.ws_col);
END
