beaver-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Beaver-devel] SyHi Plugin API


From: Leslie Polzer
Subject: [Beaver-devel] SyHi Plugin API
Date: Thu, 27 Mar 2003 07:48:04 +0100

Hello Michael, hello list,

I guess it would be nice if we'd develop the syhi-engines as plugins
that can be dl()'d / shl_load()'d at runtime.
In this thread we can work on the API.
Run-time linking should not add another dependency, I think Gdk
does that, too.

A first draft:

int init(void (*colorize)(int, int))
or
int init(void (*colorize)(int, int, type_t), void(*progress)(float))
        Called at program start. Used to allocate memory, compile patterns
        or whatever. Colorize and progress are callbacks provided by Beaver.
        Colorize takes the start and end char offset and colors it according
        to an enum type_t (think TYPE_KEYWORD, TYPE_LINECOMMENT...).
        Progress takes a float between 0 and 1 and is called at regular
        intervals by the syhi engine later.
        Returns: -1 on error, 0 on success.

int process(GtkTextBuffer* buf, int start, int end)
        The engine itself, should be self-explanatory.
        Returns: -1 on error, otherwise (maybe) number of colorized chars.

void cleanup()
        init() backwards.

plugin_info_t get_plugin_info()
        Returns a struct with various plugin info, like author,
        approx. speed (maybe find a unit for this to be
        system-independent), ...

Maybe we can also use GtkTextIters instead of ints, this might result
in faster processing.


Leslie




reply via email to

[Prev in Thread] Current Thread [Next in Thread]