Giter Site home page Giter Site logo

saloniamatteo / smclib Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 450 KB

Salonia Matteo's C Library (written in C99)

Home Page: https://salonia.it/software.html

License: GNU General Public License v3.0

C 4.53% Makefile 8.74% Shell 86.59% M4 0.14%
c c-library smclib c-header posix-c posix-compliant c99 libsmc library

smclib's Introduction

SMCLib

Salonia Matteo's C Library (or SMCLib) is a C Library written by Salonia Matteo.

I have included at least one example implementation for each individual library.

Libraries are located under lib/, and examples are located under src/.

All of the function headers (and examples) use _POSIX_C_SOURCE 200809L.

Installation

SMCLib uses GNU AutoTools, to increase portability. To install libraries under /usr/local/include, run the following commands:

./configure
make
# run the following command as root,
# or by prepending doas/sudo
make install

This will compile both libraries, and examples.

NOTE: SMCLib will be installed as a shared (and static) library, under /usr/local/lib, with the name libsmc.

Using Libraries

Just #include <smclib.h> in your C source code, making sure you installed libraries. It's also possible to only include a library: for example, include only the "color.h" library:

#include <stdio.h>
#include <color.h>

int
main(void)
{
	/* some code... */
	return 0;
}

Included Libraries

  • smclib.h: The SMCLib Meta-Library.

    • Declares and Assigns float _smclib_ver, which contains this Library's version; Also contains function prototypes.
  • color.h: Color a string.

    • Contains two functions, color, and _free_color, which frees allocated memory.
  • compiler.h: Define Compiler used.

    • Defines CC, which will contain the name of the compiler used (CLang, GCC, or MSVC).
  • platform.h: Define Target Architecture.

    • Defines ARCH, which will contain the name of the target architecture, as well as OS, which contains the name of the Operating System (WIN32, UNIX, UNKNOWN).
  • cputemp.h: Get current CPU temperature.

    • Defines CPUTEMP_RD_PATH, which is the location used to read the CPU temperature; has 3 functions: get_temp() (get temp in Celsius), get_temp_k() (get temp in Kelvin), get_temp_f() (get temp in Fahrenheit).
  • temp.h: Convert temperatures.

    • Has 4 functions: celsius_to() (convert from Celsius to Kelvin/Fahrenheit), kelvin_to() (convert from Kelvin to Celsius/Fahrenheit), fahrenheit_to() (convert from Fahrenheit to Celsius/Kelvin), temp_conv() (meta-function for conversions).

Custom Makefile rules

In addition to the regular make and make install command, you can run the following:

  • make cleandir: Clean the current directory (used after updating configure.ac, Makefile.am, etc.)
  • make headers: Print the available headers.
  • make info: Print information regarding this project.
  • make version: Print the current SMCLib version.

smclib's People

Contributors

saloniamatteo avatar

Stargazers

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