src/hg/hgTables/custom.c 1.47

1.47 2010/05/11 01:43:25 kent
Refactoring to split the trackDb.tableName field into separate track and table fields. Similarly track.mapName field goes to the same track and table fields.
Index: src/hg/hgTables/custom.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/custom.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -b -B -U 4 -r1.46 -r1.47
--- src/hg/hgTables/custom.c	13 Apr 2010 05:51:25 -0000	1.46
+++ src/hg/hgTables/custom.c	11 May 2010 01:43:25 -0000	1.47
@@ -48,9 +48,10 @@
 struct trackDb *tdb;
 char buf[256];
 
 tdb = customTrackTdbDefault();
-tdb->tableName = customTrackTableFromLabel(ctName);
+tdb->table = customTrackTableFromLabel(ctName);
+tdb->track = cloneString(tdb->table);
 tdb->shortLabel = ctName;
 tdb->longLabel = ctDesc;
 safef(buf, sizeof(buf), "bed %d .", fields);
 tdb->type = cloneString(buf);
@@ -81,9 +82,9 @@
 if (ct == NULL)
     return(NULL);
 
 AllocVar(hti);
-hti->rootName = cloneString(ct->tdb->tableName);
+hti->rootName = cloneString(ct->tdb->table);
 hti->isPos = TRUE;
 hti->isSplit = FALSE;
 hti->hasBin = FALSE;
 hti->type = cloneString(ct->tdb->type);
@@ -549,9 +550,9 @@
 
 for (region = regionList; region != NULL; region = region->next)
     {
     struct lm *lm = lmInit(64*1024);
-    struct bed *bed, *bedList = cookedBedList(conn, track->tableName,
+    struct bed *bed, *bedList = cookedBedList(conn, track->table,
 	region, lm, NULL);
     for (bed = bedList; bed != NULL; bed = bed->next)
 	{
 	tabBedRowFile(bed, chosenFields, f);
@@ -567,14 +568,14 @@
 	char *fields, FILE *f)
 /* Print out selected fields from custom track.  If fields
  * is NULL, then print out all fields. */
 {
-struct customTrack *ct = ctLookupName(track->tableName);
+struct customTrack *ct = ctLookupName(track->table);
 char *type = ct->tdb->type;
 if (startsWithWord("makeItems", type))
     {
     struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
-    doTabOutDb(CUSTOM_TRASH, db, ct->dbTableName, track->tableName, f, conn, fields);
+    doTabOutDb(CUSTOM_TRASH, db, ct->dbTableName, track->table, f, conn, fields);
     hFreeConn(&conn);
     }
 else
     doTabOutBedLike(ct, track, conn, fields, f);
@@ -587,9 +588,9 @@
 struct customTrack *newList = NULL, *ct, *next;
 for (ct = *pList; ct != NULL; ct = next)
     {
     next = ct->next;
-    if (!sameString(ct->tdb->tableName, name))
+    if (!sameString(ct->tdb->table, name))
         {
 	slAddHead(&newList, ct);
 	}
     }