Only n_to_w is missing
This commit is contained in:
parent
675cab80a7
commit
0b60f1f9e5
|
@ -4,8 +4,10 @@ SRC = main.c \
|
||||||
argparse.c \
|
argparse.c \
|
||||||
dictparse.c \
|
dictparse.c \
|
||||||
ft_linked_list.c \
|
ft_linked_list.c \
|
||||||
|
ft_linked_list_helpers.c \
|
||||||
printing.c \
|
printing.c \
|
||||||
ft_convert.c \
|
ft_convert.c \
|
||||||
|
ft_ntow.c \
|
||||||
|
|
||||||
HEADERS = ft_strlib.h \
|
HEADERS = ft_strlib.h \
|
||||||
ft_io.h \
|
ft_io.h \
|
||||||
|
@ -13,8 +15,10 @@ HEADERS = ft_strlib.h \
|
||||||
argparse.h \
|
argparse.h \
|
||||||
dictparse.h \
|
dictparse.h \
|
||||||
ft_linked_list.h \
|
ft_linked_list.h \
|
||||||
|
ft_linked_list_helpers.h \
|
||||||
printing.h \
|
printing.h \
|
||||||
ft_convert.h \
|
ft_convert.h \
|
||||||
|
ft_ntow.h \
|
||||||
|
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
INCDIR = include
|
INCDIR = include
|
||||||
|
@ -24,7 +28,9 @@ CFLAGS = \
|
||||||
-Wall \
|
-Wall \
|
||||||
-Wextra \
|
-Wextra \
|
||||||
-Werror \
|
-Werror \
|
||||||
-I$(INCDIR)
|
-I$(INCDIR) \
|
||||||
|
-fcolor-diagnostics \
|
||||||
|
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
_OBJ = $(SRC:.c=.o)
|
_OBJ = $(SRC:.c=.o)
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
Activate norminette in Makefile!!!
|
Activate norminette in Makefile!!!
|
||||||
Change .DEFAULT_GOAL in Makefile to 'all'
|
Change .DEFAULT_GOAL in Makefile to 'all'
|
||||||
Handle empty lines
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/01 21:45:39 by tischmid #+# #+# */
|
/* Created: 2023/04/01 21:45:39 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/02 18:40:32 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 19:19:53 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#define MAX_DIGITS 100
|
|
||||||
|
|
||||||
int parse_line(char *line, char *key, char *value)
|
int parse_line(char *line, char *key, char *value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,3 +40,4 @@
|
||||||
1000000000000000000000000000000000: decillion
|
1000000000000000000000000000000000: decillion
|
||||||
1000000000000000000000000000000000000: undecillion
|
1000000000000000000000000000000000000: undecillion
|
||||||
1000000000000000000000000000000000000000: tridecillion
|
1000000000000000000000000000000000000000: tridecillion
|
||||||
|
1000000000000000000000000000000000000000000: uebertreibnicht
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
/* By: shou <shou@student.42berlin.de> +#+ +:+ +#+ */
|
/* By: shou <shou@student.42berlin.de> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/27 12:05:10 by shou #+# #+# */
|
/* Created: 2023/03/27 12:05:10 by shou #+# #+# */
|
||||||
/* Updated: 2023/04/02 18:41:07 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 19:20:00 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_convert.h"
|
#include "ft_convert.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
int rm_spaces(char *str, int *ptr_i)
|
int rm_spaces(char *str, int *ptr_i)
|
||||||
{
|
{
|
||||||
|
@ -31,8 +32,6 @@ int rm_spaces(char *str, int *ptr_i)
|
||||||
return (count);
|
return (count);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int ft_atoi(char *str)
|
int ft_atoi(char *str)
|
||||||
{
|
{
|
||||||
int sign;
|
int sign;
|
||||||
|
@ -51,6 +50,7 @@ int ft_atoi(char *str)
|
||||||
result *= sign;
|
result *= sign;
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_itoa(char *buf, int nb)
|
int ft_itoa(char *buf, int nb)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
|
@ -74,4 +74,3 @@ int ft_itoa(char *buf, int nb)
|
||||||
*(buf + 1) = 0;
|
*(buf + 1) = 0;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,16 @@
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/01 15:25:42 by tischmid #+# #+# */
|
/* Created: 2023/04/01 15:25:42 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/02 18:12:47 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 20:01:34 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_linked_list.h"
|
#include "ft_linked_list.h"
|
||||||
|
#include "ft_linked_list_helpers.h"
|
||||||
#include "ft_strlib.h"
|
#include "ft_strlib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
t_map_entry *ll_map_new_entry(char *key, char *value)
|
t_map_entry *ll_map_new_entry(char *key, char *value, t_map_entry *next)
|
||||||
{
|
{
|
||||||
t_map_entry *new_entry;
|
t_map_entry *new_entry;
|
||||||
char *new_value;
|
char *new_value;
|
||||||
|
@ -27,25 +28,19 @@ t_map_entry *ll_map_new_entry(char *key, char *value)
|
||||||
new_entry = (t_map_entry *) malloc(sizeof(t_map_entry));
|
new_entry = (t_map_entry *) malloc(sizeof(t_map_entry));
|
||||||
new_entry->key = new_key;
|
new_entry->key = new_key;
|
||||||
new_entry->value = new_value;
|
new_entry->value = new_value;
|
||||||
new_entry->next = NULL;
|
new_entry->next = next;
|
||||||
return (new_entry);
|
return (new_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ll_map_get(t_map_entry *head, char *key)
|
char *ll_map_get_value(t_map_entry *head, char *key)
|
||||||
{
|
{
|
||||||
t_map_entry *current;
|
t_map_entry *retval;
|
||||||
|
|
||||||
if (head != NULL)
|
retval = ll_map_get(head, key);
|
||||||
{
|
if (retval)
|
||||||
current = head;
|
return (retval->value);
|
||||||
while (current != NULL)
|
else
|
||||||
{
|
return (NULL);
|
||||||
if (!ft_strcmp(current->key, key))
|
|
||||||
return (current->value);
|
|
||||||
current = current->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ll_map_push(t_map_entry *head, char *key, char *value)
|
void ll_map_push(t_map_entry *head, char *key, char *value)
|
||||||
|
@ -54,48 +49,19 @@ void ll_map_push(t_map_entry *head, char *key, char *value)
|
||||||
|
|
||||||
if (head != NULL)
|
if (head != NULL)
|
||||||
{
|
{
|
||||||
current = head;
|
current = ll_map_get(head, key);
|
||||||
while (current->next != NULL)
|
if (current == NULL)
|
||||||
current = current->next;
|
{
|
||||||
current->next = ll_map_new_entry(key, value);
|
current = head;
|
||||||
|
while (current->next != NULL)
|
||||||
|
current = current->next;
|
||||||
|
current->next = ll_map_new_entry(key, value, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ll_map_set_value(head, key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_entry(t_map_entry *entry)
|
|
||||||
{
|
|
||||||
free(entry->key);
|
|
||||||
free(entry->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
t_map_entry *ll_pop_last(t_map_entry *head, t_ret_flag noretval, int free_data)
|
|
||||||
{
|
|
||||||
t_map_entry *current;
|
|
||||||
t_map_entry *retval;
|
|
||||||
|
|
||||||
retval = NULL;
|
|
||||||
if (head == NULL)
|
|
||||||
return (retval);
|
|
||||||
if (head->next == NULL)
|
|
||||||
{
|
|
||||||
if (noretval != POP_NO_RETURN_VAL)
|
|
||||||
retval = ll_map_new_entry(head->key, head->value);
|
|
||||||
if (free_data)
|
|
||||||
free_entry(head);
|
|
||||||
free(head);
|
|
||||||
return (retval);
|
|
||||||
}
|
|
||||||
current = head;
|
|
||||||
while (current->next->next != NULL)
|
|
||||||
current = current->next;
|
|
||||||
if (noretval != POP_NO_RETURN_VAL)
|
|
||||||
retval = ll_map_new_entry(current->next->key, current->next->value);
|
|
||||||
if (free_data)
|
|
||||||
free_entry(current->next);
|
|
||||||
free(current->next);
|
|
||||||
current->next = NULL;
|
|
||||||
return (retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ll_clear(t_map_entry *head, int free_data)
|
void ll_clear(t_map_entry *head, int free_data)
|
||||||
{
|
{
|
||||||
if (head != NULL)
|
if (head != NULL)
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_linked_list_helpers.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/04/01 15:25:42 by tischmid #+# #+# */
|
||||||
|
/* Updated: 2023/04/02 20:12:19 by tischmid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "ft_linked_list_helpers.h"
|
||||||
|
#include "ft_linked_list.h"
|
||||||
|
#include "ft_strlib.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void free_entry(t_map_entry *entry)
|
||||||
|
{
|
||||||
|
free(entry->key);
|
||||||
|
free(entry->value);
|
||||||
|
free(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
t_map_entry *ll_pop_last(t_map_entry *head, t_ret_flag noretval, int free_data)
|
||||||
|
{
|
||||||
|
t_map_entry *current;
|
||||||
|
t_map_entry *retval;
|
||||||
|
|
||||||
|
retval = NULL;
|
||||||
|
if (head == NULL)
|
||||||
|
return (retval);
|
||||||
|
if (head->next == NULL)
|
||||||
|
{
|
||||||
|
if (noretval != POP_NO_RETURN_VAL)
|
||||||
|
retval = ll_map_new_entry(head->key, head->value, NULL);
|
||||||
|
if (free_data)
|
||||||
|
free_entry(head);
|
||||||
|
return (retval);
|
||||||
|
}
|
||||||
|
current = head;
|
||||||
|
while (current->next->next != NULL)
|
||||||
|
current = current->next;
|
||||||
|
if (noretval != POP_NO_RETURN_VAL)
|
||||||
|
retval = ll_map_new_entry(current->next->key,
|
||||||
|
current->next->value,
|
||||||
|
NULL);
|
||||||
|
if (free_data)
|
||||||
|
free_entry(current->next);
|
||||||
|
current->next = NULL;
|
||||||
|
return (retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ll_map_set_value(t_map_entry *head, char *key, char *value)
|
||||||
|
{
|
||||||
|
t_map_entry *current;
|
||||||
|
|
||||||
|
current = ll_map_get(head, key);
|
||||||
|
if (current != NULL)
|
||||||
|
{
|
||||||
|
free(current->value);
|
||||||
|
current->value = malloc(sizeof(char) * (ft_strlen(value) + 1));
|
||||||
|
ft_strcpy(current->value, value);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
t_map_entry *ll_map_get(t_map_entry *head, char *key)
|
||||||
|
{
|
||||||
|
t_map_entry *current;
|
||||||
|
|
||||||
|
if (head != NULL)
|
||||||
|
{
|
||||||
|
current = head;
|
||||||
|
while (current != NULL)
|
||||||
|
{
|
||||||
|
if (!ft_strcmp(current->key, key))
|
||||||
|
return (current);
|
||||||
|
current = current->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_ntow.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/04/02 20:26:44 by tischmid #+# #+# */
|
||||||
|
/* Updated: 2023/04/02 20:29:01 by tischmid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "ft_ntow.h"
|
||||||
|
#include "ft_linked_list.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
char *num_to_words(t_map_entry *map)
|
||||||
|
{
|
||||||
|
(void)map;
|
||||||
|
printf("%s\n", ll_map_get_value(map, "17"));
|
||||||
|
return ("one hundred");
|
||||||
|
}
|
|
@ -6,12 +6,13 @@
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/01 21:48:18 by tischmid #+# #+# */
|
/* Created: 2023/04/01 21:48:18 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/02 17:36:47 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 18:58:11 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef DICTPARSE_H
|
#ifndef DICTPARSE_H
|
||||||
# define DICTPARSE_H
|
# define DICTPARSE_H
|
||||||
|
# define MAX_DIGITS 100
|
||||||
# define MAX_LINE_LENGTH 1000
|
# define MAX_LINE_LENGTH 1000
|
||||||
# include "ft_linked_list.h"
|
# include "ft_linked_list.h"
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* ft_convert.c :+: :+: :+: */
|
/* ft_convert.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/02 17:06:51 by tischmid #+# #+# */
|
/* Created: 2023/04/02 17:06:51 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/02 18:41:32 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 18:53:17 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -14,6 +14,6 @@
|
||||||
# define FT_CONVERT_H
|
# define FT_CONVERT_H
|
||||||
|
|
||||||
int ft_atoi(char *str);
|
int ft_atoi(char *str);
|
||||||
int ft_itoa(char *buf, int nb)
|
int ft_itoa(char *buf, int nb);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/01 15:25:59 by tischmid #+# #+# */
|
/* Created: 2023/04/01 15:25:59 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/02 18:12:59 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 20:07:49 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ typedef enum
|
||||||
POP_NO_RETURN_VAL
|
POP_NO_RETURN_VAL
|
||||||
} t_ret_flag;
|
} t_ret_flag;
|
||||||
|
|
||||||
char *ll_map_get(t_map_entry *head, char *key);
|
char *ll_map_get_value(t_map_entry *head, char *key);
|
||||||
void ll_map_push(t_map_entry *head, char *key, char *value);
|
void ll_map_push(t_map_entry *head, char *key, char *value);
|
||||||
void ll_clear(t_map_entry *head, int free_data);
|
void ll_clear(t_map_entry *head, int free_data);
|
||||||
t_map_entry *ll_map_new_entry(char *key, char *value);
|
t_map_entry *ll_map_new_entry(char *key, char *value, t_map_entry *next);
|
||||||
t_map_entry *ll_pop_last(t_map_entry *head, t_ret_flag noretval, int free_data);
|
t_map_entry *ll_pop_last(t_map_entry *head, t_ret_flag noretval, int free_data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_linked_list_helpers.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/04/01 15:25:59 by tischmid #+# #+# */
|
||||||
|
/* Updated: 2023/04/02 20:08:35 by tischmid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef FT_LINKED_LIST_HELPERS_H
|
||||||
|
# define FT_LINKED_LIST_HELPERS_H
|
||||||
|
# include "ft_linked_list.h"
|
||||||
|
|
||||||
|
t_map_entry *ll_map_get(t_map_entry *head, char *key);
|
||||||
|
t_map_entry *ll_pop_last(t_map_entry *head, t_ret_flag noretval, int free_data);
|
||||||
|
void free_entry(t_map_entry *entry);
|
||||||
|
int ll_map_set_value(t_map_entry *head, char *key, char *value);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_ntow.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/04/02 20:21:19 by tischmid #+# #+# */
|
||||||
|
/* Updated: 2023/04/02 20:29:19 by tischmid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef FT_NTOW_H
|
||||||
|
# define FT_NTOW_H
|
||||||
|
# include "ft_linked_list.h"
|
||||||
|
|
||||||
|
char *num_to_words(t_map_entry *map);
|
||||||
|
|
||||||
|
#endif
|
16
ex00/main.c
16
ex00/main.c
|
@ -6,7 +6,7 @@
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/01 07:11:58 by tischmid #+# #+# */
|
/* Created: 2023/04/01 07:11:58 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/02 18:30:05 by tischmid ### ########.fr */
|
/* Updated: 2023/04/02 20:21:54 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -14,20 +14,30 @@
|
||||||
#include "dictparse.h"
|
#include "dictparse.h"
|
||||||
#include "ft_linked_list.h"
|
#include "ft_linked_list.h"
|
||||||
#include "printing.h"
|
#include "printing.h"
|
||||||
|
#include "ft_convert.h"
|
||||||
|
#include "ft_ntow.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *str_nbr;
|
char *str_nbr;
|
||||||
char *path;
|
char *path;
|
||||||
|
char *numberwords;
|
||||||
t_map_entry *map;
|
t_map_entry *map;
|
||||||
|
|
||||||
if (!parse_args(argc, argv, &path, &str_nbr))
|
if (!parse_args(argc, argv, &path, &str_nbr))
|
||||||
return (puterr("Error\n", 1));
|
return (puterr("Error\n", 1));
|
||||||
map = ll_map_new_entry("about", "Dict for the data from the .dict file");
|
map = ll_map_new_entry("about", "Dict for the data from *.dict file", NULL);
|
||||||
if (!parse_dict(path, map))
|
if (!parse_dict(path, map))
|
||||||
return (puterr("Dict Error\n", 2));
|
return (puterr("Dict Error\n", 2));
|
||||||
printf("%s\n", ll_map_get(map, "1000000"));
|
numberwords = num_to_words(map);
|
||||||
|
if (*numberwords)
|
||||||
|
{
|
||||||
|
ft_putstr(numberwords);
|
||||||
|
ft_putchar('\n');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (puterr("Dict Error\n", 3));
|
||||||
ll_clear(map, 1);
|
ll_clear(map, 1);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue