Skip to main content

Fetches and inlines remote C include dependencies

Project description

CCinit

image ⚠️ This is still a largely experimental thing. ## License

MIT License. See LICENSE.

CCinit is a tool that generates a single main.c file based on a /**/ annotation, at the start of the file, (described in a section below) which might hypothetically include libraries written as URLs or, in shorter form, with an initial / in the format described below.

Important notes

It doesn't yet support global variables and some other stuff like the C preprocessor. Use at your own risk.

Note that libraries need to be converted to this format, so that they can work at all.

Also linters as of right now aren't compatible with this special library format.

The library directory contains a library made in such a way.

After all it will put all that into a main.c file, that might be gigantic, but which is really supposed to be easily used through features like CTRL + F and terminal text editor.

Recommendations

I also recommend you to use to save frequently, by using Git, so that your work might not be lost.

A tool that can, in a way, making so that the entire code of a package is put within the file main.c, so it becomes one file.

The library directory is not really supposed to be really be used as one cohesive library, but is instead as a mere test of the program.

How to install it

This only works on GNU/Linux as of now or it could be used on Windows with a compatibility layer.

To install CCinit, use this, except you might want to replace the ~ directory with something else.

cd ~
git clone https://github.com/codemanticism/CCinit.git
cp ~/CCinit/ccinit.py ~/.local/bin/ccinit

How to use

What to type in the terminal

  • ccinit: Create a main.c file.
  • ccinit main.c: Reads the main.c file and actually does all that heavy lifting for you and everything after \n/*main*/ remains the same.

How to format the .c file

Important: Don't use the #include "LIBRARY" structure wherein LIBRARY refers to the file which has already been specified through the the system of initial annotations I made for this program.

For all of these substrings seperated by that start with /, it already fills all the stuff in, so that, for example, /[insert_other_project]/refs/heads/main/main.c if used in the correct context can make it so that it already fills in the rest, meaning the https://raw.githubusercontent.com/codemanticism part, in this case.

It creates a compile.sh file, if there's not one and no arguments are specified, which is supposed to compile it with gcc.

If there's no main.c in the root of the directory, it will create a main.c file and no further arguments are provided in the context. If there is one argument, then it will download all the dependencies listed like so, at the start of the file.

An example:

/*https://raw.githubusercontent.com/codemanticism/CCinit/refs/heads/main/libraries/calc.c /random.c*/
//^Where the URLs go.
/*main*/
int main(){
}
...

or (it should work):

/*/calc.c /random.c*/
//IF PATH is https://raw.githubusercontent.com/codemanticism/CCinit/refs/heads/main/libraries/something.c 
//^Where the URLs go.
/*main*/
int main(){
}
...

It has to be styled like this: /*example*/, not like that: //example. It has to be the very first line of the file, so the file has to start with /*.

Limits

It was made to be used for .c files only. I wanted to make using C easier and more fun to use, so that it could be more like working with pip.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccinit-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccinit-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file ccinit-0.1.0.tar.gz.

File metadata

  • Download URL: ccinit-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for ccinit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 30713dc04721ed72df3382be01498180e5a9c3ece1d9c204d6c4bc7dc8e21fc6
MD5 d7144063e1ad35cb205f42aed78924b2
BLAKE2b-256 dcecfa95e6094da6b28277999571549e5674e1c080e78261dd091f79e5ac4ddc

See more details on using hashes here.

File details

Details for the file ccinit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ccinit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for ccinit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0f2fa8303d0166600e746a94409fc68c3f3fa73797bbc63331f69ba22ac5b07
MD5 f541d89fdf39e917eb5cb19c3e3e1b4d
BLAKE2b-256 e8d1451c89fe46ef55d6ca4d64cd39fc56c40ee6a91222a60f40703e9e3cdb7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page