redsnow 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -1
  3. data/README.md +12 -0
  4. data/ext/snowcrash/bin/snowcrash +0 -0
  5. data/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c +5 -2
  6. data/ext/snowcrash/snowcrash.gyp +7 -2
  7. data/ext/snowcrash/src/ActionParser.h +141 -81
  8. data/ext/snowcrash/src/AssetParser.h +19 -11
  9. data/ext/snowcrash/src/Blueprint.h +44 -14
  10. data/ext/snowcrash/src/BlueprintParser.h +65 -51
  11. data/ext/snowcrash/src/BlueprintSourcemap.h +254 -0
  12. data/ext/snowcrash/src/BlueprintUtility.h +3 -24
  13. data/ext/snowcrash/src/CBlueprint.cc +40 -31
  14. data/ext/snowcrash/src/CBlueprint.h +54 -58
  15. data/ext/snowcrash/src/CBlueprintSourcemap.cc +620 -0
  16. data/ext/snowcrash/src/CBlueprintSourcemap.h +342 -0
  17. data/ext/snowcrash/src/CSourceAnnotation.cc +14 -0
  18. data/ext/snowcrash/src/CodeBlockUtility.h +42 -5
  19. data/ext/snowcrash/src/HeadersParser.h +84 -42
  20. data/ext/snowcrash/src/ParameterParser.h +110 -68
  21. data/ext/snowcrash/src/ParametersParser.h +26 -28
  22. data/ext/snowcrash/src/PayloadParser.h +164 -83
  23. data/ext/snowcrash/src/ResourceGroupParser.h +35 -41
  24. data/ext/snowcrash/src/ResourceParser.h +142 -97
  25. data/ext/snowcrash/src/SectionParser.h +15 -14
  26. data/ext/snowcrash/src/SectionParserData.h +11 -2
  27. data/ext/snowcrash/src/SectionProcessor.h +42 -18
  28. data/ext/snowcrash/src/Serialize.cc +2 -0
  29. data/ext/snowcrash/src/Serialize.h +3 -1
  30. data/ext/snowcrash/src/SerializeJSON.cc +608 -16
  31. data/ext/snowcrash/src/SerializeJSON.h +4 -1
  32. data/ext/snowcrash/src/SerializeYAML.cc +367 -19
  33. data/ext/snowcrash/src/SerializeYAML.h +4 -1
  34. data/ext/snowcrash/src/SymbolTable.h +12 -1
  35. data/ext/snowcrash/src/ValuesParser.h +12 -11
  36. data/ext/snowcrash/src/Version.h +1 -1
  37. data/ext/snowcrash/src/csnowcrash.cc +7 -3
  38. data/ext/snowcrash/src/csnowcrash.h +4 -2
  39. data/ext/snowcrash/src/snowcrash.cc +10 -11
  40. data/ext/snowcrash/src/snowcrash.h +3 -3
  41. data/ext/snowcrash/src/snowcrash/snowcrash.cc +38 -8
  42. data/ext/snowcrash/tools/homebrew/snowcrash.rb +1 -1
  43. data/lib/redsnow.rb +41 -2
  44. data/lib/redsnow/binding.rb +93 -8
  45. data/lib/redsnow/blueprint.rb +48 -25
  46. data/lib/redsnow/parseresult.rb +9 -2
  47. data/lib/redsnow/sourcemap.rb +369 -0
  48. data/lib/redsnow/version.rb +1 -1
  49. data/test/fixtures/sample-api-ast.json +1 -1
  50. data/test/fixtures/sample-api-sourcemap.json +169 -0
  51. data/test/redsnow_binding_test.rb +19 -2
  52. data/test/redsnow_options_test.rb +42 -0
  53. data/test/redsnow_parseresult_test.rb +5 -1
  54. data/test/redsnow_test.rb +5 -0
  55. metadata +11 -2
@@ -10,12 +10,15 @@
10
10
  #define SNOWCRASH_SERIALIZE_YAML_H
11
11
 
12
12
  #include <ostream>
13
- #include "Blueprint.h"
13
+ #include "BlueprintSourcemap.h"
14
14
 
15
15
  namespace snowcrash {
16
16
 
17
17
  // Naive YAML serialization to ostream
18
18
  void SerializeYAML(const snowcrash::Blueprint& blueprint, std::ostream &os);
19
+
20
+ // Naive Sourcmap YAML serialization to ostream
21
+ void SerializeSourceMapYAML(const snowcrash::SourceMap<snowcrash::Blueprint>& blueprint, std::ostream &os);
19
22
  }
20
23
 
21
24
  #endif
@@ -19,7 +19,7 @@
19
19
  #include "Serialize.h"
20
20
  #endif
21
21
 
22
- #include "Blueprint.h"
22
+ #include "BlueprintSourcemap.h"
23
23
  #include "StringUtility.h"
24
24
 
25
25
  // Symbol identifier regex
@@ -36,15 +36,26 @@ namespace snowcrash {
36
36
  // Resource Object Symbol
37
37
  typedef std::pair<SymbolName, ResourceModel> ResourceModelSymbol;
38
38
 
39
+ // Resource Object Symbol source map
40
+ typedef std::pair<SymbolName, SourceMap<ResourceModel> > ResourceModelSymbolSourceMap;
41
+
39
42
  // Resource Object Symbol Table
40
43
  typedef std::map<SymbolName, ResourceModel> ResourceModelSymbolTable;
41
44
 
45
+ // Reesource Object Symbol Table source map
46
+ typedef std::map<SymbolName, SourceMap<ResourceModel> > ResourceModelSymbolSourceMapTable;
47
+
42
48
  struct SymbolTable {
43
49
 
44
50
  // Resource Object Symbol Table
45
51
  ResourceModelSymbolTable resourceModels;
46
52
  };
47
53
 
54
+ struct SymbolSourceMapTable {
55
+
56
+ // Resource Object Symbol Table source map
57
+ ResourceModelSymbolSourceMapTable resourceModels;
58
+ };
48
59
 
49
60
  // Checks whether given source data represents reference to a symbol returning true if so,
50
61
  // false otherwise. If source data is represent reference referred symbol name is filled in.
@@ -18,9 +18,6 @@
18
18
 
19
19
  namespace snowcrash {
20
20
 
21
- /** Parameter Values */
22
- typedef Collection<Value>::type Values; // TODO: Move this into core later
23
-
24
21
  /** Parameter Values matching regex */
25
22
  const char* const ValuesRegex = "^[[:blank:]]*[Vv]alues[[:blank:]]*$";
26
23
 
@@ -33,8 +30,7 @@ namespace snowcrash {
33
30
  static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
34
31
  const MarkdownNodes& siblings,
35
32
  SectionParserData& pd,
36
- Report& report,
37
- Values& out) {
33
+ ParseResult<Values>& out) {
38
34
 
39
35
  if (pd.sectionContext() == ValueSectionType) {
40
36
 
@@ -44,7 +40,13 @@ namespace snowcrash {
44
40
  RegexCapture(content, PARAMETER_VALUE, captureGroups);
45
41
 
46
42
  if (captureGroups.size() > 1) {
47
- out.push_back(captureGroups[1]);
43
+ out.node.push_back(captureGroups[1]);
44
+
45
+ if (pd.exportSourceMap()) {
46
+ SourceMap<Value> valueSM;
47
+ valueSM.sourceMap = node->sourceMap;
48
+ out.sourceMap.collection.push_back(valueSM);
49
+ }
48
50
  } else {
49
51
  TrimString(content);
50
52
 
@@ -54,9 +56,9 @@ namespace snowcrash {
54
56
  ss << ", expected '`" << content << "`'";
55
57
 
56
58
  mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
57
- report.warnings.push_back(Warning(ss.str(),
58
- IgnoringWarning,
59
- sourceMap));
59
+ out.report.warnings.push_back(Warning(ss.str(),
60
+ IgnoringWarning,
61
+ sourceMap));
60
62
  }
61
63
 
62
64
  return ++MarkdownNodeIterator(node);
@@ -68,8 +70,7 @@ namespace snowcrash {
68
70
  static MarkdownNodeIterator processDescription(const MarkdownNodeIterator& node,
69
71
  const MarkdownNodes& siblings,
70
72
  SectionParserData& pd,
71
- Report& report,
72
- Values& out) {
73
+ ParseResult<Values>& out) {
73
74
 
74
75
  return node;
75
76
  }
@@ -15,7 +15,7 @@
15
15
  #define SNOWCRASH_VERSION_H
16
16
 
17
17
  #define SNOWCRASH_MAJOR_VERSION 0
18
- #define SNOWCRASH_MINOR_VERSION 14
18
+ #define SNOWCRASH_MINOR_VERSION 15
19
19
  #define SNOWCRASH_PATCH_VERSION 0
20
20
 
21
21
  #define SNOWCRASH_VERSION_IS_RELEASE 1
@@ -9,15 +9,19 @@
9
9
  #include "csnowcrash.h"
10
10
  #include "snowcrash.h"
11
11
 
12
- int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint)
12
+ int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint, sc_sm_blueprint_t** sm_blueprint)
13
13
  {
14
14
  snowcrash::Report* t_report = ::new snowcrash::Report;
15
15
  snowcrash::Blueprint* t_blueprint = ::new snowcrash::Blueprint;
16
+ snowcrash::SourceMap<snowcrash::Blueprint>* t_sm_blueprint = ::new snowcrash::SourceMap<snowcrash::Blueprint>;
16
17
 
17
- int ret = snowcrash::parse(source, option, *t_report, *t_blueprint);
18
+ snowcrash::ParseResult<snowcrash::Blueprint>* t_parse_result = ::new snowcrash::ParseResult<snowcrash::Blueprint>(*t_report, *t_blueprint, *t_sm_blueprint);
19
+
20
+ int ret = snowcrash::parse(source, option, *t_parse_result);
18
21
 
19
- *blueprint = AS_TYPE(sc_blueprint_t, t_blueprint);
20
22
  *report = AS_TYPE(sc_report_t, t_report);
23
+ *blueprint = AS_TYPE(sc_blueprint_t, t_blueprint);
24
+ *sm_blueprint = AS_TYPE(sc_sm_blueprint_t, t_sm_blueprint);
21
25
 
22
26
  return ret;
23
27
  }
@@ -12,6 +12,7 @@
12
12
 
13
13
  #include "CSourceAnnotation.h"
14
14
  #include "CBlueprint.h"
15
+ #include "CBlueprintSourcemap.h"
15
16
 
16
17
  #ifdef __cplusplus
17
18
  extern "C" {
@@ -27,9 +28,10 @@ extern "C" {
27
28
  *
28
29
  * \return Error status code. Zero represents success, non-zero a failure.
29
30
  *
30
- * \this function will allocate `report` and `blueprint`, for deallocation `sc_blueprint_free` and `sc_report_free` should be called.
31
+ * this function will allocate `report` and `blueprint`, `sm_blueprint`,
32
+ * for deallocation `sc_blueprint_free`, `sc_sm_blueprint_free` and `sc_report_free` should be called.
31
33
  */
32
- SC_API int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint);
34
+ SC_API int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint, sc_sm_blueprint_t** sm_blueprint);
33
35
 
34
36
  #ifdef __cplusplus
35
37
  }
@@ -7,7 +7,6 @@
7
7
  //
8
8
 
9
9
  #include "snowcrash.h"
10
- #include "MarkdownParser.h"
11
10
  #include "BlueprintParser.h"
12
11
 
13
12
  const int snowcrash::SourceAnnotation::OK = 0;
@@ -20,6 +19,7 @@ using namespace snowcrash;
20
19
  */
21
20
  static bool CheckSource(const mdp::ByteBuffer& source, Report& report)
22
21
  {
22
+
23
23
  std::string::size_type pos = source.find("\t");
24
24
 
25
25
  if (pos != std::string::npos) {
@@ -49,18 +49,17 @@ static bool CheckSource(const mdp::ByteBuffer& source, Report& report)
49
49
 
50
50
  int snowcrash::parse(const mdp::ByteBuffer& source,
51
51
  BlueprintParserOptions options,
52
- Report& report,
53
- Blueprint& blueprint)
52
+ ParseResult<Blueprint>& out)
54
53
  {
55
54
  try {
56
55
 
57
56
  // Sanity Check
58
- if (!CheckSource(source, report))
59
- return report.error.code;
57
+ if (!CheckSource(source, out.report))
58
+ return out.report.error.code;
60
59
 
61
60
  // Do nothing if blueprint is empty
62
61
  if (source.empty())
63
- return report.error.code;
62
+ return out.report.error.code;
64
63
 
65
64
  // Parse Markdown
66
65
  mdp::MarkdownParser markdownParser;
@@ -68,21 +67,21 @@ int snowcrash::parse(const mdp::ByteBuffer& source,
68
67
  markdownParser.parse(source, markdownAST);
69
68
 
70
69
  // Build SectionParserData
71
- SectionParserData pd(options, source, blueprint);
70
+ SectionParserData pd(options, source, out.node);
72
71
 
73
72
  // Parse Blueprint
74
- BlueprintParser::parse(markdownAST.children().begin(), markdownAST.children(), pd, report, blueprint);
73
+ BlueprintParser::parse(markdownAST.children().begin(), markdownAST.children(), pd, out);
75
74
  }
76
75
  catch (const std::exception& e) {
77
76
 
78
77
  std::stringstream ss;
79
78
  ss << "parser exception: '" << e.what() << "'";
80
- report.error = Error(ss.str(), 1);
79
+ out.report.error = Error(ss.str(), 1);
81
80
  }
82
81
  catch (...) {
83
82
 
84
- report.error = Error("parser exception has occured", 1);
83
+ out.report.error = Error("parser exception has occured", 1);
85
84
  }
86
85
 
87
- return report.error.code;
86
+ return out.report.error.code;
88
87
  }
@@ -9,7 +9,7 @@
9
9
  #ifndef SNOWCRASH_H
10
10
  #define SNOWCRASH_H
11
11
 
12
- #include "Blueprint.h"
12
+ #include "BlueprintSourcemap.h"
13
13
  #include "SourceAnnotation.h"
14
14
  #include "SectionParser.h"
15
15
 
@@ -35,12 +35,12 @@ namespace snowcrash {
35
35
  * \param options Parser options. Use 0 for no additional options.
36
36
  * \param report Parsing report.
37
37
  * \param blueprint Parsed blueprint AST.
38
+ * \param blueprintSM Blueprint sourcemap AST
38
39
  * \return Error status code. Zero represents success, non-zero a failure.
39
40
  */
40
41
  int parse(const mdp::ByteBuffer& source,
41
42
  BlueprintParserOptions options,
42
- Report& report,
43
- Blueprint& blueprint);
43
+ ParseResult<Blueprint>& out);
44
44
  }
45
45
 
46
46
  #endif
@@ -21,6 +21,7 @@ using snowcrash::Error;
21
21
  static const std::string OutputArgument = "output";
22
22
  static const std::string FormatArgument = "format";
23
23
  static const std::string RenderArgument = "render";
24
+ static const std::string SourcemapArgument = "sourcemap";
24
25
  static const std::string ValidateArgument = "validate";
25
26
  static const std::string VersionArgument = "version";
26
27
 
@@ -81,13 +82,16 @@ int main(int argc, const char *argv[])
81
82
 
82
83
  argumentParser.set_program_name("snowcrash");
83
84
  std::stringstream ss;
85
+
84
86
  ss << "<input file>\n\n";
85
87
  ss << "API Blueprint Parser\n";
86
88
  ss << "If called without <input file>, 'snowcrash' will listen on stdin.\n";
89
+
87
90
  argumentParser.footer(ss.str());
88
91
 
89
92
  argumentParser.add<std::string>(OutputArgument, 'o', "save output AST into file", false);
90
93
  argumentParser.add<std::string>(FormatArgument, 'f', "output AST format", false, "yaml", cmdline::oneof<std::string>("yaml", "json"));
94
+ argumentParser.add<std::string>(SourcemapArgument, 's', "export sourcemap AST into file", false);
91
95
  // TODO: argumentParser.add("render", 'r', "render markdown descriptions");
92
96
  argumentParser.add("help", 'h', "display this help message");
93
97
  argumentParser.add(VersionArgument, 'v', "print Snow Crash version");
@@ -118,6 +122,7 @@ int main(int argc, const char *argv[])
118
122
  std::ifstream inputFileStream;
119
123
  std::string inputFileName = argumentParser.rest().front();
120
124
  inputFileStream.open(inputFileName.c_str());
125
+
121
126
  if (!inputFileStream.is_open()) {
122
127
  std::cerr << "fatal: unable to open input file '" << inputFileName << "'\n";
123
128
  exit(EXIT_FAILURE);
@@ -127,29 +132,40 @@ int main(int argc, const char *argv[])
127
132
  inputFileStream.close();
128
133
  }
129
134
 
130
- // Parse
135
+ // Initialize
131
136
  snowcrash::BlueprintParserOptions options = 0; // Or snowcrash::RequireBlueprintNameOption
132
- snowcrash::Report report;
133
- snowcrash::Blueprint blueprint;
134
- snowcrash::parse(inputStream.str(), options, report, blueprint);
137
+ snowcrash::ParseResult<snowcrash::Blueprint> blueprint;
138
+
139
+ if (argumentParser.exist(SourcemapArgument)) {
140
+ options |= snowcrash::ExportSourcemapOption;
141
+ }
142
+
143
+ // Parse
144
+ snowcrash::parse(inputStream.str(), options, blueprint);
135
145
 
136
146
  // Output
137
147
  if (!argumentParser.exist(ValidateArgument)) {
138
148
 
139
149
  std::stringstream outputStream;
150
+ std::stringstream sourcemapOutputStream;
140
151
 
141
152
  if (argumentParser.get<std::string>(FormatArgument) == "json") {
142
- SerializeJSON(blueprint, outputStream);
153
+ SerializeJSON(blueprint.node, outputStream);
154
+ SerializeSourceMapJSON(blueprint.sourceMap, sourcemapOutputStream);
143
155
  }
144
156
  else if (argumentParser.get<std::string>(FormatArgument) == "yaml") {
145
- SerializeYAML(blueprint, outputStream);
157
+ SerializeYAML(blueprint.node, outputStream);
158
+ SerializeSourceMapYAML(blueprint.sourceMap, sourcemapOutputStream);
146
159
  }
147
160
 
148
161
  std::string outputFileName = argumentParser.get<std::string>(OutputArgument);
162
+ std::string sourcemapOutputFileName = argumentParser.get<std::string>(SourcemapArgument);
163
+
149
164
  if (!outputFileName.empty()) {
150
165
  // Serialize to file
151
166
  std::ofstream outputFileStream;
152
167
  outputFileStream.open(outputFileName.c_str());
168
+
153
169
  if (!outputFileStream.is_open()) {
154
170
  std::cerr << "fatal: unable to write to file '" << outputFileName << "'\n";
155
171
  exit(EXIT_FAILURE);
@@ -162,9 +178,23 @@ int main(int argc, const char *argv[])
162
178
  // Serialize to stdout
163
179
  std::cout << outputStream.rdbuf();
164
180
  }
181
+
182
+ if (!sourcemapOutputFileName.empty()) {
183
+ // Serialize to file
184
+ std::ofstream sourcemapOutputFileStream;
185
+ sourcemapOutputFileStream.open(sourcemapOutputFileName.c_str());
186
+
187
+ if (!sourcemapOutputFileStream.is_open()) {
188
+ std::cerr << "fatal: unable to write to file '" << sourcemapOutputFileName << "'\n";
189
+ exit(EXIT_FAILURE);
190
+ }
191
+
192
+ sourcemapOutputFileStream << sourcemapOutputStream.rdbuf();
193
+ sourcemapOutputFileStream.close();
194
+ }
165
195
  }
166
196
 
167
197
  // report
168
- PrintReport(report);
169
- return report.error.code;
198
+ PrintReport(blueprint.report);
199
+ return blueprint.report.error.code;
170
200
  }
@@ -2,7 +2,7 @@ require 'formula'
2
2
 
3
3
  class Snowcrash < Formula
4
4
  homepage 'http://apiblueprint.org'
5
- head 'https://github.com/apiaryio/snowcrash.git', :tag => 'v0.14.0'
5
+ head 'https://github.com/apiaryio/snowcrash.git', :tag => 'v0.15.0'
6
6
 
7
7
  def install
8
8
  system "./configure"
data/lib/redsnow.rb CHANGED
@@ -1,11 +1,41 @@
1
1
  require "redsnow/version"
2
2
  require "redsnow/binding"
3
3
  require "redsnow/blueprint"
4
+ require "redsnow/sourcemap"
4
5
  require "redsnow/parseresult"
5
6
  require "ffi"
6
7
 
7
8
  module RedSnow
8
9
  include Binding
10
+
11
+ # Options
12
+ EXPORT_SOURCEMAP_OPTION_KEY = :'exportSourcemap'
13
+ REQUIRE_BLUEPRINT_NAME_OPTION_KEY = :'requireBlueprintName'
14
+
15
+ # Parse options
16
+ attr_accessor :options
17
+ def self.parse_options(options)
18
+ # Parse Options
19
+ unless options.is_a?(Numeric)
20
+ opt = 0
21
+ if options.has_key?(REQUIRE_BLUEPRINT_NAME_OPTION_KEY)
22
+ if options[REQUIRE_BLUEPRINT_NAME_OPTION_KEY] === true
23
+ opt = opt | (1 << 1)
24
+ end
25
+ end
26
+
27
+ if options.has_key?(EXPORT_SOURCEMAP_OPTION_KEY)
28
+ if options[EXPORT_SOURCEMAP_OPTION_KEY] === true
29
+ opt = opt | (1 << 2)
30
+ end
31
+ end
32
+
33
+ return opt
34
+ else
35
+ return options
36
+ end
37
+ end
38
+
9
39
  # parse
10
40
  # parsing API Blueprint into Ruby objects
11
41
  # @param rawBlueprint [String] API Blueprint
@@ -13,17 +43,26 @@ module RedSnow
13
43
  #
14
44
  # @return [ParseResult]
15
45
  def self.parse(rawBlueprint, options = 0)
46
+
47
+ raise ArgumentError.new("Expected string value") unless rawBlueprint.is_a?(String)
48
+
49
+ blueprintOptions = self.parse_options(options)
50
+
16
51
  blueprint = FFI::MemoryPointer.new :pointer
52
+ sourcemap = FFI::MemoryPointer.new :pointer
17
53
  report = FFI::MemoryPointer.new :pointer
18
- ret = RedSnow::Binding.sc_c_parse(rawBlueprint, options, report, blueprint)
54
+
55
+ RedSnow::Binding.sc_c_parse(rawBlueprint, blueprintOptions, report, blueprint, sourcemap)
19
56
 
20
57
  blueprint = blueprint.get_pointer(0)
58
+ sourcemap = sourcemap.get_pointer(0)
21
59
  report = report.get_pointer(0)
22
60
 
23
- parseResult = ParseResult.new(blueprint, report)
61
+ parseResult = ParseResult.new(report, blueprint, sourcemap)
24
62
 
25
63
  return parseResult
26
64
  ensure
65
+ RedSnow::Binding.sc_sm_blueprint_free(sourcemap)
27
66
  RedSnow::Binding.sc_blueprint_free(blueprint)
28
67
  RedSnow::Binding.sc_report_free(report)
29
68
  end
@@ -16,10 +16,11 @@ module RedSnow
16
16
  # @see https://github.com/apiaryio/snowcrash/blob/master/src/BlueprintParserCore.h#L31
17
17
  enum :option, [
18
18
  :render_descriptions_option,
19
- :require_blueprint_name_option
19
+ :require_blueprint_name_option,
20
+ :export_sourcemap_option
20
21
  ]
21
22
 
22
- attach_function("sc_c_parse", "sc_c_parse", [ :string, :option, :pointer, :pointer ], :int)
23
+ attach_function("sc_c_parse", "sc_c_parse", [ :string, :option, :pointer, :pointer, :pointer ], :int)
23
24
 
24
25
  attach_function("sc_blueprint_free", "sc_blueprint_free", [ :pointer ], :void)
25
26
  attach_function("sc_blueprint_name", "sc_blueprint_name", [ :pointer ], :string)
@@ -32,12 +33,12 @@ module RedSnow
32
33
  attach_function("sc_metadata_key", "sc_metadata_key", [ :pointer ], :string)
33
34
  attach_function("sc_metadata_value", "sc_metadata_value",[ :pointer ], :string)
34
35
 
35
- attach_function("sc_resource_groups_collection_handle", "sc_resource_groups_collection_handle", [ :pointer ], :pointer)
36
- attach_function("sc_resource_groups_collection_size", "sc_resource_groups_collection_size", [ :pointer ], :int)
36
+ attach_function("sc_resource_group_collection_handle", "sc_resource_group_collection_handle", [ :pointer ], :pointer)
37
+ attach_function("sc_resource_group_collection_size", "sc_resource_group_collection_size", [ :pointer ], :int)
37
38
 
38
- attach_function("sc_resource_groups_handle", "sc_resource_groups_handle", [ :pointer, :int ], :pointer)
39
- attach_function("sc_resource_groups_name", "sc_resource_groups_name", [ :pointer ], :string)
40
- attach_function("sc_resource_groups_description", "sc_resource_groups_description", [ :pointer ], :string)
39
+ attach_function("sc_resource_group_handle", "sc_resource_group_handle", [ :pointer, :int ], :pointer)
40
+ attach_function("sc_resource_group_name", "sc_resource_group_name", [ :pointer ], :string)
41
+ attach_function("sc_resource_group_description", "sc_resource_group_description", [ :pointer ], :string)
41
42
 
42
43
  attach_function("sc_resource_collection_handle", "sc_resource_collection_handle", [ :pointer ] , :pointer)
43
44
  attach_function("sc_resource_collection_size", "sc_resource_collection_size", [ :pointer ], :int)
@@ -54,6 +55,7 @@ module RedSnow
54
55
  attach_function("sc_payload_handle", "sc_payload_handle", [ :pointer, :int ], :pointer)
55
56
  attach_function("sc_payload_handle_resource", "sc_payload_handle_resource", [ :pointer ], :pointer)
56
57
  attach_function("sc_payload_name", "sc_payload_name", [ :pointer ], :string)
58
+ attach_function("sc_payload_symbol", "sc_payload_symbol", [ :pointer ], :string)
57
59
  attach_function("sc_payload_description", "sc_payload_description", [ :pointer ], :string)
58
60
  attach_function("sc_payload_body", "sc_payload_body", [ :pointer ], :string)
59
61
  attach_function("sc_payload_schema", "sc_payload_schema", [ :pointer ], :string)
@@ -81,7 +83,7 @@ module RedSnow
81
83
  attach_function("sc_value_collection_size", "sc_value_collection_size", [ :pointer ], :int)
82
84
 
83
85
  attach_function("sc_value_handle", "sc_value_handle", [ :pointer, :int ], :pointer)
84
- attach_function("sc_value_string", "sc_value_string", [ :pointer], :string)
86
+ attach_function("sc_value", "sc_value", [ :pointer], :string)
85
87
 
86
88
  attach_function("sc_header_collection_handle_payload", "sc_header_collection_handle_payload", [ :pointer ], :pointer)
87
89
  attach_function("sc_header_collection_handle_resource", "sc_header_collection_handle_resource", [ :pointer ], :pointer)
@@ -126,6 +128,89 @@ module RedSnow
126
128
  attach_function("sc_warning_code", "sc_warning_code", [ :pointer], :int)
127
129
  attach_function("sc_warning_ok", "sc_warning_ok", [ :pointer ], :int)
128
130
 
131
+ # Sourcemap's c-interface functions
132
+ attach_function("sc_source_map_size", "sc_source_map_size", [ :pointer ], :int)
133
+ attach_function("sc_source_map_length", "sc_source_map_length", [ :pointer, :int ], :int)
134
+ attach_function("sc_source_map_location", "sc_source_map_location", [ :pointer, :int ], :int)
135
+
136
+ attach_function("sc_sm_blueprint_free", "sc_sm_blueprint_free", [ :pointer ], :void)
137
+ attach_function("sc_sm_blueprint_name", "sc_sm_blueprint_name", [ :pointer ], :pointer)
138
+ attach_function("sc_sm_blueprint_description", "sc_sm_blueprint_description", [ :pointer ], :pointer)
139
+
140
+ attach_function("sc_sm_metadata_collection_handle", "sc_sm_metadata_collection_handle", [ :pointer ], :pointer)
141
+ attach_function("sc_sm_metadata_collection_size", "sc_sm_metadata_collection_size", [ :pointer ], :int)
142
+
143
+ attach_function("sc_sm_metadata_handle", "sc_sm_metadata_handle", [ :pointer, :int ], :pointer)
144
+ attach_function("sc_sm_metadata", "sc_sm_metadata", [ :pointer ], :pointer)
145
+
146
+ attach_function("sc_sm_resource_group_collection_handle", "sc_sm_resource_group_collection_handle", [ :pointer ], :pointer)
147
+ attach_function("sc_sm_resource_group_collection_size", "sc_sm_resource_group_collection_size", [ :pointer ], :int)
148
+
149
+ attach_function("sc_sm_resource_group_handle", "sc_sm_resource_group_handle", [ :pointer, :int ], :pointer)
150
+ attach_function("sc_sm_resource_group_name", "sc_sm_resource_group_name", [ :pointer ], :pointer)
151
+ attach_function("sc_sm_resource_group_description", "sc_sm_resource_group_description", [ :pointer ], :pointer)
152
+
153
+ attach_function("sc_sm_resource_collection_handle", "sc_sm_resource_collection_handle", [ :pointer ] , :pointer)
154
+ attach_function("sc_sm_resource_collection_size", "sc_sm_resource_collection_size", [ :pointer ], :int)
155
+ # Resource
156
+ attach_function("sc_sm_resource_handle", "sc_sm_resource_handle", [ :pointer, :int ] , :pointer)
157
+ attach_function("sc_sm_resource_uritemplate", "sc_sm_resource_uritemplate", [ :pointer ], :pointer)
158
+ attach_function("sc_sm_resource_name", "sc_sm_resource_name", [ :pointer ], :pointer)
159
+ attach_function("sc_sm_resource_description", "sc_sm_resource_description", [ :pointer ], :pointer)
160
+
161
+ attach_function("sc_sm_payload_collection_handle_requests", "sc_sm_payload_collection_handle_requests", [ :pointer ], :pointer)
162
+ attach_function("sc_sm_payload_collection_handle_responses", "sc_sm_payload_collection_handle_responses", [ :pointer ], :pointer)
163
+ attach_function("sc_sm_payload_collection_size", "sc_sm_payload_collection_size", [ :pointer ], :int)
164
+ # Resource.model
165
+ attach_function("sc_sm_payload_handle", "sc_sm_payload_handle", [ :pointer, :int ], :pointer)
166
+ attach_function("sc_sm_payload_handle_resource", "sc_sm_payload_handle_resource", [ :pointer ], :pointer)
167
+ attach_function("sc_sm_payload_name", "sc_sm_payload_name", [ :pointer ], :pointer)
168
+ attach_function("sc_sm_payload_symbol", "sc_sm_payload_symbol", [ :pointer ], :pointer)
169
+ attach_function("sc_sm_payload_description", "sc_sm_payload_description", [ :pointer ], :pointer)
170
+ attach_function("sc_sm_payload_body", "sc_sm_payload_body", [ :pointer ], :pointer)
171
+ attach_function("sc_sm_payload_schema", "sc_sm_payload_schema", [ :pointer ], :pointer)
172
+
173
+ attach_function("sc_sm_parameter_collection_handle_payload", "sc_sm_parameter_collection_handle_payload", [ :pointer ], :pointer)
174
+ attach_function("sc_sm_parameter_collection_handle_resource", "sc_sm_parameter_collection_handle_resource", [ :pointer ], :pointer)
175
+ attach_function("sc_sm_parameter_collection_handle_action", "sc_sm_parameter_collection_handle_action", [ :pointer ], :pointer)
176
+ attach_function("sc_sm_parameter_collection_size", "sc_sm_parameter_collection_size", [ :pointer ], :int)
177
+
178
+ attach_function("sc_sm_parameter_handle", "sc_sm_parameter_handle", [ :pointer, :int ], :pointer)
179
+ attach_function("sc_sm_parameter_name", "sc_sm_parameter_name", [ :pointer ], :pointer)
180
+ attach_function("sc_sm_parameter_description", "sc_sm_parameter_description", [ :pointer ], :pointer)
181
+ attach_function("sc_sm_parameter_type", "sc_sm_parameter_type", [ :pointer ], :pointer)
182
+ attach_function("sc_sm_parameter_parameter_use", "sc_sm_parameter_parameter_use", [ :pointer ], :pointer)
183
+ attach_function("sc_sm_parameter_default_value", "sc_sm_parameter_default_value", [ :pointer ], :pointer)
184
+ attach_function("sc_sm_parameter_example_value", "sc_sm_parameter_example_value", [ :pointer ], :pointer)
185
+
186
+ attach_function("sc_sm_value_collection_handle", "sc_sm_value_collection_handle", [ :pointer], :pointer)
187
+ attach_function("sc_sm_value_collection_size", "sc_sm_value_collection_size", [ :pointer ], :int)
188
+
189
+ attach_function("sc_sm_value_handle", "sc_sm_value_handle", [ :pointer, :int ], :pointer)
190
+ attach_function("sc_sm_value", "sc_sm_value", [ :pointer], :pointer)
191
+
192
+ attach_function("sc_sm_header_collection_handle_payload", "sc_sm_header_collection_handle_payload", [ :pointer ], :pointer)
193
+ attach_function("sc_sm_header_collection_handle_resource", "sc_sm_header_collection_handle_resource", [ :pointer ], :pointer)
194
+ attach_function("sc_sm_header_collection_handle_action", "sc_sm_header_collection_handle_action", [ :pointer ], :pointer)
195
+ attach_function("sc_sm_header_collection_size", "sc_sm_header_collection_size", [ :pointer ], :int)
196
+
197
+ attach_function("sc_sm_header_handle", "sc_sm_header_handle", [ :pointer, :int ], :pointer)
198
+ attach_function("sc_sm_header", "sc_sm_header", [ :pointer], :pointer)
199
+
200
+ attach_function("sc_sm_action_collection_handle", "sc_sm_action_collection_handle", [ :pointer ], :pointer)
201
+ attach_function("sc_sm_action_collection_size", "sc_sm_action_collection_size", [ :pointer], :int)
202
+
203
+ attach_function("sc_sm_action_handle", "sc_sm_action_handle", [ :pointer, :int ], :pointer)
204
+ attach_function("sc_sm_action_httpmethod", "sc_sm_action_httpmethod", [ :pointer], :pointer)
205
+ attach_function("sc_sm_action_name", "sc_sm_action_name", [ :pointer], :pointer)
206
+ attach_function("sc_sm_action_description", "sc_sm_action_description", [ :pointer ], :pointer)
207
+
208
+ attach_function("sc_sm_transaction_example_collection_handle", "sc_sm_transaction_example_collection_handle", [ :pointer ], :pointer)
209
+ attach_function("sc_sm_transaction_example_collection_size", "sc_sm_transaction_example_collection_size", [ :pointer ], :int)
210
+
211
+ attach_function("sc_sm_transaction_example_handle", "sc_sm_transaction_example_handle", [ :pointer, :int ], :pointer)
212
+ attach_function("sc_sm_transaction_example_name", "sc_sm_transaction_example_name", [ :pointer ], :pointer)
213
+ attach_function("sc_sm_transaction_example_description", "sc_sm_transaction_example_description", [ :pointer ], :pointer)
129
214
 
130
215
  end
131
216