remove vt prefixes

This commit is contained in:
Mitchell Hashimoto
2025-09-24 12:36:45 -07:00
parent 96e9053862
commit 37e238c2f6
4 changed files with 20 additions and 20 deletions

View File

@@ -3,9 +3,9 @@
int main() {
GhosttyOscParser parser;
if (ghostty_vt_osc_new(NULL, &parser) != GHOSTTY_VT_SUCCESS) {
if (ghostty_osc_new(NULL, &parser) != GHOSTTY_SUCCESS) {
return 1;
}
ghostty_vt_osc_free(parser);
ghostty_osc_free(parser);
return 0;
}

View File

@@ -37,10 +37,10 @@ typedef struct GhosttyOscParser *GhosttyOscParser;
*/
typedef enum {
/** Operation completed successfully */
GHOSTTY_VT_SUCCESS = 0,
GHOSTTY_SUCCESS = 0,
/** Operation failed due to failed allocation */
GHOSTTY_VT_OUT_OF_MEMORY = -1,
} GhosttyVtResult;
GHOSTTY_OUT_OF_MEMORY = -1,
} GhosttyResult;
//-------------------------------------------------------------------
// Allocator Interface
@@ -131,7 +131,7 @@ typedef struct {
* @param ret_addr First return address of the allocation call stack (0 if not provided)
*/
void (*free)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, uintptr_t ret_addr);
} GhosttyVtAllocatorVtable;
} GhosttyAllocatorVtable;
/**
* Custom memory allocator.
@@ -143,7 +143,7 @@ typedef struct {
*
* Usage example:
* @code
* GhosttyVtAllocator allocator = {
* GhosttyAllocator allocator = {
* .vtable = &my_allocator_vtable,
* .ctx = my_allocator_state
* };
@@ -161,8 +161,8 @@ typedef struct {
* Pointer to the allocator's vtable containing function pointers
* for memory operations (alloc, resize, remap, free).
*/
const GhosttyVtAllocatorVtable *vtable;
} GhosttyVtAllocator;
const GhosttyAllocatorVtable *vtable;
} GhosttyAllocator;
//-------------------------------------------------------------------
// Functions
@@ -178,7 +178,7 @@ typedef struct {
* @param parser Pointer to store the created parser handle
* @return GHOSTTY_VT_SUCCESS on success, or an error code on failure
*/
GhosttyVtResult ghostty_vt_osc_new(const GhosttyVtAllocator *allocator, GhosttyOscParser *parser);
GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParser *parser);
/**
* Free an OSC parser instance.
@@ -188,7 +188,7 @@ GhosttyVtResult ghostty_vt_osc_new(const GhosttyVtAllocator *allocator, GhosttyO
*
* @param parser The parser handle to free (may be NULL)
*/
void ghostty_vt_osc_free(GhosttyOscParser parser);
void ghostty_osc_free(GhosttyOscParser parser);
#ifdef __cplusplus
}

View File

@@ -70,8 +70,8 @@ comptime {
// we want to reference the C API so that it gets exported.
if (terminal.is_c_lib) {
const c = terminal.c_api;
@export(&c.ghostty_vt_osc_new, .{ .name = "ghostty_vt_osc_new" });
@export(&c.ghostty_vt_osc_free, .{ .name = "ghostty_vt_osc_free" });
@export(&c.osc_new, .{ .name = "ghostty_osc_new" });
@export(&c.osc_free, .{ .name = "ghostty_osc_free" });
}
}

View File

@@ -6,7 +6,7 @@ const CAllocator = lib_alloc.Allocator;
const osc = @import("osc.zig");
/// C: GhosttyOscParser
pub const GhosttyOscParser = *osc.Parser;
pub const OscParser = *osc.Parser;
/// C: GhosttyResult
pub const Result = enum(c_int) {
@@ -14,9 +14,9 @@ pub const Result = enum(c_int) {
out_of_memory = -1,
};
pub fn ghostty_vt_osc_new(
pub fn osc_new(
alloc_: ?*const CAllocator,
result: *GhosttyOscParser,
result: *OscParser,
) callconv(.c) Result {
const alloc = lib_alloc.default(alloc_);
const ptr = alloc.create(osc.Parser) catch
@@ -26,7 +26,7 @@ pub fn ghostty_vt_osc_new(
return .success;
}
pub fn ghostty_vt_osc_free(parser: GhosttyOscParser) callconv(.c) void {
pub fn osc_free(parser: OscParser) callconv(.c) void {
// C-built parsers always have an associated allocator.
const alloc = parser.alloc.?;
parser.deinit();
@@ -39,10 +39,10 @@ test {
test "osc" {
const testing = std.testing;
var p: GhosttyOscParser = undefined;
try testing.expectEqual(Result.success, ghostty_vt_osc_new(
var p: OscParser = undefined;
try testing.expectEqual(Result.success, osc_new(
&lib_alloc.test_allocator,
&p,
));
ghostty_vt_osc_free(p);
osc_free(p);
}