std/plugin.zc
Rama main · réplica de lectura del repositorio original.
import "./core.zc"
include <stdio.h>
def ZEN_PLUGIN_API_VERSION = 2;
def ZEN_PLUGIN_MAX_NAME = 256;
struct ZConfig {
is_debug: int,
verbose: int,
target: char*,
cc: char*
}
struct ZApi {
api_version: u32,
filename: char*,
current_line: int,
out: void*,
hoist_out: void*,
error: fn*(ZApi*, char*, ...),
warn: fn*(ZApi*, char*, ...),
note: fn*(ZApi*, char*, ...),
config: ZConfig,
user_data: void*
}
struct ZPlugin {
name: char[ZEN_PLUGIN_MAX_NAME],
handler: fn*(char*, ZApi*),
hover_handler: fn*(char*, int, int) -> char*
}
// Helper: Provide a more native Zen C experience for diagnostics
impl ZApi {
@unused fn report_error(self, msg: char*) {
self.error(self, "%s", msg);
}
@unused fn report_warn(self, msg: char*) {
self.warn(self, "%s", msg);
}
@unused fn report_note(self, msg: char*) {
self.note(self, "%s", msg);
}
}