From aadc7382adf50aaaa3e3ad002eb775c0fb9a6e99 Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Thu, 10 Apr 2008 10:50:22 +0000 Subject: fix printing of 64 bit integers (use all 64 bits, instead of only 32) --- scon.c | 12 ++++++++++++ scon.h | 8 ++++++++ ufileIO2.c | 10 +++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/scon.c b/scon.c index 8250e49..f0a24dd 100644 --- a/scon.c +++ b/scon.c @@ -638,6 +638,17 @@ void ew_print_string (char *s) fputs (s,stderr); } +#ifdef A64 +void w_print_int (long n) +{ + printf ("%ld",n); +} + +void ew_print_int (long n) +{ + fprintf (stderr,"%ld",n); +} +#else void w_print_int (int n) { printf ("%d",n); @@ -647,6 +658,7 @@ void ew_print_int (int n) { fprintf (stderr,"%d",n); } +#endif void w_print_real (double r) { diff --git a/scon.h b/scon.h index 570ab32..eadb68b 100644 --- a/scon.h +++ b/scon.h @@ -3,12 +3,20 @@ extern int w_get_int (int *i_p); extern int w_get_real (double *r_p); extern unsigned long w_get_text (char *string,unsigned long max_length); extern void w_print_char (char c); +#ifdef A64 +extern void w_print_int (long i); +#else extern void w_print_int (int i); +#endif extern void w_print_real (double r); extern void w_print_string (char *s); extern void w_print_text (char *s,unsigned long length); extern void ew_print_char (char c); +#ifdef A64 +extern void ew_print_int (long i); +#else extern void ew_print_int (int i); +#endif extern void ew_print_real (double r); extern void ew_print_string (char *s); extern void ew_print_text (char *s,unsigned long length); diff --git a/ufileIO2.c b/ufileIO2.c index 2aadfed..bd4b351 100644 --- a/ufileIO2.c +++ b/ufileIO2.c @@ -15,6 +15,10 @@ # include #endif +#ifdef __x86_64__ +# define A64 +#endif + #include "scon.h" extern void IO_error (char*); @@ -807,8 +811,12 @@ void file_write_char (int c,long fn) } } +#ifdef A64 +void file_write_int (long i,long fn) +#else void file_write_int (int i,long fn) -{ +#endif +{ if (fn