e70152e44cc66cc599ff6b699eb8adc07f3e656a kent Sat May 24 21:09:34 2014 -0700 Adding Copyright NNNN Regents of the University of California to all files I believe with reasonable certainty were developed under UCSC employ or as part of Genome Browser copyright assignment. diff --git src/hg/lib/ancientRref.c src/hg/lib/ancientRref.c index 050fe41..b13855b 100644 --- src/hg/lib/ancientRref.c +++ src/hg/lib/ancientRref.c @@ -1,134 +1,137 @@ /* ancientRref.c was originally generated by the autoSql program, which also * generated ancientRref.h and ancientRref.sql. This module links the database and * the RAM representation of objects. */ +/* Copyright (C) 2014 The Regents of the University of California + * See README in this or parent directory for licensing information. */ + #include "common.h" #include "linefile.h" #include "jksql.h" #include "ancientRref.h" void ancientRrefStaticLoad(char **row, struct ancientRref *ret) /* Load a row from ancientRref table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->id = row[0]; ret->name = row[1]; ret->class = row[2]; ret->family = row[3]; ret->hseq = row[4]; ret->mseq = row[5]; } struct ancientRref *ancientRrefLoad(char **row) /* Load a ancientRref from row fetched with select * from ancientRref * from database. Dispose of this with ancientRrefFree(). */ { struct ancientRref *ret; AllocVar(ret); ret->id = cloneString(row[0]); ret->name = cloneString(row[1]); ret->class = cloneString(row[2]); ret->family = cloneString(row[3]); ret->hseq = cloneString(row[4]); ret->mseq = cloneString(row[5]); return ret; } struct ancientRref *ancientRrefLoadAll(char *fileName) /* Load all ancientRref from a tab-separated file. * Dispose of this with ancientRrefFreeList(). */ { struct ancientRref *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[6]; while (lineFileRow(lf, row)) { el = ancientRrefLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct ancientRref *ancientRrefCommaIn(char **pS, struct ancientRref *ret) /* Create a ancientRref out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new ancientRref */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->id = sqlStringComma(&s); ret->name = sqlStringComma(&s); ret->class = sqlStringComma(&s); ret->family = sqlStringComma(&s); ret->hseq = sqlStringComma(&s); ret->mseq = sqlStringComma(&s); *pS = s; return ret; } void ancientRrefFree(struct ancientRref **pEl) /* Free a single dynamically allocated ancientRref such as created * with ancientRrefLoad(). */ { struct ancientRref *el; if ((el = *pEl) == NULL) return; freeMem(el->id); freeMem(el->name); freeMem(el->class); freeMem(el->family); freeMem(el->hseq); freeMem(el->mseq); freez(pEl); } void ancientRrefFreeList(struct ancientRref **pList) /* Free a list of dynamically allocated ancientRref's */ { struct ancientRref *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; ancientRrefFree(&el); } *pList = NULL; } void ancientRrefOutput(struct ancientRref *el, FILE *f, char sep, char lastSep) /* Print out ancientRref. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->id); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->name); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->class); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->family); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->hseq); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->mseq); if (sep == ',') fputc('"',f); fputc(lastSep,f); }