inc/dystring.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dyString

Defines

#define dyStringNew   newDyString
#define dyStringFree(a)   freeDyString(a);
#define dyStringFreeList(a)   freeDyStringList(a);
#define dyStringClear(ds)   (ds->string[0] = ds->stringSize = 0)

Functions

dyStringnewDyString (int initialBufSize)
void freeDyString (struct dyString **pDs)
void freeDyStringList (struct dyString **pDs)
void dyStringAppend (struct dyString *ds, char *string)
void dyStringAppendN (struct dyString *ds, char *string, int stringSize)
char dyStringAppendC (struct dyString *ds, char c)
void dyStringAppendMultiC (struct dyString *ds, char c, int n)
void dyStringAppendEscapeQuotes (struct dyString *dy, char *string, char quot, char esc)
void dyStringVaPrintf (struct dyString *ds, char *format, va_list args)
void dyStringPrintf (struct dyString *ds, char *format,...)
dyStringdyStringSub (char *orig, char *in, char *out)
void dyStringBumpBufSize (struct dyString *ds, int size)
char * dyStringCannibalize (struct dyString **pDy)
void dyStringResize (struct dyString *ds, int newSize)


Define Documentation

#define dyStringClear ( ds   )     (ds->string[0] = ds->stringSize = 0)

Definition at line 60 of file dystring.h.

Referenced by dtdxTag(), emblLineGroup(), lineFileParseHttpHeader(), lineFileSlurpHttpBody(), netHttpGetMultiple(), nextBlock(), parseDatabaseLines(), readPartHeaderMB(), saveAxtBundle(), transQuery(), transTransQuery(), xapEndTag(), xpLookup(), xpParseEndTag(), xpParseNext(), and xpParseStartTag().

#define dyStringFree (  )     freeDyString(a);

Definition at line 27 of file dystring.h.

Referenced by dnaMotifToLogoPGM(), dnaMotifToLogoPng(), dtdParse(), errCatchFree(), getWormGeneExonDna(), htmlPageFromForm(), htmlSlurpWithCookies(), lineFileParseHttpHeader(), lineFileVaAbort(), netGetOpenFtp(), netHttpConnect(), netHttpGet(), netSkipHttpHeaderLines(), outputFa(), pslGetCreateSql(), qaStatusSoftError(), readPartHeaderMB(), saveAxtBundle(), sendFtpCommand(), sqlByteArrayToString(), sqlCharArrayToString(), sqlDoubleArrayToString(), sqlFloatArrayToString(), sqlLongLongArrayToString(), sqlShortArrayToString(), sqlSignedArrayToString(), sqlStringArrayToString(), sqlUbyteArrayToString(), sqlUnsignedArrayToString(), and sqlUshortArrayToString().

#define dyStringFreeList (  )     freeDyStringList(a);

Definition at line 32 of file dystring.h.

#define dyStringNew   newDyString

Definition at line 22 of file dystring.h.

Referenced by dnaMotifToLogoPGM(), dnaMotifToLogoPng(), dtdParse(), errCatchNew(), hashToRaString(), htmlExpandUrl(), htmlPageFromForm(), htmlSlurpWithCookies(), joinCmd(), joinCmds(), lineFileVaAbort(), parseDatabaseLines(), parseFacility(), parseMultiParts(), qaStatusSoftError(), quotedPrintableEncode(), and readPartHeaderMB().


Function Documentation

void dyStringAppend ( struct dyString ds,
char *  string 
)

Definition at line 115 of file dystring.c.

References ds, and dyStringAppendN().

Referenced by appendCgiVar(), appendMimeTerminus(), appendMimeVar(), cgiParseMultipart(), cgiUrlString(), cookieOutput(), dnaMotifToLogoPGM(), dnaMotifToLogoPng(), emblLineGroup(), expandEntities(), hashToRaString(), htmlExpandUrl(), htmlPageFromForm(), htmlSlurpWithCookies(), joinCmd(), joinCmds(), netHttpConnect(), netHttpGet(), netHttpGetMultiple(), outputFa(), parseBlockLine(), parseDatabaseLines(), parseFacility(), qaStatusSoftError(), readPartHeaderMB(), xapEndTag(), and xpLookup().

00117 {
00118 dyStringAppendN(ds, string, strlen(string));
00119 }

Here is the call graph for this function:

Here is the caller graph for this function:

char dyStringAppendC ( struct dyString ds,
char  c 
)

Definition at line 88 of file dystring.c.

References ds, and dyStringExpandBuf().

Referenced by appendCgiVar(), cookieOutput(), dtdxTag(), dyStringAppendEscapeQuotes(), emblLineGroup(), errCatchWarnHandler(), expandEntities(), hashToRaString(), htmlExpandUrl(), lineFileParseHttpHeader(), lineFileSlurpHttpBody(), nodeNames(), phyloFindPath(), qaStatusSoftError(), quotedPrintableEncode(), xpLookup(), xpParseEndTag(), xpParseNext(), xpParseStartTag(), and xpTextUntil().

00090 {
00091 char *s;
00092 if (ds->stringSize >= ds->bufSize)
00093      dyStringExpandBuf(ds, ds->bufSize+256);
00094 s = ds->string + ds->stringSize++;
00095 *s++ = c;
00096 *s = 0;
00097 return c;
00098 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dyStringAppendEscapeQuotes ( struct dyString dy,
char *  string,
char  quot,
char  esc 
)

Definition at line 121 of file dystring.c.

References dyStringAppendC().

00124 {
00125 char c;
00126 char *s = string;
00127 while ((c = *s++) != 0)
00128      {
00129      if (c == quot)
00130          dyStringAppendC(dy, esc);
00131      dyStringAppendC(dy, c);
00132      }
00133 }

Here is the call graph for this function:

void dyStringAppendMultiC ( struct dyString ds,
char  c,
int  n 
)

Definition at line 100 of file dystring.c.

References ds, and dyStringExpandBuf().

Referenced by saveAxtBundle().

00102 {
00103 int oldSize = ds->stringSize;
00104 int newSize = oldSize + n;
00105 int newAllocSize = newSize + oldSize;
00106 char *buf;
00107 if (newSize > ds->bufSize)
00108     dyStringExpandBuf(ds,newAllocSize);
00109 buf = ds->string;
00110 memset(buf+oldSize, c, n);
00111 ds->stringSize = newSize;
00112 buf[newSize] = 0;
00113 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dyStringAppendN ( struct dyString ds,
char *  string,
int  stringSize 
)

Definition at line 73 of file dystring.c.

References ds, and dyStringExpandBuf().

Referenced by appendMimeVar(), dyStringAppend(), dyStringSub(), getWormGeneExonDna(), htmlExpandUrl(), lineFileParseHttpHeader(), lineFileSlurpHttpBody(), netSlurpFile(), nodeNames(), parseMultiParts(), phyloFindPath(), saveAxtBundle(), sendFtpCommand(), and xpTextUntil().

00075 {
00076 int oldSize = ds->stringSize;
00077 int newSize = oldSize + stringSize;
00078 int newAllocSize = newSize + oldSize;
00079 char *buf;
00080 if (newSize > ds->bufSize)
00081     dyStringExpandBuf(ds,newAllocSize);
00082 buf = ds->string;
00083 memcpy(buf+oldSize, string, stringSize);
00084 ds->stringSize = newSize;
00085 buf[newSize] = 0;
00086 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dyStringBumpBufSize ( struct dyString ds,
int  size 
)

Definition at line 66 of file dystring.c.

References ds, and dyStringExpandBuf().

00068 {
00069 if (ds->bufSize < size)
00070     dyStringExpandBuf(ds, size);
00071 }

Here is the call graph for this function:

char* dyStringCannibalize ( struct dyString **  pDy  ) 

Definition at line 34 of file dystring.c.

References ds, and freez().

Referenced by hashToRaString(), htmlExpandUrl(), htmlPageFromForm(), htmlSlurpWithCookies(), joinCmd(), joinCmds(), parseMultiParts(), and quotedPrintableEncode().

00038 {
00039 char *s;
00040 struct dyString *ds = *pDy;
00041 assert(ds != NULL);
00042 s = ds->string;
00043 freez(pDy);
00044 return s;
00045 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dyStringPrintf ( struct dyString ds,
char *  format,
  ... 
)

Definition at line 167 of file dystring.c.

References ds, and dyStringVaPrintf().

Referenced by cgiParseMultipart(), cgiUrlString(), dnaMotifToLogoPGM(), dnaMotifToLogoPng(), htmlPageFromForm(), lineFileVaAbort(), netHttpConnect(), netHttpGet(), netSkipHttpHeaderLines(), outputFa(), parseMultiParts(), pslGetCreateSql(), qaStatusOnPage(), quotedPrintableEncode(), sqlByteArrayToString(), sqlCharArrayToString(), sqlDoubleArrayToString(), sqlFloatArrayToString(), sqlLongLongArrayToString(), sqlShortArrayToString(), sqlSignedArrayToString(), sqlStringArrayToString(), sqlUbyteArrayToString(), sqlUnsignedArrayToString(), sqlUshortArrayToString(), transQuery(), and transTransQuery().

00169 {
00170 va_list args;
00171 va_start(args, format);
00172 dyStringVaPrintf(ds, format, args);
00173 va_end(args);
00174 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dyStringResize ( struct dyString ds,
int  newSize 
)

Definition at line 204 of file dystring.c.

References ds, and dyStringExpandBuf().

00206 {
00207 int oldSize = ds->stringSize;
00208 if (newSize > oldSize)
00209     {
00210     /* grow */
00211     if (newSize > ds->bufSize)
00212         dyStringExpandBuf(ds, newSize + ds->stringSize);
00213     memset(ds->string+newSize, ' ', newSize);
00214     }
00215 ds->string[newSize] = '\0';
00216 ds->stringSize = newSize;
00217 }

Here is the call graph for this function:

struct dyString* dyStringSub ( char *  orig,
char *  in,
char *  out 
) [read]

Definition at line 176 of file dystring.c.

References dyStringAppendN(), newDyString(), and stringIn.

00179 {
00180 int inLen = strlen(in), outLen = strlen(out), origLen = strlen(orig);
00181 struct dyString *dy = newDyString(origLen + 2*outLen);
00182 char *s, *e;
00183 
00184 if (orig == NULL) return NULL;
00185 for (s = orig; ;)
00186     {
00187     e = stringIn(in, s);
00188     if (e == NULL) 
00189         {
00190         e = orig + origLen;
00191         dyStringAppendN(dy, s, e - s);
00192         break;
00193         }
00194     else
00195         {
00196         dyStringAppendN(dy, s, e - s);
00197         dyStringAppendN(dy, out, outLen);
00198         s = e + inLen;
00199         }
00200     }
00201 return dy;
00202 }

Here is the call graph for this function:

void dyStringVaPrintf ( struct dyString ds,
char *  format,
va_list  args 
)

Definition at line 135 of file dystring.c.

References ds, dyStringExpandBuf(), TRUE, and va_copy.

Referenced by dyStringPrintf(), errCatchWarnHandler(), lineFileVaAbort(), and qaStatusSoftError().

00137 {
00138 /* attempt to format the string in the current space.  If there
00139  * is not enough room, increase the buffer size and try again */
00140 int avail, sz;
00141 while (TRUE) 
00142     {
00143     va_list argscp;
00144     va_copy(argscp, args);
00145     avail = ds->bufSize - ds->stringSize;
00146     if (avail <= 0)
00147         {
00148         /* Don't pass zero sized buffers to vsnprintf, because who knows
00149          * if the library function will handle it. */
00150         dyStringExpandBuf(ds, ds->bufSize+ds->bufSize);
00151         avail = ds->bufSize - ds->stringSize;
00152         }
00153     sz = vsnprintf(ds->string + ds->stringSize, avail, format, argscp);
00154     va_end(argscp);
00155 
00156     /* note that some version return -1 if too small */
00157     if ((sz < 0) || (sz >= avail))
00158         dyStringExpandBuf(ds, ds->bufSize+ds->bufSize);
00159     else
00160         {
00161         ds->stringSize += sz;
00162         break;
00163         }
00164     }
00165 }

Here is the call graph for this function:

Here is the caller graph for this function:

void freeDyString ( struct dyString **  pDs  ) 

Definition at line 23 of file dystring.c.

References ds, freeMem(), and freez().

Referenced by cgiParseMultipart(), freeDyStringList(), parseMultiParts(), transQuery(), xapFree(), and xpFree().

00025 {
00026 struct dyString *ds;
00027 if ((ds = *pDs) != NULL)
00028     {
00029     freeMem(ds->string);
00030     freez(pDs);
00031     }
00032 }

Here is the call graph for this function:

Here is the caller graph for this function:

void freeDyStringList ( struct dyString **  pDs  ) 

Definition at line 47 of file dystring.c.

References ds, freeDyString(), and dyString::next.

00049 {
00050 struct dyString *ds, *next;
00051 for(ds = *pDs; ds != NULL; ds = next)
00052     {
00053     next = ds->next;
00054     freeDyString(&ds);
00055     }
00056 *pDs = NULL;
00057 }

Here is the call graph for this function:

struct dyString* newDyString ( int  initialBufSize  )  [read]

Definition at line 11 of file dystring.c.

References AllocVar, ds, and needMem().

Referenced by cgiParseMultipart(), cgiUrlString(), dnaMotifToLogoPGM(), dnaMotifToLogoPng(), dyStringSub(), emblRecord(), getWormGeneExonDna(), htmlFormCgiVars(), lineFileParseHttpHeader(), lineFileSlurpHttpBody(), netHttpConnect(), netHttpGet(), netHttpGetMultiple(), netSkipHttpHeaderLines(), netSlurpFile(), nextBlock(), outputFa(), parseMultiParts(), phyloFindPath(), phyloNodeNames(), pslGetCreateSql(), saveAxtBundle(), sendFtpCommand(), sqlByteArrayToString(), sqlCharArrayToString(), sqlDoubleArrayToString(), sqlFloatArrayToString(), sqlLongLongArrayToString(), sqlShortArrayToString(), sqlSignedArrayToString(), sqlStringArrayToString(), sqlUbyteArrayToString(), sqlUnsignedArrayToString(), sqlUshortArrayToString(), transQuery(), transTransQuery(), xapStartTag(), xpNew(), xpParseNext(), and xpParseStartTag().

00013 {
00014 struct dyString *ds;
00015 AllocVar(ds);
00016 if (initialBufSize == 0)
00017     initialBufSize = 512;
00018 ds->string = needMem(initialBufSize+1);
00019 ds->bufSize = initialBufSize;
00020 return ds;
00021 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 18:53:38 2007 for blat by  doxygen 1.5.2