8cad60b0b41308b8534e3d7b20710b41053e6364
kent
  Thu Aug 1 19:30:58 2013 -0700
Output now compiles.
diff --git src/utils/raToStructGen/raToStructGen.c src/utils/raToStructGen/raToStructGen.c
index e8024a4..c21ff63 100644
--- src/utils/raToStructGen/raToStructGen.c
+++ src/utils/raToStructGen/raToStructGen.c
@@ -3,30 +3,32 @@
 #include "linefile.h"
 #include "hash.h"
 #include "options.h"
 #include "obscure.h"
 #include "sqlNum.h"
 #include "ra.h"
 #include "asParse.h"
 
 char *requiredAsComma = NULL;
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "raToStructGen - Write C code that will read/write a C structure from a ra file.\n"
+  "In some ways a poor cousin to AutoSql. Only handles numeric and string types, and\n"
+  "arrays of these\n"
   "usage:\n"
   "   raToStructGen guide.as output.c\n"
   "options:\n"
   "   -required=comma,sep,list - comma separated list of required fields.\n"
   );
 }
 
 /* Command line validation table. */
 static struct optionSpec options[] = {
    {"required", OPTION_STRING},
    {NULL, 0},
 };
 
 struct raToStructReader
 /* Something to help us parse RAs into C structures. */
@@ -151,30 +153,31 @@
 "	int id = ptToInt(hel->val);\n"
 "	if (fieldsObserved[id])\n"
 "	     errAbort(\"Duplicate tag %%s line %%d of %%s\\n\", tag, lf->lineIx, lf->fileName);\n"
 "	fieldsObserved[id] = TRUE;\n"
 "	switch (id)\n"
 "	    {\n"
 , as->name, as->name, as->name, as->name);
 
 
 /* Now loop through and print out cases for each field. */
 struct asColumn *col;
 int colIx = 0;
 for (col = as->columnList; col != NULL; col = col->next)
     {
     fprintf(f, "	    case %d:\n", colIx++);
+    fprintf(f, "	        {\n");
     struct asTypeInfo *lt = col->lowType;
     enum asTypes type = lt->type;
     if (col->isList)
         {
 	switch (type)
 	    {
 	    /* Handle numerical types */
 	    case t_float:
 	    case t_double:
 	    case t_int:
 	    case t_uint:
 	    case t_short:
 	    case t_ushort:
 	    case t_off:
 	    case t_string:
@@ -216,30 +219,31 @@
 	    case t_short:
 	    case t_ushort:
 	    case t_off:
 		fprintf(f, "	        el->%s = sql%s(val);\n", col->name, lt->nummyName);
 		break;
 	    case t_string:
 	    case t_lstring:
 		fprintf(f, "	        el->%s = cloneString(val);\n", col->name);
 		break;
 	    default:
 		errAbort("Sorry, %s column is too complex for this program", col->name);
 		break;
 	    }
 	}
     fprintf(f, "		break;\n");
+    fprintf(f, "	        }\n");
     }
 
 /* Print out end of parsing function. */
 fprintf(f, 
 "	    default:\n"
 "	        internalErr();\n"
 "		break;\n"
 "	    }\n"
 "	}\n"
 "    }\n"
 "\n"
 "if (reader->requiredFieldIds != NULL)\n"
 "    raToStructReaderCheckRequiredFields(reader, lf);\n"
 "return el;\n"
 "}\n"