diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-26 14:22:58 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-26 14:22:58 +0300 |
commit | 5cb3ba92b9c891a481998a45052649a724931687 (patch) | |
tree | c040740312420e4fdaf0ae74527cab51497e9a94 /lib/forlan.c | |
parent | 517aad5ca97b8ed3a62dcbeca921bb930e897fbf (diff) | |
download | eclat-5cb3ba92b9c891a481998a45052649a724931687.tar.gz eclat-5cb3ba92b9c891a481998a45052649a724931687.tar.bz2 |
Change command line syntax.
The new syntax is:
eclat [GLOBAL-OPTIONS] COMMAND [COMMAND-OPTIONS] [ARGS]
* grecs: Upgrade.
* lib/forlan.c: New forlan function: sort().
* src/.gitignore: Update.
* src/Makefile.am: Update.
* src/cmdline.opt: Use the nopermute option.
* src/dscrtags-cl.opt: New file.
* src/descrtags.c: Rename to src/dscrtags.c
* src/eclat.c (command): Revamp structure.
(eclat_command): Remove.
(command_tab): Remove.
(cmdtab,cmdcnt): New globals.
(main): Change command line syntax.
* src/eclat.h (eclat_command): Remove.
(eclat_command): Remove.
* src/startinst-cl.opt: New file.
* src/startinst.c: Include startinst-cl.h. Process the command
line options.
Diffstat (limited to 'lib/forlan.c')
-rw-r--r-- | lib/forlan.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/forlan.c b/lib/forlan.c index 3f17240..1d3036b 100644 --- a/lib/forlan.c +++ b/lib/forlan.c @@ -789,11 +789,27 @@ func_parent(forlan_eval_env_t env, struct grecs_list *list) } } +static int +node_ident_cmp(struct grecs_node const *a, struct grecs_node const *b) +{ + return strcmp(a->ident, b->ident); +} + +/* FIXME */ +void +func_sort(forlan_eval_env_t env, struct grecs_list *list) +{ + struct forlan_value *val = list->head->data; + if (val->v.node) + grecs_tree_sort(val->v.node, node_ident_cmp); +} + static struct forlan_function functab[] = { { "dump", forlan_value_void, "n", 1, 1, func_dump }, { "print", forlan_value_void, "", 1, -1, func_print }, { "error", forlan_value_void, "", 1, -1, func_error }, { "parent", forlan_value_node, "n", 1, 1, func_parent }, + { "sort", forlan_value_void, "n", 1, 1, func_sort }, { NULL } }; |