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/gbSeq.c src/hg/lib/gbSeq.c
index a10e651..4169c0e 100644
--- src/hg/lib/gbSeq.c
+++ src/hg/lib/gbSeq.c
@@ -1,167 +1,170 @@
 /* gbSeq.c was originally generated by the autoSql program, which also 
  * generated gbSeq.h and gbSeq.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 "gbSeq.h"
 
 
 /* definitions for type column */
 static char *values_type[] = {"EST", "mRNA", "PEP", NULL};
 static struct hash *valhash_type = NULL;
 
 /* definitions for srcDb column */
 static char *values_srcDb[] = {"GenBank", "RefSeq", "Other", NULL};
 static struct hash *valhash_srcDb = NULL;
 
 void gbSeqStaticLoad(char **row, struct gbSeq *ret)
 /* Load a row from gbSeq table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->id = sqlUnsigned(row[0]);
 ret->acc = row[1];
 ret->version = sqlSigned(row[2]);
 ret->size = sqlUnsigned(row[3]);
 ret->gbExtFile = sqlUnsigned(row[4]);
 ret->file_offset = sqlLongLong(row[5]);
 ret->file_size = sqlUnsigned(row[6]);
 ret->type = sqlEnumParse(row[7], values_type, &valhash_type);
 ret->srcDb = sqlEnumParse(row[8], values_srcDb, &valhash_srcDb);
 }
 
 struct gbSeq *gbSeqLoad(char **row)
 /* Load a gbSeq from row fetched with select * from gbSeq
  * from database.  Dispose of this with gbSeqFree(). */
 {
 struct gbSeq *ret;
 
 AllocVar(ret);
 ret->id = sqlUnsigned(row[0]);
 ret->acc = cloneString(row[1]);
 ret->version = sqlSigned(row[2]);
 ret->size = sqlUnsigned(row[3]);
 ret->gbExtFile = sqlUnsigned(row[4]);
 ret->file_offset = sqlLongLong(row[5]);
 ret->file_size = sqlUnsigned(row[6]);
 ret->type = sqlEnumParse(row[7], values_type, &valhash_type);
 ret->srcDb = sqlEnumParse(row[8], values_srcDb, &valhash_srcDb);
 return ret;
 }
 
 struct gbSeq *gbSeqLoadAll(char *fileName) 
 /* Load all gbSeq from a whitespace-separated file.
  * Dispose of this with gbSeqFreeList(). */
 {
 struct gbSeq *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[9];
 
 while (lineFileRow(lf, row))
     {
     el = gbSeqLoad(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct gbSeq *gbSeqLoadAllByChar(char *fileName, char chopper) 
 /* Load all gbSeq from a chopper separated file.
  * Dispose of this with gbSeqFreeList(). */
 {
 struct gbSeq *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[9];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = gbSeqLoad(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct gbSeq *gbSeqCommaIn(char **pS, struct gbSeq *ret)
 /* Create a gbSeq out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new gbSeq */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->id = sqlUnsignedComma(&s);
 ret->acc = sqlStringComma(&s);
 ret->version = sqlSignedComma(&s);
 ret->size = sqlUnsignedComma(&s);
 ret->gbExtFile = sqlUnsignedComma(&s);
 ret->file_offset = sqlLongLongComma(&s);
 ret->file_size = sqlUnsignedComma(&s);
 ret->type = sqlEnumComma(&s, values_type, &valhash_type);
 ret->srcDb = sqlEnumComma(&s, values_srcDb, &valhash_srcDb);
 *pS = s;
 return ret;
 }
 
 void gbSeqFree(struct gbSeq **pEl)
 /* Free a single dynamically allocated gbSeq such as created
  * with gbSeqLoad(). */
 {
 struct gbSeq *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->acc);
 freez(pEl);
 }
 
 void gbSeqFreeList(struct gbSeq **pList)
 /* Free a list of dynamically allocated gbSeq's */
 {
 struct gbSeq *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     gbSeqFree(&el);
     }
 *pList = NULL;
 }
 
 void gbSeqOutput(struct gbSeq *el, FILE *f, char sep, char lastSep) 
 /* Print out gbSeq.  Separate fields with sep. Follow last field with lastSep. */
 {
 fprintf(f, "%u", el->id);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->acc);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%d", el->version);
 fputc(sep,f);
 fprintf(f, "%u", el->size);
 fputc(sep,f);
 fprintf(f, "%u", el->gbExtFile);
 fputc(sep,f);
 fprintf(f, "%lld", el->file_offset);
 fputc(sep,f);
 fprintf(f, "%u", el->file_size);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 sqlEnumPrint(f, el->type, values_type);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 sqlEnumPrint(f, el->srcDb, values_srcDb);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */