diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-11-28 10:14:38 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-11-28 10:14:38 +0000 |
commit | d8ae65b9d3b754b04dcbbcd6543df9bcc8e3b97b (patch) | |
tree | 5c5b783bd7c27b8c821fa19df679da40b29b90a3 | |
parent | 3b005a7f212828fe358678ea0cc186b00fb1b015 (diff) | |
download | mpc-d8ae65b9d3b754b04dcbbcd6543df9bcc8e3b97b.tar.gz |
worked on problems for windows reported by MG
removed strange loop "do while (0)" in mpc-impl.h
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@363 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | Makefile.vc | 34 | ||||
-rw-r--r-- | src/mpc-impl.h | 12 | ||||
-rw-r--r-- | tests/test.c | 6 |
3 files changed, 27 insertions, 25 deletions
diff --git a/Makefile.vc b/Makefile.vc index 0936d22..21f421a 100644 --- a/Makefile.vc +++ b/Makefile.vc @@ -31,7 +31,7 @@ # install MPC to installdirectory # # nmake /f Makefile.vc check GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory -# perform tests on MPC +# perform tests on MPC # @@ -43,14 +43,14 @@ VERSION=0.5.1 ######################## do not edit below this line ########################## -DIRMPC=.\src\ -DIRMPCTESTS=$(DIRMPC)\..\tests\ +DIRMPC=.\src\ +DIRMPCTESTS=$(DIRMPC)\..\tests\ -INCLUDES = /I$(DIRMPC) /I$(GMPDIR)\include /I$(MPFR)\include +INCLUDES = /I$(DIRMPC) /I$(GMPDIR)\include /I$(MPFR)\include CKERNELFLAGS = $(CDEFAULTFLAGS) /D__GMP_LIBGMP_DLL $(INCLUDES) -CFLAGS = $(CKERNELFLAGS) /D__MPC_WITHIN_MPC /D_GMP_IEEE_FLOATS /DHAVE_CONFIG_H +CFLAGS = $(CKERNELFLAGS) /D__MPC_WITHIN_MPC /D_GMP_IEEE_FLOATS /DHAVE_CONFIG_H -TESTCOMPILE=$(CC) $(CKERNELFLAGS) $(DIRMPC)\..\tests\tgeneric.c $(DIRMPC)\..\tests\comparisons.c $(DIRMPC)\..\tests\read_data.c $(DIRMPC)\..\tests\random.c $(DIRMPC)\..\tests\ +TESTCOMPILE=$(CC) $(CKERNELFLAGS) $(DIRMPC)\..\tests\tgeneric.c $(DIRMPC)\..\tests\comparisons.c $(DIRMPC)\..\tests\read_data.c $(DIRMPC)\..\tests\random.c $(DIRMPC)\..\tests\ MIDTESTCOMPILE=/link /out:$(DIRMPCTESTS) ENDTESTCOMPILE=/LIBPATH:"$(GMPDIR)\lib" libmpc.lib libmpfr.lib libgmp.lib @@ -127,7 +127,7 @@ $(DIRMPC)\ui_div.obj \ $(DIRMPC)\ui_ui_sub.obj \ $(DIRMPC)\urandom.obj \ $(DIRMPC)\version.obj - + CPPLINKOBJECTS = abs.obj \ @@ -198,17 +198,17 @@ version.obj # executing its link command. # -$(LIBRARY): $(DIRMPC)config.h $(CPPOBJECTS) +$(LIBRARY): $(DIRMPC)config.h $(CPPOBJECTS) link.exe /DLL /out:$@ $(CPPLINKOBJECTS) /LIBPATH:"$(GMPDIR)\lib" libmpfr.lib libgmp.lib -$(DIRMPC)config.h : +$(DIRMPC)config.h : echo #define PACKAGE_STRING "mpc" >$(DIRMPC)config.h echo #define PACKAGE_VERSION "$(VERSION)" >>$(DIRMPC)config.h echo #define STDC_HEADERS 1 >>$(DIRMPC)config.h # -# Clean target: "nmake /f Makefile.vc clean" to remove unwanted +# Clean target: "nmake /f Makefile.vc clean" to remove unwanted # objects and executables. # @@ -221,7 +221,7 @@ clean: # install target: "nmake /f Makefile.vc install DESTDIR=xxx" to perform the installation. # -install: +install: -mkdir $(DESTDIR) -mkdir $(DESTDIR)\include copy $(DIRMPC)mpc.h $(DESTDIR)\include @@ -233,7 +233,7 @@ install: # install target: "nmake /f Makefile.vc check GMPDIR=xxx MPFRDIR=xxx" to perform the installation. # check : test -test : +test : copy $(GMPDIR)\lib\*gmp*.dll $(DIRMPCTESTS) copy $(MPFRDIR)\lib\*mpfr*.dll $(DIRMPCTESTS) copy $(LIBRARY) $(DIRMPCTESTS) @@ -261,8 +261,8 @@ test : cd $(DIRMPCTESTS) && tdiv_fr.exe && cd .. $(TESTCOMPILE)tdiv_ui.c $(MIDTESTCOMPILE)tdiv_ui.exe $(ENDTESTCOMPILE) cd $(DIRMPCTESTS) && tdiv_ui.exe && cd .. -# $(TESTCOMPILE)test.c $(MIDTESTCOMPILE)test.exe $(ENDTESTCOMPILE) -# cd $(DIRMPCTESTS) && test.exe && cd .. + $(TESTCOMPILE)test.c $(MIDTESTCOMPILE)test.exe $(ENDTESTCOMPILE) + cd $(DIRMPCTESTS) && test.exe && cd .. $(TESTCOMPILE)texp.c $(MIDTESTCOMPILE)texp.exe $(ENDTESTCOMPILE) cd $(DIRMPCTESTS) && texp.exe && cd .. $(TESTCOMPILE)tfr_div.c $(MIDTESTCOMPILE)tfr_div.exe $(ENDTESTCOMPILE) @@ -273,8 +273,8 @@ test : cd $(DIRMPCTESTS) && timag.exe && cd .. $(TESTCOMPILE)tlog.c $(MIDTESTCOMPILE)tlog.exe $(ENDTESTCOMPILE) cd $(DIRMPCTESTS) && tlog.exe && cd .. -# $(TESTCOMPILE)tmul.c $(MIDTESTCOMPILE)tmul.exe $(ENDTESTCOMPILE) -# cd $(DIRMPCTESTS) && tmul.exe && cd .. + $(TESTCOMPILE)tmul.c $(MIDTESTCOMPILE)tmul.exe $(ENDTESTCOMPILE) + cd $(DIRMPCTESTS) && tmul.exe && cd .. $(TESTCOMPILE)tmul_2exp.c $(MIDTESTCOMPILE)tmul_2exp.exe $(ENDTESTCOMPILE) cd $(DIRMPCTESTS) && tmul_2exp.exe && cd .. $(TESTCOMPILE)tmul_fr.c $(MIDTESTCOMPILE)tmul_fr.exe $(ENDTESTCOMPILE) @@ -318,4 +318,4 @@ test : @echo -------------------------------------------------- @echo All tests passed @echo -------------------------------------------------- - + diff --git a/src/mpc-impl.h b/src/mpc-impl.h index 386b256..4adc70f 100644 --- a/src/mpc-impl.h +++ b/src/mpc-impl.h @@ -60,11 +60,11 @@ MA 02111-1307, USA. */ #define SAFE_ABS(type,x) ((x) >= 0 ? (type)(x) : -(type)(x)) #define OUT(x) \ - do { \ +{ \ printf (#x "[%ld,%ld]=", MPC_PREC_RE (x), MPC_PREC_IM (x)); \ mpc_out_str (stdout, 2, 0, x, MPC_RNDNN); \ printf ("\n"); \ -} while (0) +} /* Logging macros */ @@ -104,16 +104,16 @@ MA 02111-1307, USA. */ #endif /* MPC_USE_LOGGING */ - + /* Define internal functions */ #if defined (__cplusplus) extern "C" { #endif - int mpc_mul_naive __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); - int mpc_mul_karatsuba __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); - unsigned long mpc_ceil_log2 __MPC_PROTO ((unsigned long)); +__MPC_DECLSPEC int mpc_mul_naive __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); +__MPC_DECLSPEC int mpc_mul_karatsuba __MPC_PROTO ((mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); +__MPC_DECLSPEC unsigned long mpc_ceil_log2 __MPC_PROTO ((unsigned long)); #if defined (__cplusplus) } diff --git a/tests/test.c b/tests/test.c index c81cf48..deaff0d 100644 --- a/tests/test.c +++ b/tests/test.c @@ -21,10 +21,12 @@ MA 02111-1307, USA. */ #define _XOPEN_SOURCE /* for fileno */ #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include "mpc.h" #include "mpc-impl.h" +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #define PRINT(x) {} @@ -123,7 +125,7 @@ main (void) fprintf (stderr, "\n"); exit (1); } - + /* other test with invalid real part */ file = fopen (filename, "w"); /* should work now */ fprintf (file, "invalid_real_part +I*1\n"); |