{"id":23449965,"url":"https://github.com/natefoo/predef","last_synced_at":"2025-04-13T19:20:40.130Z","repository":{"id":77041697,"uuid":"42192989","full_name":"natefoo/predef","owner":"natefoo","description":"Overview of pre-defined compiler macros for standards, compilers, operating systems, and hardware architectures","archived":false,"fork":false,"pushed_at":"2015-09-10T16:54:11.000Z","size":240,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T09:52:35.583Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natefoo.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}},"created_at":"2015-09-09T17:15:10.000Z","updated_at":"2025-03-09T14:48:29.000Z","dependencies_parsed_at":"2023-03-01T03:41:30.344Z","dependency_job_id":null,"html_url":"https://github.com/natefoo/predef","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefoo%2Fpredef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefoo%2Fpredef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefoo%2Fpredef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natefoo%2Fpredef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natefoo","download_url":"https://codeload.github.com/natefoo/predef/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766686,"owners_count":21158302,"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":[],"created_at":"2024-12-23T23:31:13.949Z","updated_at":"2025-04-13T19:20:40.086Z","avatar_url":"https://github.com/natefoo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"predef\n======\n\nOverview of pre-defined compiler macros for standards, compilers, operating\nsystems, and hardware architectures.\n\nThis repository contains includes that can be used to set standardized macros\nbased on these system variables. If you are only interested in what standards,\ncompilers, etc. define what macros (e.g. how to detect them on your own), see\n[the documentation in the wiki](https://github.com/natefoo/predef/wiki/)\n\npredef was originally created by [Bjorn\nReese](http://sourceforge.net/u/breese/profile/) and maintained in\n[SourceForce](http://sourceforge.net/projects/predef/). This copy is maintained\nby [Nate Coraor](https://github.com/natefoo/).\n\nLicense\n-------\n\nThe original license for this project is a modified version of the MIT license,\nand can be found in the\n[LICENSE](https://github.com/natefoo/predef/blob/master/LICENSE) file.\n\nsrc export\n----------\n\nThis repository is a cvs-\u003egit export of the [predef project on\nSourceForge](http://sourceforge.net/p/predef/wiki/Home/) as of September 08,\n2015. I won't be attempting to synchronize past this point.\n\nThe original predef repository was stored in the\n[src](http://predef.cvs.sourceforge.net/viewvc/predef/src/) module of the\n[predef CVS repository](http://predef.cvs.sourceforge.net/).  I used Eric\nRaymond's [cvs-fast-export tool](http://www.catb.org/esr/cvs-fast-export/) to\nconvert to git.\n\nwiki export\n-----------\n\nThe [doc module](http://predef.cvs.sourceforge.net/viewvc/predef/doc/) in CVS\nunfortunately only contained outdated Emacs Muse source files. Instead, I\ncreated and used [slurpwiki](https://github.com/natefoo/slurpwiki) to grab the\n[predef wiki from SourceForge](http://sourceforge.net/p/predef/wiki/Home/) with\nrevision history and attribution.\n\npredef macros\n-------------\n\nThese files are work in progress. Please submit a [pull\nrequest](https://github.com/natefoo/predef/pull/new/master) to contribute.\n\nThe include directory and subdirectories contains predef wrappers for common\nsystem header files.\n\nThe wrappers must be included as normal header files. They define macros for\neach function provided by the individual system header file, and include the\nassociated system header file. For example, instead of including `\u003cstdio.h\u003e`,\nyou should include `\u003cpredef/stdio.h\u003e` which will include `\u003cstdio.h\u003e` and set\nvarious macros.\n\nAll wrapper files depends on `\u003cpredef/predef.h\u003e` and the associated header\nfiles directory. If single files are copied into the distribution of an\napplication, then the following header files must be copied as well:\n\n```\n  \u003cpredef/predef.h\u003e\n  \u003cpredef/predef/compiler.h\u003e\n  \u003cpredef/predef/os.h\u003e\n  \u003cpredef/predef/standard.h\u003e\n  \u003cpredef/predef/library.h\u003e\n```\n\nExample of use\n--------------\n\nUsing autoconf type:\n\n```c\n#include \u003cconfig.h\u003e\n#if defined(HAVE_INTTYPES_H)\n#include \u003cinttypes.h\u003e /* strtoimax */\n#else\n#include \u003cstdlib.h\u003e /* strtol */\n#endif\n\nintmax_t my_atoimax(const char *text)\n{\n#if defined(HAVE_STRTOIMAX)\n  return strtoimax(text, 0, 10);\n#else\n  return strtol(text, 0, 10);\n#endif\n}\n```\n\nUsing predef type:\n\n```c\n#include \u003cpredef/inttypes.h\u003e /* strtoimax */\n#if !defined(PREDEF_HEADER_INTTYPES)\n#include \u003cstdlib.h\u003e /* strtol */\n#endif\n\nintmax_t my_atoimax(const char *text)\n{\n#if defined(PREDEF_FUNC_STRTOIMAX)\n  return strtoimax(text, 0, 10);\n#else\n  return strtol(text, 0, 10);\n#endif\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatefoo%2Fpredef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatefoo%2Fpredef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatefoo%2Fpredef/lists"}