redsnow 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/.gitmodules +3 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +62 -0
- data/Rakefile +36 -0
- data/Vagrantfile +20 -0
- data/ext/snowcrash/Makefile +64 -0
- data/ext/snowcrash/Vagrantfile +20 -0
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/common.gypi +163 -0
- data/ext/snowcrash/config.gypi +10 -0
- data/ext/snowcrash/config.mk +5 -0
- data/ext/snowcrash/configure +213 -0
- data/ext/snowcrash/provisioning.sh +15 -0
- data/ext/snowcrash/snowcrash.gyp +141 -0
- data/ext/snowcrash/src/ActionParser.h +503 -0
- data/ext/snowcrash/src/AssetParser.h +215 -0
- data/ext/snowcrash/src/BlockUtility.h +186 -0
- data/ext/snowcrash/src/Blueprint.h +283 -0
- data/ext/snowcrash/src/BlueprintParser.h +347 -0
- data/ext/snowcrash/src/BlueprintParserCore.h +190 -0
- data/ext/snowcrash/src/BlueprintSection.h +140 -0
- data/ext/snowcrash/src/BlueprintUtility.h +126 -0
- data/ext/snowcrash/src/CBlueprint.cc +600 -0
- data/ext/snowcrash/src/CBlueprint.h +354 -0
- data/ext/snowcrash/src/CSourceAnnotation.cc +140 -0
- data/ext/snowcrash/src/CSourceAnnotation.h +106 -0
- data/ext/snowcrash/src/CodeBlockUtility.h +189 -0
- data/ext/snowcrash/src/DescriptionSectionUtility.h +156 -0
- data/ext/snowcrash/src/HTTP.cc +46 -0
- data/ext/snowcrash/src/HTTP.h +105 -0
- data/ext/snowcrash/src/HeaderParser.h +289 -0
- data/ext/snowcrash/src/ListBlockUtility.h +273 -0
- data/ext/snowcrash/src/ListUtility.h +95 -0
- data/ext/snowcrash/src/MarkdownBlock.cc +176 -0
- data/ext/snowcrash/src/MarkdownBlock.h +93 -0
- data/ext/snowcrash/src/MarkdownParser.cc +266 -0
- data/ext/snowcrash/src/MarkdownParser.h +88 -0
- data/ext/snowcrash/src/ParameterDefinitonParser.h +570 -0
- data/ext/snowcrash/src/ParametersParser.h +252 -0
- data/ext/snowcrash/src/Parser.cc +71 -0
- data/ext/snowcrash/src/Parser.h +29 -0
- data/ext/snowcrash/src/ParserCore.cc +120 -0
- data/ext/snowcrash/src/ParserCore.h +82 -0
- data/ext/snowcrash/src/PayloadParser.h +672 -0
- data/ext/snowcrash/src/Platform.h +54 -0
- data/ext/snowcrash/src/RegexMatch.h +32 -0
- data/ext/snowcrash/src/ResourceGroupParser.h +195 -0
- data/ext/snowcrash/src/ResourceParser.h +584 -0
- data/ext/snowcrash/src/SectionUtility.h +142 -0
- data/ext/snowcrash/src/Serialize.cc +52 -0
- data/ext/snowcrash/src/Serialize.h +69 -0
- data/ext/snowcrash/src/SerializeJSON.cc +601 -0
- data/ext/snowcrash/src/SerializeJSON.h +21 -0
- data/ext/snowcrash/src/SerializeYAML.cc +336 -0
- data/ext/snowcrash/src/SerializeYAML.h +21 -0
- data/ext/snowcrash/src/SourceAnnotation.h +177 -0
- data/ext/snowcrash/src/StringUtility.h +109 -0
- data/ext/snowcrash/src/SymbolTable.h +83 -0
- data/ext/snowcrash/src/UriTemplateParser.cc +195 -0
- data/ext/snowcrash/src/UriTemplateParser.h +243 -0
- data/ext/snowcrash/src/Version.h +39 -0
- data/ext/snowcrash/src/csnowcrash.cc +23 -0
- data/ext/snowcrash/src/csnowcrash.h +38 -0
- data/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
- data/ext/snowcrash/src/snowcrash.cc +18 -0
- data/ext/snowcrash/src/snowcrash.h +41 -0
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +170 -0
- data/ext/snowcrash/src/win/RegexMatch.cc +78 -0
- data/ext/snowcrash/sundown/CONTRIBUTING.md +10 -0
- data/ext/snowcrash/sundown/Makefile +83 -0
- data/ext/snowcrash/sundown/Makefile.win +33 -0
- data/ext/snowcrash/sundown/examples/smartypants.c +72 -0
- data/ext/snowcrash/sundown/examples/sundown.c +80 -0
- data/ext/snowcrash/sundown/html/houdini.h +37 -0
- data/ext/snowcrash/sundown/html/houdini_href_e.c +108 -0
- data/ext/snowcrash/sundown/html/houdini_html_e.c +84 -0
- data/ext/snowcrash/sundown/html/html.c +647 -0
- data/ext/snowcrash/sundown/html/html.h +77 -0
- data/ext/snowcrash/sundown/html/html_smartypants.c +389 -0
- data/ext/snowcrash/sundown/html_block_names.txt +25 -0
- data/ext/snowcrash/sundown/src/autolink.c +297 -0
- data/ext/snowcrash/sundown/src/autolink.h +51 -0
- data/ext/snowcrash/sundown/src/buffer.c +225 -0
- data/ext/snowcrash/sundown/src/buffer.h +96 -0
- data/ext/snowcrash/sundown/src/html_blocks.h +206 -0
- data/ext/snowcrash/sundown/src/markdown.c +2701 -0
- data/ext/snowcrash/sundown/src/markdown.h +147 -0
- data/ext/snowcrash/sundown/src/src_map.c +200 -0
- data/ext/snowcrash/sundown/src/src_map.h +58 -0
- data/ext/snowcrash/sundown/src/stack.c +81 -0
- data/ext/snowcrash/sundown/src/stack.h +29 -0
- data/ext/snowcrash/sundown/sundown.def +20 -0
- data/ext/snowcrash/tools/gyp/AUTHORS +11 -0
- data/ext/snowcrash/tools/gyp/DEPS +24 -0
- data/ext/snowcrash/tools/gyp/OWNERS +1 -0
- data/ext/snowcrash/tools/gyp/PRESUBMIT.py +120 -0
- data/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +190 -0
- data/ext/snowcrash/tools/gyp/codereview.settings +10 -0
- data/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
- data/ext/snowcrash/tools/gyp/gyp +8 -0
- data/ext/snowcrash/tools/gyp/gyp.bat +5 -0
- data/ext/snowcrash/tools/gyp/gyp_main.py +18 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1063 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +267 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +409 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +537 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.py +521 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +49 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1143 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +81 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +335 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +87 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2181 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3335 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2156 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1224 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2809 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +510 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +972 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +292 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1440 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2889 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
- data/ext/snowcrash/tools/gyp/pylintrc +307 -0
- data/ext/snowcrash/tools/gyp/samples/samples +81 -0
- data/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
- data/ext/snowcrash/tools/gyp/setup.py +19 -0
- data/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
- data/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
- data/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +252 -0
- data/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
- data/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
- data/ext/snowcrash/tools/gyp/tools/pretty_sln.py +168 -0
- data/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +11 -0
- data/ext/snowcrash/vcbuild.bat +184 -0
- data/lib/redsnow.rb +31 -0
- data/lib/redsnow/binding.rb +132 -0
- data/lib/redsnow/blueprint.rb +365 -0
- data/lib/redsnow/object.rb +18 -0
- data/lib/redsnow/parseresult.rb +107 -0
- data/lib/redsnow/version.rb +4 -0
- data/provisioning.sh +20 -0
- data/redsnow.gemspec +35 -0
- data/test/_helper.rb +15 -0
- data/test/fixtures/sample-api-ast.json +97 -0
- data/test/fixtures/sample-api.apib +20 -0
- data/test/redsnow_binding_test.rb +35 -0
- data/test/redsnow_parseresult_test.rb +50 -0
- data/test/redsnow_test.rb +285 -0
- metadata +358 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CBlueprint.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
// C Implementation of Blueprint.h for binding purposes
|
|
5
|
+
//
|
|
6
|
+
// Created by Ali Khoramshahi on 13/6/14.
|
|
7
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
#ifndef SC_C_BLUEPRINT_H
|
|
11
|
+
#define SC_C_BLUEPRINT_H
|
|
12
|
+
|
|
13
|
+
#include "Platform.h"
|
|
14
|
+
#include "stdlib.h"
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/** brief Blueprint Parser Options */
|
|
21
|
+
typedef unsigned int sc_blueprint_parser_options;
|
|
22
|
+
|
|
23
|
+
/** brief Blueprint Parser Options Enums */
|
|
24
|
+
enum sc_blueprint_parser_option {
|
|
25
|
+
SC_RENDER_DESCRIPTIONS_OPTION = (1 << 0), /// < Render Markdown in description.
|
|
26
|
+
SC_REQUIRE_BLUEPRINT_NAME_OPTION = (1 << 1), /// < Treat missing blueprint name as error
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** Parameter Use flag */
|
|
30
|
+
typedef enum sc_parameter_use {
|
|
31
|
+
SC_UNDEFINED_PARAMETER_USE,
|
|
32
|
+
SC_OPTIONAL_PARAMETER_USE,
|
|
33
|
+
SC_REQUIRED_PARAMETER_USE
|
|
34
|
+
} sc_parameter_use;
|
|
35
|
+
|
|
36
|
+
/** Class Blueprint wrapper */
|
|
37
|
+
struct sc_blueprint_s;
|
|
38
|
+
typedef struct sc_blueprint_s sc_blueprint_t;
|
|
39
|
+
|
|
40
|
+
/** Array Metadata wrapper */
|
|
41
|
+
struct sc_metadata_collection_s;
|
|
42
|
+
typedef struct sc_metadata_collection_s sc_metadata_collection_t;
|
|
43
|
+
|
|
44
|
+
/** Class Metadata wrapper */
|
|
45
|
+
struct sc_metadata_s;
|
|
46
|
+
typedef struct sc_metadata_s sc_metadata_t;
|
|
47
|
+
|
|
48
|
+
/** Array Resource Groups wrapper */
|
|
49
|
+
struct sc_resource_groups_collection_s;
|
|
50
|
+
typedef struct sc_resource_groups_collection_s sc_resource_groups_collection_t;
|
|
51
|
+
|
|
52
|
+
/** Class Resource Group wrapper */
|
|
53
|
+
struct sc_resource_groups_s;
|
|
54
|
+
typedef struct sc_resource_groups_s sc_resource_groups_t;
|
|
55
|
+
|
|
56
|
+
/** Array Resources Collection wrapper */
|
|
57
|
+
struct sc_resource_collection_s;
|
|
58
|
+
typedef struct sc_resource_collection_s sc_resource_collection_t;
|
|
59
|
+
|
|
60
|
+
/** Class Resources wrapper */
|
|
61
|
+
struct sc_resource_s;
|
|
62
|
+
typedef struct sc_resource_s sc_resource_t;
|
|
63
|
+
|
|
64
|
+
/** Class Resource Model wrapper */
|
|
65
|
+
struct sc_resource_model_s;
|
|
66
|
+
typedef struct sc_resource_model_s sc_resource_model_t;
|
|
67
|
+
|
|
68
|
+
/** Array Payload Collection wrapper */
|
|
69
|
+
struct sc_payload_collection_s;
|
|
70
|
+
typedef struct sc_payload_collection_s sc_payload_collection_t;
|
|
71
|
+
|
|
72
|
+
/** Class Payload wrapper */
|
|
73
|
+
struct sc_payload_s;
|
|
74
|
+
typedef struct sc_payload_s sc_payload_t;
|
|
75
|
+
|
|
76
|
+
/** Array Parameter wrapper */
|
|
77
|
+
struct sc_parameter_collection_s;
|
|
78
|
+
typedef struct sc_parameter_collection_s sc_parameter_collection_t;
|
|
79
|
+
|
|
80
|
+
/** class Parameter wrapper */
|
|
81
|
+
struct sc_parameter_s;
|
|
82
|
+
typedef struct sc_parameter_s sc_parameter_t;
|
|
83
|
+
|
|
84
|
+
/** Array Header wrapper */
|
|
85
|
+
struct sc_header_collection_s;
|
|
86
|
+
typedef struct sc_header_collection_s sc_header_collection_t;
|
|
87
|
+
|
|
88
|
+
/** class Header wrapper */
|
|
89
|
+
struct sc_header_s;
|
|
90
|
+
typedef struct sc_header_s sc_header_t;
|
|
91
|
+
|
|
92
|
+
/** Array Value wrapper */
|
|
93
|
+
struct sc_value_collection_s;
|
|
94
|
+
typedef struct sc_value_collection_s sc_value_collection_t;
|
|
95
|
+
|
|
96
|
+
/** class Value wrapper */
|
|
97
|
+
struct sc_value_s;
|
|
98
|
+
typedef struct sc_value_s sc_value_t;
|
|
99
|
+
|
|
100
|
+
/** Array Header wrapper */
|
|
101
|
+
struct sc_header_collection_s;
|
|
102
|
+
typedef struct sc_header_collection_s sc_header_collection_t;
|
|
103
|
+
|
|
104
|
+
/** class Header wrapper */
|
|
105
|
+
struct sc_header_s;
|
|
106
|
+
typedef struct sc_header_s sc_header_t;
|
|
107
|
+
|
|
108
|
+
/** Array Action wrapper */
|
|
109
|
+
struct sc_action_collection_s;
|
|
110
|
+
typedef struct sc_action_collection_s sc_action_collection_t;
|
|
111
|
+
|
|
112
|
+
/** class Action wrapper */
|
|
113
|
+
struct sc_action_s;
|
|
114
|
+
typedef struct sc_action_s sc_action_t;
|
|
115
|
+
|
|
116
|
+
/** Array Transaction Example wrapper */
|
|
117
|
+
struct sc_transaction_example_collection_s;
|
|
118
|
+
typedef struct sc_transaction_example_collection_s sc_transaction_example_collection_t;
|
|
119
|
+
|
|
120
|
+
/** class Transaction Example wrapper */
|
|
121
|
+
struct sc_transaction_example_s;
|
|
122
|
+
typedef struct sc_transaction_example_s sc_transaction_example_t;
|
|
123
|
+
|
|
124
|
+
/*----------------------------------------------------------------------*/
|
|
125
|
+
|
|
126
|
+
/** \returns pointer to allocated Blueprint*/
|
|
127
|
+
SC_API sc_blueprint_t* sc_blueprint_new();
|
|
128
|
+
|
|
129
|
+
/** \deallocate Blueprint from pointer*/
|
|
130
|
+
SC_API void sc_blueprint_free(sc_blueprint_t* blueprint);
|
|
131
|
+
|
|
132
|
+
/** \returns Blueprint name */
|
|
133
|
+
SC_API const char* sc_blueprint_name(const sc_blueprint_t* blueprint);
|
|
134
|
+
|
|
135
|
+
/** \returns Blueprint description */
|
|
136
|
+
SC_API const char* sc_blueprint_description(const sc_blueprint_t* blueprint);
|
|
137
|
+
|
|
138
|
+
/*----------------------------------------------------------------------*/
|
|
139
|
+
|
|
140
|
+
/** \returns Metadata Handle */
|
|
141
|
+
SC_API const sc_metadata_collection_t* sc_metadata_collection_handle(const sc_blueprint_t* blueprint);
|
|
142
|
+
|
|
143
|
+
/** \returns size of Metadata array */
|
|
144
|
+
SC_API size_t sc_metadata_collection_size(const sc_metadata_collection_t* metadata);
|
|
145
|
+
|
|
146
|
+
/*----------------------------------------------------------------------*/
|
|
147
|
+
|
|
148
|
+
/** \returns Metadata at `index` handle */
|
|
149
|
+
SC_API const sc_metadata_t* sc_metadata_handle(const sc_metadata_collection_t* metadata_col, size_t index);
|
|
150
|
+
|
|
151
|
+
/** \returns Metadata key */
|
|
152
|
+
SC_API const char* sc_metadata_key(const sc_metadata_t* metadata);
|
|
153
|
+
|
|
154
|
+
/** \returns Metadata value */
|
|
155
|
+
SC_API const char* sc_metadata_value(const sc_metadata_t* metadata);
|
|
156
|
+
|
|
157
|
+
/*----------------------------------------------------------------------*/
|
|
158
|
+
|
|
159
|
+
/** \returns Resource Groups Array Handle */
|
|
160
|
+
SC_API const sc_resource_groups_collection_t* sc_resource_groups_collection_handle(const sc_blueprint_t* blueprint);
|
|
161
|
+
|
|
162
|
+
/** \returns size of Resource Groups array */
|
|
163
|
+
SC_API size_t sc_resource_groups_collection_size(const sc_resource_groups_collection_t* resource);
|
|
164
|
+
|
|
165
|
+
/*----------------------------------------------------------------------*/
|
|
166
|
+
|
|
167
|
+
/** \returns Resource Groups Handle */
|
|
168
|
+
SC_API const sc_resource_groups_t* sc_resource_groups_handle(const sc_resource_groups_collection_t* resource, size_t index);
|
|
169
|
+
|
|
170
|
+
/** \returns Resource Groups name */
|
|
171
|
+
SC_API const char* sc_resource_groups_name(const sc_resource_groups_t* handle);
|
|
172
|
+
|
|
173
|
+
/** \returns Resource Groups Description */
|
|
174
|
+
SC_API const char* sc_resource_groups_description(const sc_resource_groups_t* handle);
|
|
175
|
+
|
|
176
|
+
/*----------------------------------------------------------------------*/
|
|
177
|
+
|
|
178
|
+
/** \returns Resource Array Handle */
|
|
179
|
+
SC_API const sc_resource_collection_t* sc_resource_collection_handle(const sc_resource_groups_t* handle);
|
|
180
|
+
|
|
181
|
+
/** \returns Resource array size*/
|
|
182
|
+
SC_API size_t sc_resource_collection_size(const sc_resource_collection_t* resource);
|
|
183
|
+
|
|
184
|
+
/*----------------------------------------------------------------------*/
|
|
185
|
+
|
|
186
|
+
/** \returns Resource Handle */
|
|
187
|
+
SC_API const sc_resource_t* sc_resource_handle(const sc_resource_collection_t* resource, size_t index);
|
|
188
|
+
|
|
189
|
+
/** \returns Resource URITemplate */
|
|
190
|
+
SC_API const char* sc_resource_uritemplate(const sc_resource_t* handle);
|
|
191
|
+
|
|
192
|
+
/** \returns Resource name */
|
|
193
|
+
SC_API const char* sc_resource_name(const sc_resource_t* handle);
|
|
194
|
+
|
|
195
|
+
/** \returns Resource description */
|
|
196
|
+
SC_API const char* sc_resource_description(const sc_resource_t* handle);
|
|
197
|
+
|
|
198
|
+
/*----------------------------------------------------------------------*/
|
|
199
|
+
|
|
200
|
+
/** \returns Payload Collection handle from TransactionExample for requests*/
|
|
201
|
+
SC_API const sc_payload_collection_t* sc_payload_collection_handle_requests(const sc_transaction_example_t* handle);
|
|
202
|
+
|
|
203
|
+
/** \returns Payload Collection handle from TransactionExample for responses*/
|
|
204
|
+
SC_API const sc_payload_collection_t* sc_payload_collection_handle_responses(const sc_transaction_example_t* handle);
|
|
205
|
+
|
|
206
|
+
/** \returns Payload Collection size */
|
|
207
|
+
SC_API size_t sc_payload_collection_size(const sc_payload_collection_t* handle);
|
|
208
|
+
|
|
209
|
+
/*----------------------------------------------------------------------*/
|
|
210
|
+
|
|
211
|
+
/** \returns Payload at `index` Handle*/
|
|
212
|
+
SC_API const sc_payload_t* sc_payload_handle(const sc_payload_collection_t* handle, size_t index);
|
|
213
|
+
|
|
214
|
+
/** \returns Payload Handle from resource*/
|
|
215
|
+
SC_API const sc_payload_t* sc_payload_handle_resource(const sc_resource_t* handle);
|
|
216
|
+
|
|
217
|
+
/** \returns Payload name */
|
|
218
|
+
SC_API const char* sc_payload_name(const sc_payload_t* handle);
|
|
219
|
+
|
|
220
|
+
/** \returns Payload description */
|
|
221
|
+
SC_API const char* sc_payload_description(const sc_payload_t* handle);
|
|
222
|
+
|
|
223
|
+
/** \returns Payload body */
|
|
224
|
+
SC_API const char* sc_payload_body(const sc_payload_t* handle);
|
|
225
|
+
|
|
226
|
+
/** \returns Payload schema */
|
|
227
|
+
SC_API const char* sc_payload_schema(const sc_payload_t* handle);
|
|
228
|
+
|
|
229
|
+
/*----------------------------------------------------------------------*/
|
|
230
|
+
|
|
231
|
+
/** \returns Parameter Collection handle from Payload*/
|
|
232
|
+
SC_API const sc_parameter_collection_t* sc_parameter_collection_handle_payload(const sc_payload_t* handle);
|
|
233
|
+
|
|
234
|
+
/** \returns Parameter Collection handle from Resource*/
|
|
235
|
+
SC_API const sc_parameter_collection_t* sc_parameter_collection_handle_resource(const sc_resource_t* handle);
|
|
236
|
+
|
|
237
|
+
/** \returns Parameter Collection handle from Action*/
|
|
238
|
+
SC_API const sc_parameter_collection_t* sc_parameter_collection_handle_action(const sc_action_t* handle);
|
|
239
|
+
|
|
240
|
+
/** \returns Parameter Collection size */
|
|
241
|
+
SC_API size_t sc_parameter_collection_size(const sc_parameter_collection_t* handle);
|
|
242
|
+
|
|
243
|
+
/*----------------------------------------------------------------------*/
|
|
244
|
+
|
|
245
|
+
/** \returns Parameter handle */
|
|
246
|
+
SC_API const sc_parameter_t* sc_parameter_handle(const sc_parameter_collection_t* handle, size_t index);
|
|
247
|
+
|
|
248
|
+
/** \returns Parameter name */
|
|
249
|
+
SC_API const char* sc_parameter_name(const sc_parameter_t* handle);
|
|
250
|
+
|
|
251
|
+
/** \returns Parameter description */
|
|
252
|
+
SC_API const char* sc_parameter_description(const sc_parameter_t* handle);
|
|
253
|
+
|
|
254
|
+
/** \returns Parameter Type */
|
|
255
|
+
SC_API const char* sc_parameter_type(const sc_parameter_t* handle);
|
|
256
|
+
|
|
257
|
+
/** \returns Parameter Parameter Use */
|
|
258
|
+
SC_API sc_parameter_use sc_parameter_parameter_use(const sc_parameter_t* handle);
|
|
259
|
+
|
|
260
|
+
/** \returns Parameter Default Value */
|
|
261
|
+
SC_API const char* sc_parameter_default_value(const sc_parameter_t* handle);
|
|
262
|
+
|
|
263
|
+
/** \returns Parameter Example Value */
|
|
264
|
+
SC_API const char* sc_parameter_example_value(const sc_parameter_t* handle);
|
|
265
|
+
|
|
266
|
+
/*----------------------------------------------------------------------*/
|
|
267
|
+
|
|
268
|
+
/** \returns Value Collection handle */
|
|
269
|
+
SC_API const sc_value_collection_t* sc_value_collection_handle(const sc_parameter_t* handle);
|
|
270
|
+
|
|
271
|
+
/** \returns Value Collection size */
|
|
272
|
+
SC_API size_t sc_value_collection_size(const sc_value_collection_t* handle);
|
|
273
|
+
|
|
274
|
+
/*----------------------------------------------------------------------*/
|
|
275
|
+
|
|
276
|
+
/** \returns Value handle */
|
|
277
|
+
SC_API const sc_value_t* sc_value_handle(const sc_value_collection_t* handle, size_t index);
|
|
278
|
+
|
|
279
|
+
/** \returns Value string */
|
|
280
|
+
SC_API const char* sc_value_string(const sc_value_t* handle);
|
|
281
|
+
|
|
282
|
+
/*----------------------------------------------------------------------*/
|
|
283
|
+
|
|
284
|
+
/** \returns Header Collection handle from Payload*/
|
|
285
|
+
SC_API const sc_header_collection_t* sc_header_collection_handle_payload(const sc_payload_t* handle);
|
|
286
|
+
|
|
287
|
+
/** \returns Header Collection handle from Resource*/
|
|
288
|
+
SC_API const sc_header_collection_t* sc_header_collection_handle_resource(const sc_resource_t* handle);
|
|
289
|
+
|
|
290
|
+
/** \returns Header Collection handle from Action*/
|
|
291
|
+
SC_API const sc_header_collection_t* sc_header_collection_handle_action(const sc_action_t* handle);
|
|
292
|
+
|
|
293
|
+
/** \returns Header Collection size */
|
|
294
|
+
SC_API size_t sc_header_collection_size(const sc_header_collection_t* handle);
|
|
295
|
+
|
|
296
|
+
/*----------------------------------------------------------------------*/
|
|
297
|
+
|
|
298
|
+
/** \returns Header handle */
|
|
299
|
+
SC_API const sc_header_t* sc_header_handle(const sc_header_collection_t* handle, size_t index);
|
|
300
|
+
|
|
301
|
+
/** \returns Header Key */
|
|
302
|
+
SC_API const char* sc_header_key(const sc_header_t* handle);
|
|
303
|
+
|
|
304
|
+
/** \returns Header Value */
|
|
305
|
+
SC_API const char* sc_header_value(const sc_header_t* handle);
|
|
306
|
+
|
|
307
|
+
/*----------------------------------------------------------------------*/
|
|
308
|
+
|
|
309
|
+
/** \returns Action Collection handle */
|
|
310
|
+
SC_API const sc_action_collection_t* sc_action_collection_handle(const sc_resource_t* handle);
|
|
311
|
+
|
|
312
|
+
/** \returns Action Collection size */
|
|
313
|
+
SC_API size_t sc_action_collection_size(const sc_action_collection_t* handle);
|
|
314
|
+
|
|
315
|
+
/*----------------------------------------------------------------------*/
|
|
316
|
+
|
|
317
|
+
/** \returns Action handle */
|
|
318
|
+
SC_API const sc_action_t* sc_action_handle(const sc_action_collection_t* handle, size_t index);
|
|
319
|
+
|
|
320
|
+
/** \returns Action HTTPMethod */
|
|
321
|
+
SC_API const char* sc_action_httpmethod(const sc_action_t* handle);
|
|
322
|
+
|
|
323
|
+
/** \returns Action name */
|
|
324
|
+
SC_API const char* sc_action_name(const sc_action_t* handle);
|
|
325
|
+
|
|
326
|
+
/** \returns Action Description */
|
|
327
|
+
SC_API const char* sc_action_description(const sc_action_t* handle);
|
|
328
|
+
|
|
329
|
+
/*----------------------------------------------------------------------*/
|
|
330
|
+
|
|
331
|
+
/** \returns Transaction Example Collection handle */
|
|
332
|
+
SC_API const sc_transaction_example_collection_t* sc_transaction_example_collection_handle(const sc_action_t* handle);
|
|
333
|
+
|
|
334
|
+
/** \returns Transaction Example Collection size */
|
|
335
|
+
SC_API size_t sc_transaction_example_collection_size(const sc_transaction_example_collection_t* handle);
|
|
336
|
+
|
|
337
|
+
/*----------------------------------------------------------------------*/
|
|
338
|
+
|
|
339
|
+
/** \returns Transaction Example handle */
|
|
340
|
+
SC_API const sc_transaction_example_t* sc_transaction_example_handle(const sc_transaction_example_collection_t* handle, size_t index);
|
|
341
|
+
|
|
342
|
+
/** \returns Transaction Example name */
|
|
343
|
+
SC_API const char* sc_transaction_example_name(const sc_transaction_example_t* handle);
|
|
344
|
+
|
|
345
|
+
/** \returns Transaction Example Description */
|
|
346
|
+
SC_API const char* sc_transaction_example_description(const sc_transaction_example_t* handle);
|
|
347
|
+
|
|
348
|
+
/*----------------------------------------------------------------------*/
|
|
349
|
+
|
|
350
|
+
#ifdef __cplusplus
|
|
351
|
+
}
|
|
352
|
+
#endif
|
|
353
|
+
|
|
354
|
+
#endif
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CSourceAnnotation.cc
|
|
3
|
+
// snowcrash
|
|
4
|
+
// C Implementation of SourceAnnotation.h for binding purposes
|
|
5
|
+
//
|
|
6
|
+
// Created by Ali Khoramshahi on 13/6/14.
|
|
7
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
#include "CSourceAnnotation.h"
|
|
11
|
+
#include "snowcrash.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
SC_API sc_result_t* sc_result_new()
|
|
15
|
+
{
|
|
16
|
+
return AS_TYPE(sc_result_t, ::new snowcrash::Result);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
SC_API void sc_result_free(sc_result_t* result)
|
|
20
|
+
{
|
|
21
|
+
::delete AS_TYPE(snowcrash::Result, result);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*----------------------------------------------------------------------*/
|
|
25
|
+
|
|
26
|
+
SC_API const sc_location_t* sc_location_handler(const sc_source_annotation_t* source)
|
|
27
|
+
{
|
|
28
|
+
const snowcrash::SourceAnnotation* p = AS_CTYPE(snowcrash::SourceAnnotation, source);
|
|
29
|
+
if(!p)
|
|
30
|
+
return NULL;
|
|
31
|
+
return AS_CTYPE(sc_location_t, &p->location);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SC_API size_t sc_location_size(const sc_location_t* location)
|
|
35
|
+
{
|
|
36
|
+
const snowcrash::SourceCharactersBlock* p = AS_CTYPE(snowcrash::SourceCharactersBlock, location);
|
|
37
|
+
if(!p)
|
|
38
|
+
return 0;
|
|
39
|
+
return p->size();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
SC_API size_t sc_location_length(const sc_location_t* location, size_t index)
|
|
43
|
+
{
|
|
44
|
+
const snowcrash::SourceCharactersBlock* p = AS_CTYPE(snowcrash::SourceCharactersBlock, location);
|
|
45
|
+
if(!p)
|
|
46
|
+
return 0;
|
|
47
|
+
return p->at(index).length;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SC_API size_t sc_location_location(const sc_location_t* location, size_t index)
|
|
51
|
+
{
|
|
52
|
+
const snowcrash::SourceCharactersBlock* p = AS_CTYPE(snowcrash::SourceCharactersBlock, location);
|
|
53
|
+
if(!p)
|
|
54
|
+
return 0;
|
|
55
|
+
return p->at(index).location;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*----------------------------------------------------------------------*/
|
|
59
|
+
|
|
60
|
+
SC_API const sc_error_t* sc_error_handler(const sc_result_t* result)
|
|
61
|
+
{
|
|
62
|
+
const snowcrash::Result* p = AS_CTYPE(snowcrash::Result, result);
|
|
63
|
+
if(!p)
|
|
64
|
+
return NULL;
|
|
65
|
+
return AS_CTYPE(sc_error_t, &p->error);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
SC_API const char* sc_error_message(const sc_error_t* error)
|
|
69
|
+
{
|
|
70
|
+
const snowcrash::Error* p = AS_CTYPE(snowcrash::Error, error);
|
|
71
|
+
if (!p)
|
|
72
|
+
return "";
|
|
73
|
+
return p->message.c_str();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
SC_API int sc_error_code(const sc_error_t* error)
|
|
77
|
+
{
|
|
78
|
+
const snowcrash::Error* p = AS_CTYPE(snowcrash::Error, error);
|
|
79
|
+
if (!p)
|
|
80
|
+
return 0;
|
|
81
|
+
return p->code;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
SC_API int sc_error_ok(const sc_error_t* error)
|
|
85
|
+
{
|
|
86
|
+
const snowcrash::Error* p = AS_CTYPE(snowcrash::Error, error);
|
|
87
|
+
if (!p)
|
|
88
|
+
return 0;
|
|
89
|
+
return p->OK;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/*----------------------------------------------------------------------*/
|
|
93
|
+
|
|
94
|
+
SC_API const sc_warnings_t* sc_warnings_handler(const sc_result_t* result)
|
|
95
|
+
{
|
|
96
|
+
const snowcrash::Result* p = AS_CTYPE(snowcrash::Result, result);
|
|
97
|
+
if(!p)
|
|
98
|
+
return NULL;
|
|
99
|
+
return AS_CTYPE(sc_warnings_t, &p->warnings);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
SC_API size_t sc_warnings_size(const sc_warnings_t* warning)
|
|
103
|
+
{
|
|
104
|
+
const snowcrash::Warnings* p = AS_CTYPE(snowcrash::Warnings, warning);
|
|
105
|
+
if(!p)
|
|
106
|
+
return 0;
|
|
107
|
+
return p->size();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
SC_API const sc_warning_t* sc_warning_handler(const sc_warnings_t* warning, size_t index)
|
|
111
|
+
{
|
|
112
|
+
const snowcrash::Warnings* p = AS_CTYPE(snowcrash::Warnings, warning);
|
|
113
|
+
if(!p)
|
|
114
|
+
return NULL;
|
|
115
|
+
return AS_CTYPE(sc_warning_t, &p->at(index));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
SC_API const char* sc_warning_message(const sc_warning_t* warning)
|
|
119
|
+
{
|
|
120
|
+
const snowcrash::Warning* p = AS_CTYPE(snowcrash::Warning, warning);
|
|
121
|
+
if (!p)
|
|
122
|
+
return "";
|
|
123
|
+
return p->message.c_str();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
SC_API int sc_warning_code(const sc_warning_t* warning)
|
|
127
|
+
{
|
|
128
|
+
const snowcrash::Warning* p = AS_CTYPE(snowcrash::Warning, warning);
|
|
129
|
+
if (!p)
|
|
130
|
+
return 0;
|
|
131
|
+
return p->code;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
SC_API int sc_warning_ok(const sc_warning_t* warning)
|
|
135
|
+
{
|
|
136
|
+
const snowcrash::Warning* p = AS_CTYPE(snowcrash::Warning, warning);
|
|
137
|
+
if (!p)
|
|
138
|
+
return 0;
|
|
139
|
+
return p->OK;
|
|
140
|
+
}
|