{"id":22966100,"url":"https://github.com/mattcrmx/cprotogen","last_synced_at":"2025-08-13T08:32:48.948Z","repository":{"id":261820787,"uuid":"884876296","full_name":"Mattcrmx/cprotogen","owner":"Mattcrmx","description":"Generate C headers from source file","archived":false,"fork":false,"pushed_at":"2024-11-08T17:17:22.000Z","size":19,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-10T08:57:05.136Z","etag":null,"topics":["generator","headers","parser"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mattcrmx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-07T14:47:40.000Z","updated_at":"2024-11-11T17:20:39.000Z","dependencies_parsed_at":"2024-11-08T16:43:29.873Z","dependency_job_id":"7c2b02bb-bbc8-43db-9154-7a75d80a060a","html_url":"https://github.com/Mattcrmx/cprotogen","commit_stats":null,"previous_names":["mattcrmx/cprotogen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mattcrmx%2Fcprotogen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mattcrmx%2Fcprotogen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mattcrmx%2Fcprotogen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mattcrmx%2Fcprotogen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mattcrmx","download_url":"https://codeload.github.com/Mattcrmx/cprotogen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229749371,"owners_count":18118351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","headers","parser"],"created_at":"2024-12-14T20:18:00.455Z","updated_at":"2024-12-14T20:18:01.119Z","avatar_url":"https://github.com/Mattcrmx.png","language":"Python","readme":"# CProtoGen\n\nA simple Python library and command-line tool for generating C function prototypes from source files.\n\n## Installation\n\nTo install it, use pip:\n\n```bash\npip install cprotogen\n```\n\n## Usage\n\n### Library\n\nYou can use the exposed API:\n\n```python\nfrom cprotogen.generator import generate_prototypes\n\n# Generate prototypes for multiple files\nsource_files = [\"file1.c\", \"file2.c\", \"file3.c\"]\nfor source in source_files:\n    header = source.replace(\".c\", \".h\")\n    generate_prototypes(source, header, overwrite=True)\n    print(f\"Updated {header} with prototypes from {source}\")\n```\n\n### As a Command-Line Tool\n\nCProtoGen can be used directly from the command line:\n\n```bash\n# Generate prototypes and create/update a header file\ncprotogen path/to/source.c --header path/to/header.h\n\n# Generate prototypes and overwrite existing header file\ncprotogen path/to/source.c --header path/to/existing_header.h --overwrite\n\n# Show help\ncprotogen -h\n```\n\n## Examples\n\n### Generating Prototypes for a Simple File\n\n```python\nfrom cprotogen.generator import generate_prototypes\n\n# Input file: hello.c\n\"\"\"\n#include \u003cstdio.h\u003e\n\nvoid hello_world() {\n    printf(\"Hello, World!\\n\");\n}\n\"\"\"\n\n# Generate prototypes and create a header file\ngenerate_prototypes(\"hello.c\", \"hello.h\")\n\n# Output file: hello.h\n\"\"\"\n#ifndef HELLO_H\n#define HELLO_H\n\nvoid hello_world(void);\n\n#endif // HELLO_H\n\"\"\"\n```\n\n### Updating Existing Header with New Function\n\n```python\nfrom cprotogen.generator import generate_prototypes\n\n# Updated input file: hello.c\n\"\"\"\n#include \u003cstdio.h\u003e\n\nvoid hello_world() {\n    printf(\"Hello, World!\\n\");\n}\n\nint add_numbers(int a, int b) {\n    return a + b;\n}\n\"\"\"\n\n# Generate prototypes and update the header file\ngenerate_prototypes(\"hello.c\", \"hello.h\", overwrite=True)\n\n# Updated output file: hello.h\n\"\"\"\n#ifndef HELLO_H\n#define HELLO_H\n\nvoid hello_world(void);\nint add_numbers(int a, int b);\n\n#endif // HELLO_H\n\"\"\"\n```\n\n### Generating Prototypes Without Creating a Header File\n\n```python\nfrom cprotogen.generator import generate_prototypes\n\n# Generate prototypes without creating a header file\nprototypes = generate_prototypes(\"hello.c\")\nprint(prototypes)\n# Output:\n# ['void hello_world(void);\\n', 'int add_numbers(int a, int b);\\n']\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattcrmx%2Fcprotogen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattcrmx%2Fcprotogen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattcrmx%2Fcprotogen/lists"}