Changeset d7baee6 in mainline


Ignore:
Timestamp:
2007-01-17T13:03:08Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
df4ed85
Parents:
c738d65
Message:

Rather big indentation and formatting changes.
More inteligent long line wrapping.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/version.c

    rc738d65 rd7baee6  
    5757void version_print(void)
    5858{
    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);
    6061}
    6162
  • kernel/generic/src/printf/printf_core.c

    rc738d65 rd7baee6  
    268268        if (flags & __PRINTF_FLAG_PREFIX) {
    269269                switch(base) {
    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;
     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;
    279279                }
    280280        }
     
    329329        if (flags & __PRINTF_FLAG_PREFIX) {
    330330                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)
    333336                                        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)
    344339                                        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)
    348351                                        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;
    357357                }
    358358        }
  • uspace/console/console.c

    rc738d65 rd7baee6  
    120120{
    121121        async_msg_2(fb_info.phone, FB_CURSOR_GOTO, row, col);
    122        
    123122}
    124123
     
    137136{
    138137        async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col);
    139        
    140138}
    141139
  • uspace/console/gcons.c

    rc738d65 rd7baee6  
    9090{
    9191        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);
    9493}
    9594
     
    9796{
    9897        async_msg(fbphone, FB_CLEAR, 0);
    99        
    10098}
    10199
     
    123121                        ic_pixmaps[state]);
    124122
    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) {
    127125                snprintf(data, 5, "%d", consnum + 1);
    128                 for (i=0; data[i]; i++)
     126                for (i = 0; data[i]; i++)
    129127                        tran_putch(data[i], 1, 2 + i);
    130128        }
     
    169167                return;
    170168
    171         if (consnum == active_console || console_state[consnum] ==
    172                 CONS_HAS_DATA)
     169        if (consnum == active_console ||
     170                console_state[consnum] == CONS_HAS_DATA)
    173171                return;
    174172
     
    358356        set_style(MAIN_COLOR, MAIN_COLOR);
    359357        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++)
    366364                redraw_state(i);
    367365        vp_switch(console_vp);
     
    431429                return;
    432430
    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);
    435433        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    436434
    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);
    439437        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    440438
    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);
    443441        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    444442
    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);
    447445        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    448446
     
    479477        /* create console viewport */
    480478        /* 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));
    484482        if (console_vp < 0)
    485483                return;
     
    488486        status_start += (xres - 800) / 2;
    489487        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,
    492490                        STATUS_WIDTH, STATUS_HEIGHT);
    493491                if (cstatus_vp[i] < 0)
     
    499497        /* Initialize icons */
    500498        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);
    505503        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);
    508506        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);
    511509        ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
    512510                (int) &_binary_cons_kernel_ppm_size);
  • uspace/fb/fb.c

    rc738d65 rd7baee6  
    150150
    151151/* Conversion routines between different color representations */
    152 static void rgb_byte0888(void *dst, int rgb)
     152static void
     153rgb_byte0888(void *dst, int rgb)
    153154{
    154155        *(int *)dst = rgb;
    155156}
    156157
    157 static int byte0888_rgb(void *src)
     158static int
     159byte0888_rgb(void *src)
    158160{
    159161        return (*(int *)src) & 0xffffff;
    160162}
    161163
    162 static void bgr_byte0888(void *dst, int rgb)
     164static void
     165bgr_byte0888(void *dst, int rgb)
    163166{
    164167        *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 |
     
    166169}
    167170
    168 static int byte0888_bgr(void *src)
     171static int
     172byte0888_bgr(void *src)
    169173{
    170174        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
     179static void
     180rgb_byte888(void *dst, int rgb)
    176181{
    177182        uint8_t *scr = dst;
     
    187192}
    188193
    189 static int byte888_rgb(void *src)
     194static int
     195byte888_rgb(void *src)
    190196{
    191197        uint8_t *scr = src;
     
    198204
    199205/**  16-bit depth (5:5:5) */
    200 static void rgb_byte555(void *dst, int rgb)
     206static void
     207rgb_byte555(void *dst, int rgb)
    201208{
    202209        /* 5-bit, 5-bits, 5-bits */
     
    206213
    207214/** 16-bit depth (5:5:5) */
    208 static int byte555_rgb(void *src)
     215static int
     216byte555_rgb(void *src)
    209217{
    210218        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);
    213221}
    214222
    215223/**  16-bit depth (5:6:5) */
    216 static void rgb_byte565(void *dst, int rgb)
     224static void
     225rgb_byte565(void *dst, int rgb)
    217226{
    218227        /* 5-bit, 6-bits, 5-bits */
     
    222231
    223232/** 16-bit depth (5:6:5) */
    224 static int byte565_rgb(void *src)
     233static int
     234byte565_rgb(void *src)
    225235{
    226236        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);
    229239}
    230240
    231241/** Put pixel - 8-bit depth (3:2:3) */
    232 static void rgb_byte8(void *dst, int rgb)
     242static void
     243rgb_byte8(void *dst, int rgb)
    233244{
    234245        *(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3);
     
    236247
    237248/** Return pixel color - 8-bit depth (3:2:3) */
    238 static int byte8_rgb(void *src)
     249static int
     250byte8_rgb(void *src)
    239251{
    240252        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);
    243255}
    244256
     
    250262 * @param color RGB color
    251263 */
    252 static void putpixel(viewport_t *vport, unsigned int x, unsigned int y, int
    253         color)
     264static void
     265putpixel(viewport_t *vport, unsigned int x, unsigned int y, int color)
    254266{
    255267        int dx = vport->x + x;
     
    257269
    258270        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));
    260273
    261274        if (vport->dbdata) {
     
    267280
    268281/** Get pixel from viewport */
    269 static int getpixel(viewport_t *vport, unsigned int x, unsigned int y)
     282static int
     283getpixel(viewport_t *vport, unsigned int x, unsigned int y)
    270284{
    271285        int dx = vport->x + x;
    272286        int dy = vport->y + y;
    273287
    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, int
    278         color)
     288        return COLOR((*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx, dy)]));
     289}
     290
     291static inline void
     292putpixel_mem(char *mem, unsigned int x, unsigned int y, int color)
    279293{
    280294        (*screen.rgb2scr)(&mem[POINTPOS(x,y)], COLOR(color));
    281295}
    282296
    283 static void draw_rectangle(viewport_t *vport, unsigned int sx, unsigned int sy,
     297static void
     298draw_rectangle(viewport_t *vport, unsigned int sx, unsigned int sy,
    284299        unsigned int width, unsigned int height, int color)
    285300{
     
    316331
    317332/** Fill viewport with background color */
    318 static void clear_port(viewport_t *vport)
     333static void
     334clear_port(viewport_t *vport)
    319335{
    320336        draw_rectangle(vport, 0, 0, vport->width, vport->height,
     
    327343 * @param lines Positive number - scroll up, negative - scroll down
    328344 */
    329 static void scroll_port_nodb(viewport_t *vport, int lines)
     345static void
     346scroll_port_nodb(viewport_t *vport, int lines)
    330347{
    331348        int y;
     
    351368
    352369/** Refresh given viewport from double buffer */
    353 static void refresh_viewport_db(viewport_t *vport)
     370static void
     371refresh_viewport_db(viewport_t *vport)
    354372{
    355373        unsigned int y, srcy, srcoff, dsty, dstx;
     
    369387
    370388/** Scroll viewport that has double buffering enabled */
    371 static void scroll_port_db(viewport_t *vport, int lines)
     389static void
     390scroll_port_db(viewport_t *vport, int lines)
    372391{
    373392        ++vport->paused;
     
    394413
    395414/** Scrolls viewport given number of lines */
    396 static void scroll_port(viewport_t *vport, int lines)
     415static void
     416scroll_port(viewport_t *vport, int lines)
    397417{
    398418        if (vport->dbdata)
     
    403423}
    404424
    405 static void invert_pixel(viewport_t *vport, unsigned int x, unsigned int y)
     425static void
     426invert_pixel(viewport_t *vport, unsigned int x, unsigned int y)
    406427{
    407428        putpixel(vport, x, y, ~getpixel(vport, x, y));
     
    420441 * @param transparent If false, print background color
    421442 */
    422 static void draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx,
     443static void
     444draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx,
    423445         unsigned int sy, style_t style, int transparent)
    424446{
     
    441463
    442464/** Invert character at given position */
    443 static void invert_char(viewport_t *vport,unsigned int row, unsigned int col)
     465static void
     466invert_char(viewport_t *vport,unsigned int row, unsigned int col)
    444467{
    445468        unsigned int x;
     
    460483 * @return New viewport number
    461484 */
    462 static int viewport_create(unsigned int x, unsigned int y,unsigned int width,
     485static int
     486viewport_create(unsigned int x, unsigned int y,unsigned int width,
    463487        unsigned int height)
    464488{
    465489        int i;
    466490
    467         for (i=0; i < MAX_VIEWPORTS; i++) {
     491        for (i = 0; i < MAX_VIEWPORTS; i++) {
    468492                if (!viewports[i].initialized)
    469493                        break;
     
    491515        return i;
    492516}
    493 
    494517
    495518/** Initialize framebuffer as a chardev output device
     
    503526 *
    504527 */
    505 static bool screen_init(void *addr, unsigned int xres, unsigned int yres,
     528static bool
     529screen_init(void *addr, unsigned int xres, unsigned int yres,
    506530        unsigned int scan, unsigned int visual, bool invert_colors)
    507531{
     
    559583
    560584/** Hide cursor if it is shown */
    561 static void cursor_hide(viewport_t *vport)
     585static void
     586cursor_hide(viewport_t *vport)
    562587{
    563588        if (vport->cursor_active && vport->cursor_shown) {
     
    568593
    569594/** Show cursor if cursor showing is enabled */
    570 static void cursor_print(viewport_t *vport)
     595static void
     596cursor_print(viewport_t *vport)
    571597{
    572598        /* Do not check for cursor_shown */
     
    578604
    579605/** Invert cursor, if it is enabled */
    580 static void cursor_blink(viewport_t *vport)
     606static void
     607cursor_blink(viewport_t *vport)
    581608{
    582609        if (vport->cursor_shown)
     
    594621 * @param transparent If false, print background color with character
    595622 */
    596 static void draw_char(viewport_t *vport, char c, unsigned int row, unsigned int
    597         col, style_t style, int transparent)
     623static void
     624draw_char(viewport_t *vport, char c, unsigned int row, unsigned int col,
     625        style_t style, int transparent)
    598626{
    599627        /* Optimize - do not hide cursor if we are going to overwrite it */
     
    623651 * @param data Text data fitting exactly into viewport
    624652 */
    625 static void draw_text_data(viewport_t *vport, keyfield_t *data)
     653static void
     654draw_text_data(viewport_t *vport, keyfield_t *data)
    626655{
    627656        int i;
     
    642671}
    643672
    644 
    645673/** Return first free pixmap */
    646 static int find_free_pixmap(void)
     674static int
     675find_free_pixmap(void)
    647676{
    648677        int i;
    649678       
    650         for (i=0;i < MAX_PIXMAPS;i++)
     679        for (i = 0;i < MAX_PIXMAPS;i++)
    651680                if (!pixmaps[i].data)
    652681                        return i;
     
    654683}
    655684
    656 static void putpixel_pixmap(int pm, unsigned int x, unsigned int y, int color)
     685static void
     686putpixel_pixmap(int pm, unsigned int x, unsigned int y, int color)
    657687{
    658688        pixmap_t *pmap = &pixmaps[pm];
     
    663693
    664694/** Create a new pixmap and return appropriate ID */
    665 static int shm2pixmap(unsigned char *shm, size_t size)
     695static int
     696shm2pixmap(unsigned char *shm, size_t size)
    666697{
    667698        int pm;
     
    706737 * to redefine static variables with __thread
    707738 */
    708 static int shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
     739static int
     740shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
    709741{
    710742        static keyfield_t *interbuffer = NULL;
     
    718750        int retval = 0;
    719751        viewport_t *vport = &viewports[vp];
    720         unsigned int x,y;
     752        unsigned int x, y;
    721753
    722754        switch (IPC_GET_METHOD(*call)) {
     
    775807               
    776808                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);
    779811                break;
    780812        case FB_DRAW_TEXT_DATA:
     
    799831}
    800832
    801 static void copy_vp_to_pixmap(viewport_t *vport, pixmap_t *pmap)
     833static void
     834copy_vp_to_pixmap(viewport_t *vport, pixmap_t *pmap)
    802835{
    803836        int y;
     
    815848
    816849        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;
    819852                memcpy(pmap->data + rowsize * y, screen.fbaddress + tmp,
    820853                        rowsize);
     
    823856
    824857/** Save viewport to pixmap */
    825 static int save_vp_to_pixmap(viewport_t *vport)
     858static int
     859save_vp_to_pixmap(viewport_t *vport)
    826860{
    827861        int pm;
     
    874908        realrowsize = realwidth * screen.pixelbytes;
    875909
    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;
    879913                memcpy(screen.fbaddress + tmp, pmap->data + y * srcrowsize,
    880914                        realrowsize);
     
    884918
    885919/** Tick animation one step forward */
    886 static void anims_tick(void)
     920static void
     921anims_tick(void)
    887922{
    888923        int i;
     
    894929                return;
    895930
    896         for (i=0; i < MAX_ANIMATIONS; i++) {
     931        for (i = 0; i < MAX_ANIMATIONS; i++) {
    897932                if (!animations[i].animlen || !animations[i].initialized ||
    898933                        !animations[i].enabled)
     
    911946static int pointer_pixmap = -1;
    912947
    913 static void mouse_show(void)
    914 {
    915         int i,j;
     948static void
     949mouse_show(void)
     950{
     951        int i, j;
    916952        int visibility;
    917953        int color;
     
    942978                for (j = 0; j < pointer_width; j++) {
    943979                        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));
    946982                        if (visibility) {
    947983                                color = pointer_bits[bytepos] & (1 << (j % 8))
     
    950986                                        i < screen.yres)
    951987                                        putpixel(&viewports[0], pointer_x + j,
    952                                                  pointer_y+i, color);
     988                                                pointer_y + i, color);
    953989                        }
    954990                }
     
    956992}
    957993
    958 static void mouse_hide(void)
     994static void
     995mouse_hide(void)
    959996{
    960997        /* Restore image under the cursor */
     
    9651002}
    9661003
    967 static void mouse_move(unsigned int x, unsigned int y)
     1004static void
     1005mouse_move(unsigned int x, unsigned int y)
    9681006{
    9691007        mouse_hide();
     
    9731011}
    9741012
    975 static int anim_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
     1013static int
     1014anim_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
    9761015{
    9771016        int handled = 1;
     
    10701109
    10711110/** Handler for messages concerning pixmap handling */
    1072 static int pixmap_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
     1111static int
     1112pixmap_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
    10731113{
    10741114        int handled = 1;
     
    11231163 *
    11241164 */
    1125 static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall)
     1165static void
     1166fb_client_connection(ipc_callid_t iid, ipc_call_t *icall)
    11261167{
    11271168        ipc_callid_t callid;
     
    11441185        while (1) {
    11451186                if (vport->cursor_active || anims_enabled)
    1146                         callid = async_get_call_timeout(&call,250000);
     1187                        callid = async_get_call_timeout(&call, 250000);
    11471188                else
    11481189                        callid = async_get_call(&call);
     
    11791220                                break;
    11801221                        }
    1181                         ipc_answer_fast(callid,0,0,0);
     1222                        ipc_answer_fast(callid, 0, 0, 0);
    11821223
    11831224                        draw_char(vport, c, row, col, vport->style,
     
    12651306                case FB_VIEWPORT_CREATE:
    12661307                        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);
    12691311                        break;
    12701312                case FB_VIEWPORT_DELETE:
     
    13011343                        retval = ENOENT;
    13021344                }
    1303                 ipc_answer_fast(callid,retval,0,0);
     1345                ipc_answer_fast(callid,retval, 0, 0);
    13041346        }
    13051347}
    13061348
    13071349/** Initialization of framebuffer */
    1308 int fb_init(void)
     1350int
     1351fb_init(void)
    13091352{
    13101353        void *fb_ph_addr;
  • uspace/libc/generic/io/printf_core.c

    rc738d65 rd7baee6  
    246246        if (flags & __PRINTF_FLAG_PREFIX) {
    247247                switch(base) {
    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;
     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;
    257257                }
    258258        }
     
    306306        if (flags & __PRINTF_FLAG_PREFIX) {
    307307                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)
    310313                                        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)
    321316                                        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)
    325328                                        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;
    334334                }
    335335        }
     
    472472                                ++i;
    473473                                switch (c = fmt[i]) {
    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;
     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;
    480480                                };     
    481481                               
     
    521521
    522522                        switch (fmt[i++]) {
    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;
     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;
    546546                        }       
    547547                       
     
    553553                                * String and character conversions.
    554554                                */
    555                                 case 's':
    556                                         if ((retval = print_string(va_arg(ap, char*), width, precision, flags, ps)) < 0) {
    557                                                 goto minus_out;
    558                                         };
     555                        case 's':
     556                                if ((retval = print_string(va_arg(ap, char*), width, precision, flags, ps)) < 0) {
     557                                        goto minus_out;
     558                                }
    559559                                       
    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;         
     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;         
    612612                        }
    613613               
     
    616616                        /* print number */
    617617                        switch (qualifier) {
    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;
     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;
    648648                                       
    649649                        }
Note: See TracChangeset for help on using the changeset viewer.