| Summary: This project is pretty straight forward. You will recode printf. Fortunetaly you will be able to reuse it in future projects as a legit function of your libft. You will mainly learn how to use variadic arguments. | Резюме: этот проект довольно прост. Вы перекодируете printf. К счастью, вы сможете повторно использовать его в будущих проектах в качестве законной функции вашего libft. В основном вы узнаете, как использовать вариативные аргументы. |
|---|
| The versatility of the printf function in C represents a great exercise in programming for us. This project is of moderate difficulty. It will enable you to discover variadic functions in C. | Универсальность функции printf в C представляет для нас отличное упражнение в программировании. Этот проект средней сложности. Это позволит вам открыть для себя вариативные функции в C. | | --- | --- | | The key to a successful ft_printf is a well-structured and good extensible code. | Ключ к успеху ft_printf - это хорошо структурированный и хорошо расширяемый код. |
| • Your project must be written in accordance with the Norm. If you have bonus files/functions, they are included in the norm check and you will receive a 0 if there
| is a norm error inside. | Ваш проект должен быть написан в соответствии с Нормой. Если у вас есть бонусные файлы / функции, они включаются в проверку нормы, и вы получите 0, если внутри есть ошибка нормы. |
|---|---|
| • Your functions should not quit unexpectedly (segmentation fault, bus error, double | |
| free, etc) apart from undefined behaviors. If this happens, your project will be | |
| considered non functional and will receive a 0 during the evaluation. | Ваши функции не должны неожиданно завершаться (ошибка сегментации, ошибка шины, двойное освобождение и т. Д.), За исключением неопределенного поведения. Если это произойдет, ваш проект будет считаться нефункциональным и получит 0 во время оценки. |
| • All heap allocated memory space must be properly freed when necessary. No leaks | |
| will be tolerated. | При необходимости все пространство памяти, выделенное кучей, должно быть должным образом освобождено. Утечки недопустимы. |
| • If the subject requires it, you must submit a Makefile which will compile your | |
| source files to the required output with the flags -Wall, -Wextra and -Werror, use | |
| cc, and your Makefile must not relink. | Если субъект требует этого, вы должны отправить Makefile, который скомпилирует ваши исходные файлы в требуемый вывод с флагами -Wall -Wextra -Werror, используйте cc, и ваш Makefile не должен повторно связываться. |
| • Your Makefile must at least contain the rules $(NAME), all, clean, fclean and | |
| re. | Ваш Makefile должен содержать как минимум правила $ (NAME), all, clean, fclean и re. |
| • To turn in bonuses to your project, you must include a rule bonus to your Makefile, | |
| which will add all the various headers, librairies or functions that are forbidden on | |
| the main part of the project. Bonuses must be in a different file _bonus.{c/h}. | |
| Mandatory and bonus part evaluation is done separately. | Чтобы превратить бонусы в свой проект, вы должны включить бонус правила в свой Makefile, который добавит все различные заголовки, библиотеки или функции, запрещенные в основной части проекта. Бонусы должны быть в другом файле _bonus. {C / h}. Оценка обязательной и бонусной части проводится отдельно. |
| • If your project allows you to use your libft, you must copy its sources and its | |
| associated Makefile in a libft folder with its associated Makefile. Your project’s | |
| Makefile must compile the library by using its Makefile, then compile the project. | Если ваш проект позволяет вам использовать ваш libft, вы должны скопировать его исходный код и связанный с ним Makefile в папку libft с соответствующим Makefile. Makefile вашего проекта должен скомпилировать библиотеку, используя свой Makefile, а затем скомпилировать проект. |
| • We encourage you to create test programs for your project even though this work | |
| won’t have to be submitted and won’t be graded. It will give you a chance | |
| to easily test your work and your peers’ work. You will find those tests especially | |
| useful during your defence. Indeed, during defence, you are free to use your tests | |
| and/or the tests of the peer you are evaluating. | Мы рекомендуем вам создать тестовые программы для своего проекта, даже если эту работу не нужно будет отправлять и оценивать. Это даст вам возможность легко проверить свою работу и работу коллег. Вы найдете эти тесты особенно полезными во время защиты. Действительно, во время защиты вы можете использовать свои тесты и / или тесты партнера, которого вы оцениваете. |
| • Submit your work to your assigned git repository. Only the work in the git reposi- | |
| tory will be graded. If Deepthought is assigned to grade your work, it will be done | |
| after your peer-evaluations. If an error happens in any section of your work during | |
| Deepthought’s grading, the evaluation will stop. | Отправьте свою работу в назначенный репозиторий git. Оцениваться будет только работа в репозитории git. Если DeepThreadt назначен для оценки вашей работы, это будет сделано после ваших оценок коллег. Если во время выставления оценок Deepoughtt в каком-либо разделе вашей работы произойдет ошибка, оценка будет остановлена. |
| Program name
(Имя программы) | libftprintf.a
| |
| --- | --- | --- |
| Turn in files
(Сдать файлы) | *.c, */*.c, *.h, */*.h, Makefile
| |
| Makefile | all, clean, fclean, re, bonus | |
| External functs.
(Внешние функции) | malloc, free, write, va_start, va_arg, va_copy, va_end | |
| Libft authorized | yes | |
| Description
(Описание) | Write a library that contains ft_printf, a function that will mimic the real printf | Напишите библиотеку, содержащую ft_printf, функцию, имитирующую реальный printf |
The prototype of ft_printf should be int ft_printf(const char *, ...); |
Прототип ft_printf должен быть int ft_printf (const char *, ...); |
|---|---|
| You have to recode the libc’s printf function | Вам необходимо перекодировать функцию printf библиотеки libc |
| It must not do the buffer management like the real printf | Он не должен управлять буфером, как настоящий printf |
It will manage the following conversions: cspdiuxX% |
Он будет управлять следующими преобразованиями: cspdiuxX% |
| It will be compared with the real printf | Он будет сравниваться с реальным printf |
You must use the command ar to create your librairy, using the command libtool |
|
| is forbidden. | Вы должны использовать команду ar для создания вашей библиотеки, использование команды libtool запрещено. |
| A small description of the required conversion: | Небольшое описание необходимого преобразования: |
|---|---|
%c print a single character. |
|
%c вывести один символ. |
|
%s print a string of characters. |
|
%s печатает строку символов. |
|
%p The void * pointer argument is printed in hexadecimal. |
%p Аргумент указателя void * печатается в шестнадцатеричном формате. |
%d print a decimal (base 10) number. |
%d вывести десятичное число (с основанием 10). |
%i print an integer in base 10. |
|
%i выводит целое число по основанию 10. |
|
%u print an unsigned decimal (base 10) number. |
|
%u вывести десятичное число без знака (с основанием 10). |
|
%x print a number in hexadecimal (base 16), with lowercase. |
%x вывести число в шестнадцатеричном формате (с основанием 16) со строчными буквами. |
%X print a number in hexadecimal (base 16), with uppercase. |
%X вывести число в шестнадцатеричном формате (с основанием 16) в верхнем регистре. |
%% print a percent sign. |
%% вывести знак процента. |
for more complete references : man 3 printf / man 3 stdarg ``для более полных ссылок: man 3 printf / man 3 stdarg
| If the Mandatory part is not perfect don’t even think about bonuses | Если Обязательная часть не идеальна, даже не думай о бонусах |
|---|---|
| You don’t need to do all the bonuses | Необязательно делать все бонусы |
Manage any combination of the following flags: ’-0.’ and minimum field width with all conversions |
Управляйте любой комбинацией следующих флагов: ’-0.’ И минимальная ширина поля со всеми преобразованиями |
Manage all the following flags: ’# +’ (yes, one of them is a space) |
Управляйте всеми следующими флагами: ’# +’ (да, один из них - пробел) |
If you plan to do bonuses you should think about how to do them from the beginning to avoid a naive approach.
Если вы планируете делать бонусы, вам следует подумать о том, как их делать с самого начала, чтобы избежать наивного подхода.