8edba16387f9185fea5edb8a05ced28d32ce6a34 kent Fri Aug 9 09:59:33 2019 -0700 Adding file name and line number to strexParseString. The line number isn't accurate yet, is at bottom of stanza. diff --git src/tabFile/tabToTabDir/tabToTabDir.c src/tabFile/tabToTabDir/tabToTabDir.c index d7bebd8..6a5ed0d 100644 --- src/tabFile/tabToTabDir/tabToTabDir.c +++ src/tabFile/tabToTabDir/tabToTabDir.c @@ -107,31 +107,31 @@ boolean isTotallySimple(char *s) /* We are only alphanumerical and dotty things, we even begin with a alnum or _*/ { char c = *s++; if (!isalpha(c) && (c != '_')) return FALSE; while ((c = *s++) != 0) { if (!(isalnum(c) || (c == '_') || (c == '.'))) return FALSE; } return TRUE; } -struct newFieldInfo *parseFieldVal(char *name, char *input) +struct newFieldInfo *parseFieldVal(char *name, char *input, char *fileName, int fileLineNumber) /* return a newFieldInfo based on the contents of input, which are not destroyed */ { /* Make up return structure. */ struct newFieldInfo *fv; AllocVar(fv); fv->name = cloneString(name); char *s = skipLeadingSpaces(input); if (isEmpty(s)) { fv->type = fvVar; fv->val = cloneString(name); } else @@ -144,31 +144,31 @@ if (isEmpty(val)) errAbort("Nothing following %c", c); fv->type = fvLink; } else { if (isTotallySimple(s)) { fv->val = cloneString(skipLeadingSpaces(s)); eraseTrailingSpaces(fv->val); fv->type = fvVar; } else { fv->val = cloneString(s); - fv->exp = strexParseString(fv->val); + fv->exp = strexParseString(fv->val, fileName, fileLineNumber); fv->type = fvExp; } } } return fv; } struct symRec /* Something we pass as a record to symLookup */ { struct hash *hash; /* The hash with symbol to row index */ char **row; /* The row we are working on */ }; static char *symLookup(void *record, char *key) @@ -276,31 +276,31 @@ if (isEmpty(keyFieldName)) errAbort("No key field for table %s.", tableName); /* Have dealt with first line of stanza, which is about table, rest of lines are fields */ struct slPair *fieldList = specStanza->next; int fieldCount = slCount(fieldList); /* Create empty output table and track which fields of input go to output. */ char *fieldNames[fieldCount]; int i; struct slPair *field; struct newFieldInfo *fvList = NULL; for (i=0, field=fieldList; i<fieldCount; ++i, field=field->next) { char *newName = field->name; - struct newFieldInfo *fv = parseFieldVal(newName, field->val); + struct newFieldInfo *fv = parseFieldVal(newName, field->val, lf->fileName, lf->lineIx); fv->newIx = i; if (fv->type == fvVar) fv->oldIx = fieldedTableMustFindFieldIx(inTable, fv->val); fieldNames[i] = newName; slAddHead(&fvList, fv); } slReverse(&fvList); struct fieldedTable *outTable = fieldedTableNew(tableName, fieldNames, fieldCount); outTable->startsSharp = inTable->startsSharp; /* Make sure that key field is actually in field list */ struct newFieldInfo *keyField = findField(fvList, keyFieldName); if (keyField == NULL) errAbort("key field %s is not found in field list for %s\n", tableName, keyFieldName);