lgutter / ft_printf Goto Github PK
View Code? Open in Web Editor NEWThe most awesome ft_printf! :D
The most awesome ft_printf! :D
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:
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.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.We still need to build precision for octal
for example, ft_printf("%|05i", 123);
outputs 00123
while it should output |05i
!
this is because the ft_find_flags function just keeps going when it doesn't recognize a flag when it is not alphabetical.
Building the precision for d / i conversions.
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?)
We need a function that parses options and places the in the info->options
bitstock, and knows when to stop (when the current character cannot be a valid option)
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)
%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#' ')
right now, the info
struct and t_writer
function pointer only really allow us to write to stdout.
we should refactor this so we can easily build snprintf
, asprintf
and fprintf
.
this might also concern #47 since that also has to do with the structs.
We still need to implement wide characters / %lc
and %ls
%u should print the argument as an unsigned decimal integer. check how all modifiers (0-+#' ') work.
Build ft_formatbyteint following the model of ft_formatint.
Right now, we send convinfo
AND info
structs to the format functions,
which makes me wonder if it could be nicer to move the convinfo
struct into the info
struct.
We should probably discuss this, but it's not crucial.
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.
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
following the model of ft_formatint
.
there is a placeholder for this called ft_formatlong
.
%d or %i should print the argument as a signed decimal integer. all modifiers (-+#0' ') should modify the result correctly. (check all)
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.
2.5
should round to 2
but rounds to 3
. can probably be fixed in ft_round_float
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
following the model of ft_formatint
.
there is a placeholder for this called ft_formatshort
.
%o should print the argument as a signed octal. Check how all modifiers (0-+#' ') work.
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.
if you look at the lowest scoring functions on codecov, there are still a bunch of code lines that we can hit with tests but don't.
We should create tests to hit these lines.
we should only let travis test on master.
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.
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.
%c will print the argument as an unsigned char. precision does nothing, width pads the character. Check how modifiers (-+#0' ') work exactly for %c.
%% should just print a % character. Any modifiers seem to be ignored.
Build ft_formatlonglongint
following the model of ft_formatint
.
there is a placeholder for this called ft_formatlonglong
.
Add a detailed guide for the git workflow we want to use. This can be used as a a reference.
%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 (+-#' ')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.