Changeset: 302175776f0a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/302175776f0a
Modified Files:
        sql/backends/monet5/vaults/netcdf/netcdf.c
Branch: default
Log Message:

Indentation.


diffs (truncated from 430 to 300 lines):

diff --git a/sql/backends/monet5/vaults/netcdf/netcdf.c 
b/sql/backends/monet5/vaults/netcdf/netcdf.c
--- a/sql/backends/monet5/vaults/netcdf/netcdf.c
+++ b/sql/backends/monet5/vaults/netcdf/netcdf.c
@@ -23,13 +23,13 @@
        "INSERT INTO netcdf_dims(dim_id,file_id,name,length) VALUES(%d, %d, 
'%s', %d);"
 
 #define INSVAR \
-    "INSERT INTO netcdf_vars(var_id,file_id,name,vartype,ndim,coord_dim_id) 
VALUES(%d, %d, '%s', '%s', %d, %d);"
+       "INSERT INTO netcdf_vars(var_id,file_id,name,vartype,ndim,coord_dim_id) 
VALUES(%d, %d, '%s', '%s', %d, %d);"
 
 #define INSVARDIM \
-    "INSERT INTO netcdf_vardim (var_id,dim_id,file_id,dimpos) VALUES(%d, %d, 
%d, %d);"
+       "INSERT INTO netcdf_vardim (var_id,dim_id,file_id,dimpos) VALUES(%d, 
%d, %d, %d);"
 
 #define INSATTR \
-    "INSERT INTO netcdf_attrs 
(obj_name,att_name,att_type,value,file_id,gr_name) VALUES('%s', '%s', '%s', 
'%s', %d, '%s');"
+       "INSERT INTO netcdf_attrs 
(obj_name,att_name,att_type,value,file_id,gr_name) VALUES('%s', '%s', '%s', 
'%s', %d, '%s');"
 
 #define LOAD_NCDF_VAR(tpe,ncdftpe) \
        { \
@@ -59,7 +59,7 @@ fix_quote( char *n, int l)
 str
 NCDFtest(int *vars, str *fname)
 {
-    int ncid;   /* dataset id */
+       int ncid;   /* dataset id */
        int dims, ngatts, unlimdim;
        int retval;
 
@@ -67,16 +67,16 @@ NCDFtest(int *vars, str *fname)
 
        /* Open NetCDF file  */
        if ((retval = nc_open(*fname, NC_NOWRITE, &ncid)))
-           return createException(MAL, "netcdf.test", SQLSTATE(NC000) "Cannot 
open NetCDF file %s: %s", *fname, nc_strerror(retval));
+               return createException(MAL, "netcdf.test", SQLSTATE(NC000) 
"Cannot open NetCDF file %s: %s", *fname, nc_strerror(retval));
 
-    if ((retval = nc_inq(ncid, &dims, vars, &ngatts, &unlimdim)))
-           return createException(MAL, "netcdf.test", SQLSTATE(NC000) "Cannot 
read NetCDF header: %s", nc_strerror(retval));
+       if ((retval = nc_inq(ncid, &dims, vars, &ngatts, &unlimdim)))
+               return createException(MAL, "netcdf.test", SQLSTATE(NC000) 
"Cannot read NetCDF header: %s", nc_strerror(retval));
 
-    if ((retval = nc_close(ncid)))
-           return createException(MAL, "netcdf.test", SQLSTATE(NC000) "Cannot 
close file %s: \
+       if ((retval = nc_close(ncid)))
+               return createException(MAL, "netcdf.test", SQLSTATE(NC000) 
"Cannot close file %s: \
 %s", *fname, nc_strerror(retval));
 
-    return msg;
+       return msg;
 }
 
 /* the following function is from ncdump utility: NetCDF type number to name */
@@ -85,33 +85,33 @@ prim_type_name(nc_type type)
 {
        switch (type) {
        case NC_BYTE:
-         return "byte";
+               return "byte";
        case NC_CHAR:
-         return "char";
+               return "char";
        case NC_SHORT:
-         return "short";
+               return "short";
        case NC_INT:
-         return "int";
+               return "int";
        case NC_FLOAT:
-         return "float";
+               return "float";
        case NC_DOUBLE:
-         return "double";
+               return "double";
 #ifdef USE_NETCDF4
        case NC_UBYTE:
-         return "ubyte";
+               return "ubyte";
        case NC_USHORT:
-         return "ushort";
+               return "ushort";
        case NC_UINT:
-         return "uint";
+               return "uint";
        case NC_INT64:
-         return "int64";
+               return "int64";
        case NC_UINT64:
-         return "uint64";
+               return "uint64";
        case NC_STRING:
-         return "string";
+               return "string";
 #endif /* USE_NETCDF4 */
        default:
-         return "bad type";
+               return "bad type";
        }
 }
 
@@ -120,59 +120,59 @@ prim_type_name(nc_type type)
 static const char *
 NCDF2SQL(nc_type type)
 {
-    switch (type) {
-    case NC_BYTE:
+       switch (type) {
+       case NC_BYTE:
                return "tinyint";
-    case NC_CHAR:
+       case NC_CHAR:
                return "char(1)";
-    case NC_SHORT:
+       case NC_SHORT:
                return "smallint";
-    case NC_INT:
+       case NC_INT:
                return "int";
-    case NC_FLOAT:
+       case NC_FLOAT:
                return "float";
-    case NC_DOUBLE:
+       case NC_DOUBLE:
                return "double";
 #ifdef USE_NETCDF4
 /* ?? mapping of unsigned types */
-    case NC_UBYTE:
+       case NC_UBYTE:
                return "ubyte";
-    case NC_USHORT:
+       case NC_USHORT:
                return "ushort";
-    case NC_UINT:
+       case NC_UINT:
                return "uint";
-    case NC_INT64:
+       case NC_INT64:
                return "bigint";
-    case NC_UINT64:
+       case NC_UINT64:
                return "uint64";
        case NC_STRING:
                return "string";
 #endif /* USE_NETCDF4 */
-    default:
+       default:
                return "type not supported";
-    }
+       }
 }
 
-#define array_series(sta, ste, sto, TYPE) {                            \
-       int s,g;                                                        \
-       TYPE i, *o = (TYPE*)Tloc(bn, 0);                                \
-       TYPE start = sta, step = ste, stop = sto;                       \
-       if ( start < stop && step > 0) {                                \
-               for ( s = 0; s < series; s++)                           \
-                       for ( i = start; i < stop; i += step)           \
-                               for( g = 0; g < group; g++){            \
-                                       *o = i;                         \
-                                       o++;                            \
-                               }                                       \
-       } else {                                                        \
-               for ( s = 0; s < series; s++)                           \
-                       for ( i = start; i > stop; i += step)           \
-                               for( g = 0; g < group; g++){            \
-                                       *o = i;                         \
-                                       o++;                            \
-                               }                                       \
-       }                                                               \
-}
+#define array_series(sta, ste, sto, TYPE) {                            \
+               int s,g;                                                        
                        \
+               TYPE i, *o = (TYPE*)Tloc(bn, 0);                                
\
+               TYPE start = sta, step = ste, stop = sto;               \
+               if ( start < stop && step > 0) {                                
\
+                       for ( s = 0; s < series; s++)                           
\
+                               for ( i = start; i < stop; i += step)   \
+                                       for( g = 0; g < group; g++){            
\
+                                               *o = i;                         
                        \
+                                               o++;                            
                        \
+                                       }                                       
                                \
+               } else {                                                        
                        \
+                       for ( s = 0; s < series; s++)                           
\
+                               for ( i = start; i > stop; i += step)   \
+                                       for( g = 0; g < group; g++){            
\
+                                               *o = i;                         
                        \
+                                               o++;                            
                        \
+                                       }                                       
                                \
+               }                                                               
                                \
+       }
 
 /* create and populate a dimension bat */
 static str
@@ -260,14 +260,14 @@ NCDFattach(Client cntxt, MalBlkPtr mb, M
        tattrs = mvc_bind_table(m, sch, "netcdf_attrs");
 
        if (tfiles == NULL || tdims == NULL || tvars == NULL ||
-           tvardim == NULL || tattrs == NULL)
+               tvardim == NULL || tattrs == NULL)
                return createException(MAL, "netcdf.attach", SQLSTATE(NC000) 
"Catalog table missing\n");
 
        /* check if the file is already attached */
        col = mvc_bind_column(m, tfiles, "location");
        rid = store->table_api.column_find_row(m->session->tr, col, fname, 
NULL);
        if (!is_oid_nil(rid))
-           return createException(SQL, "netcdf.attach", SQLSTATE(NC000) "File 
%s is already attached\n", fname);
+               return createException(SQL, "netcdf.attach", SQLSTATE(NC000) 
"File %s is already attached\n", fname);
 
        /* Open NetCDF file  */
        if ((retval = nc_open(fname, NC_NOWRITE, &ncid)))
@@ -291,7 +291,7 @@ header: %s", nc_strerror(retval));
        GDKfree(esc_str0);
        if ( ( msg = SQLstatementIntern(cntxt, s, "netcdf.attach", TRUE, FALSE, 
NULL))
                 != MAL_SUCCEED )
-           goto finish;
+               goto finish;
 
        /* Read dimensions from NetCDF header and insert a row for each one 
into netcdf_dims table */
 
@@ -302,7 +302,7 @@ header: %s", nc_strerror(retval));
        }
        for (didx = 0; didx < ndims; didx++){
                if ((retval = nc_inq_dim(ncid, didx, dname, &dlen)) != 0)
-               return createException(MAL, "netcdf.attach", SQLSTATE(NC000) 
"Cannot read dimension %d : %s", didx, nc_strerror(retval));
+                       return createException(MAL, "netcdf.attach", 
SQLSTATE(NC000) "Cannot read dimension %d : %s", didx, nc_strerror(retval));
 
                esc_str0 = SQLescapeString(dname);
                if (!esc_str0) {
@@ -312,11 +312,11 @@ header: %s", nc_strerror(retval));
 
                snprintf(buf, BUFSIZ, INSDIM, didx, (int)fid, esc_str0, 
(int)dlen);
                GDKfree(esc_str0);
-           if ( ( msg = SQLstatementIntern(cntxt, s, "netcdf.attach", TRUE, 
FALSE, NULL))
+               if ( ( msg = SQLstatementIntern(cntxt, s, "netcdf.attach", 
TRUE, FALSE, NULL))
                         != MAL_SUCCEED )
-               goto finish;
+                       goto finish;
 
-           dims[didx] = GDKstrdup(dname);
+               dims[didx] = GDKstrdup(dname);
                if (!dims[didx]) {
                        msg = createException(MAL, "netcdf.attach", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
                        goto finish;
@@ -325,14 +325,14 @@ header: %s", nc_strerror(retval));
 
        /* Read variables and attributes from the header and insert rows in 
netcdf_vars, netcdf_vardims, and netcdf_attrs tables */
        for (vidx = 0; vidx < nvars; vidx++){
-           if ( (retval = nc_inq_var(ncid, vidx, vname, &vtype, &vndims, 
vdims, &vnatts)))
-               return createException(MAL, "netcdf.attach",
+               if ( (retval = nc_inq_var(ncid, vidx, vname, &vtype, &vndims, 
vdims, &vnatts)))
+                       return createException(MAL, "netcdf.attach",
                                                                   
SQLSTATE(NC000) "Cannot read variable %d : %s",
                                                                   vidx, 
nc_strerror(retval));
 
-       /* Check if this is coordinate variable */
+               /* Check if this is coordinate variable */
                if ( (vndims == 1) && ( strcmp(vname, dims[vdims[0]]) == 0 ))
-               coord_dim_id = vdims[0];
+                       coord_dim_id = vdims[0];
                else coord_dim_id = -1;
 
                esc_str0 = SQLescapeString(vname);
@@ -343,20 +343,20 @@ header: %s", nc_strerror(retval));
 
                snprintf(buf, BUFSIZ, INSVAR, vidx, (int)fid, esc_str0, 
prim_type_name(vtype), vndims, coord_dim_id);
                GDKfree(esc_str0);
-           if ( ( msg = SQLstatementIntern(cntxt, s, "netcdf.attach", TRUE, 
FALSE, NULL))
+               if ( ( msg = SQLstatementIntern(cntxt, s, "netcdf.attach", 
TRUE, FALSE, NULL))
                         != MAL_SUCCEED )
                        goto finish;
 
-           if ( coord_dim_id < 0 ){
-               for (i = 0; i < vndims; i++){
+               if ( coord_dim_id < 0 ){
+                       for (i = 0; i < vndims; i++){
                                snprintf(buf, BUFSIZ, INSVARDIM, vidx, 
vdims[i], (int)fid, i);
                                if ( ( msg = SQLstatementIntern(cntxt, s, 
"netcdf.attach", TRUE, FALSE, NULL))
                                         != MAL_SUCCEED )
                                        goto finish;
-               }
-           }
+                       }
+               }
 
-       if ( vnatts > 0 ) { /* fill in netcdf_attrs table */
+               if ( vnatts > 0 ) { /* fill in netcdf_attrs table */
 
                        for (aidx = 0; aidx < vnatts; aidx++){
                                if ((retval = 
nc_inq_attname(ncid,vidx,aidx,aname)))
@@ -436,16 +436,16 @@ header: %s", nc_strerror(retval));
                                         != MAL_SUCCEED )
                                        goto finish;
 
-               } /* attr loop */
+                       } /* attr loop */
 
-           }
+               }
        } /* var loop */
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to