Changeset 28a5ebd in mainline for uspace/dist/src/c/demos/edit
- Timestamp:
- 2020-06-18T15:39:50Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce52c333
- Parents:
- 4f663f3e
- Location:
- uspace/dist/src/c/demos/edit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/dist/src/c/demos/edit/edit.c
r4f663f3e r28a5ebd 147 147 static void pane_caret_display(void); 148 148 149 static void insert_char( wchar_t c);149 static void insert_char(char32_t c); 150 150 static void delete_char_before(void); 151 151 static void delete_char_after(void); … … 630 630 kbd_event_t *kev; 631 631 char *str; 632 wchar_t buffer[INFNAME_MAX_LEN + 1];632 char32_t buffer[INFNAME_MAX_LEN + 1]; 633 633 int max_len; 634 634 int nc; … … 670 670 default: 671 671 if (kev->c >= 32 && nc < max_len) { 672 put wchar(kev->c);672 putuchar(kev->c); 673 673 console_flush(con); 674 674 buffer[nc++] = kev->c; … … 696 696 { 697 697 FILE *f; 698 wchar_t c;698 char32_t c; 699 699 char buf[BUF_SIZE]; 700 700 int bcnt; … … 847 847 coord_t rbc, rec; 848 848 char row_buf[ROW_BUF_SIZE]; 849 wchar_t c;849 char32_t c; 850 850 size_t pos, size; 851 851 int s_column; … … 1052 1052 1053 1053 /** Insert a character at caret position. */ 1054 static void insert_char( wchar_t c)1054 static void insert_char(char32_t c) 1055 1055 { 1056 1056 spt_t pt; … … 1282 1282 1283 1283 /* Search operations */ 1284 static errno_t search_spt_producer(void *data, wchar_t *ret)1284 static errno_t search_spt_producer(void *data, char32_t *ret) 1285 1285 { 1286 1286 assert(data != NULL); … … 1291 1291 } 1292 1292 1293 static errno_t search_spt_reverse_producer(void *data, wchar_t *ret)1293 static errno_t search_spt_reverse_producer(void *data, char32_t *ret) 1294 1294 { 1295 1295 assert(data != NULL); … … 1510 1510 char *str; 1511 1511 size_t off; 1512 wchar_t c;1512 char32_t c; 1513 1513 errno_t rc; 1514 1514 … … 1606 1606 } 1607 1607 1608 static wchar_t get_first_wchar(const char *str)1608 static char32_t get_first_wchar(const char *str) 1609 1609 { 1610 1610 size_t offset = 0; … … 1627 1627 return false; 1628 1628 1629 wchar_t first_char = get_first_wchar(ch);1629 char32_t first_char = get_first_wchar(ch); 1630 1630 switch (first_char) { 1631 1631 case ' ': … … 1653 1653 return false; 1654 1654 1655 wchar_t first_char = get_first_wchar(ch);1655 char32_t first_char = get_first_wchar(ch); 1656 1656 switch (first_char) { 1657 1657 case ',': -
uspace/dist/src/c/demos/edit/search.c
r4f663f3e r28a5ebd 49 49 return NULL; 50 50 51 wchar_t *p = str_to_awstr(pattern);51 char32_t *p = str_to_awstr(pattern); 52 52 if (p == NULL) { 53 53 free(search); … … 62 62 half = search->pattern_length / 2; 63 63 for (pos = 0; pos < half; pos++) { 64 wchar_t tmp = p[pos];64 char32_t tmp = p[pos]; 65 65 p[pos] = p[search->pattern_length - pos - 1]; 66 66 p[search->pattern_length - pos - 1] = tmp; … … 106 106 search_equals_fn eq = s->ops.equals; 107 107 108 wchar_t cur_char;108 char32_t cur_char; 109 109 errno_t rc = EOK; 110 110 while ((rc = s->ops.producer(s->client_data, &cur_char)) == EOK && cur_char > 0) { … … 140 140 } 141 141 142 bool char_exact_equals(const wchar_t a, const wchar_t b)142 bool char_exact_equals(const char32_t a, const char32_t b) 143 143 { 144 144 return a == b; -
uspace/dist/src/c/demos/edit/search.h
r4f663f3e r28a5ebd 41 41 struct search; 42 42 typedef struct search search_t; 43 typedef bool (*search_equals_fn)(const wchar_t, const wchar_t);44 typedef errno_t (*search_producer_fn)(void *, wchar_t *);43 typedef bool (*search_equals_fn)(const char32_t, const char32_t); 44 typedef errno_t (*search_producer_fn)(void *, char32_t *); 45 45 typedef errno_t (*search_mark_fn)(void *, void **); 46 46 typedef void (*search_mark_free_fn)(void *); … … 58 58 } search_ops_t; 59 59 60 extern bool char_exact_equals(const wchar_t, const wchar_t);60 extern bool char_exact_equals(const char32_t, const char32_t); 61 61 extern search_t *search_init(const char *, void *, search_ops_t, bool); 62 62 extern errno_t search_next_match(search_t *, match_t *); -
uspace/dist/src/c/demos/edit/search_impl.h
r4f663f3e r28a5ebd 43 43 /* Note: This structure is opaque for the user. */ 44 44 45 const wchar_t *pattern;45 const char32_t *pattern; 46 46 size_t pattern_length; 47 47 ssize_t *back_table; -
uspace/dist/src/c/demos/edit/sheet.c
r4f663f3e r28a5ebd 193 193 size_t copy_sz; 194 194 size_t off, prev; 195 wchar_t c;195 char32_t c; 196 196 197 197 spp = sh->data + spos->b_off; … … 220 220 { 221 221 size_t cur_pos, prev_pos; 222 wchar_t c;222 char32_t c; 223 223 coord_t cc; 224 224 … … 289 289 size_t off; 290 290 coord_t cc; 291 wchar_t c;291 char32_t c; 292 292 sheet_t *sh; 293 293 … … 318 318 319 319 /** Get a character at spt and return next spt */ 320 wchar_t spt_next_char(spt_t spt, spt_t *next)321 { 322 wchar_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size);320 char32_t spt_next_char(spt_t spt, spt_t *next) 321 { 322 char32_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size); 323 323 if (next) 324 324 *next = spt; … … 326 326 } 327 327 328 wchar_t spt_prev_char(spt_t spt, spt_t *prev)329 { 330 wchar_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size);328 char32_t spt_prev_char(spt_t spt, spt_t *prev) 329 { 330 char32_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size); 331 331 if (prev) 332 332 *prev = spt; -
uspace/dist/src/c/demos/edit/sheet.h
r4f663f3e r28a5ebd 101 101 extern void spt_get_coord(spt_t const *, coord_t *); 102 102 extern bool spt_equal(spt_t const *, spt_t const *); 103 extern wchar_t spt_next_char(spt_t, spt_t *);104 extern wchar_t spt_prev_char(spt_t, spt_t *);103 extern char32_t spt_next_char(spt_t, spt_t *); 104 extern char32_t spt_prev_char(spt_t, spt_t *); 105 105 106 106 extern void sheet_place_tag(sheet_t *, spt_t const *, tag_t *);
Note:
See TracChangeset
for help on using the changeset viewer.