Before Width: | Height: | Size: 943 B |
Before Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
@ -1 +1 @@ |
|||||||
{"google":"UA-35563760-2","tagline":"Lightweight json parser and reader written in C.","note":"Don't delete this file! It's used internally to help with page regeneration.","body":"##About\r\nParson is a lighweight [json](http://json.org) parser and reader written in C. \r\n\r\n##Features\r\n* Lightweight (only 2 files)\r\n* Simple API\r\n* Addressing json values with dot notation (similiar to C structs or objects in most OO languages, e.g. \"objectA.objectB.value\")\r\n* C89 compatible\r\n* Test suites\r\n\r\n##Installation\r\nRun the following code:\r\n```\r\ngit clone https://github.com/kgabis/parson.git\r\n```\r\nand copy parson.h and parson.c to you source code tree.\r\n\r\nRun tests.sh to compile and run tests.\r\n\r\n##Example\r\nHere is a function, which prints basic commit info (date, sha and author) from a github repository. It's also included in tests.c file, you can just uncomment and run it.\r\n```c\r\nvoid print_commits_info(const char *username, const char *repo) {\r\n JSON_Value *root_value;\r\n JSON_Array *commits;\r\n JSON_Object *commit;\r\n int i;\r\n \r\n char curl_command[512];\r\n char cleanup_command[256];\r\n char output_filename[] = \"commits.json\";\r\n \r\n /* it ain't pretty, but it's not a libcurl tutorial */\r\n sprintf(curl_command, \"curl -s \\\"https://api.github.com/repos/%s/%s/commits\\\"\\\r\n > %s\", username, repo, output_filename);\r\n sprintf(cleanup_command, \"rm -f %s\", output_filename);\r\n system(curl_command);\r\n \r\n /* parsing json and validating output */\r\n root_value = json_parse_file(output_filename);\r\n if (root_value == NULL || json_value_get_type(root_value) != JSONArray) {\r\n system(cleanup_command);\r\n return;\r\n }\r\n \r\n /* getting array from root value and printing commit info */\r\n commits = json_value_get_array(root_value);\r\n printf(\"%-10.10s %-10.10s %s\\n\", \"Date\", \"SHA\", \"Author\");\r\n for (i = 0; i < json_array_get_count(commits); i++) {\r\n commit = json_array_get_object(commits, i);\r\n printf(\"%.10s %.10s %s\\n\",\r\n json_object_dotget_string(commit, \"commit.author.date\"),\r\n json_object_get_string(commit, \"sha\"),\r\n json_object_dotget_string(commit, \"commit.author.name\"));\r\n }\r\n \r\n /* cleanup code */\r\n json_value_free(root_value);\r\n system(cleanup_command);\r\n}\r\n\r\n```\r\nCalling ```print_commits_info(\"torvalds\", \"linux\");``` prints: \r\n```\r\nDate SHA Author\r\n2012-10-15 dd8e8c4a2c David Rientjes\r\n2012-10-15 3ce9e53e78 Michal Marek\r\n2012-10-14 29bb4cc5e0 Randy Dunlap\r\n2012-10-15 325adeb55e Ralf Baechle\r\n2012-10-14 68687c842c Russell King\r\n2012-10-14 ddffeb8c4d Linus Torvalds\r\n...\r\n```\r\n\r\n##License\r\n[The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)\r\n\r\n##Author\r\n[Krzysztof Gabis](http://kgabis.github.com/)","name":"parson"} |
{"note":"Don't delete this file! It's used internally to help with page regeneration.","name":"parson","tagline":"Lightweight json parser and reader written in C.","google":"UA-35563760-2","body":"##About\r\nParson is a lighweight [json](http://json.org) parser and reader written in C. \r\n\r\n##Features\r\n* Lightweight (only 2 files)\r\n* Simple API\r\n* Addressing json values with dot notation (similiar to C structs or objects in most OO languages, e.g. \"objectA.objectB.value\")\r\n* C89 compatible\r\n* Test suites\r\n\r\n##Installation\r\nRun the following code:\r\n```\r\ngit clone https://github.com/kgabis/parson.git\r\n```\r\nand copy parson.h and parson.c to you source code tree.\r\n\r\nRun tests.sh to compile and run tests.\r\n\r\n##Example\r\nHere is a function, which prints basic commit info (date, sha and author) from a github repository. It's also included in tests.c file, you can just uncomment and run it.\r\n```c\r\nvoid print_commits_info(const char *username, const char *repo) {\r\n JSON_Value *root_value;\r\n JSON_Array *commits;\r\n JSON_Object *commit;\r\n int i;\r\n \r\n char curl_command[512];\r\n char cleanup_command[256];\r\n char output_filename[] = \"commits.json\";\r\n \r\n /* it ain't pretty, but it's not a libcurl tutorial */\r\n sprintf(curl_command, \"curl -s \\\"https://api.github.com/repos/%s/%s/commits\\\"\\\r\n > %s\", username, repo, output_filename);\r\n sprintf(cleanup_command, \"rm -f %s\", output_filename);\r\n system(curl_command);\r\n \r\n /* parsing json and validating output */\r\n root_value = json_parse_file(output_filename);\r\n if (root_value == NULL || json_value_get_type(root_value) != JSONArray) {\r\n system(cleanup_command);\r\n return;\r\n }\r\n \r\n /* getting array from root value and printing commit info */\r\n commits = json_value_get_array(root_value);\r\n printf(\"%-10.10s %-10.10s %s\\n\", \"Date\", \"SHA\", \"Author\");\r\n for (i = 0; i < json_array_get_count(commits); i++) {\r\n commit = json_array_get_object(commits, i);\r\n printf(\"%.10s %.10s %s\\n\",\r\n json_object_dotget_string(commit, \"commit.author.date\"),\r\n json_object_get_string(commit, \"sha\"),\r\n json_object_dotget_string(commit, \"commit.author.name\"));\r\n }\r\n \r\n /* cleanup code */\r\n json_value_free(root_value);\r\n system(cleanup_command);\r\n}\r\n\r\n```\r\nCalling ```print_commits_info(\"torvalds\", \"linux\");``` prints: \r\n```\r\nDate SHA Author\r\n2012-10-15 dd8e8c4a2c David Rientjes\r\n2012-10-15 3ce9e53e78 Michal Marek\r\n2012-10-14 29bb4cc5e0 Randy Dunlap\r\n2012-10-15 325adeb55e Ralf Baechle\r\n2012-10-14 68687c842c Russell King\r\n2012-10-14 ddffeb8c4d Linus Torvalds\r\n...\r\n```\r\n\r\n##License\r\n[The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)\r\n\r\n##Author\r\n[Krzysztof Gabis](http://kgabis.github.com/)"} |
@ -0,0 +1,226 @@ |
|||||||
|
html, body, div, span, applet, object, iframe, |
||||||
|
h1, h2, h3, h4, h5, h6, p, blockquote, pre, |
||||||
|
a, abbr, acronym, address, big, cite, code, |
||||||
|
del, dfn, em, img, ins, kbd, q, s, samp, |
||||||
|
small, strike, strong, sub, sup, tt, var, |
||||||
|
b, u, i, center, |
||||||
|
dl, dt, dd, ol, ul, li, |
||||||
|
fieldset, form, label, legend, |
||||||
|
table, caption, tbody, tfoot, thead, tr, th, td, |
||||||
|
article, aside, canvas, details, embed, |
||||||
|
figure, figcaption, footer, header, hgroup, |
||||||
|
menu, nav, output, ruby, section, summary, |
||||||
|
time, mark, audio, video { |
||||||
|
margin: 0; |
||||||
|
padding: 0; |
||||||
|
border: 0; |
||||||
|
font-size: 100%; |
||||||
|
font: inherit; |
||||||
|
vertical-align: baseline; |
||||||
|
} |
||||||
|
/* HTML5 display-role reset for older browsers */ |
||||||
|
article, aside, details, figcaption, figure, |
||||||
|
footer, header, hgroup, menu, nav, section { |
||||||
|
display: block; |
||||||
|
} |
||||||
|
body { |
||||||
|
line-height: 1; |
||||||
|
} |
||||||
|
ol, ul { |
||||||
|
list-style: none; |
||||||
|
} |
||||||
|
blockquote, q { |
||||||
|
quotes: none; |
||||||
|
} |
||||||
|
blockquote:before, blockquote:after, |
||||||
|
q:before, q:after { |
||||||
|
content: ''; |
||||||
|
content: none; |
||||||
|
} |
||||||
|
table { |
||||||
|
border-collapse: collapse; |
||||||
|
border-spacing: 0; |
||||||
|
} |
||||||
|
body { |
||||||
|
font-size: 13px; |
||||||
|
line-height: 1.5; |
||||||
|
font-family: 'Helvetica Neue', Helvetica, Arial, serif; |
||||||
|
color: #000; |
||||||
|
} |
||||||
|
|
||||||
|
a { |
||||||
|
color: #d5000d; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
|
||||||
|
header { |
||||||
|
padding-top: 35px; |
||||||
|
padding-bottom: 10px; |
||||||
|
} |
||||||
|
|
||||||
|
header h1 { |
||||||
|
font-weight: bold; |
||||||
|
letter-spacing: -1px; |
||||||
|
font-size: 48px; |
||||||
|
color: #303030; |
||||||
|
line-height: 1.2; |
||||||
|
} |
||||||
|
|
||||||
|
header h2 { |
||||||
|
letter-spacing: -1px; |
||||||
|
font-size: 24px; |
||||||
|
color: #aaa; |
||||||
|
font-weight: normal; |
||||||
|
line-height: 1.3; |
||||||
|
} |
||||||
|
#downloads { |
||||||
|
display: none; |
||||||
|
} |
||||||
|
#main_content { |
||||||
|
padding-top: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
code, pre { |
||||||
|
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal; |
||||||
|
color: #222; |
||||||
|
margin-bottom: 30px; |
||||||
|
font-size: 12px; |
||||||
|
} |
||||||
|
|
||||||
|
code { |
||||||
|
padding: 0 3px; |
||||||
|
} |
||||||
|
|
||||||
|
pre { |
||||||
|
border: solid 1px #ddd; |
||||||
|
padding: 20px; |
||||||
|
overflow: auto; |
||||||
|
} |
||||||
|
pre code { |
||||||
|
padding: 0; |
||||||
|
} |
||||||
|
|
||||||
|
ul, ol, dl { |
||||||
|
margin-bottom: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* COMMON STYLES */ |
||||||
|
|
||||||
|
table { |
||||||
|
width: 100%; |
||||||
|
border: 1px solid #ebebeb; |
||||||
|
} |
||||||
|
|
||||||
|
th { |
||||||
|
font-weight: 500; |
||||||
|
} |
||||||
|
|
||||||
|
td { |
||||||
|
border: 1px solid #ebebeb; |
||||||
|
text-align: center; |
||||||
|
font-weight: 300; |
||||||
|
} |
||||||
|
|
||||||
|
form { |
||||||
|
background: #f2f2f2; |
||||||
|
padding: 20px; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* GENERAL ELEMENT TYPE STYLES */ |
||||||
|
|
||||||
|
h1 { |
||||||
|
font-size: 2.8em; |
||||||
|
} |
||||||
|
|
||||||
|
h2 { |
||||||
|
font-size: 22px; |
||||||
|
font-weight: bold; |
||||||
|
color: #303030; |
||||||
|
margin-bottom: 8px; |
||||||
|
} |
||||||
|
|
||||||
|
h3 { |
||||||
|
color: #d5000d; |
||||||
|
font-size: 18px; |
||||||
|
font-weight: bold; |
||||||
|
margin-bottom: 8px; |
||||||
|
} |
||||||
|
|
||||||
|
h4 { |
||||||
|
font-size: 16px; |
||||||
|
color: #303030; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
|
||||||
|
h5 { |
||||||
|
font-size: 1em; |
||||||
|
color: #303030; |
||||||
|
} |
||||||
|
|
||||||
|
h6 { |
||||||
|
font-size: .8em; |
||||||
|
color: #303030; |
||||||
|
} |
||||||
|
|
||||||
|
p { |
||||||
|
font-weight: 300; |
||||||
|
margin-bottom: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
a { |
||||||
|
text-decoration: none; |
||||||
|
} |
||||||
|
|
||||||
|
p a { |
||||||
|
font-weight: 400; |
||||||
|
} |
||||||
|
|
||||||
|
blockquote { |
||||||
|
font-size: 1.6em; |
||||||
|
border-left: 10px solid #e9e9e9; |
||||||
|
margin-bottom: 20px; |
||||||
|
padding: 0 0 0 30px; |
||||||
|
} |
||||||
|
|
||||||
|
ul li { |
||||||
|
list-style: disc inside; |
||||||
|
padding-left: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
ol li { |
||||||
|
list-style: decimal inside; |
||||||
|
padding-left: 3px; |
||||||
|
} |
||||||
|
|
||||||
|
dl dd { |
||||||
|
font-style: italic; |
||||||
|
font-weight: 100; |
||||||
|
} |
||||||
|
|
||||||
|
footer { |
||||||
|
margin-top: 40px; |
||||||
|
padding-top: 20px; |
||||||
|
padding-bottom: 30px; |
||||||
|
font-size: 13px; |
||||||
|
color: #aaa; |
||||||
|
} |
||||||
|
|
||||||
|
footer a { |
||||||
|
color: #666; |
||||||
|
} |
||||||
|
|
||||||
|
/* MISC */ |
||||||
|
.clearfix:after { |
||||||
|
clear: both; |
||||||
|
content: '.'; |
||||||
|
display: block; |
||||||
|
visibility: hidden; |
||||||
|
height: 0; |
||||||
|
} |
||||||
|
|
||||||
|
.clearfix {display: inline-block;} |
||||||
|
* html .clearfix {height: 1%;} |
||||||
|
.clearfix {display: block;} |