{"action":"created","comment":{"url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/comments/32918743","id":32918743,"diff_hunk":"@@ -0,0 +1,779 @@\n+# -*- coding: utf-8 -*-\n+# -----------------------------------------------------------------------------\n+# Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details.\n+#\n+# Distributed under the terms of the MIT/X11 license.\n+#\n+# The full license is in the file LICENCE, distributed with this software.\n+# -----------------------------------------------------------------------------\n+\"\"\"Objects in this file can be used to model the public interface of a c\n+library. The Rootclass is CLibInterface, which refers to all typedef-,\n+macro-, variable-, function- objects contained in the library.\n+\n+Usually the user of the pyclibrary is not getting into contact with these\n+objects. The CParser() is generating these objects automaticially from a\n+c header file and the backend is relying on the definitions of these\n+objects to now how to interact with the underlying c library.\n+\n+The class hierarchy is:\n+\n+* CLibInterface (a catalogue of all CLibBase objects in a library)\n+* CLibBase (base class of all objects in header file)\n+  * Macro\n+    * ValMacro (#define x ...)\n+    * FnMacro (#define x(...) ...)\n+  * CLibType\n+    * SimpleType\n+      * BuiltinType (int, char, double, ...)\n+      * CustomType (all references to custom types = typedefs or named\n+                    AlgebraicDataTypes)\n+    * AlgebraicDataType\n+      * EnumType\n+      * CompoundType\n+        * StructType\n+        * UnionType\n+        * BitFieldType\n+    * ComposedType\n+      * PointerType\n+      * ArrayType\n+      * FunctionType\n+\"\"\"\n+from __future__ import (division, unicode_literals, print_function,\n+                        absolute_import)\n+import collections\n+import itertools\n+import re\n+from future.moves.itertools import zip_longest\n+from .errors import UnknownCustomTypeError\n+\n+\n+def _lpadded_str(text):\n+    \"\"\"An internal helper, returns '' if text is None otherwise ' '+text\"\"\"\n+    if text is None:\n+        return ''\n+    else:\n+        return ' ' + text\n+\n+\n+class CLibBase(object):\n+\n+    __slots__ = ()\n+\n+    def _getattrnames(self):","path":"pyclibrary/c_model.py","position":null,"original_position":62,"commit_id":"4d34bda7b420cead728200e7c24bc2b169e5b44a","original_commit_id":"d4d120297888726723f073c4880c31257ff1481e","user":{"login":"MatthieuDartiailh","id":4481740,"avatar_url":"https://avatars.githubusercontent.com/u/4481740?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthieuDartiailh","html_url":"https://github.com/MatthieuDartiailh","followers_url":"https://api.github.com/users/MatthieuDartiailh/followers","following_url":"https://api.github.com/users/MatthieuDartiailh/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuDartiailh/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuDartiailh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuDartiailh/subscriptions","organizations_url":"https://api.github.com/users/MatthieuDartiailh/orgs","repos_url":"https://api.github.com/users/MatthieuDartiailh/repos","events_url":"https://api.github.com/users/MatthieuDartiailh/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuDartiailh/received_events","type":"User","site_admin":false},"body":"But don't bother I will fix it quickly on my side.","created_at":"2015-06-22T09:50:18Z","updated_at":"2015-06-22T09:50:18Z","html_url":"https://github.com/MatthieuDartiailh/pyclibrary/pull/14#discussion_r32918743","pull_request_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/comments/32918743"},"html":{"href":"https://github.com/MatthieuDartiailh/pyclibrary/pull/14#discussion_r32918743"},"pull_request":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14","id":38151236,"html_url":"https://github.com/MatthieuDartiailh/pyclibrary/pull/14","diff_url":"https://github.com/MatthieuDartiailh/pyclibrary/pull/14.diff","patch_url":"https://github.com/MatthieuDartiailh/pyclibrary/pull/14.patch","issue_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues/14","number":14,"state":"open","locked":false,"title":"Integration of CLibInterface into CParser","user":{"login":"mrh1997","id":1482077,"avatar_url":"https://avatars.githubusercontent.com/u/1482077?v=3","gravatar_id":"","url":"https://api.github.com/users/mrh1997","html_url":"https://github.com/mrh1997","followers_url":"https://api.github.com/users/mrh1997/followers","following_url":"https://api.github.com/users/mrh1997/following{/other_user}","gists_url":"https://api.github.com/users/mrh1997/gists{/gist_id}","starred_url":"https://api.github.com/users/mrh1997/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrh1997/subscriptions","organizations_url":"https://api.github.com/users/mrh1997/orgs","repos_url":"https://api.github.com/users/mrh1997/repos","events_url":"https://api.github.com/users/mrh1997/events{/privacy}","received_events_url":"https://api.github.com/users/mrh1997/received_events","type":"User","site_admin":false},"body":"CParser() outputs now a CLibInterface() object instead of the ```parser.defs``` and ```parser.file_defs``` dictionaries (as discussed in #11). \r\n\r\nAs part of this integration some changes of the public interfaces of CParser/CLibInterface was required:\r\n* CParser:\r\n   - ```copy_from``` parameter requires a CLibInterface instead one or more other\r\n     CParsers now (if multiple CParser shall be used as source,\r\n     the CLibInterfaces can be merged via CLibInterface.include)\r\n   - ```kwargs``` parameter: accepts only ValMacros now. This corresponds to the behaviour of C-compilers where only macros can be defined via command line (\"-D\" option). All other usecases can be done by ```copy_from``` parameter\r\n   - removed some functions/attributes that relates to ```.defs``` macro. Most of them are either handled by CLibInterace (i.e. print_all()) or can be easily implemented as a one-liner (```CParser.find``` function can be easily replaced by\r\n     ```[filename for name, filename in clib_intf.file_map if re.match(name, ...)]```)\r\n* slightly modified ```c_model.py```\r\n   - more fine grained Inheritance Tree\r\n   - final Macro class interface (split macros into ValMacro and FnMacro with common Macro class)\r\n   - CLibInterface got some functionality from CParser\r\n   - introduced ```CLibInterface.include()``` to merge multiple interfaces into a single one\r\n   - moved error classes to .error Module\r\n   - added __iter__() to get all subtypes of type\r\n\r\nFurthermore two features were introduced as part of the integration:\r\n * anonymous enums/structs/unions do not use artifical names any more but refer\r\n  to the corresponding StructType/UnionType/EnumType directly (avoids name\r\n  conflicts when user uses the same name as the autogenerated one or when\r\n  two clibinterfaces with anonymous structures are merged via\r\n  clibinterface.include()) (see 6974340a5b0bdeb57217dc113f94e564096f29e8)\r\n * added storage class support (see 72f5a4dd1fec6f671169a223f2088b0cdf59b481)","created_at":"2015-06-19T21:49:50Z","updated_at":"2015-06-22T09:50:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e67a0ce74c72ee77810043c19a86bb14954d249c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14/commits","review_comments_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14/comments","review_comment_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues/14/comments","statuses_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/statuses/4d34bda7b420cead728200e7c24bc2b169e5b44a","head":{"label":"mrh1997:cmodel-based-parser","ref":"cmodel-based-parser","sha":"4d34bda7b420cead728200e7c24bc2b169e5b44a","user":{"login":"mrh1997","id":1482077,"avatar_url":"https://avatars.githubusercontent.com/u/1482077?v=3","gravatar_id":"","url":"https://api.github.com/users/mrh1997","html_url":"https://github.com/mrh1997","followers_url":"https://api.github.com/users/mrh1997/followers","following_url":"https://api.github.com/users/mrh1997/following{/other_user}","gists_url":"https://api.github.com/users/mrh1997/gists{/gist_id}","starred_url":"https://api.github.com/users/mrh1997/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrh1997/subscriptions","organizations_url":"https://api.github.com/users/mrh1997/orgs","repos_url":"https://api.github.com/users/mrh1997/repos","events_url":"https://api.github.com/users/mrh1997/events{/privacy}","received_events_url":"https://api.github.com/users/mrh1997/received_events","type":"User","site_admin":false},"repo":{"id":36191757,"name":"pyclibrary","full_name":"mrh1997/pyclibrary","owner":{"login":"mrh1997","id":1482077,"avatar_url":"https://avatars.githubusercontent.com/u/1482077?v=3","gravatar_id":"","url":"https://api.github.com/users/mrh1997","html_url":"https://github.com/mrh1997","followers_url":"https://api.github.com/users/mrh1997/followers","following_url":"https://api.github.com/users/mrh1997/following{/other_user}","gists_url":"https://api.github.com/users/mrh1997/gists{/gist_id}","starred_url":"https://api.github.com/users/mrh1997/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrh1997/subscriptions","organizations_url":"https://api.github.com/users/mrh1997/orgs","repos_url":"https://api.github.com/users/mrh1997/repos","events_url":"https://api.github.com/users/mrh1997/events{/privacy}","received_events_url":"https://api.github.com/users/mrh1997/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrh1997/pyclibrary","description":"C parser and ctypes automation for python","fork":true,"url":"https://api.github.com/repos/mrh1997/pyclibrary","forks_url":"https://api.github.com/repos/mrh1997/pyclibrary/forks","keys_url":"https://api.github.com/repos/mrh1997/pyclibrary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrh1997/pyclibrary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrh1997/pyclibrary/teams","hooks_url":"https://api.github.com/repos/mrh1997/pyclibrary/hooks","issue_events_url":"https://api.github.com/repos/mrh1997/pyclibrary/issues/events{/number}","events_url":"https://api.github.com/repos/mrh1997/pyclibrary/events","assignees_url":"https://api.github.com/repos/mrh1997/pyclibrary/assignees{/user}","branches_url":"https://api.github.com/repos/mrh1997/pyclibrary/branches{/branch}","tags_url":"https://api.github.com/repos/mrh1997/pyclibrary/tags","blobs_url":"https://api.github.com/repos/mrh1997/pyclibrary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrh1997/pyclibrary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrh1997/pyclibrary/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrh1997/pyclibrary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrh1997/pyclibrary/statuses/{sha}","languages_url":"https://api.github.com/repos/mrh1997/pyclibrary/languages","stargazers_url":"https://api.github.com/repos/mrh1997/pyclibrary/stargazers","contributors_url":"https://api.github.com/repos/mrh1997/pyclibrary/contributors","subscribers_url":"https://api.github.com/repos/mrh1997/pyclibrary/subscribers","subscription_url":"https://api.github.com/repos/mrh1997/pyclibrary/subscription","commits_url":"https://api.github.com/repos/mrh1997/pyclibrary/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrh1997/pyclibrary/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrh1997/pyclibrary/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrh1997/pyclibrary/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrh1997/pyclibrary/contents/{+path}","compare_url":"https://api.github.com/repos/mrh1997/pyclibrary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrh1997/pyclibrary/merges","archive_url":"https://api.github.com/repos/mrh1997/pyclibrary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrh1997/pyclibrary/downloads","issues_url":"https://api.github.com/repos/mrh1997/pyclibrary/issues{/number}","pulls_url":"https://api.github.com/repos/mrh1997/pyclibrary/pulls{/number}","milestones_url":"https://api.github.com/repos/mrh1997/pyclibrary/milestones{/number}","notifications_url":"https://api.github.com/repos/mrh1997/pyclibrary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrh1997/pyclibrary/labels{/name}","releases_url":"https://api.github.com/repos/mrh1997/pyclibrary/releases{/id}","created_at":"2015-05-24T20:31:53Z","updated_at":"2015-05-24T20:31:54Z","pushed_at":"2015-06-22T09:17:06Z","git_url":"git://github.com/mrh1997/pyclibrary.git","ssh_url":"git@github.com:mrh1997/pyclibrary.git","clone_url":"https://github.com/mrh1997/pyclibrary.git","svn_url":"https://github.com/mrh1997/pyclibrary","homepage":"http://pyclibrary.readthedocs.org","size":1295,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"MatthieuDartiailh:parser-rework","ref":"parser-rework","sha":"d48f5d7869dceb6403f9a810363c85d441af0a87","user":{"login":"MatthieuDartiailh","id":4481740,"avatar_url":"https://avatars.githubusercontent.com/u/4481740?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthieuDartiailh","html_url":"https://github.com/MatthieuDartiailh","followers_url":"https://api.github.com/users/MatthieuDartiailh/followers","following_url":"https://api.github.com/users/MatthieuDartiailh/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuDartiailh/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuDartiailh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuDartiailh/subscriptions","organizations_url":"https://api.github.com/users/MatthieuDartiailh/orgs","repos_url":"https://api.github.com/users/MatthieuDartiailh/repos","events_url":"https://api.github.com/users/MatthieuDartiailh/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuDartiailh/received_events","type":"User","site_admin":false},"repo":{"id":29362772,"name":"pyclibrary","full_name":"MatthieuDartiailh/pyclibrary","owner":{"login":"MatthieuDartiailh","id":4481740,"avatar_url":"https://avatars.githubusercontent.com/u/4481740?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthieuDartiailh","html_url":"https://github.com/MatthieuDartiailh","followers_url":"https://api.github.com/users/MatthieuDartiailh/followers","following_url":"https://api.github.com/users/MatthieuDartiailh/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuDartiailh/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuDartiailh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuDartiailh/subscriptions","organizations_url":"https://api.github.com/users/MatthieuDartiailh/orgs","repos_url":"https://api.github.com/users/MatthieuDartiailh/repos","events_url":"https://api.github.com/users/MatthieuDartiailh/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuDartiailh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MatthieuDartiailh/pyclibrary","description":"C parser and ctypes automation for python","fork":false,"url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary","forks_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/forks","keys_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/teams","hooks_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/hooks","issue_events_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues/events{/number}","events_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/events","assignees_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/assignees{/user}","branches_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/branches{/branch}","tags_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/tags","blobs_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/git/refs{/sha}","trees_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/statuses/{sha}","languages_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/languages","stargazers_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/stargazers","contributors_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/contributors","subscribers_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/subscribers","subscription_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/subscription","commits_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/commits{/sha}","git_commits_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/git/commits{/sha}","comments_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/comments{/number}","issue_comment_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues/comments{/number}","contents_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/contents/{+path}","compare_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/merges","archive_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/downloads","issues_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues{/number}","pulls_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls{/number}","milestones_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/milestones{/number}","notifications_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/labels{/name}","releases_url":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/releases{/id}","created_at":"2015-01-16T18:53:53Z","updated_at":"2015-06-19T14:34:15Z","pushed_at":"2015-06-22T09:17:06Z","git_url":"git://github.com/MatthieuDartiailh/pyclibrary.git","ssh_url":"git@github.com:MatthieuDartiailh/pyclibrary.git","clone_url":"https://github.com/MatthieuDartiailh/pyclibrary.git","svn_url":"https://github.com/MatthieuDartiailh/pyclibrary","homepage":"http://pyclibrary.readthedocs.org","size":1417,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14"},"html":{"href":"https://github.com/MatthieuDartiailh/pyclibrary/pull/14"},"issue":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues/14"},"comments":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/MatthieuDartiailh/pyclibrary/statuses/4d34bda7b420cead728200e7c24bc2b169e5b44a"}}}}