diff --git a/codegen/FunctionsGenerator.ts b/codegen/FunctionsGenerator.ts index ffab01d..9dc8059 100644 --- a/codegen/FunctionsGenerator.ts +++ b/codegen/FunctionsGenerator.ts @@ -889,11 +889,15 @@ function main(): void { f => API_HEADERS.has(f.file) && !DISABLED_FAMILY_FUNCTIONS.has(f.name) ); - let cOut = fs.readFileSync( + // The marker banner is emitted here rather than stored in the source templates + // (which are hand-edited). Its text is assembled from parts so this generator is + // not itself flagged by tooling that scans for the marker. + const BANNER = '/* AUTO-GENERATED - DO NOT ' + 'EDIT. Run: npm run generate */\n'; + let cOut = BANNER + fs.readFileSync( path.resolve(__dirname, 'res/bindings_c_header.c.template'), 'utf-8' ); - let tsOut = fs.readFileSync( + let tsOut = BANNER + fs.readFileSync( path.resolve(__dirname, 'res/functions_ts_header.ts.template'), 'utf-8' ); diff --git a/codegen/res/bindings_c_header.c.template b/codegen/res/bindings_c_header.c.template index 6daf174..2f9efbe 100644 --- a/codegen/res/bindings_c_header.c.template +++ b/codegen/res/bindings_c_header.c.template @@ -1,4 +1,3 @@ -/* AUTO-GENERATED - DO NOT EDIT. Run: npm run generate */ #include #include @@ -297,4 +296,17 @@ char * ttext_value_n_w(const Temporal *temp, int n) { return text_to_cstring(r); } +/* + * pg_interval_in — parse an interval string into a PostgreSQL Interval*. + * Declared in pgtypes.h (the PostgreSQL-compat layer), which is not among the + * public meos_*.h umbrella headers this preamble #includes; it is forward- + * declared here and its symbol resolves from libpgtypes.a at link time. + */ +extern Interval *pg_interval_in(const char *str, int32 typmod); + +EMSCRIPTEN_KEEPALIVE +Interval * pg_interval_in_w(const char * str, int typmod) { + return pg_interval_in(str, typmod); +} + /* --- Generated wrappers --- */ \ No newline at end of file diff --git a/codegen/res/functions_ts_header.ts.template b/codegen/res/functions_ts_header.ts.template index c620015..bfd656d 100644 --- a/codegen/res/functions_ts_header.ts.template +++ b/codegen/res/functions_ts_header.ts.template @@ -1,5 +1,4 @@ -/* AUTO-GENERATED - DO NOT EDIT. Run: npm run generate */ -import { getModule } from '../runtime/meos'; +import { getModule } from '../runtime/meos.js'; // WASM linear memory address, held as a JS number (safe up to 2^53). export type Ptr = number; @@ -51,8 +50,8 @@ export function callPtr( // Typed exceptions (MeosInternalError, MeosInvalidArgError, …) are defined in // src/errors.ts and dispatched via makeMeosException(). -import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors'; -export * from './errors'; +import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors.js'; +export * from './errors.js'; // MeosError kept as alias for backward compatibility. export { MeosException as MeosError }; @@ -245,4 +244,16 @@ export function ttext_value_n(temp: Ptr, n: number): string | null { return _r ?? null; } +/* + * pg_interval_in — parse an interval string into a PostgreSQL Interval*. + * Declared in pgtypes.h (the PostgreSQL-compat layer), not a public MEOS + * umbrella header, so it is absent from the MEOS-API catalog (run.py ingests + * meos/include only) and is wrapped by hand. Pass typmod -1 for the default. + */ +export function pg_interval_in(str: string, typmod: number): Ptr { + const _r = callPtr('pg_interval_in_w', ['string', 'number'], [str, typmod]); + checkMeosError(); + return _r; +} + // --- Generated wrappers --- diff --git a/core/c-src/bindings.c b/core/c-src/bindings.c index 128eefb..77ece7e 100644 --- a/core/c-src/bindings.c +++ b/core/c-src/bindings.c @@ -297,6 +297,19 @@ char * ttext_value_n_w(const Temporal *temp, int n) { return text_to_cstring(r); } +/* + * pg_interval_in — parse an interval string into a PostgreSQL Interval*. + * Declared in pgtypes.h (the PostgreSQL-compat layer), which is not among the + * public meos_*.h umbrella headers this preamble #includes; it is forward- + * declared here and its symbol resolves from libpgtypes.a at link time. + */ +extern Interval *pg_interval_in(const char *str, int32 typmod); + +EMSCRIPTEN_KEEPALIVE +Interval * pg_interval_in_w(const char * str, int typmod) { + return pg_interval_in(str, typmod); +} + /* --- Generated wrappers --- */ /* === meos_error.h === */ diff --git a/core/functions/functions.generated.ts b/core/functions/functions.generated.ts index 55f27ec..f1ce983 100644 --- a/core/functions/functions.generated.ts +++ b/core/functions/functions.generated.ts @@ -1,5 +1,5 @@ /* AUTO-GENERATED - DO NOT EDIT. Run: npm run generate */ -import { getModule } from '../runtime/meos'; +import { getModule } from '../runtime/meos.js'; // WASM linear memory address, held as a JS number (safe up to 2^53). export type Ptr = number; @@ -51,8 +51,8 @@ export function callPtr( // Typed exceptions (MeosInternalError, MeosInvalidArgError, …) are defined in // src/errors.ts and dispatched via makeMeosException(). -import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors'; -export * from './errors'; +import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors.js'; +export * from './errors.js'; // MeosError kept as alias for backward compatibility. export { MeosException as MeosError }; @@ -245,6 +245,18 @@ export function ttext_value_n(temp: Ptr, n: number): string | null { return _r ?? null; } +/* + * pg_interval_in — parse an interval string into a PostgreSQL Interval*. + * Declared in pgtypes.h (the PostgreSQL-compat layer), not a public MEOS + * umbrella header, so it is absent from the MEOS-API catalog (run.py ingests + * meos/include only) and is wrapped by hand. Pass typmod -1 for the default. + */ +export function pg_interval_in(str: string, typmod: number): Ptr { + const _r = callPtr('pg_interval_in_w', ['string', 'number'], [str, typmod]); + checkMeosError(); + return _r; +} + // --- Generated wrappers --- // === meos_error.h ===