acpc_dealer 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -2
  3. data/lib/acpc_dealer.rb +6 -2
  4. data/lib/acpc_dealer/version.rb +1 -1
  5. data/vendor/project_acpc_server/Makefile +12 -2
  6. data/vendor/project_acpc_server/README +1 -0
  7. data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -1
  8. data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -1
  9. data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -1
  10. data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -1
  11. data/vendor/project_acpc_server/kuhn.limit.3p.game +14 -0
  12. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +3 -0
  13. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +3 -0
  14. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +3 -0
  15. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +23 -0
  16. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +128 -0
  17. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +35 -0
  18. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +12 -0
  19. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +49 -0
  20. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +22 -0
  21. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +483 -0
  22. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +107 -0
  23. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +84 -0
  24. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +252 -0
  25. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +21 -0
  26. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +45 -0
  27. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +27 -0
  28. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +698 -0
  29. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +324 -0
  30. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +262 -0
  31. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +177 -0
  32. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.odt +0 -0
  33. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.pdf +0 -0
  34. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +30 -0
  35. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +242 -0
  36. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +43 -0
  37. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +86 -0
  38. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +2 -0
  39. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +2 -0
  40. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/production_environment.rb +14 -0
  41. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/test_environment.rb +16 -0
  42. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.odt +0 -0
  43. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.pdf +0 -0
  44. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock_Summary.md +356 -0
  45. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/license.txt +31 -0
  46. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  47. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  48. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  49. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  50. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  51. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  52. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
  53. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
  54. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
  55. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
  56. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
  57. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  58. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  59. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  60. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
  61. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
  62. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  63. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  64. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  65. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
  66. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  67. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  68. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
  69. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  70. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  71. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  72. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  73. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  74. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
  75. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
  76. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
  77. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
  78. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
  79. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
  80. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  81. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
  82. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  83. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  84. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  85. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  86. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  87. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  88. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  89. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
  90. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  91. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  92. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  93. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  94. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  95. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
  96. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock.rb +65 -0
  97. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_config.rb +129 -0
  98. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_file_writer.rb +33 -0
  99. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator.rb +195 -0
  100. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_array.rb +57 -0
  101. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_callback.rb +78 -0
  102. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +51 -0
  103. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_expect.rb +86 -0
  104. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +95 -0
  105. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
  106. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
  107. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_utils.rb +202 -0
  108. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_header_parser.rb +277 -0
  109. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_plugin_manager.rb +40 -0
  110. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -0
  111. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/build.info +2 -0
  112. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/version.info +2 -0
  113. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.c +176 -0
  114. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.h +31 -0
  115. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock_internals.h +43 -0
  116. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/gcc.yml +53 -0
  117. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v4.yml +108 -0
  118. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v5.yml +93 -0
  119. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +27 -0
  120. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +8 -0
  121. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +103 -0
  122. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +9 -0
  123. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +250 -0
  124. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +88 -0
  125. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +34 -0
  126. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +94 -0
  127. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +39 -0
  128. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +36 -0
  129. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +202 -0
  130. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +316 -0
  131. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +23 -0
  132. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +139 -0
  133. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.odt +0 -0
  134. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.pdf +0 -0
  135. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +216 -0
  136. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +31 -0
  137. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +2 -0
  138. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +2 -0
  139. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +1146 -0
  140. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +245 -0
  141. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +546 -0
  142. data/vendor/project_acpc_server/net.c +0 -0
  143. data/vendor/project_acpc_server/net.h +1 -0
  144. data/vendor/project_acpc_server/tags +298 -0
  145. metadata +158 -26
@@ -0,0 +1,43 @@
1
+ #include "CException.h"
2
+
3
+ volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID] = { 0 };
4
+
5
+ //------------------------------------------------------------------------------------------
6
+ // Throw
7
+ //------------------------------------------------------------------------------------------
8
+ void Throw(CEXCEPTION_T ExceptionID)
9
+ {
10
+ unsigned int MY_ID = CEXCEPTION_GET_ID;
11
+ CExceptionFrames[MY_ID].Exception = ExceptionID;
12
+ if (CExceptionFrames[MY_ID].pFrame)
13
+ {
14
+ longjmp(*CExceptionFrames[MY_ID].pFrame, 1);
15
+ }
16
+ CEXCEPTION_NO_CATCH_HANDLER(MY_ID);
17
+ }
18
+
19
+ //------------------------------------------------------------------------------------------
20
+ // Explanation of what it's all for:
21
+ //------------------------------------------------------------------------------------------
22
+ /*
23
+ #define Try
24
+ { <- give us some local scope. most compilers are happy with this
25
+ jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block
26
+ unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking
27
+ PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at)
28
+ CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now
29
+ CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE
30
+ if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0
31
+ if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point.
32
+
33
+ #define Catch(e)
34
+ else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly
35
+ CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted)
36
+ }
37
+ else <- an exception occurred
38
+ { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in.
39
+ CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed.
40
+ } <- finish off that local scope we created to have our own variables
41
+ if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away
42
+ */
43
+
@@ -0,0 +1,86 @@
1
+ #ifndef _CEXCEPTION_H
2
+ #define _CEXCEPTION_H
3
+
4
+ #include <setjmp.h>
5
+
6
+ #ifdef __cplusplus
7
+ extern "C"
8
+ {
9
+ #endif
10
+
11
+
12
+ //To Use CException, you have a number of options:
13
+ //1. Just include it and run with the defaults
14
+ //2. Define any of the following symbols at the command line to override them
15
+ //3. Include a header file before CException.h everywhere which defines any of these
16
+ //4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first
17
+
18
+ #ifdef CEXCEPTION_USE_CONFIG_FILE
19
+ #include "CExceptionConfig.h"
20
+ #endif
21
+
22
+ //This is the value to assign when there isn't an exception
23
+ #ifndef CEXCEPTION_NONE
24
+ #define CEXCEPTION_NONE (0x5A5A5A5A)
25
+ #endif
26
+
27
+ //This is number of exception stacks to keep track of (one per task)
28
+ #ifndef CEXCEPTION_NUM_ID
29
+ #define CEXCEPTION_NUM_ID (1) //there is only the one stack by default
30
+ #endif
31
+
32
+ //This is the method of getting the current exception stack index (0 if only one stack)
33
+ #ifndef CEXCEPTION_GET_ID
34
+ #define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway
35
+ #endif
36
+
37
+ //The type to use to store the exception values.
38
+ #ifndef CEXCEPTION_T
39
+ #define CEXCEPTION_T unsigned int
40
+ #endif
41
+
42
+ //This is an optional special handler for when there is no global Catch
43
+ #ifndef CEXCEPTION_NO_CATCH_HANDLER
44
+ #define CEXCEPTION_NO_CATCH_HANDLER(id)
45
+ #endif
46
+
47
+ //exception frame structures
48
+ typedef struct {
49
+ jmp_buf* pFrame;
50
+ CEXCEPTION_T volatile Exception;
51
+ } CEXCEPTION_FRAME_T;
52
+
53
+ //actual root frame storage (only one if single-tasking)
54
+ extern volatile CEXCEPTION_FRAME_T CExceptionFrames[];
55
+
56
+ //Try (see C file for explanation)
57
+ #define Try \
58
+ { \
59
+ jmp_buf *PrevFrame, NewFrame; \
60
+ unsigned int MY_ID = CEXCEPTION_GET_ID; \
61
+ PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \
62
+ CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \
63
+ CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \
64
+ if (setjmp(NewFrame) == 0) { \
65
+ if (1)
66
+
67
+ //Catch (see C file for explanation)
68
+ #define Catch(e) \
69
+ else { } \
70
+ CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \
71
+ } \
72
+ else \
73
+ { e = CExceptionFrames[MY_ID].Exception; e=e; } \
74
+ CExceptionFrames[MY_ID].pFrame = PrevFrame; \
75
+ } \
76
+ if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE)
77
+
78
+ //Throw an Error
79
+ void Throw(CEXCEPTION_T ExceptionID);
80
+
81
+ #ifdef __cplusplus
82
+ } // extern "C"
83
+ #endif
84
+
85
+
86
+ #endif // _CEXCEPTION_H
@@ -0,0 +1,14 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ # Setup our load path:
8
+ [
9
+ 'lib',
10
+ ].each do |dir|
11
+ $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) )
12
+ end
13
+
14
+
@@ -0,0 +1,16 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ # Setup our load path:
8
+ [
9
+ 'lib',
10
+ 'vendor/behaviors/lib',
11
+ 'vendor/hardmock/lib',
12
+ 'vendor/unity/auto/',
13
+ 'test/system/'
14
+ ].each do |dir|
15
+ $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) )
16
+ end
@@ -0,0 +1,356 @@
1
+ [All code is copyright © 2007-2010 Cmock Project
2
+ by Mike Karlesky, Mark VanderVoord, and Greg Williams.
3
+
4
+ This Documentation Is Released Under a Creative Commons 3.0
5
+ Attribution Share-Alike License]
6
+
7
+
8
+ What the What?
9
+ ==============
10
+
11
+ CMock is a nice little tool which takes your header files and creates
12
+ a Mock interface for it so that you can more easily Unit test modules
13
+ that touch other modules. For each function prototype in your
14
+ header, like this one:
15
+
16
+ int DoesSomething(int a, int b);
17
+
18
+
19
+ ...you get an automatically generated DoesSomething function
20
+ that you can link to instead of your real DoesSomething function.
21
+ By using this Mocked version, you can then verify that it receives
22
+ the data you want, and make it return whatever data you desire,
23
+ make it throw errors when you want, and more... Create these for
24
+ everything your latest real module touches, and you're suddenly
25
+ in a position of power: You can control and verify every detail
26
+ of your latest creation.
27
+
28
+ To make that easier, CMock also gives you a bunch of functions
29
+ like the ones below, so you can tell that generated DoesSomething
30
+ function how to behave for each test:
31
+
32
+ void DoesSomething_ExpectAndReturn(int a, int b, int toReturn);
33
+ void DoesSomething_ExpectAndThrow(int a, int b, EXCEPTION_T error);
34
+ void DoesSomething_StubWithCallback(CMOCK_DoesSomething_CALLBACK YourCallback);
35
+ void DoesSomething_IgnoreAndReturn(int toReturn);
36
+
37
+
38
+ You can pile a bunch of these back to back, and it remembers what
39
+ you wanted to pass when, like so:
40
+
41
+ test_CallsDoesSomething_ShouldDoJustThat(void)
42
+ {
43
+ DoesSomething_ExpectAndReturn(1,2,3);
44
+ DoesSomething_ExpectAndReturn(4,5,6);
45
+ DoesSomething_ExpectAndThrow(7,8, STATUS_ERROR_OOPS);
46
+
47
+ CallsDoesSomething( );
48
+ }
49
+
50
+
51
+ This test will call CallsDoesSomething, which is the function
52
+ we are testing. We are expecting that function to call DoesSomething
53
+ three times. The first time, we check to make sure it's called
54
+ as DoesSomething(1, 2) and we'll magically return a 3. The second
55
+ time we check for DoesSomething(4, 5) and we'll return a 6. The
56
+ third time we verify DoesSomething(7, 8) and we'll throw an error
57
+ instead of returning anything. If CallsDoesSomething gets
58
+ any of this wrong, it fails the test. It will fail if you didn't
59
+ call DoesSomething enough, or too much, or with the wrong arguments,
60
+ or in the wrong order.
61
+
62
+ CMock is based on Unity, which it uses for all internal testing.
63
+ It uses Ruby to do all the main work (versions 1.8.6 through 1.9.2).
64
+
65
+
66
+ Generated Mock Module Summary
67
+ =============================
68
+
69
+ In addition to the mocks themselves, CMock will generate the
70
+ following functions for use in your tests. The expect functions
71
+ are always generated. The other functions are only generated
72
+ if those plugins are enabled:
73
+
74
+
75
+ Expect:
76
+ -------
77
+
78
+ Your basic staple Expects which will be used for most of your day
79
+ to day CMock work.
80
+
81
+ * `void func(void)` => `void func_Expect(void)`
82
+ * `void func(params)` => `void func_Expect(expected_params)`
83
+ * `retval func(void)` => `void func_ExpectAndReturn(retval_to_return)`
84
+ * `retval func(params)` => `void func_ExpectAndReturn(expected_params, retval_to_return)`
85
+
86
+
87
+ Array:
88
+ ------
89
+
90
+ An ExpectWithArray will check as many elements as you specify.
91
+ If you specify zero elements, it will check just the pointer if
92
+ `:smart` mode is configured or fail if `:compare_data` is set.
93
+
94
+ * `void func(void)` => (nothing. In fact, an additional function is only generated if the params list contains pointers)
95
+ * `void func(ptr * param, other)` => `void func_ExpectWithArray(ptr* param, int param_depth, other)`
96
+ * `retval func(void)` => (nothing. In fact, an additional function is only generated if the params list contains pointers)
97
+ * `retval func(other, ptr* param)` => `void func_ExpectWithArrayAndReturn(other, ptr* param, int param_depth, retval_to_return)`
98
+
99
+
100
+ Callback:
101
+ ---------
102
+
103
+ As soon as you stub a callback in a test, it will call the callback
104
+ whenever the mock is encountered and return the retval returned
105
+ from the callback (if any) instead of performing the usual expect
106
+ checks. It can be configured to check the arguments first (like
107
+ expects) or just jump directly to the callback.
108
+
109
+ * `void func(void)` => `void func_StubWithCallback(CMOCK_func_CALLBACK callback)`
110
+ where `CMOCK_func_CALLBACK` looks like: `void func(int NumCalls)`
111
+ * `void func(params)` => `void func_StubWithCallback(CMOCK_func_CALLBACK callback)`
112
+ where `CMOCK_func_CALLBACK` looks like: `void func(params, int NumCalls)`
113
+ * `retval func(void)` => `void func_StubWithCallback(CMOCK_func_CALLBACK callback)`
114
+ where `CMOCK_func_CALLBACK` looks like: `retval func(int NumCalls)`
115
+ * `retval func(params)` => `void func_StubWithCallback(CMOCK_func_CALLBACK callback)`
116
+ where `CMOCK_func_CALLBACK` looks like: `retval func(params, int NumCalls)`
117
+
118
+
119
+ Cexception:
120
+ -----------
121
+
122
+ If you are using Cexception for error handling, you can use this
123
+ to throw errors from inside mocks. Like Expects, it remembers
124
+ which call was supposed to throw the error, and it still checks
125
+ parameters.
126
+
127
+ * `void func(void)` => `void func_ExpectAndThrow(value_to_throw)`
128
+ * `void func(params)` => `void func_ExpectAndThrow(expected_params, value_to_throw)`
129
+ * `retval func(void)` => `void func_ExpectAndThrow(value_to_throw)`
130
+ * `retval func(params)` => `void func_ExpectAndThrow(expected_params, value_to_throw)`
131
+
132
+
133
+ Ignore:
134
+ -------
135
+
136
+ This plugin supports two modes. You can use it to force CMock to
137
+ ignore calls to specific functions or to just ignore the arguments
138
+ passed to those functions. Either way you can specify multiple
139
+ returns or a single value to always return, whichever you prefer.
140
+
141
+ * `void func(void)` => `void func_Ignore(void)`
142
+ * `void func(params)` => `void func_Ignore(void)`
143
+ * `retval func(void)` => `void func_IgnoreAndReturn(retval_to_return)`
144
+ * `retval func(params)` => `void func_IgnoreAndReturn(retval_to_return)`
145
+
146
+
147
+ Running CMock
148
+ =============
149
+
150
+ CMock is a Ruby script and class. You can therefore use it directly
151
+ from the command line, or include it in your own scripts or rakefiles.
152
+
153
+ Mocking from the Command Line
154
+ -----------------------------
155
+
156
+ After unpacking CMock, you will find CMock.rb in the 'lib' directory.
157
+ This is the file that you want to run. It takes a list of header files
158
+ to be mocked, as well as an optional yaml file for a more detailed
159
+ configuration (see config options below).
160
+
161
+ For example, this will create three mocks using the configuration
162
+ specified in MyConfig.yml:
163
+
164
+ ruby cmock.rb -oMyConfig.yml super.h duper.h awesome.h
165
+
166
+ And this will create two mocks using the default configuration:
167
+
168
+ ruby cmock.rb ../mocking/stuff/is/fun.h ../try/it/yourself.h
169
+
170
+ Mocking From Scripts or Rake
171
+ ----------------------------
172
+
173
+ CMock can be used directly from your own scripts or from a rakefile.
174
+ Start by including cmock.rb, then create an instance of CMock.
175
+ When you create your instance, you may initialize it in one of
176
+ three ways.
177
+
178
+ You may specify nothing, allowing it to run with default settings:
179
+
180
+ cmock = CMock.new
181
+
182
+ You may specify a YAML file containing the configuration options
183
+ you desire:
184
+
185
+ cmock = CMock.new('../MyConfig.yml')
186
+
187
+ You may specify the options explicitly:
188
+
189
+ cmock = Cmock.new(:plugins => [:cexception, :ignore], :mock_path => 'my/mocks/')
190
+
191
+ Config Options:
192
+
193
+ The following configuration options can be specified in the
194
+ yaml file or directly when instantiating.
195
+
196
+ Passed as Ruby, they look like this:
197
+
198
+ { :attributes => [“__funky”, “__intrinsic”], :when_ptr => :compare }
199
+
200
+ Defined in the yaml file, they look more like this:
201
+
202
+ :cmock:
203
+ :attributes:
204
+ - __funky
205
+ - __intrinsic
206
+ :when_ptr: :compare
207
+
208
+
209
+ * `:attributes`:
210
+ These are attributes that CMock should ignore for you for testing
211
+ purposes. Custom compiler extensions and externs are handy things to
212
+ put here.
213
+
214
+ * `:callback_after_arg_check`:
215
+ Tell `:callback` plugin to do the normal argument checking before it
216
+ calls the callback function. This defaults to false, where the
217
+ callback function is called instead of the argument verification.
218
+
219
+ * `:callback_include_count`:
220
+ Tell `:callback` plugin to include an extra parameter to specify the
221
+ number of times the callback has been called. If set to false, the
222
+ callback has the same interface as the mocked function. This can be
223
+ handy when you're wanting to use callback as a stub.
224
+
225
+ * `:cexception_include`:
226
+ Tell `:cexception` plugin where to find CException.h... only need to
227
+ define if it's not in your build path already.
228
+
229
+ * `:enforce_strict_ordering`:
230
+ CMock always enforces the order that you call a particular function,
231
+ so if you expect GrabNabber(int size) to be called three times, it
232
+ will verify that the sizes are in the order you specified. You might
233
+ also want to make sure that all different functions are called in a
234
+ particular order. If so, set this to true.
235
+
236
+ * `:framework`:
237
+ Currently the only option is `:unity.` Eventually if we support other
238
+ unity test frameworks (or if you write one for us), they'll get added
239
+ here.
240
+
241
+ * `:ignore`:
242
+ Tell `:ignore` plugin to ignore `:args_only` or `:args_and_calls`
243
+ (default) where it doesn't even care how many times the mock was
244
+ called
245
+
246
+ * `:includes`:
247
+ An array of additional include files which should be added to the
248
+ mocks. Useful for global types and definitions used in your project.
249
+ There are more specific versions if you care WHERE in the mock files
250
+ the includes get placed. You can define any or all of
251
+ `:includes_h_pre_orig_header,` `:includes_h_post_orig_header, `
252
+ `:includes_c_pre_header,` `:includes_c_post_header
253
+
254
+ * `:memcmp_if_unknown`:
255
+ This is true by default. When true, CMock will just do a memory
256
+ comparison of types that it doesn't recognize (not standard types, not
257
+ in `:treat_as,` and not in a unity helper). If you instead want it to
258
+ throw an error, just set this to false.
259
+
260
+ * `:mock_path`:
261
+ The directory where you would like the mock files generated to be
262
+ placed.
263
+
264
+ * `:mock_prefix`:
265
+ The prefix to append to your mock files. Defaults to “Mock”, so a file
266
+ “USART.h” will get a mock called “MockUSART.c”
267
+
268
+ * `:plugins`:
269
+ An array of which plugins to enable. 'expect' is always active. Also
270
+ available currently are `:ignore,` `:array,` `:cexception,` and
271
+ `:callback:
272
+
273
+ * `:treat_as`:
274
+ The `:treat_as` list is a shortcut for when you have created typedefs
275
+ of standard types. Why create a custom unity helper for UINT16 when
276
+ the unity function TEST_ASSERT_EQUAL_HEX16 will work just perfectly?
277
+ Just add 'UINT16' => 'HEX16' to your list (actually, don't. We already
278
+ did that one for you). Maybe you have a type that is a pointer to an
279
+ array of unsigned characters? No problem, just add 'UINT8_T*' =>
280
+ 'HEX8*'
281
+
282
+ * `:treat_as_void`:
283
+ We've seen "fun" legacy systems typedef 'void' with a custom type,
284
+ like MY_VOID. Add any instances of those to this list to help CMock
285
+ understand how to deal with your code.
286
+
287
+ * `:treat_externs`:
288
+ Set to `:include` to mock externed functions or `:exclude` to ignore
289
+ them (the default).
290
+
291
+ * `:unity_helper_path`:
292
+ If you have created a header with your own extensions to unity to
293
+ handle your own types, you can set this argument to that path. CMock
294
+ will then automagically pull in your helpers and use them. The only
295
+ trick is that you make sure you follow the naming convention:
296
+ UNITY_TEST_ASSERT_EQUAL_YourType
297
+
298
+ * `:verbosity`:
299
+ 0 for errors only. 1 for errors and warnings. 2 for normal. 3 for
300
+ verbose
301
+
302
+ * `:when_no_prototypes`:
303
+ When you give CMock a header file and ask it to create a mock out of
304
+ it, it usually contains function prototypes (otherwise what was the
305
+ point?). You can control what happens when this isn't true. You can
306
+ set this to `:warn,` `:ignore,` or `:error
307
+
308
+ * `:when_ptr`:
309
+ You can customize how CMock deals with pointers (c strings result in
310
+ string comparisons... we're talking about other pointers here). Your
311
+ options are `:compare_ptr` to just verify the pointers are the same,
312
+ `:compare_data` or `:smart` to verify that the data is the same.
313
+ `:compare_data` and `:smart` behaviors will change slightly based on
314
+ if you have the array plugin enabled. By default, they compare a
315
+ single element of what is being pointed to. So if you have a pointer
316
+ to a struct called ORGAN_T, it will compare one ORGAN_T (whatever that
317
+ is).
318
+
319
+
320
+ Compiled Options:
321
+ -----------------
322
+
323
+ A number of #defines also exist for customizing the cmock experience.
324
+
325
+ CMOCK_MEM_STATIC or CMOCK_MEM_DYNAMIC
326
+
327
+ Define one of these to determine if you want to dynamically add
328
+ memory during tests as required from the heap. If static, you
329
+ can control the total footprint of Cmock. If dynamic, you will
330
+ need to make sure you make some heap space available for Cmock.
331
+
332
+ CMOCK_MEM_SIZE
333
+
334
+ In static mode this is the total amount of memory you are allocating
335
+ to Cmock. In Dynamic mode this is the size of each chunk allocated
336
+ at once (larger numbers grab more memory but require less mallocs).
337
+
338
+ CMOCK_MEM_ALIGN
339
+
340
+ The way to align your data to. Not everything is as flexible as
341
+ a PC, as most embedded designers know. This defaults to 2, meaning
342
+ align to the closest 2^2 -> 4 bytes (32 bits). You can turn off alignment
343
+ by setting 0, force alignment to the closest uint16 with 1 or even
344
+ to the closest uint64 with 3.
345
+
346
+ CMOCK_MEM_PTR_AS_INT
347
+
348
+ This is used internally to hold pointers... it needs to be big
349
+ enough. On most processors a pointer is the same as an unsigned
350
+ long... but maybe that's not true for yours?
351
+
352
+ CMOCK_MEM_INDEX_TYPE
353
+
354
+ This needs to be something big enough to point anywhere in Cmock's
355
+ memory space... usually it's an unsigned int.
356
+