a44421a79fb36cc2036fe116b97ea3bc9590cd0c braney Fri Dec 2 09:34:39 2011 -0800 removed rcsid (#295) diff --git src/hg/lib/cogsxra.c src/hg/lib/cogsxra.c index ca372fb..d47e340 100644 --- src/hg/lib/cogsxra.c +++ src/hg/lib/cogsxra.c @@ -1,124 +1,123 @@ /* cogsxra.c was originally generated by the autoSql program, which also * generated cogsxra.h and cogsxra.sql. This module links the database and * the RAM representation of objects. */ #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "cogsxra.h" -static char const rcsid[] = "$Id: cogsxra.c,v 1.1 2004/09/29 21:41:18 kschneid Exp $"; void COGXraStaticLoad(char **row, struct COGXra *ret) /* Load a row from COGXra table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->name = row[0]; ret->info = row[1]; } struct COGXra *COGXraLoad(char **row) /* Load a COGXra from row fetched with select * from COGXra * from database. Dispose of this with COGXraFree(). */ { struct COGXra *ret; AllocVar(ret); ret->name = cloneString(row[0]); ret->info = cloneString(row[1]); return ret; } struct COGXra *COGXraLoadAll(char *fileName) /* Load all COGXra from a whitespace-separated file. * Dispose of this with COGXraFreeList(). */ { struct COGXra *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[2]; while (lineFileRow(lf, row)) { el = COGXraLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct COGXra *COGXraLoadAllByChar(char *fileName, char chopper) /* Load all COGXra from a chopper separated file. * Dispose of this with COGXraFreeList(). */ { struct COGXra *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[2]; while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = COGXraLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct COGXra *COGXraCommaIn(char **pS, struct COGXra *ret) /* Create a COGXra out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new COGXra */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->name = sqlStringComma(&s); ret->info = sqlStringComma(&s); *pS = s; return ret; } void COGXraFree(struct COGXra **pEl) /* Free a single dynamically allocated COGXra such as created * with COGXraLoad(). */ { struct COGXra *el; if ((el = *pEl) == NULL) return; freeMem(el->name); freeMem(el->info); freez(pEl); } void COGXraFreeList(struct COGXra **pList) /* Free a list of dynamically allocated COGXra's */ { struct COGXra *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; COGXraFree(&el); } *pList = NULL; } void COGXraOutput(struct COGXra *el, FILE *f, char sep, char lastSep) /* Print out COGXra. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->name); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->info); if (sep == ',') fputc('"',f); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */