72327e4e2d294b9d2fcb6cbdadd4e628c006345b
braney
  Fri Sep 18 10:07:40 2026 -0700
bigChain: move the chain to bigChain conversion into the library

chainRecToBigChain() and chainBlockToBigLink() sat in chainToBigChain.c
next to its main(), so a CGI could not link against them.  Move both into
hg/lib/bigChain.c, add chainToBigChainOne() for one chain and
chainToBigChainList() for a list, and leave the utility as a thin main().
No behavior change; the chainToBigChain test output is unchanged.

refs #38382

diff --git src/hg/inc/bigChain.h src/hg/inc/bigChain.h
index 53d081507ed..84a03ebe437 100644
--- src/hg/inc/bigChain.h
+++ src/hg/inc/bigChain.h
@@ -65,17 +65,35 @@
 #define bigChainTabOut(el,f) bigChainOutput(el,f,'\t','\n');
 /* Print out bigChain as a line in a tab-separated file. */
 
 #define bigChainCommaOut(el,f) bigChainOutput(el,f,',',',');
 /* Print out bigChain as a comma separated list including final comma. */
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */
 
 int bigChainCmpTarget(const void *va, const void *vb);
 /* Compare to sort based on target position. */
 
 char *bigChainGetLinkFile(char *chainBigBedName);
 /* Construct the file name of the chain link file from the name of a chain file. 
  * That is, change file.bb to file.link.bb */
 
+struct chain;
+struct cBlock;
+struct bigLink;
+
+struct bigChain *chainRecToBigChain(struct chain *chain);
+/* make a bigChain from a chain */
+
+struct bigLink *chainBlockToBigLink(struct chain *chain, struct cBlock *cblk);
+/* make a chain link from a chain block */
+
+void chainToBigChainOne(struct chain *chain, struct bigChain **bigChains, struct bigLink **bigLinks);
+/* convert one chain to a bigChain and a bigLink per block, adding them to the
+ * heads of the given lists */
+
+void chainToBigChainList(struct chain *chains, struct bigChain **bigChains, struct bigLink **bigLinks);
+/* convert a list of chains to bigChains and bigLinks, sorted by target position.
+ * The new records are added to whatever is already on the given lists */
+
 #endif /* BIGCHAIN_H */