mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 00:22:17 +02:00
Lots of moving stuff around - hopefully I didn't break too much :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@632 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
3d124da13b
commit
e395e87ded
160 changed files with 3954 additions and 2959 deletions
|
|
@ -1,10 +1,10 @@
|
|||
noinst_LTLIBRARIES = libirssi_config.la
|
||||
noinst_LIBRARIES = libirssi_config.a
|
||||
|
||||
INCLUDES = \
|
||||
$(GLIB_CFLAGS) \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
libirssi_config_la_SOURCES = \
|
||||
libirssi_config_a_SOURCES = \
|
||||
get.c \
|
||||
set.c \
|
||||
parse.c \
|
||||
|
|
|
|||
|
|
@ -291,3 +291,19 @@ char **config_node_get_list(CONFIG_NODE *node)
|
|||
g_string_free(values, TRUE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Returns n'th node from list. */
|
||||
CONFIG_NODE *config_node_index(CONFIG_NODE *node, int index)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
g_return_val_if_fail(node != NULL, NULL);
|
||||
g_return_val_if_fail(is_node_list(node), NULL);
|
||||
|
||||
for (tmp = node->value; tmp != NULL; tmp = tmp->next, index--) {
|
||||
if (index == 0)
|
||||
return tmp->data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ int config_get_bool(CONFIG_REC *rec, const char *section, const char *key, int d
|
|||
const char *config_list_find(CONFIG_REC *rec, const char *section, const char *key, const char *value, const char *value_key);
|
||||
/* Like config_list_find(), but return node instead of it's value */
|
||||
CONFIG_NODE *config_list_find_node(CONFIG_REC *rec, const char *section, const char *key, const char *value, const char *value_key);
|
||||
/* Returns n'th node from list. */
|
||||
CONFIG_NODE *config_node_index(CONFIG_NODE *node, int index);
|
||||
|
||||
/* Setting values */
|
||||
int config_set_str(CONFIG_REC *rec, const char *section, const char *key, const char *value);
|
||||
|
|
@ -135,6 +137,8 @@ void config_node_remove(CONFIG_REC *rec, CONFIG_NODE *parent, CONFIG_NODE *node)
|
|||
/* Remove n'th node from a list */
|
||||
void config_node_list_remove(CONFIG_REC *rec, CONFIG_NODE *node, int index);
|
||||
|
||||
/* Clear all data inside node, but leave the node */
|
||||
void config_node_clear(CONFIG_REC *rec, CONFIG_NODE *node);
|
||||
/* Clear the entire configuration */
|
||||
void config_nodes_remove_all(CONFIG_REC *rec);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@ static void config_parse_peek_token(GScanner *scanner, CONFIG_NODE *node)
|
|||
}
|
||||
|
||||
/* get optional token, optionally warn if it's missing */
|
||||
static void config_parse_warn_missing(CONFIG_REC *rec, CONFIG_NODE *node, int expected_token, int print_warning)
|
||||
static void config_parse_warn_missing(CONFIG_REC *rec, CONFIG_NODE *node,
|
||||
GTokenType expected_token, int print_warning)
|
||||
{
|
||||
config_parse_peek_token(rec->scanner, node);
|
||||
if (rec->scanner->next_token == expected_token) {
|
||||
|
|
@ -128,7 +129,7 @@ static void config_parse_warn_missing(CONFIG_REC *rec, CONFIG_NODE *node, int ex
|
|||
g_scanner_warn(rec->scanner, "Warning: missing '%c'", expected_token);
|
||||
}
|
||||
|
||||
static void config_parse_loop(CONFIG_REC *rec, CONFIG_NODE *node, int expect);
|
||||
static void config_parse_loop(CONFIG_REC *rec, CONFIG_NODE *node, GTokenType expect);
|
||||
|
||||
static int config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
|
||||
{
|
||||
|
|
@ -215,7 +216,7 @@ static int config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
|
|||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static void config_parse_loop(CONFIG_REC *rec, CONFIG_NODE *node, int expect)
|
||||
static void config_parse_loop(CONFIG_REC *rec, CONFIG_NODE *node, GTokenType expect)
|
||||
{
|
||||
int expected_token;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,17 +59,23 @@ void config_node_remove(CONFIG_REC *rec, CONFIG_NODE *parent, CONFIG_NODE *node)
|
|||
/* Remove n'th node from a list */
|
||||
void config_node_list_remove(CONFIG_REC *rec, CONFIG_NODE *node, int index)
|
||||
{
|
||||
GSList *tmp;
|
||||
CONFIG_NODE *child;
|
||||
|
||||
g_return_if_fail(node != NULL);
|
||||
g_return_if_fail(is_node_list(node));
|
||||
|
||||
for (tmp = node->value; tmp != NULL; tmp = tmp->next, index--) {
|
||||
if (index == 0) {
|
||||
config_node_remove(rec, node, tmp->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
child = config_node_index(node, index);
|
||||
if (child != NULL) config_node_remove(rec, node, child);
|
||||
}
|
||||
|
||||
/* Clear all data inside node, but leave the node */
|
||||
void config_node_clear(CONFIG_REC *rec, CONFIG_NODE *node)
|
||||
{
|
||||
g_return_if_fail(node != NULL);
|
||||
g_return_if_fail(is_node_list(node));
|
||||
|
||||
while (node->value != NULL)
|
||||
config_node_remove(rec, node, node->value);
|
||||
}
|
||||
|
||||
void config_nodes_remove_all(CONFIG_REC *rec)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue