Giter Club home page Giter Club logo

myprintf's Introduction

C99 Printf Recreation

Recreating infamous printf function as described by standard C99.

Caution

Copying the content of this repository for your own delivery will grade you a -42 for cheating.

๐Ÿ“• C99 limitations

Please refer to the fprintf format specification for information about supported features.

The current implementation follows strictly the C99 compliance, with the following known exceptions:

  • long double (IEEE float 80) support has not been implemented.
  • multibyte character (wchar_t) are not supported.
  • %e as not been kept due to its incorrectness.

Note

Ask requested by the assignment, conversion specifier B and b from c2x standard have been implemented, corresponding to binary format.

โ“ Invalid format

In case of invalid format, as specified by C99,our function will treat the given sequence as regular text and continue.

๐Ÿ”ง Setup

Note

To ensure a consistent development environment and to simplify dependency management, we strongly recommend using Nix. The project is configured to work seamlessly with Nix, providing reproducible builds and a standardized development environment.

If you haven't already, consider installing Nix by following the instructions on nix installation page.

๐ŸŒธ Nix

You can use the standard nix flakes commands to clone, build, ... this project.

nix build github:Sigmapitech/myprintf

outputs libmy.a containing my_printf.

๐Ÿ“Ž Non-nix

0. Install the required dependencies

Make sure to have the following dependencies available within your environment:

  • The Coreutils command set, which are expected to exist on every operating system.
  • a recent version of Gnu make ~4.x.x
  • GCC, preferably, version 13.x.x along the GNU C Library.
  • The GNU ar archive program, provided by binutils.
  • Optionally, tput command to support colors within the Makefile.
  • criterion library to compile tests.
  • gcovr to retrieve coverage report.

Epitest Docker

If you want to use the epitest container provided by Epitech, you can use the following command:

docker run -it --rm -v $(pwd):/home/project -w /home/project epitechcontent/epitest-docker:latest /bin/bash

I. Clone the repository

git clone https://github.com/Sigmapitech/myprintf.git myprintf
cd myprintf

II. Compile the library

Tip

you can touch .fast to use parralel building.

make

To see other available targets, you can use a program such as fzf-make.

๐Ÿ“‘ DEVELOPMENT

if you are using Nix, you can access a devShell that you can develop with the project dependencies to build and develop.

nix develop
nix develop github:Sigmapitech/myrpg

Using direnv

You may load the devShell automatically using direnv shell integration.

echo "use flake" | tee .envrc
direnv allow

๐Ÿ”ฌ TESTING

A tester is provided to compared the implementation along-side printf from glibc. Test table only features defined behaviour described by the standard.

To run the tests and get a coverage report:

make cov

myprintf's People

Contributors

sigmanificient avatar electroniciv avatar github-actions[bot] avatar

Stargazers

Hoorad Farrokh avatar CobbCoding avatar Tim avatar Savalet avatar

myprintf's Issues

Setup the full workflow

We need to make an operational CI/CD system with the following:

  • fix headers
  • coding style
  • compilation
  • unittesting
  • codecov integration
  • sync repo

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.