/*
 * re_plugin_highlighter.h
 *
 * A programmers editor
 *
 * re_data plugin to support the syntax highlighter.
 *
 * HEADER FILE
 *
 * Author: Dario Rodriguez antartica@whereismybit.com
 * This program is licensed under the terms of GNU GPL v2.1+
 */

#include "re_data.h"

typedef struct linecolor_t {
        int len;
        int color;
} linecolor_t;

typedef struct line_t {
        long pos;
        int off; /* offset int buf */
        int len; /* size used in buf */
        int endingmode;
} hline_t;

typedef struct hcolor_t {
        char origrgba[5];
        char rgba[5];
} hcolor_t;

typedef struct highlighter_t {
        int sizelines;
        int usedlines;
        hline_t *lines;
        long sizebuf;
        long usedbuf;
        char *buf;
        int sizecolors;
        hcolor_t *colors;
        int flag_doneall;
        int sizekeywordbuf;
        int usedkeywordbuf;
        char *keywordbuf;
        int keywordbufstart;
        int sizedirectivebuf;
        int useddirectivebuf;
        char *directivebuf;
        int directivebufstart;
} highlighter_t;

int redata_highlighter_register(redata_t *redata, redata_plugin_t *slot);
int redata_highlighter_unregister(redata_t *redata, redata_plugin_t *slot,char *filename);

hcolor_t *redata_highlighter_getcolors(redata_t *redata, int *ncolors);
linecolor_t *redata_highlighter_getline(redata_t *redata, int line, int *nlinecolors);
int redata_highlighter_getcolorindex(redata_t *redata, int line, int nthbyte);
int redata_highlighter_settheme(redata_t *redata, int ntheme, int invert);