*avrpart.c,main.c: Moved list_parts() and locate_part() from main.c to avrpart.c

*avrpart.h: Added prototypes for list_parts() and locate_part()


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@389 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Jan-Hinnerk Reichert 2003-11-30 16:49:00 +00:00
parent 6f57db045f
commit 59a823acb8
3 changed files with 42 additions and 40 deletions

View File

@ -397,6 +397,43 @@ AVRPART * avr_dup_part(AVRPART * d)
}
AVRPART * locate_part(LISTID parts, char * partdesc)
{
LNODEID ln1;
AVRPART * p = NULL;
int found;
found = 0;
for (ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) {
p = ldata(ln1);
if ((strcasecmp(partdesc, p->id) == 0) ||
(strcasecmp(partdesc, p->desc) == 0))
found = 1;
}
if (found)
return p;
return NULL;
}
void list_parts(FILE * f, char * prefix, LISTID parts)
{
LNODEID ln1;
AVRPART * p;
for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
p = ldata(ln1);
fprintf(f, "%s%-4s = %-15s [%s:%d]\n",
prefix, p->id, p->desc, p->config_file, p->lineno);
}
return;
}
char * reset_disp_str(int r)
{
switch (r) {

View File

@ -134,6 +134,8 @@ void avr_mem_display(char * prefix, FILE * f, AVRMEM * m, int type,
/* Functions for AVRPART structures */
AVRPART * avr_new_part(void);
AVRPART * avr_dup_part(AVRPART * d);
AVRPART * locate_part(LISTID parts, char * partdesc);
void list_parts(FILE * f, char * prefix, LISTID parts);
void avr_display(FILE * f, AVRPART * p, char * prefix, int verbose);
#endif

View File

@ -227,43 +227,6 @@ PROGRAMMER * locate_programmer(LISTID programmers, char * configid)
return NULL;
}
AVRPART * locate_part(LISTID parts, char * partdesc)
{
LNODEID ln1;
AVRPART * p = NULL;
int found;
found = 0;
for (ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) {
p = ldata(ln1);
if ((strcasecmp(partdesc, p->id) == 0) ||
(strcasecmp(partdesc, p->desc) == 0))
found = 1;
}
if (found)
return p;
return NULL;
}
void list_parts(FILE * f, char * prefix, LISTID parts)
{
LNODEID ln1;
AVRPART * p;
for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
p = ldata(ln1);
fprintf(f, "%s%-4s = %-15s [%s:%d]\n",
prefix, p->id, p->desc, p->config_file, p->lineno);
}
return;
}
void list_programmers(FILE * f, char * prefix, LISTID programmers)
{
LNODEID ln1;