Temporarily switching back to older bugless fasta libs while fixing a

bug
This commit is contained in:
Celine Mercier
2017-10-15 20:41:55 +02:00
parent f9d0ac00aa
commit 6373bc1c20
36 changed files with 84 additions and 83 deletions

53
libfasta/fasta_header_parser.l Normal file → Executable file
View File

@ -53,7 +53,7 @@ EQUAL =
(*p_header)[*nbf].value = (char*) malloc(sizeof(char)*size_needed);
strcpy(((*p_header)[*nbf]).value,yytext);
p_header = check_and_realloc_mem_in_header_table(p_header, nbf, memory_allocated);
(*nbf)++;
}
@ -66,7 +66,7 @@ EQUAL =
field = store_in_field(field,yytext,&free_size,&i);
}
<REGNAME>{SPACE} { // TODO
<REGNAME>{SPACE} {
/*fprintf(stderr,"\n<REGNAME>{SPACE} **%s**",yytext);*/
if (i != 0)
field = store_in_field(field,yytext,&free_size,&i);
@ -112,19 +112,22 @@ EQUAL =
<REGVAL><<EOF>> {
field = store_in_header_table(field, &((*p_header)[*nbf].value), &free_size, &i);
(*nbf)++;
p_header = check_and_realloc_mem_in_header_table(p_header, nbf, memory_allocated);
end_header_table(p_header, *nbf);
free(field);
BEGIN(INITIAL);
return 0;
}
<REGNAME><<EOF>> {
(*p_header)[*nbf].name = (char*) malloc(sizeof(char)*19);
strcpy((*p_header)[*nbf].name,"definition");
/*(*p_header)[*nbf].name = (char*) malloc(sizeof(char)*19);
strcpy((*p_header)[*nbf].name,"other_informations");
field = store_in_header_table(field, &((*p_header)[*nbf].value), &free_size, &i);
(*nbf)++;
end_header_table(p_header, nbf);
p_header = check_and_realloc_mem_in_header_table(p_header, nbf, memory_allocated);
*/
end_header_table(p_header, *nbf);
free(field);
BEGIN(INITIAL);
return 0;
@ -139,31 +142,37 @@ int header_yywrap()
element_from_header* header_parser_main(char *h)
{
int nbfields, memory_allocated;
int nbfields,memory_allocated;
element_from_header* header;
char* nbfields_n;
YY_BUFFER_STATE state;
state=yy_scan_string(h);
char* nbfields_v;
nbfields_n = (char*) malloc(9*sizeof(char));
nbfields_v = (char*) malloc(5*sizeof(char));
memory_allocated=MEMALLOCATED;
header = (element_from_header*) malloc(memory_allocated * sizeof(element_from_header));
nbfields_n = (char*) malloc(9*sizeof(char));
strcpy(nbfields_n, "nbfields");
header[0].name = nbfields_n;
// Initialize memory to store the number of fields
header[0].value = (char*) malloc(10*sizeof(char));
nbfields=1;
strcpy(nbfields_n, "nbfields");
strcpy(nbfields_v, "1");
header = (element_from_header*) malloc(memory_allocated * sizeof(element_from_header));
header[0].name = nbfields_n;
header[0].value = nbfields_v;
YY_BUFFER_STATE state;
state=yy_scan_string(h);
header_parser(&nbfields, &memory_allocated, &header);
yy_delete_buffer(state);
return header;
}