Example #1
0
static struct customTrack *beginCustomTrack(char *table, int fields,
	boolean doCt, boolean doWigHdr, boolean doDataPoints)
/* If doCt, return a new custom track object from TB cart settings and params;
 * if !doCt, return NULL but print out a header line. */
{
char *ctName = cgiUsualString(hgtaCtName, table);
char *ctDesc = cgiUsualString(hgtaCtDesc, table);
char *ctUrl  = cgiUsualString(hgtaCtUrl, "");
char *ctVis  = cgiUsualString(hgtaCtVis, "dense");
int visNum = (int) hTvFromStringNoAbort(ctVis);
struct customTrack *ctNew = NULL;

if (visNum < 0)
    visNum = 0;
if (doCt)
    {
    ctNew = newCt(ctName, ctDesc, visNum, ctUrl, fields);
    if (doDataPoints)
	{
	struct dyString *wigSettings = newDyString(0);
	struct tempName tn;
	trashDirFile(&tn, "ct", hgtaCtTempNamePrefix, ".wib");
	ctNew->wibFile = cloneString(tn.forCgi);
	char *wiggleFile = cloneString(ctNew->wibFile);
	chopSuffix(wiggleFile);
	strcat(wiggleFile, ".wia");
	ctNew->wigAscii = cloneString(wiggleFile);
	chopSuffix(wiggleFile);
	/* .wig file will be created upon encoding in customFactory */
	/*strcat(wiggleFile, ".wig");
	ctNew->wigFile = cloneString(wiggleFile);
	*/
	ctNew->wiggle = TRUE;
	dyStringPrintf(wigSettings,
		       "type wiggle_0\nwibFile %s\n", ctNew->wibFile);
	ctNew->tdb->settings = dyStringCannibalize(&wigSettings);
	freeMem(wiggleFile);
	}
    }
else
    {
    if (doWigHdr)
	hPrintf("track type=wiggle_0 name=\"%s\" description=\"%s\" "
		"visibility=%d url=%s \n",
		ctName, ctDesc, visNum, ctUrl);
    else
	hPrintf("track name=\"%s\" description=\"%s\" visibility=%d url=%s \n",
		ctName, ctDesc, visNum, ctUrl);
    }
return ctNew;
}
Example #2
0
static dmz::ConfigContext *
local_get_config_from_scope (
    const dmz::String &Scope,
    dmz::ConfigContext *context,
    dmz::Boolean CreateScope) {

    dmz::ConfigContext *result (context);

    dmz::StringTokenizer it (Scope, LocalScopeChar);

    if (result) {

        dmz::String sub = it.get_next ();
        dmz::Boolean done (sub ? dmz::False : dmz::True);

        while (!done) {

            dmz::ConfigContext::DataList *next = result->configTable.lookup (sub);

            if (next && next->tail) {

                next->lock.lock ();
                result = next->tail->context;
                next->lock.unlock ();
            }
            else if (CreateScope) {

                dmz::ConfigContext *newCt (new dmz::ConfigContext (sub));
                if (result->add_config (newCt)) {
                    result = newCt;
                }
                else {
                    result = 0;
                    done = dmz::True;
                }
            }
            else {
                done = dmz::True;
                result = 0;
            }

            sub = it.get_next ();

            if (!sub) {
                done = dmz::True;
            }
        }
    }

    return result;
}