src/error_handling.c
/*
**	This function verifies each of the parameters one at a time. If the line
**	happens to be type 5(Label + instruction), then it'll move the string
**	pointer past the \n first. If an invalid instruction type is found, it'll
**	show an error message and cleanly exit.
*/
This function verifies each of the parameters one at a time. If the line
happens to be type 5(Label + instruction), then it'll move the string
pointer past the \n first. If an invalid instruction type is found, it'll
show an error message and cleanly exit.
This function verifies each of the parameters one at a time . If the line happens to be type 5 ( Label + instruction ) then it ' ll move the string pointer past the \ n first . If an invalid instruction type is found it ' ll show an error message and cleanly exit .
void			verify_params_type(int ln, char *line, char *clean_line)
{
	char	**words;
	short	*param_types;
	int		i;
	if (identify_line(clean_line) == 5)
	{
		while (*clean_line && *clean_line != '\n')
			++clean_line;
		++clean_line;
	}
	else if (!clean_line[0])
		return ;
	words = ft_strsplit(clean_line, ' ');
	i = 0;
	param_types = instruction_params_type(words[0]);
	while (words[++i])
		if (!compare_type(param_types[i - 1], words[i]) ||
		!verify_param(words[i]))
		{
			ft_putstr("Parameter ");
			ft_putnbr(i);
			error(ln, line, " invalid");
		}
	ft_strarrdel(&words);
}
void verify_params_type ( int ln , char * line , char * clean_line ) { char * * words ; short * param_types ; int i ; if ( identify_line ( clean_line ) == 5 ) { while ( * clean_line && * clean_line != ' \n ' ) ++ clean_line ; ++ clean_line ; } else if ( ! clean_line [ 0 ] ) return ; words = ft_strsplit ( clean_line , ' ' ) ; i = 0 ; param_types = instruction_params_type ( words [ 0 ] ) ; while ( words [ ++ i ] ) if ( ! compare_type ( param_types [ i - 1 ] , words [ i ] ) || ! verify_param ( words [ i ] ) ) { ft_putstr ( " " ) ; ft_putnbr ( i ) ; error ( ln , line , " " ) ; } ft_strarrdel ( & words ) ; }
This function verifies each of the parameters one at a time.
This function verifies each of the parameters one at a time .