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.1.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.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ccinit-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f8416ecded6c8de02a26109c687ccb7a5e50bc6a70f3f53238952d45b5e154e2
MD5 52a8433fa1762000d5a02230a0c2c6d2
BLAKE2b-256 f3e43d1c0e937bd843ec7f81c90887d7d8108c828b1e9f3daef6fcae82081f74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ccinit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fecdc104e1466caf32fc48b49e772a9fca2fffbe95878814ad11be6291373757
MD5 2474b1b52e9e1c6b8fbeb83f3a2cb22b
BLAKE2b-256 5daa9ce731c6c7257a3fc6254436a2d3467978428d96f0e4076d0aa09214fc2c

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