ceedling 0.19.0 → 0.20.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (426) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +10 -10
  3. data/bin/ceedling +205 -92
  4. data/ceedling-0.19.0.gem +0 -0
  5. data/config/test_environment.rb +12 -12
  6. data/docs/CeedlingPacket.md +866 -853
  7. data/docs/CeedlingPacket.odt +0 -0
  8. data/docs/CeedlingPacket.pdf +0 -0
  9. data/examples/temp_sensor/rakefile.rb +4 -4
  10. data/examples/temp_sensor/src/AdcConductor.c +42 -42
  11. data/examples/temp_sensor/src/AdcConductor.h +13 -13
  12. data/examples/temp_sensor/src/AdcHardware.c +27 -27
  13. data/examples/temp_sensor/src/AdcHardware.h +11 -11
  14. data/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
  15. data/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
  16. data/examples/temp_sensor/src/AdcModel.c +33 -33
  17. data/examples/temp_sensor/src/AdcModel.h +13 -13
  18. data/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
  19. data/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
  20. data/examples/temp_sensor/src/Executor.c +25 -25
  21. data/examples/temp_sensor/src/Executor.h +9 -9
  22. data/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
  23. data/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
  24. data/examples/temp_sensor/src/Main.c +46 -46
  25. data/examples/temp_sensor/src/Main.h +7 -7
  26. data/examples/temp_sensor/src/Model.c +10 -10
  27. data/examples/temp_sensor/src/Model.h +8 -8
  28. data/examples/temp_sensor/src/ModelConfig.h +7 -7
  29. data/examples/temp_sensor/src/TaskScheduler.c +72 -72
  30. data/examples/temp_sensor/src/TaskScheduler.h +11 -11
  31. data/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
  32. data/examples/temp_sensor/src/TemperatureCalculator.h +8 -8
  33. data/examples/temp_sensor/src/TemperatureFilter.c +38 -38
  34. data/examples/temp_sensor/src/TemperatureFilter.h +10 -10
  35. data/examples/temp_sensor/src/TimerConductor.c +15 -15
  36. data/examples/temp_sensor/src/TimerConductor.h +9 -9
  37. data/examples/temp_sensor/src/TimerConfigurator.c +51 -51
  38. data/examples/temp_sensor/src/TimerConfigurator.h +15 -15
  39. data/examples/temp_sensor/src/TimerHardware.c +15 -15
  40. data/examples/temp_sensor/src/TimerHardware.h +8 -8
  41. data/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
  42. data/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
  43. data/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
  44. data/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
  45. data/examples/temp_sensor/src/TimerModel.c +9 -9
  46. data/examples/temp_sensor/src/TimerModel.h +8 -8
  47. data/examples/temp_sensor/src/Types.h +90 -90
  48. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
  49. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +8 -8
  50. data/examples/temp_sensor/src/UsartConductor.c +21 -21
  51. data/examples/temp_sensor/src/UsartConductor.h +7 -7
  52. data/examples/temp_sensor/src/UsartConfigurator.c +39 -39
  53. data/examples/temp_sensor/src/UsartConfigurator.h +13 -13
  54. data/examples/temp_sensor/src/UsartHardware.c +22 -22
  55. data/examples/temp_sensor/src/UsartHardware.h +9 -9
  56. data/examples/temp_sensor/src/UsartModel.c +34 -34
  57. data/examples/temp_sensor/src/UsartModel.h +10 -10
  58. data/examples/temp_sensor/src/UsartPutChar.c +16 -16
  59. data/examples/temp_sensor/src/UsartPutChar.h +8 -8
  60. data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
  61. data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
  62. data/examples/temp_sensor/test/TestAdcConductor.c +121 -121
  63. data/examples/temp_sensor/test/TestAdcHardware.c +44 -44
  64. data/examples/temp_sensor/test/TestAdcModel.c +33 -33
  65. data/examples/temp_sensor/test/TestExecutor.c +36 -36
  66. data/examples/temp_sensor/test/TestMain.c +24 -24
  67. data/examples/temp_sensor/test/TestModel.c +20 -20
  68. data/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
  69. data/examples/temp_sensor/test/TestTemperatureCalculator.c +33 -33
  70. data/examples/temp_sensor/test/TestTemperatureFilter.c +79 -79
  71. data/examples/temp_sensor/test/TestTimerConductor.c +32 -32
  72. data/examples/temp_sensor/test/TestTimerHardware.c +26 -26
  73. data/examples/temp_sensor/test/TestTimerModel.c +18 -18
  74. data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
  75. data/examples/temp_sensor/test/TestUsartConductor.c +40 -40
  76. data/examples/temp_sensor/test/TestUsartHardware.c +36 -36
  77. data/examples/temp_sensor/test/TestUsartModel.c +36 -36
  78. data/examples/temp_sensor/test/support/UnityHelper.c +12 -12
  79. data/examples/temp_sensor/test/support/UnityHelper.h +12 -12
  80. data/lib/ceedling/configurator_builder.rb +1 -1
  81. data/lib/ceedling/tasks_base.rake +10 -2
  82. data/lib/ceedling/tool_executor.rb +3 -0
  83. data/lib/ceedling/version.rb +3 -3
  84. data/license.txt +1 -1
  85. data/plugins/bullseye/bullseye.rake +162 -162
  86. data/plugins/gcov/gcov.rake +152 -152
  87. data/plugins/module_generator/lib/module_generator.rb +145 -145
  88. data/plugins/module_generator/module_generator.rake +14 -14
  89. data/plugins/stdout_gtestlike_tests_report/assets/template.erb +84 -0
  90. data/plugins/stdout_gtestlike_tests_report/assets/template.erb copy +59 -0
  91. data/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml +4 -0
  92. data/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb +43 -0
  93. data/spec/system/deployment_spec.rb +0 -1
  94. data/test_graveyard/integration/paths_test.rb +80 -80
  95. data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +75 -75
  96. data/test_graveyard/integration/rake_rules_cmock_test.rb +74 -74
  97. data/test_graveyard/integration/rake_rules_preprocess_test.rb +178 -178
  98. data/test_graveyard/integration/rake_rules_test.rb +268 -268
  99. data/test_graveyard/integration/rake_tasks_test.rb +103 -103
  100. data/test_graveyard/integration_test_helper.rb +34 -34
  101. data/test_graveyard/rakefile_rules.rb +10 -10
  102. data/test_graveyard/rakefile_rules_aux_dependencies.rb +10 -10
  103. data/test_graveyard/rakefile_rules_cmock.rb +10 -10
  104. data/test_graveyard/rakefile_rules_preprocess.rb +10 -10
  105. data/test_graveyard/rakefile_tasks.rb +10 -10
  106. data/test_graveyard/system/file_system_test.rb +78 -78
  107. data/test_graveyard/system/project_mocks_test.rb +38 -38
  108. data/test_graveyard/system/project_simple_test.rb +39 -39
  109. data/test_graveyard/system/rule_mocks_test.rb +44 -44
  110. data/test_graveyard/system/rule_runners_test.rb +44 -44
  111. data/test_graveyard/system_test_helper.rb +73 -73
  112. data/test_graveyard/test_helper.rb +93 -93
  113. data/test_graveyard/unit/busted/configurator_builder_test.rb +569 -569
  114. data/test_graveyard/unit/busted/configurator_helper_test.rb +234 -234
  115. data/test_graveyard/unit/busted/configurator_test.rb +232 -232
  116. data/test_graveyard/unit/busted/configurator_validator_test.rb +169 -169
  117. data/test_graveyard/unit/busted/deep_merge_fix_test.rb +55 -55
  118. data/test_graveyard/unit/busted/dependinator_test.rb +129 -129
  119. data/test_graveyard/unit/busted/file_finder_helper_test.rb +45 -45
  120. data/test_graveyard/unit/busted/file_finder_test.rb +114 -114
  121. data/test_graveyard/unit/busted/file_path_utils_test.rb +97 -97
  122. data/test_graveyard/unit/busted/file_system_utils_test.rb +21 -21
  123. data/test_graveyard/unit/busted/generator_test.rb +187 -187
  124. data/test_graveyard/unit/busted/generator_test_results_test.rb +129 -129
  125. data/test_graveyard/unit/busted/generator_test_runner_test.rb +475 -475
  126. data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +39 -39
  127. data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +156 -156
  128. data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +93 -93
  129. data/test_graveyard/unit/busted/preprocessinator_test.rb +57 -57
  130. data/test_graveyard/unit/busted/project_file_loader_test.rb +142 -142
  131. data/test_graveyard/unit/busted/setupinator_test.rb +45 -45
  132. data/test_graveyard/unit/busted/streaminator_test.rb +49 -49
  133. data/test_graveyard/unit/busted/task_invoker_test.rb +69 -69
  134. data/test_graveyard/unit/busted/test_includes_extractor_test.rb +111 -111
  135. data/test_graveyard/unit/busted/test_invoker_helper_test.rb +62 -62
  136. data/test_graveyard/unit/busted/test_invoker_test.rb +47 -47
  137. data/test_graveyard/unit/busted/tool_executor_helper_test.rb +100 -100
  138. data/test_graveyard/unit/busted/tool_executor_test.rb +351 -351
  139. data/test_graveyard/unit/busted/verbosinator_test.rb +65 -65
  140. data/test_graveyard/unit/preprocessinator_extractor_test.rb +731 -731
  141. data/test_graveyard/unit_test_helper.rb +16 -16
  142. data/vendor/c_exception/LICENSE.txt +30 -30
  143. data/vendor/c_exception/README.md +11 -1
  144. data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  145. data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  146. data/vendor/c_exception/docs/readme.txt +261 -242
  147. data/vendor/c_exception/lib/CException.c +46 -46
  148. data/vendor/c_exception/lib/CException.h +110 -86
  149. data/vendor/c_exception/makefile +23 -23
  150. data/vendor/c_exception/test/CExceptionConfig.h +46 -46
  151. data/vendor/c_exception/test/TestException.c +391 -342
  152. data/vendor/c_exception/test/TestException_Runner.c +5 -12
  153. data/vendor/c_exception/vendor/unity/README.md +211 -0
  154. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +1 -1
  155. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +38 -38
  156. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -36
  157. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -202
  158. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +391 -320
  159. data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +2 -0
  160. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +260 -0
  161. data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +8 -0
  162. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +135 -0
  163. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +148 -139
  164. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  165. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  166. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +224 -216
  167. data/vendor/c_exception/vendor/unity/docs/license.txt +21 -31
  168. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +40 -15
  169. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
  170. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +32 -25
  171. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +29 -22
  172. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +40 -14
  173. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
  174. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
  175. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +0 -1
  176. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
  177. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -37
  178. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +179 -179
  179. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +135 -94
  180. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +13 -17
  181. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -18
  182. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +30 -0
  183. data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +60 -0
  184. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +4 -3
  185. data/vendor/c_exception/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
  186. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +182 -27
  187. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +13 -0
  188. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +8 -6
  189. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
  190. data/vendor/c_exception/vendor/unity/release/build.info +1 -1
  191. data/vendor/c_exception/vendor/unity/release/version.info +1 -1
  192. data/vendor/c_exception/vendor/unity/src/unity.c +1333 -1145
  193. data/vendor/c_exception/vendor/unity/src/unity.h +290 -307
  194. data/vendor/c_exception/vendor/unity/src/unity_internals.h +758 -620
  195. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +7 -3
  196. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +7 -3
  197. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
  198. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
  199. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +4 -3
  200. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +4 -3
  201. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  202. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
  203. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -5
  204. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +4 -3
  205. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +4 -3
  206. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -5
  207. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +4 -3
  208. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -6
  209. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +9 -5
  210. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -3
  211. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +7 -3
  212. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +9 -5
  213. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -3
  214. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +10 -6
  215. data/vendor/c_exception/vendor/unity/{rakefile.rb → test/rakefile} +60 -61
  216. data/vendor/c_exception/vendor/unity/{rakefile_helper.rb → test/rakefile_helper.rb} +255 -249
  217. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +83 -0
  218. data/vendor/c_exception/vendor/unity/{targets → test/targets}/clang_strict.yml +83 -83
  219. data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
  220. data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
  221. data/vendor/c_exception/vendor/unity/{targets/gcc_64.yml → test/targets/gcc_auto_limits.yml} +46 -45
  222. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +47 -0
  223. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +58 -0
  224. data/vendor/{cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml → c_exception/vendor/unity/test/targets/gcc_manual_math.yml} +46 -45
  225. data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/hitech_picc18.yml +101 -101
  226. data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_arm_v4.yml +89 -89
  227. data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_arm_v5.yml +79 -79
  228. data/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_arm_v5_3.yml +79 -79
  229. data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -93
  230. data/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_cortexm3_v5.yml +83 -83
  231. data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_msp430.yml +94 -94
  232. data/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_sh2a_v6.yml +85 -85
  233. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -51
  234. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +8 -8
  235. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +68 -51
  236. data/vendor/{cmock/vendor/c_exception/vendor/unity/test → c_exception/vendor/unity/test/tests}/test_generate_test_runner.rb +102 -88
  237. data/vendor/{cmock/vendor/c_exception/vendor/unity/test → c_exception/vendor/unity/test/tests}/testparameterized.c +104 -101
  238. data/vendor/c_exception/vendor/unity/test/{testunity.c → tests/testunity.c} +3682 -3447
  239. data/vendor/cmock/docs/CMock_Summary.md +3 -0
  240. data/vendor/cmock/lib/cmock_config.rb +1 -0
  241. data/vendor/cmock/lib/cmock_file_writer.rb +7 -3
  242. data/vendor/cmock/lib/cmock_generator.rb +3 -2
  243. data/vendor/cmock/lib/cmock_header_parser.rb +12 -5
  244. data/vendor/cmock/release/version.info +1 -1
  245. data/vendor/cmock/test/system/test_compilation/parsing.h +3 -0
  246. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +7 -0
  247. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +57 -1
  248. data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -30
  249. data/vendor/cmock/vendor/c_exception/README.md +11 -1
  250. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  251. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  252. data/vendor/cmock/vendor/c_exception/docs/readme.txt +261 -242
  253. data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -46
  254. data/vendor/cmock/vendor/c_exception/lib/CException.h +110 -86
  255. data/vendor/cmock/vendor/c_exception/makefile +23 -23
  256. data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -46
  257. data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -342
  258. data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +5 -12
  259. data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +211 -0
  260. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +1 -1
  261. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +38 -38
  262. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -36
  263. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -202
  264. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +391 -320
  265. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parseOutput.rb +2 -0
  266. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +260 -0
  267. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +8 -0
  268. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +135 -0
  269. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +148 -139
  270. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  271. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  272. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +224 -216
  273. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt +21 -31
  274. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +40 -15
  275. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
  276. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +32 -25
  277. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +29 -22
  278. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +40 -14
  279. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
  280. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
  281. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +0 -1
  282. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
  283. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -37
  284. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +179 -179
  285. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +135 -94
  286. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +13 -17
  287. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -18
  288. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +30 -0
  289. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +60 -0
  290. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +4 -3
  291. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
  292. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +182 -27
  293. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +13 -0
  294. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +8 -6
  295. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
  296. data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +1 -1
  297. data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
  298. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +1333 -1145
  299. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +290 -307
  300. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +758 -620
  301. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +7 -3
  302. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +7 -3
  303. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
  304. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
  305. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +4 -3
  306. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +4 -3
  307. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  308. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
  309. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -5
  310. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +4 -3
  311. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +4 -3
  312. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -5
  313. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +4 -3
  314. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -6
  315. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +9 -5
  316. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -3
  317. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +7 -3
  318. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +9 -5
  319. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -3
  320. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +10 -6
  321. data/vendor/cmock/vendor/c_exception/vendor/unity/{rakefile.rb → test/rakefile} +60 -61
  322. data/vendor/cmock/vendor/c_exception/vendor/unity/{rakefile_helper.rb → test/rakefile_helper.rb} +255 -249
  323. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +83 -0
  324. data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/clang_strict.yml +83 -83
  325. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
  326. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
  327. data/vendor/cmock/vendor/c_exception/vendor/unity/{targets/gcc_32.yml → test/targets/gcc_auto_limits.yml} +46 -44
  328. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +47 -0
  329. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +58 -0
  330. data/vendor/{c_exception/vendor/unity/targets/gcc_32.yml → cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml} +46 -44
  331. data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/hitech_picc18.yml +101 -101
  332. data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_arm_v4.yml +89 -89
  333. data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_arm_v5.yml +79 -79
  334. data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_arm_v5_3.yml +79 -79
  335. data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -93
  336. data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_cortexm3_v5.yml +83 -83
  337. data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_msp430.yml +94 -94
  338. data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_sh2a_v6.yml +85 -85
  339. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -51
  340. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml +8 -8
  341. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c +68 -51
  342. data/vendor/{c_exception/vendor/unity/test → cmock/vendor/c_exception/vendor/unity/test/tests}/test_generate_test_runner.rb +102 -88
  343. data/vendor/{c_exception/vendor/unity/test → cmock/vendor/c_exception/vendor/unity/test/tests}/testparameterized.c +104 -101
  344. data/vendor/cmock/vendor/c_exception/vendor/unity/test/{testunity.c → tests/testunity.c} +3682 -3447
  345. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +30 -13
  346. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +260 -0
  347. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +96 -93
  348. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
  349. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -19
  350. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +18 -17
  351. data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +66 -5
  352. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +2 -1
  353. data/vendor/cmock/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
  354. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +187 -27
  355. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +14 -0
  356. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -5
  357. data/vendor/cmock/vendor/unity/release/version.info +1 -1
  358. data/vendor/cmock/vendor/unity/src/unity.c +38 -27
  359. data/vendor/cmock/vendor/unity/src/unity.h +5 -0
  360. data/vendor/cmock/vendor/unity/src/unity_internals.h +22 -18
  361. data/vendor/cmock/vendor/unity/test/Makefile +52 -0
  362. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +4 -0
  363. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +4 -0
  364. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +4 -0
  365. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +7 -4
  366. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +6 -4
  367. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +4 -0
  368. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +4 -0
  369. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +4 -0
  370. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +4 -0
  371. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +4 -0
  372. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +4 -0
  373. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +1 -1
  374. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +0 -1
  375. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +0 -1
  376. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +0 -1
  377. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +0 -1
  378. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +0 -1
  379. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -1
  380. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +0 -1
  381. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +0 -1
  382. data/vendor/cmock/vendor/unity/test/testdata/testsample.c +19 -2
  383. data/vendor/cmock/vendor/unity/test/tests/testunity.c +55 -4
  384. data/vendor/unity/auto/generate_test_runner.rb +4 -2
  385. data/vendor/unity/auto/stylize_as_junit.rb +260 -0
  386. data/vendor/unity/extras/fixture/src/unity_fixture.c +24 -41
  387. data/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
  388. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +5 -7
  389. data/vendor/unity/extras/fixture/test/Makefile +53 -8
  390. data/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
  391. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +129 -32
  392. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -0
  393. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +4 -4
  394. data/vendor/unity/release/version.info +1 -1
  395. data/vendor/unity/src/unity.c +32 -21
  396. data/vendor/unity/src/unity.h +5 -0
  397. data/vendor/unity/src/unity_internals.h +7 -3
  398. data/vendor/unity/test/Makefile +52 -0
  399. data/vendor/unity/test/expectdata/testsample_cmd.c +4 -0
  400. data/vendor/unity/test/expectdata/testsample_def.c +4 -0
  401. data/vendor/unity/test/expectdata/testsample_head1.c +4 -0
  402. data/vendor/unity/test/expectdata/testsample_head1.h +7 -4
  403. data/vendor/unity/test/expectdata/testsample_mock_head1.h +6 -4
  404. data/vendor/unity/test/expectdata/testsample_new1.c +4 -0
  405. data/vendor/unity/test/expectdata/testsample_new2.c +4 -0
  406. data/vendor/unity/test/expectdata/testsample_param.c +4 -0
  407. data/vendor/unity/test/expectdata/testsample_run1.c +4 -0
  408. data/vendor/unity/test/expectdata/testsample_run2.c +4 -0
  409. data/vendor/unity/test/expectdata/testsample_yaml.c +4 -0
  410. data/vendor/unity/test/testdata/testsample.c +19 -2
  411. data/vendor/unity/test/tests/testunity.c +35 -4
  412. metadata +75 -52
  413. data/ceedling-0.18.0.gem +0 -0
  414. data/docs/CeedlingLogo.png +0 -0
  415. data/vendor/c_exception/vendor/unity/Gemfile +0 -4
  416. data/vendor/c_exception/vendor/unity/Gemfile.lock +0 -12
  417. data/vendor/c_exception/vendor/unity/examples/example_3/makefile +0 -41
  418. data/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -46
  419. data/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -50
  420. data/vendor/c_exception/vendor/unity/makefile +0 -37
  421. data/vendor/cmock/vendor/c_exception/vendor/unity/Gemfile +0 -4
  422. data/vendor/cmock/vendor/c_exception/vendor/unity/Gemfile.lock +0 -12
  423. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/makefile +0 -41
  424. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -46
  425. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -50
  426. data/vendor/cmock/vendor/c_exception/vendor/unity/makefile +0 -37
@@ -284,6 +284,9 @@ Defined in the yaml file, they look more like this:
284
284
  The prefix to append to your mock files. Defaults to “Mock”, so a file
285
285
  “USART.h” will get a mock called “MockUSART.c”
286
286
 
287
+ * `:mock_suffix`:
288
+ The suffix to append to your mock files. Defaults to “”.
289
+
287
290
  * `:subdir`:
288
291
  Relative subdir for your mocks. Set this to e.g. "sys" in order to
289
292
  create mock for `sys/types.h` in `:mock_path`/sys/
@@ -11,6 +11,7 @@ class CMockConfig
11
11
  :framework => :unity,
12
12
  :mock_path => 'mocks',
13
13
  :mock_prefix => 'Mock',
14
+ :mock_suffix => '',
14
15
  :subdir => nil,
15
16
  :plugins => [],
16
17
  :strippables => ['(?:__attribute__\s*\(+.*?\)+)'],
@@ -2,7 +2,7 @@
2
2
  # CMock Project - Automatic Mock Generation for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  class CMockFileWriter
8
8
 
@@ -13,6 +13,10 @@ class CMockFileWriter
13
13
  end
14
14
 
15
15
  def create_subdir(subdir)
16
+ if !Dir.exists?("#{@config.mock_path}/")
17
+ require 'fileutils'
18
+ FileUtils.mkdir_p "#{@config.mock_path}/"
19
+ end
16
20
  if subdir && !Dir.exists?("#{@config.mock_path}/#{subdir+'/' if subdir}")
17
21
  require 'fileutils'
18
22
  FileUtils.mkdir_p "#{@config.mock_path}/#{subdir+'/' if subdir}"
@@ -28,9 +32,9 @@ class CMockFileWriter
28
32
  end
29
33
  update_file(full_file_name_done, full_file_name_temp)
30
34
  end
31
-
35
+
32
36
  private ###################################
33
-
37
+
34
38
  def update_file(dest, src)
35
39
  require 'fileutils'
36
40
  FileUtils.rm(dest) if (File.exist?(dest))
@@ -14,6 +14,7 @@ class CMockGenerator
14
14
  @plugins = plugins
15
15
  @config = config
16
16
  @prefix = @config.mock_prefix
17
+ @suffix = @config.mock_suffix
17
18
  @ordered = @config.enforce_strict_ordering
18
19
  @framework = @config.framework.to_s
19
20
 
@@ -39,7 +40,7 @@ class CMockGenerator
39
40
 
40
41
  def create_mock(module_name, parsed_stuff)
41
42
  @module_name = module_name
42
- @mock_name = @prefix + @module_name
43
+ @mock_name = @prefix + @module_name + @suffix
43
44
  @clean_mock_name = TypeSanitizer.sanitize_c_identifier(@mock_name)
44
45
  create_mock_subdir()
45
46
  create_mock_header_file(parsed_stuff)
@@ -83,7 +84,7 @@ class CMockGenerator
83
84
 
84
85
  def create_mock_header_header(file, filename)
85
86
  define_name = @clean_mock_name.upcase
86
- orig_filename = (@subdir ? @subdir + "/" : "") + filename[@config.mock_prefix.size..-1]
87
+ orig_filename = (@subdir ? @subdir + "/" : "") + @module_name + ".h"
87
88
  file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
88
89
  file << "#ifndef _#{define_name}_H\n"
89
90
  file << "#define _#{define_name}_H\n\n"
@@ -74,7 +74,7 @@ class CMockHeaderParser
74
74
 
75
75
  # remove preprocessor statements and extern "C"
76
76
  source.gsub!(/^\s*#.*/, '')
77
- source.gsub!(/extern\s+\"C\"\s+\{/, '')
77
+ source.gsub!(/extern\s+\"C\"\s*\{/, '')
78
78
 
79
79
  # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them
80
80
  # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes
@@ -93,12 +93,13 @@ class CMockHeaderParser
93
93
  "#{functype} #{$2.strip}(#{$3});"
94
94
  end
95
95
 
96
+ # remove nested pairs of braces because no function declarations will be inside of them (leave outer pair for function definition detection)
97
+ while source.gsub!(/\{[^\{\}]*\{[^\{\}]*\}[^\{\}]*\}/m, '{ }')
98
+ end
99
+
96
100
  # remove function definitions by stripping off the arguments right now
97
101
  source.gsub!(/\([^\)]*\)\s*\{[^\}]*\}/m, ";")
98
102
 
99
- # remove pairs of braces because no function declarations will be inside of them
100
- #source.gsub!(/\{[^\}]*\}/m, '')
101
-
102
103
  #drop extra white space to make the rest go faster
103
104
  source.gsub!(/^\s+/, '') # remove extra white space from beginning of line
104
105
  source.gsub!(/\s+$/, '') # remove extra white space from end of line
@@ -142,7 +143,7 @@ class CMockHeaderParser
142
143
  args << { :type => (arg_type = arg_elements[0..-2].join(' ')),
143
144
  :name => arg_elements[-1],
144
145
  :ptr? => divine_ptr(arg_type),
145
- :const? => arg_array.include?('const')
146
+ :const? => divine_const(arg)
146
147
  }
147
148
  end
148
149
  return args
@@ -154,6 +155,12 @@ class CMockHeaderParser
154
155
  return true
155
156
  end
156
157
 
158
+ def divine_const(arg)
159
+ return false if /const[ *]/.match(arg).nil? # check for const
160
+ return false if /\*/.match(arg) and /const[^*]*\*/.match(arg).nil? # check const comes before * indicating const data
161
+ return true
162
+ end
163
+
157
164
  def clean_args(arg_list)
158
165
  if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?))
159
166
  return 'void'
@@ -1,2 +1,2 @@
1
- 2.4.0
1
+ 2.4.2
2
2
 
@@ -7,6 +7,9 @@
7
7
  typedef unsigned short U16;
8
8
  typedef signed int int32_t;
9
9
 
10
+ /* CMock should handle UTF-8 characters in comments. The world is an awesomely diverse place! */
11
+ /* my µC Rocks! Open Source, not ©! My language has no Ümlauts! ǺƜǝƧǾɱɛ! */ /**! Illegal: åäö */
12
+
10
13
  typedef struct _POINT_T
11
14
  {
12
15
  int x;
@@ -43,6 +43,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
43
43
 
44
44
  #no strict handling
45
45
  @config.expect :mock_prefix, "Mock"
46
+ @config.expect :mock_suffix, ""
46
47
  @config.expect :enforce_strict_ordering, nil
47
48
  @config.expect :framework, :unity
48
49
  @config.expect :includes, ["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]
@@ -58,6 +59,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
58
59
 
59
60
  #strict handling
60
61
  @config.expect :mock_prefix, "Mock"
62
+ @config.expect :mock_suffix, ""
61
63
  @config.expect :enforce_strict_ordering, true
62
64
  @config.expect :framework, :unity
63
65
  @config.expect :includes, nil
@@ -77,6 +79,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
77
79
 
78
80
  it "create the top of a header file with optional include files from config and include file from plugin" do
79
81
  @config.expect :mock_prefix, "Mock"
82
+ @config.expect :mock_suffix, ""
80
83
  orig_filename = "PoutPoutFish.h"
81
84
  define_name = "MOCKPOUTPOUTFISH_H"
82
85
  mock_name = "MockPoutPoutFish"
@@ -112,6 +115,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
112
115
  it "handle dashes and spaces in the module name" do
113
116
  #no strict handling
114
117
  @config.expect :mock_prefix, "Mock"
118
+ @config.expect :mock_suffix, ""
115
119
  @config.expect :enforce_strict_ordering, nil
116
120
  @config.expect :framework, :unity
117
121
  @config.expect :includes, ["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]
@@ -125,6 +129,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
125
129
  @cmock_generator2.clean_mock_name = "MockPout_Pout_Fish"
126
130
 
127
131
  @config.expect :mock_prefix, "Mock"
132
+ @config.expect :mock_suffix, ""
128
133
  orig_filename = "Pout-Pout Fish.h"
129
134
  define_name = "MOCKPOUT_POUT_FISH_H"
130
135
  mock_name = "MockPout_Pout_Fish"
@@ -159,6 +164,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
159
164
 
160
165
  it "create the top of a header file with optional include files from config" do
161
166
  @config.expect :mock_prefix, "Mock"
167
+ @config.expect :mock_suffix, ""
162
168
  orig_filename = "PoutPoutFish.h"
163
169
  define_name = "MOCKPOUTPOUTFISH_H"
164
170
  mock_name = "MockPoutPoutFish"
@@ -192,6 +198,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
192
198
 
193
199
  it "create the top of a header file with include file from plugin" do
194
200
  @config.expect :mock_prefix, "Mock"
201
+ @config.expect :mock_suffix, ""
195
202
  orig_filename = "PoutPoutFish.h"
196
203
  define_name = "MOCKPOUTPOUTFISH_H"
197
204
  mock_name = "MockPoutPoutFish"
@@ -311,6 +311,34 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
311
311
  assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
312
312
  end
313
313
 
314
+ it "remove function definitions with nested braces but keep function declarations" do
315
+ source =
316
+ "uint32 func_with_decl_a(unsigned int);\n" +
317
+ "uint32 func_with_decl_a(unsigned int a) {\n" +
318
+ " while (stuff) {\n" +
319
+ " not_a_definition1(void);\n" +
320
+ " }\n" +
321
+ " not_a_definition2(blah, bleh);\n" +
322
+ " return a;\n" +
323
+ "}\n" +
324
+ "uint32 func_with_decl_b(unsigned int);\n" +
325
+ "uint32 func_with_decl_b(unsigned int a)\n" +
326
+ "{\n" +
327
+ " bar((unsigned int) a);\n" +
328
+ " stripme(a);\n" +
329
+ "}\n"
330
+
331
+ expected =
332
+ [
333
+ "uint32 func_with_decl_a(unsigned int)",
334
+ "uint32 func_with_decl_a", #okay. it's not going to be interpretted as another function
335
+ "uint32 func_with_decl_b(unsigned int)",
336
+ "uint32 func_with_decl_b", #okay. it's not going to be interpretted as another function
337
+ ]
338
+
339
+ assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
340
+ end
341
+
314
342
  it "remove a fully defined inline function" do
315
343
  source =
316
344
  "inline void foo(unsigned int a) { oranges = a; }\n" +
@@ -359,6 +387,34 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
359
387
  end
360
388
  end
361
389
 
390
+ it "remove a fully defined inline function that contains nested braces" do
391
+ source =
392
+ "inline void bar(unsigned int a)\n" +
393
+ "{" +
394
+ " apples(bananas, grapes);\n" +
395
+ " if (bananas == a)\n" +
396
+ " {\n" +
397
+ " oranges(a);\n" +
398
+ " grapes = a;\n" +
399
+ " }\n" +
400
+ " grapefruit(bananas, grapes);\n" +
401
+ "}"
402
+
403
+ # ensure it's expected type of exception
404
+ assert_raises RuntimeError do
405
+ @parser.parse("module", source)
406
+ end
407
+
408
+ assert_equal([], @parser.funcs)
409
+
410
+ # verify exception message
411
+ begin
412
+ @parser.parse("module", source)
413
+ rescue RuntimeError => e
414
+ assert_equal("ERROR: No function prototypes found!", e.message)
415
+ end
416
+ end
417
+
362
418
  it "remove just inline functions if externs to be included" do
363
419
  source =
364
420
  " extern uint32 foobar(unsigned int);\n" +
@@ -858,7 +914,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
858
914
  {:type=>"int", :name=>"int_param", :ptr? => false, :const? => false},
859
915
  {:type=>"int", :name=>"integer", :ptr? => false, :const? => false},
860
916
  {:type=>"char", :name=>"character", :ptr? => false, :const? => false},
861
- {:type=>"int*", :name=>"constant", :ptr? => true, :const? => true}
917
+ {:type=>"int*", :name=>"constant", :ptr? => true, :const? => false}
862
918
  ],
863
919
  :args_string=>"const unsigned int const_param, int int_param, int integer, char character, int* const constant",
864
920
  :args_call=>"const_param, int_param, integer, character, constant" }]
@@ -1,30 +1,30 @@
1
- Copyright (c) 2007-2014 Mark VanderVoord
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- The end-user documentation included with the redistribution, if
16
- any, must include the following acknowledgment: "This product
17
- includes software developed for the CEXCeption Project, by Mark
18
- VanderVoord and other contributors", in the same place and form
19
- as other third-party acknowledgments. Alternately, this
20
- acknowledgment may appear in the software itself, in the same
21
- form and location as other such third-party acknowledgments.
22
-
23
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30
- OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2007-2014 Mark VanderVoord
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ The end-user documentation included with the redistribution, if
16
+ any, must include the following acknowledgment: "This product
17
+ includes software developed for the CEXCeption Project, by Mark
18
+ VanderVoord and other contributors", in the same place and form
19
+ as other third-party acknowledgments. Alternately, this
20
+ acknowledgment may appear in the software itself, in the same
21
+ form and location as other such third-party acknowledgments.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -96,6 +96,9 @@ CException API
96
96
  * `Throw(e)`
97
97
  * `Throw` is the method used to throw an error. `Throw`s should only occur from within a protected (`Try`...`Catch`) block, though it may easily be nested many function calls deep without an impact on performance or functionality. `Throw` takes a single argument, which is an exception id which will be passed to `Catch` as the reason for the error. If you wish to _re-throw_ an error, this can be done by calling `Throw(e)` with the error code you just caught. It _IS_ valid to throw from a `Catch` block.
98
98
 
99
+ * `ExitTry()`
100
+ * `ExitTry` is a method used to immediately exit your current Try block but NOT treat this as an error. Don't run the Catch. Just start executing from after the Catch as if nothing had happened.
101
+
99
102
  Configuration
100
103
  =============
101
104
 
@@ -124,6 +127,13 @@ You have options for configuring the library, if the defaults aren't good enough
124
127
 
125
128
  You may also want to include any header files which will commonly be needed by the rest of your application where it uses exception handling here. For example, OS header files or exception codes would be useful.
126
129
 
130
+ Finally, there are some hook macros which you can implement to inject your own target-specific code in particular places. It is a rare instance where you will need these, but they are here if you need them:
131
+
132
+ * `CEXCEPTION_HOOK_START_TRY` - called immediately before the Try block
133
+ * `CEXCEPTION_HOOK_HAPPY_TRY` - called immediately after the Try block if no exception was thrown
134
+ * `CEXCEPTION_HOOK_AFTER_TRY` - called immediately after the Try block OR before an exception is caught
135
+ * `CEXCEPTION_HOOK_START_CATCH` - called immediately before the catch
136
+
127
137
  Testing
128
138
  =======
129
139
 
@@ -138,7 +148,7 @@ License
138
148
  =======
139
149
 
140
150
  *This software is licensed under the MIT License:
141
- Copyright (c) 2007-2014 Mark VanderVoord*
151
+ Copyright (c) 2007-2016 Mark VanderVoord*
142
152
 
143
153
  *Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
144
154
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.*
@@ -1,242 +1,261 @@
1
- ====================================================================
2
- CException
3
- ====================================================================
4
-
5
- CException is a basic exception framework for C, suitable for use in
6
- embedded applications. It provides an exception framework similar in
7
- use to C++, but with much less overhead.
8
-
9
- CException uses C standard library functions setjmp and longjmp to
10
- operate. As long as the target system has these two functions defined,
11
- this library should be useable with very little configuration. It
12
- even supports environments where multiple program flows are in use,
13
- such as real-time operating systems.
14
-
15
- There are about a gabillion exception frameworks using a similar
16
- setjmp/longjmp method out there... and there will probably be more
17
- in the future. Unfortunately, when we started our last embedded
18
- project, all those that existed either (a) did not support multiple
19
- tasks (therefore multiple stacks) or (b) were way more complex than
20
- we really wanted. CException was born.
21
-
22
- Why use CException?
23
-
24
- 0. It's ANSI C, and it beats passing error codes around.
25
-
26
- 1. You want something simple... CException throws a single id. You can
27
- define those ID's to be whatever you like. You might even choose which
28
- type that number is for your project. But that's as far as it goes.
29
- We weren't interested in passing objects or structs or strings...
30
- just simple error codes.
31
-
32
- 2. Performance... CException can be configured for single tasking or
33
- multitasking. In single tasking, there is very little overhead past
34
- the setjmp/longjmp calls (which are already fast). In multitasking,
35
- your only additional overhead is the time it takes you to determine
36
- a unique task id 0 - num_tasks.
37
-
38
- For the latest version, go to http://cexception.sourceforge.net
39
-
40
- --------------------------------------------------------------------
41
- CONTENTS OF THIS DOCUMENT
42
- --------------------------------------------------------------------
43
-
44
- Usage
45
- Limitations
46
- API
47
- Configuration
48
- Testing
49
- License
50
-
51
- --------------------------------------------------------------------
52
- Usage
53
- --------------------------------------------------------------------
54
-
55
- Code that is to be protected are wrapped in Try { } Catch { } blocks.
56
- The code directly following the Try call is "protected", meaning that
57
- if any Throws occur, program control is directly transferred to the
58
- start of the Catch block.
59
-
60
- A numerical exception ID is included with Throw, and is made accessible
61
- from the Catch block.
62
-
63
- Throws can occur from within function calls (nested as deeply as you
64
- like) or directly from within the function itself.
65
-
66
- --------------------------------------------------------------------
67
- Limitations
68
- --------------------------------------------------------------------
69
-
70
- This library was made to be as fast as possible, and provide basic
71
- exception handling. It is not a full-blown exception library. Because
72
- of this, there are a few limitations that should be observed in order
73
- to successfully utilize this library:
74
-
75
- 1. Do not directly "return" from within a Try block, nor "goto"
76
- into or out of a Try block.
77
-
78
- Why?
79
-
80
- The "Try" macro allocates some local memory and alters a global
81
- pointer. These are cleaned up at the top of the "Catch" macro.
82
- Gotos and returns would bypass some of these steps, resulting in
83
- memory leaks or unpredictable behavior.
84
-
85
- 2. If (a) you change local (stack) variables within your Try block,
86
- AND (b) wish to make use of the updated values after an exception
87
- is thrown, those variables should be made volatile. Note that this
88
- is ONLY for locals and ONLY when you need access to them after a
89
- throw.
90
-
91
- Why?
92
-
93
- Compilers optimize. There is no way to guarantee that the actual
94
- memory location was updated and not just a register unless the
95
- variable is marked volatile.
96
-
97
- 3. Memory which is malloc'd or new'd is not automatically released
98
- when an error is thrown. This will sometimes be desirable, and
99
- othertimes may not. It will be the responsibility of the Catch
100
- block to perform this kind of cleanup.
101
-
102
- Why?
103
-
104
- There's just no easy way to track malloc'd memory, etc., without
105
- replacing or wrapping malloc calls or something like that. This
106
- is a light framework, so these options were not desirable.
107
-
108
- --------------------------------------------------------------------
109
- API
110
- --------------------------------------------------------------------
111
-
112
- Try
113
- ---
114
-
115
- Try is a macro which starts a protected block. It MUST be followed by
116
- a pair of braces or a single protected line (similar to an 'if'),
117
- enclosing the data that is to be protected. It MUST be followed by a
118
- Catch block (don't worry, you'll get compiler errors to let you know if
119
- you mess any of that up).
120
-
121
- Catch(e)
122
- --------
123
-
124
- Catch is a macro which ends the Try block and starts the error handling
125
- block. The catch block is called if and only if an exception was thrown
126
- while within the Try block. This error was thrown by a Throw call
127
- somewhere within Try (or within a function called within Try, or a function
128
- called by a function called within Try, etc).
129
-
130
- The single parameter 'e' is filled with the error code which was thrown.
131
- This can be used for reporting, conditional cleanup, etc. (or you can just
132
- ignore it if you really want... people ignore return codes all the time,
133
- right?). 'e' should be of type EXCEPTION_T;
134
-
135
- Throw(e)
136
- --------
137
-
138
- The method of throwing an error. Throws should only occur from within a
139
- protected (Try...Catch) block, though it may easily be nested many function
140
- calls deep without an impact on performance or functionality. Throw takes
141
- a single argument, which is an exception id which will be passed to Catch
142
- as the reason for the error.
143
-
144
- If you wish to Rethrow an error, this can be done by calling Throw(e) with
145
- the error code you just caught. It IS valid to throw from a catch block.
146
-
147
- --------------------------------------------------------------------
148
- CONFIGURATION
149
- --------------------------------------------------------------------
150
-
151
- CException is a mostly portable library. It has one universal
152
- dependency, and some macros which are required if working in a
153
- multi-tasking environment.
154
-
155
- 1. The standard C library setjmp must be available. Since this is part
156
- of the standard library, chances are good that you'll be fine.
157
-
158
- 2. If working in a multitasking environment, methods for obtaining an
159
- index into an array of frames and to get the overall number of
160
- id's are required. If the OS supports a method to retrieve Task
161
- ID's, and those Tasks are number 0, 1, 2... you are in an ideal
162
- situation. Otherwise, a more creative mapping function may be
163
- required. Note that this function is likely to be called twice
164
- for each protected block and once during a throw. This is the
165
- only overhead in the system.
166
-
167
- Exception.h
168
- -----------------
169
- By convention, most projects include Exception.h which defines any
170
- further requirements, then calls CException.h to do the gruntwork. All
171
- of these are optional. You could directly include CException.h if
172
- you wanted and just use the defaults provided.
173
-
174
- EXCEPTION_T - Set this to the type you want your exception id's
175
- to be. Defaults to 'unsigned int'.
176
-
177
- EXCEPTION_NONE - Set this to a number which will never be an
178
- exception id in your system. Defaults to 0x5a5a5a5a.
179
-
180
- EXCEPTION_GET_ID - If in a multi-tasking environment, this should be
181
- set to be a call to the function described in #2 above.
182
- Defaults to just return 0 all the time (good for
183
- single tasking environments)
184
-
185
- EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set
186
- to the number of ID's required (usually the number of
187
- tasks in the system). Defaults to 1 (for single
188
- tasking environments).
189
-
190
- CEXCEPTION_NO_CATCH_HANDLER(id) - This macro can be optionally specified.
191
- It allows you to specify code to be called when a Throw
192
- is made outside of Try...Catch protection. Consider
193
- this the emergency fallback plan for when something has
194
- gone terribly wrong.
195
-
196
- You may also want to include any header files which will commonly be
197
- needed by the rest of your application where it uses exception handling
198
- here. For example, OS header files or exception codes would be useful.
199
-
200
- --------------------------------------------------------------------
201
- TESTING
202
- --------------------------------------------------------------------
203
-
204
- If you want to validate that CException works with your tools or that
205
- it works with your custom configuration, you may want to run the test
206
- suite.
207
-
208
- The test suite included makes use of the Unity Test Framework. It will
209
- require a native C compiler. The example makefile uses MinGW's gcc.
210
- Modify the makefile to include the proper paths to tools, then run 'make'
211
- to compile and run the test application.
212
-
213
- C_COMPILER - The C compiler to use to perform the tests
214
- C_LIBS - The path to the C libraries (including setjmp)
215
- UNITY_DIR - The path to the Unity framework (required to run tests)
216
- (get it at http://unity.sourceforge.net)
217
-
218
- --------------------------------------------------------------------
219
- LICENSE
220
- --------------------------------------------------------------------
221
-
222
- This software is licensed under the MIT License
223
-
224
- Copyright (c) 2007-2012 Mark VanderVoord
225
-
226
- Permission is hereby granted, free of charge, to any person obtaining a copy
227
- of this software and associated documentation files (the "Software"), to deal
228
- in the Software without restriction, including without limitation the rights
229
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
230
- copies of the Software, and to permit persons to whom the Software is
231
- furnished to do so, subject to the following conditions:
232
-
233
- The above copyright notice and this permission notice shall be included in
234
- all copies or substantial portions of the Software.
235
-
236
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
237
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
238
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
239
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
240
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
241
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
242
- THE SOFTWARE.
1
+ ====================================================================
2
+ CException
3
+ ====================================================================
4
+
5
+ CException is a basic exception framework for C, suitable for use in
6
+ embedded applications. It provides an exception framework similar in
7
+ use to C++, but with much less overhead.
8
+
9
+ CException uses C standard library functions setjmp and longjmp to
10
+ operate. As long as the target system has these two functions defined,
11
+ this library should be useable with very little configuration. It
12
+ even supports environments where multiple program flows are in use,
13
+ such as real-time operating systems.
14
+
15
+ There are about a gabillion exception frameworks using a similar
16
+ setjmp/longjmp method out there... and there will probably be more
17
+ in the future. Unfortunately, when we started our last embedded
18
+ project, all those that existed either (a) did not support multiple
19
+ tasks (therefore multiple stacks) or (b) were way more complex than
20
+ we really wanted. CException was born.
21
+
22
+ Why use CException?
23
+
24
+ 0. It's ANSI C, and it beats passing error codes around.
25
+
26
+ 1. You want something simple... CException throws a single id. You can
27
+ define those ID's to be whatever you like. You might even choose which
28
+ type that number is for your project. But that's as far as it goes.
29
+ We weren't interested in passing objects or structs or strings...
30
+ just simple error codes.
31
+
32
+ 2. Performance... CException can be configured for single tasking or
33
+ multitasking. In single tasking, there is very little overhead past
34
+ the setjmp/longjmp calls (which are already fast). In multitasking,
35
+ your only additional overhead is the time it takes you to determine
36
+ a unique task id 0 - num_tasks.
37
+
38
+ For the latest version, go to http://cexception.sourceforge.net
39
+
40
+ --------------------------------------------------------------------
41
+ CONTENTS OF THIS DOCUMENT
42
+ --------------------------------------------------------------------
43
+
44
+ Usage
45
+ Limitations
46
+ API
47
+ Configuration
48
+ Testing
49
+ License
50
+
51
+ --------------------------------------------------------------------
52
+ Usage
53
+ --------------------------------------------------------------------
54
+
55
+ Code that is to be protected are wrapped in Try { } Catch { } blocks.
56
+ The code directly following the Try call is "protected", meaning that
57
+ if any Throws occur, program control is directly transferred to the
58
+ start of the Catch block.
59
+
60
+ A numerical exception ID is included with Throw, and is made accessible
61
+ from the Catch block.
62
+
63
+ Throws can occur from within function calls (nested as deeply as you
64
+ like) or directly from within the function itself.
65
+
66
+ --------------------------------------------------------------------
67
+ Limitations
68
+ --------------------------------------------------------------------
69
+
70
+ This library was made to be as fast as possible, and provide basic
71
+ exception handling. It is not a full-blown exception library. Because
72
+ of this, there are a few limitations that should be observed in order
73
+ to successfully utilize this library:
74
+
75
+ 1. Do not directly "return" from within a Try block, nor "goto"
76
+ into or out of a Try block.
77
+
78
+ Why?
79
+
80
+ The "Try" macro allocates some local memory and alters a global
81
+ pointer. These are cleaned up at the top of the "Catch" macro.
82
+ Gotos and returns would bypass some of these steps, resulting in
83
+ memory leaks or unpredictable behavior.
84
+
85
+ 2. If (a) you change local (stack) variables within your Try block,
86
+ AND (b) wish to make use of the updated values after an exception
87
+ is thrown, those variables should be made volatile. Note that this
88
+ is ONLY for locals and ONLY when you need access to them after a
89
+ throw.
90
+
91
+ Why?
92
+
93
+ Compilers optimize. There is no way to guarantee that the actual
94
+ memory location was updated and not just a register unless the
95
+ variable is marked volatile.
96
+
97
+ 3. Memory which is malloc'd or new'd is not automatically released
98
+ when an error is thrown. This will sometimes be desirable, and
99
+ othertimes may not. It will be the responsibility of the Catch
100
+ block to perform this kind of cleanup.
101
+
102
+ Why?
103
+
104
+ There's just no easy way to track malloc'd memory, etc., without
105
+ replacing or wrapping malloc calls or something like that. This
106
+ is a light framework, so these options were not desirable.
107
+
108
+ --------------------------------------------------------------------
109
+ API
110
+ --------------------------------------------------------------------
111
+
112
+ Try
113
+ ---
114
+
115
+ Try is a macro which starts a protected block. It MUST be followed by
116
+ a pair of braces or a single protected line (similar to an 'if'),
117
+ enclosing the data that is to be protected. It MUST be followed by a
118
+ Catch block (don't worry, you'll get compiler errors to let you know if
119
+ you mess any of that up).
120
+
121
+ Catch(e)
122
+ --------
123
+
124
+ Catch is a macro which ends the Try block and starts the error handling
125
+ block. The catch block is called if and only if an exception was thrown
126
+ while within the Try block. This error was thrown by a Throw call
127
+ somewhere within Try (or within a function called within Try, or a function
128
+ called by a function called within Try, etc).
129
+
130
+ The single parameter 'e' is filled with the error code which was thrown.
131
+ This can be used for reporting, conditional cleanup, etc. (or you can just
132
+ ignore it if you really want... people ignore return codes all the time,
133
+ right?). 'e' should be of type EXCEPTION_T;
134
+
135
+ Throw(e)
136
+ --------
137
+
138
+ The method of throwing an error. Throws should only occur from within a
139
+ protected (Try...Catch) block, though it may easily be nested many function
140
+ calls deep without an impact on performance or functionality. Throw takes
141
+ a single argument, which is an exception id which will be passed to Catch
142
+ as the reason for the error.
143
+
144
+ If you wish to Rethrow an error, this can be done by calling Throw(e) with
145
+ the error code you just caught. It IS valid to throw from a catch block.
146
+
147
+ ExitTry()
148
+ ---------
149
+
150
+ On rare occasion, you might want to immediately exit your current Try block
151
+ but NOT treat this as an error. Don't run the Catch. Just start executing
152
+ from after the Catch as if nothing had happened... That's what ExitTry is
153
+ for.
154
+
155
+ --------------------------------------------------------------------
156
+ CONFIGURATION
157
+ --------------------------------------------------------------------
158
+
159
+ CException is a mostly portable library. It has one universal
160
+ dependency, and some macros which are required if working in a
161
+ multi-tasking environment.
162
+
163
+ 1. The standard C library setjmp must be available. Since this is part
164
+ of the standard library, chances are good that you'll be fine.
165
+
166
+ 2. If working in a multitasking environment, methods for obtaining an
167
+ index into an array of frames and to get the overall number of
168
+ id's are required. If the OS supports a method to retrieve Task
169
+ ID's, and those Tasks are number 0, 1, 2... you are in an ideal
170
+ situation. Otherwise, a more creative mapping function may be
171
+ required. Note that this function is likely to be called twice
172
+ for each protected block and once during a throw. This is the
173
+ only overhead in the system.
174
+
175
+ Exception.h
176
+ -----------------
177
+ By convention, most projects include Exception.h which defines any
178
+ further requirements, then calls CException.h to do the gruntwork. All
179
+ of these are optional. You could directly include CException.h if
180
+ you wanted and just use the defaults provided.
181
+
182
+ EXCEPTION_T - Set this to the type you want your exception id's
183
+ to be. Defaults to 'unsigned int'.
184
+
185
+ EXCEPTION_NONE - Set this to a number which will never be an
186
+ exception id in your system. Defaults to 0x5a5a5a5a.
187
+
188
+ EXCEPTION_GET_ID - If in a multi-tasking environment, this should be
189
+ set to be a call to the function described in #2 above.
190
+ Defaults to just return 0 all the time (good for
191
+ single tasking environments)
192
+
193
+ EXCEPTION_NUM_ID - If in a multi-tasking environment, this should be set
194
+ to the number of ID's required (usually the number of
195
+ tasks in the system). Defaults to 1 (for single
196
+ tasking environments).
197
+
198
+ CEXCEPTION_NO_CATCH_HANDLER(id) - This macro can be optionally specified.
199
+ It allows you to specify code to be called when a Throw
200
+ is made outside of Try...Catch protection. Consider
201
+ this the emergency fallback plan for when something has
202
+ gone terribly wrong.
203
+
204
+ You may also want to include any header files which will commonly be
205
+ needed by the rest of your application where it uses exception handling
206
+ here. For example, OS header files or exception codes would be useful.
207
+
208
+ Finally, there are some hook macros which you can implement to inject
209
+ your own target-specific code in particular places. It is a rare instance
210
+ where you will need these, but they are here if you need them:
211
+
212
+ CEXCEPTION_HOOK_START_TRY - called immediately before the Try block
213
+ CEXCEPTION_HOOK_HAPPY_TRY - called immediately after the Try block
214
+ if no exception was thrown
215
+ CEXCEPTION_HOOK_AFTER_TRY - called immediately after the Try block
216
+ OR before an exception is caught
217
+ CEXCEPTION_HOOK_START_CATCH - called immediately before the catch
218
+
219
+ --------------------------------------------------------------------
220
+ TESTING
221
+ --------------------------------------------------------------------
222
+
223
+ If you want to validate that CException works with your tools or that
224
+ it works with your custom configuration, you may want to run the test
225
+ suite.
226
+
227
+ The test suite included makes use of the Unity Test Framework. It will
228
+ require a native C compiler. The example makefile uses MinGW's gcc.
229
+ Modify the makefile to include the proper paths to tools, then run 'make'
230
+ to compile and run the test application.
231
+
232
+ C_COMPILER - The C compiler to use to perform the tests
233
+ C_LIBS - The path to the C libraries (including setjmp)
234
+ UNITY_DIR - The path to the Unity framework (required to run tests)
235
+ (get it at http://unity.sourceforge.net)
236
+
237
+ --------------------------------------------------------------------
238
+ LICENSE
239
+ --------------------------------------------------------------------
240
+
241
+ This software is licensed under the MIT License
242
+
243
+ Copyright (c) 2007-2016 Mark VanderVoord
244
+
245
+ Permission is hereby granted, free of charge, to any person obtaining a copy
246
+ of this software and associated documentation files (the "Software"), to deal
247
+ in the Software without restriction, including without limitation the rights
248
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
+ copies of the Software, and to permit persons to whom the Software is
250
+ furnished to do so, subject to the following conditions:
251
+
252
+ The above copyright notice and this permission notice shall be included in
253
+ all copies or substantial portions of the Software.
254
+
255
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
261
+ THE SOFTWARE.