// The MIT License (MIT) // // Copyright (C) 2026 Scott Duensing // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. // basBuild.h -- shared "emit .app resource set" step // // Both the DVX BASIC IDE (ideMain.c) and the standalone command-line // compiler (bascomp.c) need to attach the same group of resources to // an output .app file after writing the stub DXE. This header exposes // a single function that takes the metadata, bytecode, debug info and // form texts and appends all resources in the canonical order. // // Callers are still responsible for: // - writing the stub to outPath before calling us // - copying the .hlp file next to outPath (if any) // - freeing any buffers they passed in via BasBuildSpecT // // Resource names use BAS_RES_* from basRes.h so both callers stay in // sync automatically. #ifndef BAS_BUILD_H #define BAS_BUILD_H #include #ifdef __cplusplus extern "C" { #endif typedef struct { // Basic metadata (any NULL/empty is skipped). const char *projName; const char *author; const char *publisher; const char *version; const char *copyright; const char *description; const char *helpFile; // just the filename, not a path // Icon: either a file to load and embed, OR pre-loaded bytes. // If iconPath is set (non-NULL and non-empty) it is read from disk. // Otherwise iconData / iconSize are used (may themselves be NULL/0). const char *iconPath; const void *iconData; int32_t iconSize; // Bytecode module and optional debug info. const void *moduleData; int32_t moduleLen; const void *debugData; // may be NULL int32_t debugLen; // Forms: parallel arrays of formCount entries, each a text blob. // formData[i] points at formLens[i] bytes of (already stripped / // possibly obfuscated) form source to embed as resource FORMi. int32_t formCount; const uint8_t *const *formData; const int32_t *formLens; } BasBuildSpecT; // Append the full resource set to outPath. Returns 0 on success, non-zero // on failure. The stub must already have been written to outPath. int32_t basBuildEmitResources(const char *outPath, const BasBuildSpecT *spec); #ifdef __cplusplus } #endif #endif // BAS_BUILD_H