case_N.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Allow an arbitrary sequence of case labels.
  3. *
  4. * Copyright (C) 2006-2010 Wayne Davison
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, visit the http://fsf.org website.
  18. */
  19. /* This is included multiple times, once for every segement in a switch statement.
  20. * This produces the next "case N:" statement in sequence. */
  21. #if !defined CASE_N_STATE_0
  22. #define CASE_N_STATE_0
  23. case 0:
  24. #elif !defined CASE_N_STATE_1
  25. #define CASE_N_STATE_1
  26. case 1:
  27. #elif !defined CASE_N_STATE_2
  28. #define CASE_N_STATE_2
  29. case 2:
  30. #elif !defined CASE_N_STATE_3
  31. #define CASE_N_STATE_3
  32. case 3:
  33. #elif !defined CASE_N_STATE_4
  34. #define CASE_N_STATE_4
  35. case 4:
  36. #elif !defined CASE_N_STATE_5
  37. #define CASE_N_STATE_5
  38. case 5:
  39. #elif !defined CASE_N_STATE_6
  40. #define CASE_N_STATE_6
  41. case 6:
  42. #elif !defined CASE_N_STATE_7
  43. #define CASE_N_STATE_7
  44. case 7:
  45. #elif !defined CASE_N_STATE_8
  46. #define CASE_N_STATE_8
  47. case 8:
  48. #elif !defined CASE_N_STATE_9
  49. #define CASE_N_STATE_9
  50. case 9:
  51. #elif !defined CASE_N_STATE_10
  52. #define CASE_N_STATE_10
  53. case 10:
  54. #elif !defined CASE_N_STATE_11
  55. #define CASE_N_STATE_11
  56. case 11:
  57. #elif !defined CASE_N_STATE_12
  58. #define CASE_N_STATE_12
  59. case 12:
  60. #elif !defined CASE_N_STATE_13
  61. #define CASE_N_STATE_13
  62. case 13:
  63. #elif !defined CASE_N_STATE_14
  64. #define CASE_N_STATE_14
  65. case 14:
  66. #elif !defined CASE_N_STATE_15
  67. #define CASE_N_STATE_15
  68. case 15:
  69. #elif !defined CASE_N_STATE_16
  70. #define CASE_N_STATE_16
  71. case 16:
  72. #else
  73. #error Need to add more case statements!
  74. #endif