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/agpGap.c src/hg/lib/agpGap.c index b61ced3..e623ddd 100644 --- src/hg/lib/agpGap.c +++ src/hg/lib/agpGap.c @@ -1,117 +1,120 @@ /* agpGap.c was originally generated by the autoSql program, which also * generated agpGap.h and agpGap.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 "jksql.h" #include "agpGap.h" void agpGapStaticLoad(char **row, struct agpGap *ret) /* Load a row from agpGap table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->chrom = row[0]; ret->chromStart = sqlUnsigned(row[1]); ret->chromEnd = sqlUnsigned(row[2]); ret->ix = sqlSigned(row[3]); strcpy(ret->n, row[4]); ret->size = sqlUnsigned(row[5]); ret->type = row[6]; ret->bridge = row[7]; } struct agpGap *agpGapLoad(char **row) /* Load a agpGap from row fetched with select * from agpGap * from database. Dispose of this with agpGapFree(). */ { struct agpGap *ret; AllocVar(ret); ret->chrom = cloneString(row[0]); ret->chromStart = sqlUnsigned(row[1]); ret->chromEnd = sqlUnsigned(row[2]); ret->ix = sqlSigned(row[3]); strcpy(ret->n, row[4]); ret->size = sqlUnsigned(row[5]); ret->type = cloneString(row[6]); ret->bridge = cloneString(row[7]); return ret; } struct agpGap *agpGapCommaIn(char **pS, struct agpGap *ret) /* Create a agpGap out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new agpGap */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->chrom = sqlStringComma(&s); ret->chromStart = sqlUnsignedComma(&s); ret->chromEnd = sqlUnsignedComma(&s); ret->ix = sqlSignedComma(&s); sqlFixedStringComma(&s, ret->n, sizeof(ret->n)); ret->size = sqlUnsignedComma(&s); ret->type = sqlStringComma(&s); ret->bridge = sqlStringComma(&s); *pS = s; return ret; } void agpGapFree(struct agpGap **pEl) /* Free a single dynamically allocated agpGap such as created * with agpGapLoad(). */ { struct agpGap *el; if ((el = *pEl) == NULL) return; freeMem(el->chrom); freeMem(el->type); freeMem(el->bridge); freez(pEl); } void agpGapFreeList(struct agpGap **pList) /* Free a list of dynamically allocated agpGap's */ { struct agpGap *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; agpGapFree(&el); } *pList = NULL; } void agpGapOutput(struct agpGap *el, FILE *f, char sep, char lastSep) /* Print out agpGap. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->chrom); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->chromStart); fputc(sep,f); fprintf(f, "%u", el->chromEnd); fputc(sep,f); fprintf(f, "%d", el->ix); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->n); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->size); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->type); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->bridge); if (sep == ',') fputc('"',f); fputc(lastSep,f); }