Changeset a35b458 in mainline for uspace/app/top/screen.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/top/screen.c

    r3061bc1 ra35b458  
    9999{
    100100        screen_style_normal();
    101        
     101
    102102        if (clear) {
    103103                console_flush(console);
    104104                console_clear(console);
    105105        }
    106        
     106
    107107        screen_moveto(0, 0);
    108108}
     
    113113        sysarg_t rows;
    114114        screen_get_size(&cols, &rows);
    115        
     115
    116116        sysarg_t c;
    117117        sysarg_t r;
    118118        screen_get_pos(&c, &r);
    119        
     119
    120120        sysarg_t i;
    121121        for (i = c + 1; i < cols; i++)
    122122                puts(" ");
    123        
     123
    124124        if (r + 1 < rows)
    125125                puts("\n");
     
    129129{
    130130        console = console_init(stdin, stdout);
    131        
     131
    132132        console_flush(console);
    133133        console_cursor_visibility(console, false);
    134        
     134
    135135        screen_restart(true);
    136136}
     
    142142
    143143        screen_restart(true);
    144        
     144
    145145        console_flush(console);
    146146        console_cursor_visibility(console, true);
     
    150150{
    151151        printf("%3" PRIu64 ".", ffloat.upper / ffloat.lower);
    152        
     152
    153153        unsigned int i;
    154154        uint64_t rest = (ffloat.upper % ffloat.lower) * 10;
     
    157157                rest = (rest % ffloat.lower) * 10;
    158158        }
    159        
     159
    160160        printf("%%");
    161161}
     
    166166        sysarg_t rows;
    167167        screen_get_size(&cols, &rows);
    168        
     168
    169169        sysarg_t c;
    170170        sysarg_t r;
    171171        screen_get_pos(&c, &r);
    172        
     172
    173173        if (c < cols) {
    174174                int pos = cols - c - 1;
     
    184184            data->hours, data->minutes, data->seconds,
    185185            data->udays, data->uhours, data->uminutes, data->useconds);
    186        
     186
    187187        size_t i;
    188188        for (i = 0; i < data->load_count; i++) {
     
    190190                stats_print_load_fragment(data->load[i], 2);
    191191        }
    192        
     192
    193193        screen_newline();
    194194}
     
    209209        size_t other = 0;
    210210        size_t invalid = 0;
    211        
     211
    212212        size_t i;
    213213        for (i = 0; i < data->threads_count; i++) {
    214214                total++;
    215                
     215
    216216                switch (data->threads[i].state) {
    217217                case Running:
     
    235235                }
    236236        }
    237        
     237
    238238        printf("threads: %zu total, %zu running, %zu ready, "
    239239            "%zu sleeping, %zu lingering, %zu other, %zu invalid",
     
    251251                        char busy_suffix;
    252252                        char idle_suffix;
    253                        
     253
    254254                        order_suffix(data->cpus[i].busy_cycles, &busy, &busy_suffix);
    255255                        order_suffix(data->cpus[i].idle_cycles, &idle, &idle_suffix);
    256                        
     256
    257257                        printf("cpu%u (%4" PRIu16 " MHz): busy cycles: "
    258258                            "%" PRIu64 "%c, idle cycles: %" PRIu64 "%c",
     
    265265                } else
    266266                        printf("cpu%u inactive", data->cpus[i].id);
    267                
     267
    268268                screen_newline();
    269269        }
     
    280280        const char *used_suffix;
    281281        const char *free_suffix;
    282        
     282
    283283        bin_order_suffix(data->physmem->total, &total, &total_suffix, false);
    284284        bin_order_suffix(data->physmem->unavail, &unavail, &unavail_suffix, false);
    285285        bin_order_suffix(data->physmem->used, &used, &used_suffix, false);
    286286        bin_order_suffix(data->physmem->free, &free, &free_suffix, false);
    287        
     287
    288288        printf("memory: %" PRIu64 "%s total, %" PRIu64 "%s unavail, %"
    289289            PRIu64 "%s used, %" PRIu64 "%s free", total, total_suffix,
     
    305305        sysarg_t rows;
    306306        screen_get_size(&cols, &rows);
    307        
    308         screen_newline();
    309        
     307
     308        screen_newline();
     309
    310310        printf("Operation modes:");
    311311        screen_newline();
    312        
     312
    313313        printf(" t .. tasks statistics");
    314314        screen_newline();
    315        
     315
    316316        printf(" i .. IPC statistics");
    317317        screen_newline();
    318        
     318
    319319        printf(" e .. exceptions statistics");
    320320        screen_newline();
    321        
     321
    322322        printf("      a .. toggle display of all/hot exceptions");
    323323        screen_newline();
     
    330330        printf("Other keys:");
    331331        screen_newline();
    332        
     332
    333333        printf(" s .. choose column to sort by");
    334334        screen_newline();
    335        
     335
    336336        printf(" r .. toggle reversed sorting");
    337337        screen_newline();
    338        
     338
    339339        printf(" q .. quit");
    340340        screen_newline();
    341        
     341
    342342        sysarg_t col;
    343343        sysarg_t row;
    344344        screen_get_pos(&col, &row);
    345        
     345
    346346        while (row < rows) {
    347347                screen_newline();
     
    380380        sysarg_t rows;
    381381        screen_get_size(&cols, &rows);
    382        
     382
    383383        sysarg_t col;
    384384        sysarg_t row;
    385385        screen_get_pos(&col, &row);
    386        
     386
    387387        size_t i;
    388388        for (i = 0; (i < table->num_fields) && (row < rows); i++) {
     
    441441                }
    442442        }
    443        
     443
    444444        while (row < rows) {
    445445                screen_newline();
     
    453453        sysarg_t rows;
    454454        screen_get_size(&cols, &rows);
    455        
     455
    456456        sysarg_t col;
    457457        sysarg_t row;
     
    464464                row++;
    465465        }
    466        
     466
    467467        while (row < rows) {
    468468                screen_newline();
     
    494494        print_physmem_info(data);
    495495        print_warning();
    496        
     496
    497497        switch (screen_mode) {
    498498        case SCREEN_TABLE:
     
    507507                print_help();
    508508        }
    509        
     509
    510510        console_flush(console);
    511511}
     
    527527        vsnprintf(warning_text, warning_text_size, fmt, args);
    528528        va_end(args);
    529        
     529
    530530        warning_timeleft = 2 * USEC_COUNT;
    531531
     
    543543         * Reset timeleft whenever it is not positive.
    544544         */
    545        
     545
    546546        if (timeleft <= 0)
    547547                timeleft = sec * USEC_COUNT;
    548        
     548
    549549        /*
    550550         * Wait to see if there is any input. If so, take it and
     
    553553         * make timeleft zero and return -1.
    554554         */
    555        
     555
    556556        wchar_t c = 0;
    557        
     557
    558558        while (c == 0) {
    559559                cons_event_t event;
    560                
     560
    561561                warning_timeleft -= timeleft;
    562562                if (!console_get_event_timeout(console, &event, &timeleft)) {
     
    565565                }
    566566                warning_timeleft += timeleft;
    567                
     567
    568568                if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
    569569                        c = event.ev.key.c;
    570570        }
    571        
     571
    572572        return (int) c;
    573573}
Note: See TracChangeset for help on using the changeset viewer.