Introduce names (en enum) for 0, 1, and 2 constants. We now have VCI_HALF_BRIGHT, VCI_NORMAL, and VCI_BOLD instead. Apart from the cleanup, 1) the enum allows for better type checking, and 2) this saves some code. No more fiddling with bits is needed in assembly now. (OTOH, the structure is larger.)
Showing the changes to include/linux (2 of 7 files). Show all
Unified · Split
| @@ -35,6 +35,8 @@ enum con_scroll { · 34 unmodified lines | |||
| 35 | SM_DOWN, | 35 | SM_DOWN, |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | enum vc_intensity; | ||
| 39 | |||
| 38 | /** | 40 | /** |
| 39 | * struct consw - callbacks for consoles | 41 | * struct consw - callbacks for consoles |
| 40 | * | 42 | * |
| @@ -74,7 +76,8 @@ struct consw { · 33 unmodified lines | |||
| 74 | void (*con_scrolldelta)(struct vc_data *vc, int lines); | 76 | void (*con_scrolldelta)(struct vc_data *vc, int lines); |
| 75 | int (*con_set_origin)(struct vc_data *vc); | 77 | int (*con_set_origin)(struct vc_data *vc); |
| 76 | void (*con_save_screen)(struct vc_data *vc); | 78 | void (*con_save_screen)(struct vc_data *vc); |
| 77 | u8 (*con_build_attr)(struct vc_data *vc, u8 color, u8 intensity, | 79 | u8 (*con_build_attr)(struct vc_data *vc, u8 color, |
| 80 | enum vc_intensity intensity, | ||
| 78 | u8 blink, u8 underline, u8 reverse, u8 italic); | 81 | u8 blink, u8 underline, u8 reverse, u8 italic); |
| 79 | void (*con_invert_region)(struct vc_data *vc, u16 *p, int count); | 82 | void (*con_invert_region)(struct vc_data *vc, u16 *p, int count); |
| 80 | u16 *(*con_screen_pos)(struct vc_data *vc, int offset); | 83 | u16 *(*con_screen_pos)(struct vc_data *vc, int offset); |
| @@ -22,6 +22,13 @@ struct uni_screen; · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #define NPAR 16 | 23 | #define NPAR 16 |
| 24 | 24 | ||
| 25 | enum vc_intensity { | ||
| 26 | VCI_HALF_BRIGHT, | ||
| 27 | VCI_NORMAL, | ||
| 28 | VCI_BOLD, | ||
| 29 | VCI_MASK = 0x3, | ||
| 30 | }; | ||
| 31 | |||
| 25 | /** | 32 | /** |
| 26 | * struct vc_state -- state of a VC | 33 | * struct vc_state -- state of a VC |
| 27 | * @x: cursor's x-position | 34 | * @x: cursor's x-position |
| @@ -30,7 +37,7 @@ struct uni_screen; · 2 unmodified lines | |||
| 30 | * @G0_charset: what's G0 slot set to (like GRAF_MAP, LAT1_MAP) | 37 | * @G0_charset: what's G0 slot set to (like GRAF_MAP, LAT1_MAP) |
| 31 | * @G1_charset: what's G1 slot set to (like GRAF_MAP, LAT1_MAP) | 38 | * @G1_charset: what's G1 slot set to (like GRAF_MAP, LAT1_MAP) |
| 32 | * @charset: what character set to use (0=G0 or 1=G1) | 39 | * @charset: what character set to use (0=G0 or 1=G1) |
| 33 | * @intensity: 0=half-bright, 1=normal, 2=bold | 40 | * @intensity: see enum vc_intensity for values |
| 34 | * @reverse: reversed foreground/background colors | 41 | * @reverse: reversed foreground/background colors |
| 35 | * | 42 | * |
| 36 | * These members are defined separately from struct vc_data as we save & | 43 | * These members are defined separately from struct vc_data as we save & |
| @@ -46,7 +53,7 @@ struct vc_state { · 9 unmodified lines | |||
| 46 | unsigned int charset : 1; | 53 | unsigned int charset : 1; |
| 47 | 54 | ||
| 48 | /* attribute flags */ | 55 | /* attribute flags */ |
| 49 | unsigned int intensity : 2; | 56 | enum vc_intensity intensity; |
| 50 | unsigned int italic : 1; | 57 | unsigned int italic : 1; |
| 51 | unsigned int underline : 1; | 58 | unsigned int underline : 1; |
| 52 | unsigned int blink : 1; | 59 | unsigned int blink : 1; |