2006-08-15 Kolja Waschk <kawk@telos.de>

* linkcmds.c, linkcmds.h, memory.c, memory.h, sample.ptf: New files.
	* bridges.c: corrected detection of bridged connections
	* clocks.c: removed a printf
	* linkcmds.[ch] new files, added output of linker script
	* Makefile.am: added new files
	* memory.[ch]: new files, detection of memory in SOPC configuration
	* nios2gen.c: updated command line parsing and output control
	* output.[ch]: improved output of BSP header file
	* ptf.[ch]: added ptf_dump_ptf_item and small fixes
	* sample.ptf: new file, sample configuration for nios2gen
	* README: updated
This commit is contained in:
Joel Sherrill
2006-08-15 21:02:55 +00:00
parent 5f88544369
commit 16fd5a99e1
15 changed files with 1304 additions and 136 deletions
+54 -8
View File
@@ -9,6 +9,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "ptf.h"
@@ -364,7 +365,7 @@ void parse_char(struct ptf_parser_state *state, int c)
default:
#if DEBUG&DEBUG_EXPECTATIONS
printf("Expectation: %d (???)\n", state->expectation);
printf("Expectation: %d (?)\n", state->expectation);
#endif
parse_error(state, "Internal error: Unhandled state of expectation");
@@ -510,6 +511,44 @@ struct ptf *ptf_parse_file(char *filename)
/***************************************************************************/
struct ptf *ptf_concat(struct ptf *a, struct ptf *b)
{
struct ptf *leaf = a;
if(!a) return b;
if(!b) return a;
for(leaf = a; leaf->next != NULL; leaf = leaf->next);
leaf->next = b;
return a;
}
/***************************************************************************/
void ptf_dump_ptf_item(FILE *f, struct ptf_item *pi)
{
int i;
fprintf(f, "level=%d in %p\n", pi->level, pi);
for(i=pi->level;i>=0;i--)
{
if(pi->item[i] != NULL)
{
fprintf(f, " %d: %s name=%s value=%s\n",
i,
pi->item[i]->type == item ? "item":"section",
pi->item[i]->name,
pi->item[i]->value);
}
else
{
fprintf(f, " %d: NULL\n");
}
fflush(f);
}
}
/***************************************************************************/
void ptf_printf(FILE *s, struct ptf *tree, char *prefix)
{
struct ptf *leaf;
@@ -532,12 +571,12 @@ void ptf_printf(FILE *s, struct ptf *tree, char *prefix)
strcat(new_prefix, leaf->name);
if(leaf->value != NULL && leaf->value[0] != 0)
{
strcat(new_prefix, "_");
strcat(new_prefix, ":");
strcat(new_prefix, leaf->value);
};
strcat(new_prefix, "/");
fputs(new_prefix, s);
fputs("\r\n", s);
fputs("\n", s);
ptf_printf(s, leaf->sub, new_prefix);
break;
};
@@ -548,12 +587,19 @@ void ptf_printf(FILE *s, struct ptf *tree, char *prefix)
fputs(prefix, s);
fputs(leaf->name, s);
fputs(" = \"", s);
for(c=leaf->value; *c; c++)
if(leaf->value == NULL)
{
if(*c=='\\' || *c=='"') putc('\\', s);
putc(*c, s);
};
fprintf(s, "\"\r\n");
fputs("(NULL)", s);
}
else
{
for(c=leaf->value; *c; c++)
{
if(*c=='\\' || *c=='"') putc('\\', s);
putc(*c, s);
};
}
fprintf(s, "\"\n");
break;
};