Changeset 28a5ebd in mainline for uspace/app
- Timestamp:
- 2020-06-18T15:39:50Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce52c333
- Parents:
- 4f663f3e
- Location:
- uspace/app
- Files:
-
- 23 edited
-
bdsh/cmds/modules/cat/cat.c (modified) (3 diffs)
-
bdsh/cmds/modules/mkdir/mkdir.c (modified) (1 diff)
-
bdsh/cmds/modules/printf/printf.c (modified) (4 diffs)
-
bdsh/compl.c (modified) (2 diffs)
-
bdsh/tok.c (modified) (6 diffs)
-
edit/edit.c (modified) (12 diffs)
-
edit/search.c (modified) (4 diffs)
-
edit/search.h (modified) (2 diffs)
-
edit/search_impl.h (modified) (1 diff)
-
edit/sheet.c (modified) (5 diffs)
-
edit/sheet.h (modified) (1 diff)
-
kio/kio.c (modified) (6 diffs)
-
netecho/netecho.c (modified) (1 diff)
-
nterm/nterm.c (modified) (1 diff)
-
sbi/src/builtin/bi_char.c (modified) (1 diff)
-
sbi/src/os/helenos.c (modified) (3 diffs)
-
sbi/src/os/os.h (modified) (1 diff)
-
sbi/src/os/posix.c (modified) (1 diff)
-
sysinfo/sysinfo.c (modified) (1 diff)
-
tester/print/print4.c (modified) (1 diff)
-
tetris/scores.c (modified) (1 diff)
-
tetris/screen.c (modified) (2 diffs)
-
top/screen.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r4f663f3e r28a5ebd 154 154 } 155 155 156 static void paged_char( wchar_t c)156 static void paged_char(char32_t c) 157 157 { 158 158 if (last_char_was_newline && number) { … … 160 160 printf("%6u ", lineno); 161 161 } 162 put wchar(c);162 putuchar(c); 163 163 last_char_was_newline = c == '\n'; 164 164 if (paging_enabled) { … … 269 269 paged_char(((count + i + 1) & 0xf) == 0 ? '\n' : ' '); 270 270 } else { 271 wchar_t c = str_decode(buff, &offset, bytes);271 char32_t c = str_decode(buff, &offset, bytes); 272 272 if (c == 0) { 273 273 /* Reached end of string */ -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r4f663f3e r28a5ebd 108 108 while (true) { 109 109 size_t prev_off = off; 110 wchar_t cur_char = str_decode(path, &off, STR_NO_LIMIT);110 char32_t cur_char = str_decode(path, &off, STR_NO_LIMIT); 111 111 if ((cur_char == 0) || (cur_char == U_SPECIAL)) { 112 112 break; -
uspace/app/bdsh/cmds/modules/printf/printf.c
r4f663f3e r28a5ebd 68 68 * @param arg string with data to print. 69 69 */ 70 static int print_arg( wchar_t ch, const char *arg)70 static int print_arg(char32_t ch, const char *arg) 71 71 { 72 72 switch (ch) { … … 93 93 * @param ch Control character. 94 94 */ 95 static int process_ctl( wchar_t ch)95 static int process_ctl(char32_t ch) 96 96 { 97 97 switch (ch) { … … 120 120 char *fmt; 121 121 size_t pos, fmt_sz; 122 wchar_t ch;122 char32_t ch; 123 123 bool esc_flag = false; 124 124 unsigned int carg; // Current argument … … 170 170 break; 171 171 } 172 put wchar(ch);172 putuchar(ch); 173 173 break; 174 174 175 175 emit: 176 put wchar(ch);176 putuchar(ch); 177 177 esc_flag = false; 178 178 } -
uspace/app/bdsh/compl.c
r4f663f3e r28a5ebd 44 44 #include "util.h" 45 45 46 static errno_t compl_init( wchar_t *text, size_t pos, size_t *cstart, void **state);46 static errno_t compl_init(char32_t *text, size_t pos, size_t *cstart, void **state); 47 47 static errno_t compl_get_next(void *state, char **compl); 48 48 static void compl_fini(void *state); … … 94 94 * Set up iterators in completion object, based on current token. 95 95 */ 96 static errno_t compl_init( wchar_t *text, size_t pos, size_t *cstart, void **state)96 static errno_t compl_init(char32_t *text, size_t pos, size_t *cstart, void **state) 97 97 { 98 98 compl_t *cs = NULL; -
uspace/app/bdsh/tok.c
r4f663f3e r28a5ebd 36 36 37 37 /* Forward declarations of static functions */ 38 static wchar_t tok_get_char(tokenizer_t *);39 static wchar_t tok_look_char(tokenizer_t *);40 static errno_t tok_push_char(tokenizer_t *, wchar_t);38 static char32_t tok_get_char(tokenizer_t *); 39 static char32_t tok_look_char(tokenizer_t *); 40 static errno_t tok_push_char(tokenizer_t *, char32_t); 41 41 static errno_t tok_push_token(tokenizer_t *); 42 42 static bool tok_pending_chars(tokenizer_t *); … … 92 92 { 93 93 errno_t rc; 94 wchar_t next_char;94 char32_t next_char; 95 95 96 96 /* Read the input line char by char and append tokens */ … … 182 182 { 183 183 errno_t rc; 184 wchar_t next_char;184 char32_t next_char; 185 185 186 186 while ((next_char = tok_look_char(tok)) != 0) { … … 214 214 215 215 /** Get a char from input, advancing the input position */ 216 wchar_t tok_get_char(tokenizer_t *tok)216 char32_t tok_get_char(tokenizer_t *tok) 217 217 { 218 218 tok->in_char_offset++; … … 221 221 222 222 /** Get a char from input, while staying on the same input position */ 223 wchar_t tok_look_char(tokenizer_t *tok)223 char32_t tok_look_char(tokenizer_t *tok) 224 224 { 225 225 size_t old_offset = tok->in_offset; 226 226 size_t old_char_offset = tok->in_char_offset; 227 wchar_t ret = tok_get_char(tok);227 char32_t ret = tok_get_char(tok); 228 228 tok->in_offset = old_offset; 229 229 tok->in_char_offset = old_char_offset; … … 232 232 233 233 /** Append a char to the end of the current token */ 234 errno_t tok_push_char(tokenizer_t *tok, wchar_t ch)234 errno_t tok_push_char(tokenizer_t *tok, char32_t ch) 235 235 { 236 236 return chr_encode(ch, tok->outbuf, &tok->outbuf_offset, tok->outbuf_size); -
uspace/app/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; … … 850 850 coord_t rbc, rec; 851 851 char row_buf[ROW_BUF_SIZE]; 852 wchar_t c;852 char32_t c; 853 853 size_t pos, size; 854 854 int s_column; … … 1055 1055 1056 1056 /** Insert a character at caret position. */ 1057 static void insert_char( wchar_t c)1057 static void insert_char(char32_t c) 1058 1058 { 1059 1059 spt_t pt; … … 1285 1285 1286 1286 /* Search operations */ 1287 static errno_t search_spt_producer(void *data, wchar_t *ret)1287 static errno_t search_spt_producer(void *data, char32_t *ret) 1288 1288 { 1289 1289 assert(data != NULL); … … 1294 1294 } 1295 1295 1296 static errno_t search_spt_reverse_producer(void *data, wchar_t *ret)1296 static errno_t search_spt_reverse_producer(void *data, char32_t *ret) 1297 1297 { 1298 1298 assert(data != NULL); … … 1513 1513 char *str; 1514 1514 size_t off; 1515 wchar_t c;1515 char32_t c; 1516 1516 errno_t rc; 1517 1517 … … 1609 1609 } 1610 1610 1611 static wchar_t get_first_wchar(const char *str)1611 static char32_t get_first_wchar(const char *str) 1612 1612 { 1613 1613 size_t offset = 0; … … 1630 1630 return false; 1631 1631 1632 wchar_t first_char = get_first_wchar(ch);1632 char32_t first_char = get_first_wchar(ch); 1633 1633 switch (first_char) { 1634 1634 case ' ': … … 1656 1656 return false; 1657 1657 1658 wchar_t first_char = get_first_wchar(ch);1658 char32_t first_char = get_first_wchar(ch); 1659 1659 switch (first_char) { 1660 1660 case ',': -
uspace/app/edit/search.c
r4f663f3e r28a5ebd 50 50 return NULL; 51 51 52 wchar_t *p = str_to_awstr(pattern);52 char32_t *p = str_to_awstr(pattern); 53 53 if (p == NULL) { 54 54 free(search); … … 63 63 half = search->pattern_length / 2; 64 64 for (pos = 0; pos < half; pos++) { 65 wchar_t tmp = p[pos];65 char32_t tmp = p[pos]; 66 66 p[pos] = p[search->pattern_length - pos - 1]; 67 67 p[search->pattern_length - pos - 1] = tmp; … … 107 107 search_equals_fn eq = s->ops.equals; 108 108 109 wchar_t cur_char;109 char32_t cur_char; 110 110 errno_t rc = EOK; 111 111 while ((rc = s->ops.producer(s->client_data, &cur_char)) == EOK && cur_char > 0) { … … 141 141 } 142 142 143 bool char_exact_equals(const wchar_t a, const wchar_t b)143 bool char_exact_equals(const char32_t a, const char32_t b) 144 144 { 145 145 return a == b; -
uspace/app/edit/search.h
r4f663f3e r28a5ebd 42 42 struct search; 43 43 typedef struct search search_t; 44 typedef bool (*search_equals_fn)(const wchar_t, const wchar_t);45 typedef errno_t (*search_producer_fn)(void *, wchar_t *);44 typedef bool (*search_equals_fn)(const char32_t, const char32_t); 45 typedef errno_t (*search_producer_fn)(void *, char32_t *); 46 46 typedef errno_t (*search_mark_fn)(void *, void **); 47 47 typedef void (*search_mark_free_fn)(void *); … … 59 59 } search_ops_t; 60 60 61 extern bool char_exact_equals(const wchar_t, const wchar_t);61 extern bool char_exact_equals(const char32_t, const char32_t); 62 62 extern search_t *search_init(const char *, void *, search_ops_t, bool); 63 63 extern errno_t search_next_match(search_t *, match_t *); -
uspace/app/edit/search_impl.h
r4f663f3e r28a5ebd 43 43 /* Note: This structure is opaque for the user. */ 44 44 45 wchar_t *pattern;45 char32_t *pattern; 46 46 size_t pattern_length; 47 47 ssize_t *back_table; -
uspace/app/edit/sheet.c
r4f663f3e r28a5ebd 195 195 size_t copy_sz; 196 196 size_t off, prev; 197 wchar_t c;197 char32_t c; 198 198 199 199 spp = sh->data + spos->b_off; … … 222 222 { 223 223 size_t cur_pos, prev_pos; 224 wchar_t c;224 char32_t c; 225 225 coord_t cc; 226 226 … … 291 291 size_t off; 292 292 coord_t cc; 293 wchar_t c;293 char32_t c; 294 294 sheet_t *sh; 295 295 … … 320 320 321 321 /** Get a character at spt and return next spt */ 322 wchar_t spt_next_char(spt_t spt, spt_t *next)323 { 324 wchar_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size);322 char32_t spt_next_char(spt_t spt, spt_t *next) 323 { 324 char32_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size); 325 325 if (next) 326 326 *next = spt; … … 328 328 } 329 329 330 wchar_t spt_prev_char(spt_t spt, spt_t *prev)331 { 332 wchar_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size);330 char32_t spt_prev_char(spt_t spt, spt_t *prev) 331 { 332 char32_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size); 333 333 if (prev) 334 334 *prev = spt; -
uspace/app/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 *); -
uspace/app/kio/kio.c
r4f663f3e r28a5ebd 56 56 link_t link; 57 57 size_t length; 58 wchar_t *data;58 char32_t *data; 59 59 } item_t; 60 60 … … 62 62 63 63 /* Pointer to kio area */ 64 static wchar_t *kio = (wchar_t *) AS_AREA_ANY;64 static char32_t *kio = (char32_t *) AS_AREA_ANY; 65 65 static size_t kio_length; 66 66 … … 77 77 * 78 78 */ 79 static void producer(size_t length, wchar_t *data)79 static void producer(size_t length, char32_t *data) 80 80 { 81 81 item_t *item = (item_t *) malloc(sizeof(item_t)); … … 83 83 return; 84 84 85 size_t sz = sizeof( wchar_t) * length;86 wchar_t *buf = (wchar_t *) malloc(sz);85 size_t sz = sizeof(char32_t) * length; 86 char32_t *buf = (char32_t *) malloc(sz); 87 87 if (buf == NULL) { 88 88 free(item); … … 121 121 122 122 for (size_t i = 0; i < item->length; i++) 123 put wchar(item->data[i]);123 putuchar(item->data[i]); 124 124 125 125 if (log != NULL) { 126 126 for (size_t i = 0; i < item->length; i++) 127 fput wc(item->data[i], log);127 fputuc(item->data[i], log); 128 128 129 129 fflush(log); … … 202 202 203 203 size_t size = pages * PAGE_SIZE; 204 kio_length = size / sizeof( wchar_t);204 kio_length = size / sizeof(char32_t); 205 205 206 206 rc = physmem_map(faddr, pages, AS_AREA_READ | AS_AREA_CACHEABLE, -
uspace/app/netecho/netecho.c
r4f663f3e r28a5ebd 71 71 } 72 72 73 static void send_char( wchar_t c)73 static void send_char(char32_t c) 74 74 { 75 75 char cbuf[STR_BOUNDS(1)]; -
uspace/app/nterm/nterm.c
r4f663f3e r28a5ebd 58 58 } 59 59 60 static void send_char( wchar_t c)60 static void send_char(char32_t c) 61 61 { 62 62 char cbuf[STR_BOUNDS(1)]; -
uspace/app/sbi/src/builtin/bi_char.c
r4f663f3e r28a5ebd 90 90 } 91 91 92 str = os_chr_to_astr(( wchar_t) char_val);92 str = os_chr_to_astr((char32_t) char_val); 93 93 94 94 /* Ownership of str is transferred. */ -
uspace/app/sbi/src/os/helenos.c
r4f663f3e r28a5ebd 94 94 size_t i; 95 95 size_t size; 96 wchar_t c;96 char32_t c; 97 97 98 98 assert(start + length <= str_length(str)); … … 155 155 size_t offset; 156 156 int i; 157 wchar_t c = 0;157 char32_t c = 0; 158 158 159 159 if (index < 0) … … 178 178 * @return Newly allocated string. 179 179 */ 180 char *os_chr_to_astr( wchar_t chr)180 char *os_chr_to_astr(char32_t chr) 181 181 { 182 182 char *str; -
uspace/app/sbi/src/os/os.h
r4f663f3e r28a5ebd 38 38 size_t os_str_length(const char *str); 39 39 errno_t os_str_get_char(const char *str, int index, int *out_char); 40 char *os_chr_to_astr( wchar_t chr);40 char *os_chr_to_astr(char32_t chr); 41 41 void os_input_disp_help(void); 42 42 errno_t os_input_line(const char *prompt, char **ptr); -
uspace/app/sbi/src/os/posix.c
r4f663f3e r28a5ebd 164 164 * @return Newly allocated string. 165 165 */ 166 char *os_chr_to_astr( wchar_t chr)166 char *os_chr_to_astr(char32_t chr) 167 167 { 168 168 char *str; -
uspace/app/sysinfo/sysinfo.c
r4f663f3e r28a5ebd 56 56 57 57 while (offset < size) { 58 wchar_t c = str_decode(data, &offset, size);58 char32_t c = str_decode(data, &offset, size); 59 59 printf("%lc", (wint_t) c); 60 60 } -
uspace/app/tester/print/print4.c
r4f663f3e r28a5ebd 29 29 #include <stdio.h> 30 30 #include <stddef.h> 31 #include < wchar.h>31 #include <uchar.h> 32 32 #include "../tester.h" 33 33 -
uspace/app/tetris/scores.c
r4f663f3e r28a5ebd 154 154 if (kev->key == KC_BACKSPACE) { 155 155 if (i > 0) { 156 wchar_t uc;156 char32_t uc; 157 157 158 158 --i; -
uspace/app/tetris/screen.c
r4f663f3e r28a5ebd 371 371 */ 372 372 373 wchar_t c = 0;373 char32_t c = 0; 374 374 375 375 while (c == 0) { … … 393 393 int twait(void) 394 394 { 395 wchar_t c = 0;395 char32_t c = 0; 396 396 397 397 while (c == 0) { -
uspace/app/top/screen.c
r4f663f3e r28a5ebd 551 551 */ 552 552 553 wchar_t c = 0;553 char32_t c = 0; 554 554 555 555 while (c == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.
