Commit 99876e9c authored by Niels Möller's avatar Niels Möller
Browse files

* src/interact.h (terminal_attributes): New class.

(interact): Renamed the class abstract_interact. Added methods
get_attributes and set_attributes.

* src/interact.h (window_change_callback): New class.
(abstract_interact): Replaced the window_change method with to
methods, window_size and window_change_subscribe.

* src/interact.c: Moved unix_interact class to unix_interact.c.

Rev: src/interact.c:1.4
Rev: src/interact.h:1.4
parent 9fd31429
......@@ -42,6 +42,7 @@
#include "interact.h.x"
#if 0
int tty_fd = -1;
int lsh_open_tty(void)
......@@ -159,4 +160,4 @@ int yes_or_no(struct lsh_string *s, int def, int free)
return 0;
......@@ -29,7 +29,7 @@
#include "lsh.h"
/* Forward declaration */
struct abstract_interact;
struct interact;
struct terminal_dimensions;
......@@ -47,18 +47,29 @@ struct terminal_dimensions
UINT32 pixel_height;
/* GABA:
(name terminal_attributes)
(make_raw method (object terminal_attributes))
(encode method (string))))
#define TERM_MAKE_RAW(t) ((t)->make_raw((t)))
#define TERM_ENCODE(t) ((t)->encode((t)))
/* GABA:
(name window_change_callback)
(f method void "struct abstract_interact *i")))
(f method void "struct interact *i")))
#define WINDOW_CHANGE_CALLBACK(c, i) ((c)->f((c), (i)))
/* GABA:
(name abstract_interact)
(name interact)
(is_tty method int)
; (read_line method int "UINT32 size" "UINT8 *buffer")
......@@ -69,6 +80,10 @@ struct terminal_dimensions
(yes_or_no method int
"struct lsh_string *prompt"
"int def" "int free")
(get_attributes method (object terminal_attributes) )
(set_attributes method int "struct terminal_attributes *attr")
(window_size method int "struct terminal_dimensions *")
(window_change_subscribe method (object resource)
"struct window_change_callback *callback")))
......@@ -80,15 +95,24 @@ struct terminal_dimensions
((i)->read_password((i), (l), (p), (f)))
#define INTERACT_YES_OR_NO(i, p, d, f) \
((i)->yes_or_no((i), (p), (d), (f)))
((i)->set_attributes((i), (t)))
#define INTERACT_WINDOW_SIZE(i, d) \
((i)->window_size((i), (d)))
((i)->window_change_subscribe((i), (c)))
#if 0
extern int tty_fd;
int lsh_open_tty(void);
int tty_read_line(UINT32 size, UINT8 *buffer);
int yes_or_no(struct lsh_string *s, int def, int free);
struct interact *
make_unix_interact(struct io_backend *backend);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment