Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 626 lines (590 sloc) 15.846 kb
5dd73d9 @mauke initial import
authored
1 #ifndef GUARD_UNIBILIUM_H_
2 #define GUARD_UNIBILIUM_H_
3
818f32e @mauke licensing boilerplate
authored
4 /*
5
726b789 @mauke clean up after brute merge
authored
6 Copyright 2008, 2010-2013 Lukas Mai.
818f32e @mauke licensing boilerplate
authored
7
8 This file is part of unibilium.
9
10 Unibilium is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 Unibilium is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with unibilium. If not, see <http://www.gnu.org/licenses/>.
22
23 */
5dd73d9 @mauke initial import
authored
24
25 #include <stdio.h>
26
27 enum unibi_boolean {
305505a @mauke tabs -> spaces
authored
28 unibi_boolean_begin_,
29 unibi_auto_left_margin,
30 unibi_auto_right_margin,
31 unibi_no_esc_ctlc,
32 unibi_ceol_standout_glitch,
33 unibi_eat_newline_glitch,
34 unibi_erase_overstrike,
35 unibi_generic_type,
36 unibi_hard_copy,
37 unibi_has_meta_key,
38 unibi_has_status_line,
39 unibi_insert_null_glitch,
40 unibi_memory_above,
41 unibi_memory_below,
42 unibi_move_insert_mode,
43 unibi_move_standout_mode,
44 unibi_over_strike,
45 unibi_status_line_esc_ok,
46 unibi_dest_tabs_magic_smso,
47 unibi_tilde_glitch,
48 unibi_transparent_underline,
49 unibi_xon_xoff,
50 unibi_needs_xon_xoff,
51 unibi_prtr_silent,
52 unibi_hard_cursor,
53 unibi_non_rev_rmcup,
54 unibi_no_pad_char,
55 unibi_non_dest_scroll_region,
56 unibi_can_change,
57 unibi_back_color_erase,
58 unibi_hue_lightness_saturation,
59 unibi_col_addr_glitch,
60 unibi_cr_cancels_micro_mode,
61 unibi_has_print_wheel,
62 unibi_row_addr_glitch,
63 unibi_semi_auto_right_margin,
64 unibi_cpi_changes_res,
65 unibi_lpi_changes_res,
66 unibi_backspaces_with_bs,
67 unibi_crt_no_scrolling,
68 unibi_no_correctly_working_cr,
69 unibi_gnu_has_meta_key,
70 unibi_linefeed_is_newline,
71 unibi_has_hardware_tabs,
72 unibi_return_does_clr_eol,
73 unibi_boolean_end_
5dd73d9 @mauke initial import
authored
74 };
75
76 enum unibi_numeric {
305505a @mauke tabs -> spaces
authored
77 unibi_numeric_begin_ = unibi_boolean_end_,
78 unibi_columns,
79 unibi_init_tabs,
80 unibi_lines,
81 unibi_lines_of_memory,
82 unibi_magic_cookie_glitch,
83 unibi_padding_baud_rate,
84 unibi_virtual_terminal,
85 unibi_width_status_line,
86 unibi_num_labels,
87 unibi_label_height,
88 unibi_label_width,
89 unibi_max_attributes,
90 unibi_maximum_windows,
91 unibi_max_colors,
92 unibi_max_pairs,
93 unibi_no_color_video,
94 unibi_buffer_capacity,
95 unibi_dot_vert_spacing,
96 unibi_dot_horz_spacing,
97 unibi_max_micro_address,
98 unibi_max_micro_jump,
99 unibi_micro_col_size,
100 unibi_micro_line_size,
101 unibi_number_of_pins,
102 unibi_output_res_char,
103 unibi_output_res_line,
104 unibi_output_res_horz_inch,
105 unibi_output_res_vert_inch,
106 unibi_print_rate,
107 unibi_wide_char_size,
108 unibi_buttons,
109 unibi_bit_image_entwining,
110 unibi_bit_image_type,
111 unibi_magic_cookie_glitch_ul,
112 unibi_carriage_return_delay,
113 unibi_new_line_delay,
114 unibi_backspace_delay,
115 unibi_horizontal_tab_delay,
116 unibi_number_of_function_keys,
117 unibi_numeric_end_
5dd73d9 @mauke initial import
authored
118 };
119
120 enum unibi_string {
305505a @mauke tabs -> spaces
authored
121 unibi_string_begin_ = unibi_numeric_end_,
122 unibi_back_tab,
123 unibi_bell,
124 unibi_carriage_return,
125 unibi_change_scroll_region,
126 unibi_clear_all_tabs,
127 unibi_clear_screen,
128 unibi_clr_eol,
129 unibi_clr_eos,
130 unibi_column_address,
131 unibi_command_character,
132 unibi_cursor_address,
133 unibi_cursor_down,
134 unibi_cursor_home,
135 unibi_cursor_invisible,
136 unibi_cursor_left,
137 unibi_cursor_mem_address,
138 unibi_cursor_normal,
139 unibi_cursor_right,
140 unibi_cursor_to_ll,
141 unibi_cursor_up,
142 unibi_cursor_visible,
143 unibi_delete_character,
144 unibi_delete_line,
145 unibi_dis_status_line,
146 unibi_down_half_line,
147 unibi_enter_alt_charset_mode,
148 unibi_enter_blink_mode,
149 unibi_enter_bold_mode,
150 unibi_enter_ca_mode,
151 unibi_enter_delete_mode,
152 unibi_enter_dim_mode,
153 unibi_enter_insert_mode,
154 unibi_enter_secure_mode,
155 unibi_enter_protected_mode,
156 unibi_enter_reverse_mode,
157 unibi_enter_standout_mode,
158 unibi_enter_underline_mode,
159 unibi_erase_chars,
160 unibi_exit_alt_charset_mode,
161 unibi_exit_attribute_mode,
162 unibi_exit_ca_mode,
163 unibi_exit_delete_mode,
164 unibi_exit_insert_mode,
165 unibi_exit_standout_mode,
166 unibi_exit_underline_mode,
167 unibi_flash_screen,
168 unibi_form_feed,
169 unibi_from_status_line,
170 unibi_init_1string,
171 unibi_init_2string,
172 unibi_init_3string,
173 unibi_init_file,
174 unibi_insert_character,
175 unibi_insert_line,
176 unibi_insert_padding,
177 unibi_key_backspace,
178 unibi_key_catab,
179 unibi_key_clear,
180 unibi_key_ctab,
181 unibi_key_dc,
182 unibi_key_dl,
183 unibi_key_down,
184 unibi_key_eic,
185 unibi_key_eol,
186 unibi_key_eos,
187 unibi_key_f0,
188 unibi_key_f1,
189 unibi_key_f10,
190 unibi_key_f2,
191 unibi_key_f3,
192 unibi_key_f4,
193 unibi_key_f5,
194 unibi_key_f6,
195 unibi_key_f7,
196 unibi_key_f8,
197 unibi_key_f9,
198 unibi_key_home,
199 unibi_key_ic,
200 unibi_key_il,
201 unibi_key_left,
202 unibi_key_ll,
203 unibi_key_npage,
204 unibi_key_ppage,
205 unibi_key_right,
206 unibi_key_sf,
207 unibi_key_sr,
208 unibi_key_stab,
209 unibi_key_up,
210 unibi_keypad_local,
211 unibi_keypad_xmit,
212 unibi_lab_f0,
213 unibi_lab_f1,
214 unibi_lab_f10,
215 unibi_lab_f2,
216 unibi_lab_f3,
217 unibi_lab_f4,
218 unibi_lab_f5,
219 unibi_lab_f6,
220 unibi_lab_f7,
221 unibi_lab_f8,
222 unibi_lab_f9,
223 unibi_meta_off,
224 unibi_meta_on,
225 unibi_newline,
226 unibi_pad_char,
227 unibi_parm_dch,
228 unibi_parm_delete_line,
229 unibi_parm_down_cursor,
230 unibi_parm_ich,
231 unibi_parm_index,
232 unibi_parm_insert_line,
233 unibi_parm_left_cursor,
234 unibi_parm_right_cursor,
235 unibi_parm_rindex,
236 unibi_parm_up_cursor,
237 unibi_pkey_key,
238 unibi_pkey_local,
239 unibi_pkey_xmit,
240 unibi_print_screen,
241 unibi_prtr_off,
242 unibi_prtr_on,
243 unibi_repeat_char,
244 unibi_reset_1string,
245 unibi_reset_2string,
246 unibi_reset_3string,
247 unibi_reset_file,
248 unibi_restore_cursor,
249 unibi_row_address,
250 unibi_save_cursor,
251 unibi_scroll_forward,
252 unibi_scroll_reverse,
253 unibi_set_attributes,
254 unibi_set_tab,
255 unibi_set_window,
256 unibi_tab,
257 unibi_to_status_line,
258 unibi_underline_char,
259 unibi_up_half_line,
260 unibi_init_prog,
261 unibi_key_a1,
262 unibi_key_a3,
263 unibi_key_b2,
264 unibi_key_c1,
265 unibi_key_c3,
266 unibi_prtr_non,
267 unibi_char_padding,
268 unibi_acs_chars,
269 unibi_plab_norm,
270 unibi_key_btab,
271 unibi_enter_xon_mode,
272 unibi_exit_xon_mode,
273 unibi_enter_am_mode,
274 unibi_exit_am_mode,
275 unibi_xon_character,
276 unibi_xoff_character,
277 unibi_ena_acs,
278 unibi_label_on,
279 unibi_label_off,
280 unibi_key_beg,
281 unibi_key_cancel,
282 unibi_key_close,
283 unibi_key_command,
284 unibi_key_copy,
285 unibi_key_create,
286 unibi_key_end,
287 unibi_key_enter,
288 unibi_key_exit,
289 unibi_key_find,
290 unibi_key_help,
291 unibi_key_mark,
292 unibi_key_message,
293 unibi_key_move,
294 unibi_key_next,
295 unibi_key_open,
296 unibi_key_options,
297 unibi_key_previous,
298 unibi_key_print,
299 unibi_key_redo,
300 unibi_key_reference,
301 unibi_key_refresh,
302 unibi_key_replace,
303 unibi_key_restart,
304 unibi_key_resume,
305 unibi_key_save,
306 unibi_key_suspend,
307 unibi_key_undo,
308 unibi_key_sbeg,
309 unibi_key_scancel,
310 unibi_key_scommand,
311 unibi_key_scopy,
312 unibi_key_screate,
313 unibi_key_sdc,
314 unibi_key_sdl,
315 unibi_key_select,
316 unibi_key_send,
317 unibi_key_seol,
318 unibi_key_sexit,
319 unibi_key_sfind,
320 unibi_key_shelp,
321 unibi_key_shome,
322 unibi_key_sic,
323 unibi_key_sleft,
324 unibi_key_smessage,
325 unibi_key_smove,
326 unibi_key_snext,
327 unibi_key_soptions,
328 unibi_key_sprevious,
329 unibi_key_sprint,
330 unibi_key_sredo,
331 unibi_key_sreplace,
332 unibi_key_sright,
333 unibi_key_srsume,
334 unibi_key_ssave,
335 unibi_key_ssuspend,
336 unibi_key_sundo,
337 unibi_req_for_input,
338 unibi_key_f11,
339 unibi_key_f12,
340 unibi_key_f13,
341 unibi_key_f14,
342 unibi_key_f15,
343 unibi_key_f16,
344 unibi_key_f17,
345 unibi_key_f18,
346 unibi_key_f19,
347 unibi_key_f20,
348 unibi_key_f21,
349 unibi_key_f22,
350 unibi_key_f23,
351 unibi_key_f24,
352 unibi_key_f25,
353 unibi_key_f26,
354 unibi_key_f27,
355 unibi_key_f28,
356 unibi_key_f29,
357 unibi_key_f30,
358 unibi_key_f31,
359 unibi_key_f32,
360 unibi_key_f33,
361 unibi_key_f34,
362 unibi_key_f35,
363 unibi_key_f36,
364 unibi_key_f37,
365 unibi_key_f38,
366 unibi_key_f39,
367 unibi_key_f40,
368 unibi_key_f41,
369 unibi_key_f42,
370 unibi_key_f43,
371 unibi_key_f44,
372 unibi_key_f45,
373 unibi_key_f46,
374 unibi_key_f47,
375 unibi_key_f48,
376 unibi_key_f49,
377 unibi_key_f50,
378 unibi_key_f51,
379 unibi_key_f52,
380 unibi_key_f53,
381 unibi_key_f54,
382 unibi_key_f55,
383 unibi_key_f56,
384 unibi_key_f57,
385 unibi_key_f58,
386 unibi_key_f59,
387 unibi_key_f60,
388 unibi_key_f61,
389 unibi_key_f62,
390 unibi_key_f63,
391 unibi_clr_bol,
392 unibi_clear_margins,
393 unibi_set_left_margin,
394 unibi_set_right_margin,
395 unibi_label_format,
396 unibi_set_clock,
397 unibi_display_clock,
398 unibi_remove_clock,
399 unibi_create_window,
400 unibi_goto_window,
401 unibi_hangup,
402 unibi_dial_phone,
403 unibi_quick_dial,
404 unibi_tone,
405 unibi_pulse,
406 unibi_flash_hook,
407 unibi_fixed_pause,
408 unibi_wait_tone,
409 unibi_user0,
410 unibi_user1,
411 unibi_user2,
412 unibi_user3,
413 unibi_user4,
414 unibi_user5,
415 unibi_user6,
416 unibi_user7,
417 unibi_user8,
418 unibi_user9,
419 unibi_orig_pair,
420 unibi_orig_colors,
421 unibi_initialize_color,
422 unibi_initialize_pair,
423 unibi_set_color_pair,
424 unibi_set_foreground,
425 unibi_set_background,
426 unibi_change_char_pitch,
427 unibi_change_line_pitch,
428 unibi_change_res_horz,
429 unibi_change_res_vert,
430 unibi_define_char,
431 unibi_enter_doublewide_mode,
432 unibi_enter_draft_quality,
433 unibi_enter_italics_mode,
434 unibi_enter_leftward_mode,
435 unibi_enter_micro_mode,
436 unibi_enter_near_letter_quality,
437 unibi_enter_normal_quality,
438 unibi_enter_shadow_mode,
439 unibi_enter_subscript_mode,
440 unibi_enter_superscript_mode,
441 unibi_enter_upward_mode,
442 unibi_exit_doublewide_mode,
443 unibi_exit_italics_mode,
444 unibi_exit_leftward_mode,
445 unibi_exit_micro_mode,
446 unibi_exit_shadow_mode,
447 unibi_exit_subscript_mode,
448 unibi_exit_superscript_mode,
449 unibi_exit_upward_mode,
450 unibi_micro_column_address,
451 unibi_micro_down,
452 unibi_micro_left,
453 unibi_micro_right,
454 unibi_micro_row_address,
455 unibi_micro_up,
456 unibi_order_of_pins,
457 unibi_parm_down_micro,
458 unibi_parm_left_micro,
459 unibi_parm_right_micro,
460 unibi_parm_up_micro,
461 unibi_select_char_set,
462 unibi_set_bottom_margin,
463 unibi_set_bottom_margin_parm,
464 unibi_set_left_margin_parm,
465 unibi_set_right_margin_parm,
466 unibi_set_top_margin,
467 unibi_set_top_margin_parm,
468 unibi_start_bit_image,
469 unibi_start_char_set_def,
470 unibi_stop_bit_image,
471 unibi_stop_char_set_def,
472 unibi_subscript_characters,
473 unibi_superscript_characters,
474 unibi_these_cause_cr,
475 unibi_zero_motion,
476 unibi_char_set_names,
477 unibi_key_mouse,
478 unibi_mouse_info,
479 unibi_req_mouse_pos,
480 unibi_get_mouse,
481 unibi_set_a_foreground,
482 unibi_set_a_background,
483 unibi_pkey_plab,
484 unibi_device_type,
485 unibi_code_set_init,
486 unibi_set0_des_seq,
487 unibi_set1_des_seq,
488 unibi_set2_des_seq,
489 unibi_set3_des_seq,
490 unibi_set_lr_margin,
491 unibi_set_tb_margin,
492 unibi_bit_image_repeat,
493 unibi_bit_image_newline,
494 unibi_bit_image_carriage_return,
495 unibi_color_names,
496 unibi_define_bit_image_region,
497 unibi_end_bit_image_region,
498 unibi_set_color_band,
499 unibi_set_page_length,
500 unibi_display_pc_char,
501 unibi_enter_pc_charset_mode,
502 unibi_exit_pc_charset_mode,
503 unibi_enter_scancode_mode,
504 unibi_exit_scancode_mode,
505 unibi_pc_term_options,
506 unibi_scancode_escape,
507 unibi_alt_scancode_esc,
508 unibi_enter_horizontal_hl_mode,
509 unibi_enter_left_hl_mode,
510 unibi_enter_low_hl_mode,
511 unibi_enter_right_hl_mode,
512 unibi_enter_top_hl_mode,
513 unibi_enter_vertical_hl_mode,
514 unibi_set_a_attributes,
515 unibi_set_pglen_inch,
516 unibi_termcap_init2,
517 unibi_termcap_reset,
518 unibi_linefeed_if_not_lf,
519 unibi_backspace_if_not_bs,
520 unibi_other_non_function_keys,
521 unibi_arrow_key_map,
522 unibi_acs_ulcorner,
523 unibi_acs_llcorner,
524 unibi_acs_urcorner,
525 unibi_acs_lrcorner,
526 unibi_acs_ltee,
527 unibi_acs_rtee,
528 unibi_acs_btee,
529 unibi_acs_ttee,
530 unibi_acs_hline,
531 unibi_acs_vline,
532 unibi_acs_plus,
533 unibi_memory_lock,
534 unibi_memory_unlock,
535 unibi_box_chars_1,
536 unibi_string_end_
5dd73d9 @mauke initial import
authored
537 };
538
539 typedef struct unibi_term unibi_term;
540
541 unibi_term *unibi_dummy(void);
759f403 @mauke rename unibi_init to unibi_from_mem
authored
542 unibi_term *unibi_from_mem(const char *, size_t);
5dd73d9 @mauke initial import
authored
543 void unibi_destroy(unibi_term *);
544
545 size_t unibi_dump(const unibi_term *, char *, size_t);
546
547 const char *unibi_get_name(const unibi_term *);
548 void unibi_set_name(unibi_term *, const char *);
549
550 const char **unibi_get_aliases(const unibi_term *);
551 void unibi_set_aliases(unibi_term *, const char **);
552
553 int unibi_get_bool(const unibi_term *, enum unibi_boolean);
554 void unibi_set_bool(unibi_term *, enum unibi_boolean, int);
555
556 short unibi_get_num(const unibi_term *, enum unibi_numeric);
557 void unibi_set_num(unibi_term *, enum unibi_numeric, short);
558
559 const char *unibi_get_str(const unibi_term *, enum unibi_string);
560 void unibi_set_str(unibi_term *, enum unibi_string, const char *);
561
562 unibi_term *unibi_from_fp(FILE *);
563 unibi_term *unibi_from_fd(int);
564 unibi_term *unibi_from_file(const char *);
565 unibi_term *unibi_from_term(const char *);
566 unibi_term *unibi_from_env(void);
567
568 extern const char *const unibi_terminfo_dirs;
569
570 const char *unibi_name_bool(enum unibi_boolean);
699ecf4 @mauke provide access to the shorter capnames
authored
571 const char *unibi_short_name_bool(enum unibi_boolean);
5dd73d9 @mauke initial import
authored
572 const char *unibi_name_num(enum unibi_numeric);
699ecf4 @mauke provide access to the shorter capnames
authored
573 const char *unibi_short_name_num(enum unibi_numeric);
5dd73d9 @mauke initial import
authored
574 const char *unibi_name_str(enum unibi_string);
699ecf4 @mauke provide access to the shorter capnames
authored
575 const char *unibi_short_name_str(enum unibi_string);
5dd73d9 @mauke initial import
authored
576
e11128d @mauke first attempt at support for extended capabilities
authored
577
578 size_t unibi_count_ext_bool(const unibi_term *);
579 size_t unibi_count_ext_num(const unibi_term *);
580 size_t unibi_count_ext_str(const unibi_term *);
581
582 int unibi_get_ext_bool(const unibi_term *, size_t);
583 short unibi_get_ext_num(const unibi_term *, size_t);
584 const char *unibi_get_ext_str(const unibi_term *, size_t);
585
586 void unibi_set_ext_bool(unibi_term *, size_t, int);
587 void unibi_set_ext_num(unibi_term *, size_t, short);
588 void unibi_set_ext_str(unibi_term *, size_t, const char *);
c54ef8d @mauke reshuffle
authored
589
590 const char *unibi_get_ext_bool_name(const unibi_term *, size_t);
591 const char *unibi_get_ext_num_name(const unibi_term *, size_t);
592 const char *unibi_get_ext_str_name(const unibi_term *, size_t);
593
594 void unibi_set_ext_bool_name(unibi_term *, size_t, const char *);
595 void unibi_set_ext_num_name(unibi_term *, size_t, const char *);
e11128d @mauke first attempt at support for extended capabilities
authored
596 void unibi_set_ext_str_name(unibi_term *, size_t, const char *);
597
598 size_t unibi_add_ext_bool(unibi_term *, const char *, int);
599 size_t unibi_add_ext_num(unibi_term *, const char *, short);
600 size_t unibi_add_ext_str(unibi_term *, const char *, const char *);
601
602 void unibi_del_ext_bool(unibi_term *, size_t);
603 void unibi_del_ext_num(unibi_term *, size_t);
604 void unibi_del_ext_str(unibi_term *, size_t);
605
726b789 @mauke clean up after brute merge
authored
606
607 typedef union {
305505a @mauke tabs -> spaces
authored
608 int i;
609 char *p;
726b789 @mauke clean up after brute merge
authored
610 } unibi_var_t;
611
612 void unibi_format(
305505a @mauke tabs -> spaces
authored
613 unibi_var_t [26],
614 unibi_var_t [26],
615 const char *,
616 unibi_var_t [9],
617 void (*)(void *, const char *, size_t),
618 void *,
619 void (*)(void *, size_t, int, int),
620 void *
726b789 @mauke clean up after brute merge
authored
621 );
622
623 size_t unibi_run(const char *, unibi_var_t [9], char *, size_t);
624
5dd73d9 @mauke initial import
authored
625 #endif /* GUARD_UNIBILIUM_H_ */
Something went wrong with that request. Please try again.