acpc_dealer 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/acpc_dealer/version.rb +1 -1
  3. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +0 -1
  4. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +1 -1
  5. metadata +1 -85
  6. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.odt +0 -0
  7. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.pdf +0 -0
  8. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/production_environment.rb +0 -14
  9. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/test_environment.rb +0 -16
  10. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.odt +0 -0
  11. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.pdf +0 -0
  12. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock_Summary.md +0 -356
  13. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/license.txt +0 -31
  14. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +0 -71
  15. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +0 -94
  16. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +0 -67
  17. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +0 -185
  18. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +0 -185
  19. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +0 -2259
  20. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.dep +0 -3691
  21. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewd +0 -1696
  22. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewp +0 -2581
  23. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.eww +0 -10
  24. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +0 -61
  25. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +0 -2314
  26. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +0 -4704
  27. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +0 -3407
  28. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +0 -2268
  29. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +0 -4380
  30. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +0 -4211
  31. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +0 -32
  32. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +0 -86
  33. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +0 -42
  34. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +0 -76
  35. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +0 -266
  36. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +0 -98
  37. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +0 -71
  38. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +0 -94
  39. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +0 -67
  40. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +0 -43
  41. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +0 -42
  42. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.dep +0 -4204
  43. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewd +0 -1906
  44. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewp +0 -2426
  45. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.eww +0 -26
  46. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +0 -61
  47. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +0 -2268
  48. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +0 -4211
  49. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/project.h +0 -30
  50. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +0 -33
  51. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +0 -5
  52. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +0 -18
  53. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +0 -74
  54. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +0 -12
  55. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +0 -33
  56. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +0 -85
  57. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +0 -44
  58. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +0 -73
  59. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +0 -12
  60. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +0 -12
  61. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +0 -12
  62. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +0 -299
  63. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +0 -98
  64. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock.rb +0 -65
  65. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_config.rb +0 -129
  66. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_file_writer.rb +0 -33
  67. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator.rb +0 -195
  68. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_array.rb +0 -57
  69. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_callback.rb +0 -78
  70. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +0 -51
  71. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_expect.rb +0 -86
  72. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +0 -95
  73. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +0 -44
  74. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +0 -74
  75. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_utils.rb +0 -202
  76. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_header_parser.rb +0 -277
  77. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_plugin_manager.rb +0 -40
  78. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_unityhelper_parser.rb +0 -75
  79. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/build.info +0 -2
  80. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/version.info +0 -2
  81. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.c +0 -176
  82. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.h +0 -31
  83. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock_internals.h +0 -43
  84. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/gcc.yml +0 -53
  85. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v4.yml +0 -108
  86. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v5.yml +0 -93
  87. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.odt +0 -0
  88. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.pdf +0 -0
  89. data/vendor/project_acpc_server/tags +0 -298
@@ -1,277 +0,0 @@
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
- class CMockHeaderParser
8
-
9
- attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs
10
-
11
- def initialize(cfg)
12
- @funcs = []
13
- @c_strippables = cfg.strippables
14
- @c_attributes = (['const'] + cfg.attributes).uniq
15
- @c_calling_conventions = cfg.c_calling_conventions.uniq
16
- @treat_as_void = (['void'] + cfg.treat_as_void).uniq
17
- @declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m
18
- @standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq
19
- @when_no_prototypes = cfg.when_no_prototypes
20
- @local_as_void = @treat_as_void
21
- @verbosity = cfg.verbosity
22
- @treat_externs = cfg.treat_externs
23
- @c_strippables += ['extern'] if (@treat_externs == :include) #we'll need to remove the attribute if we're allowing externs
24
- end
25
-
26
- def parse(name, source)
27
- @module_name = name.gsub(/\W/,'')
28
- @typedefs = []
29
- @funcs = []
30
- function_names = []
31
-
32
- parse_functions( import_source(source) ).map do |decl|
33
- func = parse_declaration(decl)
34
- unless (function_names.include? func[:name])
35
- @funcs << func
36
- function_names << func[:name]
37
- end
38
- end
39
-
40
- { :includes => nil,
41
- :functions => @funcs,
42
- :typedefs => @typedefs
43
- }
44
- end
45
-
46
- private if $ThisIsOnlyATest.nil? ################
47
-
48
- def import_source(source)
49
-
50
- # void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void
51
- # to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void
52
- @local_as_void = @treat_as_void
53
- void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w\d]+)\s*;/)
54
- if void_types
55
- @local_as_void += void_types.flatten.uniq.compact
56
- end
57
-
58
- # smush multiline macros into single line (checking for continuation character at end of line '\')
59
- source.gsub!(/\s*\\\s*/m, ' ')
60
-
61
- #remove comments (block and line, in three steps to ensure correct precedence)
62
- source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
63
- source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
64
- source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
65
-
66
- # remove assembler pragma sections
67
- source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
68
-
69
- # remove gcc's __attribute__ tags
70
- source.gsub(/__attrbute__\s*\(\(\.*\)\)/, '')
71
-
72
- # remove preprocessor statements and extern "C"
73
- source.gsub!(/^\s*#.*/, '')
74
- source.gsub!(/extern\s+\"C\"\s+\{/, '')
75
-
76
- # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them
77
- # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes
78
- source.gsub!(/^[\w\s]*struct[^;\{\}\(\)]+;/m, '') # remove forward declared structs
79
- source.gsub!(/^[\w\s]*(enum|union|struct|typepdef)[\w\s]*\{[^\}]+\}[\w\s\*\,]*;/m, '') # remove struct, union, and enum definitions and typedefs with braces
80
- source.gsub!(/(\W)(?:register|auto|static|restrict)(\W)/, '\1\2') # remove problem keywords
81
- source.gsub!(/\s*=\s*['"a-zA-Z0-9_\.]+\s*/, '') # remove default value statements from argument lists
82
- source.gsub!(/^(?:[\w\s]*\W)?typedef\W.*/, '') # remove typedef statements
83
- source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped
84
-
85
- #scan for functions which return function pointers, because they are a pain
86
- source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m|
87
- functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}"
88
- @typedefs << "typedef #{$1.strip}(*#{functype})(#{$4});"
89
- "#{functype} #{$2.strip}(#{$3});"
90
- end
91
-
92
- #drop extra white space to make the rest go faster
93
- source.gsub!(/^\s+/, '') # remove extra white space from beginning of line
94
- source.gsub!(/\s+$/, '') # remove extra white space from end of line
95
- source.gsub!(/\s*\(\s*/, '(') # remove extra white space from before left parens
96
- source.gsub!(/\s*\)\s*/, ')') # remove extra white space from before right parens
97
- source.gsub!(/\s+/, ' ') # remove remaining extra white space
98
-
99
- #split lines on semicolons and remove things that are obviously not what we are looking for
100
- src_lines = source.split(/\s*;\s*/)
101
- src_lines.delete_if {|line| line.strip.length == 0} # remove blank lines
102
- src_lines.delete_if {|line| !(line =~ /[\w\s\*]+\(+\s*\*[\*\s]*[\w\s]+(?:\[[\w\s]*\]\s*)+\)+\s*\((?:[\w\s\*]*,?)*\s*\)/).nil?} #remove function pointer arrays
103
- if (@treat_externs == :include)
104
- src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:inline)\s+/).nil?} # remove inline functions
105
- else
106
- src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:extern|inline)\s+/).nil?} # remove inline and extern functions
107
- end
108
- end
109
-
110
- def parse_functions(source)
111
- funcs = []
112
- source.each {|line| funcs << line.strip.gsub(/\s+/, ' ') if (line =~ @declaration_parse_matcher)}
113
- if funcs.empty?
114
- case @when_no_prototypes
115
- when :error
116
- raise "ERROR: No function prototypes found!"
117
- when :warn
118
- puts "WARNING: No function prototypes found!" unless (@verbosity < 1)
119
- end
120
- end
121
- return funcs
122
- end
123
-
124
- def parse_args(arg_list)
125
- args = []
126
- arg_list.split(',').each do |arg|
127
- arg.strip!
128
- return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ...
129
- arg_array = arg.split
130
- arg_elements = arg_array - @c_attributes # split up words and remove known attributes
131
- args << { :type => (arg_type =arg_elements[0..-2].join(' ')),
132
- :name => arg_elements[-1],
133
- :ptr? => divine_ptr(arg_type),
134
- :const? => arg_array.include?('const')
135
- }
136
- end
137
- return args
138
- end
139
-
140
- def divine_ptr(arg_type)
141
- return false unless arg_type.include? '*'
142
- return false if arg_type.gsub(/(const|char|\*|\s)+/,'').empty?
143
- return true
144
- end
145
-
146
- def clean_args(arg_list)
147
- if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?))
148
- return 'void'
149
- else
150
- c=0
151
- arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks
152
- arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong)
153
- arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong)
154
-
155
- #scan argument list for function pointers and replace them with custom types
156
- arg_list.gsub!(/([\w\s\*]+)\(+\s*\*[\*\s]*([\w\s]*)\s*\)+\s*\(((?:[\w\s\*]*,?)*)\s*\)*/) do |m|
157
-
158
- functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}"
159
- funcret = $1.strip
160
- funcname = $2.strip
161
- funcargs = $3.strip
162
- funconst = ''
163
- if (funcname.include? 'const')
164
- funcname.gsub!('const','').strip!
165
- funconst = 'const '
166
- end
167
- @typedefs << "typedef #{funcret}(*#{functype})(#{funcargs});"
168
- funcname = "cmock_arg#{c+=1}" if (funcname.empty?)
169
- "#{functype} #{funconst}#{funcname}"
170
- end
171
-
172
- #automatically name unnamed arguments (those that only had a type)
173
- arg_list.split(/\s*,\s*/).map { |arg|
174
- parts = (arg.split - ['struct', 'union', 'enum', 'const', 'const*'])
175
- if ((parts.size < 2) or (parts[-1][-1].chr == '*') or (@standards.include?(parts[-1])))
176
- "#{arg} cmock_arg#{c+=1}"
177
- else
178
- arg
179
- end
180
- }.join(', ')
181
- end
182
- end
183
-
184
- def parse_declaration(declaration)
185
- decl = {}
186
-
187
- regex_match = @declaration_parse_matcher.match(declaration)
188
- raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil?
189
-
190
- #grab argument list
191
- args = regex_match[2].strip
192
-
193
- #process function attributes, return type, and name
194
- descriptors = regex_match[1]
195
- descriptors.gsub!(/\s+\*/,'*') #remove space to place asterisks with return type (where they belong)
196
- descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from function name to place asterisks with return type (where they belong)
197
- descriptors = descriptors.split #array of all descriptor strings
198
-
199
- #grab name
200
- decl[:name] = descriptors[-1] #snag name as last array item
201
-
202
- #build attribute and return type strings
203
- decl[:modifier] = []
204
- rettype = []
205
- descriptors[0..-2].each do |word|
206
- if @c_attributes.include?(word)
207
- decl[:modifier] << word
208
- elsif @c_calling_conventions.include?(word)
209
- decl[:c_calling_convention] = word
210
- else
211
- rettype << word
212
- end
213
- end
214
- decl[:modifier] = decl[:modifier].join(' ')
215
- rettype = rettype.join(' ')
216
- rettype = 'void' if (@local_as_void.include?(rettype.strip))
217
- decl[:return] = { :type => rettype,
218
- :name => 'cmock_to_return',
219
- :ptr? => divine_ptr(rettype),
220
- :const? => rettype.split(/\s/).include?('const'),
221
- :str => "#{rettype} cmock_to_return",
222
- :void? => (rettype == 'void')
223
- }
224
-
225
- #remove default argument statements from mock definitions
226
- args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ')
227
-
228
- #check for var args
229
- if (args =~ /\.\.\./)
230
- decl[:var_arg] = args.match( /[\w\s]*\.\.\./ ).to_s.strip
231
- if (args =~ /\,[\w\s]*\.\.\./)
232
- args = args.gsub!(/\,[\w\s]*\.\.\./,'')
233
- else
234
- args = 'void'
235
- end
236
- else
237
- decl[:var_arg] = nil
238
- end
239
- args = clean_args(args)
240
- decl[:args_string] = args
241
- decl[:args] = parse_args(args)
242
- decl[:args_call] = decl[:args].map{|a| a[:name]}.join(', ')
243
- decl[:contains_ptr?] = decl[:args].inject(false) {|ptr, arg| arg[:ptr?] ? true : ptr }
244
-
245
- if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or
246
- decl[:return][:type].empty? or decl[:name].empty?)
247
- raise "Failed Parsing Declaration Prototype!\n" +
248
- " declaration: '#{declaration}'\n" +
249
- " modifier: '#{decl[:modifier]}'\n" +
250
- " return: #{prototype_inspect_hash(decl[:return])}\n" +
251
- " function: '#{decl[:name]}'\n" +
252
- " args: #{prototype_inspect_array_of_hashes(decl[:args])}\n"
253
- end
254
-
255
- return decl
256
- end
257
-
258
- def prototype_inspect_hash(hash)
259
- pairs = []
260
- hash.each_pair { |name, value| pairs << ":#{name} => #{"'" if (value.class == String)}#{value}#{"'" if (value.class == String)}" }
261
- return "{#{pairs.join(', ')}}"
262
- end
263
-
264
- def prototype_inspect_array_of_hashes(array)
265
- hashes = []
266
- array.each { |hash| hashes << prototype_inspect_hash(hash) }
267
- case (array.size)
268
- when 0
269
- return "[]"
270
- when 1
271
- return "[#{hashes[0]}]"
272
- else
273
- return "[\n #{hashes.join("\n ")}\n ]\n"
274
- end
275
- end
276
-
277
- end
@@ -1,40 +0,0 @@
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
- class CMockPluginManager
8
-
9
- attr_accessor :plugins
10
-
11
- def initialize(config, utils)
12
- @plugins = []
13
- plugins_to_load = [:expect, config.plugins].flatten.uniq.compact
14
- plugins_to_load.each do |plugin|
15
- plugin_name = plugin.to_s
16
- object_name = "CMockGeneratorPlugin" + camelize(plugin_name)
17
- begin
18
- unless (Object.const_defined? object_name)
19
- require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb"
20
- end
21
- @plugins << eval("#{object_name}.new(config, utils)")
22
- rescue
23
- raise "ERROR: CMock unable to load plugin '#{plugin_name}'"
24
- end
25
- end
26
- @plugins.sort! {|a,b| a.priority <=> b.priority }
27
- end
28
-
29
- def run(method, args=nil)
30
- if args.nil?
31
- return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join
32
- else
33
- return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join
34
- end
35
- end
36
-
37
- def camelize(lower_case_and_underscored_word)
38
- lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
39
- end
40
- end
@@ -1,75 +0,0 @@
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
- class CMockUnityHelperParser
8
-
9
- attr_accessor :c_types
10
-
11
- def initialize(config)
12
- @config = config
13
- @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
14
- @c_types = map_C_types.merge(import_source)
15
- end
16
-
17
- def get_helper(ctype)
18
- lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_')
19
- return [@c_types[lookup], ''] if (@c_types[lookup])
20
- if (lookup =~ /\*$/)
21
- lookup = lookup.gsub(/\*$/,'')
22
- return [@c_types[lookup], '*'] if (@c_types[lookup])
23
- else
24
- lookup = lookup + '*'
25
- return [@c_types[lookup], '&'] if (@c_types[lookup])
26
- end
27
- return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/)
28
- raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown
29
- return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, '']
30
- end
31
-
32
- private ###########################
33
-
34
- def map_C_types
35
- c_types = {}
36
- @config.treat_as.each_pair do |ctype, expecttype|
37
- c_type = ctype.gsub(/\s+/,'_')
38
- if (expecttype =~ /\*/)
39
- c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY"
40
- else
41
- c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}"
42
- c_types[c_type+'*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY"
43
- end
44
- end
45
- c_types
46
- end
47
-
48
- def import_source
49
- source = @config.load_unity_helper
50
- return {} if source.nil?
51
- c_types = {}
52
- source = source.gsub(/\/\/.*$/, '') #remove line comments
53
- source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments
54
-
55
- #scan for comparison helpers
56
- match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)')
57
- pairs = source.scan(match_regex).flatten.compact
58
- (pairs.size/2).times do |i|
59
- expect = pairs[i*2]
60
- ctype = pairs[(i*2)+1]
61
- c_types[ctype] = expect unless expect.include?("_ARRAY")
62
- end
63
-
64
- #scan for array variants of those helpers
65
- match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)')
66
- pairs = source.scan(match_regex).flatten.compact
67
- (pairs.size/2).times do |i|
68
- expect = pairs[i*2]
69
- ctype = pairs[(i*2)+1]
70
- c_types[ctype.gsub('_ARRAY','*')] = expect
71
- end
72
-
73
- c_types
74
- end
75
- end
@@ -1,176 +0,0 @@
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
- #include "unity.h"
8
-
9
- #include "cmock_internals.h"
10
-
11
- //private variables
12
- #ifdef CMOCK_MEM_DYNAMIC
13
- static unsigned char* CMock_Guts_Buffer = NULL;
14
- static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE;
15
- static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr;
16
- #else
17
- static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE];
18
- static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE;
19
- static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr;
20
- #endif
21
-
22
- //-------------------------------------------------------
23
- // CMock_Guts_MemNew
24
- //-------------------------------------------------------
25
- CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size)
26
- {
27
- CMOCK_MEM_INDEX_TYPE index;
28
-
29
- //verify arguments valid (we must be allocating space for at least 1 byte, and the existing chain must be in memory somewhere)
30
- if (size < 1)
31
- return CMOCK_GUTS_NONE;
32
-
33
- //verify we have enough room
34
- size = size + CMOCK_MEM_INDEX_SIZE;
35
- if (size & CMOCK_MEM_ALIGN_MASK)
36
- size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK;
37
- if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size)
38
- {
39
- #ifdef CMOCK_MEM_DYNAMIC
40
- CMock_Guts_BufferSize += CMOCK_MEM_SIZE + size;
41
- CMock_Guts_Buffer = realloc(CMock_Guts_Buffer, CMock_Guts_BufferSize);
42
- if (CMock_Guts_Buffer == NULL)
43
- #endif //yes that if will continue to the return below if TRUE
44
- return CMOCK_GUTS_NONE;
45
- }
46
-
47
- //determine where we're putting this new block, and init its pointer to be the end of the line
48
- index = CMock_Guts_FreePtr + CMOCK_MEM_INDEX_SIZE;
49
- *(CMOCK_MEM_INDEX_TYPE*)(&CMock_Guts_Buffer[CMock_Guts_FreePtr]) = CMOCK_GUTS_NONE;
50
- CMock_Guts_FreePtr += size;
51
-
52
- return index;
53
- }
54
-
55
- //-------------------------------------------------------
56
- // CMock_Guts_MemChain
57
- //-------------------------------------------------------
58
- CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index)
59
- {
60
- CMOCK_MEM_INDEX_TYPE index;
61
- void* root;
62
- void* obj;
63
- void* next;
64
-
65
- if (root_index == CMOCK_GUTS_NONE)
66
- {
67
- //if there is no root currently, we return this object as the root of the chain
68
- return obj_index;
69
- }
70
- else
71
- {
72
- //reject illegal nodes
73
- if ((root_index < CMOCK_MEM_ALIGN_SIZE) || (root_index >= CMock_Guts_FreePtr))
74
- {
75
- return CMOCK_GUTS_NONE;
76
- }
77
- if ((obj_index < CMOCK_MEM_ALIGN_SIZE) || (obj_index >= CMock_Guts_FreePtr))
78
- {
79
- return CMOCK_GUTS_NONE;
80
- }
81
-
82
- root = (void*)(&CMock_Guts_Buffer[root_index]);
83
- obj = (void*)(&CMock_Guts_Buffer[obj_index]);
84
-
85
- //find the end of the existing chain and add us
86
- next = root;
87
- do {
88
- index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE);
89
- if (index >= CMock_Guts_FreePtr)
90
- return CMOCK_GUTS_NONE;
91
- if (index > 0)
92
- next = (void*)(&CMock_Guts_Buffer[index]);
93
- } while (index > 0);
94
- *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE) = ((CMOCK_MEM_PTR_AS_INT)obj - (CMOCK_MEM_PTR_AS_INT)CMock_Guts_Buffer);
95
- return root_index;
96
- }
97
- }
98
-
99
- //-------------------------------------------------------
100
- // CMock_Guts_MemNext
101
- //-------------------------------------------------------
102
- CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index)
103
- {
104
- CMOCK_MEM_INDEX_TYPE index;
105
- void* previous_item;
106
-
107
- //There is nothing "next" if the pointer isn't from our buffer
108
- if ((previous_item_index < CMOCK_MEM_ALIGN_SIZE) || (previous_item_index >= CMock_Guts_FreePtr))
109
- return CMOCK_GUTS_NONE;
110
- previous_item = (void*)(&CMock_Guts_Buffer[previous_item_index]);
111
-
112
- //if the pointer is good, then use it to look up the next index
113
- //(we know the first element always goes in zero, so NEXT must always be > 1)
114
- index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)previous_item - CMOCK_MEM_INDEX_SIZE);
115
- if ((index > 1) && (index < CMock_Guts_FreePtr))
116
- return index;
117
- else
118
- return CMOCK_GUTS_NONE;
119
- }
120
-
121
- //-------------------------------------------------------
122
- // CMock_Guts_MemEndOfChain
123
- //-------------------------------------------------------
124
- CMOCK_MEM_INDEX_TYPE CMock_Guts_MemEndOfChain(CMOCK_MEM_INDEX_TYPE root_index)
125
- {
126
- CMOCK_MEM_INDEX_TYPE index = root_index;
127
- CMOCK_MEM_INDEX_TYPE next_index;
128
-
129
- for (next_index = root_index;
130
- next_index != CMOCK_GUTS_NONE;
131
- next_index = CMock_Guts_MemNext(index))
132
- {
133
- index = next_index;
134
- }
135
-
136
- return index;
137
- }
138
-
139
- //-------------------------------------------------------
140
- // CMock_GetAddressFor
141
- //-------------------------------------------------------
142
- void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index)
143
- {
144
- if ((index >= CMOCK_MEM_ALIGN_SIZE) && (index < CMock_Guts_FreePtr))
145
- {
146
- return (void*)(&CMock_Guts_Buffer[index]);
147
- }
148
- else
149
- {
150
- return NULL;
151
- }
152
- }
153
-
154
- //-------------------------------------------------------
155
- // CMock_Guts_MemBytesFree
156
- //-------------------------------------------------------
157
- CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void)
158
- {
159
- return CMock_Guts_BufferSize - CMock_Guts_FreePtr;
160
- }
161
-
162
- //-------------------------------------------------------
163
- // CMock_Guts_MemBytesUsed
164
- //-------------------------------------------------------
165
- CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void)
166
- {
167
- return CMock_Guts_FreePtr - CMOCK_MEM_ALIGN_SIZE;
168
- }
169
-
170
- //-------------------------------------------------------
171
- // CMock_Guts_MemFreeAll
172
- //-------------------------------------------------------
173
- void CMock_Guts_MemFreeAll(void)
174
- {
175
- CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE; //skip the very beginning
176
- }