Changeset: 3950594ef09b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3950594ef09b
Modified Files:
monetdb5/modules/mal/array.mx
Branch: sciql
Log Message:
array.mx clean-up: remove not yet used commented out print_array()
implementation
dead code remains in the HG attic
diffs (207 lines):
diff --git a/monetdb5/modules/mal/array.mx b/monetdb5/modules/mal/array.mx
--- a/monetdb5/modules/mal/array.mx
+++ b/monetdb5/modules/mal/array.mx
@@ -1123,203 +1123,4 @@ ARRAYembed(Client cntxt, MalBlkPtr mb, M
throw(MAL,"array.embed","incomplete embedding");
return MAL_SUCCEED;
}
-@-
-The printing stuff is postponed to the future. Then it also needs
-a solution to the GDKout issues.
-/*---------------------------------------------------------------------------*/
-/*
- memory-hungry function;
- it internally builds the index to be able to print the array in-order.
- This is postpone to the future of arrays.
-*/
-
-static int
-print_array(BAT *val, ...)
-{
- BATiter vali = bat_iterator(val);
- va_list ap;
- BAT *tmp, *batptr[MAX_ARRAY_DIM];
- int *minvector;
- int *idxvector;
- int *maxvector;
- int *lenvector;
- oid *arrayindex;
- int i, dims;
- BUN j, c;
- stream *st = GDKout;
- int type_id = BATttype(val);
-
- va_start(ap, val);
- dims = 0;
- while ((tmp = va_arg(ap, BAT *)) != NULL) {
- if (dims == MAX_ARRAY_DIM) {
- GDKerror("print_array: Error, too high
dimensionality.\n");
- goto exit_err_none;
- }
- batptr[dims++] = tmp;
- }
- if (dims == 0) {
- GDKerror("print_array: Error, no index bats provided.\n");
- goto exit_err_none;
- }
- va_end(ap);
-
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, "[PRINT_ARRAY] Dims = %d\n", dims);
-#endif
-
- minvector = GDKmalloc(sizeof(ptr) * dims);
- if ( minvector == NULL)
- goto exit_err_full;
- idxvector = GDKzalloc(sizeof(int) * dims);
- if ( idxvector == NULL)
- goto exit_err_full;
- maxvector = GDKmalloc(sizeof(ptr) * dims);
- if ( maxvector == NULL)
- goto exit_err_full;
- lenvector = GDKmalloc(sizeof(ptr) * dims);
- if ( lenvector == NULL)
- goto exit_err_full;
-
- c = 1;
- j = BATcount(val);
- for (i = 0; i < dims; i++) {
- if (BATttype(batptr[i]) != TYPE_int) {
- GDKerror("print_array: Index %d error, not int type\n",
i);
- goto exit_err_part;
- }
- if (BATcount(batptr[i]) != j) {
- GDKerror("print_array: Index %d error, count doesn't
match\n", i);
- goto exit_err_part;
- }
-
- BATmin(batptr[i], &(minvector[i]));
- BATmax(batptr[i], &(maxvector[i]));
- lenvector[i] = maxvector[i] - minvector[i] + 1;
- c *= lenvector[i];
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, "[PRINT_ARRAY] Axis %d = %d..%d\n", i,
minvector[i], maxvector[i]);
-#endif
- }
-
- if (c != j) {
- GDKerror("print_array: array size does not match array
count\n");
- goto exit_err_part;
- }
- arrayindex = GDKmalloc(sizeof(oid) * c);
- if ( arrayindex == NULL)
- goto exit_err_full;
-
- /* Iterate over the first index BAT. */
- /* And fetch additional indices (for a given oid) */
- /* building the full M-D structure (of oid's). */
- {
- BATiter b0i = bat_iterator(batptr[0]);
- register BUN p, q;
-
- p = BUNfirst(batptr[0]);
- q = BUNlast(batptr[0]);
- while (p < q) {
- register oid *o = (oid *) BUNhead(b0i, p);
- register int offset;
-
- offset = *((int *) BUNtail(b0i, p)) - minvector[0];
- for (i = 1; i < dims; i++) {
- register BUN p = BUNfnd(batptr[i], o);
-
- if (p == BUN_NONE) {
- GDKerror("print_array: Index %d missing
for oid " OIDFMT ".\n", i, *o);
- goto exit_err_full;
- }
- offset = (offset * lenvector[i]) + ((*((int *)
Tloc(batptr[i],p))) - minvector[i]);
- }
- arrayindex[offset] = *o;
- p++;
- }
- }
-
- /* Iterate over all valid indices */
- /* (note: normalized to [0..l-1] ranges !) */
- /* And print the values within the 'correct' */
- /* bracket structure... */
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, "[PRINT_ARRAY] ");
-#endif
- while (idxvector[dims - 1] < lenvector[dims - 1]) {
- int offset;
-
- for (i = 0; i < dims; i++) {
- if (idxvector[i] != 0) {
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, ",");
-#endif
- mnstr_printf(st, ",");
- break;
- }
- }
- i = 0;
- while (i < dims && idxvector[i] == 0) {
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, "[");
-#endif
- mnstr_printf(st, "[");
- i++;
- }
- for (offset = idxvector[0], i = 1; i < dims; i++) {
- offset = (offset * lenvector[i]) + idxvector[i];
- }
- {
- register BUN p = BUNfnd(val, &arrayindex[offset]);
-
- if (p == BUN_NONE) {
- GDKerror("print_array: Value missing for oid "
OIDFMT ".\n", arrayindex[offset]);
- goto exit_err_full;
- }
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, OIDFMT "\@0", arrayindex[offset]);
-#endif
- ATOMprint(type_id, BUNtail(vali, p), st);
- if (mnstr_errnr(st))
- goto exit_err_full;
- }
- i = 0;
- while (i < dims && (++idxvector[i]) == lenvector[i]) {
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, "]");
-#endif
- mnstr_printf(st, "]");
- if (i < dims - 1) {
- idxvector[i] = 0;
- i++;
- }
- }
- }
-#ifdef EXCESSIVE_DEBUGGING
- fprintf(stderr, "\n");
-#endif
- mnstr_printf(st, "\n");
-
- /* Exit strategies... */
- GDKfree(arrayindex);
- GDKfree(maxvector);
- GDKfree(idxvector);
- GDKfree(minvector);
- GDKfree(lenvector);
- return GDK_SUCCEED;
-
-exit_err_full:
- if (arrayindex)
- GDKfree(arrayindex);
-exit_err_part:
- if ( maxvector)
- GDKfree(maxvector);
- if (idxvector)
- GDKfree(idxvector);
- if (minvector)
- GDKfree(minvector);
- if (lenvector)
- GDKfree(lenvector);
-exit_err_none:
- return GDK_FAIL;
-}
@}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list