Mercurial > hg > minc-tools
changeset 1899:07e2d66e9ccd
Eliminate all references to minc_def.h
line wrap: on
line diff
--- a/progs/coordinates/voxeltoworld.c +++ b/progs/coordinates/voxeltoworld.c @@ -10,7 +10,10 @@ @CREATED : June 13, 1994 (Peter Neelin) @MODIFIED : * $Log: voxeltoworld.c,v $ - * Revision 6.5 2004-04-27 15:38:47 bert + * Revision 6.6 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.5 2004/04/27 15:38:47 bert * Added milog_init() * * Revision 6.4 2004/02/02 18:27:51 bert @@ -65,7 +68,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/coordinates/voxeltoworld.c,v 6.5 2004-04-27 15:38:47 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/coordinates/voxeltoworld.c,v 6.6 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -73,7 +76,6 @@ #include <string.h> #include <volume_io.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE
--- a/progs/coordinates/worldtovoxel.c +++ b/progs/coordinates/worldtovoxel.c @@ -10,7 +10,10 @@ @CREATED : June 13, 1994 (Peter Neelin) @MODIFIED : * $Log: worldtovoxel.c,v $ - * Revision 6.4 2004-02-02 18:27:51 bert + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2004/02/02 18:27:51 bert * Call ParseArgv() so that version information can be output * * Revision 6.3 2001/04/24 13:38:41 neelin @@ -62,7 +65,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/coordinates/worldtovoxel.c,v 6.4 2004-02-02 18:27:51 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/coordinates/worldtovoxel.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -70,7 +73,6 @@ #include <string.h> #include <volume_io.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE
--- a/progs/minc_modify_header/minc_modify_header.c +++ b/progs/minc_modify_header/minc_modify_header.c @@ -10,7 +10,10 @@ @CREATED : March 31, 1995 (Peter Neelin) @MODIFIED : * $Log: minc_modify_header.c,v $ - * Revision 6.9 2004-06-11 15:19:34 bert + * Revision 6.10 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.9 2004/06/11 15:19:34 bert * Fix attribute append operation * * Revision 6.8 2004/05/25 21:33:51 bert @@ -75,7 +78,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/minc_modify_header/minc_modify_header.c,v 6.9 2004-06-11 15:19:34 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/minc_modify_header/minc_modify_header.c,v 6.10 2004-11-01 22:38:38 bert Exp $"; #endif #include "config.h" @@ -86,7 +89,6 @@ #include <math.h> #include <minc.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #define MINC_EXTENSION ".mnc" @@ -204,7 +206,7 @@ if (created_tempfile) { if (newfile != NULL) { (void) remove(newfile); - FREE(newfile); + free(newfile); } (void) fprintf(stderr, "Cannot edit file \"%s\" in place.\n", filename); @@ -325,8 +327,8 @@ } else if (!done_redef && attribute_exists && (total_length > 0)) { if (total_length > alloc_length) { - if (zeros != NULL) FREE(zeros); - zeros = MALLOC(total_length); + if (zeros != NULL) free(zeros); + zeros = malloc(total_length); alloc_length = total_length; for (ival=0; ival < alloc_length; ival++) zeros[ival] = '\0'; @@ -378,8 +380,8 @@ (void) miclose(mincid); /* Free stuff */ - FREE(newfile); - if (zeros != NULL) FREE(zeros); + free(newfile); + if (zeros != NULL) free(zeros); exit(EXIT_SUCCESS); } @@ -486,7 +488,7 @@ } /* Allocate a list */ - dvalues = MALLOC(sizeof(*dvalues) * num_doubles); + dvalues = malloc(sizeof(*dvalues) * num_doubles); /* Loop over values */ cur = value; @@ -528,11 +530,11 @@ attribute_list_alloc += 10; if (attribute_list == NULL) { attribute_list = - MALLOC(attribute_list_alloc * sizeof(*attribute_list)); + malloc(attribute_list_alloc * sizeof(*attribute_list)); } else { attribute_list = - REALLOC(attribute_list, + realloc(attribute_list, attribute_list_alloc * sizeof(*attribute_list)); } }
--- a/progs/mincaverage/mincaverage.c +++ b/progs/mincaverage/mincaverage.c @@ -10,7 +10,10 @@ @CREATED : April 28, 1995 (Peter Neelin) @MODIFIED : * $Log: mincaverage.c,v $ - * Revision 6.5 2004-04-27 15:38:15 bert + * Revision 6.6 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.5 2004/04/27 15:38:15 bert * Added -2 option * * Revision 6.4 2001/04/24 13:38:42 neelin @@ -68,7 +71,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincaverage/mincaverage.c,v 6.5 2004-04-27 15:38:15 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincaverage/mincaverage.c,v 6.6 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -81,15 +84,10 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include <voxel_loop.h> /* Constants */ -#ifndef public -# define public -#endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -125,30 +123,29 @@ } Norm_Data; /* Function prototypes */ -public int main(int argc, char *argv[]); -public void do_normalization(void *caller_data, long num_voxels, +static void do_normalization(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void find_mincfile_range(int mincid, double *minimum, double *maximum); -public void do_average(void *caller_data, long num_voxels, +static void find_mincfile_range(int mincid, double *minimum, double *maximum); +static void do_average(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void start_average(void *caller_data, long num_voxels, +static void start_average(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void finish_average(void *caller_data, long num_voxels, +static void finish_average(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public int get_double_list(char *dst, char *key, char *nextarg); -public char **read_file_names(char *filelist, int *num_files); +static int get_double_list(char *dst, char *key, char *nextarg); +static char **read_file_names(char *filelist, int *num_files); /* Argument variables */ int clobber = FALSE; @@ -252,7 +249,7 @@ /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { char **infiles, *outfiles[2]; int nfiles, nout; @@ -367,12 +364,12 @@ /* Save the weights */ average_data.num_weights = weights.numvalues; average_data.weights = - MALLOC(sizeof(*average_data.weights) * average_data.num_weights); + malloc(sizeof(*average_data.weights) * average_data.num_weights); for (iweight=0; iweight < average_data.num_weights; iweight++) { average_data.weights[iweight] = weights.values[iweight]; } - FREE(weights.values); + free(weights.values); } /* Check for width weighting */ @@ -420,7 +417,7 @@ (void) ncdiminq(first_mincid, dim[0], NULL, &count); average_data.num_weights = count; average_data.weights = - MALLOC(sizeof(*average_data.weights) * average_data.num_weights); + malloc(sizeof(*average_data.weights) * average_data.num_weights); /* Read in the widths */ start = 0; @@ -484,9 +481,9 @@ /* Do normalization if needed */ average_data.norm_factor = - MALLOC(sizeof(*average_data.norm_factor) * nfiles); + malloc(sizeof(*average_data.norm_factor) * nfiles); if (normalize) { - vol_mean = MALLOC(sizeof(*vol_mean) * nfiles); + vol_mean = malloc(sizeof(*vol_mean) * nfiles); loop_options = create_loop_options(); set_loop_verbose(loop_options, FALSE); #ifdef MINC2 @@ -547,7 +544,7 @@ ifile, average_data.norm_factor[ifile]); } } - FREE(vol_mean); + free(vol_mean); } else { for (ifile=0; ifile < nfiles; ifile++) { @@ -576,8 +573,8 @@ free_loop_options(loop_options); /* Free stuff */ - FREE(average_data.weights); - FREE(average_data.norm_factor); + free(average_data.weights); + free(average_data.norm_factor); exit(EXIT_SUCCESS); } @@ -595,7 +592,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_normalization(void *caller_data, long num_voxels, +static void do_normalization(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -649,7 +646,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void find_mincfile_range(int mincid, double *minimum, double *maximum) +static void find_mincfile_range(int mincid, double *minimum, double *maximum) { int varid; char *varname; @@ -724,7 +721,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_average(void *caller_data, long num_voxels, +static void do_average(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -808,7 +805,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void start_average(void *caller_data, long num_voxels, +static void start_average(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info) @@ -851,7 +848,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void finish_average(void *caller_data, long num_voxels, +static void finish_average(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info) @@ -918,7 +915,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_double_list(char *dst, char *key, char *nextarg) +static int get_double_list(char *dst, char *key, char *nextarg) { #define VECTOR_SEPARATOR ',' @@ -967,11 +964,11 @@ num_alloc += 20; if (double_list == NULL) { double_list = - MALLOC(num_alloc * sizeof(*double_list)); + malloc(num_alloc * sizeof(*double_list)); } else { double_list = - REALLOC(double_list, num_alloc * sizeof(*double_list)); + realloc(double_list, num_alloc * sizeof(*double_list)); } } double_list[num_elements-1] = dvalue; @@ -987,7 +984,7 @@ /* Update the global variables */ double_array->numvalues = num_elements; if (double_array->values != NULL) { - FREE(double_array->values); + free(double_array->values); } double_array->values = double_list; @@ -1009,7 +1006,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char **read_file_names(char *filelist, int *num_files) +static char **read_file_names(char *filelist, int *num_files) { #define FILE_NAME_ALLOC_SIZE 10 char **files; @@ -1033,7 +1030,7 @@ /* Allocate an initial array and NULL-terminate it */ array_size = FILE_NAME_ALLOC_SIZE; - files = MALLOC(sizeof(*files) * array_size); + files = malloc(sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL; @@ -1055,7 +1052,7 @@ /* Make room for names if needed */ while (nfiles >= array_size-1) { array_size += FILE_NAME_ALLOC_SIZE; - files = REALLOC(files, sizeof(*files) * array_size); + files = realloc(files, sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL;
--- a/progs/minccalc/minccalc.c +++ b/progs/minccalc/minccalc.c @@ -19,7 +19,10 @@ This is predominately a rehash of mincmath by Peter Neelin * $Log: minccalc.c,v $ - * Revision 1.10 2004-06-11 20:55:37 bert + * Revision 1.11 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 1.10 2004/06/11 20:55:37 bert * Fix for nasty bug which causes lots of bogus zero values to be inserted when minccalc is used with a file with a vector_dimension * * Revision 1.9 2004/04/27 15:37:52 bert @@ -69,7 +72,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/minccalc/minccalc.c,v 1.10 2004-06-11 20:55:37 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/minccalc/minccalc.c,v 1.11 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -84,13 +87,9 @@ #include <ParseArgv.h> #include <voxel_loop.h> #include <time_stamp.h> -#include <minc_def.h> #include "node.h" /* Constants */ -#ifndef public -# define public -#endif #ifndef TRUE # define TRUE 1 @@ -106,14 +105,14 @@ #define DEFAULT_BOOL -1 /* Function prototypes */ -public void do_math(void *caller_data, long num_voxels, +static void do_math(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public char **read_file_names(char *filelist, int *num_files); -public char *read_expression_file(char *filename); -public int get_list_option(char *dst, char *key, int argc, char **argv); +static char **read_file_names(char *filelist, int *num_files); +static char *read_expression_file(char *filename); +static int get_list_option(char *dst, char *key, int argc, char **argv); /* Argument variables */ int Output_list_size = 0; @@ -229,7 +228,7 @@ scalar_t *Output_values; /* Main program */ -public int main(int argc, char *argv[]){ +int main(int argc, char *argv[]){ char **infiles, **outfiles; int nfiles, nout; char *arg_string; @@ -255,7 +254,7 @@ /* Get output file names */ nout = (Output_list == NULL ? 1 : Output_list_size); - outfiles = MALLOC(nout * sizeof(*outfiles)); + outfiles = malloc(nout * sizeof(*outfiles)); if (Output_list == NULL) { outfiles[0] = argv[argc-1]; } @@ -343,7 +342,7 @@ Output_values = NULL; } else { - Output_values = MALLOC(Output_list_size * sizeof(*Output_values)); + Output_values = malloc(Output_list_size * sizeof(*Output_values)); for (i=0; i < Output_list_size; i++) { ident = ident_lookup(Output_list[i].symbol); scalar = new_scalar(eval_width); @@ -384,10 +383,10 @@ /* Clean up */ vector_free(A); sym_leave_scope(rootsym); - if (expr_file != NULL) FREE(expression); - FREE(outfiles); - if (Output_list != NULL) FREE(Output_list); - if (Output_values != NULL) FREE(Output_values); + if (expr_file != NULL) free(expression); + free(outfiles); + if (Output_list != NULL) free(Output_list); + if (Output_values != NULL) free(Output_values); exit(EXIT_SUCCESS); } @@ -403,7 +402,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : Thu Dec 21 17:08:40 EST 2000 (Andrew Janke - rotor@cmr.uq.edu.au) ---------------------------------------------------------------------------- */ -public void do_math(void *caller_data, long num_voxels, +static void do_math(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -492,7 +491,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char **read_file_names(char *filelist, int *num_files) +static char **read_file_names(char *filelist, int *num_files) { #define FILE_NAME_ALLOC_SIZE 10 char **files; @@ -516,7 +515,7 @@ /* Allocate an initial array and NULL-terminate it */ array_size = FILE_NAME_ALLOC_SIZE; - files = MALLOC(sizeof(*files) * array_size); + files = malloc(sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL; @@ -538,7 +537,7 @@ /* Make room for names if needed */ while (nfiles >= array_size-1) { array_size += FILE_NAME_ALLOC_SIZE; - files = REALLOC(files, sizeof(*files) * array_size); + files = realloc(files, sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL; @@ -576,7 +575,7 @@ @CREATED : May 3, 2001 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char *read_expression_file(char *filename) +static char *read_expression_file(char *filename) { struct stat statbuf; size_t size; @@ -617,7 +616,7 @@ if (size == 0) size = ALLOC_SIZE; /* Get space */ - expression = MALLOC(size * sizeof(*expression)); + expression = malloc(size * sizeof(*expression)); /* Read the expression */ ichar = 0; @@ -648,7 +647,7 @@ /* Check whether we need more space */ if (ichar >= size-1) { size += ALLOC_SIZE; - expression = REALLOC(expression, size * sizeof(expression)); + expression = realloc(expression, size * sizeof(expression)); } /* Save the character */ @@ -683,7 +682,7 @@ @CREATED : May 3, 2001 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_list_option(char *dst, char *key, int argc, char **argv) +static int get_list_option(char *dst, char *key, int argc, char **argv) /* ARGSUSED */ { enum {OPT_OUTPUT_SYMBOL} option_type; @@ -721,11 +720,11 @@ *list_alloc += 10; if (*list == NULL) { *list = - MALLOC(*list_alloc * entry_size); + malloc(*list_alloc * entry_size); } else { *list = - REALLOC(*list, + realloc(*list, *list_alloc * entry_size); } }
--- a/progs/mincconcat/mincconcat.c +++ b/progs/mincconcat/mincconcat.c @@ -11,7 +11,10 @@ @CREATED : March 7, 1995 (Peter Neelin) @MODIFIED : * $Log: mincconcat.c,v $ - * Revision 6.9 2004-04-27 15:37:13 bert + * Revision 6.10 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.9 2004/04/27 15:37:13 bert * Added -2 flag * * Revision 6.8 2001/09/18 15:32:39 neelin @@ -94,7 +97,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincconcat/mincconcat.c,v 6.9 2004-04-27 15:37:13 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincconcat/mincconcat.c,v 6.10 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -108,7 +111,6 @@ #include <ParseArgv.h> #include <time_stamp.h> #include <voxel_loop.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE @@ -173,27 +175,26 @@ } Sort_Element; /* Function prototypes */ -public int main(int argc, char *argv[]); -public void get_arginfo(int argc, char *argv[], +static void get_arginfo(int argc, char *argv[], int *num_input_files, char ***input_files, Concat_Info *concat_info); -public int get_double_list(char *dst, char *key, char *nextarg); -public void get_concat_dim_name(Concat_Info *concat_info, +static int get_double_list(char *dst, char *key, char *nextarg); +static void get_concat_dim_name(Concat_Info *concat_info, char *first_filename, int *first_mincid); -public void get_input_file_info(void *caller_data, int input_mincid, +static void get_input_file_info(void *caller_data, int input_mincid, int input_curfile, Loop_Info *loop_info); -public int get_image_dimension_id(int input_mincid, char *dimension_name); -public void do_concat(void *caller_data, long num_voxels, +static int get_image_dimension_id(int input_mincid, char *dimension_name); +static void do_concat(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void sort_coords(Concat_Info *concat_info); -public int sort_function(const void *value1, const void *value2); -public void create_concat_file(int inmincid, Concat_Info *concat_info); -private void update_history(int mincid, char *arg_string); -public char **read_file_names(char *filelist, int *num_files); +static void sort_coords(Concat_Info *concat_info); +static int sort_function(const void *value1, const void *value2); +static void create_concat_file(int inmincid, Concat_Info *concat_info); +static void update_history(int mincid, char *arg_string); +static char **read_file_names(char *filelist, int *num_files); /* Globals */ static int Sort_ascending = TRUE; @@ -201,7 +202,7 @@ /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { Concat_Info *concat_info; Loop_Options *loop_options; @@ -211,7 +212,7 @@ double valid_range[2]; /* Allocate the concat_info structure */ - concat_info = MALLOC(sizeof(*concat_info)); + concat_info = malloc(sizeof(*concat_info)); /* Get argument information */ get_arginfo(argc, argv, &num_input_files, &input_files, concat_info); @@ -263,7 +264,7 @@ /* Free stuff */ free_loop_options(loop_options); - FREE(concat_info); + free(concat_info); exit(EXIT_SUCCESS); } @@ -284,7 +285,7 @@ @CREATED : March 11, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_arginfo(int argc, char *argv[], +static void get_arginfo(int argc, char *argv[], int *num_input_files, char ***input_files, Concat_Info *concat_info) { @@ -529,18 +530,18 @@ /* Fill in coordinate info. We allocate space even if coordinates aren't specified just in case we can't get the info from the files. */ - concat_info->num_file_coords = MALLOC(sizeof(int) * (*num_input_files)); - concat_info->file_coords = MALLOC(sizeof(void *) * (*num_input_files)); - concat_info->file_widths = MALLOC(sizeof(void *) * (*num_input_files)); + concat_info->num_file_coords = malloc(sizeof(int) * (*num_input_files)); + concat_info->file_coords = malloc(sizeof(void *) * (*num_input_files)); + concat_info->file_widths = malloc(sizeof(void *) * (*num_input_files)); for (ifile=0; ifile < *num_input_files; ifile++) { concat_info->num_file_coords[ifile] = 1; - concat_info->file_coords[ifile] = MALLOC(sizeof(double)); + concat_info->file_coords[ifile] = malloc(sizeof(double)); concat_info->file_coords[ifile][0] = ((dimension_coords.numvalues > 0) ? dimension_coords.values[ifile] : dimension_start + dimension_step * ifile); if ((dimension_widths.numvalues > 0) || (dimension_width != DBL_MAX)) { - concat_info->file_widths[ifile] = MALLOC(sizeof(double)); + concat_info->file_widths[ifile] = malloc(sizeof(double)); concat_info->file_widths[ifile][0] = ((dimension_widths.numvalues > 0) ? dimension_widths.values[ifile] : dimension_width); @@ -565,7 +566,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_double_list(char *dst, char *key, char *nextarg) +static int get_double_list(char *dst, char *key, char *nextarg) { #define VECTOR_SEPARATOR ',' @@ -614,11 +615,11 @@ num_alloc += 20; if (double_list == NULL) { double_list = - MALLOC(num_alloc * sizeof(*double_list)); + malloc(num_alloc * sizeof(*double_list)); } else { double_list = - REALLOC(double_list, num_alloc * sizeof(*double_list)); + realloc(double_list, num_alloc * sizeof(*double_list)); } } double_list[num_elements-1] = dvalue; @@ -634,7 +635,7 @@ /* Update the global variables */ double_array->numvalues = num_elements; if (double_array->values != NULL) { - FREE(double_array->values); + free(double_array->values); } double_array->values = double_list; @@ -655,7 +656,7 @@ @CREATED : March 16, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_concat_dim_name(Concat_Info *concat_info, +static void get_concat_dim_name(Concat_Info *concat_info, char *first_filename, int *first_mincid) { char *filename; @@ -670,7 +671,7 @@ if (created_tempfile) { (void) remove(filename); } - FREE(filename); + free(filename); *first_mincid = input_mincid; /* Do we have to get the dimension name from the file? */ @@ -725,7 +726,7 @@ @CREATED : March 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_input_file_info(void *caller_data, int input_mincid, +static void get_input_file_info(void *caller_data, int input_mincid, int input_curfile, Loop_Info *loop_info) { Concat_Info *concat_info; @@ -757,9 +758,9 @@ /* Allocate the arrays */ (void) ncdiminq(input_mincid, dimid, dimname, &dimlength); concat_info->num_file_coords[input_curfile] = dimlength; - FREE(concat_info->file_coords[input_curfile]); + free(concat_info->file_coords[input_curfile]); concat_info->file_coords[input_curfile] = - MALLOC(sizeof(double) * dimlength); + malloc(sizeof(double) * dimlength); /* Set defaults */ if (!Sort_sequential || (input_curfile < 1)) { @@ -846,7 +847,7 @@ /* Allocate space for widths */ concat_info->file_widths[input_curfile] = - MALLOC(sizeof(double) * dimlength); + malloc(sizeof(double) * dimlength); /* Loop through indices, getting values */ for (index=0; index < dimlength; index++) { @@ -878,7 +879,7 @@ @CREATED : March 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_image_dimension_id(int input_mincid, char *dimension_name) +static int get_image_dimension_id(int input_mincid, char *dimension_name) { int dimid, ndims, dim[MAX_VAR_DIMS], idim; int found; @@ -923,7 +924,7 @@ @CREATED : March 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_concat(void *caller_data, long num_voxels, +static void do_concat(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -1058,7 +1059,7 @@ @CREATED : March 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void sort_coords(Concat_Info *concat_info) +static void sort_coords(Concat_Info *concat_info) { int ifile; Sort_Element *sort_list; @@ -1069,17 +1070,17 @@ /* Allocate space for the ordering information */ concat_info->file_to_dim_order = - MALLOC(sizeof(void *) * (concat_info->num_input_files)); + malloc(sizeof(void *) * (concat_info->num_input_files)); concat_dimension_length = 0; for (ifile=0; ifile < concat_info->num_input_files; ifile++) { concat_dimension_length += concat_info->num_file_coords[ifile]; concat_info->file_to_dim_order[ifile] = - MALLOC(sizeof(int) * concat_info->num_file_coords[ifile]); + malloc(sizeof(int) * concat_info->num_file_coords[ifile]); } concat_info->concat_dimension_length = concat_dimension_length; /* Set up sorting stuff */ - sort_list = MALLOC(sizeof(Sort_Element) * concat_dimension_length); + sort_list = malloc(sizeof(Sort_Element) * concat_dimension_length); index = 0; for (ifile=0; ifile < concat_info->num_input_files; ifile++) { for (icoord=0; icoord < concat_info->num_file_coords[ifile]; icoord++) { @@ -1154,7 +1155,7 @@ @CREATED : March 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int sort_function(const void *value1, const void *value2) +static int sort_function(const void *value1, const void *value2) { Sort_Element *element1, *element2; int return_value; @@ -1189,7 +1190,7 @@ @CREATED : March 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void create_concat_file(int inmincid, Concat_Info *concat_info) +static void create_concat_file(int inmincid, Concat_Info *concat_info) { int outmincid, outimgid, inimgid, coordid, widthid, invarid; int maxid, minid, icvid; @@ -1393,7 +1394,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -private void update_history(int mincid, char *arg_string) +static void update_history(int mincid, char *arg_string) { nc_type datatype; int att_length; @@ -1408,7 +1409,7 @@ att_length += strlen(arg_string) + 1; /* Allocate a string and get the old history */ - string = MALLOC(att_length); + string = malloc(att_length); string[0] = '\0'; (void) miattgetstr(mincid, NC_GLOBAL, MIhistory, att_length, string); @@ -1417,7 +1418,7 @@ /* Add the new command and put the new history. */ (void) strcat(string, arg_string); (void) miattputstr(mincid, NC_GLOBAL, MIhistory, string); - FREE(string); + free(string); } @@ -1436,7 +1437,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char **read_file_names(char *filelist, int *num_files) +static char **read_file_names(char *filelist, int *num_files) { #define FILE_NAME_ALLOC_SIZE 10 char **files; @@ -1460,7 +1461,7 @@ /* Allocate an initial array and NULL-terminate it */ array_size = FILE_NAME_ALLOC_SIZE; - files = MALLOC(sizeof(*files) * array_size); + files = malloc(sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL; @@ -1482,7 +1483,7 @@ /* Make room for names if needed */ while (nfiles >= array_size-1) { array_size += FILE_NAME_ALLOC_SIZE; - files = REALLOC(files, sizeof(*files) * array_size); + files = realloc(files, sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL;
--- a/progs/mincconvert/mincconvert.c +++ b/progs/mincconvert/mincconvert.c @@ -10,7 +10,10 @@ @CREATED : 2003-12-17 @MODIFIED : * $Log: mincconvert.c,v $ - * Revision 1.2 2004-09-09 19:25:32 bert + * Revision 1.3 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 1.2 2004/09/09 19:25:32 bert * Force V1 file format creation if -2 not specified * * Revision 1.1 2004/04/27 15:27:57 bert @@ -29,7 +32,7 @@ express or implied warranty. ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincconvert/mincconvert.c,v 1.2 2004-09-09 19:25:32 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincconvert/mincconvert.c,v 1.3 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -37,7 +40,6 @@ #include <string.h> #include <minc.h> #include <ParseArgv.h> -#include <minc_def.h> #include <time_stamp.h> int clobber = 0;
--- a/progs/minccopy/minccopy.c +++ b/progs/minccopy/minccopy.c @@ -11,7 +11,10 @@ @CREATED : May 13, 1993 (Peter Neelin) @MODIFIED : * $Log: minccopy.c,v $ - * Revision 6.1 1999-10-19 14:45:20 neelin + * Revision 6.2 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.1 1999/10/19 14:45:20 neelin * Fixed Log subsitutions for CVS * * Revision 6.0 1997/09/12 13:23:34 neelin @@ -51,7 +54,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/minccopy/minccopy.c,v 6.1 1999-10-19 14:45:20 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/minccopy/minccopy.c,v 6.2 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -59,7 +62,6 @@ #include <string.h> #include <minc.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE @@ -155,7 +157,7 @@ } /* Allocate space */ - data = MALLOC(size); + data = malloc(size); /* Set up image conversion */ if (!copy_pixel_values) { @@ -203,7 +205,7 @@ (void) miicv_free(outicv); (void) miicv_free(inicv); } - FREE(data); + free(data); exit(EXIT_SUCCESS); }
--- a/progs/mincexample/mincexample1.c +++ b/progs/mincexample/mincexample1.c @@ -10,7 +10,10 @@ @CREATED : August 24, 1993 (Peter Neelin) @MODIFIED : * $Log: mincexample1.c,v $ - * Revision 6.4 2001-09-18 15:32:46 neelin + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2001/09/18 15:32:46 neelin * Create image variable last to allow big images and to fix compatibility * problems with 2.3 and 3.x. * @@ -72,7 +75,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincexample/mincexample1.c,v 6.4 2001-09-18 15:32:46 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincexample/mincexample1.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -81,22 +84,7 @@ #include <minc.h> #include <time_stamp.h> -/* Include the standard minc definitions for cross-platform compilation - if we are compiling the package, otherwise, just define MALLOC, - FREE, EXIT_SUCCESS and EXIT_FAILURE */ -#ifdef COMPILING_MINC_PACKAGE -# include <minc_def.h> -#else -# define MALLOC(size) ((void *) malloc(size)) -# define FREE(ptr) free(ptr) -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# define EXIT_FAILURE 1 -# endif -#endif - /* Constants */ -#define public #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -126,22 +114,22 @@ } Volume; /* Function prototypes */ -public void load_volume(char *infile, Volume *volume); -public void get_dimension_info(char *infile, int icvid, Volume *volume); -public void setup_icv(int icvid); -public void read_volume_data(int icvid, Volume *volume); -public void save_volume(char *infile, char *outfile, char *arg_string, +static void load_volume(char *infile, Volume *volume); +static void get_dimension_info(char *infile, int icvid, Volume *volume); +static void setup_icv(int icvid); +static void read_volume_data(int icvid, Volume *volume); +static void save_volume(char *infile, char *outfile, char *arg_string, Volume *volume); -public void setup_variables(int inmincid, int mincid, Volume *volume, +static void setup_variables(int inmincid, int mincid, Volume *volume, char *arg_string); -public void setup_image_variables(int inmincid, int mincid, +static void setup_image_variables(int inmincid, int mincid, int ndims, int dim[]); -public void update_history(int mincid, char *arg_string); -public void write_volume_data(int icvid, Volume *volume); +static void update_history(int mincid, char *arg_string); +static void write_volume_data(int icvid, Volume *volume); /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { char *infile, *outfile; Volume volume; @@ -195,7 +183,7 @@ @CREATED : August 22, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void load_volume(char *infile, Volume *volume) +static void load_volume(char *infile, Volume *volume) { int icvid, mincid; @@ -233,7 +221,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_icv(int icvid) +static void setup_icv(int icvid) { /* Set desired type */ (void) miicv_setint(icvid, MI_ICV_TYPE, NC_BYTE); @@ -274,7 +262,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_dimension_info(char *infile, int icvid, Volume *volume) +static void get_dimension_info(char *infile, int icvid, Volume *volume) { int mincid, imgid, varid; int idim, ndims; @@ -354,7 +342,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void read_volume_data(int icvid, Volume *volume) +static void read_volume_data(int icvid, Volume *volume) { long start[MAX_VAR_DIMS], count[MAX_VAR_DIMS]; @@ -365,7 +353,7 @@ count[2] = volume->ncolumns; /* Allocate space for the data */ - volume->data = MALLOC(sizeof(*volume->data) * + volume->data = malloc(sizeof(*volume->data) * volume->ncolumns * volume->nrows * volume->nslices); @@ -394,7 +382,7 @@ @CREATED : August 22, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void save_volume(char *infile, char *outfile, char *arg_string, +static void save_volume(char *infile, char *outfile, char *arg_string, Volume *volume) { int mincid, icvid, inmincid; @@ -449,7 +437,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_variables(int inmincid, int mincid, Volume *volume, +static void setup_variables(int inmincid, int mincid, Volume *volume, char *arg_string) { int dim[MAX_VAR_DIMS], ndims, idim, varid; @@ -534,7 +522,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_image_variables(int inmincid, int mincid, +static void setup_image_variables(int inmincid, int mincid, int ndims, int dim[]) { int imgid, maxid, minid; @@ -580,7 +568,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void update_history(int mincid, char *arg_string) +static void update_history(int mincid, char *arg_string) { nc_type datatype; int att_length; @@ -595,7 +583,7 @@ att_length += strlen(arg_string) + 1; /* Allocate a string and get the old history */ - string = MALLOC(att_length); + string = malloc(att_length); string[0] = '\0'; (void) miattgetstr(mincid, NC_GLOBAL, MIhistory, att_length, string); @@ -604,7 +592,7 @@ /* Add the new command and put the new history. */ (void) strcat(string, arg_string); (void) miattputstr(mincid, NC_GLOBAL, MIhistory, string); - FREE(string); + free(string); } @@ -621,7 +609,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void write_volume_data(int icvid, Volume *volume) +static void write_volume_data(int icvid, Volume *volume) { int mincid; long start[MAX_VAR_DIMS], count[MAX_VAR_DIMS]; @@ -645,7 +633,7 @@ (void) miicv_put(icvid, start, count, volume->data); /* Free space for the data */ - FREE(volume->data); + free(volume->data); }
--- a/progs/mincexample/mincexample2.c +++ b/progs/mincexample/mincexample2.c @@ -12,7 +12,10 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : * $Log: mincexample2.c,v $ - * Revision 6.4 2001-09-18 15:32:46 neelin + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2001/09/18 15:32:46 neelin * Create image variable last to allow big images and to fix compatibility * problems with 2.3 and 3.x. * @@ -60,7 +63,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincexample/mincexample2.c,v 6.4 2001-09-18 15:32:46 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincexample/mincexample2.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -69,22 +72,7 @@ #include <minc.h> #include <time_stamp.h> -/* Include the standard minc definitions for cross-platform compilation - if we are compiling the package, otherwise, just define MALLOC, - FREE, EXIT_SUCCESS and EXIT_FAILURE */ -#ifdef COMPILING_MINC_PACKAGE -# include <minc_def.h> -#else -# define MALLOC(size) ((void *) malloc(size)) -# define FREE(ptr) free(ptr) -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# define EXIT_FAILURE 1 -# endif -#endif - /* Constants */ -#define public #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -113,29 +101,29 @@ } Volume_Info; /* Function prototypes */ -public int get_volume_info(char *infile, Volume_Info *volume_info); -public void setup_input_icv(int icvid); -public void get_dimension_info(char *infile, int icvid, +static int get_volume_info(char *infile, Volume_Info *volume_info); +static void setup_input_icv(int icvid); +static void get_dimension_info(char *infile, int icvid, Volume_Info *volume_info); -public void close_volume(int icvid); -public void get_volume_slice(int icvid, Volume_Info *volume_info, +static void close_volume(int icvid); +static void get_volume_slice(int icvid, Volume_Info *volume_info, int slice_num, unsigned char *image); -public int save_volume_info(int input_icvid, char *outfile, char *arg_string, +static int save_volume_info(int input_icvid, char *outfile, char *arg_string, Volume_Info *volume_info); -public void setup_output_icv(int icvid); -public void setup_variables(int inmincid, int mincid, +static void setup_output_icv(int icvid); +static void setup_variables(int inmincid, int mincid, Volume_Info *volume_info, char *arg_string); -public void setup_image_variables(int inmincid, int mincid, +static void setup_image_variables(int inmincid, int mincid, int ndims, int dim[]); -public void update_history(int mincid, char *arg_string); -public void save_volume_slice(int icvid, Volume_Info *volume_info, +static void update_history(int mincid, char *arg_string); +static void save_volume_slice(int icvid, Volume_Info *volume_info, int slice_num, unsigned char *image, double slice_min, double slice_max); /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { char *infile, *outfile; Volume_Info volume_info; @@ -181,7 +169,7 @@ &volume_info); /* Loop through slices, copying them */ - image = MALLOC(volume_info.nrows * volume_info.ncolumns * sizeof(*image)); + image = malloc(volume_info.nrows * volume_info.ncolumns * sizeof(*image)); for (islice=0; islice < volume_info.nslices; islice++) { get_volume_slice(input_icvid, &volume_info, islice, image); save_volume_slice(output_icvid, &volume_info, islice, image, @@ -191,7 +179,7 @@ /* Free up image and close files */ close_volume(input_icvid); close_volume(output_icvid); - FREE(image); + free(image); exit(EXIT_SUCCESS); } @@ -208,7 +196,7 @@ @CREATED : August 22, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_volume_info(char *infile, Volume_Info *volume_info) +static int get_volume_info(char *infile, Volume_Info *volume_info) { int icvid, mincid; @@ -244,7 +232,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_input_icv(int icvid) +static void setup_input_icv(int icvid) { /* Set desired type */ (void) miicv_setint(icvid, MI_ICV_TYPE, NC_BYTE); @@ -286,7 +274,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_dimension_info(char *infile, int icvid, +static void get_dimension_info(char *infile, int icvid, Volume_Info *volume_info) { int mincid, imgid, varid; @@ -384,7 +372,7 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void close_volume(int icvid) +static void close_volume(int icvid) { int mincid; @@ -414,7 +402,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_volume_slice(int icvid, Volume_Info *volume_info, +static void get_volume_slice(int icvid, Volume_Info *volume_info, int slice_num, unsigned char *image) { long start[MAX_VAR_DIMS], count[MAX_VAR_DIMS]; @@ -461,7 +449,7 @@ @CREATED : August 22, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int save_volume_info(int input_icvid, char *outfile, char *arg_string, +static int save_volume_info(int input_icvid, char *outfile, char *arg_string, Volume_Info *volume_info) { int mincid, icvid, inmincid; @@ -500,7 +488,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_output_icv(int icvid) +static void setup_output_icv(int icvid) { /* Set desired type */ (void) miicv_setint(icvid, MI_ICV_TYPE, NC_BYTE); @@ -530,7 +518,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_variables(int inmincid, int mincid, +static void setup_variables(int inmincid, int mincid, Volume_Info *volume_info, char *arg_string) { @@ -619,7 +607,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_image_variables(int inmincid, int mincid, +static void setup_image_variables(int inmincid, int mincid, int ndims, int dim[]) { int imgid, maxid, minid; @@ -665,7 +653,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void update_history(int mincid, char *arg_string) +static void update_history(int mincid, char *arg_string) { nc_type datatype; int att_length; @@ -680,7 +668,7 @@ att_length += strlen(arg_string) + 1; /* Allocate a string and get the old history */ - string = MALLOC(att_length); + string = malloc(att_length); string[0] = '\0'; (void) miattgetstr(mincid, NC_GLOBAL, MIhistory, att_length, string); @@ -689,7 +677,7 @@ /* Add the new command and put the new history. */ (void) strcat(string, arg_string); (void) miattputstr(mincid, NC_GLOBAL, MIhistory, string); - FREE(string); + free(string); } @@ -711,7 +699,7 @@ @CREATED : August 26, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void save_volume_slice(int icvid, Volume_Info *volume_info, +static void save_volume_slice(int icvid, Volume_Info *volume_info, int slice_num, unsigned char *image, double slice_min, double slice_max) {
--- a/progs/mincexpand/mincexpand.c +++ b/progs/mincexpand/mincexpand.c @@ -10,7 +10,10 @@ @CREATED : January 20, 1995 (Peter Neelin) @MODIFIED : * $Log: mincexpand.c,v $ - * Revision 6.1 1999-10-19 14:45:22 neelin + * Revision 6.2 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.1 1999/10/19 14:45:22 neelin * Fixed Log subsitutions for CVS * * Revision 6.0 1997/09/12 13:24:16 neelin @@ -50,7 +53,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincexpand/mincexpand.c,v 6.1 1999-10-19 14:45:22 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincexpand/mincexpand.c,v 6.2 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -58,7 +61,6 @@ #include <string.h> #include <minc.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE @@ -122,7 +124,7 @@ } /* Free the temporary file name string */ - FREE(newfile); + free(newfile); exit(EXIT_SUCCESS); }
--- a/progs/mincextract/mincextract.c +++ b/progs/mincextract/mincextract.c @@ -10,7 +10,10 @@ @CREATED : June 10, 1993 (Peter Neelin) @MODIFIED : * $Log: mincextract.c,v $ - * Revision 6.4 2003-10-28 20:31:19 bert + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2003/10/28 20:31:19 bert * Remove two unused variables * * Revision 6.3 2001/08/16 16:41:35 neelin @@ -85,7 +88,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincextract/mincextract.c,v 6.4 2003-10-28 20:31:19 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincextract/mincextract.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -96,17 +99,13 @@ #include <float.h> #include <ctype.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif -#ifndef public -# define public -# define private static -#endif + #define VECTOR_SEPARATOR ',' #define TYPE_ASCII 0 #define TYPE_BYTE 1 @@ -120,7 +119,7 @@ }; /* Function declarations */ -public int get_arg_vector(char *dst, char *key, char *nextArg); +static int get_arg_vector(char *dst, char *key, char *nextArg); /* Variables used for argument parsing */ int arg_odatatype = TYPE_ASCII; @@ -374,7 +373,7 @@ element_size = nctypelen(output_datatype); /* Allocate space */ - data = MALLOC(element_size*nelements); + data = malloc(element_size*nelements); /* Loop over input slices */ @@ -412,7 +411,7 @@ /* Clean up */ (void) miclose(mincid); (void) miicv_free(icvid); - FREE(data); + free(data); exit(EXIT_SUCCESS); } @@ -433,7 +432,7 @@ @CREATED : June 10, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_arg_vector(char *dst, char *key, char *nextArg) +static int get_arg_vector(char *dst, char *key, char *nextArg) /* ARGSUSED */ {
--- a/progs/mincinfo/mincinfo.c +++ b/progs/mincinfo/mincinfo.c @@ -10,7 +10,10 @@ @CREATED : May 19, 1993 (Peter Neelin) @MODIFIED : * $Log: mincinfo.c,v $ - * Revision 6.4 2001-10-31 19:40:21 neelin + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2001/10/31 19:40:21 neelin * Fixed bug in printing of sign for default output - this was introduced * in the change to miget_datatype. * @@ -79,7 +82,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincinfo/mincinfo.c,v 6.4 2001-10-31 19:40:21 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincinfo/mincinfo.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -89,10 +92,8 @@ #include <float.h> #include <minc.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ -#define public #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -124,12 +125,11 @@ #define RTN_ERR(code) if ((code) == MI_ERROR) {return MI_ERROR;} /* Function prototypes */ -public int main(int argc, char *argv[]); -public int process_file( char* filename, int header_only ); -public int get_option(char *dst, char *key, char *nextarg); -public int report_error(void); -public int get_attname(int mincid, char *string, int *varid, char *name); -public int print_image_info(char *filename, int mincid); +static int process_file( char* filename, int header_only ); +static int get_option(char *dst, char *key, char *nextarg); +static int report_error(void); +static int get_attname(int mincid, char *string, int *varid, char *name); +static int print_image_info(char *filename, int mincid); /* Variables used for argument parsing */ char *error_string = NULL; Option_type option_list[MAX_NUM_OPTIONS] = {ENDLIST}; @@ -164,7 +164,7 @@ /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int ioption, ifile, header_only; int ret_value = EXIT_SUCCESS; @@ -224,7 +224,7 @@ @CREATED : April 25, 2000 (Steve Robbins) @MODIFIED : ---------------------------------------------------------------------------- */ -public int process_file( char* filename, int header_only ) +static int process_file( char* filename, int header_only ) { int mincid, varid, dimid; int ndims, dims[MAX_VAR_DIMS]; @@ -330,23 +330,23 @@ row_length = length; } if (datatype==NC_CHAR) { - cdata = MALLOC(var_length*sizeof(char)); + cdata = malloc(var_length*sizeof(char)); CHK_ERR(ncvarget(mincid, varid, start, count, cdata)); for (ival=0; ival<var_length; ival++) { (void) putchar((int) cdata[ival]); if (((ival+1) % row_length) == 0) (void) putchar((int)'\n'); } - FREE(cdata); + free(cdata); } else { - ddata = MALLOC(var_length*sizeof(double)); + ddata = malloc(var_length*sizeof(double)); CHK_ERR(mivarget(mincid, varid, start, count, NC_DOUBLE, NULL, ddata)); for (ival=0; ival<var_length; ival++) { (void) printf("%.20g\n", ddata[ival]); } - FREE(ddata); + free(ddata); } break; case ATTTYPE: @@ -358,21 +358,21 @@ CHK_ERR(get_attname(mincid, string, &varid, name)); CHK_ERR(ncattinq(mincid, varid, name, &datatype, &att_length)); if (datatype == NC_CHAR) { - cdata = MALLOC((att_length+1)*sizeof(char)); + cdata = malloc((att_length+1)*sizeof(char)); if (miattgetstr(mincid, varid, name, att_length+1, cdata)==NULL) {REPORT_ERROR} (void) printf("%s\n", cdata); - FREE(cdata); + free(cdata); } else { - ddata = MALLOC(att_length * sizeof(double)); + ddata = malloc(att_length * sizeof(double)); CHK_ERR(miattget(mincid, varid, name, NC_DOUBLE, att_length, ddata, NULL)); for (iatt=0; iatt<att_length; iatt++) { (void) printf("%.20g ", ddata[iatt]); } (void) printf("\n"); - FREE(ddata); + free(ddata); } break; default: @@ -402,7 +402,7 @@ @CREATED : May 19, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_option(char *dst, char *key, char *nextarg) +static int get_option(char *dst, char *key, char *nextarg) /* ARGSUSED */ { Option_code code; @@ -454,7 +454,7 @@ @CREATED : May 19, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int report_error(void) +static int report_error(void) { if (error_string == NULL) { (void) fprintf(stderr, "Error reading file.\n"); @@ -481,7 +481,7 @@ @CREATED : May 19, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_attname(int mincid, char *string, int *varid, char *name) +static int get_attname(int mincid, char *string, int *varid, char *name) { #define ATT_SEP_CHAR ':' @@ -530,7 +530,7 @@ @CREATED : May 19, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int print_image_info(char *filename, int mincid) +static int print_image_info(char *filename, int mincid) { int imgid, ndims, dim[MAX_VAR_DIMS], varid; nc_type datatype;
--- a/progs/minclookup/minclookup.c +++ b/progs/minclookup/minclookup.c @@ -11,7 +11,10 @@ @CREATED : December 6, 1994 (Peter Neelin) @MODIFIED : * $Log: minclookup.c,v $ - * Revision 6.4 2004-05-20 21:52:08 bert + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2004/05/20 21:52:08 bert * Revised man pages * * Revision 6.3 2001/04/24 13:38:43 neelin @@ -66,7 +69,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/minclookup/minclookup.c,v 6.4 2004-05-20 21:52:08 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/minclookup/minclookup.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -78,13 +81,8 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include <voxel_loop.h> -#ifndef public -# define public -#endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -120,21 +118,21 @@ } Sort_Key; /* Function prototypes */ -public Lookup_Table *read_lookup_table(char *lookup_file, char *lookup_string); -public double *get_values_from_string(char *string, int array_size, +static Lookup_Table *read_lookup_table(char *lookup_file, char *lookup_string); +static double *get_values_from_string(char *string, int array_size, double *array, int *nread); -public double *get_null_value(int vector_length, char *null_value_string); -public void get_full_range(int mincid, double lookup_range[2]); -public void do_lookup(void *caller_data, long num_voxels, +static double *get_null_value(int vector_length, char *null_value_string); +static void get_full_range(int mincid, double lookup_range[2]); +static void do_lookup(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void lookup_in_table(double index, Lookup_Table *lookup_table, +static void lookup_in_table(double index, Lookup_Table *lookup_table, int discrete_values, double null_value[], double output_value[]); -private char *get_next_line(char *line, int linelen, FILE *fp, char **string); -private int sorting_function(const void *value1, const void *value2); +static char *get_next_line(char *line, int linelen, FILE *fp, char **string); +static int sorting_function(const void *value1, const void *value2); /* Lookup tables */ static double gray_lookup_values[] = { @@ -361,10 +359,10 @@ do_lookup, (void *) &lookup_data); /* Free stuff */ - if (lookup_data.null_value != NULL) FREE(lookup_data.null_value); + if (lookup_data.null_value != NULL) free(lookup_data.null_value); if (lookup_data.lookup_table->free_data) { - FREE(lookup_data.lookup_table->table); - FREE(lookup_data.lookup_table); + free(lookup_data.lookup_table->table); + free(lookup_data.lookup_table); } exit(EXIT_SUCCESS); @@ -386,7 +384,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public Lookup_Table *read_lookup_table(char *lookup_filename, +static Lookup_Table *read_lookup_table(char *lookup_filename, char *lookup_string) { Lookup_Table *lookup_table; @@ -433,10 +431,10 @@ row = get_values_from_string(line, 0, NULL, &table_nvalues); if (table_nvalues < 2) { (void) fprintf(stderr, "First line has fewer than 2 values.\n"); - if (row != NULL) FREE(row); + if (row != NULL) free(row); exit(EXIT_FAILURE); } - table = MALLOC(sizeof(*table) * table_nvalues); + table = malloc(sizeof(*table) * table_nvalues); for (ivalue=0; ivalue < table_nvalues; ivalue++) table[ivalue] = row[ivalue]; nentries++; @@ -447,11 +445,11 @@ (void) fprintf(stderr, "Wrong number of values on line %d.\n", nentries+1); - FREE(row); - FREE(table); + free(row); + free(table); exit(EXIT_FAILURE); } - table = REALLOC(table, sizeof(*table) * table_nvalues * (nentries+1)); + table = realloc(table, sizeof(*table) * table_nvalues * (nentries+1)); for (ivalue=0; ivalue < table_nvalues; ivalue++) { table[ivalue + nentries*table_nvalues] = row[ivalue]; } @@ -473,7 +471,7 @@ if (need_sort) { /* Set up sorting table */ - sort_table = MALLOC(sizeof(*sort_table) * nentries); + sort_table = malloc(sizeof(*sort_table) * nentries); for (ientry=0; ientry < nentries; ientry++) { sort_table[ientry].key = table[ientry*table_nvalues]; sort_table[ientry].index = ientry; @@ -484,7 +482,7 @@ sorting_function); /* Copy the table */ - new_table = MALLOC(sizeof(*table) * table_nvalues * nentries); + new_table = malloc(sizeof(*table) * table_nvalues * nentries); for (ientry=0; ientry < nentries; ientry++) { new_offset = ientry * table_nvalues; old_offset = sort_table[ientry].index * table_nvalues; @@ -492,13 +490,13 @@ new_table[new_offset + ivalue] = table[old_offset + ivalue]; } } - FREE(table); + free(table); table = new_table; - FREE(sort_table); + free(sort_table); } /* Allocate space for the lookup table and set initial values */ - lookup_table = MALLOC(sizeof(*lookup_table)); + lookup_table = malloc(sizeof(*lookup_table)); lookup_table->free_data = TRUE; lookup_table->nentries = nentries; lookup_table->vector_length = table_nvalues - 1; @@ -525,7 +523,7 @@ @MODIFIED : ---------------------------------------------------------------------------- */ #define LOOKUP_LINE_SEPARATOR ';' -private char *get_next_line(char *line, int linelen, FILE *fp, char **string) +static char *get_next_line(char *line, int linelen, FILE *fp, char **string) { int count; @@ -577,7 +575,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -private int sorting_function(const void *value1, const void *value2) +static int sorting_function(const void *value1, const void *value2) { Sort_Key *key1, *key2; @@ -615,7 +613,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public double *get_values_from_string(char *string, int array_size, +static double *get_values_from_string(char *string, int array_size, double *array, int *nread) { #define VECTOR_SEPARATOR ',' @@ -648,7 +646,7 @@ if (cur == prev) { *nread = 0; if (array_size <= 0 && array != NULL) { - FREE(array); + free(array); } return NULL; } @@ -659,10 +657,10 @@ if (array_size <= 0) { num_alloc += 1; if (array == NULL) { - array = MALLOC(num_alloc * sizeof(*array)); + array = malloc(num_alloc * sizeof(*array)); } else { - array = REALLOC(array, num_alloc * sizeof(*array)); + array = realloc(array, num_alloc * sizeof(*array)); } } else { @@ -699,7 +697,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public double *get_null_value(int vector_length, char *string) +static double *get_null_value(int vector_length, char *string) { int num_read; double *values; @@ -712,7 +710,7 @@ /* Check the number of values read */ if (num_read != vector_length) { - if (values != NULL) FREE(values); + if (values != NULL) free(values); (void) fprintf(stderr, "Null value does not match lookup table (%d values).\n", num_read); @@ -734,7 +732,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_full_range(int mincid, double range[2]) +static void get_full_range(int mincid, double range[2]) { char *string; int varid; @@ -771,7 +769,7 @@ num_values *= length; } if (num_values > 0) { - values = MALLOC(num_values * sizeof(*values)); + values = malloc(num_values * sizeof(*values)); (void) mivarget(mincid, varid, start, count, NC_DOUBLE, NULL, values); *extreme = values[0]; @@ -779,7 +777,7 @@ if ((values[ivalue] * sign) > (*extreme * sign)) *extreme = values[ivalue]; } - FREE(values); + free(values); } } /* If variable is found */ @@ -811,7 +809,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_lookup(void *caller_data, long num_voxels, +static void do_lookup(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -892,7 +890,7 @@ @CREATED : December 8, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void lookup_in_table(double index, Lookup_Table *lookup_table, +static void lookup_in_table(double index, Lookup_Table *lookup_table, int discrete_values, double null_value[], double output_value[]) {
--- a/progs/mincmakescalar/mincmakescalar.c +++ b/progs/mincmakescalar/mincmakescalar.c @@ -10,7 +10,10 @@ @CREATED : August 7, 1997 (Peter Neelin) @MODIFIED : * $Log: mincmakescalar.c,v $ - * Revision 6.4 2004-04-27 15:32:33 bert + * Revision 6.5 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.4 2004/04/27 15:32:33 bert * Added -2 option * * Revision 6.3 2001/04/24 13:38:43 neelin @@ -40,7 +43,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincmakescalar/mincmakescalar.c,v 6.4 2004-04-27 15:32:33 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincmakescalar/mincmakescalar.c,v 6.5 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -52,13 +55,8 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include <voxel_loop.h> -#ifndef public -# define public -#endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -87,13 +85,13 @@ } Program_Data; /* Function prototypes */ -public void do_makescalar(void *caller_data, long num_voxels, +static void do_makescalar(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public int get_double_list(char *dst, char *key, char *nextarg); -public long get_vector_length(int mincid); +static int get_double_list(char *dst, char *key, char *nextarg); +static long get_vector_length(int mincid); /* Argument variables */ int clobber = FALSE; @@ -206,7 +204,7 @@ program_data.conversion_type = conversion_type; program_data.num_coefficients = linear_coefficients.numvalues; program_data.linear_coefficients = - MALLOC(linear_coefficients.numvalues * + malloc(linear_coefficients.numvalues * sizeof(*program_data.linear_coefficients)); for (ivalue=0; ivalue < linear_coefficients.numvalues; ivalue++) { program_data.linear_coefficients[ivalue] = @@ -252,10 +250,10 @@ /* Free stuff */ if (program_data.linear_coefficients != NULL) { - FREE(program_data.linear_coefficients); + free(program_data.linear_coefficients); } if (linear_coefficients.values != NULL) { - FREE(linear_coefficients.values); + free(linear_coefficients.values); } exit(EXIT_SUCCESS); @@ -282,7 +280,7 @@ @CREATED : August 7, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_makescalar(void *caller_data, long num_voxels, +static void do_makescalar(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -386,7 +384,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_double_list(char *dst, char *key, char *nextarg) +static int get_double_list(char *dst, char *key, char *nextarg) { #define VECTOR_SEPARATOR ',' @@ -435,11 +433,11 @@ num_alloc += 20; if (double_list == NULL) { double_list = - MALLOC(num_alloc * sizeof(*double_list)); + malloc(num_alloc * sizeof(*double_list)); } else { double_list = - REALLOC(double_list, num_alloc * sizeof(*double_list)); + realloc(double_list, num_alloc * sizeof(*double_list)); } } double_list[num_elements-1] = dvalue; @@ -455,7 +453,7 @@ /* Update the global variables */ double_array->numvalues = num_elements; if (double_array->values != NULL) { - FREE(double_array->values); + free(double_array->values); } double_array->values = double_list; @@ -474,7 +472,7 @@ @CREATED : November 30, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public long get_vector_length(int mincid) +static long get_vector_length(int mincid) { int imgid; int ndims;
--- a/progs/mincmakevector/mincmakevector.c +++ b/progs/mincmakevector/mincmakevector.c @@ -11,7 +11,10 @@ @CREATED : August 11, 1997 (Peter Neelin) @MODIFIED : * $Log: mincmakevector.c,v $ - * Revision 6.5 2004-04-30 19:53:30 bert + * Revision 6.6 2004-11-01 22:38:38 bert + * Eliminate all references to minc_def.h + * + * Revision 6.5 2004/04/30 19:53:30 bert * Remove unused variable * * Revision 6.4 2004/04/27 15:32:15 bert @@ -41,7 +44,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincmakevector/mincmakevector.c,v 6.5 2004-04-30 19:53:30 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincmakevector/mincmakevector.c,v 6.6 2004-11-01 22:38:38 bert Exp $"; #endif #include <stdlib.h> @@ -53,13 +56,8 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include <voxel_loop.h> -#ifndef public -# define public -#endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -75,12 +73,12 @@ } Program_Data; /* Function prototypes */ -public void do_makevector(void *caller_data, long num_voxels, +static void do_makevector(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public long get_vector_length(int mincid); +static long get_vector_length(int mincid); /* Argument variables */ int clobber = FALSE; @@ -211,7 +209,7 @@ @CREATED : August 11, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_makevector(void *caller_data, long num_voxels, +static void do_makevector(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -255,7 +253,7 @@ @CREATED : November 30, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public long get_vector_length(int mincid) +static long get_vector_length(int mincid) { int imgid; int ndims;
--- a/progs/mincmath/mincmath.c +++ b/progs/mincmath/mincmath.c @@ -10,7 +10,10 @@ @CREATED : April 28, 1995 (Peter Neelin) @MODIFIED : * $Log: mincmath.c,v $ - * Revision 6.6 2004-04-27 15:31:45 bert + * Revision 6.7 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.6 2004/04/27 15:31:45 bert * Added -2 option * * Revision 6.5 2001/04/24 13:38:44 neelin @@ -69,7 +72,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincmath/mincmath.c,v 6.6 2004-04-27 15:31:45 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincmath/mincmath.c,v 6.7 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -81,15 +84,10 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include <voxel_loop.h> /* Constants */ -#ifndef public -# define public -#endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -163,28 +161,27 @@ } Math_Data; /* Function prototypes */ -public int main(int argc, char *argv[]); -public void do_math(void *caller_data, long num_voxels, +static void do_math(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void accum_math(void *caller_data, long num_voxels, +static void accum_math(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void start_math(void *caller_data, long num_voxels, +static void start_math(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public void end_math(void *caller_data, long num_voxels, +static void end_math(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info); -public char **read_file_names(char *filelist, int *num_files); +static char **read_file_names(char *filelist, int *num_files); /* Argument variables */ int clobber = FALSE; @@ -356,7 +353,7 @@ /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { char **infiles, **outfiles; int nfiles, nout; @@ -520,7 +517,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_math(void *caller_data, long num_voxels, +static void do_math(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -709,7 +706,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void accum_math(void *caller_data, long num_voxels, +static void accum_math(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -808,7 +805,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void start_math(void *caller_data, long num_voxels, +static void start_math(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info) @@ -860,7 +857,7 @@ @CREATED : April 25, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void end_math(void *caller_data, long num_voxels, +static void end_math(void *caller_data, long num_voxels, int output_num_buffers, int output_vector_length, double *output_data[], Loop_Info *loop_info) @@ -910,7 +907,7 @@ @CREATED : March 8, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char **read_file_names(char *filelist, int *num_files) +static char **read_file_names(char *filelist, int *num_files) { #define FILE_NAME_ALLOC_SIZE 10 char **files; @@ -934,7 +931,7 @@ /* Allocate an initial array and NULL-terminate it */ array_size = FILE_NAME_ALLOC_SIZE; - files = MALLOC(sizeof(*files) * array_size); + files = malloc(sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL; @@ -956,7 +953,7 @@ /* Make room for names if needed */ while (nfiles >= array_size-1) { array_size += FILE_NAME_ALLOC_SIZE; - files = REALLOC(files, sizeof(*files) * array_size); + files = realloc(files, sizeof(*files) * array_size); if (files == NULL) { (void) fprintf(stderr, "Error allocating memory\n"); return NULL;
--- a/progs/mincresample/mincresample.c +++ b/progs/mincresample/mincresample.c @@ -11,7 +11,10 @@ @CREATED : February 8, 1993 (Peter Neelin) @MODIFIED : * $Log: mincresample.c,v $ - * Revision 6.15 2004-04-30 19:53:40 bert + * Revision 6.16 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.15 2004/04/30 19:53:40 bert * Remove unused variable * * Revision 6.14 2004/04/30 18:52:49 bert @@ -171,7 +174,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincresample/mincresample.c,v 6.15 2004-04-30 19:53:40 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincresample/mincresample.c,v 6.16 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -184,7 +187,6 @@ #include <ParseArgv.h> #include <time_stamp.h> #include <volume_io.h> -#include <minc_def.h> #include <convert_origin_to_start.h> #include "mincresample.h" @@ -199,7 +201,7 @@ /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { VVolume in_vol_struct, out_vol_struct; VVolume *in_vol = &in_vol_struct, *out_vol = &out_vol_struct; @@ -236,7 +238,7 @@ @CREATED : February 8, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_arginfo(int argc, char *argv[], +static void get_arginfo(int argc, char *argv[], Program_Flags *program_flags, VVolume *in_vol, VVolume *out_vol, General_transform *transformation) @@ -491,7 +493,7 @@ delete_general_transform(&input_transformation); /* Check input file for default argument information */ - in_vol->file = MALLOC(sizeof(File_Info)); + in_vol->file = malloc(sizeof(File_Info)); get_file_info(infile, FALSE, &input_volume_def, in_vol->file); transform_volume_def((transform_input_sampling ? &args.transform_info : NULL), @@ -521,15 +523,15 @@ } /* Save the voxel_to_world transformation information */ - in_vol->voxel_to_world = MALLOC(sizeof(General_transform)); - in_vol->world_to_voxel = MALLOC(sizeof(General_transform)); + in_vol->voxel_to_world = malloc(sizeof(General_transform)); + in_vol->world_to_voxel = malloc(sizeof(General_transform)); get_voxel_to_world_transf(&input_volume_def, in_vol->voxel_to_world); create_inverse_general_transform(in_vol->voxel_to_world, in_vol->world_to_voxel); /* Get input volume data information */ in_vol->slice = NULL; - in_vol->volume = MALLOC(sizeof(Volume_Data)); + in_vol->volume = malloc(sizeof(Volume_Data)); in_vol->volume->datatype = in_vol->file->datatype; in_vol->volume->is_signed = in_vol->file->is_signed; in_vol->volume->vrange[0] = in_vol->file->vrange[0]; @@ -575,14 +577,14 @@ total_size *= size; in_vol->volume->size[index] = size; } - in_vol->volume->data = MALLOC((size_t) total_size * + in_vol->volume->data = malloc((size_t) total_size * nctypelen(in_vol->volume->datatype)); /* Get space for slice scale and offset */ in_vol->volume->scale = - MALLOC(sizeof(double) * in_vol->volume->size[SLC_AXIS]); + malloc(sizeof(double) * in_vol->volume->size[SLC_AXIS]); in_vol->volume->offset = - MALLOC(sizeof(double) * in_vol->volume->size[SLC_AXIS]); + malloc(sizeof(double) * in_vol->volume->size[SLC_AXIS]); /* Save the program flags */ *program_flags = args.flags; @@ -594,7 +596,7 @@ /* Explicitly force output files to have regular spacing */ for (idim=0; idim < WORLD_NDIMS; idim++) { if (args.volume_def.coords[idim] != NULL) { - FREE(args.volume_def.coords[idim]); + free(args.volume_def.coords[idim]); args.volume_def.coords[idim] = NULL; } } @@ -622,7 +624,7 @@ } /* Set up the file description for the output file */ - out_vol->file = MALLOC(sizeof(File_Info)); + out_vol->file = malloc(sizeof(File_Info)); out_vol->file->ndims = in_vol->file->ndims; out_vol->file->datatype = args.datatype; out_vol->file->is_signed = args.is_signed; @@ -636,7 +638,7 @@ /* Get space for output slice */ out_vol->volume = NULL; - out_vol->slice = MALLOC(sizeof(Slice_Data)); + out_vol->slice = malloc(sizeof(Slice_Data)); /* Loop through list of axes, getting size of volume and slice */ total_size = 1; @@ -659,7 +661,7 @@ total_size *= size; } } - out_vol->slice->data = MALLOC((size_t) total_size * sizeof(double)); + out_vol->slice->data = malloc((size_t) total_size * sizeof(double)); /* Create the output file */ if (args.clobber) { @@ -678,14 +680,14 @@ tm_stamp, &args.transform_info); /* Save the voxel_to_world transformation information */ - out_vol->voxel_to_world = MALLOC(sizeof(General_transform)); - out_vol->world_to_voxel = MALLOC(sizeof(General_transform)); + out_vol->voxel_to_world = malloc(sizeof(General_transform)); + out_vol->world_to_voxel = malloc(sizeof(General_transform)); get_voxel_to_world_transf(&args.volume_def, out_vol->voxel_to_world); create_inverse_general_transform(out_vol->voxel_to_world, out_vol->world_to_voxel); /* Free the time stamp */ - FREE(tm_stamp); + free(tm_stamp); } @@ -704,7 +706,7 @@ @CREATED : August 5, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void check_imageminmax(File_Info *fp, Volume_Data *volume) +static void check_imageminmax(File_Info *fp, Volume_Data *volume) { int ndims, idim, dim[MAX_VAR_DIMS], imgdim[MAX_VAR_DIMS]; int ivar, varid; @@ -767,7 +769,7 @@ @CREATED : February 9, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_file_info(char *filename, int initialized_volume_def, +static void get_file_info(char *filename, int initialized_volume_def, Volume_Definition *volume_def, File_Info *file_info) { @@ -817,7 +819,7 @@ volume_def->dircos[idim][jdim] = 0.0; } if (initialized_volume_def && (volume_def->coords[idim] != NULL)) { - FREE(volume_def->coords[idim]); + free(volume_def->coords[idim]); } volume_def->coords[idim] = NULL; (void) strcpy(volume_def->units[idim], "mm"); @@ -910,14 +912,14 @@ coord_spacing = REGULAR; } if (coord_spacing == IRREGULAR) { - volume_def->coords[cur_axis] = MALLOC(sizeof(double) * dimlength); + volume_def->coords[cur_axis] = malloc(sizeof(double) * dimlength); varstart = 0; varcount = dimlength; if (mivarget(file_info->mincid, dimid, &varstart, &varcount, NC_DOUBLE, MI_SIGNED, volume_def->coords[cur_axis]) == MI_ERROR) { ncopts = NC_VERBOSE | NC_FATAL; - FREE(volume_def->coords[cur_axis]); + free(volume_def->coords[cur_axis]); volume_def->coords[cur_axis] = NULL; continue; } @@ -960,7 +962,7 @@ @CREATED : November 7, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_args_volume_def(Volume_Definition *input_volume_def, +static void get_args_volume_def(Volume_Definition *input_volume_def, Volume_Definition *args_volume_def) { int idim, jdim; @@ -1008,7 +1010,7 @@ @CREATED : November 7, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void transform_volume_def(Transform_Info *transform_info, +static void transform_volume_def(Transform_Info *transform_info, Volume_Definition *input_volume_def, Volume_Definition *transformed_volume_def) { @@ -1112,7 +1114,7 @@ @CREATED : November 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int is_zero_vector(double vector[]) +static int is_zero_vector(double vector[]) { return ((vector[0] == 0.0) && (vector[1] == 0.0) && @@ -1131,7 +1133,7 @@ @CREATED : November 9, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void normalize_vector(double vector[]) +static void normalize_vector(double vector[]) { int idim; double magnitude; @@ -1169,7 +1171,7 @@ @CREATED : February 9, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void create_output_file(char *filename, int cflags, +static void create_output_file(char *filename, int cflags, Volume_Definition *volume_def, File_Info *in_file, File_Info *out_file, @@ -1221,14 +1223,14 @@ (datatype != NC_CHAR)) att_length = 0; att_length += strlen(tm_stamp) + 1; - string = MALLOC(att_length); + string = malloc(att_length); string[0] = '\0'; (void) miattgetstr(out_file->mincid, NC_GLOBAL, MIhistory, att_length, string); ncopts=NC_VERBOSE | NC_FATAL; (void) strcat(string, tm_stamp); (void) miattputstr(out_file->mincid, NC_GLOBAL, MIhistory, string); - FREE(string); + free(string); /* Get the dimension ids from the input file */ (void) ncvarinq(in_file->mincid, in_file->imgid, NULL, NULL, @@ -1273,7 +1275,7 @@ size, then we must rename it */ if (is_volume_dimension && dim_exists && (out_file->nelements[out_index] != in_file->nelements[in_index])) { - string = MALLOC(MAX_NC_NAME); + string = malloc(MAX_NC_NAME); ncopts = 0; idim = 0; do { @@ -1282,7 +1284,7 @@ } while (ncdimid(out_file->mincid, string) != MI_ERROR); ncopts = NC_VERBOSE | NC_FATAL; (void) ncdimrename(out_file->mincid, out_dims[out_index], string); - FREE(string); + free(string); out_dims[out_index] = ncdimdef(out_file->mincid, dimname, out_file->nelements[out_index]); } @@ -1369,7 +1371,7 @@ } /* Look for an unused transformation attribute */ - string = MALLOC(MI_MAX_ATTSTR_LEN); + string = malloc(MI_MAX_ATTSTR_LEN); itrans = 0; do { (void) sprintf(string, "transformation%d-filename", itrans); @@ -1392,7 +1394,7 @@ (void) miattputstr(out_file->mincid, varid, string, MI_TRUE); } - FREE(string); + free(string); } /* If transform specified on command line */ @@ -1445,7 +1447,7 @@ @CREATED : February 9, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_voxel_to_world_transf(Volume_Definition *volume_def, +static void get_voxel_to_world_transf(Volume_Definition *volume_def, General_transform *voxel_to_world) { int idim, jdim, cur_dim, vol_axis; @@ -1488,7 +1490,7 @@ /* If we have an irregularly spaced dimension, then create the appropriate transform */ if (irregular) { - irreg_transf_data = MALLOC(sizeof(*irreg_transf_data)); + irreg_transf_data = malloc(sizeof(*irreg_transf_data)); /* Loop through the axes */ for (idim=0; idim < WORLD_NDIMS; idim++) { @@ -1508,7 +1510,7 @@ dimlength = volume_def->nelements[idim]; irreg_transf_data->nelements[vol_axis] = dimlength; irreg_transf_data->coords[vol_axis] = - MALLOC(sizeof(double) * dimlength); + malloc(sizeof(double) * dimlength); /* Normalize the coordinates to give first coord 0 and last coord n-1 (so that we can concat with the linear @@ -1529,7 +1531,7 @@ sizeof(*irreg_transf_data), irregular_transform_function, irregular_inverse_transform_function); - FREE(irreg_transf_data); + free(irreg_transf_data); /* Concatenate the linear transform with the irregular transform */ copy_general_transform(voxel_to_world, &linear_transf); @@ -1556,7 +1558,7 @@ @CREATED : November 4, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void irregular_transform_function(void *user_data, +static void irregular_transform_function(void *user_data, Real x, Real y, Real z, @@ -1618,7 +1620,7 @@ @CREATED : November 4, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void irregular_inverse_transform_function(void *user_data, +static void irregular_inverse_transform_function(void *user_data, Real x, Real y, Real z, @@ -1712,7 +1714,7 @@ @MODIFIED : February 10, 1993 (Peter Neelin) - ripped off from MINC code ---------------------------------------------------------------------------- */ -public double get_default_range(char *what, nc_type datatype, int is_signed) +static double get_default_range(char *what, nc_type datatype, int is_signed) { double limit; @@ -1753,7 +1755,7 @@ @CREATED : February 15, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void finish_up(VVolume *in_vol, VVolume *out_vol) +static void finish_up(VVolume *in_vol, VVolume *out_vol) { File_Info *in_file, *out_file; @@ -1792,7 +1794,7 @@ @CREATED : February 15, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_transformation(char *dst, char *key, char *nextArg) +static int get_transformation(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Transform_Info *transform_info; @@ -1838,14 +1840,14 @@ /* Read in the file for later use */ if (transform_info->file_contents == NULL) { - transform_info->file_contents = MALLOC(TRANSFORM_BUFFER_INCREMENT); + transform_info->file_contents = malloc(TRANSFORM_BUFFER_INCREMENT); transform_info->buffer_length = TRANSFORM_BUFFER_INCREMENT; } for (index = 0; (ch=getc(fp)) != EOF; index++) { if (index >= transform_info->buffer_length-1) { transform_info->buffer_length += TRANSFORM_BUFFER_INCREMENT; transform_info->file_contents = - REALLOC(transform_info->file_contents, + realloc(transform_info->file_contents, transform_info->buffer_length); } transform_info->file_contents[index] = (char) ch; @@ -1886,7 +1888,7 @@ @CREATED : February 15, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_model_file(char *dst, char *key, char *nextArg) +static int get_model_file(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Volume_Definition *volume_def; @@ -1931,7 +1933,7 @@ @CREATED : November 14, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int set_standard_sampling(char *dst, char *key, char *nextArg) +static int set_standard_sampling(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Volume_Definition *volume_def; @@ -1967,7 +1969,7 @@ @CREATED : December 12, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int set_spacetype(char *dst, char *key, char *nextArg) +static int set_spacetype(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Volume_Definition *volume_def; @@ -2024,7 +2026,7 @@ @CREATED : December 12, 1995 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int set_units(char *dst, char *key, char *nextArg) +static int set_units(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Volume_Definition *volume_def; @@ -2067,7 +2069,7 @@ @CREATED : February 15, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_axis_order(char *dst, char *key, char *nextArg) +static int get_axis_order(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Volume_Definition *volume_def; @@ -2109,7 +2111,7 @@ @CREATED : February 15, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_fillvalue(char *dst, char *key, char *nextArg) +static int get_fillvalue(char *dst, char *key, char *nextArg) /* ARGSUSED */ { double *dptr;
--- a/progs/mincresample/mincresample.h +++ b/progs/mincresample/mincresample.h @@ -7,7 +7,10 @@ @CREATED : February 8, 1993 (Peter Neelin) @MODIFIED : * $Log: mincresample.h,v $ - * Revision 6.5 2004-04-27 15:31:20 bert + * Revision 6.6 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.5 2004/04/27 15:31:20 bert * Added -2 option * * Revision 6.4 2002/11/06 13:32:23 jason @@ -335,69 +338,69 @@ /* Function prototypes */ -public void get_arginfo(int argc, char *argv[], +static void get_arginfo(int argc, char *argv[], Program_Flags *program_flags, VVolume *in_vol, VVolume *out_vol, General_transform *transformation); -public void check_imageminmax(File_Info *fp, Volume_Data *volume); -public void get_file_info(char *filename, int initialized_volume_def, +static void check_imageminmax(File_Info *fp, Volume_Data *volume); +static void get_file_info(char *filename, int initialized_volume_def, Volume_Definition *volume_def, File_Info *file_info); -public void get_args_volume_def(Volume_Definition *input_volume_def, +static void get_args_volume_def(Volume_Definition *input_volume_def, Volume_Definition *args_volume_def); -public void transform_volume_def(Transform_Info *transform_info, +static void transform_volume_def(Transform_Info *transform_info, Volume_Definition *input_volume_def, Volume_Definition *transformed_volume_def); -public int is_zero_vector(double vector[]); -public void normalize_vector(double vector[]); -public void create_output_file(char *filename, int clobber, +static int is_zero_vector(double vector[]); +static void normalize_vector(double vector[]); +static void create_output_file(char *filename, int clobber, Volume_Definition *volume_def, File_Info *in_file, File_Info *out_file, char *tm_stamp, Transform_Info *transform_info); -public void get_voxel_to_world_transf(Volume_Definition *volume_def, +static void get_voxel_to_world_transf(Volume_Definition *volume_def, General_transform *voxel_to_world); -public void irregular_transform_function(void *user_data, +static void irregular_transform_function(void *user_data, Real x, Real y, Real z, Real *x_trans, Real *y_trans, Real *z_trans); -public void irregular_inverse_transform_function(void *user_data, +static void irregular_inverse_transform_function(void *user_data, Real x, Real y, Real z, Real *x_trans, Real *y_trans, Real *z_trans); -public double get_default_range(char *what, nc_type datatype, int is_signed); -public void finish_up(VVolume *in_vol, VVolume *out_vol); -public int get_transformation(char *dst, char *key, char *nextArg); -public int get_model_file(char *dst, char *key, char *nextArg); -public int set_standard_sampling(char *dst, char *key, char *nextArg); -public int set_spacetype(char *dst, char *key, char *nextArg); -public int set_units(char *dst, char *key, char *nextArg); -public int get_axis_order(char *dst, char *key, char *nextArg); -public int get_fillvalue(char *dst, char *key, char *nextArg); -public void resample_volumes(Program_Flags *program_flags, +static double get_default_range(char *what, nc_type datatype, int is_signed); +static void finish_up(VVolume *in_vol, VVolume *out_vol); +static int get_transformation(char *dst, char *key, char *nextArg); +static int get_model_file(char *dst, char *key, char *nextArg); +static int set_standard_sampling(char *dst, char *key, char *nextArg); +static int set_spacetype(char *dst, char *key, char *nextArg); +static int set_units(char *dst, char *key, char *nextArg); +static int get_axis_order(char *dst, char *key, char *nextArg); +static int get_fillvalue(char *dst, char *key, char *nextArg); +extern void resample_volumes(Program_Flags *program_flags, VVolume *in_vol, VVolume *out_vol, General_transform *transformation); -public void load_volume(File_Info *file, long start[], long count[], +static void load_volume(File_Info *file, long start[], long count[], Volume_Data *volume); -public void get_slice(long slice_num, VVolume *in_vol, VVolume *out_vol, +static void get_slice(long slice_num, VVolume *in_vol, VVolume *out_vol, General_transform *transformation, double *minimum, double *maximum); -public int trilinear_interpolant(Volume_Data *volume, +extern int trilinear_interpolant(Volume_Data *volume, Coord_Vector coord, double *result); -public int tricubic_interpolant(Volume_Data *volume, +extern int tricubic_interpolant(Volume_Data *volume, Coord_Vector coord, double *result); -public int do_Ncubic_interpolation(Volume_Data *volume, +static int do_Ncubic_interpolation(Volume_Data *volume, long index[], int cur_dim, double frac[], double *result); -public int nearest_neighbour_interpolant(Volume_Data *volume, +extern int nearest_neighbour_interpolant(Volume_Data *volume, Coord_Vector coord, double *result); -public void renormalize_slices(Program_Flags *program_flags, VVolume *out_vol, +static void renormalize_slices(Program_Flags *program_flags, VVolume *out_vol, double slice_min[], double slice_max[]);
--- a/progs/mincresample/resample_volumes.c +++ b/progs/mincresample/resample_volumes.c @@ -6,7 +6,10 @@ @CREATED : February 8, 1993 (Peter Neelin) @MODIFIED : * $Log: resample_volumes.c,v $ - * Revision 6.3 2001-08-16 13:32:39 neelin + * Revision 6.4 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.3 2001/08/16 13:32:39 neelin * Partial fix for valid_range of different type from image (problems * arising from double to float conversion/rounding). NOT COMPLETE. * @@ -84,7 +87,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincresample/resample_volumes.c,v 6.3 2001-08-16 13:32:39 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincresample/resample_volumes.c,v 6.4 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -94,7 +97,6 @@ #include <math.h> #include <minc.h> #include <volume_io.h> -#include <minc_def.h> #include "mincresample.h" /* ----------------------------- MNI Header ----------------------------------- @@ -113,9 +115,9 @@ @CREATED : February 8, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void resample_volumes(Program_Flags *program_flags, - VVolume *in_vol, VVolume *out_vol, - General_transform *transformation) +void resample_volumes(Program_Flags *program_flags, + VVolume *in_vol, VVolume *out_vol, + General_transform *transformation) { long in_start[MAX_VAR_DIMS], in_count[MAX_VAR_DIMS], in_end[MAX_VAR_DIMS]; long out_start[MAX_VAR_DIMS], out_count[MAX_VAR_DIMS]; @@ -132,9 +134,9 @@ /* Allocate slice min/max arrays if needed */ if (ofp->do_slice_renormalization) { - slice_min = MALLOC(ofp->images_per_file * ofp->slices_per_image * + slice_min = malloc(ofp->images_per_file * ofp->slices_per_image * sizeof(double)); - slice_max = MALLOC(ofp->images_per_file * ofp->slices_per_image * + slice_max = malloc(ofp->images_per_file * ofp->slices_per_image * sizeof(double)); } @@ -264,8 +266,8 @@ /* Recompute slices and free vectors, if needed */ if (ofp->do_slice_renormalization) { renormalize_slices(program_flags, out_vol, slice_min, slice_max); - FREE(slice_min); - FREE(slice_max); + free(slice_min); + free(slice_max); } } @@ -285,8 +287,8 @@ @CREATED : February 10, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void load_volume(File_Info *file, long start[], long count[], - Volume_Data *volume) +void load_volume(File_Info *file, long start[], long count[], + Volume_Data *volume) { long nread, islice, mm_start[MAX_VAR_DIMS], mm_count[MAX_VAR_DIMS]; int varid, ivar, idim, ndims; @@ -420,9 +422,9 @@ @CREATED : February 8, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_slice(long slice_num, VVolume *in_vol, VVolume *out_vol, - General_transform *transformation, - double *minimum, double *maximum) +void get_slice(long slice_num, VVolume *in_vol, VVolume *out_vol, + General_transform *transformation, + double *minimum, double *maximum) { Slice_Data *slice; Volume_Data *volume; @@ -541,8 +543,8 @@ @CREATED : February 10, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int trilinear_interpolant(Volume_Data *volume, - Coord_Vector coord, double *result) +int trilinear_interpolant(Volume_Data *volume, + Coord_Vector coord, double *result) { long slcind, rowind, colind, slcmax, rowmax, colmax; long slcnext, rownext, colnext; @@ -658,8 +660,8 @@ @CREATED : February 12, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int tricubic_interpolant(Volume_Data *volume, - Coord_Vector coord, double *result) +int tricubic_interpolant(Volume_Data *volume, + Coord_Vector coord, double *result) { long slcind, rowind, colind, slcmax, rowmax, colmax, index[VOL_NDIMS]; double frac[VOL_NDIMS]; @@ -716,9 +718,9 @@ @CREATED : February 12, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int do_Ncubic_interpolation(Volume_Data *volume, - long index[], int cur_dim, - double frac[], double *result) +int do_Ncubic_interpolation(Volume_Data *volume, + long index[], int cur_dim, + double frac[], double *result) { long base_index; double v0, v1, v2, v3, u; @@ -817,8 +819,8 @@ @CREATED : February 12, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int nearest_neighbour_interpolant(Volume_Data *volume, - Coord_Vector coord, double *result) +int nearest_neighbour_interpolant(Volume_Data *volume, + Coord_Vector coord, double *result) { long slcind, rowind, colind, slcmax, rowmax, colmax; @@ -866,7 +868,7 @@ @CREATED : October 29, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void renormalize_slices(Program_Flags *program_flags, VVolume *out_vol, +static void renormalize_slices(Program_Flags *program_flags, VVolume *out_vol, double slice_min[], double slice_max[]) { File_Info *ofp; @@ -899,8 +901,8 @@ } /* Find the max/min for each image */ - image_maximum = MALLOC( sizeof(double) * ofp->images_per_file); - image_minimum = MALLOC( sizeof(double) * ofp->images_per_file); + image_maximum = malloc( sizeof(double) * ofp->images_per_file); + image_minimum = malloc( sizeof(double) * ofp->images_per_file); for (image=0; image < ofp->images_per_file; image++) { image_maximum[image] = -DBL_MAX; image_minimum[image] = DBL_MAX; @@ -996,8 +998,8 @@ } /* Free the image max/min arrays */ - FREE(image_maximum); - FREE(image_minimum); + free(image_maximum); + free(image_minimum); return; }
--- a/progs/mincreshape/copy_data.c +++ b/progs/mincreshape/copy_data.c @@ -6,7 +6,10 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : * $Log: copy_data.c,v $ - * Revision 6.3 2001-04-17 18:40:24 neelin + * Revision 6.4 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.3 2001/04/17 18:40:24 neelin * Modifications to work with NetCDF 3.x * In particular, changed NC_LONG to NC_INT (and corresponding longs to ints). * Changed NC_UNSPECIFIED to NC_NAT. @@ -63,7 +66,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincreshape/copy_data.c,v 6.3 2001-04-17 18:40:24 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincreshape/copy_data.c,v 6.4 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -73,10 +76,11 @@ #include <string.h> #include <math.h> #include <minc.h> -#include <minc_def.h> #include <nd_loop.h> #include "mincreshape.h" +#define ROUND( x ) ((long) ((x) + ( ((x) >= 0) ? 0.5 : (-0.5) ) )) + /* ----------------------------- MNI Header ----------------------------------- @NAME : copy_data @INPUT : reshape_info - information for reshaping volume @@ -90,7 +94,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void copy_data(Reshape_info *reshape_info) +void copy_data(Reshape_info *reshape_info) { int idim, odim, out_ndims; long block_begin[MAX_VAR_DIMS], block_end[MAX_VAR_DIMS]; @@ -123,7 +127,7 @@ for (odim=0; odim < out_ndims; odim++) { total_size *= reshape_info->chunk_count[odim]; } - chunk_data = MALLOC(total_size); + chunk_data = malloc(total_size); /* Get enough space for image-min and max values for a block */ get_num_minmax_values(reshape_info, NULL, block_count, @@ -131,7 +135,7 @@ num_values = ((num_min_values > num_max_values) ? num_min_values : num_max_values); if (num_values > 0) - minmax_buffer = MALLOC(num_values * sizeof(double)); + minmax_buffer = malloc(num_values * sizeof(double)); else minmax_buffer = NULL; @@ -195,11 +199,11 @@ } /* Free the chunk space */ - FREE(chunk_data); + free(chunk_data); /* Free minmax buffer */ if (minmax_buffer != NULL) { - FREE(minmax_buffer); + free(minmax_buffer); } /* Print ending log message */ @@ -231,7 +235,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_num_minmax_values(Reshape_info *reshape_info, +static void get_num_minmax_values(Reshape_info *reshape_info, long *block_start, long *block_count, long *num_min_values, long *num_max_values) { @@ -315,7 +319,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void handle_normalization(Reshape_info *reshape_info, +static void handle_normalization(Reshape_info *reshape_info, long *block_start, long *block_count, double *minmax_buffer, @@ -413,7 +417,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_block_min_and_max(Reshape_info *reshape_info, +static void get_block_min_and_max(Reshape_info *reshape_info, long *block_start, long *block_count, double *minmax_buffer, @@ -519,7 +523,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void truncate_input_vectors(Reshape_info *reshape_info, +static void truncate_input_vectors(Reshape_info *reshape_info, long *input_start, long *input_count) { @@ -565,7 +569,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void translate_output_to_input(Reshape_info *reshape_info, +static void translate_output_to_input(Reshape_info *reshape_info, long *output_start, long *output_count, long *input_start, @@ -611,7 +615,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void translate_input_to_output(Reshape_info *reshape_info, +static void translate_input_to_output(Reshape_info *reshape_info, long *input_start, long *input_count, long *output_start, @@ -654,7 +658,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void copy_the_chunk(Reshape_info *reshape_info, +static void copy_the_chunk(Reshape_info *reshape_info, long chunk_start[], long chunk_count[], void *chunk_data, @@ -772,7 +776,7 @@ @CREATED : October 25, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void convert_value_from_double(double dvalue, +static void convert_value_from_double(double dvalue, nc_type datatype, int is_signed, void *ptr) {
--- a/progs/mincreshape/mincreshape.c +++ b/progs/mincreshape/mincreshape.c @@ -13,7 +13,10 @@ @CREATED : March 10, 1994 (Peter Neelin) @MODIFIED : * $Log: mincreshape.c,v $ - * Revision 6.9 2004-04-27 15:30:02 bert + * Revision 6.10 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.9 2004/04/27 15:30:02 bert * Add -2 flag * * Revision 6.8 2001/11/13 14:16:50 neelin @@ -92,7 +95,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincreshape/mincreshape.c,v 6.9 2004-04-27 15:30:02 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincreshape/mincreshape.c,v 6.10 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -105,12 +108,11 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include "mincreshape.h" /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { Reshape_info reshape_info; @@ -142,7 +144,7 @@ @CREATED : March 11, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_arginfo(int argc, char *argv[], +static void get_arginfo(int argc, char *argv[], Reshape_info *reshape_info) { @@ -468,7 +470,7 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_fillvalue(char *dst, char *key, char *nextArg) +static int get_fillvalue(char *dst, char *key, char *nextArg) /* ARGSUSED */ { double *dptr; @@ -503,7 +505,7 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_dimsize(char *dst, char *key, char *nextArg) +static int get_dimsize(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Dimsize_list *dimsize_list; @@ -589,7 +591,7 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_axis_order(char *dst, char *key, char *nextArg) +static int get_axis_order(char *dst, char *key, char *nextArg) /* ARGSUSED */ { char **axis_order; @@ -680,7 +682,7 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_axis_range(char *dst, char *key, char *nextArg) +static int get_axis_range(char *dst, char *key, char *nextArg) /* ARGSUSED */ { Axis_ranges *axis_ranges; @@ -780,7 +782,7 @@ @CREATED : June 10, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int get_arg_vector(char *dst, char *key, char *nextArg) +static int get_arg_vector(char *dst, char *key, char *nextArg) /* ARGSUSED */ { @@ -855,7 +857,7 @@ @CREATED : March 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void get_default_datatype(int mincid, nc_type *datatype, int *is_signed, +static void get_default_datatype(int mincid, nc_type *datatype, int *is_signed, double valid_range[2]) { int imgid; @@ -953,7 +955,7 @@ @CREATED : May 18, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_dim_sizes(int icvid, int mincid, Dimsize_list *dimsize_list) +static void setup_dim_sizes(int icvid, int mincid, Dimsize_list *dimsize_list) { int ientry, idim; int imgid, dimid; @@ -1023,7 +1025,7 @@ @CREATED : May 26, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_reshaping_info(int icvid, int mincid, +static void setup_reshaping_info(int icvid, int mincid, int do_norm, double fillvalue, int do_scalar, char *axis_order[], Axis_ranges *axis_ranges, long hs_start[], long hs_count[], @@ -1311,7 +1313,7 @@ @CREATED : June 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void setup_output_file(int mincid, char *history, +static void setup_output_file(int mincid, char *history, Reshape_info *reshape_info) { int output_ndims, output_dim[MAX_VAR_DIMS]; @@ -1439,13 +1441,13 @@ == MI_ERROR) || (datatype != NC_CHAR)) att_length = 0; att_length += strlen(history) + 1; - string = MALLOC(att_length); + string = malloc(att_length); string[0] = '\0'; (void) miattgetstr(mincid, NC_GLOBAL, MIhistory, att_length, string); ncopts = NCOPTS_DEFAULT; (void) strcat(string, history); (void) miattputstr(mincid, NC_GLOBAL, MIhistory, string); - FREE(string); + free(string); /* Get into data mode */ (void) ncsetfill(mincid, NC_NOFILL); @@ -1485,7 +1487,7 @@ @CREATED : June 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void create_dim_var(int outmincid, int outdimid, +static void create_dim_var(int outmincid, int outdimid, int inicvid, int cur_image_dim, int inmincid, long input_start, long input_count) { @@ -1598,7 +1600,7 @@ @CREATED : June 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void copy_dimension_values(int outmincid, int outdimid, int inmincid, +static void copy_dimension_values(int outmincid, int outdimid, int inmincid, long input_start, long input_count) { char dimname[MAX_NC_NAME]; @@ -1637,7 +1639,7 @@ @CREATED : June 16, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void copy_dim_var_values(int outmincid, char *dimname, char *varname, +static void copy_dim_var_values(int outmincid, char *dimname, char *varname, int inmincid, long input_start, long input_count) {
--- a/progs/mincreshape/mincreshape.h +++ b/progs/mincreshape/mincreshape.h @@ -7,7 +7,10 @@ @CREATED : March 11, 1994 (Peter Neelin) @MODIFIED : * $Log: mincreshape.h,v $ - * Revision 6.3 2001-12-06 14:12:45 neelin + * Revision 6.4 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.3 2001/12/06 14:12:45 neelin * Trivial change to definition of NCOPTS_DEFAULT. * * Revision 6.2 1999/10/19 14:45:29 neelin @@ -112,66 +115,65 @@ #define MIN( x, y ) ( ((x) <= (y)) ? (x) : (y) ) /* Function prototypes */ -public int main(int argc, char *argv[]); -public void get_arginfo(int argc, char *argv[], +static void get_arginfo(int argc, char *argv[], Reshape_info *reshape_info); -public int get_fillvalue(char *dst, char *key, char *nextArg); -public int get_dimsize(char *dst, char *key, char *nextArg); -public int get_axis_order(char *dst, char *key, char *nextArg); -public int get_axis_range(char *dst, char *key, char *nextArg); -public int get_arg_vector(char *dst, char *key, char *nextArg); -public void get_default_datatype(int mincid, nc_type *datatype, int *is_signed, +static int get_fillvalue(char *dst, char *key, char *nextArg); +static int get_dimsize(char *dst, char *key, char *nextArg); +static int get_axis_order(char *dst, char *key, char *nextArg); +static int get_axis_range(char *dst, char *key, char *nextArg); +static int get_arg_vector(char *dst, char *key, char *nextArg); +static void get_default_datatype(int mincid, nc_type *datatype, int *is_signed, double valid_range[2]); -public void setup_dim_sizes(int icvid, int mincid, Dimsize_list *dimsize_list); -public void setup_reshaping_info(int icvid, int mincid, +static void setup_dim_sizes(int icvid, int mincid, Dimsize_list *dimsize_list); +static void setup_reshaping_info(int icvid, int mincid, int do_norm, double fillvalue, int do_scalar, char *axis_order[], Axis_ranges *axis_ranges, long hs_start[], long hs_count[], int max_chunk_size_in_kb, Reshape_info *reshape_info); -public void setup_output_file(int mincid, char *history, +static void setup_output_file(int mincid, char *history, Reshape_info *reshape_info); -public void create_dim_var(int outmincid, int outdimid, +static void create_dim_var(int outmincid, int outdimid, int inicvid, int cur_image_dim, int inmincid, long input_start, long input_count); -public void copy_dimension_values(int outmincid, int outdimid, int inmincid, +static void copy_dimension_values(int outmincid, int outdimid, int inmincid, long input_start, long input_count); -public void copy_dim_var_values(int outmincid, char *dimname, char *varname, +static void copy_dim_var_values(int outmincid, char *dimname, char *varname, int inmincid, long input_start, long input_count); -public void copy_data(Reshape_info *reshape_info); -public void get_num_minmax_values(Reshape_info *reshape_info, +extern void copy_data(Reshape_info *reshape_info); +static void get_num_minmax_values(Reshape_info *reshape_info, long *block_start, long *block_count, long *num_min_values, long *num_max_values); -public void handle_normalization(Reshape_info *reshape_info, +static void handle_normalization(Reshape_info *reshape_info, long *block_start, long *block_count, double *minmax_buffer, double *fillvalue); -public void get_block_min_and_max(Reshape_info *reshape_info, +static void get_block_min_and_max(Reshape_info *reshape_info, long *block_start, long *block_count, double *minmax_buffer, double *minimum, double *maximum); -public void truncate_input_vectors(Reshape_info *reshape_info, +static void truncate_input_vectors(Reshape_info *reshape_info, long *input_start, long *input_count); -public void translate_output_to_input(Reshape_info *reshape_info, +static void translate_output_to_input(Reshape_info *reshape_info, long *output_start, long *output_count, long *input_start, long *input_count); -public void translate_input_to_output(Reshape_info *reshape_info, +static void translate_input_to_output(Reshape_info *reshape_info, long *input_start, long *input_count, long *output_start, long *output_count); -public void copy_the_chunk(Reshape_info *reshape_info, +static void copy_the_chunk(Reshape_info *reshape_info, long chunk_start[], long chunk_count[], void *chunk_data, double fillvalue); -public void convert_value_from_double(double dvalue, +static void convert_value_from_double(double dvalue, nc_type datatype, int is_signed, void *ptr);
--- a/progs/mincstats/mincstats.c +++ b/progs/mincstats/mincstats.c @@ -5,7 +5,10 @@ * University of Queensland, Australia * * $Log: mincstats.c,v $ - * Revision 1.16 2004-10-18 08:20:35 rotor + * Revision 1.17 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 1.16 2004/10/18 08:20:35 rotor * * Changes to mincstats * - Fixed bug in calculation of BiModalT * - changed default # of histogram bins to 65536 (from 10000) @@ -91,16 +94,20 @@ * of a histogram. */ +#include "config.h" #include <stdlib.h> #include <stdio.h> +#if HAVE_UNISTD_H #include <unistd.h> +#endif /* HAVE_UNISTD_H */ #include <limits.h> +#if HAVE_FLOAT_H #include <float.h> +#endif /* HAVE_FLOAT_H */ #include <math.h> #include <string.h> #include <ctype.h> #include <ParseArgv.h> -#include <minc_def.h> #include <voxel_loop.h> #ifndef TRUE @@ -432,24 +439,24 @@ exit(EXIT_FAILURE); } - if(access(infiles[0], F_OK) != 0) { + if(access(infiles[0], 0) != 0) { (void)fprintf(stderr, "%s: Couldn't find %s\n", argv[0], infiles[0]); exit(EXIT_FAILURE); } - if(infiles[1] != NULL && access(infiles[1], F_OK) != 0) { + if(infiles[1] != NULL && access(infiles[1], 0) != 0) { (void)fprintf(stderr, "%s: Couldn't find mask file: %s\n", argv[0], infiles[1]); exit(EXIT_FAILURE); } - if(hist_file != NULL && !clobber && access(hist_file, F_OK) != -1) { + if(hist_file != NULL && !clobber && access(hist_file, 0) != -1) { (void)fprintf(stderr, "%s: Histogram %s exists! (use -clobber to overwrite)\n", argv[0], hist_file); exit(EXIT_FAILURE); } /* Open the file to get some information */ - mincid = miopen(infiles[0], NC_NOWRITE); + mincid = miopen(infiles[0], NC_NOWRITE | 0x8000); imgid = ncvarid(mincid, MIimage); nvoxels = get_minc_nvoxels(mincid); voxel_volume = get_minc_voxel_volume(mincid); @@ -537,9 +544,9 @@ } /* Initialize the stats structure */ - stats_info = MALLOC(num_ranges * sizeof(*stats_info)); + stats_info = malloc(num_ranges * sizeof(*stats_info)); for(irange = 0; irange < num_ranges; irange++) { - stats_info[irange] = MALLOC(num_masks * sizeof(**stats_info)); + stats_info[irange] = malloc(num_masks * sizeof(**stats_info)); for(imask = 0; imask < num_masks; imask++) { stats = &stats_info[irange][imask]; init_stats(stats, hist_bins); @@ -612,9 +619,9 @@ double max_var = 0.0; /* Allocate space for histograms */ - hist_centre = CALLOC(hist_bins, sizeof(float)); - pdf = CALLOC(hist_bins, sizeof(float)); - cdf = CALLOC(hist_bins, sizeof(float)); + hist_centre = calloc(hist_bins, sizeof(float)); + pdf = calloc(hist_bins, sizeof(float)); + cdf = calloc(hist_bins, sizeof(float)); if(hist_centre == NULL || pdf == NULL || cdf == NULL) { (void)fprintf(stderr, "Memory allocation error\n"); exit(EXIT_FAILURE); @@ -649,12 +656,12 @@ if(c > 0) { var = SQR((stats->mean * zero_moment) - first_moment) / (zero_moment * (1 - zero_moment)); - + if(var > max_var) { bimodalt_bin = c; max_var = var; } - } + } /* pct Threshold */ if(cdf[c] < pctT) { @@ -709,9 +716,9 @@ } /* Free the space */ - FREE(hist_centre); - FREE(pdf); - FREE(cdf); + free(hist_centre); + free(pdf); + free(cdf); } /* end histogram calculations */ @@ -843,9 +850,9 @@ for(imask = 0; imask < num_masks; imask++) { free_stats(&stats_info[irange][imask]); } - FREE(stats_info[irange]); + free(stats_info[irange]); } - FREE(stats_info); + free(stats_info); return EXIT_SUCCESS; } @@ -1287,10 +1294,10 @@ if(num_elements > num_alloc) { num_alloc += 20; if(double_list == NULL) { - double_list = MALLOC(num_alloc * sizeof(*double_list)); + double_list = malloc(num_alloc * sizeof(*double_list)); } else { - double_list = REALLOC(double_list, num_alloc * sizeof(*double_list)); + double_list = realloc(double_list, num_alloc * sizeof(*double_list)); } } double_list[num_elements - 1] = dvalue; @@ -1308,7 +1315,7 @@ /* Update the global variables */ double_array->numvalues = num_elements; if(double_array->values != NULL) { - FREE(double_array->values); + free(double_array->values); } double_array->values = double_list; @@ -1377,11 +1384,11 @@ /* Allocate the space */ if(min->numvalues <= 0) { min->numvalues = num_values; - min->values = MALLOC(num_values * sizeof(double)); + min->values = malloc(num_values * sizeof(double)); } if(max->numvalues <= 0) { max->numvalues = num_values; - max->values = MALLOC(num_values * sizeof(double)); + max->values = malloc(num_values * sizeof(double)); } if(min->values == NULL || max->values == NULL) { (void)fprintf(stderr, "Memory allocation error\n"); @@ -1433,7 +1440,7 @@ stats->mask_range[0] = -DBL_MAX; stats->mask_range[1] = DBL_MAX; if(Hist && hist_bins > 0) { - stats->histogram = CALLOC(hist_bins, sizeof(float)); + stats->histogram = calloc(hist_bins, sizeof(float)); if(stats->histogram == NULL) { (void)fprintf(stderr, "Memory allocation error\n"); exit(EXIT_FAILURE); @@ -1474,5 +1481,5 @@ void free_stats(Stats_Info * stats) { if(stats->histogram != NULL) - FREE(stats->histogram); + free(stats->histogram); }
--- a/progs/minctoraw/minctoraw.c +++ b/progs/minctoraw/minctoraw.c @@ -10,7 +10,10 @@ @CREATED : February 11, 1993 (Peter Neelin) @MODIFIED : * $Log: minctoraw.c,v $ - * Revision 6.7 2003-10-28 20:32:09 bert + * Revision 6.8 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.7 2003/10/28 20:32:09 bert * Get rid of a few compiler warnings * * Revision 6.6 2001/08/16 16:41:36 neelin @@ -79,7 +82,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/minctoraw/minctoraw.c,v 6.7 2003-10-28 20:32:09 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/minctoraw/minctoraw.c,v 6.8 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -89,7 +92,6 @@ #include <limits.h> #include <float.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE @@ -228,7 +230,7 @@ } /* Allocate space */ - data = MALLOC(size); + data = malloc(size); /* Loop over input slices */ @@ -257,7 +259,7 @@ /* Clean up */ (void) miclose(mincid); (void) miicv_free(icvid); - FREE(data); + free(data); exit(EXIT_SUCCESS); }
--- a/progs/mincwindow/mincwindow.c +++ b/progs/mincwindow/mincwindow.c @@ -10,7 +10,10 @@ @CREATED : January 10, 1994 (Peter Neelin) @MODIFIED : * $Log: mincwindow.c,v $ - * Revision 6.2 2004-04-27 15:28:39 bert + * Revision 6.3 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.2 2004/04/27 15:28:39 bert * Added -2 option * * Revision 6.1 1999/10/19 14:45:30 neelin @@ -64,7 +67,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincwindow/mincwindow.c,v 6.2 2004-04-27 15:28:39 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincwindow/mincwindow.c,v 6.3 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -74,13 +77,8 @@ #include <minc.h> #include <ParseArgv.h> #include <time_stamp.h> -#include <minc_def.h> #include <voxel_loop.h> -#ifndef public -# define public -#endif - #ifndef TRUE # define TRUE 1 # define FALSE 0 @@ -95,7 +93,7 @@ } Window_Data; /* Function prototypes */ -public void do_window(void *caller_data, long num_voxels, +static void do_window(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length, @@ -127,7 +125,7 @@ }; /* Main program */ -public int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { char *infile, *outfile; char *arg_string; @@ -201,7 +199,7 @@ @CREATED : January 11, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void do_window(void *caller_data, long num_voxels, +static void do_window(void *caller_data, long num_voxels, int input_num_buffers, int input_vector_length, double *input_data[], int output_num_buffers, int output_vector_length,
--- a/progs/rawtominc/rawtominc.c +++ b/progs/rawtominc/rawtominc.c @@ -11,7 +11,10 @@ @CREATED : September 25, 1992 (Peter Neelin) @MODIFIED : * $Log: rawtominc.c,v $ - * Revision 6.14 2004-04-27 15:26:34 bert + * Revision 6.15 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.14 2004/04/27 15:26:34 bert * Added -2 option * * Revision 6.13 2004/02/02 18:24:58 bert @@ -143,7 +146,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/rawtominc/rawtominc.c,v 6.14 2004-04-27 15:26:34 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/rawtominc/rawtominc.c,v 6.15 2004-11-01 22:38:39 bert Exp $"; #endif #include "config.h" @@ -158,7 +161,6 @@ #include <ParseArgv.h> #include <time_stamp.h> #include <convert_origin_to_start.h> -#include <minc_def.h> /* Some constants */ @@ -193,11 +195,11 @@ #define STR_EQ(s1,s2) (strcmp(s1,s2)==0) /* Function declarations */ -void parse_args(int argc, char *argv[]); -void usage_error(char *pname); -int get_attribute(char *dst, char *key, char *nextarg); -int get_times(char *dst, char *key, char *nextarg); -int get_axis_order(char *dst, char *key, char *nextArg); +static void parse_args(int argc, char *argv[]); +static void usage_error(char *pname); +static int get_attribute(char *dst, char *key, char *nextarg); +static int get_times(char *dst, char *key, char *nextarg); +static int get_axis_order(char *dst, char *key, char *nextArg); /* Array containing information about signs. It is subscripted by [signtype][type]. Note that the first row should never be used, since @@ -718,7 +720,7 @@ image_pix *= end[ndims-i]; pix_size=nctypelen(datatype); image_size=image_pix*pix_size; - image=MALLOC(image_size); + image=malloc(image_size); /* Loop through the images */ fastdim=ndims-image_dims-1; @@ -897,7 +899,7 @@ } /* Free the memory */ - FREE(image); + free(image); /* Write the valid max and min */ if (do_vrange) { @@ -941,7 +943,7 @@ @CREATED : December 3, 1992 @MODIFIED : ---------------------------------------------------------------------------- */ -void parse_args(int argc, char *argv[]) +static void parse_args(int argc, char *argv[]) { char *ptr; int time_size; @@ -1050,7 +1052,7 @@ @CREATED : September 25, 1992 (Peter Neelin) @MODIFIED : December 2, 1992 (P.N.) ---------------------------------------------------------------------------- */ -void usage_error(char *progname) +static void usage_error(char *progname) { (void) fprintf(stderr, "\nUsage: %s [<options>] <output.mnc> ", progname); @@ -1076,7 +1078,7 @@ @CREATED : May 3, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -int get_attribute(char *dst, char *key, char *nextarg) +static int get_attribute(char *dst, char *key, char *nextarg) /* ARGSUSED */ { int need_string, need_double; @@ -1127,11 +1129,11 @@ attribute_list_alloc += 10; if (attribute_list == NULL) { attribute_list = - MALLOC(attribute_list_alloc * sizeof(*attribute_list)); + malloc(attribute_list_alloc * sizeof(*attribute_list)); } else { attribute_list = - REALLOC(attribute_list, + realloc(attribute_list, attribute_list_alloc * sizeof(*attribute_list)); } } @@ -1172,7 +1174,7 @@ @CREATED : May 3, 1994 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -int get_times(char *dst, char *key, char *nextarg) +static int get_times(char *dst, char *key, char *nextarg) /* ARGSUSED */ { int *num_elements_ptr; @@ -1232,11 +1234,11 @@ num_alloc += 20; if (time_list == NULL) { time_list = - MALLOC(num_alloc * sizeof(*time_list)); + malloc(num_alloc * sizeof(*time_list)); } else { time_list = - REALLOC(time_list, num_alloc * sizeof(*time_list)); + realloc(time_list, num_alloc * sizeof(*time_list)); } } time_list[num_elements-1] = dvalue; @@ -1252,7 +1254,7 @@ /* Update the global variables */ *num_elements_ptr = num_elements; if (*time_list_ptr != NULL) { - FREE(*time_list_ptr); + free(*time_list_ptr); } *time_list_ptr = time_list; @@ -1288,7 +1290,7 @@ #define YXZ_ORIENTATION 5 #define ZXY_ORIENTATION 6 #define STD_ORIENTATION_COUNT 7 -public int get_axis_order(char *dst, char *key, char *nextArg) +static int get_axis_order(char *dst, char *key, char *nextArg) { char **dim_name_array; char *argp;
--- a/progs/xfm/transformtags.c +++ b/progs/xfm/transformtags.c @@ -10,7 +10,10 @@ @CREATED : September 13, 1993 (Peter Neelin) @MODIFIED : * $Log: transformtags.c,v $ - * Revision 6.1 1999-10-19 14:45:31 neelin + * Revision 6.2 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.1 1999/10/19 14:45:31 neelin * Fixed Log subsitutions for CVS * * Revision 6.0 1997/09/12 13:23:28 neelin @@ -47,7 +50,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/xfm/transformtags.c,v 6.1 1999-10-19 14:45:31 neelin Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/xfm/transformtags.c,v 6.2 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -55,7 +58,6 @@ #include <string.h> #include <volume_io.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE
--- a/progs/xfm/xfmconcat.c +++ b/progs/xfm/xfmconcat.c @@ -10,7 +10,10 @@ @CREATED : August 13, 1993 (Peter Neelin) @MODIFIED : * $Log: xfmconcat.c,v $ - * Revision 6.2 2004-02-02 18:24:11 bert + * Revision 6.3 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.2 2004/02/02 18:24:11 bert * Call ParseArgv() so that version information will be available * * Revision 6.1 1999/10/19 14:45:32 neelin @@ -60,7 +63,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/xfm/xfmconcat.c,v 6.2 2004-02-02 18:24:11 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/xfm/xfmconcat.c,v 6.3 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -68,17 +71,12 @@ #include <string.h> #include <volume_io.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif -#ifndef public -# define public -# define private static -#endif /* Argument table */ ArgvInfo argTable[] = {
--- a/progs/xfm/xfminvert.c +++ b/progs/xfm/xfminvert.c @@ -10,7 +10,10 @@ @CREATED : August 13, 1993 (Peter Neelin) @MODIFIED : * $Log: xfminvert.c,v $ - * Revision 6.2 2004-02-02 18:24:11 bert + * Revision 6.3 2004-11-01 22:38:39 bert + * Eliminate all references to minc_def.h + * + * Revision 6.2 2004/02/02 18:24:11 bert * Call ParseArgv() so that version information will be available * * Revision 6.1 1999/10/19 14:45:32 neelin @@ -60,7 +63,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[]="$Header: /private-cvsroot/minc/progs/xfm/xfminvert.c,v 6.2 2004-02-02 18:24:11 bert Exp $"; +static char rcsid[]="$Header: /private-cvsroot/minc/progs/xfm/xfminvert.c,v 6.3 2004-11-01 22:38:39 bert Exp $"; #endif #include <stdlib.h> @@ -68,17 +71,12 @@ #include <string.h> #include <volume_io.h> #include <ParseArgv.h> -#include <minc_def.h> /* Constants */ #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif -#ifndef public -# define public -# define private static -#endif /* Argument table */ ArgvInfo argTable[] = {