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/kgMapName.c src/hg/lib/kgMapName.c index 7298831..a650a37 100644 --- src/hg/lib/kgMapName.c +++ src/hg/lib/kgMapName.c @@ -1,129 +1,132 @@ /* kgMapName.c was originally generated by the autoSql program, which also * generated kgMapName.h and kgMapName.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 "kgMapName.h" void kgMapNameStaticLoad(char **row, struct kgMapName *ret) /* Load a row from kgMapName table into ret. The contents of ret will * be replaced at the next call to this function. */ { int sizeOne,i; char *s; ret->kgPepId = row[0]; ret->geneName = row[1]; } struct kgMapName *kgMapNameLoad(char **row) /* Load a kgMapName from row fetched with select * from kgMapName * from database. Dispose of this with kgMapNameFree(). */ { struct kgMapName *ret; int sizeOne,i; char *s; AllocVar(ret); ret->kgPepId = cloneString(row[0]); ret->geneName = cloneString(row[1]); return ret; } struct kgMapName *kgMapNameLoadAll(char *fileName) /* Load all kgMapName from a whitespace-separated file. * Dispose of this with kgMapNameFreeList(). */ { struct kgMapName *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[2]; while (lineFileRow(lf, row)) { el = kgMapNameLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct kgMapName *kgMapNameLoadAllByChar(char *fileName, char chopper) /* Load all kgMapName from a chopper separated file. * Dispose of this with kgMapNameFreeList(). */ { struct kgMapName *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[2]; while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = kgMapNameLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct kgMapName *kgMapNameCommaIn(char **pS, struct kgMapName *ret) /* Create a kgMapName out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new kgMapName */ { char *s = *pS; int i; if (ret == NULL) AllocVar(ret); ret->kgPepId = sqlStringComma(&s); ret->geneName = sqlStringComma(&s); *pS = s; return ret; } void kgMapNameFree(struct kgMapName **pEl) /* Free a single dynamically allocated kgMapName such as created * with kgMapNameLoad(). */ { struct kgMapName *el; if ((el = *pEl) == NULL) return; freeMem(el->kgPepId); freeMem(el->geneName); freez(pEl); } void kgMapNameFreeList(struct kgMapName **pList) /* Free a list of dynamically allocated kgMapName's */ { struct kgMapName *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; kgMapNameFree(&el); } *pList = NULL; } void kgMapNameOutput(struct kgMapName *el, FILE *f, char sep, char lastSep) /* Print out kgMapName. Separate fields with sep. Follow last field with lastSep. */ { int i; if (sep == ',') fputc('"',f); fprintf(f, "%s", el->kgPepId); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->geneName); if (sep == ',') fputc('"',f); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */