1 /* NetHack 3.6 wc_chainout.c $NHDT-Date: 1433806611 2015/06/08 23:36:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
2 /* Copyright (c) Kenneth Lorber, 2012 */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* -chainout is an internal processor that changes the flow from chain_procs
6 * back to window_procs. */
10 struct chainout_data {
11 struct window_procs *nprocs;
20 chainout_procs_chain(cmd, n, me, nextprocs, nextdata)
25 void *nextdata UNUSED;
27 struct chainout_data *tdp = 0;
31 tdp = (struct chainout_data *) alloc(sizeof *tdp);
37 tdp->nprocs = nextprocs;
40 panic("chainout_procs_chain: bad cmd\n");
46 /* XXX if we don't need this, take it out of the table */
48 chainout_procs_init(dir)
58 chainout_init_nhwindows(vp, argcp, argv)
63 struct chainout_data *tdp = vp;
65 (*tdp->nprocs->win_init_nhwindows)(argcp, argv);
69 chainout_player_selection(vp)
72 struct chainout_data *tdp = vp;
74 (*tdp->nprocs->win_player_selection)();
81 struct chainout_data *tdp = vp;
83 (*tdp->nprocs->win_askname)();
87 chainout_get_nh_event(vp)
90 struct chainout_data *tdp = vp;
92 (*tdp->nprocs->win_get_nh_event)();
96 chainout_exit_nhwindows(vp, str)
100 struct chainout_data *tdp = vp;
102 (*tdp->nprocs->win_exit_nhwindows)(str);
106 chainout_suspend_nhwindows(vp, str)
110 struct chainout_data *tdp = vp;
112 (*tdp->nprocs->win_suspend_nhwindows)(str);
116 chainout_resume_nhwindows(vp)
119 struct chainout_data *tdp = vp;
121 (*tdp->nprocs->win_resume_nhwindows)();
125 chainout_create_nhwindow(vp, type)
129 struct chainout_data *tdp = vp;
132 rv = (*tdp->nprocs->win_create_nhwindow)(type);
138 chainout_clear_nhwindow(vp, window)
142 struct chainout_data *tdp = vp;
144 (*tdp->nprocs->win_clear_nhwindow)(window);
148 chainout_display_nhwindow(vp, window, blocking)
153 struct chainout_data *tdp = vp;
155 (*tdp->nprocs->win_display_nhwindow)(window, blocking);
159 chainout_destroy_nhwindow(vp, window)
163 struct chainout_data *tdp = vp;
165 (*tdp->nprocs->win_destroy_nhwindow)(window);
169 chainout_curs(vp, window, x, y)
175 struct chainout_data *tdp = vp;
177 (*tdp->nprocs->win_curs)(window, x, y);
181 chainout_putstr(vp, window, attr, str)
187 struct chainout_data *tdp = vp;
189 (*tdp->nprocs->win_putstr)(window, attr, str);
193 chainout_putmixed(vp, window, attr, str)
199 struct chainout_data *tdp = vp;
201 (*tdp->nprocs->win_putmixed)(window, attr, str);
205 chainout_display_file(vp, fname, complain)
210 struct chainout_data *tdp = vp;
212 (*tdp->nprocs->win_display_file)(fname, complain);
216 chainout_start_menu(vp, window)
220 struct chainout_data *tdp = vp;
222 (*tdp->nprocs->win_start_menu)(window);
226 chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str,
229 winid window; /* window to use, must be of type NHW_MENU */
230 int glyph; /* glyph to display with item (unused) */
231 const anything *identifier; /* what to return if selected */
232 char ch; /* keyboard accelerator (0 = pick our own) */
233 char gch; /* group accelerator (0 = no group) */
234 int attr; /* attribute for string (like tty_putstr()) */
235 const char *str; /* menu string */
236 boolean preselected; /* item is marked as selected */
238 struct chainout_data *tdp = vp;
240 (*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr,
245 chainout_end_menu(vp, window, prompt)
250 struct chainout_data *tdp = vp;
252 (*tdp->nprocs->win_end_menu)(window, prompt);
256 chainout_select_menu(vp, window, how, menu_list)
260 menu_item **menu_list;
262 struct chainout_data *tdp = vp;
265 rv = (*tdp->nprocs->win_select_menu)(window, how, (void *) menu_list);
271 chainout_message_menu(vp, let, how, mesg)
277 struct chainout_data *tdp = vp;
280 rv = (*tdp->nprocs->win_message_menu)(let, how, mesg);
286 chainout_update_inventory(vp)
289 struct chainout_data *tdp = vp;
291 (*tdp->nprocs->win_update_inventory)();
295 chainout_mark_synch(vp)
298 struct chainout_data *tdp = vp;
300 (*tdp->nprocs->win_mark_synch)();
304 chainout_wait_synch(vp)
307 struct chainout_data *tdp = vp;
309 (*tdp->nprocs->win_wait_synch)();
314 chainout_cliparound(vp, x, y)
319 struct chainout_data *tdp = vp;
321 (*tdp->nprocs->win_cliparound)(x, y);
327 chainout_update_positionbar(vp, posbar)
331 struct chainout_data *tdp = vp;
333 (*tdp->nprocs->win_update_positionbar)(posbar);
338 chainout_print_glyph(vp, window, x, y, glyph, bkglyph)
344 struct chainout_data *tdp = vp;
346 (*tdp->nprocs->win_print_glyph)(window, x, y, glyph, bkglyph);
350 chainout_raw_print(vp, str)
354 struct chainout_data *tdp = vp;
356 (*tdp->nprocs->win_raw_print)(str);
360 chainout_raw_print_bold(vp, str)
364 struct chainout_data *tdp = vp;
366 (*tdp->nprocs->win_raw_print_bold)(str);
373 struct chainout_data *tdp = vp;
376 rv = (*tdp->nprocs->win_nhgetch)();
382 chainout_nh_poskey(vp, x, y, mod)
388 struct chainout_data *tdp = vp;
391 rv = (*tdp->nprocs->win_nh_poskey)(x, y, mod);
400 struct chainout_data *tdp = vp;
402 (*tdp->nprocs->win_nhbell)();
406 chainout_doprev_message(vp)
409 struct chainout_data *tdp = vp;
412 rv = (*tdp->nprocs->win_doprev_message)();
418 chainout_yn_function(vp, query, resp, def)
420 const char *query, *resp;
423 struct chainout_data *tdp = vp;
426 rv = (*tdp->nprocs->win_yn_function)(query, resp, def);
432 chainout_getlin(vp, query, bufp)
437 struct chainout_data *tdp = vp;
439 (*tdp->nprocs->win_getlin)(query, bufp);
443 chainout_get_ext_cmd(vp)
446 struct chainout_data *tdp = vp;
449 rv = (*tdp->nprocs->win_get_ext_cmd)();
455 chainout_number_pad(vp, state)
459 struct chainout_data *tdp = vp;
461 (*tdp->nprocs->win_number_pad)(state);
465 chainout_delay_output(vp)
468 struct chainout_data *tdp = vp;
470 (*tdp->nprocs->win_delay_output)();
475 chainout_change_color(vp, color, value, reverse)
481 struct chainout_data *tdp = vp;
483 (*tdp->nprocs->win_change_color)(color, value, reverse);
488 chainout_change_background(vp, bw)
492 struct chainout_data *tdp = vp;
494 (*tdp->nprocs->win_change_background)(bw);
498 chainout_set_font_name(vp, window, font)
503 struct chainout_data *tdp = vp;
506 rv = (*tdp->nprocs->win_set_font_name)(window, font);
513 trace_get_color_string(vp)
516 struct chainout_data *tdp = vp;
519 rv = (*tdp->nprocs->win_get_color_string)();
526 /* other defs that really should go away (they're tty specific) */
528 chainout_start_screen(vp)
531 struct chainout_data *tdp = vp;
533 (*tdp->nprocs->win_start_screen)();
537 chainout_end_screen(vp)
540 struct chainout_data *tdp = vp;
542 (*tdp->nprocs->win_end_screen)();
546 chainout_outrip(vp, tmpwin, how, when)
552 struct chainout_data *tdp = vp;
554 (*tdp->nprocs->win_outrip)(tmpwin, how, when);
558 chainout_preference_update(vp, pref)
562 struct chainout_data *tdp = vp;
564 (*tdp->nprocs->win_preference_update)(pref);
568 chainout_getmsghistory(vp, init)
572 struct chainout_data *tdp = vp;
575 rv = (*tdp->nprocs->win_getmsghistory)(init);
581 chainout_putmsghistory(vp, msg, is_restoring)
584 boolean is_restoring;
586 struct chainout_data *tdp = vp;
588 (*tdp->nprocs->win_putmsghistory)(msg, is_restoring);
592 chainout_status_init(vp)
595 struct chainout_data *tdp = vp;
597 (*tdp->nprocs->win_status_init)();
601 chainout_status_finish(vp)
604 struct chainout_data *tdp = vp;
606 (*tdp->nprocs->win_status_finish)();
610 chainout_status_enablefield(vp, fieldidx, nm, fmt, enable)
617 struct chainout_data *tdp = vp;
619 (*tdp->nprocs->win_status_enablefield)(fieldidx, nm, fmt, enable);
623 chainout_status_update(vp, idx, ptr, chg, percent, color, colormasks)
625 int idx, chg, percent, color;
627 unsigned long *colormasks;
629 struct chainout_data *tdp = vp;
631 (*tdp->nprocs->win_status_update)(idx, ptr, chg, percent, color, colormasks);
635 chainout_can_suspend(vp)
638 struct chainout_data *tdp = vp;
641 rv = (*tdp->nprocs->win_can_suspend)();
646 struct chain_procs chainout_procs = {
647 "-chainout", 0, /* wincap */
650 XXX problem - the above need to come from the real window port, possibly
651 modified. May need to do something to call an additional init fn later
652 or if this is the only place like this the choose_windows fn can do the
654 (but not if the value can be modified by the stack?) TBD
656 chainout_init_nhwindows,
657 chainout_player_selection, chainout_askname, chainout_get_nh_event,
658 chainout_exit_nhwindows, chainout_suspend_nhwindows,
659 chainout_resume_nhwindows, chainout_create_nhwindow,
660 chainout_clear_nhwindow, chainout_display_nhwindow,
661 chainout_destroy_nhwindow, chainout_curs, chainout_putstr,
662 chainout_putmixed, chainout_display_file, chainout_start_menu,
663 chainout_add_menu, chainout_end_menu, chainout_select_menu,
664 chainout_message_menu, chainout_update_inventory, chainout_mark_synch,
670 chainout_update_positionbar,
672 chainout_print_glyph, chainout_raw_print, chainout_raw_print_bold,
673 chainout_nhgetch, chainout_nh_poskey, chainout_nhbell,
674 chainout_doprev_message, chainout_yn_function, chainout_getlin,
675 chainout_get_ext_cmd, chainout_number_pad, chainout_delay_output,
677 chainout_change_color,
679 chainout_change_background, chainout_set_font_name,
681 chainout_get_color_string,
684 chainout_start_screen, chainout_end_screen,
686 chainout_outrip, chainout_preference_update, chainout_getmsghistory,
687 chainout_putmsghistory,
688 chainout_status_init, chainout_status_finish, chainout_status_enablefield,
689 chainout_status_update,
690 chainout_can_suspend,