Changeset d7baee6 in mainline
- Timestamp:
- 2007-01-17T13:03:08Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- df4ed85
- Parents:
- c738d65
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/version.c
rc738d65 rd7baee6 57 57 void version_print(void) 58 58 { 59 printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright); 59 printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", 60 project, release, name, revision, timestamp, arch, copyright); 60 61 } 61 62 -
kernel/generic/src/printf/printf_core.c
rc738d65 rd7baee6 268 268 if (flags & __PRINTF_FLAG_PREFIX) { 269 269 switch(base) { 270 271 272 273 274 275 276 277 278 270 case 2: /* Binary formating is not standard, but usefull */ 271 size += 2; 272 break; 273 case 8: 274 size++; 275 break; 276 case 16: 277 size += 2; 278 break; 279 279 } 280 280 } … … 329 329 if (flags & __PRINTF_FLAG_PREFIX) { 330 330 switch(base) { 331 case 2: /* Binary formating is not standard, but usefull */ 332 if (printf_putchar('0', ps) == 1) 331 case 2: /* Binary formating is not standard, but usefull */ 332 if (printf_putchar('0', ps) == 1) 333 counter++; 334 if (flags & __PRINTF_FLAG_BIGCHARS) { 335 if (printf_putchar('B', ps) == 1) 333 336 counter++; 334 if (flags & __PRINTF_FLAG_BIGCHARS) { 335 if (printf_putchar('B', ps) == 1) 336 counter++; 337 } else { 338 if (printf_putchar('b', ps) == 1) 339 counter++; 340 } 341 break; 342 case 8: 343 if (printf_putchar('o', ps) == 1) 337 } else { 338 if (printf_putchar('b', ps) == 1) 344 339 counter++; 345 break; 346 case 16: 347 if (printf_putchar('0', ps) == 1) 340 } 341 break; 342 case 8: 343 if (printf_putchar('o', ps) == 1) 344 counter++; 345 break; 346 case 16: 347 if (printf_putchar('0', ps) == 1) 348 counter++; 349 if (flags & __PRINTF_FLAG_BIGCHARS) { 350 if (printf_putchar('X', ps) == 1) 348 351 counter++; 349 if (flags & __PRINTF_FLAG_BIGCHARS) { 350 if (printf_putchar('X', ps) == 1) 351 counter++; 352 } else { 353 if (printf_putchar('x', ps) == 1) 354 counter++; 355 } 356 break; 352 } else { 353 if (printf_putchar('x', ps) == 1) 354 counter++; 355 } 356 break; 357 357 } 358 358 } -
uspace/console/console.c
rc738d65 rd7baee6 120 120 { 121 121 async_msg_2(fb_info.phone, FB_CURSOR_GOTO, row, col); 122 123 122 } 124 123 … … 137 136 { 138 137 async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col); 139 140 138 } 141 139 -
uspace/console/gcons.c
rc738d65 rd7baee6 90 90 { 91 91 return async_req_2(fbphone, FB_VIEWPORT_CREATE, 92 (x << 16) | y, (width << 16) | height, 93 NULL, NULL); 92 (x << 16) | y, (width << 16) | height, NULL, NULL); 94 93 } 95 94 … … 97 96 { 98 97 async_msg(fbphone, FB_CLEAR, 0); 99 100 98 } 101 99 … … 123 121 ic_pixmaps[state]); 124 122 125 if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state !=126 CONS_DISCONNECTED_SEL) {123 if (state != CONS_DISCONNECTED && state != CONS_KERNEL && 124 state != CONS_DISCONNECTED_SEL) { 127 125 snprintf(data, 5, "%d", consnum + 1); 128 for (i =0; data[i]; i++)126 for (i = 0; data[i]; i++) 129 127 tran_putch(data[i], 1, 2 + i); 130 128 } … … 169 167 return; 170 168 171 if (consnum == active_console || console_state[consnum] ==172 CONS_HAS_DATA)169 if (consnum == active_console || 170 console_state[consnum] == CONS_HAS_DATA) 173 171 return; 174 172 … … 358 356 set_style(MAIN_COLOR, MAIN_COLOR); 359 357 clear(); 360 draw_pixmap(_binary_helenos_ppm_start, (size_t)361 &_binary_helenos_ppm_size, xres - 66, 2);362 draw_pixmap(_binary_nameic_ppm_start, (size_t)363 &_binary_nameic_ppm_size, 5, 17);364 365 for (i =0;i < CONSOLE_COUNT; i++)358 draw_pixmap(_binary_helenos_ppm_start, 359 (size_t) &_binary_helenos_ppm_size, xres - 66, 2); 360 draw_pixmap(_binary_nameic_ppm_start, 361 (size_t) &_binary_nameic_ppm_size, 5, 17); 362 363 for (i = 0;i < CONSOLE_COUNT; i++) 366 364 redraw_state(i); 367 365 vp_switch(console_vp); … … 431 429 return; 432 430 433 pm = make_pixmap(_binary_anim_1_ppm_start, (int)434 &_binary_anim_1_ppm_size);431 pm = make_pixmap(_binary_anim_1_ppm_start, 432 (int) &_binary_anim_1_ppm_size); 435 433 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 436 434 437 pm = make_pixmap(_binary_anim_2_ppm_start, (int)438 &_binary_anim_2_ppm_size);435 pm = make_pixmap(_binary_anim_2_ppm_start, 436 (int) &_binary_anim_2_ppm_size); 439 437 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 440 438 441 pm = make_pixmap(_binary_anim_3_ppm_start, (int)442 &_binary_anim_3_ppm_size);439 pm = make_pixmap(_binary_anim_3_ppm_start, 440 (int) &_binary_anim_3_ppm_size); 443 441 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 444 442 445 pm = make_pixmap(_binary_anim_4_ppm_start, (int)446 &_binary_anim_4_ppm_size);443 pm = make_pixmap(_binary_anim_4_ppm_start, 444 (int) &_binary_anim_4_ppm_size); 447 445 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 448 446 … … 479 477 /* create console viewport */ 480 478 /* Align width & height to character size */ 481 console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, ALIGN_DOWN(xres -482 2 * CONSOLE_MARGIN, 8), ALIGN_DOWN(yres - (CONSOLE_TOP +483 CONSOLE_MARGIN), 16));479 console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, 480 ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8), 481 ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16)); 484 482 if (console_vp < 0) 485 483 return; … … 488 486 status_start += (xres - 800) / 2; 489 487 for (i = 0; i < CONSOLE_COUNT; i++) { 490 cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + i *491 (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,488 cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + 489 i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP, 492 490 STATUS_WIDTH, STATUS_HEIGHT); 493 491 if (cstatus_vp[i] < 0) … … 499 497 /* Initialize icons */ 500 498 ic_pixmaps[CONS_SELECTED] = 501 make_pixmap(_binary_cons_selected_ppm_start, (int)502 &_binary_cons_selected_ppm_size);503 ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, (int)504 &_binary_cons_idle_ppm_size);499 make_pixmap(_binary_cons_selected_ppm_start, 500 (int) &_binary_cons_selected_ppm_size); 501 ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, 502 (int) &_binary_cons_idle_ppm_size); 505 503 ic_pixmaps[CONS_HAS_DATA] = 506 make_pixmap(_binary_cons_has_data_ppm_start, (int)507 &_binary_cons_has_data_ppm_size);504 make_pixmap(_binary_cons_has_data_ppm_start, 505 (int) &_binary_cons_has_data_ppm_size); 508 506 ic_pixmaps[CONS_DISCONNECTED] = 509 make_pixmap(_binary_cons_idle_ppm_start, (int)510 &_binary_cons_idle_ppm_size);507 make_pixmap(_binary_cons_idle_ppm_start, 508 (int) &_binary_cons_idle_ppm_size); 511 509 ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, 512 510 (int) &_binary_cons_kernel_ppm_size); -
uspace/fb/fb.c
rc738d65 rd7baee6 150 150 151 151 /* Conversion routines between different color representations */ 152 static void rgb_byte0888(void *dst, int rgb) 152 static void 153 rgb_byte0888(void *dst, int rgb) 153 154 { 154 155 *(int *)dst = rgb; 155 156 } 156 157 157 static int byte0888_rgb(void *src) 158 static int 159 byte0888_rgb(void *src) 158 160 { 159 161 return (*(int *)src) & 0xffffff; 160 162 } 161 163 162 static void bgr_byte0888(void *dst, int rgb) 164 static void 165 bgr_byte0888(void *dst, int rgb) 163 166 { 164 167 *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | … … 166 169 } 167 170 168 static int byte0888_bgr(void *src) 171 static int 172 byte0888_bgr(void *src) 169 173 { 170 174 int color = *(uint32_t *)(src); 171 return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color 172 >> 16) & 0xff); 173 } 174 175 static void rgb_byte888(void *dst, int rgb) 175 return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | 176 ((color >> 16) & 0xff); 177 } 178 179 static void 180 rgb_byte888(void *dst, int rgb) 176 181 { 177 182 uint8_t *scr = dst; … … 187 192 } 188 193 189 static int byte888_rgb(void *src) 194 static int 195 byte888_rgb(void *src) 190 196 { 191 197 uint8_t *scr = src; … … 198 204 199 205 /** 16-bit depth (5:5:5) */ 200 static void rgb_byte555(void *dst, int rgb) 206 static void 207 rgb_byte555(void *dst, int rgb) 201 208 { 202 209 /* 5-bit, 5-bits, 5-bits */ … … 206 213 207 214 /** 16-bit depth (5:5:5) */ 208 static int byte555_rgb(void *src) 215 static int 216 byte555_rgb(void *src) 209 217 { 210 218 int color = *(uint16_t *)(src); 211 return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) <<212 ( 8 + 3)) | ((color & 0x1f) << 3);219 return (((color >> 10) & 0x1f) << (16 + 3)) | 220 (((color >> 5) & 0x1f) << (8 + 3)) | ((color & 0x1f) << 3); 213 221 } 214 222 215 223 /** 16-bit depth (5:6:5) */ 216 static void rgb_byte565(void *dst, int rgb) 224 static void 225 rgb_byte565(void *dst, int rgb) 217 226 { 218 227 /* 5-bit, 6-bits, 5-bits */ … … 222 231 223 232 /** 16-bit depth (5:6:5) */ 224 static int byte565_rgb(void *src) 233 static int 234 byte565_rgb(void *src) 225 235 { 226 236 int color = *(uint16_t *)(src); 227 return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) <<228 ( 8 + 2)) | ((color & 0x1f) << 3);237 return (((color >> 11) & 0x1f) << (16 + 3)) | 238 (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); 229 239 } 230 240 231 241 /** Put pixel - 8-bit depth (3:2:3) */ 232 static void rgb_byte8(void *dst, int rgb) 242 static void 243 rgb_byte8(void *dst, int rgb) 233 244 { 234 245 *(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); … … 236 247 237 248 /** Return pixel color - 8-bit depth (3:2:3) */ 238 static int byte8_rgb(void *src) 249 static int 250 byte8_rgb(void *src) 239 251 { 240 252 int color = *(uint8_t *)src; 241 return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) <<242 ( 8 + 6)) | ((color & 0x7) << 5);253 return (((color >> 5) & 0x7) << (16 + 5)) | 254 (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); 243 255 } 244 256 … … 250 262 * @param color RGB color 251 263 */ 252 static void putpixel(viewport_t *vport, unsigned int x, unsigned int y, int253 264 static void 265 putpixel(viewport_t *vport, unsigned int x, unsigned int y, int color) 254 266 { 255 267 int dx = vport->x + x; … … 257 269 258 270 if (! (vport->paused && vport->dbdata)) 259 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], COLOR(color)); 271 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], 272 COLOR(color)); 260 273 261 274 if (vport->dbdata) { … … 267 280 268 281 /** Get pixel from viewport */ 269 static int getpixel(viewport_t *vport, unsigned int x, unsigned int y) 282 static int 283 getpixel(viewport_t *vport, unsigned int x, unsigned int y) 270 284 { 271 285 int dx = vport->x + x; 272 286 int dy = vport->y + y; 273 287 274 return COLOR((*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx, dy)]));275 } 276 277 static inline void putpixel_mem(char *mem, unsigned int x, unsigned int y, int278 288 return COLOR((*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx, dy)])); 289 } 290 291 static inline void 292 putpixel_mem(char *mem, unsigned int x, unsigned int y, int color) 279 293 { 280 294 (*screen.rgb2scr)(&mem[POINTPOS(x,y)], COLOR(color)); 281 295 } 282 296 283 static void draw_rectangle(viewport_t *vport, unsigned int sx, unsigned int sy, 297 static void 298 draw_rectangle(viewport_t *vport, unsigned int sx, unsigned int sy, 284 299 unsigned int width, unsigned int height, int color) 285 300 { … … 316 331 317 332 /** Fill viewport with background color */ 318 static void clear_port(viewport_t *vport) 333 static void 334 clear_port(viewport_t *vport) 319 335 { 320 336 draw_rectangle(vport, 0, 0, vport->width, vport->height, … … 327 343 * @param lines Positive number - scroll up, negative - scroll down 328 344 */ 329 static void scroll_port_nodb(viewport_t *vport, int lines) 345 static void 346 scroll_port_nodb(viewport_t *vport, int lines) 330 347 { 331 348 int y; … … 351 368 352 369 /** Refresh given viewport from double buffer */ 353 static void refresh_viewport_db(viewport_t *vport) 370 static void 371 refresh_viewport_db(viewport_t *vport) 354 372 { 355 373 unsigned int y, srcy, srcoff, dsty, dstx; … … 369 387 370 388 /** Scroll viewport that has double buffering enabled */ 371 static void scroll_port_db(viewport_t *vport, int lines) 389 static void 390 scroll_port_db(viewport_t *vport, int lines) 372 391 { 373 392 ++vport->paused; … … 394 413 395 414 /** Scrolls viewport given number of lines */ 396 static void scroll_port(viewport_t *vport, int lines) 415 static void 416 scroll_port(viewport_t *vport, int lines) 397 417 { 398 418 if (vport->dbdata) … … 403 423 } 404 424 405 static void invert_pixel(viewport_t *vport, unsigned int x, unsigned int y) 425 static void 426 invert_pixel(viewport_t *vport, unsigned int x, unsigned int y) 406 427 { 407 428 putpixel(vport, x, y, ~getpixel(vport, x, y)); … … 420 441 * @param transparent If false, print background color 421 442 */ 422 static void draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, 443 static void 444 draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, 423 445 unsigned int sy, style_t style, int transparent) 424 446 { … … 441 463 442 464 /** Invert character at given position */ 443 static void invert_char(viewport_t *vport,unsigned int row, unsigned int col) 465 static void 466 invert_char(viewport_t *vport,unsigned int row, unsigned int col) 444 467 { 445 468 unsigned int x; … … 460 483 * @return New viewport number 461 484 */ 462 static int viewport_create(unsigned int x, unsigned int y,unsigned int width, 485 static int 486 viewport_create(unsigned int x, unsigned int y,unsigned int width, 463 487 unsigned int height) 464 488 { 465 489 int i; 466 490 467 for (i =0; i < MAX_VIEWPORTS; i++) {491 for (i = 0; i < MAX_VIEWPORTS; i++) { 468 492 if (!viewports[i].initialized) 469 493 break; … … 491 515 return i; 492 516 } 493 494 517 495 518 /** Initialize framebuffer as a chardev output device … … 503 526 * 504 527 */ 505 static bool screen_init(void *addr, unsigned int xres, unsigned int yres, 528 static bool 529 screen_init(void *addr, unsigned int xres, unsigned int yres, 506 530 unsigned int scan, unsigned int visual, bool invert_colors) 507 531 { … … 559 583 560 584 /** Hide cursor if it is shown */ 561 static void cursor_hide(viewport_t *vport) 585 static void 586 cursor_hide(viewport_t *vport) 562 587 { 563 588 if (vport->cursor_active && vport->cursor_shown) { … … 568 593 569 594 /** Show cursor if cursor showing is enabled */ 570 static void cursor_print(viewport_t *vport) 595 static void 596 cursor_print(viewport_t *vport) 571 597 { 572 598 /* Do not check for cursor_shown */ … … 578 604 579 605 /** Invert cursor, if it is enabled */ 580 static void cursor_blink(viewport_t *vport) 606 static void 607 cursor_blink(viewport_t *vport) 581 608 { 582 609 if (vport->cursor_shown) … … 594 621 * @param transparent If false, print background color with character 595 622 */ 596 static void draw_char(viewport_t *vport, char c, unsigned int row, unsigned int 597 col, style_t style, int transparent) 623 static void 624 draw_char(viewport_t *vport, char c, unsigned int row, unsigned int col, 625 style_t style, int transparent) 598 626 { 599 627 /* Optimize - do not hide cursor if we are going to overwrite it */ … … 623 651 * @param data Text data fitting exactly into viewport 624 652 */ 625 static void draw_text_data(viewport_t *vport, keyfield_t *data) 653 static void 654 draw_text_data(viewport_t *vport, keyfield_t *data) 626 655 { 627 656 int i; … … 642 671 } 643 672 644 645 673 /** Return first free pixmap */ 646 static int find_free_pixmap(void) 674 static int 675 find_free_pixmap(void) 647 676 { 648 677 int i; 649 678 650 for (i =0;i < MAX_PIXMAPS;i++)679 for (i = 0;i < MAX_PIXMAPS;i++) 651 680 if (!pixmaps[i].data) 652 681 return i; … … 654 683 } 655 684 656 static void putpixel_pixmap(int pm, unsigned int x, unsigned int y, int color) 685 static void 686 putpixel_pixmap(int pm, unsigned int x, unsigned int y, int color) 657 687 { 658 688 pixmap_t *pmap = &pixmaps[pm]; … … 663 693 664 694 /** Create a new pixmap and return appropriate ID */ 665 static int shm2pixmap(unsigned char *shm, size_t size) 695 static int 696 shm2pixmap(unsigned char *shm, size_t size) 666 697 { 667 698 int pm; … … 706 737 * to redefine static variables with __thread 707 738 */ 708 static int shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 739 static int 740 shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 709 741 { 710 742 static keyfield_t *interbuffer = NULL; … … 718 750 int retval = 0; 719 751 viewport_t *vport = &viewports[vp]; 720 unsigned int x, y;752 unsigned int x, y; 721 753 722 754 switch (IPC_GET_METHOD(*call)) { … … 775 807 776 808 ppm_draw(shm, shm_size, IPC_GET_ARG1(*call), 777 IPC_GET_ARG2(*call), vport->width - x, vport->height -778 y, (putpixel_cb_t)putpixel, vport);809 IPC_GET_ARG2(*call), vport->width - x, 810 vport->height - y, (putpixel_cb_t)putpixel, vport); 779 811 break; 780 812 case FB_DRAW_TEXT_DATA: … … 799 831 } 800 832 801 static void copy_vp_to_pixmap(viewport_t *vport, pixmap_t *pmap) 833 static void 834 copy_vp_to_pixmap(viewport_t *vport, pixmap_t *pmap) 802 835 { 803 836 int y; … … 815 848 816 849 for (y = 0; y < height; y++) { 817 tmp = (vport->y + y) * screen.scanline + vport->x *818 screen.pixelbytes;850 tmp = (vport->y + y) * screen.scanline + 851 vport->x * screen.pixelbytes; 819 852 memcpy(pmap->data + rowsize * y, screen.fbaddress + tmp, 820 853 rowsize); … … 823 856 824 857 /** Save viewport to pixmap */ 825 static int save_vp_to_pixmap(viewport_t *vport) 858 static int 859 save_vp_to_pixmap(viewport_t *vport) 826 860 { 827 861 int pm; … … 874 908 realrowsize = realwidth * screen.pixelbytes; 875 909 876 for (y =0; y < realheight; y++) {877 tmp = (vport->y + y) * screen.scanline + vport->x *878 screen.pixelbytes;910 for (y = 0; y < realheight; y++) { 911 tmp = (vport->y + y) * screen.scanline + 912 vport->x * screen.pixelbytes; 879 913 memcpy(screen.fbaddress + tmp, pmap->data + y * srcrowsize, 880 914 realrowsize); … … 884 918 885 919 /** Tick animation one step forward */ 886 static void anims_tick(void) 920 static void 921 anims_tick(void) 887 922 { 888 923 int i; … … 894 929 return; 895 930 896 for (i =0; i < MAX_ANIMATIONS; i++) {931 for (i = 0; i < MAX_ANIMATIONS; i++) { 897 932 if (!animations[i].animlen || !animations[i].initialized || 898 933 !animations[i].enabled) … … 911 946 static int pointer_pixmap = -1; 912 947 913 static void mouse_show(void) 914 { 915 int i,j; 948 static void 949 mouse_show(void) 950 { 951 int i, j; 916 952 int visibility; 917 953 int color; … … 942 978 for (j = 0; j < pointer_width; j++) { 943 979 bytepos = i * ((pointer_width - 1) / 8 + 1) + j / 8; 944 visibility = pointer_mask_bits[bytepos] & (1 << (j %945 8));980 visibility = pointer_mask_bits[bytepos] & 981 (1 << (j % 8)); 946 982 if (visibility) { 947 983 color = pointer_bits[bytepos] & (1 << (j % 8)) … … 950 986 i < screen.yres) 951 987 putpixel(&viewports[0], pointer_x + j, 952 pointer_y+i, color);988 pointer_y + i, color); 953 989 } 954 990 } … … 956 992 } 957 993 958 static void mouse_hide(void) 994 static void 995 mouse_hide(void) 959 996 { 960 997 /* Restore image under the cursor */ … … 965 1002 } 966 1003 967 static void mouse_move(unsigned int x, unsigned int y) 1004 static void 1005 mouse_move(unsigned int x, unsigned int y) 968 1006 { 969 1007 mouse_hide(); … … 973 1011 } 974 1012 975 static int anim_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 1013 static int 1014 anim_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 976 1015 { 977 1016 int handled = 1; … … 1070 1109 1071 1110 /** Handler for messages concerning pixmap handling */ 1072 static int pixmap_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 1111 static int 1112 pixmap_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 1073 1113 { 1074 1114 int handled = 1; … … 1123 1163 * 1124 1164 */ 1125 static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) 1165 static void 1166 fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) 1126 1167 { 1127 1168 ipc_callid_t callid; … … 1144 1185 while (1) { 1145 1186 if (vport->cursor_active || anims_enabled) 1146 callid = async_get_call_timeout(&call, 250000);1187 callid = async_get_call_timeout(&call, 250000); 1147 1188 else 1148 1189 callid = async_get_call(&call); … … 1179 1220 break; 1180 1221 } 1181 ipc_answer_fast(callid, 0,0,0);1222 ipc_answer_fast(callid, 0, 0, 0); 1182 1223 1183 1224 draw_char(vport, c, row, col, vport->style, … … 1265 1306 case FB_VIEWPORT_CREATE: 1266 1307 retval = viewport_create(IPC_GET_ARG1(call) >> 16, 1267 IPC_GET_ARG1(call) & 0xffff, IPC_GET_ARG2(call) 1268 >> 16, IPC_GET_ARG2(call) & 0xffff); 1308 IPC_GET_ARG1(call) & 0xffff, 1309 IPC_GET_ARG2(call) >> 16, 1310 IPC_GET_ARG2(call) & 0xffff); 1269 1311 break; 1270 1312 case FB_VIEWPORT_DELETE: … … 1301 1343 retval = ENOENT; 1302 1344 } 1303 ipc_answer_fast(callid,retval, 0,0);1345 ipc_answer_fast(callid,retval, 0, 0); 1304 1346 } 1305 1347 } 1306 1348 1307 1349 /** Initialization of framebuffer */ 1308 int fb_init(void) 1350 int 1351 fb_init(void) 1309 1352 { 1310 1353 void *fb_ph_addr; -
uspace/libc/generic/io/printf_core.c
rc738d65 rd7baee6 246 246 if (flags & __PRINTF_FLAG_PREFIX) { 247 247 switch(base) { 248 249 250 251 252 253 254 255 256 248 case 2: /* Binary formating is not standard, but usefull */ 249 size += 2; 250 break; 251 case 8: 252 size++; 253 break; 254 case 16: 255 size += 2; 256 break; 257 257 } 258 258 } … … 306 306 if (flags & __PRINTF_FLAG_PREFIX) { 307 307 switch(base) { 308 case 2: /* Binary formating is not standard, but usefull */ 309 if (printf_putchar('0', ps) == 1) 308 case 2: /* Binary formating is not standard, but usefull */ 309 if (printf_putchar('0', ps) == 1) 310 counter++; 311 if (flags & __PRINTF_FLAG_BIGCHARS) { 312 if (printf_putchar('B', ps) == 1) 310 313 counter++; 311 if (flags & __PRINTF_FLAG_BIGCHARS) { 312 if (printf_putchar('B', ps) == 1) 313 counter++; 314 } else { 315 if (printf_putchar('b', ps) == 1) 316 counter++; 317 } 318 break; 319 case 8: 320 if (printf_putchar('o', ps) == 1) 314 } else { 315 if (printf_putchar('b', ps) == 1) 321 316 counter++; 322 break; 323 case 16: 324 if (printf_putchar('0', ps) == 1) 317 } 318 break; 319 case 8: 320 if (printf_putchar('o', ps) == 1) 321 counter++; 322 break; 323 case 16: 324 if (printf_putchar('0', ps) == 1) 325 counter++; 326 if (flags & __PRINTF_FLAG_BIGCHARS) { 327 if (printf_putchar('X', ps) == 1) 325 328 counter++; 326 if (flags & __PRINTF_FLAG_BIGCHARS) { 327 if (printf_putchar('X', ps) == 1) 328 counter++; 329 } else { 330 if (printf_putchar('x', ps) == 1) 331 counter++; 332 } 333 break; 329 } else { 330 if (printf_putchar('x', ps) == 1) 331 counter++; 332 } 333 break; 334 334 } 335 335 } … … 472 472 ++i; 473 473 switch (c = fmt[i]) { 474 475 476 477 478 479 474 case '#': flags |= __PRINTF_FLAG_PREFIX; break; 475 case '-': flags |= __PRINTF_FLAG_LEFTALIGNED; break; 476 case '+': flags |= __PRINTF_FLAG_SHOWPLUS; break; 477 case ' ': flags |= __PRINTF_FLAG_SPACESIGN; break; 478 case '0': flags |= __PRINTF_FLAG_ZEROPADDED; break; 479 default: end = 1; 480 480 }; 481 481 … … 521 521 522 522 switch (fmt[i++]) { 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 523 /** TODO: unimplemented qualifiers: 524 * t ptrdiff_t - ISO C 99 525 */ 526 case 'h': /* char or short */ 527 qualifier = PrintfQualifierShort; 528 if (fmt[i] == 'h') { 529 i++; 530 qualifier = PrintfQualifierByte; 531 } 532 break; 533 case 'l': /* long or long long*/ 534 qualifier = PrintfQualifierLong; 535 if (fmt[i] == 'l') { 536 i++; 537 qualifier = PrintfQualifierLongLong; 538 } 539 break; 540 case 'z': /* size_t */ 541 qualifier = PrintfQualifierSizeT; 542 break; 543 default: 544 qualifier = PrintfQualifierInt; /* default type */ 545 --i; 546 546 } 547 547 … … 553 553 * String and character conversions. 554 554 */ 555 556 557 558 };555 case 's': 556 if ((retval = print_string(va_arg(ap, char*), width, precision, flags, ps)) < 0) { 557 goto minus_out; 558 } 559 559 560 561 562 563 564 565 566 567 };568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 560 counter += retval; 561 j = i + 1; 562 goto next_char; 563 case 'c': 564 c = va_arg(ap, unsigned int); 565 if ((retval = print_char(c, width, flags, ps)) < 0) { 566 goto minus_out; 567 } 568 569 counter += retval; 570 j = i + 1; 571 goto next_char; 572 573 /* 574 * Integer values 575 */ 576 case 'P': /* pointer */ 577 flags |= __PRINTF_FLAG_BIGCHARS; 578 case 'p': 579 flags |= __PRINTF_FLAG_PREFIX; 580 base = 16; 581 qualifier = PrintfQualifierPointer; 582 break; 583 case 'b': 584 base = 2; 585 break; 586 case 'o': 587 base = 8; 588 break; 589 case 'd': 590 case 'i': 591 flags |= __PRINTF_FLAG_SIGNED; 592 case 'u': 593 break; 594 case 'X': 595 flags |= __PRINTF_FLAG_BIGCHARS; 596 case 'x': 597 base = 16; 598 break; 599 /* percentile itself */ 600 case '%': 601 j = i; 602 goto next_char; 603 /* 604 * Bad formatting. 605 */ 606 default: 607 /* Unknown format 608 * now, the j is index of '%' so we will 609 * print whole bad format sequence 610 */ 611 goto next_char; 612 612 } 613 613 … … 616 616 /* print number */ 617 617 switch (qualifier) { 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 618 case PrintfQualifierByte: 619 size = sizeof(unsigned char); 620 number = (uint64_t)va_arg(ap, unsigned int); 621 break; 622 case PrintfQualifierShort: 623 size = sizeof(unsigned short); 624 number = (uint64_t)va_arg(ap, unsigned int); 625 break; 626 case PrintfQualifierInt: 627 size = sizeof(unsigned int); 628 number = (uint64_t)va_arg(ap, unsigned int); 629 break; 630 case PrintfQualifierLong: 631 size = sizeof(unsigned long); 632 number = (uint64_t)va_arg(ap, unsigned long); 633 break; 634 case PrintfQualifierLongLong: 635 size = sizeof(unsigned long long); 636 number = (uint64_t)va_arg(ap, unsigned long long); 637 break; 638 case PrintfQualifierPointer: 639 size = sizeof(void *); 640 number = (uint64_t)(unsigned long)va_arg(ap, void *); 641 break; 642 case PrintfQualifierSizeT: 643 size = sizeof(size_t); 644 number = (uint64_t)va_arg(ap, size_t); 645 break; 646 default: /* Unknown qualifier */ 647 goto minus_out; 648 648 649 649 }
Note:
See TracChangeset
for help on using the changeset viewer.