{"id":41925199,"url":"https://github.com/lubomilko/neatcpp","last_synced_at":"2026-01-25T17:09:33.753Z","repository":{"id":227804392,"uuid":"761049428","full_name":"lubomilko/neatcpp","owner":"lubomilko","description":"Minimalistic Python C preprocessor preserving the C code formatting","archived":false,"fork":false,"pushed_at":"2025-08-03T08:02:03.000Z","size":193,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-16T04:48:02.723Z","etag":null,"topics":["c","preprocessor"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lubomilko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-21T06:24:09.000Z","updated_at":"2025-06-03T10:07:41.000Z","dependencies_parsed_at":"2024-03-15T08:33:56.095Z","dependency_job_id":"08804fd0-e226-4551-ac85-a1f66e012493","html_url":"https://github.com/lubomilko/neatcpp","commit_stats":null,"previous_names":["lubomilko/pycpp","lubomilko/neatcpp"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/lubomilko/neatcpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubomilko%2Fneatcpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubomilko%2Fneatcpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubomilko%2Fneatcpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubomilko%2Fneatcpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lubomilko","download_url":"https://codeload.github.com/lubomilko/neatcpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubomilko%2Fneatcpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","preprocessor"],"created_at":"2026-01-25T17:09:33.222Z","updated_at":"2026-01-25T17:09:33.747Z","avatar_url":"https://github.com/lubomilko.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n**Neatcpp** is a minimalistic C code preprocessor written in Python. The preprocessor is not\nintended to create source files for the compiler. It is aimed at the creation of C source files\nwith correctly expanded macros for the purposes of static analysis or code coverage analysis.\n\nThe neatcpp produces a code with formatting very close to the original code, i.e., the line\nendings, intendantion and comments are preserved, even in the expanded macro bodies. It is also\npossible to keep the original preprocessor directives.\n\n\n# Installation\n\nThe neatcpp package can be installed from the [Python Package Index](https://pypi.org/) using the\nfollowing *pip* console command:\n\n```console\npip install neatcpp\n```\n\nAlternatively, it is also possible to install the neatcpp package from a *\\*.tar.gz* source\ndistribution that can be downloaded from the *dist* directory:\n\n```console\npip install neatcpp-\u003cversion\u003e.tar.gz\n```\n\n\n# Usage\n\n## Neatcpp as a Python module\n\nNeatcpp preprocessor object should be created as an instance of the `NeatCpp` class and controlled\nthrough its public object attributes and methods.\n\nThe code below shows the basic usage of neatcpp as a Python module. See the *samples\\module_usage*\ndirectory for the executable example listed below together with another slightly more advanced\nsample script.\n\n``` python\n# Import preprocessor class NeatCpp\nfrom neatcpp import NeatCpp\n\n\nSAMPLE_CODE = \"\"\"\n#define CUBE(X)     (X) * (X) * (X)\n#define A           5\n#define B           3\n\na = CUBE(A);\n\"\"\"\n\n# Create the preprocessor object.\nneatcpp = NeatCpp()\n\n# Process C code defined in a SAMPLE_CODE string.\nneatcpp.process_code(SAMPLE_CODE)\n\n# Print full global output. The full output means that everything from the original code\n# (including preprocessor directives) is included in the output.\nprint(neatcpp.output_full)\n# Prints:\n# #define CUBE(X)     (X) * (X) * (X)\n# #define A           5\n# #define B           3\n#\n# a = (5) * (5) * (5);\n\n# Print standard preprocessed output without the processed directives and comments\n# not related to the remaining code.\nprint(neatcpp.output)\n# Prints:\n# a = (5) * (5) * (5);\n\nprint(neatcpp.expand_macros(\"b = CUBE(B + 1);\"))\n# Prints:\n# b = (3 + 1) * (3 + 1) * (3 + 1);\n\nprint(neatcpp.evaluate(\"CUBE(2 + 2)\"))\n# Prints:\n# 64\n\nprint(neatcpp.is_true(\"CUBE(A - B) \u003c CUBE(A + B)\"))\n# Prints:\n# True\n\n# Reset internal preprocessor output.\nneatcpp.reset_output()\n\n# Add include directory to search for included files.\nneatcpp.add_include_dirs(\"path/to/incl/dir\")\n\n# Process C code defined in file.\nneatcpp.process_files(\"path/to/src.c\")\n\n# Save preprocessor output to the output file.\nneatcpp.save_output_to_file(\"path/to/src_processed.c\")\n```\n\n## Neatcpp as a standalone script\n\nC source files can be processed from a commmand line with the arguments in a following format:\n\n```text\npython neatcpp.py in1.c [in2.c ...] out.c [-s sin1.c [sin2.c ...]] [-i incl1 [incl2 ...]] [-x excl1 [excl2 ...]] [-f] [-v 0-2] [-V] [-h]\n```\n\nPositional arguments:\n\n- `in1.c [in2.c ...]` - Input source files to be processed.\n- `out.c` - Output source file with processed code from all specified input files.\n\nOptional arguments:\n\n- `-s sin1.c [sin2.c ...]` - Input source files processed silently , i.e., without generated\n  output, before processing the main input files.\n- `-i incl1 [incl2 ...]` - Included directories to search for the input files or for the included files\n  defined by the `#include` statements in the input sources.\n- `-x` - Excluded macros or files. #define and #include statements for these identifiers will not be processed.\n- `-f` - Option to enable full output, i.e., to include directives, all comments and whitespaces in the\n  preprocessor output\n- `-v 0-2` - Set console log verbosity level (0 = logging OFF with errors still shown).\n- `-V` - Show program name and version.\n- `-h` - Show help message and exit.\n\nSee the example in the *samples\\script_usage* directory illustrating the command line usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flubomilko%2Fneatcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flubomilko%2Fneatcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flubomilko%2Fneatcpp/lists"}