#ifndef ANSI_H #define ANSI_H #include "sm.h" #include "ansi_codes.h" #include "ansi_table.h" struct ansi_context; typedef void (*put_handler)(void *user_ctx, unsigned char ch); typedef void (*osc_handler)(void *user_ctx, unsigned char ch); struct function_id { unsigned char i_count_priv; unsigned char intermediates[2]; unsigned char final; }; struct str_hook { put_handler handler_fn; void *user_ctx; }; struct osc_hook { osc_handler handler_fn; void *user_ctx; }; typedef void (*graphic_char)(unsigned char ch); typedef void (*control_char)(unsigned char ch); typedef void (*esc_sequence)(struct function_id esc_id); typedef void (*control_seq)(struct function_id csi_id, int paramc, unsigned int *paramv); typedef void (*str_hook)(struct str_hook *hook, struct function_id str_id, int paramc, unsigned int *paramv); typedef void (*osc_hook)(struct osc_hook *hook); struct ansi_actions { graphic_char graphic_cb; control_char control_cb; esc_sequence esc_cb; control_seq csi_cb; str_hook str_cb; osc_hook osc_cb; }; struct ansi_context *new_ansi_context(struct ansi_actions *actions); void ansi_context_put(struct ansi_context *ctx, unsigned char code); #endif