options.h 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. static int sel_max = 0;
  2. static int sel = 0;
  3. void toggle(int ndx, int value, char *str) {
  4. set_attr(sel == ndx ? 0x70 : 0x07);
  5. if (value) {
  6. print_(" [X] ");
  7. } else {
  8. print_(" [ ] ");
  9. }
  10. print_(str);
  11. if (x < 40) {
  12. while (x < 39) {
  13. print_(" ");
  14. }
  15. x = 40;
  16. } else {
  17. print_("\n");
  18. }
  19. }
  20. struct option {
  21. int * value;
  22. char * title;
  23. char * description_1;
  24. char * description_2;
  25. } boot_options[20] = {{0}}; /* can't really hold more than that */
  26. static int _boot_offset = 0;
  27. #define BOOT_OPTION(_value, default_val, option, d1, d2) \
  28. int _value = default_val;\
  29. boot_options[_boot_offset].value = &_value; \
  30. boot_options[_boot_offset].title = option; \
  31. boot_options[_boot_offset].description_1 = d1; \
  32. boot_options[_boot_offset].description_2 = d2; \
  33. _boot_offset++
  34. struct bootmode {
  35. int index;
  36. char * key;
  37. char * title;
  38. };
  39. #define BASE_SEL ((sizeof(boot_mode_names)/sizeof(*boot_mode_names))-1)