57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
|
#ifndef ANSI_TABLE_H
|
||
|
#define ANSI_TABLE_H
|
||
|
|
||
|
#define ANSI_ITEM_COUNT 16
|
||
|
#define ANSI_C_COLUMNS 2
|
||
|
#define ANSI_G_COLUMNS 6
|
||
|
#define ANSI_CSI_FINAL_COLUMNS 4
|
||
|
#define ANSI_INTERMEDIATES 1
|
||
|
|
||
|
typedef struct ansi_table Table;
|
||
|
typedef struct control_seq_table CsTable;
|
||
|
typedef struct table_entry Entry;
|
||
|
|
||
|
enum entry_kind {
|
||
|
ENTRY_GRAPHIC,
|
||
|
ENTRY_CONTROL,
|
||
|
ENTRY_CS
|
||
|
};
|
||
|
|
||
|
struct table_entry {
|
||
|
const char *name;
|
||
|
const enum entry_kind kind;
|
||
|
};
|
||
|
|
||
|
struct table_col {
|
||
|
struct table_entry *rows[ANSI_ITEM_COUNT];
|
||
|
};
|
||
|
|
||
|
struct control_table {
|
||
|
struct table_col *cols[ANSI_C_COLUMNS];
|
||
|
};
|
||
|
|
||
|
struct graphic_table {
|
||
|
struct table_col *cols[ANSI_G_COLUMNS];
|
||
|
};
|
||
|
|
||
|
struct control_seq_final_table {
|
||
|
struct table_col *cols[ANSI_CSI_FINAL_COLUMNS];
|
||
|
};
|
||
|
|
||
|
struct ansi_table {
|
||
|
struct control_table *c0;
|
||
|
struct graphic_table *gl;
|
||
|
struct control_table *c1;
|
||
|
struct graphic_table *gr;
|
||
|
};
|
||
|
|
||
|
struct control_seq_table {
|
||
|
struct control_seq_final_table *no_i;
|
||
|
struct control_seq_final_table *with_i[ANSI_ITEM_COUNT];
|
||
|
};
|
||
|
|
||
|
Entry* ansi_table_lookup(Table *t, unsigned char code);
|
||
|
Entry* csi_table_lookup(CsTable *t, int ic, unsigned char *iv, unsigned char f);
|
||
|
|
||
|
#endif
|