0fabc7d965abdc0b7901fe08dcdf873a305433ba
angie
  Thu May 21 11:06:54 2015 -0700
hgIntegrator: omit bam and maf (wigMaf) tracks from the group/track/table menus
because the underlying anno* libs don't support those types yet.
refs #14579 note 52

diff --git src/lib/jsonWrite.c src/lib/jsonWrite.c
index 458ba96..9669899 100644
--- src/lib/jsonWrite.c
+++ src/lib/jsonWrite.c
@@ -205,15 +205,33 @@
     jsonWriteString(jw, "label", (char *)(pair->val));
     jsonWriteObjectEnd(jw);
     }
 jsonWriteListEnd(jw);
 }
 
 void jsonWriteSlNameList(struct jsonWrite *jw, char *var, struct slName *slnList)
 /* Print out a named list of strings from slnList. */
 {
 jsonWriteListStart(jw, var);
 struct slName *sln;
 for (sln = slnList;  sln != NULL;  sln = sln->next)
     jsonWriteString(jw, NULL, sln->name);
 jsonWriteListEnd(jw);
 }
+
+void jsonWriteAppend(struct jsonWrite *jwA, char *var, struct jsonWrite *jwB)
+/* Append jwB's contents to jwA's.  If jwB is non-NULL, it must be fully closed (no unclosed
+ * list or object).  If var is non-NULL, write it out as a tag before appending.
+ * If both var and jwB are NULL, leave jwA unchanged. */
+{
+if (jwB && jwB->stackIx)
+    errAbort("jsonWriteAppend: second argument must be fully closed but its stackIx is %d not 0",
+             jwB->stackIx);
+if (var)
+    jsonWriteTag(jwA, var);
+else
+    jsonWriteMaybeComma(jwA);
+if (jwB)
+    dyStringAppendN(jwA->dy, jwB->dy->string, jwB->dy->stringSize);
+else if (var)
+    dyStringAppend(jwA->dy, "null");
+}