Import Upstream version 0.8.2
[platform/upstream/mpc.git] / src / strtoc.c
index b96ccee..16c986f 100644 (file)
@@ -1,30 +1,30 @@
 /* mpc_strtoc -- Read a complex number from a string.
 
-Copyright (C) 2009, 2010, 2011 INRIA
+Copyright (C) 2009, 2010 Philippe Th\'eveny, Andreas Enge, Paul Zimmermann
 
-This file is part of GNU MPC.
+This file is part of the MPC Library.
 
-GNU MPC is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
+The MPC Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
 option) any later version.
 
-GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
-more details.
+The MPC Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+License for more details.
 
 You should have received a copy of the GNU Lesser General Public License
-along with this program. If not, see http://www.gnu.org/licenses/ .
-*/
+along with the MPC Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
 
 #include <string.h>
 #include <ctype.h>
 #include "mpc-impl.h"
 
 static void
-skip_whitespace (const char **p)
-{
+skip_whitespace (const char **p) {
    /* TODO: This function had better be inlined, but it is unclear whether
       the hassle to get this implemented across all platforms is worth it. */
    while (isspace ((unsigned char) **p))
@@ -32,8 +32,7 @@ skip_whitespace (const char **p)
 }
 
 int
-mpc_strtoc (mpc_ptr rop, const char *nptr, char **endptr, int base, mpc_rnd_t rnd)
-{
+mpc_strtoc (mpc_ptr rop, const char *nptr, char **endptr, int base, mpc_rnd_t rnd) {
    const char *p;
    char *end;
    int bracketed = 0;
@@ -51,20 +50,20 @@ mpc_strtoc (mpc_ptr rop, const char *nptr, char **endptr, int base, mpc_rnd_t rn
       ++p;
    }
 
-   inex_re = mpfr_strtofr (mpc_realref(rop), p, &end, base, MPC_RND_RE (rnd));
+   inex_re = mpfr_strtofr (MPC_RE(rop), p, &end, base, MPC_RND_RE (rnd));
    if (end == p)
       goto error;
    p = end;
 
    if (!bracketed)
-     inex_im = mpfr_set_ui (mpc_imagref (rop), 0ul, GMP_RNDN);
+     inex_im = mpfr_set_ui (MPC_IM (rop), 0ul, GMP_RNDN);
    else {
      if (!isspace ((unsigned char)*p))
          goto error;
 
       skip_whitespace (&p);
 
-      inex_im = mpfr_strtofr (mpc_imagref(rop), p, &end, base, MPC_RND_IM (rnd));
+      inex_im = mpfr_strtofr (MPC_IM(rop), p, &end, base, MPC_RND_IM (rnd));
       if (end == p)
          goto error;
       p = end;
@@ -83,7 +82,7 @@ mpc_strtoc (mpc_ptr rop, const char *nptr, char **endptr, int base, mpc_rnd_t rn
 error:
    if (endptr != NULL)
      *endptr = (char*) nptr;
-   mpfr_set_nan (mpc_realref (rop));
-   mpfr_set_nan (mpc_imagref (rop));
+   mpfr_set_nan (MPC_RE (rop));
+   mpfr_set_nan (MPC_IM (rop));
    return -1;
 }