Temporarily switching back to older bugless fasta libs while fixing a
bug
This commit is contained in:
61
libfasta/fasta_header_parser.c
Normal file → Executable file
61
libfasta/fasta_header_parser.c
Normal file → Executable file
@ -798,7 +798,7 @@ YY_RULE_SETUP
|
||||
(*p_header)[*nbf].value = (char*) malloc(sizeof(char)*size_needed);
|
||||
strcpy(((*p_header)[*nbf]).value,header_yytext);
|
||||
|
||||
p_header = check_and_realloc_mem_in_header_table(p_header, nbf, memory_allocated);
|
||||
(*nbf)++;
|
||||
}
|
||||
YY_BREAK
|
||||
case 3:
|
||||
@ -820,7 +820,7 @@ YY_RULE_SETUP
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 69 "fasta_header_parser.l"
|
||||
{ // TODO
|
||||
{
|
||||
/*fprintf(stderr,"\n<REGNAME>{SPACE} **%s**",header_yytext);*/
|
||||
if (i != 0)
|
||||
field = store_in_field(field,header_yytext,&free_size,&i);
|
||||
@ -886,21 +886,24 @@ case YY_STATE_EOF(REGVAL):
|
||||
#line 113 "fasta_header_parser.l"
|
||||
{
|
||||
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;
|
||||
}
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(REGNAME):
|
||||
#line 122 "fasta_header_parser.l"
|
||||
#line 123 "fasta_header_parser.l"
|
||||
{
|
||||
(*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;
|
||||
@ -908,10 +911,10 @@ case YY_STATE_EOF(REGNAME):
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 133 "fasta_header_parser.l"
|
||||
#line 136 "fasta_header_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 915 "<stdout>"
|
||||
#line 918 "<stdout>"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(REGID):
|
||||
yyterminate();
|
||||
@ -1909,7 +1912,7 @@ void header_yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 133 "fasta_header_parser.l"
|
||||
#line 136 "fasta_header_parser.l"
|
||||
|
||||
|
||||
|
||||
@ -1920,32 +1923,38 @@ 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=header_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=header_yy_scan_string(h);
|
||||
|
||||
header_parser(&nbfields, &memory_allocated, &header);
|
||||
|
||||
|
||||
header_yy_delete_buffer(state);
|
||||
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user