{"action":"created","comment":{"url":"https://api.github.com/repos/u-aizu/bekobrew/pulls/comments/37692308","id":37692308,"diff_hunk":"@@ -0,0 +1,106 @@\n+#include \"bekobuild.h\"\n+\n+static struct bekobuild_t *new_bekobuild() {\n+  return (struct bekobuild_t*) malloc(sizeof(struct bekobuild_t));\n+}\n+\n+static struct list_t *new_list() {\n+  return (struct list_t*) malloc(sizeof(struct list_t));\n+}\n+\n+static yaml_parser_t *new_parser() {\n+  return (yaml_parser_t*) malloc(sizeof(yaml_parser_t));\n+}\n+\n+static void init_parser(yaml_parser_t *parser, FILE* file) {\n+  if (!yaml_parser_initialize(parser)) {\n+    fputs(\"ERROR: yaml_parser_initialize\", stderr);\n+    exit(1);\n+  }\n+  yaml_parser_set_input_file(parser, file);\n+}\n+\n+static const char *to_string(yaml_token_t *token) {\n+  return strdup((const char *)token->data.scalar.value);\n+}\n+\n+static struct list_t *parse_seq(yaml_parser_t *parser) {\n+  yaml_token_t token;\n+  int done = 0;\n+  struct list_t *head = new_list();\n+\n+  while (!done) {\n+    if (!yaml_parser_scan(parser, &token)) {\n+      return NULL;\n+    }\n+\n+    switch (token.type) {\n+      case YAML_SCALAR_TOKEN:\n+        break;\n+\n+      case YAML_BLOCK_END_TOKEN:\n+        done = 1;\n+        break;\n+    }\n+  }\n+\n+  return head;\n+}\n+\n+static int parse(yaml_parser_t *parser) {\n+  yaml_token_t token;\n+  int done = 0;\n+  int flag_key = 0;\n+  const char *item_key;\n+  const char *item_value;\n+\n+  while (!done) {\n+    if (!yaml_parser_scan(parser, &token)) {\n+      return 0;\n+    }\n+\n+    switch (token.type) {\n+      case YAML_KEY_TOKEN:\n+        flag_key = 1;\n+        break;\n+\n+      case YAML_SCALAR_TOKEN:\n+        if (flag_key) {\n+          item_key = to_string(&token);\n+        } else {\n+          item_value = to_string(&token);\n+        }\n+        flag_key = 0;\n+        break;\n+\n+      case YAML_BLOCK_SEQUENCE_START_TOKEN:\n+        parse_seq(parser);\n+        break;\n+\n+      case YAML_STREAM_END_TOKEN:\n+        done = 1;\n+        break;\n+    }\n+\n+    yaml_token_delete(&token);\n+  }\n+\n+  return 1;\n+}\n+\n+struct bekobuild_t *bekobuild_open(FILE* file) {\n+  struct bekobuild_t *self = new_bekobuild();\n+  self->parser = new_parser();\n+  init_parser(self->parser, file);\n+  if (!parse(self->parser)) {\n+    bekobuild_close(self);\n+    exit(1);","path":"src/bekobuild.c","position":97,"original_position":97,"commit_id":"85c9a4b9892ef3164971b11dd3c83b623b625888","original_commit_id":"85c9a4b9892ef3164971b11dd3c83b623b625888","user":{"login":"sh19910711","id":1015222,"avatar_url":"https://avatars.githubusercontent.com/u/1015222?v=3","gravatar_id":"","url":"https://api.github.com/users/sh19910711","html_url":"https://github.com/sh19910711","followers_url":"https://api.github.com/users/sh19910711/followers","following_url":"https://api.github.com/users/sh19910711/following{/other_user}","gists_url":"https://api.github.com/users/sh19910711/gists{/gist_id}","starred_url":"https://api.github.com/users/sh19910711/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh19910711/subscriptions","organizations_url":"https://api.github.com/users/sh19910711/orgs","repos_url":"https://api.github.com/users/sh19910711/repos","events_url":"https://api.github.com/users/sh19910711/events{/privacy}","received_events_url":"https://api.github.com/users/sh19910711/received_events","type":"User","site_admin":false},"body":"return NULL;","created_at":"2015-08-22T04:16:27Z","updated_at":"2015-08-22T04:16:27Z","html_url":"https://github.com/u-aizu/bekobrew/pull/34#discussion_r37692308","pull_request_url":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/u-aizu/bekobrew/pulls/comments/37692308"},"html":{"href":"https://github.com/u-aizu/bekobrew/pull/34#discussion_r37692308"},"pull_request":{"href":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34","id":43018479,"html_url":"https://github.com/u-aizu/bekobrew/pull/34","diff_url":"https://github.com/u-aizu/bekobrew/pull/34.diff","patch_url":"https://github.com/u-aizu/bekobrew/pull/34.patch","issue_url":"https://api.github.com/repos/u-aizu/bekobrew/issues/34","number":34,"state":"open","locked":false,"title":"Version 0.1.0","user":{"login":"sh19910711","id":1015222,"avatar_url":"https://avatars.githubusercontent.com/u/1015222?v=3","gravatar_id":"","url":"https://api.github.com/users/sh19910711","html_url":"https://github.com/sh19910711","followers_url":"https://api.github.com/users/sh19910711/followers","following_url":"https://api.github.com/users/sh19910711/following{/other_user}","gists_url":"https://api.github.com/users/sh19910711/gists{/gist_id}","starred_url":"https://api.github.com/users/sh19910711/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh19910711/subscriptions","organizations_url":"https://api.github.com/users/sh19910711/orgs","repos_url":"https://api.github.com/users/sh19910711/repos","events_url":"https://api.github.com/users/sh19910711/events{/privacy}","received_events_url":"https://api.github.com/users/sh19910711/received_events","type":"User","site_admin":false},"body":"おもに動作確認的な意味合いがあります。\r\n\r\n##### 概要\r\n\r\n###### 1. Prepare development environment\r\n\r\n* ビルド用のスクリプトを追加\r\n* Travis CI の設定\r\n* BEKOBUILD をパースするために LibYAML を利用（See also #33 ）\r\n* テストフレームワークは Google Test を利用\r\n\r\n###### 2. Add source code (not finished yet)\r\n\r\n* CLI 実装 （途中）\r\n* サブコマンド呼び出しの実験\r\n  - help\r\n  - install\r\n  - version\r\n* BEKOBUILD 対応（途中）\r\n\r\n###### 3. Add test environment\r\n\r\n* Google Test を実行する実験\r\n* Solaris (std1) と Mac (std6) で動作確認済み\r\n\r\n##### 動作確認\r\n\r\n外部ライブラリ（LibYAML, GoogleTest）は `git-submodule` を使って管理しています。`git-clone` からの `git-checkout` をしたら忘れずに更新してください。\r\n\r\n###### ビルド\r\n\r\n```\r\n$ git clone https://github.com/sh19910711/bekobrew\r\n$ cd bekobrew\r\n$ git checkout patch/0.1.0\r\n$ git submodule init\r\n$ git submodule update\r\n$ ./script/build.sh\r\n```\r\n\r\n`git-clone` で `--recursive` を使うのも良し :+1: \r\n\r\n```\r\n$ git clone --recursive -b patch/0.1.0 https://github.com/sh19910711/bekobrew\r\n$ cd bekobrew\r\n$ ./script/build.sh\r\n```\r\n\r\n###### テスト実行\r\n\r\n```\r\n$ ./build/run_test\r\n```\r\n\r\n###### コマンド実行\r\n\r\n```\r\n$ ./build/bekobrew --version\r\n$ ./build/bekobrew version\r\n```\r\n\r\nエラーなどでビルド通せなかったら教えてください。\r\n\r\nThanks.","created_at":"2015-08-21T09:18:21Z","updated_at":"2015-08-22T04:16:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41503c2976cfc9d476fe5de26ed8b6ef3d83ab8b","assignee":null,"milestone":{"url":"https://api.github.com/repos/u-aizu/bekobrew/milestones/2","html_url":"https://github.com/u-aizu/bekobrew/milestones/0.1","labels_url":"https://api.github.com/repos/u-aizu/bekobrew/milestones/2/labels","id":1266018,"number":2,"title":"0.1","description":"","creator":{"login":"sh19910711","id":1015222,"avatar_url":"https://avatars.githubusercontent.com/u/1015222?v=3","gravatar_id":"","url":"https://api.github.com/users/sh19910711","html_url":"https://github.com/sh19910711","followers_url":"https://api.github.com/users/sh19910711/followers","following_url":"https://api.github.com/users/sh19910711/following{/other_user}","gists_url":"https://api.github.com/users/sh19910711/gists{/gist_id}","starred_url":"https://api.github.com/users/sh19910711/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh19910711/subscriptions","organizations_url":"https://api.github.com/users/sh19910711/orgs","repos_url":"https://api.github.com/users/sh19910711/repos","events_url":"https://api.github.com/users/sh19910711/events{/privacy}","received_events_url":"https://api.github.com/users/sh19910711/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2015-08-21T09:05:26Z","updated_at":"2015-08-21T09:18:21Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34/commits","review_comments_url":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34/comments","review_comment_url":"https://api.github.com/repos/u-aizu/bekobrew/pulls/comments{/number}","comments_url":"https://api.github.com/repos/u-aizu/bekobrew/issues/34/comments","statuses_url":"https://api.github.com/repos/u-aizu/bekobrew/statuses/85c9a4b9892ef3164971b11dd3c83b623b625888","head":{"label":"sh19910711:patch/0.1.0","ref":"patch/0.1.0","sha":"85c9a4b9892ef3164971b11dd3c83b623b625888","user":{"login":"sh19910711","id":1015222,"avatar_url":"https://avatars.githubusercontent.com/u/1015222?v=3","gravatar_id":"","url":"https://api.github.com/users/sh19910711","html_url":"https://github.com/sh19910711","followers_url":"https://api.github.com/users/sh19910711/followers","following_url":"https://api.github.com/users/sh19910711/following{/other_user}","gists_url":"https://api.github.com/users/sh19910711/gists{/gist_id}","starred_url":"https://api.github.com/users/sh19910711/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh19910711/subscriptions","organizations_url":"https://api.github.com/users/sh19910711/orgs","repos_url":"https://api.github.com/users/sh19910711/repos","events_url":"https://api.github.com/users/sh19910711/events{/privacy}","received_events_url":"https://api.github.com/users/sh19910711/received_events","type":"User","site_admin":false},"repo":{"id":40067784,"name":"bekobrew","full_name":"sh19910711/bekobrew","owner":{"login":"sh19910711","id":1015222,"avatar_url":"https://avatars.githubusercontent.com/u/1015222?v=3","gravatar_id":"","url":"https://api.github.com/users/sh19910711","html_url":"https://github.com/sh19910711","followers_url":"https://api.github.com/users/sh19910711/followers","following_url":"https://api.github.com/users/sh19910711/following{/other_user}","gists_url":"https://api.github.com/users/sh19910711/gists{/gist_id}","starred_url":"https://api.github.com/users/sh19910711/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh19910711/subscriptions","organizations_url":"https://api.github.com/users/sh19910711/orgs","repos_url":"https://api.github.com/users/sh19910711/repos","events_url":"https://api.github.com/users/sh19910711/events{/privacy}","received_events_url":"https://api.github.com/users/sh19910711/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sh19910711/bekobrew","description":"The userspace package manager","fork":true,"url":"https://api.github.com/repos/sh19910711/bekobrew","forks_url":"https://api.github.com/repos/sh19910711/bekobrew/forks","keys_url":"https://api.github.com/repos/sh19910711/bekobrew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sh19910711/bekobrew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sh19910711/bekobrew/teams","hooks_url":"https://api.github.com/repos/sh19910711/bekobrew/hooks","issue_events_url":"https://api.github.com/repos/sh19910711/bekobrew/issues/events{/number}","events_url":"https://api.github.com/repos/sh19910711/bekobrew/events","assignees_url":"https://api.github.com/repos/sh19910711/bekobrew/assignees{/user}","branches_url":"https://api.github.com/repos/sh19910711/bekobrew/branches{/branch}","tags_url":"https://api.github.com/repos/sh19910711/bekobrew/tags","blobs_url":"https://api.github.com/repos/sh19910711/bekobrew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sh19910711/bekobrew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sh19910711/bekobrew/git/refs{/sha}","trees_url":"https://api.github.com/repos/sh19910711/bekobrew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sh19910711/bekobrew/statuses/{sha}","languages_url":"https://api.github.com/repos/sh19910711/bekobrew/languages","stargazers_url":"https://api.github.com/repos/sh19910711/bekobrew/stargazers","contributors_url":"https://api.github.com/repos/sh19910711/bekobrew/contributors","subscribers_url":"https://api.github.com/repos/sh19910711/bekobrew/subscribers","subscription_url":"https://api.github.com/repos/sh19910711/bekobrew/subscription","commits_url":"https://api.github.com/repos/sh19910711/bekobrew/commits{/sha}","git_commits_url":"https://api.github.com/repos/sh19910711/bekobrew/git/commits{/sha}","comments_url":"https://api.github.com/repos/sh19910711/bekobrew/comments{/number}","issue_comment_url":"https://api.github.com/repos/sh19910711/bekobrew/issues/comments{/number}","contents_url":"https://api.github.com/repos/sh19910711/bekobrew/contents/{+path}","compare_url":"https://api.github.com/repos/sh19910711/bekobrew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sh19910711/bekobrew/merges","archive_url":"https://api.github.com/repos/sh19910711/bekobrew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sh19910711/bekobrew/downloads","issues_url":"https://api.github.com/repos/sh19910711/bekobrew/issues{/number}","pulls_url":"https://api.github.com/repos/sh19910711/bekobrew/pulls{/number}","milestones_url":"https://api.github.com/repos/sh19910711/bekobrew/milestones{/number}","notifications_url":"https://api.github.com/repos/sh19910711/bekobrew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sh19910711/bekobrew/labels{/name}","releases_url":"https://api.github.com/repos/sh19910711/bekobrew/releases{/id}","created_at":"2015-08-02T03:33:37Z","updated_at":"2015-08-02T06:12:37Z","pushed_at":"2015-08-21T08:31:59Z","git_url":"git://github.com/sh19910711/bekobrew.git","ssh_url":"git@github.com:sh19910711/bekobrew.git","clone_url":"https://github.com/sh19910711/bekobrew.git","svn_url":"https://github.com/sh19910711/bekobrew","homepage":"","size":159,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"u-aizu:master","ref":"master","sha":"4194a8da39f33d2cd5f4a3fccddabbf542990626","user":{"login":"u-aizu","id":4474564,"avatar_url":"https://avatars.githubusercontent.com/u/4474564?v=3","gravatar_id":"","url":"https://api.github.com/users/u-aizu","html_url":"https://github.com/u-aizu","followers_url":"https://api.github.com/users/u-aizu/followers","following_url":"https://api.github.com/users/u-aizu/following{/other_user}","gists_url":"https://api.github.com/users/u-aizu/gists{/gist_id}","starred_url":"https://api.github.com/users/u-aizu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/u-aizu/subscriptions","organizations_url":"https://api.github.com/users/u-aizu/orgs","repos_url":"https://api.github.com/users/u-aizu/repos","events_url":"https://api.github.com/users/u-aizu/events{/privacy}","received_events_url":"https://api.github.com/users/u-aizu/received_events","type":"Organization","site_admin":false},"repo":{"id":13430553,"name":"bekobrew","full_name":"u-aizu/bekobrew","owner":{"login":"u-aizu","id":4474564,"avatar_url":"https://avatars.githubusercontent.com/u/4474564?v=3","gravatar_id":"","url":"https://api.github.com/users/u-aizu","html_url":"https://github.com/u-aizu","followers_url":"https://api.github.com/users/u-aizu/followers","following_url":"https://api.github.com/users/u-aizu/following{/other_user}","gists_url":"https://api.github.com/users/u-aizu/gists{/gist_id}","starred_url":"https://api.github.com/users/u-aizu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/u-aizu/subscriptions","organizations_url":"https://api.github.com/users/u-aizu/orgs","repos_url":"https://api.github.com/users/u-aizu/repos","events_url":"https://api.github.com/users/u-aizu/events{/privacy}","received_events_url":"https://api.github.com/users/u-aizu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/u-aizu/bekobrew","description":"The userspace package manager","fork":false,"url":"https://api.github.com/repos/u-aizu/bekobrew","forks_url":"https://api.github.com/repos/u-aizu/bekobrew/forks","keys_url":"https://api.github.com/repos/u-aizu/bekobrew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/u-aizu/bekobrew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/u-aizu/bekobrew/teams","hooks_url":"https://api.github.com/repos/u-aizu/bekobrew/hooks","issue_events_url":"https://api.github.com/repos/u-aizu/bekobrew/issues/events{/number}","events_url":"https://api.github.com/repos/u-aizu/bekobrew/events","assignees_url":"https://api.github.com/repos/u-aizu/bekobrew/assignees{/user}","branches_url":"https://api.github.com/repos/u-aizu/bekobrew/branches{/branch}","tags_url":"https://api.github.com/repos/u-aizu/bekobrew/tags","blobs_url":"https://api.github.com/repos/u-aizu/bekobrew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/u-aizu/bekobrew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/u-aizu/bekobrew/git/refs{/sha}","trees_url":"https://api.github.com/repos/u-aizu/bekobrew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/u-aizu/bekobrew/statuses/{sha}","languages_url":"https://api.github.com/repos/u-aizu/bekobrew/languages","stargazers_url":"https://api.github.com/repos/u-aizu/bekobrew/stargazers","contributors_url":"https://api.github.com/repos/u-aizu/bekobrew/contributors","subscribers_url":"https://api.github.com/repos/u-aizu/bekobrew/subscribers","subscription_url":"https://api.github.com/repos/u-aizu/bekobrew/subscription","commits_url":"https://api.github.com/repos/u-aizu/bekobrew/commits{/sha}","git_commits_url":"https://api.github.com/repos/u-aizu/bekobrew/git/commits{/sha}","comments_url":"https://api.github.com/repos/u-aizu/bekobrew/comments{/number}","issue_comment_url":"https://api.github.com/repos/u-aizu/bekobrew/issues/comments{/number}","contents_url":"https://api.github.com/repos/u-aizu/bekobrew/contents/{+path}","compare_url":"https://api.github.com/repos/u-aizu/bekobrew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/u-aizu/bekobrew/merges","archive_url":"https://api.github.com/repos/u-aizu/bekobrew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/u-aizu/bekobrew/downloads","issues_url":"https://api.github.com/repos/u-aizu/bekobrew/issues{/number}","pulls_url":"https://api.github.com/repos/u-aizu/bekobrew/pulls{/number}","milestones_url":"https://api.github.com/repos/u-aizu/bekobrew/milestones{/number}","notifications_url":"https://api.github.com/repos/u-aizu/bekobrew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/u-aizu/bekobrew/labels{/name}","releases_url":"https://api.github.com/repos/u-aizu/bekobrew/releases{/id}","created_at":"2013-10-09T01:54:50Z","updated_at":"2015-08-21T22:43:04Z","pushed_at":"2015-08-21T09:18:21Z","git_url":"git://github.com/u-aizu/bekobrew.git","ssh_url":"git@github.com:u-aizu/bekobrew.git","clone_url":"https://github.com/u-aizu/bekobrew.git","svn_url":"https://github.com/u-aizu/bekobrew","homepage":"","size":613,"stargazers_count":2,"watchers_count":2,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":14,"forks":1,"open_issues":14,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34"},"html":{"href":"https://github.com/u-aizu/bekobrew/pull/34"},"issue":{"href":"https://api.github.com/repos/u-aizu/bekobrew/issues/34"},"comments":{"href":"https://api.github.com/repos/u-aizu/bekobrew/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/u-aizu/bekobrew/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/u-aizu/bekobrew/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/u-aizu/bekobrew/statuses/85c9a4b9892ef3164971b11dd3c83b623b625888"}}}}