Debian Codegraph @

common/core_display.h

raw
1 /*****************************************************************************
2 * Free42 -- an HP-42S calculator simulator
3 * Copyright (C) 2004-2026 Thomas Okken
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/licenses/.
16 *****************************************************************************/
17
18 #ifndef CORE_DISPLAY_H
19 #define CORE_DISPLAY_H 1
20
21 #include "free42.h"
22 #include "core_phloat.h"
23 #include "core_globals.h"
24
25 bool persist_display();
26 bool unpersist_display(int version);
27 void clear_display();
28 void flush_display();
29 void repaint_display();
30 void draw_pixel(int x, int y);
31 void draw_pattern(phloat dx, phloat dy, const char *pattern, int pattern_width);
32 void fly_goose();
33
34 void squeak();
35 void tone(int n);
36 void draw_char(int x, int y, char c);
37 const unsigned char *get_char(char c);
38 void draw_string(int x, int y, const char *s, int length);
39 int special_menu_key(int which);
40 void clear_row(int row);
41
42 void display_prgm_line(int row, int line_offset);
43 void xlabel2buf(char *buf, int buflen, int *bufptr);
44 void display_x(int row);
45 void display_y(int row);
46 void display_incomplete_command(int row);
47 void display_error(int error);
48 void display_command(int row);
49 void draw_varmenu();
50 void display_mem();
51 void show();
52 void redisplay();
53
54 void print_display();
55 int print_program(int prgm_index, int4 pc, int4 lines, bool normal);
56 void print_program_line(int prgm_index, int4 pc);
57 int command2buf(char *buf, int len, int cmd, const arg_struct *arg);
58
59 struct textbuf {
60 char *buf;
61 size_t size;
62 size_t capacity;
63 bool fail;
64 };
65
66 void tb_write(textbuf *tb, const char *data, size_t size);
67 void tb_write_null(textbuf *tb);
68 void tb_indent(textbuf *tb, int indent);
69 void tb_print_current_program(textbuf *tb);
70
71 #define MENULEVEL_COMMAND 0
72 #define MENULEVEL_ALPHA 1
73 #define MENULEVEL_TRANSIENT 2
74 #define MENULEVEL_PLAIN 3
75 #define MENULEVEL_APP 4
76
77 int appmenu_exitcallback_1(int menuid, bool exitall);
78 int appmenu_exitcallback_2(int menuid, bool exitall);
79 int appmenu_exitcallback_3(int menuid, bool exitall);
80 int appmenu_exitcallback_4(int menuid, bool exitall);
81 int appmenu_exitcallback_5(int menuid, bool exitall);
82
83 void set_menu(int level, int menuid);
84 int set_menu_return_err(int level, int menuid, bool exitall);
85 void set_appmenu_exitcallback(int callback_id);
86 void set_plainmenu(int menuid, const char *name, int length);
87 void set_catalog_menu(int direction);
88 int get_front_menu();
89 void set_cat_section(int section);
90 int get_cat_section();
91 void move_cat_row(int direction);
92 void set_cat_row(int row);
93 int get_cat_row();
94 int get_cat_item(int menukey);
95 void update_catalog();
96
97 void clear_custom_menu();
98 void assign_custom_key(int keynum, const char *name, int length);
99 void get_custom_key(int keynum, char *name, int *length);
100
101 void clear_prgm_menu();
102 void assign_prgm_key(int keynum, bool is_gto, const arg_struct *arg);
103 void do_prgm_menu_key(int keynum);
104
105 #endif