inc/xap.h File Reference

#include "dystring.h"

Include dependency graph for xap.h:

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

Go to the source code of this file.

Data Structures

struct  xapStack
struct  xap

Functions

xapxapNew (void *(*startHandler)(struct xap *xap, char *name, char **atts), void(*endHandler)(struct xap *xap, char *name), char *fileName)
void xapFree (struct xap **pXp)
void xapParseFile (struct xap *xap, char *fileName)
void xapError (struct xap *xap, char *format,...)
void xapIndent (int count, FILE *f)
void xapSkip (struct xap *xap)
void xapParseAny (char *fileName, char *type, void *(*startHandler)(struct xap *xap, char *name, char **atts), void(*endHandler)(struct xap *xap, char *name), char **retType, void *retObj)
xapxapOpen (char *fileName, void *(*startHandler)(struct xap *xap, char *name, char **atts), void(*endHandler)(struct xap *xap, char *name))
void * xapNext (struct xap *xap, char *tag)


Function Documentation

void xapError ( struct xap xap,
char *  format,
  ... 
)

Definition at line 15 of file xap.c.

References errAbort(), xap::fileName, vaWarn(), xap::xp, and xpLineIx().

Referenced by xapEndTag(), xapParseAny(), and xapStartTag().

00017 {
00018 va_list args;
00019 va_start(args, format);
00020 vaWarn(format, args);
00021 errAbort("line %d of %s", xpLineIx(xap->xp), xap->fileName);
00022 va_end(args);
00023 }

Here is the call graph for this function:

Here is the caller graph for this function:

void xapFree ( struct xap **  pXp  ) 

Definition at line 99 of file xap.c.

References xap::fileName, freeDyString(), freeMem(), freez(), xap::stackBuf, xapStack::text, xap::topType, xap::xp, and xpFree().

Referenced by xapParseAny().

00101 {
00102 struct xap *xap = *pXp;
00103 if (xap != NULL)
00104     {
00105     struct xapStack *stack;
00106     for (stack = xap->stackBuf; stack < xap->endStack; ++stack)
00107         {
00108         if (stack->text != NULL)
00109            freeDyString(&stack->text);
00110         }
00111     xpFree(&xap->xp);
00112     freeMem(xap->fileName);
00113     freeMem(xap->topType);
00114     freez(pXp);
00115     }
00116 }

Here is the call graph for this function:

Here is the caller graph for this function:

void xapIndent ( int  count,
FILE *  f 
)

Definition at line 126 of file xap.c.

00128 {
00129 int i;
00130 for (i=0; i<count; ++i)
00131     {
00132     fputc(' ', f);
00133     }
00134 }

struct xap* xapNew ( void *(*)(struct xap *xap, char *name, char **atts)  startHandler,
void(*)(struct xap *xap, char *name endHandler,
char *  fileName 
) [read]

Definition at line 85 of file xap.c.

References AllocVar, ArraySize, cloneString(), xap::endHandler, xap::endStack, xap::fileName, xap::stack, xap::stackBuf, xap::startHandler, xapEndTag(), xapRead(), xapStartTag(), xap::xp, and xpNew().

Referenced by xapOpen(), and xapParseAny().

00088 {
00089 struct xap *xap;
00090 AllocVar(xap);
00091 xap->endStack = xap->stack = xap->stackBuf + ArraySize(xap->stackBuf) - 1;
00092 xap->startHandler = startHandler;
00093 xap->endHandler = endHandler;
00094 xap->xp = xpNew(xap, xapStartTag, xapEndTag, xapRead, fileName);
00095 xap->fileName = cloneString(fileName);
00096 return xap;
00097 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* xapNext ( struct xap xap,
char *  tag 
)

Definition at line 174 of file xap.c.

References errAbort(), sameString, xap::topObject, xap::topType, xap::xp, and xpParseNext().

00176 {
00177 if (!xpParseNext(xap->xp, tag))
00178     return NULL;
00179 if (!sameString(xap->topType, tag))
00180     errAbort("Expecting %s tag, got %s tag", tag, xap->topType);
00181 return xap->topObject;
00182 }

Here is the call graph for this function:

struct xap* xapOpen ( char *  fileName,
void *(*)(struct xap *xap, char *name, char **atts)  startHandler,
void(*)(struct xap *xap, char *name endHandler 
) [read]

Definition at line 162 of file xap.c.

References xap::f, mustOpen(), and xapNew().

00168 {
00169 struct xap *xap = xapNew(startHandler, endHandler, fileName);
00170 xap->f =  mustOpen(fileName, "r");
00171 return xap;
00172 }

Here is the call graph for this function:

void xapParseAny ( char *  fileName,
char *  type,
void *(*)(struct xap *xap, char *name, char **atts)  startHandler,
void(*)(struct xap *xap, char *name endHandler,
char **  retType,
void *  retObj 
)

Definition at line 142 of file xap.c.

References cloneString(), sameString, xap::topType, xapError(), xapFree(), xapNew(), and xapParseFile().

00148           :
00149  *     xapParseAny("file.xml", "das", dasStartHandler, dasEndHandler, &type, &obj); */
00150 {
00151 struct xap *xap = xapNew(startHandler, endHandler, fileName);
00152 void **pObj = retObj;
00153 xapParseFile(xap, fileName);
00154 if (type != NULL && !sameString(xap->topType, type))
00155     xapError(xap, "Got %s, expected %s\n", xap->topType, type);
00156 if (retType != NULL)
00157     *retType = cloneString(xap->topType);
00158 *pObj = xap->topObject;
00159 xapFree(&xap);
00160 }

Here is the call graph for this function:

void xapParseFile ( struct xap xap,
char *  fileName 
)

Definition at line 118 of file xap.c.

References carefulClose(), xap::f, mustOpen(), xap::xp, and xpParse().

Referenced by xapParseAny().

00120 {
00121 xap->f = mustOpen(fileName, "r");
00122 xpParse(xap->xp);
00123 carefulClose(&xap->f);
00124 }

Here is the call graph for this function:

Here is the caller graph for this function:

void xapSkip ( struct xap xap  ) 

Definition at line 136 of file xap.c.

References xap::skipDepth, and xap::stackDepth.

00138 {
00139 xap->skipDepth = xap->stackDepth;
00140 }


Generated on Tue Dec 25 19:20:24 2007 for blat by  doxygen 1.5.2