A C library for graph and mathematical analysis
_
| |
___ __ _ _ __ __ _ _ __ | |__
/ __/ _` | '__/ _` | '_ \| '_ \
| (_| (_| | | | (_| | |_) | | | |
\___\__, |_| \__,_| .__/|_| |_|
__/ | | |
|___/ |_|
Learn more types of programming languages, and know more ways to ponder, model and deal with real problems.
This library can be configured by autotools with autogen.sh and configure, compiled and checked by Makefiles with the following standard steps:
chmod +x ./autogen.sh
./autogen.sh
./configure --prefix=${prefix} --enable-gtk-doc
make
make doc
make check
packaged and checked by Makefiles with the following standard steps:
make dist
make distcheck
and cleaned by Makefiles with the following standard steps:
make clean
or
make distclean
and updated by Makefiles and git with the following standard steps:
make update
Only the platform supports bash and autotools that can use the standard way to compile this library, such as Linux and other Unix-like OS. If the users use Windows OS, use msys, msys2, cygwin or wsl instead.
This library supports mingw32-make (compile.mk), make (compile.mk), cmake (CMakeLists.txt), xmake (xmake.lua), meson (meson.build) and ninja (compile.ninja) to compile all the source files with the version of debug (with the addtional compilation flags of "-g -DDEBUG") and release (with the addtional compilation flags of "-O2"), cross different platforms of mingw, msys, msys2, cygwin, wsl and linux.
This library also provides bash shell script compile.sh, z shell script compile.zsh, fish shell script compile.fish, c shell script compile.csh and v shell script compile.vsh in msys, msys2, cygwin, wsl and linux, batch script compile.bat and powershell script compile.ps1 in mingw to directly compile this library by C compiler without make tools in special platforms(notice that incremental compilation is unsupported). All the compile scripts provide the same command-line arguments, without any argument or with the arguments of test, clean, distclean and help.
What's more, this library provides perl script compile.pl, raku/perl6 script compile.raku, ruby script compile.rb, crystal script compile.cr, python script compile.py, lua script compile.lua, r script compile.r, julia script compile.jl, tcl script compile.tcl, ocaml script compile.ml, lisp script compile.lisp in clisp, elixir script compile.exs and io script compile.io to compile this library(where incremental compilation is also unsupported here). Make tools and shells are good enough to do above things well, but the script languages can do the same as well, especially much easily cross-platform.
In addtion, this library provides some other language scripts, based on jvm, to do the same work, such as java script compile.java in openjdk11, scala script compile.scala, kotlin script compile.kts, clojure script compile.clj and groovy script compile.groovy.
Some compiled languages realized by given compilers with special extension tools can also be used to write scripts, such as c script compile.c in tcc, go script compile.go in go with gorun, swift script compile.swift, haskell script compile.hs in haskell with runhaskell, rust script compile.rs in rust with rustx, erlang script compile.escript, nims script compile.nims and zig script compile.zig.
All above ways are called with Makefile.mk in MSYS, MSYS2, CYGWIN or Linux platform by
make -f Makefile.mk $(TOOL) CMD=$(CMD)
or in Windows platform by
mingw32-make.exe -f Makefile.mk $(TOOL) CMD=$(CMD)
Any compiler who supports STANDARD C89/ANSI C/C99/C11 can compile this library well, such as mingw32-gcc, mingw-w64-i686-gcc, mingw-w64-x86_64-gcc, tcc, gcc and clang. Their flags are lised as bellow. If you want to cross compilers, use flag "-pedantic -Wall -std=c89/c99/c11" or "-pedantic -Wall -ansi" instead.
tool name | optional flags 1 | optional flags 2 |
---|---|---|
mingw32-gcc, mingw-w64-i686-gcc, mingw-w64-x86_64-gcc, tcc, gcc | -pedantic -Wall -fPIC -std=c89/c99/c11 | -pedantic -pedantic-errors -Wall -fPIC -ansi |
clang | -pedantic -Wall -std=c89/c99/c11 | -pedantic -Wall -ansi |
Windows Platforms:
Linux Platforms:
Windows Platforms Only:
All Platforms:
All the involved compilation scripts in this library are listed as below. Users can run them individually, call them by Makefile.mk with Option TOOL and use Configure.pl to change their default configurations (Ongoing...).
- CMake CMakeLists.txt
- DOS Batch compile.bat
- C compile.c
- Ceylon compile.ceylon
- Clojure compile.clj
- Crystal compile.cr
- C Shell compile.csh
- D compile.d
- Erlang compile.escript
- Elixir compile.exs
- Fish Shell compile.fish
- Go compile.go
- Groovy compile.groovy
- Haskell compile.hs
- IO compile.io
- Java compile.java (Needs java11 or higher)
- Julia compile.jl
- JavaScript compile.js
- K Shell compile.ksh
- Kotlin compile.kts
- Lisp compile.lisp
- Lua compile.lua (Needs lua5.1 or higher and luafilesystem)
- Makefile compile.mk
- Ocaml compile.ml
- Nims compile.nims
- Ninja compile.ninja
- Odin compile.odin
- PHP compile.php (Needs PHP7.0 or higher)
- Perl compile.pl
- Powershell compile.ps1
- Python compile.py (Needs Python2.7, Python3.4 or higher and pathlib)
- R compile.r
- Raku/Perl6 compile.raku
- Ruby compile.rb
- Rebol compile.rebol
- Red compile.red
- Rust compile.rs
- Scala compile.scala
- Bourne Shell compile.sh
- Swift compile.swift
- Tcl/Tk compile.tcl
- Typescript compile.ts
- V Shell compile.vsh
- Zig compile.zig
- Z Shell compile.zsh
- Meson meson.build
- Premake premake.lua
- XMake xmake.lua
- Xonsh compile.xsh
Do what you want to do, and be what you want to be!
I used to use process-oriented languages to think and solve problems, like C, Perl and Shell, but now I want to use concepts in C to do something different:
- pointers and structures to realize some features in object-oriented programming
- macros to realize the features in generic and interface-oriented programming
- integers to implement float pointer numbers and their operators by software, instead of FPU
so that I can know more about computer knowledge and programming paradigms.
A lot of repetitive work used to be done by object-oriented compilers, must be done by hand while programming with C. The process may be tough and boring, but the target is cool and interesting enough! And it is also meaningful for me to understand the mechanism behind computers and compilers. Writing a library by hand will be better than packaging the APIs of a known library, for the case that its stability and safety can be controlled and guaranteed.
graph LR;
template_base.ct[template_base] --data-based--> template_data.ct(template_data)
template_data.ct(template_data) --"object-based"--> template_object.ct([template_object])
template_data.ct(template_data) --int-based--> template_int.ct([template_int])
template_data.ct(template_data) --float-based--> template_float.ct([template_float])
template_data.ct(template_data) --point-based--> template_point.ct([template_point])
template_base.ct[template_base] --structure based--> template_struct.ct(template_struct)
template_struct.ct(template_struct) --matrix-based--> template_matrix.ct([template_matrix])
template_struct.ct(template_struct) --3d-matrix-based--> template_matrix3d.ct([template_matrix3d])