inc/dtdParse.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  dtdElement
struct  dtdElChild
struct  dtdAttribute

Functions

void dtdParse (char *fileName, char *prefix, char *textField, struct dtdElement **retList, struct hash **retHash)
void dtdElementDump (struct dtdElement *el, FILE *f)


Function Documentation

void dtdElementDump ( struct dtdElement el,
FILE *  f 
)

Definition at line 439 of file dtdParse.c.

References dtdElement::attributes, dtdElement::children, dtdElChild::copyCode, dtdElChild::isOr, dtdElement::mixedCaseName, dtdElement::name, dtdElChild::name, dtdAttribute::name, dtdElChild::next, dtdAttribute::next, dtdAttribute::required, dtdElement::textType, dtdAttribute::type, and dtdAttribute::usual.

00441 {
00442 struct dtdElChild *ec;
00443 struct dtdAttribute *att;
00444 fprintf(f, "%s %s (", el->name, el->mixedCaseName);
00445 for (ec = el->children; ec != NULL; ec = ec->next)
00446     {
00447     fprintf(f, "%s", ec->name);
00448     if (ec->copyCode != '1')
00449         fprintf(f, "%c", ec->copyCode);
00450     if (ec->isOr)
00451         fprintf(f, " (isOr)");
00452     if (ec->next != NULL)
00453         fprintf(f, ", ");
00454     }
00455 fprintf(f, ")");
00456 if (el->textType != NULL)
00457     fprintf(f, " (%s)", el->textType);
00458 fprintf(f, "\n");
00459 for (att = el->attributes; att != NULL; att = att->next)
00460     {
00461     fprintf(f, "  %s %s %s %s\n",
00462         att->name, att->type, (att->usual ? att->usual : "n/a"),  
00463         (att->required ? "required" : "optional"));
00464     }
00465 }

void dtdParse ( char *  fileName,
char *  prefix,
char *  textField,
struct dtdElement **  retList,
struct hash **  retHash 
)

Definition at line 371 of file dtdParse.c.

References dtdxTag(), dyStringFree, dyStringNew, eatComment(), errAbort(), fixupChildRefs(), freeHashAndVals(), initialEntityHash(), lineFileClose(), lineFileOpen(), needNextWord(), newHash(), parseAttribute(), parseElement(), parseEntity(), sameWord, slAddHead, slReverse(), startsWith(), syntaxError(), trimSpaces(), and TRUE.

00383 {
00384 struct hash *elHash = newHash(8);
00385 struct hash *entityHash = initialEntityHash();
00386 struct hash *predefEntityHash = initialEntityHash();
00387 struct dtdElement *elList = NULL, *el;
00388 struct lineFile *lf = lineFileOpen(fileName, TRUE);
00389 char *line, *word;
00390 struct dyString *buf = dyStringNew(0);
00391 
00392 if (prefix == NULL)
00393     prefix = "";
00394 if (textField == NULL)
00395     textField = "text";
00396 while ((line = dtdxTag(lf, entityHash, buf)) != NULL)
00397     {
00398     line = trimSpaces(line);
00399     if (line == NULL || line[0] == 0 || line[0] == '#')
00400         continue;
00401     if (startsWith("<!--", line))
00402         {
00403         line = eatComment(lf, line);
00404         if (line == NULL)
00405             continue;
00406         }
00407     if (!startsWith("<!", line))
00408         syntaxError(lf);
00409     line += 2;
00410     word = needNextWord(&line, lf);
00411     if (sameWord("ELEMENT", word))
00412         {
00413         el = parseElement(prefix, textField, line, elHash, lf);
00414         slAddHead(&elList, el);
00415         }
00416     else if (sameWord("ATTLIST", word))
00417         {
00418         parseAttribute(line, textField, elHash, lf);
00419         }
00420     else if (sameWord("ENTITY", word))
00421         {
00422         parseEntity(entityHash, predefEntityHash, line, lf);
00423         }
00424     else
00425         {
00426         errAbort("Don't understand %s line %d of %s", word, lf->lineIx, lf->fileName);
00427         }
00428     }
00429 lineFileClose(&lf);
00430 dyStringFree(&buf);
00431 slReverse(&elList);
00432 fixupChildRefs(elList, elHash, fileName);
00433 freeHashAndVals(&entityHash);
00434 freeHashAndVals(&predefEntityHash);
00435 *retHash = elHash;
00436 *retList = elList;
00437 }

Here is the call graph for this function:


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