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/contigAcc.c src/hg/lib/contigAcc.c index 3f60170..8b940cb 100644 --- src/hg/lib/contigAcc.c +++ src/hg/lib/contigAcc.c @@ -1,123 +1,126 @@ /* contigAcc.c was originally generated by the autoSql program, which also * generated contigAcc.h and contigAcc.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 "dystring.h" #include "jksql.h" #include "contigAcc.h" void contigAccStaticLoad(char **row, struct contigAcc *ret) /* Load a row from contigAcc table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->contig = row[0]; ret->acc = row[1]; } struct contigAcc *contigAccLoad(char **row) /* Load a contigAcc from row fetched with select * from contigAcc * from database. Dispose of this with contigAccFree(). */ { struct contigAcc *ret; AllocVar(ret); ret->contig = cloneString(row[0]); ret->acc = cloneString(row[1]); return ret; } struct contigAcc *contigAccLoadAll(char *fileName) /* Load all contigAcc from a whitespace-separated file. * Dispose of this with contigAccFreeList(). */ { struct contigAcc *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[2]; while (lineFileRow(lf, row)) { el = contigAccLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct contigAcc *contigAccLoadAllByChar(char *fileName, char chopper) /* Load all contigAcc from a chopper separated file. * Dispose of this with contigAccFreeList(). */ { struct contigAcc *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[2]; while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = contigAccLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct contigAcc *contigAccCommaIn(char **pS, struct contigAcc *ret) /* Create a contigAcc out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new contigAcc */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->contig = sqlStringComma(&s); ret->acc = sqlStringComma(&s); *pS = s; return ret; } void contigAccFree(struct contigAcc **pEl) /* Free a single dynamically allocated contigAcc such as created * with contigAccLoad(). */ { struct contigAcc *el; if ((el = *pEl) == NULL) return; freeMem(el->contig); freeMem(el->acc); freez(pEl); } void contigAccFreeList(struct contigAcc **pList) /* Free a list of dynamically allocated contigAcc's */ { struct contigAcc *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; contigAccFree(&el); } *pList = NULL; } void contigAccOutput(struct contigAcc *el, FILE *f, char sep, char lastSep) /* Print out contigAcc. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->contig); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->acc); if (sep == ',') fputc('"',f); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */