diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2021-06-02 19:18:10 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2021-06-02 19:18:10 +0200 |
commit | ffbc962c0a241f7d70b48162f92f2023fe6c043f (patch) | |
tree | d97dd89b680162b935cb8aae223405ffd0d9e16a /src/symbols.h | |
parent | 3939a60c73694d5b76d60f61354e0aeb60b270c6 (diff) | |
download | sciteco-ffbc962c0a241f7d70b48162f92f2023fe6c043f.tar.gz |
renamed scintilla.[ch] to symbols.[ch]: fixes builds on case-insensitive file systems
* There is a "Scintilla.h" as well.
* should fix macOS and builds on native Windows hosts
* It wasn't practical to refer to the Scintilla includes using paths since
the Scintilla location is configurable (--with-scintilla).
So we'd have to write something like #include <include/Scintilla.h>.
For Scinterm we cannot avoid collisions neither as its path is also
configurable (--with-scinterm).
Effectively, we must prevent name clashes across SciTECO and all
of Scintilla and Scinterm.
Diffstat (limited to 'src/symbols.h')
-rw-r--r-- | src/symbols.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/symbols.h b/src/symbols.h new file mode 100644 index 0000000..607a3ff --- /dev/null +++ b/src/symbols.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012-2021 Robin Haberkorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include <glib.h> + +#include "sciteco.h" +#include "string-utils.h" +#include "parser.h" + +typedef struct { + const gchar *name; + gint value; +} teco_symbol_entry_t; + +typedef struct { + const teco_symbol_entry_t *entries; + gint size; + + int (*cmp_fnc)(const char *, const char *, size_t); + + /** + * For auto-completions. + * The list is allocated only ondemand. + */ + GList *list; +} teco_symbol_list_t; + +void teco_symbol_list_init(teco_symbol_list_t *ctx, const teco_symbol_entry_t *entries, gint size, + gboolean case_sensitive); + +gint teco_symbol_list_lookup(teco_symbol_list_t *ctx, const gchar *name, const gchar *prefix); + +gboolean teco_symbol_list_auto_complete(teco_symbol_list_t *ctx, const gchar *symbol, teco_string_t *insert); + +/** @memberof teco_symbol_list_t */ +static inline void +teco_symbol_list_clear(teco_symbol_list_t *ctx) +{ + g_list_free(ctx->list); +} + +extern teco_symbol_list_t teco_symbol_list_scintilla; +extern teco_symbol_list_t teco_symbol_list_scilexer; + +/* + * Command states + */ + +TECO_DECLARE_STATE(teco_state_scintilla_symbols); |