Changeset: 2e58be5a7f82 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e58be5a7f82
Removed Files:
        sql/backends/monet5/sql_readline.c
        sql/backends/monet5/sql_readline.h
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/Makefile.ag
        monetdb5/mal/mal_readline.c
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/clients.h
        monetdb5/modules/mal/clients.mal
        monetdb5/tools/Makefile.ag
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/sql_execute.c
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/vaults/Makefile.ag
        sql/backends/monet5/vaults/fits/Makefile.ag
        sql/backends/monet5/vaults/lidar/Makefile.ag
        sql/backends/monet5/vaults/netcdf/Makefile.ag
        sql/backends/monet5/vaults/shp/Makefile.ag
Branch: default
Log Message:

Complete removal of readline support from mserver5 console.
Also see changeset ec2bf9017ee4.


diffs (truncated from 470 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -904,7 +904,6 @@ str CLTquit(Client cntxt, MalBlkPtr mb, 
 str CLTremoveUser(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str CLTripemd160sum(str *ret, str *pw);
 str CLTsessions(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str CLTsetHistory(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str CLTsetListing(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str CLTsetPassword(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str CLTsetScenario(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
diff --git a/monetdb5/mal/Makefile.ag b/monetdb5/mal/Makefile.ag
--- a/monetdb5/mal/Makefile.ag
+++ b/monetdb5/mal/Makefile.ag
@@ -9,8 +9,7 @@ INCLUDES = ../../common/options \
                   ../../common/utils \
                   ../../clients/mapilib \
                   ../../gdk \
-                  ../optimizer \
-                  $(READLINE_INCS) 
+                  ../optimizer
 MTSAFE
 
 lib_mal = {
diff --git a/monetdb5/mal/mal_readline.c b/monetdb5/mal/mal_readline.c
--- a/monetdb5/mal/mal_readline.c
+++ b/monetdb5/mal/mal_readline.c
@@ -17,8 +17,6 @@
 #include <strings.h>           /* for strncasecmp */
 #endif
 
-/* #define _MAL_READLINE_DEBUG  */
-
 #ifndef S_ISCHR
 #define S_ISCHR(m)  (((m) & S_IFMT) == S_IFCHR)
 #endif
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -27,11 +27,6 @@
 #include "mal_private.h"
 #include "mtime.h"
 
-#ifdef HAVE_LIBREADLINE
-#include <readline/readline.h>
-#include <readline/history.h>
-#endif
-
 static void
 pseudo(bat *ret, BAT *b, str X1,str X2) {
        char buf[BUFSIZ];
@@ -277,29 +272,6 @@ CLTusers(bat *ret)
 }
 
 str
-CLTsetHistory(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       str* fname = getArgReference_str(stk,pci,1);
-       (void) mb;
-
-       if( cntxt->history){
-#ifdef HAVE_LIBREADLINE
-               write_history(cntxt->history);
-#endif
-               GDKfree(cntxt->history);
-       }
-       if( *fname == str_nil)
-               cntxt->history = NULL;
-       else {
-               cntxt->history = GDKstrdup(*fname);
-#ifdef HAVE_LIBREADLINE
-               read_history(cntxt->history);
-#endif
-       }
-       return MAL_SUCCEED;
-}
-
-str
 CLTquit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        int id;
diff --git a/monetdb5/modules/mal/clients.h b/monetdb5/modules/mal/clients.h
--- a/monetdb5/modules/mal/clients.h
+++ b/monetdb5/modules/mal/clients.h
@@ -22,7 +22,6 @@ mal_export str CLTgetClientId(Client cnt
 mal_export str CLTgetScenario(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 mal_export str CLTsetScenario(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 mal_export str CLTusers(bat *ret);
-mal_export str CLTsetHistory(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 mal_export str CLTquit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 mal_export str CLTLogin(bat *ret, bat *nme);
 mal_export str CLTLastCommand(bat *ret);
diff --git a/monetdb5/modules/mal/clients.mal b/monetdb5/modules/mal/clients.mal
--- a/monetdb5/modules/mal/clients.mal
+++ b/monetdb5/modules/mal/clients.mal
@@ -14,10 +14,6 @@ comment "Turn on/off echo of MAL instruc
        4 - show details of type resolutoin, 
        8 - show binding information.";
 
-pattern setHistory(s:str)
-address CLTsetHistory
-comment "Designate console history file for readline.";
-
 pattern getId():int
 address CLTgetClientId
 comment "Return a number that uniquely represents the current client.";
diff --git a/monetdb5/tools/Makefile.ag b/monetdb5/tools/Makefile.ag
--- a/monetdb5/tools/Makefile.ag
+++ b/monetdb5/tools/Makefile.ag
@@ -25,7 +25,7 @@ lib_monetdb5 = {
                ../../common/utils/libmsabaoth \
                $(UUID_LIBS) $(curl_LIBS) \
                $(MATH_LIBS) $(SOCKET_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) \
-               $(DL_LIBS) $(READLINE_LIBS) $(openssl_LIBS) $(pcre_LIBS) \
+               $(DL_LIBS) $(openssl_LIBS) $(pcre_LIBS) \
                $(LTLIBICONV) $(zlib_LIBS) $(libxml2_LIBS) \
                $(libmicrohttpd_LIBS) $(liburiparser_LIBS)
 }
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -17,8 +17,7 @@ INCLUDES = ../../include ../../common ..
                   ../../../common/options \
                   ../../../common/stream \
                   ../../../common/utils \
-                  ../../../gdk \
-                  $(READLINE_INCS)
+                  ../../../gdk
 
 lib__sql = {
        MODULE
@@ -37,7 +36,6 @@ lib__sql = {
                sql_gencode.c sql_gencode.h \
                sql_optimizer.c sql_optimizer.h \
                sql_result.c sql_result.h \
-               sql_readline.c sql_readline.h \
                sql_cast.c sql_cast.h \
                sql_cast_impl_down_from_flt.h \
                sql_cast_impl_down_from_int.h \
@@ -55,7 +53,7 @@ lib__sql = {
                   ../../../gdk/libbat \
                   ../../../common/stream/libstream \
                   ../../../common/utils/libmcrypt \
-                  $(READLINE_LIBS) $(PTHREAD_LIBS) \
+                  $(PTHREAD_LIBS) \
                   $(openssl_LIBS) $(MATH_LIBS)
 }
 
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -23,7 +23,6 @@
 #include "sql_execute.h"
 #include "sql_env.h"
 #include "sql_mvc.h"
-#include "sql_readline.h"
 #include "sql_user.h"
 #include <sql_optimizer.h>
 #include <sql_datetime.h>
diff --git a/sql/backends/monet5/sql_readline.c 
b/sql/backends/monet5/sql_readline.c
deleted file mode 100644
--- a/sql/backends/monet5/sql_readline.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0.  If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
- */
-
-/*
- * @- Word completion
- * Word completion recognizes the start of a line to issue a
- * list of valid SQL command options. Any other identifier
- * is considered a table name or column name.
- * The word completion does not recognize possible functions
- * and types yet.
- * Add readline functionality to the MAL console.
- * This means that the user has history access and some other
- * features to assemble a command before it is being interpreted.
- * @f sql_readline
- */
-#include "monetdb_config.h"
-#include "mal.h"
-#undef PATHLENGTH
-#include "mal_readline.h"
-#include "mal_client.h"
-#include "mal_scenario.h"
-#include "sql_readline.h"
-
-/* #define _SQL_READLINE_DEBUG  */
-
-#ifdef HAVE_LIBREADLINE
-
-#include <readline/readline.h>
-#include <readline/history.h>
-#include "mal_debugger.h"
-
-void init_sql_readline(void);
-void deinit_sql_readline(void);
-rl_completion_func_t *suspend_completion(void);
-void continue_completion(rl_completion_func_t * func);
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>           /* for strncasecmp */
-#endif
-
-
-static const char *sql_commands[] = {
-       "COMMIT",
-       "COPY",
-       "CREATE TABLE",
-       "CREATE VIEW",
-       "DECLARE",
-       "DROP TABLE",
-       "DROP VIEW",
-       "FROM",
-       "BEGIN TRANSACTION",
-       "ROLLBACK",
-       "SELECT",
-       "SET AUTO_COMMIT",
-       "WHERE",
-       0
-};
-
-static int sqlcommandlimit = 13;
-
-#ifdef HAVE_STRNCASECMP
-#define STR_EQUAL(a, b, l)     (strncasecmp(a, b, l) == 0)
-#else
-#define STR_EQUAL(a, b, l)     (strncmp(a, b, l) == 0)
-#endif
-
-static char *
-sql_command_generator(const char *text, int state)
-{
-       static int index, len;
-       const char *name;
-
-#ifdef _SQL_READLINE_DEBUG
-       printf("expand:%d [%d] %s \n", state, (int) strlen(text), text);
-#endif
-       if (!state) {
-               index = 0;
-               len = strlen(text);
-       }
-       if (mdbSession()) {
-               while ((name = sql_commands[index++])) {
-                       if (STR_EQUAL(name, text, len))
-                               return strdup(name);
-               }
-               return NULL;
-       }
-       while (index < sqlcommandlimit && (name = sql_commands[index++])) {
-               if (STR_EQUAL(name, text, len))
-                       return strdup(name);
-       }
-       return NULL;
-}
-
-static char **
-sql_completion(const char *text, int start, int end)
-{
-       (void) start;
-       (void) end;
-
-       /* FIXME: Nice, context-sensitive completion strategy should go here */
-       return rl_completion_matches(text, sql_command_generator);
-}
-
-void
-init_sql_readline(void)
-{
-       str history = MCgetClient(CONSOLE)->history;    /* only for console */
-
-       /* Allow conditional parsing of the ~/.inputrc file. */
-       rl_readline_name = "MonetDB";
-       /* Tell the completer that we want to try our own completion before std 
completion (filename) kicks in. */
-       rl_attempted_completion_function = sql_completion;
-       read_history(history);
-}
-
-void
-deinit_sql_readline(void)
-{
-       str history = MCgetClient(CONSOLE)->history;    /* only for console */
-       if (history) {
-               write_history(history);
-       }
-}
-
-/*
- * @-
- */
-#ifndef S_ISCHR
-#define S_ISCHR(m)  (((m) & S_IFMT) == S_IFCHR)
-#endif
-
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to