// formcfm.h -- Compiled form format
//
// Binary serialization of .frm layout data for standalone apps.
// Widget types and layout stored as strings for stability across
// widget set changes. No BASIC source code is included.

#ifndef DVXBASIC_FORMCFM_H
#define DVXBASIC_FORMCFM_H

#include "formrt.h"

#include <stdint.h>

// Serialize a .frm source string to compiled form binary.
// Returns a malloc'd buffer (caller frees) and sets *outLen.
uint8_t *basFormCompile(const char *frmSource, int32_t frmLen, int32_t *outLen);

// Load a compiled form binary into the form runtime.
// Creates the form window and all controls.
BasFormT *basFormLoadCompiled(BasFormRtT *rt, const uint8_t *data, int32_t dataLen);

// Extract the form name from a compiled form binary without loading it.
// Writes to nameBuf (up to bufSize-1 chars). Returns true on success.
bool basFormGetCompiledName(const uint8_t *data, int32_t dataLen, char *nameBuf, int32_t bufSize);

#endif // DVXBASIC_FORMCFM_H
