Ver código fonte

MSVC: resolve global/local warnings

richarddobson 3 semanas atrás
pai
commit
f10fb700ed
3 arquivos alterados com 170 adições e 160 exclusões
  1. 92 88
      dev/tabedit/columns0.c
  2. 30 26
      dev/tabedit/columns1.c
  3. 48 46
      dev/tabedit/columns4.c

+ 92 - 88
dev/tabedit/columns0.c

@@ -32,6 +32,10 @@
 
 #define STACK_WITH_OVERLAP 1111
 
+//#ifdef unix
+#define round(x) lround((x))
+//#endif
+
 void    usage(void), logo(void);
 
 static void read_flags(char *,char *);
@@ -53,15 +57,15 @@ static void flag_only_takes_no_params(char flag);
 static void unknown_flag_or_bad_param(void);
 static void no_value_with_flag(char flag,int ro);
 static void no_value_with_flag_only(char flag);
-static void no_value_required_with_flag(char flag,int ro);
+static void no_value_required_with_flag(char flag,int i_ro);
 static void no_value_required_with_flag_only(char flag);
 static void read_flags_data_error(char *str);
 static void unknown_flag_string(char *flagstr);
 
 static void check_for_columnextract(char *argv1,int *argc,char *argv[]);
 static int valid_call_for_multicol_input(char flag,int ro);
-static int noro(int ro);
-static void output_multicol_data();
+static int noro(int i_ro);
+static void output_multicol_data(void);
 
 int     cnt = 0, firstcnt, arraysize = BIGARRAY, infilecnt, outfilecnt, colcnt, thecol, allcols = 1;
 double  *number, *permm, *permmm, factor, scatter, *pos, *outcoldata;
@@ -2504,7 +2508,7 @@ void do_string_params(char *argv[],int pcnt)
 
 /********************************* READ_DATA *********************************/
 
-void read_data(char *startarg,char *endarg,int *ro)
+void read_data(char *startarg,char *endarg,int *i_ro)
 {
     /* READ THE (FIRST) FILE DATA */
     if(!strncmp(endarg,"-th",3) || !strncmp(endarg,"-tM",3))
@@ -2532,9 +2536,9 @@ void read_data(char *startarg,char *endarg,int *ro)
     } else if(!strncmp(endarg,"-DB",3))
         do_DB_infile(startarg);                                         /* DB info in file */
     else if(!strcmp(endarg,"-c"))
-        *ro = ENDOFSTR;                                                         /* COUNT only, option */
+        *i_ro = ENDOFSTR;                                                         /* COUNT only, option */
     else if(!strcmp(endarg,"-cl"))
-        *ro = 'l';                                                                      /* COUNT lines, option */
+        *i_ro = 'l';                                                                      /* COUNT lines, option */
     else
         do_infile(startarg);                                            /* read numeric values */
 }
@@ -2580,40 +2584,40 @@ int option_takes_data_and_has_extra_params(char *agv)
 
 /********************************* CHECK_EXCEPTIONAL_PROCESSES ********************************/
 
-void check_exceptional_processes(int ro,int argc)
+void check_exceptional_processes(int i_ro,int argc)
 {
     if(!sloom && !sloombatch) {
-        if(flag=='H' && (ro==ENDOFSTR || ro=='r') && cnt>1) {
+        if(flag=='H' && (ro==ENDOFSTR || i_ro=='r') && cnt>1) {
             fprintf(stderr,"Too many values in file for H");
-            if(ro=='r')
+            if(i_ro=='r')
                 fprintf(stderr,"r");
             fprintf(stderr," flag.\n");
             exit(1);
         }
 
-        if((flag=='J' || (flag=='C' && (ro == ENDOFSTR || ro == 'c'))) && argc<4) {
+        if((flag=='J' || (flag=='C' && (i_ro == ENDOFSTR || i_ro == 'c'))) && argc<4) {
             fprintf(stderr,"Flags J & C need at least 2 input files.\n");
             exit(1);
         }
-        if(((flag=='S' && ro==ENDOFSTR) || flag=='N') && argc!=4) {
+        if(((flag=='S' && i_ro==ENDOFSTR) || flag=='N') && argc!=4) {
             fprintf(stderr,"flags S & N or Nr need 1 infilename & 1 generic outfilename.\n");
             exit(1);
         }
     } else {
-        if(flag=='H' && (ro==ENDOFSTR || ro=='r') && cnt>1) {
+        if(flag=='H' && (i_ro==ENDOFSTR || i_ro=='r') && cnt>1) {
             fprintf(stdout,"ERROR: Too many values in file this option.\n");
             fflush(stdout);
             exit(1);
         }
         if((flag=='J' || flag=='j'
-            || (flag == 'W' && ro == 'b')
-            || (flag=='e' && (ro == 's' || ro == 'i' || ro == 'A' || ro == 'S' || ro == 'w' || ro == 'W' || ro == 'L' || ro == 'Q' || ro == 'X' || ro == 'Y'))
-            || (flag == 'A' && ro == 'e')) && argc<4) {
+            || (flag == 'W' && i_ro == 'b')
+            || (flag=='e' && (i_ro == 's' || i_ro == 'i' || i_ro == 'A' || i_ro == 'S' || i_ro == 'w' || i_ro == 'W' || i_ro == 'L' || i_ro == 'Q' || i_ro == 'X' || i_ro == 'Y'))
+            || (flag == 'A' && i_ro == 'e')) && argc<4) {
             fprintf(stdout,"ERROR: This option needs at least 2 input files.\n");
             fflush(stdout);
             exit(1);
         }
-        if(((flag=='S' && ro==ENDOFSTR) || flag=='N') && argc!=4) {
+        if(((flag=='S' && i_ro==ENDOFSTR) || flag=='N') && argc!=4) {
             fprintf(stdout,"ERROR: These options need 1 infilename & 1 generic outfilename.\n");
             fflush(stdout);
             exit(1);
@@ -2623,7 +2627,7 @@ void check_exceptional_processes(int ro,int argc)
 
 /********************************* HANDLE_MULTIFILE_PROCESSES_AND_THE_OUTPUT_FILE ********************************/
 
-void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,char **argv)
+void handle_multifile_processes_and_the_output_file(int argc, char cflag,int i_ro,char **argv)
 {
     int joico = 0, colcnt2 = 0;
 
@@ -2633,13 +2637,13 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
             firstcnt = cnt;
             infilecnt = argc-2;
             do_other_stringline_infiles(argv,'J');
-        } else if(flag=='C' && (ro == ENDOFSTR || ro == 'c')) {
+        } else if(cflag=='C' && (i_ro == ENDOFSTR || i_ro == 'c')) {
             joico = 1;
             firstcnt = cnt;
             infilecnt = argc-2;
             do_other_infiles(argv);
-        } else if(flag =='j') {
-            if(ro == 0) {
+        } else if(cflag =='j') {
+            if(i_ro == 0) {
                 infilecnt = 2;
                 colcnt2 = do_other_stringline_infile(argv[2]);
                 if(colcnt != colcnt2) {
@@ -2647,14 +2651,14 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
                     fflush(stdout);
                     exit(1);
                 }
-            } else if(ro =='j') {
+            } else if(i_ro =='j') {
                 infilecnt = argc-2;
                 do_other_stringline_infiles(argv,'j');
             }
-        } else if(flag =='W' && ro == 'b') {
+        } else if(cflag =='W' && i_ro == 'b') {
             infilecnt = argc-2;
             do_other_stringline_infiles(argv,'W');
-        } else if(flag =='K' && ro == 'b') {
+        } else if(cflag =='K' && i_ro == 'b') {
             infilecnt = argc-3;
             do_other_infiles(argv);
         } else {
@@ -2663,7 +2667,7 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
                 fflush(stdout);
                 exit(1);
             }
-            if(flag!='S' && flag!='N') {
+            if(cflag!='S' && flag!='N') {
                 /*RWD*/         if(!strcmp(argv[2],"con") || !strcmp(argv[2],"CON"))
                     fp[1]=stdout;
                 else if(allcols == 1)
@@ -2673,7 +2677,7 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
             }
         }
     } else {
-        if(flag=='A' && ro == 'e') {
+        if(cflag=='A' && i_ro == 'e') {
             joico = 1;
             infilecnt = argc-2;
             if((file_cnt = (int *)malloc(infilecnt * sizeof(int)))==NULL) {
@@ -2683,28 +2687,28 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
             }
             file_cnt[0] = cnt;
             do_other_infiles(argv);
-        } else if(flag=='J') {
+        } else if(cflag=='J') {
             joico = 1;
             firstcnt = cnt;
             infilecnt = argc-2;
             do_other_stringline_infiles(argv,'J');
-        } else if(flag=='C' && (ro == ENDOFSTR || ro == 'c')) {
+        } else if(cflag=='C' && (i_ro == ENDOFSTR || i_ro == 'c')) {
             joico = 1;
             firstcnt = cnt;
             infilecnt = argc-2;
             do_other_infiles(argv);
-        } else if(flag =='e'
-                  && (ro == 's' || ro == 'i' || ro == 'a' || ro == 'A' || ro == 'S' || ro == 'w' || ro == 'W' || ro == 'L' || ro == 'Q'
-                      || ro == 'X' || ro == 'm' || ro =='Y')) {
+        } else if(cflag =='e'
+                  && (i_ro == 's' || i_ro == 'i' || i_ro == 'a' || i_ro == 'A' || i_ro == 'S' || i_ro == 'w' || i_ro == 'W' || i_ro == 'L' || i_ro == 'Q'
+                      || i_ro == 'X' || i_ro == 'm' || i_ro =='Y')) {
             firstcnt = cnt;
             infilecnt = 2;
             do_other_infiles(argv);
-        } else if(flag =='w' && (ro == 't' || ro == 'o')) {
+        } else if(cflag =='w' && (i_ro == 't' || i_ro == 'o')) {
             firstcnt = cnt;
             infilecnt = 2;
             do_other_infiles(argv);
-        } else if(flag =='j') {
-            if(ro == 0) {
+        } else if(cflag =='j') {
+            if(i_ro == 0) {
                 infilecnt = 2;
                 colcnt2 = do_other_stringline_infile(argv[2]);
                 if(colcnt != colcnt2) {
@@ -2712,14 +2716,14 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
                     fflush(stdout);
                     exit(1);
                 }
-            } else if(ro =='j') {
+            } else if(i_ro =='j') {
                 infilecnt = argc-2;
                 do_other_stringline_infiles(argv,'j');
             }
-        } else if(flag =='W' && ro == 'b') {
+        } else if(cflag =='W' && i_ro == 'b') {
             infilecnt = argc-2;
             do_other_stringline_infiles(argv,'W');
-        } else if(flag =='K' && ro == 'b') {
+        } else if(cflag =='K' && i_ro == 'b') {
             infilecnt = argc-3;
             do_other_infiles(argv);
         } else if(!joico) {
@@ -2728,7 +2732,7 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
                 fflush(stdout);
                 exit(1);
             }
-            if(flag!='S' && flag!='N') {
+            if(cflag!='S' && cflag!='N') {
                 if(allcols == 1)
                     do_outfile(argv[2]);
                 else
@@ -2741,9 +2745,9 @@ void handle_multifile_processes_and_the_output_file(int argc, char flag,int ro,c
 /********************************* ERROR_REPORTING ********************************/
 
 
-void cant_read_numeric_value(char flag,int ro) {
+void cant_read_numeric_value(char cflag,int i_ro) {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"Cannot read numerical value with flag %c%c\n",flag,ro);
+        fprintf(stderr,"Cannot read numerical value with flag %c%c\n",cflag,i_ro);
     else {
         fprintf(stdout,"ERROR: Cannot read numerical value.\n");
         fflush(stdout);
@@ -2751,9 +2755,9 @@ void cant_read_numeric_value(char flag,int ro) {
     exit(1);
 }
 
-void cant_read_numeric_value_with_flag_only(char flag) {
+void cant_read_numeric_value_with_flag_only(char cflag) {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"Cannot read numerical value with flag %c\n",flag);
+        fprintf(stderr,"Cannot read numerical value with flag %c\n",cflag);
     else {
         fprintf(stdout,"ERROR: Cannot read numerical value.\n");
         fflush(stdout);
@@ -2761,10 +2765,10 @@ void cant_read_numeric_value_with_flag_only(char flag) {
     exit(1);
 }
 
-void unknown_flag_only(char flag)
+void unknown_flag_only(char cflag)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"Unknown flag -%c\n",flag);
+        fprintf(stderr,"Unknown flag -%c\n",cflag);
     else {
         fprintf(stdout,"ERROR: Unknown option.\n");
         fflush(stdout);
@@ -2772,10 +2776,10 @@ void unknown_flag_only(char flag)
     exit(1);
 }
 
-void unknown_flag(char flag,int ro)
+void unknown_flag(char cflag,int i_ro)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"Unknown flag -%c%c\n",flag,ro);
+        fprintf(stderr,"Unknown flag -%c%c\n",cflag,i_ro);
     else {
         fprintf(stdout,"ERROR: Unknown option.\n");
         fflush(stdout);
@@ -2794,10 +2798,10 @@ void cannot_read_flags(char *flagstr)
     exit(1);
 }
 
-void flag_takes_no_params(char flag,int ro)
+void flag_takes_no_params(char cflag,int i_ro)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"flag -%c%c does not take a parameter\n",flag,ro);
+        fprintf(stderr,"flag -%c%c does not take a parameter\n",cflag,i_ro);
     else {
         fprintf(stdout,"ERROR: This option does not take a parameter\n");
         fflush(stdout);
@@ -2805,10 +2809,10 @@ void flag_takes_no_params(char flag,int ro)
     exit(1);
 }
 
-void flag_only_takes_no_params(char flag)
+void flag_only_takes_no_params(char cflag)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"flag -%c does not take a parameter\n",flag);
+        fprintf(stderr,"flag -%c does not take a parameter\n",cflag);
     else {
         fprintf(stdout,"ERROR: This option does not take a parameter\n");
         fflush(stdout);
@@ -2827,10 +2831,10 @@ void unknown_flag_or_bad_param(void)
     exit(1);
 }
 
-void no_value_with_flag(char flag,int ro)
+void no_value_with_flag(char cflag,int i_ro)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"No value supplied with flag -%c%c\n",flag,ro);
+        fprintf(stderr,"No value supplied with flag -%c%c\n",cflag,i_ro);
     else {
         fprintf(stdout,"ERROR: No value supplied with this option\n");
         fflush(stdout);
@@ -2838,10 +2842,10 @@ void no_value_with_flag(char flag,int ro)
     exit(1);
 }
 
-void no_value_with_flag_only(char flag)
+void no_value_with_flag_only(char cflag)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"No value supplied with flag -%c\n",flag);
+        fprintf(stderr,"No value supplied with flag -%c\n",cflag);
     else {
         fprintf(stdout,"ERROR: No value supplied with this option\n");
         fflush(stdout);
@@ -2849,10 +2853,10 @@ void no_value_with_flag_only(char flag)
     exit(1);
 }
 
-void no_value_required_with_flag(char flag,int ro)
+void no_value_required_with_flag(char cflag,int i_ro)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"No parameter required with flag %c%c.\n",flag,ro);
+        fprintf(stderr,"No parameter required with flag %c%c.\n",cflag,i_ro);
     else {
         fprintf(stdout,"ERROR: No parameter required with this option.\n");
         fflush(stdout);
@@ -2860,10 +2864,10 @@ void no_value_required_with_flag(char flag,int ro)
     exit(1);
 }
 
-void no_value_required_with_flag_only(char flag)
+void no_value_required_with_flag_only(char cflag)
 {
     if(!sloom && !sloombatch)
-        fprintf(stderr,"No parameter required with flag %c\n",flag);
+        fprintf(stderr,"No parameter required with flag %c\n",cflag);
     else {
         fprintf(stdout,"ERROR: No parameter required with this option.\n");
         fflush(stdout);
@@ -3016,114 +3020,114 @@ void check_for_columnextract(char *argv1,int *argc,char *argv[])
 
 /********************************** VALID_CALL_FOR_MULTICOL_INPUT **********************************/
 
-int valid_call_for_multicol_input(char flag,int ro)
+int valid_call_for_multicol_input(char cflag,int i_ro)
 {
-    switch(flag) {
+    switch(cflag) {
     case('A'):
-        if(ro == 's')
+        if(i_ro == 's')
             return 1;
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
         break;
     case('D'):
-        if(ro == 'B')
+        if(i_ro == 'B')
             return 1;
         break;
     case('I'):
-        if(ro == 'r')
+        if(i_ro == 'r')
             return 1;
         break;
     case('M'):
-        if(ro == 'h')
+        if(i_ro == 'h')
             return 1;
-        if(ro == 'm')
+        if(i_ro == 'm')
             return 1;
-        if(ro == 't')
+        if(i_ro == 't')
             return 1;
         break;
     case('P'):
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
         break;
     case('R'):
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
-        if(ro == 'A' || ro == 'a' || ro == 'm' || ro == 'o' || ro == 's')
+        if(i_ro == 'A' || i_ro == 'a' || i_ro == 'm' || i_ro == 'o' || i_ro == 's')
             return 1;
         break;
     case('S'):
-        if(ro == 'L')
+        if(i_ro == 'L')
             return 1;
         break;
     case('T'):
-        if(ro == 'c' || ro == 'h' || ro == 'M' || ro == 'l')
+        if(i_ro == 'c' || i_ro == 'h' || i_ro == 'M' || i_ro == 'l')
             return 1;
         break;
     case('a'):
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
         break;
     case('b'):
-        if(ro == 'g' || ro == 'l')
+        if(i_ro == 'g' || i_ro == 'l')
             return 1;
         break;
     case('d'):
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
-        if(ro == 'b')
+        if(i_ro == 'b')
             return 1;
         break;
     case('f'):
-        if(ro == 'l')
+        if(i_ro == 'l')
             return 1;
         break;
     case('h'):
-        if(ro == 'M')
+        if(i_ro == 'M')
             return 1;
         break;
     case('i'):
-        if(ro == 'L' || ro == 'M' || ro == 'a' || ro == 'h' || ro == 'm' || ro == 'l')
+        if(i_ro == 'L' || i_ro == 'M' || i_ro == 'a' || i_ro == 'h' || i_ro == 'm' || i_ro == 'l')
             return 1;
         break;
     case('l'):
-        if(ro == 'i')
+        if(i_ro == 'i')
             return 1;
         break;
     case('m'):
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
-        if(ro == 'M' || ro == 'g' || ro == 'l')
+        if(i_ro == 'M' || ro == 'g' || ro == 'l')
             return 1;
         break;
     case('o'):
     case('q'):
-        if(noro(ro))
+        if(noro(i_ro))
             return 1;
         break;
     case('r'):
-        if(ro == 'S' || ro == 'm' || ro == 'r')
+        if(i_ro == 'S' || i_ro == 'm' || i_ro == 'r')
             return 1;
         break;
     case('s'):
-        if(ro == 'l' || ro == 't')
+        if(i_ro == 'l' || i_ro == 't')
             return 1;
         break;
     case('t'):
-        if(ro == 'M' || ro == 'h')
+        if(i_ro == 'M' || i_ro == 'h')
             return 1;
         break;
     }
     return 0;
 }
 
-int noro(int ro)
+int noro(int i_ro)
 {
-    if(ro == ENDOFSTR || ro == '.' || ro == '-' || isdigit(ro))
+    if(i_ro == ENDOFSTR || i_ro == '.' || i_ro == '-' || isdigit(i_ro))
         return 1;
     return 0;
 }
 
-void output_multicol_data()
+void  output_multicol_data(void)
 {
     int xcnt;
     int this_column;

+ 30 - 26
dev/tabedit/columns1.c

@@ -28,6 +28,10 @@
 
 #include <columns.h>
 
+//#ifdef unix
+#define round(x) lround((x))
+//#endif
+
 #define CALCLIM                 0.001
 #define M                       7
 #define NSTACK                  50
@@ -107,7 +111,7 @@ int     stringstoresize = 0, stringstart = 0;
 
 int timevents(double intime0,double intime1,double insize0,double insize1)
 {
-    int    number;
+    int    inumber;
     double fnum, fnumber, error;
     double lobound, hibound, duration;
     if(flteq(insize0,0.0) || flteq(insize1,0.0)) {
@@ -120,13 +124,13 @@ int timevents(double intime0,double intime1,double insize0,double insize1)
         do_error();
     }
     if(fabs(insize1-insize0)<CALCLIM)                       /* 1 */
-        return(number = samesize(intime0,intime1,insize0,insize1,duration));
+        return(inumber = samesize(intime0,intime1,insize0,insize1,duration));
     fnum     = cntevents(duration,insize0,insize1); /* 2 */
-    number   = round(fnum);
-    if(number<=1)                                   /* 3 */
+    inumber   = round(fnum);
+    if(inumber<=1)                                   /* 3 */
         return(1);
-    pos = (double *)exmalloc((number+1) * sizeof(double));
-    fnumber = (double)(number);                             /* 4 */
+    pos = (double *)exmalloc((inumber+1) * sizeof(double));
+    fnumber = (double)(inumber);                             /* 4 */
     error   = fabs(fnum - fnumber);
     lobound = insize1;                                      /* 5 */
     hibound = insize1;
@@ -141,9 +145,9 @@ int timevents(double intime0,double intime1,double insize0,double insize1)
     } else {
         insize1 = (hibound+lobound)/2;
     }                                               /* 7 */
-    getetime(intime0,intime1,insize0,insize1,number);
-    pos[number] = intime1;
-    return(number+1);
+    getetime(intime0,intime1,insize0,insize1,inumber);
+    pos[inumber] = intime1;
+    return(inumber+1);
 }
 
 /*************************** CNTEVENTS *****************************/
@@ -171,16 +175,16 @@ double cntevents(double dur,double s0,double s1)
 int samesize
 (double intime0,double intime1,double insize0,double insize1,double duration)
 {
-    int     number;
+    int     inumber;
     double fnum, size;                                      /* 1 */
     size   = (insize0+insize1)/2;
     fnum   = duration/size;
-    number = round(fnum);
-    size   = duration/(double)(number);
-    pos     = (double *)exmalloc((number+1) * sizeof(double));
-    approxtimes(intime0,size,number);
-    pos[number] = intime1;
-    return(number+1);
+    inumber = round(fnum);
+    size   = duration/(double)inumber;
+    pos     = (double *)exmalloc((inumber+1) * sizeof(double));
+    approxtimes(intime0,size,inumber);
+    pos[inumber] = intime1;
+    return(inumber+1);
 }
 
 /************************ APPROXTIME ***************************
@@ -188,11 +192,11 @@ int samesize
  * Calculate time-positions of equally spaced events.
  */
 
-void approxtimes(double intime0,double size,int number)
+void approxtimes(double intime0,double size,int inumber)
 {   int k;
     double *q = pos;
     *q++ = intime0;
-    for(k=1;k<number;k++) {
+    for(k=1;k<inumber;k++) {
         *q = *(q-1) + size;
         q++;
     }
@@ -203,11 +207,11 @@ void approxtimes(double intime0,double size,int number)
  * Calculate time-positions of events that vary in size between s0 and s1.
  */
 
-void getetime(double t0,double t1,double s0,double s1,int number)
+void getetime(double t0,double t1,double s0,double s1,int inumber)
 {   int n;
     double sdiff = s1-s0, tdiff = t1-t0, d1, d2, d3, *q = pos;
     *q++ = t0;
-    for(n=1;n<number;n++)   {
+    for(n=1;n<inumber;n++)   {
         d1      = sdiff/tdiff;
         d1   *= (double)n;
         d1    = exp(d1);
@@ -822,9 +826,9 @@ void bellperm3(void)
 
 void swap(double *d0,double *d1)
 {
-    double temp = *d0;
+    double dtemp = *d0;
     *d0 = *d1;
-    *d1 = temp;
+    *d1 = dtemp;
 }
 
 /**************************** FLTEQ *******************************/
@@ -982,16 +986,16 @@ void prnt_pitchclass(int z,int oct)
     }
 }
 
-
+//RWD Nov 2025 nb this func uses global var 'number' (columns.h), TODO: make local, somehow!
 void bublsort(void) {
     int n, m;
-    double temp;
+    double dtemp;
     for(n=0;n<cnt-1;n++) {
         for(m = n; m<cnt; m++) {
             if(number[m] < number[n]) {
-                temp = number[n];
+                dtemp = number[n];
                 number[n] = number[m];
-                number[m] = temp;
+                number[m] = dtemp;
             }
         }
     }

+ 48 - 46
dev/tabedit/columns4.c

@@ -22,10 +22,12 @@
  *
  */
 
-
-
 #include <columns.h>
 
+ //#ifdef unix
+#define round(x) lround((x))
+//#endif
+
 void sort_numbers(int *);
 
 /***************************** PRINT_NUMBERS() ************************/
@@ -68,18 +70,18 @@ void remove_frq_pitchclass_duplicates(void)
 
 /***************************** COUNT_ITEMS ****************************/
 
-void count_items(char *filename)
+void count_items(char *fname)
 {
     char *p;
-    char temp[10000];
+    char ctemp[10000];
     cnt = 0;
-    if((fp[0] = fopen(filename,"r"))==NULL) {
-        fprintf(stdout,"ERROR: Cannot open infile %s\n",filename);
+    if((fp[0] = fopen(fname,"r"))==NULL) {
+        fprintf(stdout,"ERROR: Cannot open infile %s\n",fname);
         fflush(stdout);
         exit(1);
     }
-    while(fgets(temp,200,fp[0])!=NULL) {
-        p = temp;
+    while(fgets(ctemp,200,fp[0])!=NULL) {
+        p = ctemp;
         if(ro=='l') {
             cnt++;
         } else {
@@ -249,12 +251,12 @@ void rotate_partition_values_to_files(void)
 
 /************************* JOIN_FILES_AS_COLUMNS ************************/
 
-void join_files_as_columns(char *filename)
+void join_files_as_columns(char *fname)
 {
     int n, m;
-    char temp[64];
+    char ctemp[64];
     if(!sloom) {
-        if((fp[0] = fopen(filename,"w"))==NULL) {
+        if((fp[0] = fopen(fname,"w"))==NULL) {
             fprintf(stdout,"Cannot reopen infile1 to write data.\n");
             fflush(stdout);
             exit(1);
@@ -263,11 +265,11 @@ void join_files_as_columns(char *filename)
     errstr[0] = ENDOFSTR;
     for(n=0;n<firstcnt;n++) {
         for(m=0;m<infilecnt-1;m++) {
-            sprintf(temp,"%.5lf ",number[n + (firstcnt * m)]);
-            strcat(errstr,temp);
+            sprintf(ctemp,"%.5lf ",number[n + (firstcnt * m)]);
+            strcat(errstr,ctemp);
         }
-        sprintf(temp,"%.5lf ",number[n + (firstcnt * m)]);
-        strcat(errstr,temp);
+        sprintf(ctemp,"%.5lf ",number[n + (firstcnt * m)]);
+        strcat(errstr,ctemp);
         if(!sloom)
             fprintf(fp[0],"%s\n",errstr);
         else
@@ -282,37 +284,37 @@ void join_files_as_columns(char *filename)
 void join_files_as_rows(void)
 {
     int n, m, locnt = cnt/colcnt, totcnt = (cnt + stringscnt)/colcnt;
-    char temp[64];
+    char ctemp[64];
     errstr[0] = ENDOFSTR;
     for(n=0;n<ifactor;n++) {
         sprintf(errstr,"INFO: ");
         for(m = 0; m < colcnt-1; m++) {
-            sprintf(temp,"%s ",strings[(n * colcnt) + m]);
-            strcat(errstr,temp);
+            sprintf(ctemp,"%s ",strings[(n * colcnt) + m]);
+            strcat(errstr,ctemp);
         }
-        sprintf(temp,"%s",strings[(n * colcnt) + m]);
-        strcat(errstr,temp);
+        sprintf(ctemp,"%s",strings[(n * colcnt) + m]);
+        strcat(errstr,ctemp);
         fprintf(stdout,"%s\n",errstr);
     }
     for(n=locnt;n<totcnt;n++) {
         sprintf(errstr,"INFO: ");
         for(m = 0; m < colcnt-1; m++) {
-            sprintf(temp,"%s ",strings[(n * colcnt) + m]);
-            strcat(errstr,temp);
+            sprintf(ctemp,"%s ",strings[(n * colcnt) + m]);
+            strcat(errstr,ctemp);
         }
-        sprintf(temp,"%s",strings[(n * colcnt) + m]);
-        strcat(errstr,temp);
+        sprintf(ctemp,"%s",strings[(n * colcnt) + m]);
+        strcat(errstr,ctemp);
         fprintf(stdout,"%s\n",errstr);
     }
 
     for(n=ifactor;n<locnt;n++) {
         sprintf(errstr,"INFO: ");
         for(m = 0; m < colcnt-1; m++) {
-            sprintf(temp,"%s ",strings[(n * colcnt) + m]);
-            strcat(errstr,temp);
+            sprintf(ctemp,"%s ",strings[(n * colcnt) + m]);
+            strcat(errstr,ctemp);
         }
-        sprintf(temp,"%s",strings[(n * colcnt) + m]);
-        strcat(errstr,temp);
+        sprintf(ctemp,"%s",strings[(n * colcnt) + m]);
+        strcat(errstr,ctemp);
         fprintf(stdout,"%s\n",errstr);
     }
     fflush(stdout);
@@ -323,7 +325,7 @@ void join_files_as_rows(void)
 void join_many_files_as_rows(void)
 {
     int i, n, m, rowcnt, bas;
-    char temp[200];
+    char ctemp[200];
 
     bas = 0;
     for(i = 0;i < infilecnt; i++) {                 /* for each file */
@@ -331,8 +333,8 @@ void join_many_files_as_rows(void)
         for(n=0;n<rowcnt;n++) {                         /*      for each row in file */
             sprintf(errstr,"INFO: ");
             for(m=0;m<colcnt;m++) {                 /* foreach column in row */
-                sprintf(temp,"%s ",strings[bas + (n * colcnt) + m]);
-                strcat(errstr,temp);
+                sprintf(ctemp,"%s ",strings[bas + (n * colcnt) + m]);
+                strcat(errstr,ctemp);
             }
             fprintf(stdout,"%s\n",errstr);
         }
@@ -344,13 +346,13 @@ void join_many_files_as_rows(void)
 /************************* JOIN_MANY_FILES_AS_COLUMNS ************************/
 
 
-void join_many_files_as_columns(char *filename,int insert)
+void join_many_files_as_columns(char *fname,int insert)
 {
     int i, n, m, rowcnt, bas;
-    char temp[200], *p;
+    char ctemp[200], *p;
 
     if(!sloom) {
-        if((fp[0] = fopen(filename,"w"))==NULL) {
+        if((fp[0] = fopen(fname,"w"))==NULL) {
             fprintf(stdout,"Cannot reopen infile1 to write data.\n");
             fflush(stdout);
             exit(1);
@@ -374,19 +376,19 @@ void join_many_files_as_columns(char *filename,int insert)
 
             colcnt = cntr[0]/rowcnt;                /*      Number of columns in file */
             for(m=0;m<ifactor;m++) {                        /* foreach column in row */
-                sprintf(temp,"%s ",strings[(n * colcnt) + m]);
-                strcat(errstr,temp);
+                sprintf(ctemp,"%s ",strings[(n * colcnt) + m]);
+                strcat(errstr,ctemp);
             }
             colcnt = cntr[1]/rowcnt;                /*      Number of columns in file1 */
             for(m=0;m<colcnt;m++) {                 /* foreach column in row */
-                sprintf(temp,"%s ",strings[cntr[0] + (n * colcnt) + m]);
-                strcat(errstr,temp);
+                sprintf(ctemp,"%s ",strings[cntr[0] + (n * colcnt) + m]);
+                strcat(errstr,ctemp);
             }
             colcnt = cntr[0]/rowcnt;                /*      Number of columns in file */
 
             for(m=ifactor;m<colcnt;m++) {                   /* foreach column in row */
-                sprintf(temp,"%s ",strings[(n * colcnt) + m]);
-                strcat(errstr,temp);
+                sprintf(ctemp,"%s ",strings[(n * colcnt) + m]);
+                strcat(errstr,ctemp);
             }
 
             fprintf(stdout,"%s\n",p);
@@ -404,8 +406,8 @@ void join_many_files_as_columns(char *filename,int insert)
             for(i = 0;i < infilecnt; i++) {         /* for each file */
                 colcnt = cntr[i]/rowcnt;                /*      Number of columns in file */
                 for(m=0;m<colcnt;m++) {                 /* foreach column in row */
-                    sprintf(temp,"%s ",strings[bas + (n * colcnt) + m]);
-                    strcat(errstr,temp);
+                    sprintf(ctemp,"%s ",strings[bas + (n * colcnt) + m]);
+                    strcat(errstr,ctemp);
                 }
                 bas += cntr[i];                                 /* set bas to start of next file's numbers */
             }
@@ -419,11 +421,11 @@ void join_many_files_as_columns(char *filename,int insert)
 
 /************************ CONCATENATE_FILES ****************************/
 
-void concatenate_files(char *filename)
+void concatenate_files(char *fname)
 {
     int n;
     if(!sloom) {
-        if((fp[0] = fopen(filename,"w"))==NULL) {
+        if((fp[0] = fopen(fname,"w"))==NULL) {
             fprintf(stdout,"Cannot reopen infile1 to write data.\n");
             fflush(stdout);
             exit(1);
@@ -440,11 +442,11 @@ void concatenate_files(char *filename)
 
 /************************ CONCATENATE_FILES_CYCLICALLY ****************************/
 
-void concatenate_files_cyclically(char *filename)
+void concatenate_files_cyclically(char *fname)
 {
     int n, m;
     if(!sloom) {
-        if((fp[0] = fopen(filename,"w"))==NULL) {
+        if((fp[0] = fopen(fname,"w"))==NULL) {
             fprintf(stdout,"Cannot reopen infile1 to write data.\n");
             fflush(stdout);
             exit(1);