{"id":50127465,"url":"https://github.com/zefir1990/static-pairs","last_synced_at":"2026-05-23T20:34:51.584Z","repository":{"id":282467118,"uuid":"948691736","full_name":"zefir1990/static-pairs","owner":"zefir1990","description":"Static pairs examples","archived":false,"fork":false,"pushed_at":"2025-03-15T06:48:38.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-21T21:20:31.001Z","etag":null,"topics":["code-notation","codenotation","notation"],"latest_commit_sha":null,"homepage":"","language":null,"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/zefir1990.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-14T19:31:52.000Z","updated_at":"2025-03-15T08:52:55.000Z","dependencies_parsed_at":"2025-03-15T11:31:45.898Z","dependency_job_id":null,"html_url":"https://github.com/zefir1990/static-pairs","commit_stats":null,"previous_names":["demensdeum/static-pairs","zefir1990/static-pairs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zefir1990/static-pairs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefir1990%2Fstatic-pairs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefir1990%2Fstatic-pairs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefir1990%2Fstatic-pairs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefir1990%2Fstatic-pairs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zefir1990","download_url":"https://codeload.github.com/zefir1990/static-pairs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefir1990%2Fstatic-pairs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33412082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T18:09:33.147Z","status":"ssl_error","status_checked_at":"2026-05-23T18:09:31.380Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["code-notation","codenotation","notation"],"created_at":"2026-05-23T20:34:50.729Z","updated_at":"2026-05-23T20:34:51.562Z","avatar_url":"https://github.com/zefir1990.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Static Pairs - Name + Type\n\n## Overview\n\nStatic Pairs - Name + Type is a tool designed to create a value name-to-type notation by processing files with source code transpiling based on rules specified in a configuration file. The transpiling process generates consistent and reusable result code, aligning with the DRY (Don't Repeat Yourself) principle by minimizing redundancy. \nExample prototype version is implemented in Python, offering a straightforward and easy-to-understand approach for file processing tasks. The prototype source code example implementation is in Objective-C++, while the preprocessor is in Python. This tool is intended for source code only.\n\n## Features\n\n- **Configuration-Driven**: Reads a configuration file to determine text replacement rules.\n- **Flexible Processing**: Processes input files line-by-line, applying replacements as specified.\n- **Ease of Use**: The Python script provides a simple interface for defining and applying text replacement rules.\n\n## Installation\n\n### Prerequisites\n\n- **Python**: Ensure you have Python installed on your system.\n\n### Running the Script\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/static-pairs-preprocessor.git\n   cd static-pairs-preprocessor\n   ```\n\n2. Execute the Python script with the necessary input files:\n   ```bash\n   python StaticPairsPreprocessor.py\n   ```\n\n## Usage\n\nEnsure that the input file and configuration file are correctly specified within the script or passed as arguments.\n\n## Examples\n\n### Creating a .sp Configuration File\n\nThe `.sp` configuration file is used to define mappings for the preprocessor. Below is a guide on how to create and structure this file:\n\n1. **Define Mappings**: Each line in the `.sp` file should define a mapping from a placeholder to a specific type or object. The format is as follows:\n   ```\n   :placeholder -\u003e :(Type *)object\n   ```\n   For example:\n   - `:button -\u003e :(NSButton *)button` maps the placeholder `:button` to an `NSButton` pointer named `button`.\n   - `:timeLabel -\u003e :(NSLabel *)timeLabel` maps `:timeLabel` to an `NSLabel` pointer named `timeLabel`.\n\n2. **Supported Types**: You can map placeholders to various types, such as `NSButton`, `NSLabel`, `NSWindow`, `NSTimer`, and other standard types like `std::chrono::steady_clock::time_point` and `bool`.\n\n3. **Usage**: These mappings are used by the preprocessor to replace placeholders in your code with the specified types or objects, facilitating type-safe code generation. This example is specifically for Objective-C or Objective-C++, but the concept can potentially be applied to any language with types to help remove redundancy.\n\n### Real-World Example Before and After Preprocessing\n\nHere's a real-world example to illustrate how the preprocessor can transform code using the `.sp` configuration file:\n\n**Before Preprocessing**\n```cpp\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n\nvoid processFiles(std::vector\u003cMyNamespace::File\u003e files) {  \n    std::cout \u003c\u003c \"Processing \" \u003c\u003c files.size() \u003c\u003c \" files.\\n\";\n}\n\nint main() {\n    std::vector\u003cMyNamespace::File\u003e files;\n    processFiles(files);\n}\n```\n\n**After Preprocessing**\n```cpp\nStaticPairConfigFile:PairsConfig.sp\n\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n\nvoid processFiles(files) {\n    std::cout \u003c\u003c \"Processing \" \u003c\u003c files.size() \u003c\u003c \" files.\\n\";\n}\n\nint main() {\n    files;\n    processFiles(files);\n}\n```\n\nThis example demonstrates how the preprocessor can simplify code by removing redundancy and making type declarations more concise.\n\n### .sp Configuration Rules for C++ Example\n\nTo achieve the transformation shown in the real-world example, you can use the following `.sp` configuration rule:\n\n```plaintext\nfiles -\u003e std::vector\u003cMyNamespace::File\u003e files\n```\n\nThis rule allows the preprocessor to replace the placeholder `files` with `std::vector\u003cMyNamespace::File\u003e files`, simplifying the code by removing explicit type declarations.\n\n### Objective-C++ Timer Application Example\n\nThis example demonstrates an Objective-C++ application using the preprocessor for type-safe code generation. The application is a simple timer with a graphical interface.\n\n#### Key Features\n\n- **GUI**: Uses Cocoa for a window with a button and label.\n- **Timer**: Implements a start/stop timer with `NSTimer` and `std::chrono`.\n- **Preprocessor**: Uses `.mmsp` file for type-safe mappings.\n\nThe preprocessor utilizes the `TimerApp.sp` configuration file and the main source code in `TimerApp.mmsp` to produce the final `TimerApp.mm` file. This process streamlines code and enhances type safety in an Objective-C++ context.\n\n## Contributing\n\nContributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nFor any questions or feedback, please contact demensdeum@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzefir1990%2Fstatic-pairs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzefir1990%2Fstatic-pairs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzefir1990%2Fstatic-pairs/lists"}