#define FALSE 0 #define TRUE 1 /* possible values for color */ #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define WHITE 7 struct attributes { unsigned bordash : 1; /* solid or dashed */ unsigned bcolor : 3;/* border foreground color */ unsigned fill : 1;/* fill/nofill with fcolor */ unsigned fcolor : 3;/* fill color */ }; main() { static struct attributes atr; atr.bordash = FALSE; atr.bcolor = RED; atr.fill = TRUE; atr.fcolor = WHITE; /* ... */ }; #include "atr.h" struct boxatr1 { int xpos; int ypos; unsigned xlen; unsigned ylen; unsigned bordash : 1; unsigned bcolor : 3; unsigned fill : 1; unsigned fcolor : 3; }; struct boxatr1 b1 = {1, 1, 2, 3, FALSE, GREEN, TRUE, RED}; #include "atr.h" struct box { int xpos; int ypos; unsigned xlen; unsigned ylen; }; struct attributes { unsigned bordash : 1; unsigned bcolor : 3; unsigned fill : 1; unsigned fcolor : 3; }; struct boxatr2 { struct box abox; struct attributes atr; }; struct boxatr2 b2 = { {1, 1, 2, 3}, {FALSE, GREEN, TRUE, RED} };