MonetDB: default - Indent.

2023-03-20 Thread Sjoerd Mullender
Changeset: 78bd208b6794 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/78bd208b6794
Modified Files:
gdk/gdk.h
Branch: default
Log Message:

Indent.


diffs (12 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1270,7 +1270,7 @@ gdk_export gdk_return BATextend(BAT *b, 
 gdk_export uint8_t ATOMelmshift(int sz)
__attribute__((__const__));
 gdk_export gdk_return ATOMheap(int id, Heap *hp, size_t cap)
-__attribute__((__warn_unused_result__));
+   __attribute__((__warn_unused_result__));
 gdk_export const char *BATtailname(const BAT *b);
 
 gdk_export gdk_return GDKupgradevarheap(BAT *b, var_t v, BUN cap, BUN ncopy)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Indent + send debug output to stderr.

2019-03-20 Thread Sjoerd Mullender
Changeset: 77bed127f56d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=77bed127f56d
Modified Files:
monetdb5/optimizer/opt_commonTerms.c
Branch: default
Log Message:

Indent + send debug output to stderr.


diffs (112 lines):

diff --git a/monetdb5/optimizer/opt_commonTerms.c 
b/monetdb5/optimizer/opt_commonTerms.c
--- a/monetdb5/optimizer/opt_commonTerms.c
+++ b/monetdb5/optimizer/opt_commonTerms.c
@@ -58,8 +58,8 @@ OPTcommonTermsImplementation(Client cntx
duplicate = 0;
 
for ( k = 0; k < p->argc; k++)
-   if ( alias[getArg(p,k)] )
-   getArg(p,k) = alias[getArg(p,k)];
+   if ( alias[getArg(p,k)] )
+   getArg(p,k) = alias[getArg(p,k)];

if (p->token == ENDsymbol){
pushInstruction(mb,p);
@@ -84,7 +84,7 @@ OPTcommonTermsImplementation(Client cntx
barrier |= getFunctionId(p) == assertRef;
if (barrier || p->token == NOOPsymbol || p->token == 
ASSIGNsymbol) {
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-   fprintf(stderr, "#COMMON SKIPPED[%d] %d 
%d\n",i, barrier, p->retc == p->argc);
+   fprintf(stderr, "#COMMON SKIPPED[%d] %d %d\n",i, 
barrier, p->retc == p->argc);
 #endif
pushInstruction(mb,p);
continue;
@@ -93,7 +93,7 @@ OPTcommonTermsImplementation(Client cntx
/* the same holds for function calls without an argument, it is 
unclear where the results comes from (e.g. clock()) */
if ( mayhaveSideEffects(cntxt, mb, p,TRUE) || p->argc == 
p->retc){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-   fprintf(stderr, "#COMMON SKIPPED[%d] 
side-effect %d\n", i, p->retc == p->argc);
+   fprintf(stderr, "#COMMON SKIPPED[%d] side-effect %d\n", 
i, p->retc == p->argc);
 #endif
pushInstruction(mb,p);
continue;
@@ -101,25 +101,25 @@ OPTcommonTermsImplementation(Client cntx
 
/* from here we have a candidate to look for a match */
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-   fprintf(stderr,"#CANDIDATE[%d] look at list[%d]=>%d\n",
+   fprintf(stderr,"#CANDIDATE[%d] look at list[%d]=>%d\n",
i, HASHinstruction(p), 
hash[HASHinstruction(p)]);
-   fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
+   fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
 #endif
/* Look into the hash structure for matching instructions */
for (j = hash[HASHinstruction(p)];  j > 0  ; j = list[j]) 
if ( (q= getInstrPtr(mb,j)) && getFunctionId(q) == 
getFunctionId(p) && getModuleId(q) == getModuleId(p)  ){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-   fprintf(stderr,"#CANDIDATE[%d->%d] %d %d", j, list[j], 
-   hasSameSignature(mb, p, q, p->retc), 
-   hasSameArguments(mb, p, q));
-   mnstr_printf(cntxt->fdout," :%d %d %d=%d %d %d 
%d ", 
-   q->token != ASSIGNsymbol ,
-   list[getArg(q,q->argc-1)],i,
-   !hasCommonResults(p, q), 
-   !isUnsafeFunction(q),
-   !isUpdateInstruction(q),
-   isLinearFlow(q));
-   printInstruction(cntxt->fdout, mb, 0, q, 
LIST_MAL_ALL);
+   fprintf(stderr,"#CANDIDATE[%d->%d] %d %d :%d %d 
%d=%d %d %d %d ",
+   j, list[j], 
+   hasSameSignature(mb, p, q, 
p->retc), 
+   hasSameArguments(mb, p, q),
+   q->token != ASSIGNsymbol ,
+   list[getArg(q,q->argc-1)],i,
+   !hasCommonResults(p, q), 
+   !isUnsafeFunction(q),
+   !isUpdateInstruction(q),
+   isLinearFlow(q));
+   fprintInstruction(stderr, mb, 0, q, 
LIST_MAL_ALL);
 #endif
/*
 * Simple assignments are not replaced either. 
They should be
@@ -127,13 +127,13 @@ OPTcommonTermsImplementation(Client cntx
 * be assigned their value before instruction p.
 */
if ( hasSameArguments(mb, p, q) && 
-   

MonetDB: default - Indent.

2018-02-13 Thread Sjoerd Mullender
Changeset: 90aae7a9a53f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=90aae7a9a53f
Modified Files:
common/stream/stream.c
Branch: default
Log Message:

Indent.


diffs (70 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -1744,7 +1744,7 @@ stream_lz4read(stream *restrict s, void 
remaining_to_decompress = size - total_read;
total_decompressed = lz4->ring_buffer_size - 
lz4->total_processing;
ret = LZ4F_decompress(lz4->context.dec_context, (char*)buf + 
total_read, _to_decompress,
- 
(char*)lz4->ring_buffer + lz4->total_processing, _decompressed, NULL);
+ (char*)lz4->ring_buffer + 
lz4->total_processing, _decompressed, NULL);
if(LZ4F_isError(ret)) {
s->errnr = MNSTR_WRITE_ERROR;
return -1;
@@ -1755,23 +1755,23 @@ stream_lz4read(stream *restrict s, void 
}
 
 #ifdef WIN32
-   /* on Windows when in text mode, convert \r\n line endings to 
\n */
-   if (s->type == ST_ASCII) {
-   char *p1, *p2, *pe;
-
-   p1 = buf;
-   pe = p1 + total_read;
-   while (p1 < pe && *p1 != '\r')
-   p1++;
-   p2 = p1;
-   while (p1 < pe) {
-   if (*p1 == '\r' && p1[1] == '\n')
-   total_read--;
-   else
-   *p2++ = *p1;
-   p1++;
-   }
+   /* on Windows when in text mode, convert \r\n line endings to \n */
+   if (s->type == ST_ASCII) {
+   char *p1, *p2, *pe;
+
+   p1 = buf;
+   pe = p1 + total_read;
+   while (p1 < pe && *p1 != '\r')
+   p1++;
+   p2 = p1;
+   while (p1 < pe) {
+   if (*p1 == '\r' && p1[1] == '\n')
+   total_read--;
+   else
+   *p2++ = *p1;
+   p1++;
}
+   }
 #endif
return (ssize_t) (total_read / elmsize);
 }
@@ -1803,7 +1803,7 @@ stream_lz4write(stream *restrict s, cons
assert(next_batch > 0);
 
ret = LZ4F_compressUpdate(lz4->context.comp_context, 
((char*)lz4->ring_buffer) + lz4->total_processing,
- available, 
((char*)buf) + total_written, next_batch, NULL);
+ available, ((char*)buf) + 
total_written, next_batch, NULL);
if(LZ4F_isError(ret)) {
s->errnr = MNSTR_WRITE_ERROR;
return -1;
@@ -2003,7 +2003,7 @@ open_lz4stream(const char *restrict file
} else if (flags[0] == 'r' && flags[1] != 'b') { /* check for utf-8 
encoding */
char buf[UTF8BOMLENGTH];
if (stream_lz4read(s, buf, 1, UTF8BOMLENGTH) == UTF8BOMLENGTH &&
-   strncmp(buf, UTF8BOM, UTF8BOMLENGTH) == 0) {
+   strncmp(buf, UTF8BOM, UTF8BOMLENGTH) == 0) {
s->isutf8 = 1;
} else {
rewind(lz4->fp);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Indent.

2017-08-22 Thread Sjoerd Mullender
Changeset: 75ab70dc252d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75ab70dc252d
Modified Files:
sql/backends/monet5/sql.c
Branch: default
Log Message:

Indent.


diffs (121 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -399,20 +399,20 @@ create_table_from_emit(Client cntxt, cha
}
 
for(i = 0; i < ncols; i++) {
-   BAT *b = columns[i].b;
-   sql_subtype *tpe = sql_bind_localtype(ATOMname(b->ttype));
-   sql_column *col = NULL;
-
-   if (!tpe) {
+   BAT *b = columns[i].b;
+   sql_subtype *tpe = sql_bind_localtype(ATOMname(b->ttype));
+   sql_column *col = NULL;
+
+   if (!tpe) {
msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not 
find type for column");
goto cleanup;
-   }
-
-   col = mvc_create_column(sql, t, columns[i].name, tpe);
-   if (!col) {
+   }
+
+   col = mvc_create_column(sql, t, columns[i].name, tpe);
+   if (!col) {
msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not 
create column %s", columns[i].name);
goto cleanup;
-   }
+   }
}
msg = create_table_or_view(sql, sname, t->base.name, t, 0);
if (msg != MAL_SUCCEED) {
@@ -424,24 +424,24 @@ create_table_from_emit(Client cntxt, cha
goto cleanup;
}
for(i = 0; i < ncols; i++) {
-   BAT *b = columns[i].b;
-   sql_column *col = NULL;
-
-   col = mvc_bind_column(sql,t, columns[i].name);
-   if (!col) {
+   BAT *b = columns[i].b;
+   sql_column *col = NULL;
+
+   col = mvc_bind_column(sql,t, columns[i].name);
+   if (!col) {
msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not 
bind column %s", columns[i].name);
goto cleanup;
-   }
-   msg = mvc_append_column(sql->session->tr, col, b);
-   if (msg != MAL_SUCCEED) {
-   goto cleanup;
-   }
+   }
+   msg = mvc_append_column(sql->session->tr, col, b);
+   if (msg != MAL_SUCCEED) {
+   goto cleanup;
+   }
}
 
-cleanup:
-sa_destroy(sql->sa);
-sql->sa = NULL;
-return msg;
+  cleanup:
+   sa_destroy(sql->sa);
+   sql->sa = NULL;
+   return msg;
 }
 
 str 
@@ -461,7 +461,7 @@ append_to_table_from_emit(Client cntxt, 
/* for some reason we don't have an allocator here, so make one */
sql->sa = sa_create();
 
-if (!sname) 
+   if (!sname) 
sname = "sys";
if (!(s = mvc_bind_schema(sql, sname))) {
msg = sql_error(sql, 02, "3F000!CREATE TABLE: no such schema 
'%s'", sname);
@@ -473,24 +473,24 @@ append_to_table_from_emit(Client cntxt, 
goto cleanup;
}
for(i = 0; i < ncols; i++) {
-   BAT *b = columns[i].b;
-   sql_column *col = NULL;
-
-   col = mvc_bind_column(sql,t, columns[i].name);
-   if (!col) {
+   BAT *b = columns[i].b;
+   sql_column *col = NULL;
+
+   col = mvc_bind_column(sql,t, columns[i].name);
+   if (!col) {
msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not 
bind column %s", columns[i].name);
goto cleanup;
-   }
-   msg = mvc_append_column(sql->session->tr, col, b);
-   if (msg != MAL_SUCCEED) {
-   goto cleanup;
-   }
+   }
+   msg = mvc_append_column(sql->session->tr, col, b);
+   if (msg != MAL_SUCCEED) {
+   goto cleanup;
+   }
}
 
-cleanup:
-sa_destroy(sql->sa);
-sql->sa = NULL;
-return msg;
+  cleanup:
+   sa_destroy(sql->sa);
+   sql->sa = NULL;
+   return msg;
 }
 
 BAT *
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Indent and license.

2016-06-30 Thread Sjoerd Mullender
Changeset: 410e07a5f978 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=410e07a5f978
Modified Files:
gdk/gdk_interprocess.c
gdk/gdk_interprocess.h
Branch: default
Log Message:

Indent and license.


diffs (truncated from 603 to 300 lines):

diff --git a/gdk/gdk_interprocess.c b/gdk/gdk_interprocess.c
--- a/gdk/gdk_interprocess.c
+++ b/gdk/gdk_interprocess.c
@@ -1,3 +1,10 @@
+/*
+ * 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.
+ */
 
 #include "gdk_interprocess.h"
 
@@ -29,16 +36,17 @@ static key_t base_key = 8;
 gdk_return interprocess_init_semaphore(int id, int count, int flags, int 
*semid, str *msg);
 
 // Regular ftok produces too many collisions
-static gdk_return 
-ftok_enhanced(int id, key_t *return_key) {
-*return_key = base_key + id;
-return GDK_SUCCEED;
+static gdk_return
+ftok_enhanced(int id, key_t * return_key)
+{
+   *return_key = base_key + id;
+   return GDK_SUCCEED;
 }
 
-#define interprocess_create_error(...) { \
-*msg = (char*) GDKzalloc(500 * sizeof(char));\
-snprintf(*msg, 500, __VA_ARGS__); \
-errno = 0;   \
+#define interprocess_create_error(...) {   \
+*msg = (char*) GDKzalloc(500 * sizeof(char));  \
+snprintf(*msg, 500, __VA_ARGS__);  \
+errno = 0; \
 }
 
 //! Obtain a set of unique identifiers that can be used to create memory 
mapped files or semaphores
@@ -46,14 +54,15 @@ ftok_enhanced(int id, key_t *return_key)
  * return: The first unique identifier reserved. The consecutive [offset] 
identifiers are also reserved.
  *  (ex. if offset = 5 and the return value is 10, then the identifiers 10-14 
are reserved)
 */
-size_t 
-GDKuniqueid(size_t offset) {
-// TODO: lock this here instead of in pyapi
-size_t id;
+size_t
+GDKuniqueid(size_t offset)
+{
+   // TODO: lock this here instead of in pyapi
+   size_t id;
 
-id = interprocess_unique_id;
-interprocess_unique_id += offset;
-return id;
+   id = interprocess_unique_id;
+   interprocess_unique_id += offset;
+   return id;
 }
 
 //! Create a memory mapped file if it does not exist and open it
@@ -63,51 +72,53 @@ GDKuniqueid(size_t offset) {
  * msg: Error message (only set if function returns GDK_FAIL)
  * return: GDK_SUCCEED if successful, GDK_FAIL if not successful (with msg set 
to error message)
 */
-gdk_return 
-GDKinitmmap(size_t id, size_t size, void **return_ptr, size_t *return_size, 
str *msg) {
-char address[100];
-void *ptr;
-int fd;
-int mod = MMAP_READ | MMAP_WRITE | MMAP_SEQUENTIAL | MMAP_SYNC  | 
MAP_SHARED;
-char *path = NULL;
-GDKmmapfile(address, 100, id);
+gdk_return
+GDKinitmmap(size_t id, size_t size, void **return_ptr, size_t *return_size, 
str *msg)
+{
+   char address[100];
+   void *ptr;
+   int fd;
+   int mod = MMAP_READ | MMAP_WRITE | MMAP_SEQUENTIAL | MMAP_SYNC | 
MAP_SHARED;
+   char *path = NULL;
+   GDKmmapfile(address, 100, id);
 
-/* round up to multiple of GDK_mmap_pagesize with a
- * minimum of one 
-size = (maxsize + GDK_mmap_pagesize - 1) & ~(GDK_mmap_pagesize - 1);
-if (size == 0)
-size = GDK_mmap_pagesize; */
-fd = GDKfdlocate(0, address, "wb", "tmp");
-if (fd < 0) {
-interprocess_create_error("Failure in GDKfdlocate: %s", 
strerror(errno));
-goto cleanup;
-}
-path = GDKfilepath(0, BATDIR, address, "tmp");
-if (path == NULL) {
-interprocess_create_error("Failure in GDKfilepath: %s", 
strerror(errno));
-goto cleanup;
-}
-close(fd);
-if (GDKextend(path, size) != GDK_SUCCEED) {
-interprocess_create_error("Failure in GDKextend: %s", strerror(errno));
-goto cleanup;
-}
-ptr = GDKmmap(path, mod, size);
-if (ptr == NULL) {
-interprocess_create_error("Failure in GDKmmap: %s", strerror(errno));
-goto cleanup;
-}
-GDKfree(path);
-if (return_ptr != NULL) {
-*return_ptr = ptr;
-}
-if (return_size != NULL) {
-*return_size = size;
-}
-return GDK_SUCCEED;
-cleanup:
-if (path) GDKfree(path);
-return GDK_FAIL;
+   /* round up to multiple of GDK_mmap_pagesize with a
+* minimum of one
+size = (maxsize + GDK_mmap_pagesize - 1) & ~(GDK_mmap_pagesize - 1);
+if (size == 0)
+size = GDK_mmap_pagesize; */
+   fd = GDKfdlocate(0, address, "wb", "tmp");
+   if (fd < 0) {
+   interprocess_create_error("Failure in GDKfdlocate: %s", 
strerror(errno));
+   goto cleanup;
+   }
+   path = GDKfilepath(0, BATDIR, address, "tmp");
+   if 

MonetDB: default - indent

2015-03-22 Thread Niels Nes
Changeset: d80b5c8b389d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d80b5c8b389d
Modified Files:
sql/scripts/17_temporal.sql
Branch: default
Log Message:

indent


diffs (12 lines):

diff --git a/sql/scripts/17_temporal.sql b/sql/scripts/17_temporal.sql
--- a/sql/scripts/17_temporal.sql
+++ b/sql/scripts/17_temporal.sql
@@ -6,7 +6,7 @@
 
 -- assume milliseconds when converted to TIMESTAMP
 create function epoch(sec BIGINT) returns TIMESTAMP
-external name timestamp.epoch;
+   external name timestamp.epoch;
 
 create function epoch(sec INT) returns TIMESTAMP
external name timestamp.epoch;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - indent and approve test output

2014-06-11 Thread Arjen de Rijke
Changeset: 881793198b59 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=881793198b59
Modified Files:
monetdb5/modules/atoms/json.c
sql/test/json/Tests/aggregate01.stable.out
Branch: default
Log Message:

indent and approve test output


diffs (162 lines):

diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -1793,57 +1793,57 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
map = (const oid *) Tloc(t2, BUNfirst(t2));
}
if (g  BATtdense(g)) {
- for (p = 0, q = BATcount(g); p  q; p++) {
-   switch(b-ttype) {
+   for (p = 0, q = BATcount(g); p  q; p++) {
+   switch(b-ttype) {
case  TYPE_str:
-   v = (const char *) BUNtail(bi, BUNfirst(b) + 
(map ? (BUN) map[p] : p + mapoff));
-   break;
-   case TYPE_dbl:
-   val = (const double *) BUNtail(bi, BUNfirst(b) 
+ (map ? (BUN) map[p] : p + mapoff));
-   if (*val != dbl_nil) {
-   snprintf(temp, sizeof(temp), %f, 
*val);
-   v = (const char *)temp;
-   } else {
-   v =  NULL;
+   v = (const char *) BUNtail(bi, 
BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff));
+   break;
+   case TYPE_dbl:
+   val = (const double *) BUNtail(bi, 
BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff));
+   if (*val != dbl_nil) {
+   snprintf(temp, sizeof(temp), 
%f, *val);
+   v = (const char *)temp;
+   } else {
+   v =  NULL;
+   }
+   break;
}
-   break;
-   }
-   if (!v||strNil(v)) {
-   if (skip_nils)
-   continue;
-   strncpy(buf, str_nil, buflen);
-   isnil = 1;
-   } else {
-   len = strlen(v);
-   if (len = maxlen - buflen) {
-   maxlen += len + BUFSIZ;
-   buf = GDKrealloc(buf, maxlen);
-   if (buf == NULL) {
-   err = MAL_MALLOC_FAIL;
-   goto bunins_failed;
+   if (!v||strNil(v)) {
+   if (skip_nils)
+   continue;
+   strncpy(buf, str_nil, buflen);
+   isnil = 1;
+   } else {
+   len = strlen(v);
+   if (len = maxlen - buflen) {
+   maxlen += len + BUFSIZ;
+   buf = GDKrealloc(buf, maxlen);
+   if (buf == NULL) {
+   err = MAL_MALLOC_FAIL;
+   goto bunins_failed;
+   }
+   }
+   switch (b-ttype) {
+   case TYPE_str:
+   len = snprintf(buf + buflen, 
maxlen - buflen, [ \%s\ ], v);
+   buflen += len;
+   break;
+   case TYPE_dbl:
+   len = snprintf(buf + buflen, 
maxlen - buflen, [ %s ], v);
+   buflen += len;
+   break;
}
}
-   switch (b-ttype) {
-   case TYPE_str:
- len = snprintf(buf + buflen, maxlen - buflen, 
[ \%s\ ], v);
- buflen += len;
- break;
-

MonetDB: default - Indent.

2012-11-29 Thread Sjoerd Mullender
Changeset: 658cd94d155f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=658cd94d155f
Modified Files:
monetdb5/modules/mal/pqueue.c
Branch: default
Log Message:

Indent.


diffs (truncated from 2366 to 300 lines):

diff --git a/monetdb5/modules/mal/pqueue.c b/monetdb5/modules/mal/pqueue.c
--- a/monetdb5/modules/mal/pqueue.c
+++ b/monetdb5/modules/mal/pqueue.c
@@ -3,19 +3,19 @@
  * 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-2012 MonetDB B.V.
  * All Rights Reserved.
-*/
+ */
 
 /*
  * Nikos Mamoulis, Niels Nes
@@ -35,16 +35,17 @@
 
 #include pqueue.h
 
-/*returns the parent of a pqueue position*/
-static inline BUN parent(BUN posel)
+/* returns the parent of a pqueue position */
+static inline BUN
+parent(BUN posel)
 {
-  if (posel%2) /*odd*/
-   return posel/2;
-  else
-   return (posel-1)/2;
+   if (posel % 2)  /*odd */
+   return posel / 2;
+   else
+   return (posel - 1) / 2;
 }
 
-/*initialize pqueue*/
+/* initialize pqueue */
 static int
 do_pqueue_init(BAT **h, BAT *b, BUN maxsize)
 {
@@ -55,1178 +56,1205 @@ do_pqueue_init(BAT **h, BAT *b, BUN maxs
return GDK_SUCCEED;
 }
 
-static int 
+static int
 pqueue_init(BAT **h, BAT *b, wrd *maxsize)
 {
return do_pqueue_init(h, b, (BUN) *maxsize);
 }
 
-#define ht_swap(tpe,cur,ins)   
\
-   do {
\
- oid htmp = *(oid*)BUNhloc(hi,cur);\
- tpe ttmp = *(tpe*)BUNtloc(hi,cur);\
- *(oid*)BUNhloc(hi,cur) = *(oid*)BUNhloc(hi,ins);  \
- *(tpe*)BUNtloc(hi,cur) = *(tpe*)BUNtloc(hi,ins);  \
- *(oid*)BUNhloc(hi,ins) = htmp;
\
- *(tpe*)BUNtloc(hi,ins) = ttmp;
\
+#define ht_swap(tpe,cur,ins)   
\
+   do {
\
+   oid htmp = *(oid*)BUNhloc(hi,cur);  
\
+   tpe ttmp = *(tpe*)BUNtloc(hi,cur);  
\
+   *(oid*)BUNhloc(hi,cur) = *(oid*)BUNhloc(hi,ins);\
+   *(tpe*)BUNtloc(hi,cur) = *(tpe*)BUNtloc(hi,ins);\
+   *(oid*)BUNhloc(hi,ins) = htmp;  
\
+   *(tpe*)BUNtloc(hi,ins) = ttmp;  
\
} while (0)
 
 #define any_swap(cur,ins,ts)   
\
do {
\
- unsigned int i;   
\
- char ch;  
\
-  /* only swap the locations (ie var_t's) */   \
- char *c1 = BUNtloc(hi,cur), *c2 = BUNtloc(hi,ins);\
- oid htmp = *(oid*)BUNhloc(hi,cur);
\
- *(oid*)BUNhloc(hi,cur) = *(oid*)BUNhloc(hi,ins);  \
- *(oid*)BUNhloc(hi,ins) = htmp;
\
- for(i=0;its;i++) {   
\
-   ch= c1[i]; c1[i]=c2[i]; c2[i]=ch;   
\
- } 
\
+   unsigned int i; 
\
+   char ch;
\
+   /* only swap the locations (ie var_t's) */  
\
+   char *c1 = BUNtloc(hi,cur), *c2 = BUNtloc(hi,ins);  \
+   oid htmp = *(oid*)BUNhloc(hi,cur);  
\
+   *(oid*)BUNhloc(hi,cur) = *(oid*)BUNhloc(hi,ins);\
+   

MonetDB: default - indent with uncrustify

2012-04-21 Thread Fabian Groffen
Changeset: 3b16952ba79b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3b16952ba79b
Modified Files:
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_import.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_parser.c
Branch: default
Log Message:

indent with uncrustify


diffs (truncated from 4256 to 300 lines):

diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -38,9 +38,10 @@
 
 int MDBdelay;  /* do not immediately react */
 
-#define skipBlanc(c,X)while(*(X)  isspace((int)*X)){ X++; }
-#define skipNonBlanc(c,X) while(*(X)  !isspace((int) *X)){ X++; }
-#define skipWord(c,X)while(*(X)  isalnum((int) *X)){X++;} skipBlanc(c,X);
+#define skipBlanc(c, X)while (*(X)  isspace((int) *X)) { X++; }
+#define skipNonBlanc(c, X) while (*(X)  !isspace((int) *X)) { X++; }
+#define skipWord(c, X) while (*(X)  isalnum((int) *X)) { X++; } \
+   skipBlanc(c, X);
 
 static void printStackElm(stream *f, MalBlkPtr mb, ValPtr v, int index, BUN 
cnt, BUN first);
 static void printStackHdr(stream *f, MalBlkPtr mb, ValPtr v, int index);
@@ -65,21 +66,21 @@ isBreakpoint(Client cntxt, MalBlkPtr mb,
int i, j;
 
for (i = 0; i  mdbTable[cntxt-idx].brkTop; i++) {
-   if( mdbTable[cntxt-idx].brkBlock[i] != mb) 
+   if (mdbTable[cntxt-idx].brkBlock[i] != mb)
continue;
-   if( mdbTable[cntxt-idx].brkPc[i] == pc )
+   if (mdbTable[cntxt-idx].brkPc[i] == pc)
return mdbTable[cntxt-idx].brkCmd[i];
 
-   if( mdbTable[cntxt-idx].brkMod[i]  getModuleId(p) 
-   mdbTable[cntxt-idx].brkFcn[i]  getFunctionId(p) 
-   strcmp(mdbTable[cntxt-idx].brkMod[i], 
getModuleId(p))==0 
-   strcmp(mdbTable[cntxt-idx].brkFcn[i], 
getFunctionId(p))==0)
+   if (mdbTable[cntxt-idx].brkMod[i]  getModuleId(p) 
+   mdbTable[cntxt-idx].brkFcn[i]  getFunctionId(p) 
+   strcmp(mdbTable[cntxt-idx].brkMod[i], getModuleId(p)) 
== 0 
+   strcmp(mdbTable[cntxt-idx].brkFcn[i], 
getFunctionId(p)) == 0)
return mdbTable[cntxt-idx].brkCmd[i];
 
-   if( mdbTable[cntxt-idx].brkVar[i] = 0 )
-   for (j = 0; j  p-retc; j++)
-   if (mdbTable[cntxt-idx].brkVar[i] == getArg(p,j))
-   return mdbTable[cntxt-idx].brkCmd[i];
+   if (mdbTable[cntxt-idx].brkVar[i] = 0)
+   for (j = 0; j  p-retc; j++)
+   if (mdbTable[cntxt-idx].brkVar[i] == getArg(p, 
j))
+   return mdbTable[cntxt-idx].brkCmd[i];
}
return 0;
 }
@@ -87,7 +88,7 @@ isBreakpoint(Client cntxt, MalBlkPtr mb,
 /*
  * Break points can be set on assignment to a specific variable,
  * specific operation, or a instruction line
-*/
+ */
 void
 mdbSetBreakRequest(Client cntxt, MalBlkPtr mb, str request, char cmd)
 {
@@ -97,12 +98,12 @@ mdbSetBreakRequest(Client cntxt, MalBlkP
Symbol sym;
 
/* set breakpoint on specific line */
-   if( *request == '#' ){
-   i= atoi(request+1);
-   if( i0 || i= mb-stop)
-   mnstr_printf(cntxt-fdout, breakpoint on #%d (%d) not 
set\n, 
-   i, mb-stop);
-   else  {
+   if (*request == '#') {
+   i = atoi(request + 1);
+   if (i  0 || i = mb-stop)
+   mnstr_printf(cntxt-fdout, breakpoint on #%d (%d) not 
set\n,
+   i, mb-stop);
+   else {
mdb-brkBlock[mdb-brkTop] = mb;
mdb-brkPc[mdb-brkTop] = i;
mdb-brkVar[mdb-brkTop] = -1;
@@ -117,27 +118,28 @@ mdbSetBreakRequest(Client cntxt, MalBlkP
}
 
/* check for a [module.]function request */
-   fcnnme= strchr(request,'.');
-   if( fcnnme){
-   modnme= request;
-   *fcnnme= 0;
+   fcnnme = strchr(request, '.');
+   if (fcnnme) {
+   modnme = request;
+   *fcnnme = 0;
fcnnme++;
-   sym= findSymbol(cntxt-nspace, modnme,fcnnme);
-   mdb-brkBlock[mdb-brkTop] = sym? sym-def: mb;
+   sym = findSymbol(cntxt-nspace, modnme, fcnnme);
+   mdb-brkBlock[mdb-brkTop] = sym ? sym-def : mb;
mdb-brkPc[mdb-brkTop] = -1;
mdb-brkVar[mdb-brkTop] = -1;
-   mdb-brkMod[mdb-brkTop] = putName(modnme,strlen(modnme));
-   mdb-brkFcn[mdb-brkTop] = putName(fcnnme,strlen(fcnnme));
-   fcnnme--; *fcnnme= '.';
+   mdb-brkMod[mdb-brkTop] = putName(modnme, strlen(modnme));
+   

MonetDB: default - Indent.

2012-02-13 Thread Sjoerd Mullender
Changeset: 83374e9bd613 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=83374e9bd613
Modified Files:
monetdb5/mal/mal_instruction.mx
Branch: default
Log Message:

Indent.


diffs (truncated from 1981 to 300 lines):

diff --git a/monetdb5/mal/mal_instruction.mx b/monetdb5/mal/mal_instruction.mx
--- a/monetdb5/mal/mal_instruction.mx
+++ b/monetdb5/mal/mal_instruction.mx
@@ -39,29 +39,29 @@ All Rights Reserved.
 
 #define DEBUG_MAL_INSTR
 /* #define DEBUG_REDUCE */
-#define MAXARG 4   /* BEWARE the code depends on this knowledge */
+#define MAXARG 4   /* BEWARE the code depends on 
this knowledge */
 #define STMT_INCREMENT 32
 #define MAL_VAR_WINDOW  32
 #define MAXVARS 32
 #define MAXLISTING 64*1024
 
 typedef struct SYMDEF {
-   struct SYMDEF *peer;/* where to look next */
-   struct SYMDEF *skip;/* skip to next different symbol */
+   struct SYMDEF *peer;/* where to look next */
+   struct SYMDEF *skip;/* skip to next different symbol */
str name;
int kind;
-   struct MALBLK *def; /* the details of the MAL fcn */
+   struct MALBLK *def; /* the details of the MAL fcn */
 } *Symbol, SymRecord;
 
 typedef struct VARRECORD {
-   str name;   /* argname or lexical value repr */
-   malType type;   /* internal type signature */
-   int flags;  /* see below, reserve some space */
-   int tmpindex;   /* temporary variable */
+   str name;   /* argname or lexical 
value repr */
+   malType type;   /* internal type signature */
+   int flags;  /* see below, reserve 
some space */
+   int tmpindex;   /* temporary variable */
ValRecord value;
-   int eolife; /* pc index when it should be garbage 
collected */
-   int propc, maxprop; /* proc count and max number of properties */
-   int prps[]; /* property array */
+   int eolife; /* pc index when it 
should be garbage collected */
+   int propc, maxprop; /* proc count and max number of 
properties */
+   int prps[]; /* property array */
 } *VarPtr, VarRecord;
 
 /* Variable properties */
@@ -72,7 +72,7 @@ typedef struct VARRECORD {
 #define VAR_CLEANUP16
 #define VAR_INIT   32
 #define VAR_USED   64
-#define VAR_DISABLED   128 /* used for comments and scheduler */
+#define VAR_DISABLED   128 /* used for comments and scheduler */
 
 /* type check status is kept around to improve type checking efficiency */
 #define TYPE_ERROR  -1
@@ -81,112 +81,106 @@ typedef struct VARRECORD {
 
 #define GARBAGECONTROL   3
 
-#define VARARGS 1  /* deal with variable arguments */
+#define VARARGS 1  /* deal with variable arguments 
*/
 #define VARRETS 2
 
 /* all functions return a string */
 
 typedef struct {
-   bit token;  /* instruction type */
-   bit barrier;/* flow of control modifier takes:
-  BARRIER, LEAVE, REDO, EXIT, CATCH, RAISE*/
-   bit typechk;/* type check status */
-   bit gc; /* garbage control flags */
-   bit polymorphic;/* complex type analysis */
-   bit varargs;/* variable number of arguments */
-   int recycle;/* 0 or index into recycle cache */
-   int jump;   /* controlflow program counter */
-   MALfcn fcn; /* resolved function address */
-   struct MALBLK *blk; /* resolved MAL function address */
-   str modname;/* module context */
-   str fcnname;/* function name */
-   int argc, retc, maxarg; /* total and result argument count */
-   int argv[]; /* at least a few entries */
+   bit token;  /* instruction type */
+   bit barrier;/* flow of control modifier 
takes:
+  BARRIER, 
LEAVE, REDO, EXIT, CATCH, RAISE */
+   bit typechk;/* type check status */
+   bit gc; /* garbage control 
flags */
+   bit polymorphic;/* complex type analysis */
+   bit varargs;/* variable number of arguments 
*/
+   int recycle;/* 0 or index into recycle 
cache */
+   int jump;   /* controlflow program 
counter */
+   MALfcn fcn; /* resolved function 
address */
+   struct MALBLK *blk;