Giter Site home page Giter Site logo

ft_printf's People

Contributors

imrew-vantey avatar lgutter avatar

Stargazers

 avatar

Watchers

 avatar

ft_printf's Issues

Improve makefile so we recognize if files have changed, and to minimize recompiling.

Right now, if a file changes but the library or test executable is compiled, the makefile doesn't compile. we have to manually use make re or make retest.

I think we can improve the makefile in at least these 2 ways:

  • There should be a way to recognize if any files for a specific rule has changed, so if, for example, we have modified or added a test, calling make test should recognize this and recompile that file and finally the executable. This will require compiling to .o files first, but that should not be an issue.
  • We should also try to minimize the amount of times libft are recompiled. right now it is ALWAYS compiled when we call make re or make retest, while 90% of the time nothing has changed.

Integrate norm checks in the tests

right now any code with norm errors will get past travis, since travis doesn't look at the norm at all. We should integrate the norm checks into the travis checks.
Perhaps the easiest way is to make a norm rule in the Makefile which is always run when the test rule is run.
And integrate norminette+ aswell I guess?
And we need to check if travis will fail based on norminette output. (probably not, so maybe create a bash script which returns 1 or 0 based on errors?)

Decimal floating point module

just %f should print the argument as a decimal floating point number. with the modifier l it should print the argument as a double, and with the modifier L it should print a long double.
It is easiest to start with a long double, since we'll be able to convert that to the smaller types.
modifiers (#0-+' ') should all modify the output correctly (check all)

String module

%s should print the argument as a null terminated string of characters. precision overrides the null terminator, so when precision is provided, that is the maximum amount of characters to be printed. Width pads the string with spaces. check exact behaviour with modifiers. (-+0#' ')

Make ft_strexpand

Create a function that takes a source/destination AND string to add as arguments, and adds that to the source/destination by creating an new copy with both of them, and frees the old source.

think of the best way to compare our ft_printf to the real printf

Right now we don't really compare our ft_printf to the real thing.
It could be nice to do so, and we could either change existing tests to compare to printf output instead of a fixed string, or write extra tests that compare ours to the real printf.
Discuss and implement. :)

build ft_formatlongint

Build ft_formatlongint following the model of ft_formatint.
there is a placeholder for this called ft_formatlong.

Signed decimal integer module

%d or %i should print the argument as a signed decimal integer. all modifiers (-+#0' ') should modify the result correctly. (check all)

Hexadecimal module

this might become 2 modules, but is probably just as easily done in one. %x should print the argument as a hexadecimal integer with lowercase abcdef, and %X with uppercase ABCDEF. check how all modifiers (0-+#' ') work.

build ft_ulltoa_base

Build a function that takes a unsigned long long as argument 1, and a base as argument 2, and returns the given integer value as an ascii string of characters.
the input value can range from 0 to +18,446,744,073,709,551,615,
and the input base should at least work with a range from 1 to 16, and preferably to as high as possible.

build ft_formatshortint

Build ft_formatshortint following the model of ft_formatint.
there is a placeholder for this called ft_formatshort.

Signed octal module

%o should print the argument as a signed octal. Check how all modifiers (0-+#' ') work.

build ft_lltoa_base

Build a function that takes a signed long long as argument 1, and a base as argument 2, and returns the given integer value as an ascii string of characters.
the input value can range from โˆ’9,223,372,036,854,775,808 to +9,223,372,036,854,775,807,
and the input base should at least work with a range from 1 to 16, and preferably to as high as possible.

Build the main ft_printf function

Build the function that will iterate through the format string and call modules for flags.
We should probably use enums and an array of function pointers to direct to the proper function per flag.

Improve project structure

Right now we don't really have a consistent naming convention for files/functions etc, and everything is in the main directory.
I think we could greatly improve the structure of the project, first of all moving all source files to a sources directory, and thinking about further separation.
We should also consider splitting up the header file if we decide to separate the source files more.

Character module

%c will print the argument as an unsigned char. precision does nothing, width pads the character. Check how modifiers (-+#0' ') work exactly for %c.

build ft_formatlonglong

Build ft_formatlonglongint following the model of ft_formatint.
there is a placeholder for this called ft_formatlonglong.

Pointer address module

%p should print the argument as a memory address (pointer). width works differently with and without the 0 modifier, precision does something, figure out what. Also figure out other modifiers (+-#' ')

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.