# HG changeset patch # User bert # Date 1109894917 0 # Node ID 3806135d219b0e0ece24903fbdbba41b3ba97064 # Parent 300fd0f951cbf8a50885b339ae4ebf639db412d7 Lose private and public diff --git a/conversion/Acr_nema/file_io.c b/conversion/Acr_nema/file_io.c --- a/conversion/Acr_nema/file_io.c +++ b/conversion/Acr_nema/file_io.c @@ -6,7 +6,10 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : * $Log: file_io.c,v $ - * Revision 6.6 2005-02-16 19:22:32 bert + * Revision 6.7 2005-03-04 00:09:00 bert + * Lose private and public + * + * Revision 6.6 2005/02/16 19:22:32 bert * Autoconfiscation * * Revision 6.5 2004/10/29 13:08:41 rotor @@ -99,12 +102,6 @@ #include #include -/* these are pinched from minc_def.h */ -#define MALLOC(size) ((void *) malloc(size)) -#define FREE(ptr) free(ptr) -#define REALLOC(ptr, size) ((void *) realloc(ptr, size)) -#define CALLOC(nelem, elsize) ((void *) calloc(nelem, elsize)) - /* Define some constants */ #define ACR_MAX_BUFFER_LENGTH (64*1024) #define ACR_BUFFER_MARGIN 256 @@ -136,7 +133,7 @@ @CREATED : February 18, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_enable_trace(Acr_File *afp) +void acr_file_enable_trace(Acr_File *afp) { afp->do_trace = TRUE; } @@ -153,7 +150,7 @@ @CREATED : February 18, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_disable_trace(Acr_File *afp) +void acr_file_disable_trace(Acr_File *afp) { afp->do_trace = FALSE; } @@ -175,9 +172,9 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : February 5, 1997 (P.N.) ---------------------------------------------------------------------------- */ -public Acr_File *acr_file_initialize(void *io_data, - int maxlength, - Acr_Io_Routine io_routine) +Acr_File *acr_file_initialize(void *io_data, + int maxlength, + Acr_Io_Routine io_routine) { Acr_File *afp; @@ -187,7 +184,7 @@ } /* Allocate the strcture */ - afp = MALLOC(sizeof(*afp)); + afp = malloc(sizeof(*afp)); /* Initialize fields */ afp->io_data = io_data; @@ -205,7 +202,7 @@ afp->client_data = NULL; /* Allocate the buffer */ - afp->start = MALLOC((size_t) afp->buffer_length); + afp->start = malloc((size_t) afp->buffer_length); /* Set ptr and end to start so that we can detect beginning of i/o */ afp->length = 0; @@ -231,22 +228,22 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_free(Acr_File *afp) +void acr_file_free(Acr_File *afp) { if (afp != NULL) { if (afp->stream_type == ACR_WRITE_STREAM) { (void) acr_file_flush(afp); } if (afp->start != NULL) { - FREE(afp->start); + free(afp->start); } if (afp->tracefp != NULL) { (void) fclose(afp->tracefp); } if (afp->client_data != NULL) { - FREE(afp->client_data); + free(afp->client_data); } - FREE(afp); + free(afp); } return; } @@ -264,7 +261,7 @@ @CREATED : February 18, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_reset(Acr_File *afp) +void acr_file_reset(Acr_File *afp) { afp->watchpoint_set = FALSE; afp->bytes_to_watchpoint = 0; @@ -291,8 +288,8 @@ @CREATED : May 17, 2000 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_set_ismore_function(Acr_File *afp, - Acr_Ismore_Function ismore_function) +void acr_file_set_ismore_function(Acr_File *afp, + Acr_Ismore_Function ismore_function) { afp->ismore_function = ismore_function; } @@ -312,7 +309,7 @@ @CREATED : March 10, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_set_eof(Acr_File *afp) +void acr_file_set_eof(Acr_File *afp) { afp->reached_eof = TRUE; } @@ -334,10 +331,10 @@ @CREATED : February 14, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_file_set_client_data(Acr_File *afp, void *client_data) +void acr_file_set_client_data(Acr_File *afp, void *client_data) { if (afp->client_data != NULL) { - FREE(afp->client_data); + free(afp->client_data); } afp->client_data = client_data; } @@ -354,7 +351,7 @@ @CREATED : February 14, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void *acr_file_get_client_data(Acr_File *afp) +void *acr_file_get_client_data(Acr_File *afp) { return afp->client_data; } @@ -372,7 +369,7 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : February 5, 1997 (P.N.) ---------------------------------------------------------------------------- */ -public int acr_file_read_more(Acr_File *afp) +int acr_file_read_more(Acr_File *afp) { int nread, ichar; char trace_file[128]; @@ -448,8 +445,7 @@ if (afp->do_trace) { if (afp->tracefp == NULL) { (void) strcpy(trace_file, Input_trace_file); - (void) mktemp(trace_file); - afp->tracefp = fopen(trace_file, "w"); + afp->tracefp = fdopen(mkstemp(trace_file), "w"); if (afp->tracefp != NULL) { (void) fprintf(stderr, "Opened input trace file %s.\n", trace_file); @@ -496,7 +492,7 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : February 5, 1997 (P.N.) ---------------------------------------------------------------------------- */ -public int acr_file_write_more(Acr_File *afp, int character) +int acr_file_write_more(Acr_File *afp, int character) { /* Check the pointer */ @@ -531,7 +527,7 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : February 5, 1997 (P.N.) ---------------------------------------------------------------------------- */ -public int acr_file_flush(Acr_File *afp) +int acr_file_flush(Acr_File *afp) { int length, nwritten; char trace_file[128]; @@ -563,8 +559,7 @@ if (afp->do_trace) { if (afp->tracefp == NULL) { (void) strcpy(trace_file, Output_trace_file); - (void) mktemp(trace_file); - afp->tracefp = fopen(trace_file, "w"); + afp->tracefp = fdopen(mkstemp(trace_file), "w"); if (afp->tracefp != NULL) { (void) fprintf(stderr, "Opened output trace file %s.\n", trace_file); @@ -621,7 +616,7 @@ @CREATED : November 25, 1993 (Peter Neelin) @MODIFIED : February 5, 1997 (P.N.) ---------------------------------------------------------------------------- */ -public int acr_ungetc(int c, Acr_File *afp) +int acr_ungetc(int c, Acr_File *afp) { /* Check the pointer */ @@ -659,7 +654,7 @@ @CREATED : February 17, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public void *acr_file_get_io_data(Acr_File *afp) +void *acr_file_get_io_data(Acr_File *afp) { return afp->io_data; } @@ -680,7 +675,7 @@ @CREATED : February 5, 1997 (P.N.) @MODIFIED : ---------------------------------------------------------------------------- */ -public void acr_set_io_watchpoint(Acr_File *afp, long bytes_to_watchpoint) +void acr_set_io_watchpoint(Acr_File *afp, long bytes_to_watchpoint) { if (afp == NULL) return; @@ -724,7 +719,7 @@ @CREATED : February 5, 1997 (P.N.) @MODIFIED : ---------------------------------------------------------------------------- */ -public long acr_get_io_watchpoint(Acr_File *afp) +long acr_get_io_watchpoint(Acr_File *afp) { if ((afp == NULL) || !afp->watchpoint_set) return ACR_NO_WATCHPOINT; @@ -752,7 +747,7 @@ @CREATED : May 17, 2000 (P.N.) @MODIFIED : ---------------------------------------------------------------------------- */ -public int acr_file_ismore(Acr_File *afp) +int acr_file_ismore(Acr_File *afp) { int retval; @@ -805,7 +800,7 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int acr_stdio_read(void *io_data, void *buffer, int nbytes) +int acr_stdio_read(void *io_data, void *buffer, int nbytes) { FILE *fp; int nread; @@ -835,7 +830,7 @@ @CREATED : November 9, 1993 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int acr_stdio_write(void *io_data, void *buffer, int nbytes) +int acr_stdio_write(void *io_data, void *buffer, int nbytes) { FILE *fp; int nwritten; @@ -869,7 +864,7 @@ @CREATED : May 17, 2000 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int acr_stdio_ismore(void *io_data) +int acr_stdio_ismore(void *io_data) { FILE *fp; int val; diff --git a/conversion/Acr_nema/value_repr.c b/conversion/Acr_nema/value_repr.c --- a/conversion/Acr_nema/value_repr.c +++ b/conversion/Acr_nema/value_repr.c @@ -6,7 +6,10 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : * $Log: value_repr.c,v $ - * Revision 6.3 2004-10-29 13:08:42 rotor + * Revision 6.4 2005-03-04 00:08:37 bert + * Lose private and public + * + * Revision 6.3 2004/10/29 13:08:42 rotor * * rewrote Makefile with no dependency on a minc distribution * * removed all references to the abominable minc_def.h * * I should autoconf this really, but this is old code that @@ -72,40 +75,40 @@ }; /* Private functions */ -private void check_table_integrity(); -private Acr_VR_Entry *get_vr_entry(Acr_VR_Type vr_code); -private Acr_VR_Type find_vr_name(char *vr_name); -private double return_zero(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private double string_to_numeric(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private double get_short(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private double get_long(Acr_VR_Entry *vr_entry, +static void check_table_integrity(); +static Acr_VR_Entry *get_vr_entry(Acr_VR_Type vr_code); +static Acr_VR_Type find_vr_name(char *vr_name); +static double return_zero(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static double string_to_numeric(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static double get_short(Acr_VR_Entry *vr_entry, Acr_byte_order byte_order, char *data, long data_length); -private double get_float(Acr_VR_Entry *vr_entry, +static double get_long(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static double get_float(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static double get_double(Acr_VR_Entry *vr_entry, Acr_byte_order byte_order, char *data, long data_length); -private double get_double(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private double guess_numeric_type(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private void extend_internal_buffer(int length); -private char *return_empty_string(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private char *return_the_string(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); -private char *numeric_to_string(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length); +static double guess_numeric_type(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static void extend_internal_buffer(int length); +static char *return_empty_string(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static char *return_the_string(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); +static char *numeric_to_string(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length); /* Table of VRs and conversion routines */ static Acr_VR_Entry VR_table[] = { @@ -160,7 +163,7 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -private void check_table_integrity() +static void check_table_integrity() { int ientry; @@ -199,7 +202,7 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -private Acr_VR_Entry *get_vr_entry(Acr_VR_Type vr_code) +static Acr_VR_Entry *get_vr_entry(Acr_VR_Type vr_code) { CHECK_TABLE_INTEGRITY; @@ -231,7 +234,7 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -private Acr_VR_Type find_vr_name(char *vr_name) +static Acr_VR_Type find_vr_name(char *vr_name) { int ientry; @@ -270,7 +273,7 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char *acr_get_vr_name(Acr_VR_Type vr_code) +char *acr_get_vr_name(Acr_VR_Type vr_code) { Acr_VR_Entry *entry; @@ -292,7 +295,7 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public int acr_test_vr_name(char *vr_name) +int acr_test_vr_name(char *vr_name) { Acr_VR_Type vr_code; @@ -313,7 +316,7 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public Acr_VR_Type acr_lookup_vr_name(char *vr_name) +Acr_VR_Type acr_lookup_vr_name(char *vr_name) { Acr_VR_Type vr_code; int ientry; @@ -369,9 +372,9 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public double acr_get_numeric_vr(Acr_VR_Type vr_code, - Acr_byte_order byte_order, - char *data, long data_length) +double acr_get_numeric_vr(Acr_VR_Type vr_code, + Acr_byte_order byte_order, + char *data, long data_length) { Acr_VR_Entry *entry; @@ -397,9 +400,9 @@ @CREATED : January 31, 1997 (Peter Neelin) @MODIFIED : ---------------------------------------------------------------------------- */ -public char *acr_get_string_vr(Acr_VR_Type vr_code, - Acr_byte_order byte_order, - char *data, long data_length) +char *acr_get_string_vr(Acr_VR_Type vr_code, + Acr_byte_order byte_order, + char *data, long data_length) { Acr_VR_Entry *entry; @@ -431,25 +434,25 @@ ---------------------------------------------------------------------------- */ /* ARGSUSED */ -private double return_zero(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double return_zero(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { return 0.0; } /* ARGSUSED */ -private double string_to_numeric(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double string_to_numeric(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { return atof((char *) data); } /* ARGSUSED */ -private double get_short(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double get_short(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { unsigned short value; @@ -463,9 +466,9 @@ } /* ARGSUSED */ -private double get_long(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double get_long(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { long value; @@ -479,9 +482,9 @@ } /* ARGSUSED */ -private double get_float(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double get_float(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { float value; @@ -495,9 +498,9 @@ } /* ARGSUSED */ -private double get_double(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double get_double(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { double value; @@ -511,9 +514,9 @@ } /* ARGSUSED */ -private double guess_numeric_type(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static double guess_numeric_type(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { switch (data_length) { case ACR_SIZEOF_SHORT: @@ -552,7 +555,7 @@ static char *internal_string_buffer = NULL; static int length_of_internal_string = 0; -private void extend_internal_buffer(int length) +static void extend_internal_buffer(int length) { if (length+1 > length_of_internal_string) { @@ -566,9 +569,9 @@ } /* ARGSUSED */ -private char *return_empty_string(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static char *return_empty_string(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { extend_internal_buffer(LINE_LENGTH); @@ -578,17 +581,17 @@ } /* ARGSUSED */ -private char *return_the_string(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static char *return_the_string(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { return (char *) data; } /* ARGSUSED */ -private char *numeric_to_string(Acr_VR_Entry *vr_entry, - Acr_byte_order byte_order, - char *data, long data_length) +static char *numeric_to_string(Acr_VR_Entry *vr_entry, + Acr_byte_order byte_order, + char *data, long data_length) { extend_internal_buffer(LINE_LENGTH); (void) sprintf(internal_string_buffer, "%.6g",