Giter Site home page Giter Site logo

liurunzhan / cgraph Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 3.19 MB

A C library for graph and mathematical analysis

License: GNU General Public License v3.0

Makefile 3.33% C 83.91% Python 3.03% R 0.50% Lua 0.68% CMake 0.23% Batchfile 0.46% PowerShell 0.33% Shell 2.81% Raku 0.41% Perl 1.04% Go 0.59% Julia 0.41% Common Lisp 0.07% Ruby 0.48% Haskell 0.07% Tcl 0.52% TypeScript 0.60% Clojure 0.08% Groovy 0.46%

cgraph's Introduction

cgraph


A C library for graph and mathematical analysis

                                                _                               
                                               | |                              
                       ___ __ _ _ __ __ _ _ __ | |__                            
                      / __/ _` | '__/ _` | '_ \| '_ \                           
                     | (_| (_| | | | (_| | |_) | | | |                          
                      \___\__, |_|  \__,_| .__/|_| |_|                          
                           __/ |         | |                                    
                          |___/          |_|                                    

Compilation


Learn more types of programming languages, and know more ways to ponder, model and deal with real problems.

Standard way


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.

Custom way


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)  

Compiler


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

Summary


Platform List


Windows Platforms:

Linux Platforms:

Compiler List


Windows Platforms Only:

All Platforms:

Script List


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...).

Overview


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.

Structure


Template Hierarchy


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])
Loading

Branches


Dist


Julia


Perl


Python


R


cgraph's People

Contributors

liurunzhan avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.