6a3c69bdf84c82867390f2352d5c26e5dfa19304 max Thu Apr 25 11:35:12 2013 -0700 removed EXTRA_FIELDS_SUPPORT ifdef-blocks, as they made the code very hard to read, got OK from Tim by email diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 78f8609..c32a693 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -1415,131 +1415,97 @@ chopPrefix(dbOnly); printf("%-20s %d\n",hOrganism(dbOnly), diff); } printf("<BR>"); } } } } int extraFieldsPrint(struct trackDb *tdb,struct sqlResult *sr,char **fields,int fieldCount) // Any extra bed or bigBed fields (defined in as and occurring after N in bed N + types. // sr may be null for bigBeds. // Returns number of extra fields actually printed. { -#ifdef EXTRA_FIELDS_SUPPORT -struct extraField *extras = extraFieldsGet(database, tdb); -if (extras == NULL) - return 0; -#else///ifndef EXTRA_FIELDS_SUPPORT struct sqlConnection *conn = NULL ; if (!trackHubDatabase(database)) conn = hAllocConnTrack(database, tdb); struct asObject *as = asForTdb(conn, tdb); hFreeConn(&conn); if (as == NULL) return 0; -#endif///ndef EXTRA_FIELDS_SUPPORT // We are trying to print extra fields so we need to figure out how many fields to skip int start = 0; char *type = cloneString(tdb->type); char *word = nextWord(&type); if (word && (sameWord(word,"bed") || sameWord(word,"bigBed"))) { if (NULL != (word = nextWord(&type))) start = sqlUnsigned(word); - #ifndef EXTRA_FIELDS_SUPPORT else // custom beds and bigBeds may not have full type "begBed 9 +" start = max(0,slCount(as->columnList) - fieldCount); - #else///ifdef EXTRA_FIELDS_SUPPORT - // extraFields do not have to define all fields - if (fieldCount > slCount(extras)) - start = 0; - #endif///def EXTRA_FIELDS_SUPPORT } int count = 0; -#ifdef EXTRA_FIELDS_SUPPORT -struct extraField *col = extras; -#else///ifndef EXTRA_FIELDS_SUPPORT struct asColumn *col = as->columnList; -#endif///ndef EXTRA_FIELDS_SUPPORT for (;col != NULL && count < fieldCount;col=col->next) { if (start > 0) // skip past already known fields { start--; continue; } int ix = count; if (sr != NULL) { ix = sqlFieldColumn(sr, col->name); // If sr provided, name must match sql columnn name! if (ix == -1 || ix > fieldCount) // so extraField really just provides a label continue; } // Print as table rows if (count == 0) printf("<br><table>"); count++; - #ifdef EXTRA_FIELDS_SUPPORT - printf("<tr><td><B>%s:</B></td>", col->label); - if (col->type == ftInteger) - { - long long valInt = sqlLongLong(fields[ix]); - printf("<td>%lld</td></tr>\n", valInt); - } - else if (col->type == ftFloat) - { - double valDouble = sqlDouble(fields[ix]); - printf("<td>%g</td></tr>\n", valDouble); - } - #else///ifndef EXTRA_FIELDS_SUPPORT printf("<tr><td><B>%s:</B></td>", col->comment); if (col->isList || col->isArray || col->lowType->stringy) { printf("<td>%s</td></tr>\n", fields[ix]); } else if (asTypesIsInt(col->lowType->type)) { long valInt = strtol(fields[ix],NULL,10); if (errno == 0 && valInt != 0) printf("<td>%ld</td></tr>\n", valInt); else printf("<td>%s</td></tr>\n", fields[ix]); // decided not to print error } else if (asTypesIsFloating(col->lowType->type)) { double valDouble = strtod(fields[ix],NULL); if (errno == 0 && valDouble != 0) printf("<td>%g</td></tr>\n", valDouble); else printf("<td>%s</td></tr>\n", fields[ix]); // decided not to print error } - #endif///ndef EXTRA_FIELDS_SUPPORT else { printf("<td>%s</td></tr>\n", fields[ix]); } } -#ifdef EXTRA_FIELDS_SUPPORT -extraFieldsFree(&extras); -#else///ifndef EXTRA_FIELDS_SUPPORT asObjectFree(&as); -#endif///ndef EXTRA_FIELDS_SUPPORT if (count > 0) printf("</table>\n"); return count; } void genericBedClick(struct sqlConnection *conn, struct trackDb *tdb, char *item, int start, int bedSize) /* Handle click in generic BED track. */ { char table[64]; boolean hasBin; struct bed *bed; char query[512]; struct sqlResult *sr;