Changeset: 4708e98182b9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4708e98182b9
Added Files:
        clients/R/Makefile.ag
        clients/R/MonetDB.R/Makefile.ag
        clients/R/MonetDB.R/src/Makefile.ag
Modified Files:
        clients/Makefile.ag
        clients/R/MonetDB.R/src/profiler.c
        clients/mapiclient/Makefile.ag
Branch: default
Log Message:

Get the progress bar to compile.


diffs (239 lines):

diff --git a/clients/Makefile.ag b/clients/Makefile.ag
--- a/clients/Makefile.ag
+++ b/clients/Makefile.ag
@@ -15,6 +15,6 @@
 # Copyright August 2008-2015 MonetDB B.V.
 # All Rights Reserved.
 
-SUBDIRS = mapilib mapiclient HAVE_ODBC?odbc HAVE_PERL?perl php 
HAVE_RUBYGEM?ruby examples HAVE_PYTHON2?python2 HAVE_PYTHON3?python3 
NATIVE_WIN32?NT
+SUBDIRS = mapilib mapiclient HAVE_ODBC?odbc HAVE_PERL?perl php 
HAVE_RUBYGEM?ruby examples HAVE_PYTHON2?python2 HAVE_PYTHON3?python3 
NATIVE_WIN32?NT R
 
 EXTRA_DIST_DIR = Tests
diff --git a/clients/R/Makefile.ag b/clients/R/Makefile.ag
new file mode 100644
--- /dev/null
+++ b/clients/R/Makefile.ag
@@ -0,0 +1,20 @@
+# The contents of this file are subject to the MonetDB Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.monetdb.org/Legal/MonetDBLicense
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is the MonetDB Database System.
+#
+# The Initial Developer of the Original Code is CWI.
+# Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+# Copyright August 2008-2015 MonetDB B.V.
+# All Rights Reserved.
+
+SUBDIRS = MonetDB.R
+
+EXTRA_DIST_DIR = Tests
diff --git a/clients/R/MonetDB.R/Makefile.ag b/clients/R/MonetDB.R/Makefile.ag
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/Makefile.ag
@@ -0,0 +1,20 @@
+# The contents of this file are subject to the MonetDB Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.monetdb.org/Legal/MonetDBLicense
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is the MonetDB Database System.
+#
+# The Initial Developer of the Original Code is CWI.
+# Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+# Copyright August 2008-2015 MonetDB B.V.
+# All Rights Reserved.
+
+SUBDIRS = src
+EXTRA_DIST = DESCRIPTION NAMESPACE NEWS
+EXTRA_DIST_DIR = R man
diff --git a/clients/R/MonetDB.R/src/Makefile.ag 
b/clients/R/MonetDB.R/src/Makefile.ag
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/src/Makefile.ag
@@ -0,0 +1,18 @@
+# The contents of this file are subject to the MonetDB Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.monetdb.org/Legal/MonetDBLicense
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is the MonetDB Database System.
+#
+# The Initial Developer of the Original Code is CWI.
+# Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+# Copyright August 2008-2015 MonetDB B.V.
+# All Rights Reserved.
+
+EXTRA_DIST = Makevars.win mapisplit.c mapisplit.h mapisplit-r.c profiler.c 
profiler.h profiler-r.c
diff --git a/clients/R/MonetDB.R/src/profiler.c 
b/clients/R/MonetDB.R/src/profiler.c
--- a/clients/R/MonetDB.R/src/profiler.c
+++ b/clients/R/MonetDB.R/src/profiler.c
@@ -20,6 +20,12 @@
 #else
 #include <sys/socket.h>
 #include <netinet/in.h>
+
+#define HAVE_NL_LANGINFO       /* not on Windows, probably everywhere else */
+#endif
+
+#ifdef HAVE_NL_LANGINFO
+#include <langinfo.h>
 #endif
 
 #include "mapisplit.h"
@@ -45,13 +51,6 @@ static char* profiler_symb_trans = "V";
 static char* profiler_symb_bfree = "_";
 static char* profiler_symb_bfull = "#";
 
-static int profiler_strupp(char *s) {
-    size_t i;
-    for (i = 0; i < strlen(s); i++)
-        s[i] = toupper(s[i]);
-    return i;
-}
-
 /* standalone MAL function call parser */
 void mal_statement_split(char* stmt, mal_statement *out, size_t maxparams) {
        #define TRIM(str) \
@@ -121,7 +120,7 @@ void mal_statement_split(char* stmt, mal
        }
 }
 
-static unsigned long profiler_tsms() {
+static unsigned long profiler_tsms(void) {
        unsigned long ret = 0;
        struct timeval tv;
        gettimeofday(&tv, NULL);
@@ -131,9 +130,10 @@ static unsigned long profiler_tsms() {
 }
 
 // clear line and overwrite with spaces
-void profiler_clearbar() {
+void profiler_clearbar(void) {
+       int bs;
        if (!profiler_needcleanup) return;
-       for (int bs=0; bs < PROFILER_BARSYMB + 3 + 6; bs++) printf("\b \b"); 
+       for (bs=0; bs < PROFILER_BARSYMB + 3 + 6; bs++) printf("\b \b"); 
        profiler_needcleanup = 0;
 }
 
@@ -156,7 +156,6 @@ void profiler_renderbar(size_t state, si
 }
 
 static void* profiler_thread(void* params) {
-       params = (void*) params;
        char buf[BUFSIZ];
        char* elems[TRACE_NCOLS];
        // query ids are unlikely to be longer than BUFSIZ
@@ -173,9 +172,14 @@ static void* profiler_thread(void* param
        mal_statement *stmt = malloc(sizeof(mal_statement));
        stmt->params = malloc(TRACE_MAL_MAXPARAMS * sizeof(char*));
 
+       (void) params;
        for(;;) {
                recvd = read(profiler_socket, buf, sizeof(buf));
+               if (recvd < 0)
+                       return NULL;
                if (recvd > 0) {
+                       size_t i = 0, j = 0;
+                       char ib = 0;
                        buf[recvd] = 0;
                        if (buf[0]== '#') {
                                continue;
@@ -185,8 +189,6 @@ static void* profiler_thread(void* param
                                continue;
                        }
                        // cleanup overloaded query identifier
-                       size_t i = 0, j = 0;
-                       char ib = 0;
                        for (i = 0; i < strlen(elems[TRACE_COL_QUERYID]); i++) {
                                if (elems[TRACE_COL_QUERYID][i] == '[') {ib = 
1; thisqueryid[j++] = '*'; }
                                if (elems[TRACE_COL_QUERYID][i] == ']') {ib = 
0; continue;}
@@ -229,20 +231,20 @@ void profiler_renderbar_dl(int* state, i
        profiler_renderbar(*state, *total, profiler_symb_trans);
 }
 
-void profiler_arm() {
+void profiler_arm(void) {
        profiler_armed = 1;
 }
 
-int profiler_start() {
+int profiler_start(void) {
+       struct sockaddr_in serv_addr;
+       socklen_t len = sizeof(serv_addr);
+
        profiler_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        if(profiler_socket < 0) {
            fprintf(stderr, "socket error\n");
            return -1;
        }
 
-       struct sockaddr_in serv_addr;
-       socklen_t len = sizeof(serv_addr);
-
        memset((char *) &serv_addr, 0, sizeof(serv_addr));
        serv_addr.sin_family = AF_INET;
        serv_addr.sin_addr.s_addr = INADDR_ANY;
@@ -254,15 +256,14 @@ int profiler_start() {
        return -1;
        }
 
-       // some nicer characters for UTF-enabled terminals
-       char* ctype = getenv("LC_CTYPE");
-       profiler_strupp(ctype);
-       if (strstr(ctype, "UTF-8") != NULL) {
-               profiler_symb_query = "\u27F2";
-               profiler_symb_trans = "\u2193";
-               profiler_symb_bfree = "\u2591";
-               profiler_symb_bfull = "\u2588";
-       }
+#ifdef HAVE_NL_LANGINFO
+       if (strcasecmp(nl_langinfo(CODESET), "utf-8") == 0) {
+               profiler_symb_query = "\342\237\262";   /* U+27F2 */
+               profiler_symb_trans = "\342\206\223";   /* U+2193 */
+               profiler_symb_bfree = "\342\226\221";   /* U+2591 */
+               profiler_symb_bfull = "\342\226\210";   /* U+2588 */
+       }
+#endif
 
        // start backgroud listening thread
        pthread_create(&profiler_pthread, NULL, &profiler_thread, NULL);
diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag
--- a/clients/mapiclient/Makefile.ag
+++ b/clients/mapiclient/Makefile.ag
@@ -16,7 +16,7 @@
 # All Rights Reserved.
 
 MTSAFE
-INCLUDES = ../mapilib ../../common/options ../../common/stream 
../R/MonetDB.R/src/ $(READLINE_INCS)
+INCLUDES = ../mapilib ../../common/options ../../common/stream 
../R/MonetDB.R/src $(READLINE_INCS)
 
 lib_mcutil = {
        NOINST
@@ -28,7 +28,7 @@ bin_mclient = {
        LIBS = libmcutil ../mapilib/libmapi \
                ../../common/stream/libstream \
                $(READLINE_LIBS) \
-               $(curl_LIBS) $(LTLIBICONV)
+               $(curl_LIBS) $(LTLIBICONV) $(PTHREAD_LIBS) $(MATH_LIBS)
 }
 
 bin_msqldump = {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to