Files
scriptc/packages/compiler/native/ts7-process.h
Chris Tate 806b96d32b feat(compiler): own the TypeScript server from native clients
- Launch and manage TypeScript server processes through a portable native FFI boundary.
- Share the production session API between Node and statically compiled clients.
- Preserve Unicode command-line arguments and release server resources on every exit path.
2026-09-28 09:54:18 -05:00

26 lines
1.1 KiB
C

#ifndef SCRIPTC_TS7_PROCESS_H
#define SCRIPTC_TS7_PROCESS_H
#include <stddef.h>
#include <stdint.h>
/* A compiler host boundary, called synchronously on the compiler thread.
* Handles are monotonically assigned IDs, never pointer-shaped numbers.
* Zero is an invalid handle. Failed transfers return -1; EOF returns 0.
* The last error is copied before another host operation can overwrite it.
* All spans are borrowed for the duration of the call only. */
uint32_t scriptc_ts7_open(const uint8_t *executable, size_t executable_size,
const uint8_t *cwd, size_t cwd_size,
const uint8_t *callbacks, size_t callbacks_size,
uint8_t timing);
int32_t scriptc_ts7_read(uint32_t handle, uint8_t *bytes, size_t size,
uint32_t offset, uint32_t length);
int32_t scriptc_ts7_write(uint32_t handle, const uint8_t *bytes, size_t size,
uint32_t offset, uint32_t length);
uint32_t scriptc_ts7_pid(uint32_t handle);
void scriptc_ts7_close(uint32_t handle);
void scriptc_ts7_close_all(void);
int32_t scriptc_ts7_error(uint8_t *bytes, size_t size);
#endif