- Timestamp:
- 2010-05-08T07:53:23Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 051bc69a
- Parents:
- 6c39a907 (diff), 1317380 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 2 edited
-
lib/c/generic/io/printf_core.c (modified) (7 diffs)
-
srv/hid/fb/serial_console.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/printf_core.c
r6c39a907 r25a76ab8 260 260 if (str == NULL) 261 261 return printf_putstr(nullstr, ps); 262 262 263 263 /* Print leading spaces. */ 264 264 size_t strw = str_length(str); 265 265 if (precision == 0) 266 266 precision = strw; 267 267 268 268 /* Left padding */ 269 269 size_t counter = 0; … … 275 275 } 276 276 } 277 277 278 278 /* Part of @a str fitting into the alloted space. */ 279 279 int retval; … … 390 390 */ 391 391 if (flags & __PRINTF_FLAG_PREFIX) { 392 switch (base) {392 switch (base) { 393 393 case 2: 394 394 /* Binary formating is not standard, but usefull */ … … 454 454 /* Print prefix */ 455 455 if (flags & __PRINTF_FLAG_PREFIX) { 456 switch (base) {456 switch (base) { 457 457 case 2: 458 458 /* Binary formating is not standard, but usefull */ … … 569 569 * 570 570 * - P, p Print value of a pointer. Void * value is expected and it is 571 * printed in hexadecimal notation with prefix (as with \%#X / \%#x 572 * for 32-bit or \%#X / \%#x for 64-bit long pointers). 571 * printed in hexadecimal notation with prefix (as with 572 * \%#0.8X / \%#0.8x for 32-bit or \%#0.16lX / \%#0.16lx for 64-bit 573 * long pointers). 573 574 * 574 575 * - b Print value as unsigned binary number. Prefix is not printed by … … 783 784 case 'p': 784 785 flags |= __PRINTF_FLAG_PREFIX; 786 flags |= __PRINTF_FLAG_ZEROPADDED; 785 787 base = 16; 786 788 qualifier = PrintfQualifierPointer; … … 845 847 case PrintfQualifierPointer: 846 848 size = sizeof(void *); 847 number = (uint64_t) (unsigned long) va_arg(ap, void *); 849 precision = size << 1; 850 number = (uint64_t) (uintptr_t) va_arg(ap, void *); 848 851 break; 849 852 default: -
uspace/srv/hid/fb/serial_console.c
r6c39a907 r25a76ab8 84 84 SGR_RESET = 0, 85 85 SGR_BOLD = 1, 86 SGR_UNDERLINE = 4, 86 87 SGR_BLINK = 5, 87 88 SGR_REVERSE = 7, 88 SGR_NORMAL_INT = 22,89 SGR_BLINK_OFF = 25,90 SGR_REVERSE_OFF = 27,91 89 SGR_FGCOLOR = 30, 92 90 SGR_BGCOLOR = 40 … … 153 151 switch (style) { 154 152 case STYLE_EMPHASIS: 153 serial_sgr(SGR_RESET); 155 154 if (color) { 156 serial_sgr(SGR_RESET);157 155 serial_sgr(SGR_FGCOLOR + CI_RED); 158 156 serial_sgr(SGR_BGCOLOR + CI_WHITE); … … 161 159 break; 162 160 case STYLE_INVERTED: 161 serial_sgr(SGR_RESET); 163 162 if (color) { 164 serial_sgr(SGR_RESET);165 163 serial_sgr(SGR_FGCOLOR + CI_WHITE); 166 164 serial_sgr(SGR_BGCOLOR + CI_BLACK); 167 serial_sgr(SGR_NORMAL_INT);168 165 } else 169 166 serial_sgr(SGR_REVERSE); 170 167 break; 171 168 case STYLE_SELECTED: 169 serial_sgr(SGR_RESET); 172 170 if (color) { 173 serial_sgr(SGR_RESET);174 171 serial_sgr(SGR_FGCOLOR + CI_WHITE); 175 172 serial_sgr(SGR_BGCOLOR + CI_RED); 176 serial_sgr(SGR_NORMAL_INT); 177 } else { 178 serial_sgr(SGR_BOLD); 179 serial_sgr(SGR_REVERSE); 180 } 173 } else 174 serial_sgr(SGR_UNDERLINE); 181 175 break; 182 176 default: 177 serial_sgr(SGR_RESET); 183 178 if (color) { 184 serial_sgr(SGR_RESET);185 179 serial_sgr(SGR_FGCOLOR + CI_BLACK); 186 180 serial_sgr(SGR_BGCOLOR + CI_WHITE); 187 181 } 188 serial_sgr(SGR_NORMAL_INT);189 182 } 190 183 } … … 193 186 uint8_t flags) 194 187 { 188 serial_sgr(SGR_RESET); 195 189 if (color) { 196 serial_sgr(SGR_RESET); 197 serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); 198 serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); 190 serial_sgr(SGR_FGCOLOR + color_map[fgcolor & 7]); 191 serial_sgr(SGR_BGCOLOR + color_map[bgcolor & 7]); 192 if (flags & CATTR_BRIGHT) 193 serial_sgr(SGR_BOLD); 199 194 } else { 200 if (fgcolor < bgcolor) 201 serial_sgr(SGR_RESET); 202 else 195 if (fgcolor >= bgcolor) 203 196 serial_sgr(SGR_REVERSE); 204 } 197 } 205 198 } 206 199 … … 209 202 serial_sgr(SGR_RESET); 210 203 211 if (fgcolor < bgcolor) 212 serial_sgr(SGR_REVERSE_OFF); 213 else 204 if (fgcolor >= bgcolor) 214 205 serial_sgr(SGR_REVERSE); 215 206 } … … 283 274 } 284 275 285 286 287 276 /** Draw text data to viewport. 288 277 * 289 * @param vport Viewport id290 * @param data Text data.291 * @param x Leftmost column of the area.292 * @param y Topmost row of the area.293 * @param w Number of rows.294 * @param h Number of columns.278 * @param vport Viewport id 279 * @param data Text data. 280 * @param x0 Leftmost column of the area. 281 * @param y0 Topmost row of the area. 282 * @param width Number of rows. 283 * @param height Number of columns. 295 284 * 296 285 */ 297 static void draw_text_data(keyfield_t *data, ipcarg_t x, ipcarg_t y, 298 ipcarg_t w, ipcarg_t h) 299 { 300 serial_goto(x, y); 301 ipcarg_t i; 302 ipcarg_t j; 303 286 static void draw_text_data(keyfield_t *data, ipcarg_t x0, ipcarg_t y0, 287 ipcarg_t width, ipcarg_t height) 288 { 304 289 attrs_t *a0 = &data[0].attrs; 305 306 for (j = 0; j < h; j++) { 307 if ((j > 0) && (w != scr_width)) 308 serial_goto(x, j); 290 serial_set_attrs(a0); 291 292 ipcarg_t y; 293 for (y = 0; y < height; y++) { 294 serial_goto(x0, y0 + y); 309 295 310 for (i = 0; i < w; i++) { 311 attrs_t *a1 = &data[j * w + i].attrs; 312 313 if (!attrs_same(*a0, *a1)) { 314 serial_set_attrs(a1); 315 a0 = a1; 296 ipcarg_t x; 297 for (x = 0; x < width; x++) { 298 attrs_t *attr = &data[y * width + x].attrs; 299 300 if (!attrs_same(*a0, *attr)) { 301 serial_set_attrs(attr); 302 a0 = attr; 316 303 } 317 304 318 serial_putchar(data[ j * w + i].character);305 serial_putchar(data[y * width + x].character); 319 306 } 320 307 } … … 352 339 ipcarg_t w; 353 340 ipcarg_t h; 354 attrs_t attr;355 341 ssize_t rows; 356 342 … … 430 416 break; 431 417 case FB_SET_STYLE: 432 attr.t = at_style;433 attr.a.s.style = IPC_GET_ARG1(call);418 cur_attr.t = at_style; 419 cur_attr.a.s.style = IPC_GET_ARG1(call); 434 420 serial_set_attrs(&cur_attr); 435 421 retval = 0; 436 422 break; 437 423 case FB_SET_COLOR: 438 attr.t = at_idx;439 attr.a.i.fg_color = IPC_GET_ARG1(call);440 attr.a.i.bg_color = IPC_GET_ARG2(call);441 attr.a.i.flags = IPC_GET_ARG3(call);424 cur_attr.t = at_idx; 425 cur_attr.a.i.fg_color = IPC_GET_ARG1(call); 426 cur_attr.a.i.bg_color = IPC_GET_ARG2(call); 427 cur_attr.a.i.flags = IPC_GET_ARG3(call); 442 428 serial_set_attrs(&cur_attr); 443 429 retval = 0; 444 430 break; 445 431 case FB_SET_RGB_COLOR: 446 attr.t = at_rgb;447 attr.a.r.fg_color = IPC_GET_ARG1(call);448 attr.a.r.bg_color = IPC_GET_ARG2(call);432 cur_attr.t = at_rgb; 433 cur_attr.a.r.fg_color = IPC_GET_ARG1(call); 434 cur_attr.a.r.bg_color = IPC_GET_ARG2(call); 449 435 serial_set_attrs(&cur_attr); 450 436 retval = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
