DVX_GUI/tools/hlpcCompile.h

38 lines
1.6 KiB
C

// hlpcCompile.h -- DVX Help Compiler library interface
//
// Allows the help compiler to be called as a function (from the
// loader for startup recompilation) or as a standalone executable.
// The progress callback enables real-time progress bar updates.
#ifndef HLPC_COMPILE_H
#define HLPC_COMPILE_H
#include <stdint.h>
// Progress callback: called after each input file in pass 1 and
// after each of passes 2-5. total is set on the first call and
// stays constant. current increments from 0 to total.
typedef void (*HlpcProgressFnT)(void *ctx, int32_t current, int32_t total);
// Compile help source files into a binary .hlp file.
//
// inputFiles: array of .dhs source file paths
// inputCount: number of input files
// outputPath: path to write the .hlp file
// imageDir: directory to search for .image references (NULL = ".")
// htmlPath: if non-NULL, also emit HTML to this path
// quiet: suppress informational output
// progressFn: progress callback (NULL = no progress reporting)
// progressCtx: opaque context passed to progressFn
//
// Returns 0 on success, non-zero on error.
int32_t hlpcCompile(const char **inputFiles, int32_t inputCount, const char *outputPath, const char *imageDir, const char *htmlPath, int32_t quiet, HlpcProgressFnT progressFn, void *progressCtx);
// Return the number of progress steps for a given input count.
// This is inputCount (one per file in pass 1) + 4 (passes 2-5).
// Useful for pre-computing the total across multiple compilations.
static inline int32_t hlpcProgressTotal(int32_t inputCount) {
return inputCount + 4;
}
#endif // HLPC_COMPILE_H