本文整理汇总了C++中dyStringAppend函数的典型用法代码示例。如果您正苦于以下问题:C++ dyStringAppend函数的具体用法?C++ dyStringAppend怎么用?C++ dyStringAppend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dyStringAppend函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: addClusterMapItem
void addClusterMapItem(struct hacTree *ht, int x1, int y1, int x2, int y2, struct titleHelper *helper)
/* If using imageV2, add mouseover text (no link) with info about this cluster. */
{
if (theImgBox && curImgTrack)
{
struct dyString *dy = dyStringNew(0);
struct hapCluster *c = (struct hapCluster *)ht->itemOrCluster;
dyStringPrintf(dy, "N=%d ", c->leafCount);
while (dyStringLen(dy) < 7)
dyStringAppendC(dy, ' ');
if (helper->startIx > 0)
dyStringAppend(dy, "...");
int i, nHapsForClustering = helper->endIx - helper->startIx;
for (i=0; i < nHapsForClustering; i++)
{
boolean isCenter = (helper->startIx+i == helper->centerIx);
char *allele = isRef(c, i) ? helper->refs[i] : helper->alts[i];
if (isCenter)
dyStringAppendC(dy, '[');
int altCount = c->leafCount - c->refCounts[i] - c->unkCounts[i];
if (c->refCounts[i] > 0 && altCount > 0)
dyStringAppendC(dy, '*');
else if (strlen(allele) == 1)
dyStringAppendC(dy, allele[0]);
else
dyStringPrintf(dy, "(%s)", allele);
if (isCenter)
dyStringAppendC(dy, ']');
}
if (helper->endIx < helper->nRecords)
dyStringAppend(dy, "...");
imgTrackAddMapItem(curImgTrack, TITLE_BUT_NO_LINK, dy->string,
x1, y1, x2, y2, helper->track);
}
}
开发者ID:maximilianh,项目名称:kent,代码行数:35,代码来源:vcfTrack.c
示例2: mapBoxForCenterVariant
void mapBoxForCenterVariant(struct vcfRecord *rec, struct hvGfx *hvg, struct track *tg,
int xOff, int yOff, int width)
/* Special mouseover for center variant */
{
struct dyString *dy = dyStringNew(0);
unsigned int chromStartMap = vcfRecordTrimIndelLeftBase(rec);
unsigned int chromEndMap = vcfRecordTrimAllelesRight(rec);
gtSummaryString(rec, dy);
dyStringAppend(dy, " Haplotypes sorted on ");
char *centerChrom = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "centerVariantChrom");
if (centerChrom == NULL || !sameString(chromName, centerChrom))
dyStringAppend(dy, "middle variant by default. ");
else
dyStringAppend(dy, "this variant. ");
dyStringAppend(dy, "To anchor sorting to a different variant, click on that variant and "
"then click on the 'Use this variant' button below the variant name.");
const double scale = scaleForPixels(width);
int x1 = round((double)(rec->chromStart-winStart)*scale) + xOff;
int x2 = round((double)(rec->chromEnd-winStart)*scale) + xOff;
int w = x2-x1;
if (w <= 1)
{
x1--;
w = 3;
}
mapBoxHgcOrHgGene(hvg, chromStartMap, chromEndMap, x1, yOff, w, tg->height, tg->track,
rec->name, dy->string, NULL, TRUE, NULL);
}
开发者ID:maximilianh,项目名称:kent,代码行数:28,代码来源:vcfTrack.c
示例3: dyStringNew
char *getDescription(struct hash *ra,char *alternateSetting)
// Returns allocated string that is description. Will include DEPRECATED if appropriate
{
struct dyString *dyDescription = dyStringNew(256);
char *deprecated = hashFindVal(ra, "deprecated");
if (deprecated != NULL)
dyStringPrintf(dyDescription,"DEPRECATED - %s",deprecated);
char *description = hashFindVal(ra, CV_DESCRIPTION);
if (description == NULL && alternateSetting != NULL)
description = hashFindVal(ra, alternateSetting);
if (description == NULL)
description = hashFindVal(ra, CV_TITLE);
if (description == NULL)
description = hashFindVal(ra, CV_LABEL);
if (description != NULL)
{
if (dyStringLen(dyDescription) > 0)
dyStringAppend(dyDescription,"<BR>");
dyStringAppend(dyDescription,description);
}
if (dyStringLen(dyDescription) > 0)
return dyStringCannibalize(&dyDescription);
dyStringFree(&dyDescription);
return NULL;
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:25,代码来源:hgEncodeVocab.c
示例4: dyStringNew
static char *getPartPslFile(char *outDir, int partNum)
/* compute the name for the partition psl file, creating directories.
* freeMem result */
{
struct dyString *partPath = dyStringNew(128);
char partStr[64];
int i, partStrLen;
/* part number, with leading zeros */
safef(partStr, sizeof(partStr), "%0*d", gOutLevels, partNum);
partStrLen = strlen(partStr);
dyStringAppend(partPath, outDir);
makeDir(partPath->string);
/* create with multiple levels of directories, with least-signficant part of
* number being lowest directory */
for (i = 0; i < gOutLevels; i++)
{
dyStringAppendC(partPath, '/');
dyStringAppendC(partPath, partStr[(partStrLen-gOutLevels)+i]);
makeDir(partPath->string);
}
dyStringAppendC(partPath, '/');
dyStringAppend(partPath, partStr);
dyStringAppend(partPath, ".psl");
return dyStringCannibalize(&partPath);
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:29,代码来源:pslPartition.c
示例5: appendMimeTerminus
static void appendMimeTerminus(struct dyString *dy, char *boundary)
/* Append MIME boundary terminator to dy. */
{
dyStringAppend(dy, "\r\n--");
dyStringAppend(dy, boundary);
dyStringAppend(dy, "--\r\n");
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:7,代码来源:htmlPage.c
示例6: writeGap
void writeGap(struct dyString *aRes, int aGap, char *aSeq, struct dyString *bRes, int bGap, char *bSeq)
/* Write double - gap. Something like:
* ....123.... or --c
* ...4123.... ag- */
{
char abbrev[16];
int minToAbbreviate = 16;
if (doShort && (aGap >= minToAbbreviate || bGap >= minToAbbreviate))
{
fillShortGapString(abbrev, aGap, '.', 13);
dyStringAppend(aRes, abbrev);
fillShortGapString(abbrev, bGap, '.', 13);
dyStringAppend(bRes, abbrev);
}
else
{
#ifdef OLD
dyStringAppendMultiC(aRes, '-', aGap);
dyStringAppendN(bRes, bSeq, aGap);
dyStringAppendN(aRes, aSeq, bGap);
dyStringAppendMultiC(bRes, '-', bGap);
#endif /* OLD */
dyStringAppendMultiC(aRes, '-', bGap);
dyStringAppendN(bRes, bSeq, bGap);
dyStringAppendN(aRes, aSeq, aGap);
dyStringAppendMultiC(bRes, '-', aGap);
}
}
开发者ID:SHuang-Broad,项目名称:SnowTools,代码行数:29,代码来源:pslPretty.c
示例7: main
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 5)
usage();
acceptString = optionVal("A", NULL);
if (acceptString)
{
acceptExtensionsCount = chopByChar(acceptString, ',', NULL, 0);
AllocArray(acceptExtensions, acceptExtensionsCount);
chopByChar(acceptString, ',', acceptExtensions, acceptExtensionsCount);
verbose(1, "accept-option count: %d\n", acceptExtensionsCount);
int i = 0;
for(i=0; i<acceptExtensionsCount; ++i)
{
verbose(2, "accept-option: %s\n", acceptExtensions[i]);
}
}
struct dyString *url = dyStringNew(4096);
struct dyString *outPath = dyStringNew(4096);
dyStringAppend(url, argv[3]);
dyStringAppend(outPath, argv[4]);
if (!paraSync(atoi(argv[1]), atoi(argv[2]), url, outPath, optionExists("newer"), optionExists("progress")))
exit(1);
return 0;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:27,代码来源:paraSync.c
示例8: strlen
char *menuBarAddUiVars(char *oldString, char *cgiPrefix, char *uiVars)
/* Look for CGI program calls in oldString, and add session vars hgsid to them */
{
int len = strlen(oldString);
char buf[4096];
/* Create a regular expression and compile it */
regex_t re;
regmatch_t match[2];
safef(buf, sizeof(buf), "%s[A-Za-z]+(%c%c?)", cgiPrefix, '\\', '?');
int err = regcomp(&re, buf, REG_EXTENDED);
if(err)
errAbort("regcomp failed; err: %d", err);
/* Search through oldString with regex, and build up new string in dy */
struct dyString *dy = newDyString(0);
int offset;
for(offset = 0; offset < len && !regexec(&re, oldString + offset, ArraySize(match), match, 0);
offset += match[0].rm_eo)
{
dyStringAppendN(dy, oldString + offset, match[0].rm_eo);
if(match[1].rm_so == match[1].rm_eo)
dyStringAppend(dy, "?");
dyStringAppend(dy, uiVars);
if(match[1].rm_so != match[1].rm_eo)
dyStringAppend(dy, "&");
}
if(offset < len)
dyStringAppend(dy, oldString + offset);
return dyStringCannibalize(&dy);
}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:31,代码来源:web.c
示例9: doLog
void doLog()
{
FILE *logFileHandle = mustOpen("snpGetSeqDup.log", "w");
struct hashCookie cookie = hashFirst(uniqHash);
char *rsId = NULL;
int count = 0;
struct hashEl *hel = NULL;
char *fileName = NULL;
struct dyString *dy = newDyString(1024);
while ((rsId = hashNextName(&cookie)) != NULL)
{
count = 0;
for (hel = hashLookup(snpHash, rsId); hel != NULL; hel = hashLookupNext(hel))
count++;
if (count == 1) continue;
for (hel = hashLookup(snpHash, rsId); hel != NULL; hel = hashLookupNext(hel))
{
fileName = (char *)hel->val;
dyStringAppend(dy, fileName);
dyStringAppend(dy, " ");
}
fprintf(logFileHandle, "%s\t%s\n", rsId, dy->string);
dyStringClear(dy);
}
carefulClose(&logFileHandle);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:28,代码来源:snpGetSeqDup.c
示例10: xpLookup
static void xpLookup(struct xp *xp, struct dyString *temp, struct dyString *text)
/* Parse after '&' until ';' and look up symbol. Put result into text. */
{
char c;
char *s;
dyStringClear(temp);
for (;;)
{
if ((c = xpGetChar(xp)) == 0)
xpError(xp, "End of file in after & and before ;");
if (isspace(c))
xpError(xp, "& without ;");
if (c == ';')
break;
dyStringAppendC(temp, c);
}
s = temp->string;
if (s[0] == '#')
{
c = atoi(s+1);
dyStringAppendC(text, c);
}
else if ((s = hashFindVal(xp->symHash, s)) == NULL)
{
dyStringAppendC(text, '&');
dyStringAppend(text, temp->string);
dyStringAppendC(text, ';');
}
else
{
dyStringAppend(text, s);
}
}
开发者ID:JinfengChen,项目名称:pblat,代码行数:33,代码来源:xp.c
示例11: strstr
struct dyString *unrepFileName(char *fileName, boolean isSingle)
/* Return string with Rep# in fileName replaced with "Merged" */
{
char *s = strstr(fileName, "Rep");
struct dyString *dy = dyStringNew(0);
if (s == NULL)
{
if (isSingle)
dyStringAppend(dy, fileName);
else
errAbort("No 'Rep' in fileName %s", fileName);
}
else
{
char *pastRep = s + strlen("Rep");
int digitCount = countLeadingDigits(pastRep);
if (digitCount < 1)
errAbort("No digits after 'Rep' in filename %s", fileName);
pastRep += digitCount;
dyStringAppendN(dy, fileName, s-fileName);
dyStringAppend(dy, "Merged");
int len = strlen(pastRep);
if (!isSingle && endsWith(pastRep, ".gz"))
len -= strlen(".gz");
dyStringAppendN(dy, pastRep, len);
}
return dy;
}
开发者ID:davidhoover,项目名称:kent,代码行数:28,代码来源:encodeMergeReplicatesBatch.c
示例12: regcomp
char *replaceRegEx(char *str, char *replace, char *regEx, int flags)
{
/* Replace text matching regEx in str with replace string.
flags is passed through to regcomp as the cflags argument.
Returned string should be free'ed after use. */
regex_t re;
regmatch_t match[1];
int err = regcomp(&re, regEx, flags);
if(err)
errAbort("regcomp failed; err: %d", err);
struct dyString *dy = newDyString(0);
size_t len = strlen(str);
size_t offset = 0;
while(offset < len && !regexec(&re, str + offset, 1, match, 0))
{
dyStringAppendN(dy, str + offset, match[0].rm_so);
if(replace != NULL)
dyStringAppend(dy, replace);
offset += match[0].rm_eo;
}
if(offset < len)
{
dyStringAppend(dy, str + offset);
}
regfree(&re);
return dyStringCannibalize(&dy);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:27,代码来源:jsHelper.c
示例13: dyStringNew
static struct slName *getListFromCgapSageLibs(struct sqlConnection *conn, char *column, boolean returnIds, boolean distinct)
/* Return [unique] list of tissues sorted alphabetically. */
{
struct slName *list = NULL;
struct dyString *dy = dyStringNew(0);
char **row;
struct sqlResult *sr;
sqlDyStringPrintf(dy, "select ");
if (distinct)
dyStringAppend(dy, "distinct ");
sqlDyStringPrintf(dy, "%s", column);
if (returnIds)
dyStringAppend(dy, ",libId");
sqlDyStringPrintf(dy, " from cgapSageLib order by %s", column);
sr = sqlGetResult(conn, dy->string);
while ((row = sqlNextRow(sr)) != NULL)
{
char *word = (returnIds) ? row[1] : row[0];
slNameAddHead(&list, word);
}
slReverse(&list);
sqlFreeResult(&sr);
dyStringFree(&dy);
return list;
}
开发者ID:bowhan,项目名称:kent,代码行数:25,代码来源:cgapSageUi.c
示例14: lineFileOpen
struct dyString *readAndReplaceTableName(char *fileName, char *table)
/* Read file into string. While doing so strip any leading comments
* and insist that the first non-comment line contain the words
* "create table" followed by a table name. Replace the table name,
* and copy the rest of the file verbatem. */
{
struct lineFile *lf = lineFileOpen(fileName, TRUE);
struct dyString *dy = dyStringNew(0);
char *line, *word;
if (!lineFileNextReal(lf, &line))
errAbort("No real lines in %s\n", fileName);
word = nextWord(&line);
if (!sameWord(word, "create"))
errAbort("Expecting first word in file to be CREATE. Got %s", word);
word = nextWord(&line);
if (word == NULL || !sameWord(word, "table"))
errAbort("Expecting second word in file to be table. Got %s", emptyForNull(word));
word = nextWord(&line);
if (word == NULL)
errAbort("Expecting table name on same line as CREATE TABLE");
sqlDyStringPrintf(dy, "CREATE TABLE %s ", table);
if (line != NULL)
dyStringAppend(dy, line);
dyStringAppendC(dy, '\n');
while (lineFileNext(lf, &line, NULL))
{
dyStringAppend(dy, line);
dyStringAppendC(dy, '\n');
}
lineFileClose(&lf);
return dy;
}
开发者ID:sktu,项目名称:kentUtils,代码行数:32,代码来源:hgLoadSqlTab.c
示例15: gensatFixFull
void gensatFixFull(char *captionFile)
/* Fix missing captions. */
{
struct lineFile *lf = lineFileOpen(captionFile, TRUE);
char *row[2];
struct dyString *sql = dyStringNew(0);
struct sqlConnection *conn = sqlConnect(database);
struct hash *capHash = newHash(16);
while (lineFileRowTab(lf, row))
{
int captionId;
char *submitId = row[0];
char *caption = row[1];
captionId = hashIntValDefault(capHash, caption, 0);
if (captionId == 0)
{
dyStringClear(sql);
dyStringAppend(sql, "insert into caption values(default, \"");
dyStringAppend(sql, caption);
dyStringAppend(sql, "\")");
sqlUpdate(conn, sql->string);
verbose(1, "%s\n", sql->string);
captionId = sqlLastAutoId(conn);
hashAddInt(capHash, caption, captionId);
}
dyStringClear(sql);
dyStringPrintf(sql, "update imageFile set caption=%d ", captionId);
dyStringPrintf(sql, "where submissionSet=%d ", gensatId);
dyStringPrintf(sql, "and submitId = \"%s\"", submitId);
sqlUpdate(conn, sql->string);
verbose(1, "%s\n", sql->string);
}
dyStringFree(&sql);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:34,代码来源:gensatFixFull.c
示例16: hashNumEntries
char *identifierWhereClause(char *idField, struct hash *idHash)
/* If the number of pasted IDs is reasonably low, return a where-clause component for the IDs. */
{
if (idHash == NULL || idField == NULL)
return NULL;
int numIds = hashNumEntries(idHash);
int maxIdsInWhere = cartUsualInt(cart, "hgt_maxIdsInWhere", DEFAULT_MAX_IDS_IN_WHERE);
if (numIds > 0 && numIds <= maxIdsInWhere)
{
struct dyString *dy = dyStringNew(16 * numIds);
dyStringPrintf(dy, "%s in (", idField);
struct hashCookie hc = hashFirst(idHash);
boolean first = TRUE;
char *id;
while ((id = hashNextName(&hc)) != NULL)
{
if (first)
first = FALSE;
else
dyStringAppend(dy, ", ");
dyStringPrintf(dy, "'%s'", id);
}
dyStringAppend(dy, ")");
return dyStringCannibalize(&dy);
}
return NULL;
}
开发者ID:maximilianh,项目名称:kent,代码行数:27,代码来源:identifiers.c
示例17: getItemLabel
static void getItemLabel(struct sqlConnection *conn,
char *retroInfoTbl,
unsigned labelSet,
struct linkedFeatures *lf)
/* get label for a retro item */
{
struct ucscRetroInfo *info = NULL;
info = ucscRetroInfoQuery(conn, retroInfoTbl, lf->name);
char *geneSymbol = getRetroParentSymbol(info, lf->name);
//lf->extra = geneSymbol;
struct dyString *label = dyStringNew(64);
dyStringAppend(label, "retro-");
if ((labelSet & useGene) && (retroInfoTbl != NULL))
{
if ((geneSymbol != NULL) && (strlen(geneSymbol) > 0))
dyStringAppend(label, geneSymbol);
else
labelSet |= useAcc; // no gene, so force acc
}
/* if both accession and gene are selected, add to item label */
if (labelSet & useAcc)
{
if (labelSet & useGene)
{
dyStringAppend(label, "/");
dyStringAppend(label, lf->name);
}
else
dyStringAppend(label, lf->name);
}
ucscRetroInfoFree(&info);
lf->extra = dyStringCannibalize(&label);
}
开发者ID:maximilianh,项目名称:kent,代码行数:33,代码来源:retroGene.c
示例18: parseBlockLine
static boolean parseBlockLine(struct blastFile *bf, int *startRet, int *endRet,
struct dyString *seq)
/* read and parse the next target or query line, like:
* Query: 26429 taccttgacattcctcagtgtgtcatcatcgttctctcctccaaacggcgagagtccgga 26488
*
* also handle broken NCBI tblastn output like:
* Sbjct: 1181YYGEQRSTNGQTIQLKTQVFRRFPDDDDESEDHDDPDNAHESPEQEGAEGHFDLHYYENQ 1360
*
* Ignores and returns FALSE on bogus records generated by PSI BLAST, such as
* Query: 0 --------------------------
* Sbjct: 38 PPGPPGVAGGNQTTVVVIYGPPGPPG 63
* Query: 0
* Sbjct: 63 63
* If FALSE is returned, the output parameters will be unchanged.
*/
{
char* line = bfNeedNextLine(bf);
int a, b, s, e;
char *words[16];
int wordCount = chopLine(line, words);
if ((wordCount < 2) || (wordCount > 4) || !(sameString("Query:", words[0]) || sameString("Sbjct:", words[0])))
bfSyntax(bf);
/* look for one of the bad formats to ignore, as described above */
if (((wordCount == 2) && isAllDigits(words[1]))
|| ((wordCount == 3) && isAllDigits(words[1]) && isAllDigits(words[2]))
|| ((wordCount == 3) && isAllDigits(words[1]) && isAllDashes(words[2])))
{
bfWarn(bf, "Ignored invalid alignment format for aligned sequence pair");
return FALSE;
}
/* special handling for broken output with no space between start and
* sequence */
if (wordCount == 3)
{
char *p;
if (!isdigit(words[1][0]) || !isdigit(words[2][0]))
bfSyntax(bf);
a = atoi(words[1]);
b = atoi(words[2]);
p = words[1];
while ((*p != '\0') && (isdigit(*p)))
p++;
dyStringAppend(seq, p);
}
else
{
if (!isdigit(words[1][0]) || !isdigit(words[3][0]))
bfSyntax(bf);
a = atoi(words[1]);
b = atoi(words[3]);
dyStringAppend(seq, words[2]);
}
s = min(a,b);
e = max(a,b);
*startRet = min(s, *startRet);
*endRet = max(e, *endRet);
return TRUE;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:60,代码来源:blastParse.c
示例19: addWhereOrAnd
static void addWhereOrAnd(struct dyString *query, int clauseCnt)
/* add a `where' or `and' to the query as indicated by clauseCnt */
{
if (clauseCnt == 0)
dyStringAppend(query, " where");
else
dyStringAppend(query, " and");
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:8,代码来源:hgSelect.c
示例20: maybeBedGraph
static void maybeBedGraph(int col, struct dyString *dy, char *colDefinition)
/* output definition "default" for column "col" when not bedGraph */
{
if (col == bedGraph)
dyStringAppend(dy, " dataValue float not null,\n");
else
dyStringAppend(dy, colDefinition);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:8,代码来源:hgLoadBed.c
注:本文中的dyStringAppend函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论