#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "debug.h"
fprintf (stdout, "logical operators:");
fprintf (stdout, " & | !\n");
fprintf (stdout, "mathematic functions:");
- fprintf (stdout, " pow sqrt cos sin tan acos asin atan log exp\n");
+ fprintf (stdout, " pow sqrt log exp\n");
+ fprintf (stdout, "trigonometric functions:");
+ fprintf (stdout, " cos sin tan acos asin atan\n");
fprintf (stdout, "supported functions:");
fprintf (stdout, " abs ceil floor\n");
fprintf (stdout, "storage functions:");
return 0;
}
+char **generate_completion_list ()
+{
+ int i, l = 0;
+ char **list = (char **) calloc (NB_FUNCTIONS + NB_CONSTANTS + 1, sizeof (char *));
+ if (list == NULL) {
+ VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
+ exit (1);
+ }
+
+ for (i = 0; i < NB_FUNCTIONS; i++) {
+ list[l] = strdup ((functions + i)->keyword);
+ if (list[l] == NULL) {
+ VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
+ exit (1);
+ }
+ l++;
+ }
+
+ for (i = 0; i < NB_CONSTANTS; i++) {
+ list[l] = strdup ((constants + i)->keyword);
+ if (list[l] == NULL) {
+ VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
+ exit (1);
+ }
+ l++;
+ }
+
+ return (list);
+}
+
+void free_completion_list (char **list)
+{
+ int i;
+
+ if (list) {
+ for (i = 0; i < NB_FUNCTIONS + NB_CONSTANTS; i++) {
+ if (list[i] != NULL) {
+ free (list[i]);
+ }
+ }
+ free (list);
+ }
+}
+
+
/* vim: set ts=4 sw=4 et: */