Also changed formatting to comply with the norm.
-//27.06.2023 20:28
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_foreach.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/27 20:28:04 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:05:10 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
-void ft_foreach(int *tab, int length, void(*f)(int))
+void ft_foreach(int *tab, int length, void (*f)(int))
{
int i;
-//27.06.2023 20:30
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_map.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/27 20:30:34 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:06:20 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#include <stdlib.h>
-int *ft_map(int *tab, int length, int(*f)(int))
+int *ft_map(int *tab, int length, int (*f)(int))
{
int i;
int *res;
-//27.06.2023 20:39
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_any.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/27 20:39:52 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:07:34 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
-int ft_any(char **tab, int(*f)(char*))
+int ft_any(char **tab, int (*f)(char*))
{
while (*tab)
- if(f(*(tab++)))
+ if (f(*(tab++)))
return (1);
return (0);
}
-//27.06.2023 20:41
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_count_if.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/27 20:41:17 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:06:20 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
-int ft_count_if(char **tab, int length, int(*f)(char*))
+int ft_count_if(char **tab, int length, int (*f)(char*))
{
int i;
int count;
-//27.06.2023 20:48
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_is_sort.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/27 20:48:37 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:06:20 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
-int ft_is_sort(int *tab, int length, int(*f)(int, int))
+int ft_is_sort(int *tab, int length, int (*f)(int, int))
{
int i;
-//28.06.2023 06:21
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* operators.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 06:21:27 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:08:48 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#ifndef OPERATORS_H
# define OPERATORS_H
-//28.06.2023 06:47
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* utils.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 06:47:49 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:09:05 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#ifndef UTILS_H
# define UTILS_H
-//27.06.2023 20:53
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* main.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 20:53:06 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:10:18 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#include <unistd.h>
#include "operators.h"
#include "utils.h"
-enum operator_id
+enum e_operator_id
{
Invalid,
Add,
Mod,
};
-enum operator_id get_op_id(char *str)
+enum e_operator_id get_op_id(char *str)
{
if (str[1] != '\0')
return (Invalid);
-//28.06.2023 6:23
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* operators.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 06:23:24 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:10:47 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#include "operators.h"
return (n1 + n2);
}
-int ft_sub(int n1, int n2)
+int ft_sub(int n1, int n2)
{
return (n1 - n2);
}
-int ft_mul(int n1, int n2)
+int ft_mul(int n1, int n2)
{
return (n1 * n2);
}
-int ft_div(int n1, int n2)
+int ft_div(int n1, int n2)
{
return (n1 / n2);
}
-//28.06.2023 6:37
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* utils.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 06:37:35 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:11:02 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#include <unistd.h>
#include "utils.h"
return (c == ' ' || ('\t' <= c && c <= '\r'));
}
-int is_digit(char c)
+int is_digit(char c)
{
return ('0' <= c && c <= '9');
}
-// 28.06.2023 07:13
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_sort_string_tab.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 07:13:52 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 10:06:51 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
void ft_swap(char **s1, char **s2)
{
return ;
}
-int ft_strcmp(char *s1, char *s2)
+int ft_strcmp(char *s1, char *s2)
{
while (*s1 == *s2 && *s1 && *s2)
{
-//28.06.2023 07:29
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* main.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2023/06/28 07:29:06 by ljiriste #+# #+# */
+/* Updated: 2023/06/28 09:55:37 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
#include <unistd.h>