09e2ab568b321f2c20ad4e8d1f377de8eaf3c3e1 kent Mon Oct 29 17:40:29 2012 -0700 Fixing several cases where the attributes name was used where it's mixedCaseName should have been. This fixes a glitch that came up reading NCBI incident database stuff that Hiram is working on. diff --git src/hg/autoXml/autoXml.c src/hg/autoXml/autoXml.c index cf05e8b..5123f23 100644 --- src/hg/autoXml/autoXml.c +++ src/hg/autoXml/autoXml.c @@ -170,65 +170,65 @@ { fprintf(f, "%sif (sameString(name, \"%s\"))\n", (el == elList ? "" : "else "), el->name); fprintf(f, " {\n"); fprintf(f, " struct %s *obj;\n", el->mixedCaseName); fprintf(f, " AllocVar(obj);\n"); if (el->attributes != NULL) { boolean first = TRUE; for (att = el->attributes; att != NULL; att = att->next) { if (att->usual != NULL) { char *quote = "\""; if (sameString(att->type, "INT") || sameString(att->type, "FLOAT")) quote = ""; - fprintf(f, " obj->%s = %s%s%s;\n", att->name, quote, att->usual, quote); + fprintf(f, " obj->%s = %s%s%s;\n", att->mixedCaseName, quote, att->usual, quote); } } fprintf(f, " for (i=0; atts[i] != NULL; i += 2)\n"); fprintf(f, " {\n"); fprintf(f, " char *name = atts[i], *val = atts[i+1];\n"); for (att = el->attributes; att != NULL; att = att->next) { fprintf(f, " %s (sameString(name, \"%s\"))\n", (first ? "if " : "else if"), att->name); if (sameWord(att->type, "INT")) - fprintf(f, " obj->%s = atoi(val);\n", att->name); + fprintf(f, " obj->%s = atoi(val);\n", att->mixedCaseName); else if (sameWord(att->type, "FLOAT")) - fprintf(f, " obj->%s = atof(val);\n", att->name); + fprintf(f, " obj->%s = atof(val);\n", att->mixedCaseName); else - fprintf(f, " obj->%s = cloneString(val);\n", att->name); + fprintf(f, " obj->%s = cloneString(val);\n", att->mixedCaseName); first = FALSE; } if (picky) { fprintf(f, " else\n"); fprintf(f, " xapError(xp, \"Unknown attribute %%s\", name);\n"); } fprintf(f, " }\n"); for (att = el->attributes; att != NULL; att = att->next) { if (att->required) { if (sameWord(att->type, "INT") || sameWord(att->type, "FLOAT")) { /* For the moment can't check these. */ } else { - fprintf(f, " if (obj->%s == NULL)\n", att->name); + fprintf(f, " if (obj->%s == NULL)\n", att->mixedCaseName); fprintf(f, " xapError(xp, \"missing %s\");\n", att->name); } } } } if (anyParent(elList, el)) { struct dtdElement *parent; boolean first = TRUE; fprintf(f, " if (depth > 1)\n"); fprintf(f, " {\n"); for (parent = elList; parent != NULL; parent = parent->next) { if (childMatch(parent->children, el)) { @@ -374,31 +374,31 @@ { fprintf(f, "struct %s\n", el->mixedCaseName); fprintf(f, " {\n"); fprintf(f, " struct %s *next;\n", el->mixedCaseName); if (el->textType != NULL) { if (sameString(el->textType, "#INT")) fprintf(f, " int %s;\n", textField); else if (sameString(el->textType, "#FLOAT")) fprintf(f, " float %s;\n", textField); else fprintf(f, " char *%s;\n", textField); } for (att = el->attributes; att != NULL; att = att->next) { - fprintf(f, " %s%s;", cAttType(att->type), att->name); + fprintf(f, " %s%s;", cAttType(att->type), att->mixedCaseName); if (att->required) fprintf(f, "\t/* Required */"); else { if (att->usual != NULL) fprintf(f, "\t/* Defaults to %s */", att->usual); else fprintf(f, "\t/* Optional */"); } fprintf(f, "\n"); } for (ec = el->children; ec != NULL; ec = ec->next) { fprintf(f, " struct %s *%s;", ec->el->mixedCaseName, ec->el->mixedCaseName); if (ec->copyCode == '1') @@ -475,45 +475,45 @@ fprintf(f, "if (obj == NULL) return;\n"); fprintf(f, "xapIndent(indent, f);\n"); if (el->attributes == NULL) { if (isAtom) fprintf(f, "fprintf(f, \" ->\\n\");\n"); else fprintf(f, "fprintf(f, \"<%s>\");\n", el->name); } else { fprintf(f, "fprintf(f, \"<%s\");\n", el->name); for (att = el->attributes; att != NULL; att = att->next) { if (att->required ) - fprintf(f, "fprintf(f, \" %s=\\\"%%%c\\\"\", obj->%s);\n", att->name, fAttType(att->type), att->name); + fprintf(f, "fprintf(f, \" %s=\\\"%%%c\\\"\", obj->%s);\n", att->name, fAttType(att->type), att->mixedCaseName); else { if (sameString(att->type, "INT") || sameString(att->type, "FLOAT")) { if (positiveOnly) { - fprintf(f, "if (obj->%s >= 0)\n ", att->name); + fprintf(f, "if (obj->%s >= 0)\n ", att->mixedCaseName); } - fprintf(f, "fprintf(f, \" %s=\\\"%%%c\\\"\", obj->%s);\n", att->name, fAttType(att->type), att->name); + fprintf(f, "fprintf(f, \" %s=\\\"%%%c\\\"\", obj->%s);\n", att->name, fAttType(att->type), att->mixedCaseName); } else { - fprintf(f, "if (obj->%s != NULL)\n", att->name); - fprintf(f, " fprintf(f, \" %s=\\\"%%%c\\\"\", obj->%s);\n", att->name, fAttType(att->type), att->name); + fprintf(f, "if (obj->%s != NULL)\n", att->mixedCaseName); + fprintf(f, " fprintf(f, \" %s=\\\"%%%c\\\"\", obj->%s);\n", att->name, fAttType(att->type), att->mixedCaseName); } } } if (isAtom) fprintf(f, "fprintf(f, \"/>\\n\");\n"); else fprintf(f, "fprintf(f, \">\");\n"); } if (el->textType != NULL) { if (sameString(el->textType, "#INT")) fprintf(f, "fprintf(f, \"%%d\", obj->%s);\n", textField); else if (sameString(el->textType, "#FLOAT")) fprintf(f, "fprintf(f, \"%%f\", obj->%s);\n", textField); else @@ -583,31 +583,31 @@ void freeFunctionBody(struct dtdElement *el, FILE *f) /* Write out free function body. */ { struct dtdElChild *ec; struct dtdAttribute *att; fprintf(f, "{\n"); fprintf(f, "struct %s *obj = *pObj;\n", el->mixedCaseName); /* Declare variables to walk through list if need be. */ fprintf(f, "if (obj == NULL) return;\n"); for (att = el->attributes; att != NULL; att = att->next) { if (!sameString(att->type, "INT") && !sameString(att->type, "FLOAT")) - fprintf(f, "freeMem(obj->%s);\n", att->name); + fprintf(f, "freeMem(obj->%s);\n", att->mixedCaseName); } if (el->textType != NULL) { if (!sameString(el->textType, "#INT") && !sameString(el->textType, "#FLOAT")) fprintf(f, "freeMem(obj->text);\n"); } for (ec = el->children; ec != NULL; ec = ec->next) { char *name = ec->el->mixedCaseName; if (ec->copyCode == '*' || ec->copyCode == '+') fprintf(f, "%sFreeList(&obj->%s);\n", name, name); else fprintf(f, "%sFree(&obj->%s);\n", name, name); }