Changeset 357d9dd in mainline
- Timestamp:
- 2024-10-01T10:39:09Z (4 months ago)
- Branches:
- master
- Children:
- d31c3ea
- Parents:
- 89e5c0c7
- git-author:
- Jiri Svoboda <jiri@…> (2024-09-30 18:39:04)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-10-01 10:39:09)
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/vt/include/vt/vt100.h
r89e5c0c7 r357d9dd 89 89 vt100_control_puts_t control_puts; 90 90 vt100_flush_t flush; 91 } vt100_ state_t;91 } vt100_t; 92 92 93 93 extern sgr_color_index_t color_map[]; 94 94 95 extern vt100_ state_t *vt100_state_create(void *, sysarg_t, sysarg_t,95 extern vt100_t *vt100_create(void *, sysarg_t, sysarg_t, 96 96 vt100_putuchar_t, vt100_control_puts_t, vt100_flush_t); 97 extern void vt100_ state_destroy(vt100_state_t *);97 extern void vt100_destroy(vt100_t *); 98 98 99 extern errno_t vt100_yield(vt100_ state_t *);100 extern errno_t vt100_claim(vt100_ state_t *);101 extern void vt100_get_dimensions(vt100_ state_t *, sysarg_t *, sysarg_t *);99 extern errno_t vt100_yield(vt100_t *); 100 extern errno_t vt100_claim(vt100_t *); 101 extern void vt100_get_dimensions(vt100_t *, sysarg_t *, sysarg_t *); 102 102 103 extern void vt100_cls(vt100_ state_t *);104 extern void vt100_set_pos(vt100_ state_t *, sysarg_t, sysarg_t);105 extern void vt100_goto(vt100_ state_t *, sysarg_t, sysarg_t);106 extern void vt100_set_sgr(vt100_ state_t *, char_attrs_t);107 extern void vt100_set_attr(vt100_ state_t *, char_attrs_t);108 extern void vt100_cursor_visibility(vt100_ state_t *, bool);109 extern void vt100_putuchar(vt100_ state_t *, char32_t);110 extern void vt100_flush(vt100_ state_t *);103 extern void vt100_cls(vt100_t *); 104 extern void vt100_set_pos(vt100_t *, sysarg_t, sysarg_t); 105 extern void vt100_goto(vt100_t *, sysarg_t, sysarg_t); 106 extern void vt100_set_sgr(vt100_t *, char_attrs_t); 107 extern void vt100_set_attr(vt100_t *, char_attrs_t); 108 extern void vt100_cursor_visibility(vt100_t *, bool); 109 extern void vt100_putuchar(vt100_t *, char32_t); 110 extern void vt100_flush(vt100_t *); 111 111 112 112 #endif -
uspace/lib/vt/src/vt100.c
r89e5c0c7 r357d9dd 49 49 }; 50 50 51 void vt100_cls(vt100_ state_t *state)51 void vt100_cls(vt100_t *state) 52 52 { 53 53 state->control_puts(state->arg, "\033[2J"); … … 55 55 56 56 /** ECMA-48 Set Graphics Rendition. */ 57 static void vt100_sgr(vt100_ state_t *state, unsigned int mode)57 static void vt100_sgr(vt100_t *state, unsigned int mode) 58 58 { 59 59 char control[MAX_CONTROL]; … … 64 64 65 65 /** Set Graphics Rendition with 5 arguments. */ 66 static void vt100_sgr5(vt100_ state_t *state, unsigned a1, unsigned a2,66 static void vt100_sgr5(vt100_t *state, unsigned a1, unsigned a2, 67 67 unsigned a3, unsigned a4, unsigned a5) 68 68 { … … 74 74 } 75 75 76 void vt100_set_pos(vt100_ state_t *state, sysarg_t col, sysarg_t row)76 void vt100_set_pos(vt100_t *state, sysarg_t col, sysarg_t row) 77 77 { 78 78 char control[MAX_CONTROL]; … … 83 83 } 84 84 85 void vt100_set_sgr(vt100_ state_t *state, char_attrs_t attrs)85 void vt100_set_sgr(vt100_t *state, char_attrs_t attrs) 86 86 { 87 87 unsigned color; … … 147 147 } 148 148 149 vt100_ state_t *vt100_state_create(void *arg, sysarg_t cols, sysarg_t rows,149 vt100_t *vt100_create(void *arg, sysarg_t cols, sysarg_t rows, 150 150 vt100_putuchar_t putuchar_fn, vt100_control_puts_t control_puts_fn, 151 151 vt100_flush_t flush_fn) 152 152 { 153 vt100_ state_t *state = malloc(sizeof(vt100_state_t));153 vt100_t *state = malloc(sizeof(vt100_t)); 154 154 if (state == NULL) 155 155 return NULL; … … 172 172 } 173 173 174 void vt100_ state_destroy(vt100_state_t *state)174 void vt100_destroy(vt100_t *state) 175 175 { 176 176 free(state); 177 177 } 178 178 179 void vt100_get_dimensions(vt100_ state_t *state, sysarg_t *cols,179 void vt100_get_dimensions(vt100_t *state, sysarg_t *cols, 180 180 sysarg_t *rows) 181 181 { … … 184 184 } 185 185 186 errno_t vt100_yield(vt100_ state_t *state)186 errno_t vt100_yield(vt100_t *state) 187 187 { 188 188 return EOK; 189 189 } 190 190 191 errno_t vt100_claim(vt100_ state_t *state)191 errno_t vt100_claim(vt100_t *state) 192 192 { 193 193 return EOK; 194 194 } 195 195 196 void vt100_goto(vt100_ state_t *state, sysarg_t col, sysarg_t row)196 void vt100_goto(vt100_t *state, sysarg_t col, sysarg_t row) 197 197 { 198 198 if ((col >= state->cols) || (row >= state->rows)) … … 206 206 } 207 207 208 void vt100_set_attr(vt100_ state_t *state, char_attrs_t attrs)208 void vt100_set_attr(vt100_t *state, char_attrs_t attrs) 209 209 { 210 210 if (!attrs_same(state->cur_attrs, attrs)) { … … 214 214 } 215 215 216 void vt100_cursor_visibility(vt100_ state_t *state, bool visible)216 void vt100_cursor_visibility(vt100_t *state, bool visible) 217 217 { 218 218 if (visible) … … 222 222 } 223 223 224 void vt100_putuchar(vt100_ state_t *state, char32_t ch)224 void vt100_putuchar(vt100_t *state, char32_t ch) 225 225 { 226 226 state->putuchar(state->arg, ch == 0 ? ' ' : ch); … … 233 233 } 234 234 235 void vt100_flush(vt100_ state_t *state)235 void vt100_flush(vt100_t *state) 236 236 { 237 237 state->flush(state->arg); -
uspace/srv/hid/output/ctl/serial.c
r89e5c0c7 r357d9dd 53 53 * 54 54 */ 55 static void draw_char(vt100_ state_t *state, charfield_t *field,55 static void draw_char(vt100_t *state, charfield_t *field, 56 56 sysarg_t col, sysarg_t row) 57 57 { … … 63 63 static errno_t serial_yield(outdev_t *dev) 64 64 { 65 vt100_ state_t *state = (vt100_state_t *) dev->data;65 vt100_t *state = (vt100_t *) dev->data; 66 66 67 67 return vt100_yield(state); … … 70 70 static errno_t serial_claim(outdev_t *dev) 71 71 { 72 vt100_ state_t *state = (vt100_state_t *) dev->data;72 vt100_t *state = (vt100_t *) dev->data; 73 73 74 74 return vt100_claim(state); … … 78 78 sysarg_t *rows) 79 79 { 80 vt100_ state_t *state = (vt100_state_t *) dev->data;80 vt100_t *state = (vt100_t *) dev->data; 81 81 82 82 vt100_get_dimensions(state, cols, rows); … … 92 92 sysarg_t prev_row, sysarg_t col, sysarg_t row, bool visible) 93 93 { 94 vt100_ state_t *state = (vt100_state_t *) dev->data;94 vt100_t *state = (vt100_t *) dev->data; 95 95 96 96 vt100_goto(state, col, row); … … 100 100 static void serial_char_update(outdev_t *dev, sysarg_t col, sysarg_t row) 101 101 { 102 vt100_ state_t *state = (vt100_state_t *) dev->data;102 vt100_t *state = (vt100_t *) dev->data; 103 103 charfield_t *field = 104 104 chargrid_charfield_at(dev->backbuf, col, row); … … 109 109 static void serial_flush(outdev_t *dev) 110 110 { 111 vt100_ state_t *state = (vt100_state_t *) dev->data;111 vt100_t *state = (vt100_t *) dev->data; 112 112 113 113 vt100_flush(state); … … 128 128 { 129 129 char_attrs_t attrs; 130 vt100_ state_t *state=131 vt100_ state_create(NULL, SERIAL_COLS, SERIAL_ROWS, putuchar_fn,130 vt100_t *vt100 = 131 vt100_create(NULL, SERIAL_COLS, SERIAL_ROWS, putuchar_fn, 132 132 control_puts_fn, flush_fn); 133 if ( state== NULL)133 if (vt100 == NULL) 134 134 return ENOMEM; 135 state->enable_rgb = true;135 vt100->enable_rgb = true; 136 136 137 vt100_cursor_visibility( state, false);137 vt100_cursor_visibility(vt100, false); 138 138 attrs.type = CHAR_ATTR_STYLE; 139 139 attrs.val.style = STYLE_NORMAL; 140 vt100_set_attr( state, attrs);141 vt100_cls( state);140 vt100_set_attr(vt100, attrs); 141 vt100_cls(vt100); 142 142 143 outdev_t *dev = outdev_register(&serial_ops, state);143 outdev_t *dev = outdev_register(&serial_ops, vt100); 144 144 if (dev == NULL) { 145 vt100_ state_destroy(state);145 vt100_destroy(vt100); 146 146 return ENOMEM; 147 147 } -
uspace/srv/hid/remcons/remcons.c
r89e5c0c7 r357d9dd 568 568 remcons->curs_visible = true; 569 569 570 remcons->vt = vt100_ state_create((void *)remcons, 80, 25,570 remcons->vt = vt100_create((void *)remcons, 80, 25, 571 571 remcons_vt_putchar, remcons_vt_cputs, remcons_vt_flush); 572 572 assert(remcons->vt != NULL); // XXX -
uspace/srv/hid/remcons/remcons.h
r89e5c0c7 r357d9dd 47 47 typedef struct { 48 48 telnet_user_t *user; /**< telnet user */ 49 vt100_ state_t *vt;/**< virtual terminal driver */49 vt100_t *vt; /**< virtual terminal driver */ 50 50 bool enable_ctl; /**< enable escape control sequences */ 51 51 bool enable_rgb; /**< enable RGB color setting */
Note:
See TracChangeset
for help on using the changeset viewer.