Esempio n. 1
0
int edwSubmitPositionInQueue(struct sqlConnection *conn, char *url, unsigned *retJobId)
/* Return position of our URL in submission queue.  Optionally return id in edwSubmitJob
 * table of job. */
{
char query[256];
sqlSafef(query, sizeof(query), "select id,commandLine from edwSubmitJob where startTime = 0");
struct sqlResult *sr = sqlGetResult(conn, query);
char **row;
int aheadOfUs = -1;
int pos = 0;
unsigned jobId = 0;
while ((row = sqlNextRow(sr)) != NULL)
    {
    jobId = sqlUnsigned(row[0]);
    char *line = row[1];
    char *edwSubmit = nextQuotedWord(&line);
    char *lineUrl = nextQuotedWord(&line);
    if (sameOk(edwSubmit, "edwSubmit") && sameOk(url, lineUrl))
        {
	aheadOfUs = pos;
	break;
	}
    ++pos;
    }
sqlFreeResult(&sr);
if (retJobId != NULL)
    *retJobId = jobId;
return aheadOfUs;
}
Esempio n. 2
0
static void normalizePatList(struct slName **pPatList)
/* patList might be a plain old list of terms, in which case we keep the
 * terms only if they are not no-ops.  patList might also be one element
 * that is a space-separated list of terms, in which case we make a new
 * list item for each non-no-op term.  (Trim spaces while we're at it.) */
{
struct slName *pat, *nextPat, *patListOut = NULL;
if (pPatList == NULL) return;
for (pat = *pPatList;  pat != NULL;  pat = nextPat)
    {
    nextPat = pat->next;
    strcpy(pat->name, trimSpaces(pat->name));
    if (hasWhiteSpace(pat->name))
	{
	char *line = pat->name, *word;
	while ((word = nextQuotedWord(&line)) != NULL)
	    if (wildReal(word))
		{
		struct slName *newPat = slNameNew(word);
		slAddHead(&patListOut, newPat);
		}
	slNameFree(&pat);
	}
    else if (wildReal(pat->name))
	slAddHead(&patListOut, pat);
    }
*pPatList = patListOut;
}
Esempio n. 3
0
int countQuotedWordsInFile(char *fileName)
/* Count Quoted Words in a file */
{
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *line, *word;
int cnt;
cnt = 0;
while (lineFileNext(lf, &line, NULL))
    {
    while ((word = nextQuotedWord(&line)) != NULL)
        {
	cnt++;
        }
    }
lineFileClose(&lf);
return cnt;
}
Esempio n. 4
0
static struct hash *upcHashWordsInFile(char *fileName, int hashSize)
/* Create a hash of space delimited uppercased words in file. */
{
struct hash *hash = newHash(hashSize);
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *line, *word;
while (lineFileNext(lf, &line, NULL))
    {
    while ((word = nextQuotedWord(&line)) != NULL)
	{
	touppers(word);
        hashAdd(hash, word, NULL);
	}
    }
lineFileClose(&lf);
return hash;
}
Esempio n. 5
0
struct slName *slNameListOfUniqueWords(char *text,boolean respectQuotes)
/* Return list of unique words found by parsing string delimited by whitespace.
 * If respectQuotes then ["Lucy and Ricky" 'Fred and Ethyl'] will yield 2 slNames no quotes */
{
struct slName *list = NULL;
char *word = NULL;
while (text != NULL)
    {
    if (respectQuotes)
        word = nextQuotedWord(&text);
    else
        word = nextWord(&text);
    if (word)
        slNameStore(&list, word);
    else
        break;
    }
slReverse(&list);
return list;
}