2 * Copyright (c) 2016, S. Gilles <sgilles@math.umd.edu>
4 * Permission to use, copy, modify, and/or distribute this software
5 * for any purpose with or without fee is hereby granted, provided
6 * that the above copyright notice and this permission notice appear
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 /* Whether we actually need to draw this frame or not */
28 static uint_fast8_t need_to_draw
= 1;
33 /* The event we'll give back */
34 static struct ui_event pass_back
= { 0 };
37 int ui_init(struct quiver
*i_q
)
44 /* Deal with the fact that the quiver was changed */
45 int ui_respond_quiver_change(void)
56 /* Record that a frame has been started */
57 int ui_start_frame(void)
62 /* Draw a frame, sleep to framelimit */
63 int ui_finish_frame(void)
67 struct rational
*e
= 0;
68 size_t line_length
= 0;
74 printf("%*s| Name\n----------\n", 4, "i");
76 for (j
= 0; j
< q
->v_num
; ++j
) {
77 printf("%*llu | %s\n", 4, (long long unsigned) j
, q
->v
[j
].name
);
80 line_length
= printf("%*s| ", 4, "i\\j");
82 for (j
= 0; j
< q
->v_num
; ++j
) {
83 line_length
+= printf("%*llu", 5, (long long unsigned) j
);
88 for (j
= 0; j
< line_length
; ++j
) {
92 for (i
= 0; i
< q
->v_num
; ++i
) {
93 printf("\n %*llu| ", 3, (long long unsigned) i
);
95 for (j
= 0; j
< q
->v_num
; ++j
) {
96 e
= &(q
->e
[i
* q
->v_len
+ j
]);
100 } else if (e
->q
== 1) {
101 printf("%*lld", 5, (long long int) e
->p
);
103 printf("%*lld/%llu", 3, (long long int) e
->p
,
104 (long long unsigned) e
->q
);
116 int ui_get_event(struct ui_event
*e
, uint_fast8_t *more
)
120 pass_back
= (struct ui_event
) { 0 };