gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master c6462d1 016/125: Type conversion operators in


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c6462d1 016/125: Type conversion operators in Arithmetic
Date: Sun, 23 Apr 2017 22:36:27 -0400 (EDT)

branch: master
commit c6462d12540bf9bd2a76ef0ad24a18cf29b25af3
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Type conversion operators in Arithmetic
    
    In this branch, we are working on a root data structure to facilitate the
    manipulation of input, output and generally internal data processing. In
    particular, a data array pointer is generally stored as a `void *' and
    there is an element in the structure to keep its type. This will enable a
    high-level usage of the data structure independent of the actual type of
    the data.
    
    Until now, Arithmetic would convert all input numbers and arrays into
    double precision floating point numbers and do the processing on them. But
    as the datasets get larger, this process (both the conversion and the
    processing) can make things slow when the input data aren't `double' (most
    astronomical images are stored in single precision floating point types).
    
    Thanks to the new data type, it is now possible to actually do the
    arithmetic on arrays and numbers with their original input types. Since the
    original types are preserved in Arithmetic now, in some cases, it might be
    necessary to explicitly change the input types to another type (for example
    division of two integer arrays). With this commit the necessary type
    operators (based on the CFITSIO image types) have been defined and are now
    usable. The explanation of the operators is now also within the manual.
    
    Other minor corrections:
    
     - `data_arithmetic_not' didn't free the input if the caller asked for
       it. So this is also now corrected.
    
     - The part of `gal_data_alloc' which copied the WCS structure is now taken
       out as a separate `gal_data_copy_wcs', to generally copy the WCS of any
       data structure into another.
    
    This finishes task #14254.
---
 bin/arithmetic/arithmetic.c | 28 ++++++++++++++
 doc/gnuastro.texi           | 79 ++++++++++++++++++++++++++++++++++++++
 lib/data-arithmetic-unary.c | 78 +++++++++++++++++++++++++++++++-------
 lib/data-arithmetic-unary.h |  5 ++-
 lib/data.c                  | 68 ++++++++++++++++++++++++---------
 lib/gnuastro/data.h         | 92 ++++++++++++++++++++++++++-------------------
 6 files changed, 278 insertions(+), 72 deletions(-)

diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index 935207e..fea2328 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -91,6 +91,7 @@ reversepolish(struct imgarithparams *p)
         add_operand(p, NULL, d1);
       else
         {
+
           /* Order is the same as in the manual. */
           /* Simple arithmetic operators. */
           if      (!strcmp(token->v, "+" ))
@@ -166,11 +167,35 @@ reversepolish(struct imgarithparams *p)
           else if (!strcmp(token->v, "rshift"))
             { op=GAL_DATA_OPERATOR_BITRSH;        nop=2;  }
 
+          /* Type conversion. */
+          else if (!strcmp(token->v, "uchar"))
+            { op=GAL_DATA_OPERATOR_TO_UCHAR;      nop=1;  }
+          else if (!strcmp(token->v, "char"))
+            { op=GAL_DATA_OPERATOR_TO_CHAR;       nop=1;  }
+          else if (!strcmp(token->v, "ushort"))
+            { op=GAL_DATA_OPERATOR_TO_USHORT;     nop=1;  }
+          else if (!strcmp(token->v, "short"))
+            { op=GAL_DATA_OPERATOR_TO_SHORT;      nop=1;  }
+          else if (!strcmp(token->v, "ulong"))
+            { op=GAL_DATA_OPERATOR_TO_ULONG;      nop=1;  }
+          else if (!strcmp(token->v, "long"))
+            { op=GAL_DATA_OPERATOR_TO_LONG;       nop=1;  }
+          else if (!strcmp(token->v, "longlong"))
+            { op=GAL_DATA_OPERATOR_TO_LONGLONG;   nop=1;  }
+          else if (!strcmp(token->v, "float"))
+            { op=GAL_DATA_OPERATOR_TO_FLOAT;      nop=1;  }
+          else if (!strcmp(token->v, "double"))
+            { op=GAL_DATA_OPERATOR_TO_DOUBLE;     nop=1;  }
+
+
+          /* Finished checks with known operators */
           else
             error(EXIT_FAILURE, 0, "the argument \"%s\" could not be "
                   "interpretted as a FITS file, number, or operator",
                   token->v);
 
+
+
           /* Pop the necessary number of operators. Note that the operators
              are poped from a linked list (which is last-in-first-out). So
              for the operators which need a specific order, the first poped
@@ -203,6 +228,9 @@ reversepolish(struct imgarithparams *p)
         }
     }
 
+
+
+
 #if 0
 
           else if(!strcmp(token->v, "abs"))       takeabs(p);
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 1900f23..a5e167b 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -7337,6 +7337,85 @@ the right by a number of times given by the second 
operand. For example
 @code{00101000 2 rshift} will give @code{00001010}. Note that the bitwise
 operators only work on integer type datasets.
 
address@hidden uchar
+Convert the type of the popped operand to @code{unsigned char}. Different
+types of storange have a different number of bytes (and thus limits), they
+can also represent different standards of reading the bits.
+
+The most basic standard for reading the bits is integer numbers. Since we
+use CFITSIO, we define the @code{char}, @code{short}, or @code{long}
+integer types. These types can store an integer number (@mymath{..., -2,
+-1, 0, 1, 2, ...}), with an increasing number of bytes/bits and thus a
+limits. The range of integers each can represent is: @mymath{(-2^7, ...,
+2^7-1)}, @mymath{(-2^{15}, ..., 2^{15}-1}), and @mymath{(-2^{32}, ...,
+2^{31}-1)} respectively. One bit in the above types is dedicated to the
+number's sign (positive or negative). So, there is also an @code{unsigned}
+version where all the bits are counted in calculating the number. The
address@hidden types thus have larger positive limits, but no negative
+value with ranges @mymath{(0, ..., 2^8-1)}, @mymath{(0, ..., 2^{16}-1}),
+and @mymath{(0, ..., 2^{32}-1)} respectively. When the context of your work
+doesn't involve integer numbers (for example labeled images, where pixels
+can only have positive integers), it is best to use the @code{unsigned}
+types.
+
+The second standard of converting a given number of bits to numbers is the
+floating point standard, this standard can approximately store any real
+number with a given precision. There are two floating point types in
+CFITSIO: @code{float} and @code{double}, for single and double precision
+floating point numbers. The former is sufficient for data with less than 8
+significant decimal digits (most astronomical data), while the latter is
+good for less than 16 significant decimal digits. The representation of
+real numbers as bits is much more complex than integers, so we won't
+explain any further, if you are interested have a look in the
address@hidden://en.wikipedia.org/wiki/Floating_point, Wikipedia}.
+
+With the conversion operators in Gnuastro's Arithmetic, you can change the
+types of data to each other, which is necessary in some contexts. For
+example your program/library only accepts integer values for some
+operation, but you have a floating point image. Another example can be that
+you know that your data only has values that fit within @code{char} or
address@hidden types, however the current image format is
address@hidden Operations involving floating point or larger integer types
+are significantly slower than integer or smaller types respectively. In the
+latter case, it also requires more space to keep. So when you confront such
+situations and want to store/archive/process the data, it is best to use
+Arithmetic to convert them to the most efficient type.
+
address@hidden char
+Convert the type of the popped operand to @code{char}. See explanations
+under the @command{unsigned char} operator for more.
+
address@hidden ushort
+Convert the type of the popped operand to @code{unsigned short}. See
+explanations under the @command{unsigned char} operator for more.
+
address@hidden short
+Convert the type of the popped operand to @code{short}. See explanations
+under the @command{unsigned char} operator for more.
+
address@hidden ulong
+Convert the type of the popped operand to @code{unsigned long}. See
+explanations under the @command{unsigned char} operator for more.
+
address@hidden long
+Convert the type of the popped operand to @code{long}. See explanations
+under the @command{unsigned char} operator for more.
+
address@hidden longlong
+Convert the type of the popped operand to @code{long long} (64-bit
+integer). See explanations under the @command{unsigned char} operator for
+more.
+
address@hidden float
+Convert the type of the popped operand to @code{float} (single precision
+floating point). See explanations under the @command{unsigned char}
+operator for more.
+
address@hidden double
+Convert the type of the popped operand to @code{double} (double precision
+floating point). See explanations under the @command{unsigned char}
+operator for more.
+
 @end table
 
 @cartouche
diff --git a/lib/data-arithmetic-unary.c b/lib/data-arithmetic-unary.c
index 2ffbd7e..2f3ace2 100644
--- a/lib/data-arithmetic-unary.c
+++ b/lib/data-arithmetic-unary.c
@@ -32,6 +32,54 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 
+
+
+
+
+
+/* Change input data structure type. */
+gal_data_t *
+data_arithmetic_change_type(gal_data_t *data, int operator,
+                            unsigned char flags)
+{
+  int type=0;
+  gal_data_t *out;
+
+  /* Set the output type. */
+  switch(operator)
+    {
+    case GAL_DATA_OPERATOR_TO_UCHAR:    type=GAL_DATA_TYPE_UCHAR;    break;
+    case GAL_DATA_OPERATOR_TO_CHAR:     type=GAL_DATA_TYPE_UCHAR;    break;
+    case GAL_DATA_OPERATOR_TO_USHORT:   type=GAL_DATA_TYPE_USHORT;   break;
+    case GAL_DATA_OPERATOR_TO_SHORT:    type=GAL_DATA_TYPE_SHORT;    break;
+    case GAL_DATA_OPERATOR_TO_UINT:     type=GAL_DATA_TYPE_UINT;     break;
+    case GAL_DATA_OPERATOR_TO_INT:      type=GAL_DATA_TYPE_INT;      break;
+    case GAL_DATA_OPERATOR_TO_ULONG:    type=GAL_DATA_TYPE_ULONG;    break;
+    case GAL_DATA_OPERATOR_TO_LONG:     type=GAL_DATA_TYPE_LONG;     break;
+    case GAL_DATA_OPERATOR_TO_LONGLONG: type=GAL_DATA_TYPE_LONGLONG; break;
+    case GAL_DATA_OPERATOR_TO_FLOAT:    type=GAL_DATA_TYPE_FLOAT;    break;
+    case GAL_DATA_OPERATOR_TO_DOUBLE:   type=GAL_DATA_TYPE_DOUBLE;   break;
+
+    default:
+      error(EXIT_FAILURE, 0, "operator value of %d not recognized in "
+            "`data_arithmetic_change_type'", operator);
+    }
+
+  /* Copy to the new type. */
+  out=gal_data_copy_to_new_type(data, type);
+
+  /* Delete the input structure if the user asked for it. */
+  if(flags & GAL_DATA_ARITH_FREE)
+    gal_data_free(data);
+
+  /* Return */
+  return out;
+}
+
+
+
+
+
 /* Return an array of value 1 for any zero valued element and zero for any
    non-zero valued element. */
 #define TYPE_CASE_FOR_NOT(TYPE, IN, IN_FINISH) {                        \
@@ -41,26 +89,24 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
   }
 
 gal_data_t *
-data_arithmetic_not(gal_data_t *data)
+data_arithmetic_not(gal_data_t *data, unsigned char flags)
 {
   gal_data_t *out;
 
   /* 'value' will only be read from one of these based on the
      datatype. Which the caller assigned. If there is any problem, it is
      their responsability, not this function's.*/
-  void *A=data->array;
-  size_t S=data->size;
-  unsigned char     *uc = A,   *ucf = A+S, *o;
-  char               *c = A,    *cf = A+S;
-  unsigned short    *us = A,   *usf = A+S;
-  short              *s = A,    *sf = A+S;
-  unsigned int      *ui = A,   *uif = A+S;
-  int               *in = A,   *inf = A+S;
-  unsigned long     *ul = A,   *ulf = A+S;
-  long               *l = A,    *lf = A+S;
-  LONGLONG           *L = A,    *Lf = A+S;
-  float              *f = A,    *ff = A+S;
-  double             *d = A,    *df = A+S;
+  unsigned char     *uc = data->array,   *ucf = data->array + data->size, *o;
+  char               *c = data->array,    *cf = data->array + data->size;
+  unsigned short    *us = data->array,   *usf = data->array + data->size;
+  short              *s = data->array,    *sf = data->array + data->size;
+  unsigned int      *ui = data->array,   *uif = data->array + data->size;
+  int               *in = data->array,   *inf = data->array + data->size;
+  unsigned long     *ul = data->array,   *ulf = data->array + data->size;
+  long               *l = data->array,    *lf = data->array + data->size;
+  LONGLONG           *L = data->array,    *Lf = data->array + data->size;
+  float              *f = data->array,    *ff = data->array + data->size;
+  double             *d = data->array,    *df = data->array + data->size;
 
 
   /* Allocate the output array. */
@@ -95,6 +141,10 @@ data_arithmetic_not(gal_data_t *data)
             "in `data_arithmetic_not'", data->type);
     }
 
+  /* Delete the input structure if the user asked for it. */
+  if(flags & GAL_DATA_ARITH_FREE)
+    gal_data_free(data);
+
   /* Return */
   return out;
 }
diff --git a/lib/data-arithmetic-unary.h b/lib/data-arithmetic-unary.h
index 50954f0..847e9d2 100644
--- a/lib/data-arithmetic-unary.h
+++ b/lib/data-arithmetic-unary.h
@@ -23,9 +23,12 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #ifndef __GAL_ARITHMETIC_UNARY_H__
 #define __GAL_ARITHMETIC_UNARY_H__
 
+gal_data_t *
+data_arithmetic_change_type(gal_data_t *data, int operator,
+                            unsigned char flags);
 
 gal_data_t *
-data_arithmetic_not(gal_data_t *data);
+data_arithmetic_not(gal_data_t *data, unsigned char flags);
 
 
 #endif
diff --git a/lib/data.c b/lib/data.c
index 86bf0d1..f935c01 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -152,6 +152,27 @@ gal_data_sizeof(int type)
 
 
 
+/* Copy the WCS structure from the input to the output structure. */
+void
+gal_data_copy_wcs(gal_data_t *in, gal_data_t *out)
+{
+  if(in->wcs)
+    {
+      errno=0;
+      out->wcs=malloc(sizeof *out->wcs);
+      if(out->wcs==NULL)
+        error(EXIT_FAILURE, errno, "%zu bytes for out->wcs in "
+              "gal_data_copy_wcs", sizeof *out->wcs);
+      wcscopy(1, in->wcs, out->wcs);
+    }
+  else
+    out->wcs=NULL;
+}
+
+
+
+
+
 /* Allocate an array based on the value of type. Note that the argument
    `size' is the number of elements, necessary in the array, the number of
    bytes each element needs will be determined internaly by this function
@@ -349,7 +370,7 @@ gal_data_alloc(void *array, int type, size_t ndim, long 
*dsize,
                struct wcsprm *wcs, int clear, size_t minmapsize)
 {
   size_t i;
-  gal_data_t *out;
+  gal_data_t in, *out;
 
 
   /* Allocate the space for the actual structure. */
@@ -367,17 +388,12 @@ gal_data_alloc(void *array, int type, size_t ndim, long 
*dsize,
   out->type=type;
   out->anyblank=0;
   out->minmapsize=minmapsize;
-  if(wcs)
-    {
-      errno=0;
-      out->wcs=malloc(sizeof *out->wcs);
-      if(out->wcs==NULL)
-        error(EXIT_FAILURE, errno, "%zu bytes for out->wcs in "
-              "gal_data_alloc", sizeof *out->wcs);
-      wcscopy(1, wcs, out->wcs);
-    }
-  else
-    out->wcs=NULL;
+
+
+  /* Copy the WCS structure. Note that the `in' data structure was just
+     defined to keep this pointer to call `gal_data_copy_wcs'. */
+  in.wcs=wcs;
+  gal_data_copy_wcs(&in, out);
 
 
   /* Allocate space for the dsize array: */
@@ -1474,9 +1490,15 @@ gal_data_arithmetic(int operator, unsigned char flags, 
...)
 
     case GAL_DATA_OPERATOR_NOT:
       d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_not(d1);
+      out=data_arithmetic_not(d1, flags);
       break;
 
+    case GAL_DATA_OPERATOR_ISBLANK:
+      d1 = va_arg(va, gal_data_t *);
+      out = gal_data_flag_blank(d1);
+      if(flags & GAL_DATA_ARITH_FREE)
+        gal_data_free(d1);
+
     /* Binary operators that only work on integer types. */
     case GAL_DATA_OPERATOR_BITAND:
     case GAL_DATA_OPERATOR_BITOR:
@@ -1490,12 +1512,22 @@ gal_data_arithmetic(int operator, unsigned char flags, 
...)
 
     /* Ones component (bitwise) operator.*/
 
-    case GAL_DATA_OPERATOR_ISBLANK:
-      d1 = va_arg(va, gal_data_t *);
-      out = gal_data_flag_blank(d1);
-      if(flags & GAL_DATA_ARITH_FREE)
-        gal_data_free(d1);
 
+    /* Conversion operators. */
+    case GAL_DATA_OPERATOR_TO_UCHAR:
+    case GAL_DATA_OPERATOR_TO_CHAR:
+    case GAL_DATA_OPERATOR_TO_USHORT:
+    case GAL_DATA_OPERATOR_TO_SHORT:
+    case GAL_DATA_OPERATOR_TO_UINT:
+    case GAL_DATA_OPERATOR_TO_INT:
+    case GAL_DATA_OPERATOR_TO_ULONG:
+    case GAL_DATA_OPERATOR_TO_LONG:
+    case GAL_DATA_OPERATOR_TO_LONGLONG:
+    case GAL_DATA_OPERATOR_TO_FLOAT:
+    case GAL_DATA_OPERATOR_TO_DOUBLE:
+      d1 = va_arg(va, gal_data_t *);
+      data_arithmetic_change_type(d1, operator, flags);
+      break;
 
 
 #if 0
diff --git a/lib/gnuastro/data.h b/lib/gnuastro/data.h
index b8c0a61..1ee8c28 100644
--- a/lib/gnuastro/data.h
+++ b/lib/gnuastro/data.h
@@ -132,44 +132,55 @@ enum gal_data_alltypes
 
 enum gal_data_operators
 {
-  GAL_DATA_OPERATOR_PLUS,      /*   +    */
-  GAL_DATA_OPERATOR_MINUS,     /*   -    */
-  GAL_DATA_OPERATOR_MULTIPLY,  /*   *    */
-  GAL_DATA_OPERATOR_DIVIDE,    /*   /    */
-  GAL_DATA_OPERATOR_MODULO,    /*   %    */
-
-  GAL_DATA_OPERATOR_LT,        /*   <    */
-  GAL_DATA_OPERATOR_LE,        /*   <=   */
-  GAL_DATA_OPERATOR_GT,        /*   >    */
-  GAL_DATA_OPERATOR_GE,        /*   >=   */
-  GAL_DATA_OPERATOR_EQ,        /*   ==   */
-  GAL_DATA_OPERATOR_NE,        /*   !=   */
-  GAL_DATA_OPERATOR_AND,       /*   &&   */
-  GAL_DATA_OPERATOR_OR,        /*   ||   */
-
-  GAL_DATA_OPERATOR_BITAND,    /*   &    */
-  GAL_DATA_OPERATOR_BITOR,     /*   |    */
-  GAL_DATA_OPERATOR_BITXOR,    /*   ^    */
-  GAL_DATA_OPERATOR_BITLSH,    /*   <<   */
-  GAL_DATA_OPERATOR_BITRSH,    /*   >>   */
-  GAL_DATA_OPERATOR_BITOCM,    /*   ~    */
-
-  GAL_DATA_OPERATOR_NOT,       /*   !    */
-  GAL_DATA_OPERATOR_ISBLANK,   /* Similar to isnan() for floats. */
-  GAL_DATA_OPERATOR_WHERE,     /*   ?:   */
-
-  GAL_DATA_OPERATOR_ABS,       /* abs()  */
-  GAL_DATA_OPERATOR_POW,       /* pow()  */
-  GAL_DATA_OPERATOR_SQRT,      /* sqrt() */
-  GAL_DATA_OPERATOR_LOG,       /* log()  */
-  GAL_DATA_OPERATOR_LOG10,     /* log()  */
-
-  GAL_DATA_OPERATOR_MINVAL,    /* Minimum value of array.                */
-  GAL_DATA_OPERATOR_MAXVAL,    /* Maximum value of array.                */
-  GAL_DATA_OPERATOR_MIN,       /* Minimum per pixel of multiple arrays.  */
-  GAL_DATA_OPERATOR_MAX,       /* Maximum per pixel of multiple arrays.  */
-  GAL_DATA_OPERATOR_AVERAGE,   /* Average per pixel of multiple arrays.  */
-  GAL_DATA_OPERATOR_MEDIAN,    /* Median per pixel of multiple arrays.   */
+  GAL_DATA_OPERATOR_PLUS,         /*   +    */
+  GAL_DATA_OPERATOR_MINUS,        /*   -    */
+  GAL_DATA_OPERATOR_MULTIPLY,     /*   *    */
+  GAL_DATA_OPERATOR_DIVIDE,       /*   /    */
+  GAL_DATA_OPERATOR_MODULO,       /*   %    */
+
+  GAL_DATA_OPERATOR_LT,           /*   <    */
+  GAL_DATA_OPERATOR_LE,           /*   <=   */
+  GAL_DATA_OPERATOR_GT,           /*   >    */
+  GAL_DATA_OPERATOR_GE,           /*   >=   */
+  GAL_DATA_OPERATOR_EQ,           /*   ==   */
+  GAL_DATA_OPERATOR_NE,           /*   !=   */
+  GAL_DATA_OPERATOR_AND,          /*   &&   */
+  GAL_DATA_OPERATOR_OR,           /*   ||   */
+  GAL_DATA_OPERATOR_NOT,          /*   !    */
+  GAL_DATA_OPERATOR_ISBLANK,      /* Similar to isnan() for floats. */
+  GAL_DATA_OPERATOR_WHERE,        /*   ?:   */
+
+  GAL_DATA_OPERATOR_BITAND,       /*   &    */
+  GAL_DATA_OPERATOR_BITOR,        /*   |    */
+  GAL_DATA_OPERATOR_BITXOR,       /*   ^    */
+  GAL_DATA_OPERATOR_BITLSH,       /*   <<   */
+  GAL_DATA_OPERATOR_BITRSH,       /*   >>   */
+  GAL_DATA_OPERATOR_BITOCM,       /*   ~    */
+
+  GAL_DATA_OPERATOR_ABS,          /* abs()  */
+  GAL_DATA_OPERATOR_POW,          /* pow()  */
+  GAL_DATA_OPERATOR_SQRT,         /* sqrt() */
+  GAL_DATA_OPERATOR_LOG,          /* log()  */
+  GAL_DATA_OPERATOR_LOG10,        /* log()  */
+
+  GAL_DATA_OPERATOR_MINVAL,       /* Minimum value of array.               */
+  GAL_DATA_OPERATOR_MAXVAL,       /* Maximum value of array.               */
+  GAL_DATA_OPERATOR_MIN,          /* Minimum per pixel of multiple arrays. */
+  GAL_DATA_OPERATOR_MAX,          /* Maximum per pixel of multiple arrays. */
+  GAL_DATA_OPERATOR_AVERAGE,      /* Average per pixel of multiple arrays. */
+  GAL_DATA_OPERATOR_MEDIAN,       /* Median per pixel of multiple arrays.  */
+
+  GAL_DATA_OPERATOR_TO_UCHAR,     /* Convert to unsigned char.             */
+  GAL_DATA_OPERATOR_TO_CHAR,      /* Convert to char.                      */
+  GAL_DATA_OPERATOR_TO_USHORT,    /* Convert to unsigned short.            */
+  GAL_DATA_OPERATOR_TO_SHORT,     /* Convert to short.                     */
+  GAL_DATA_OPERATOR_TO_UINT,      /* Convert to unsigned int.              */
+  GAL_DATA_OPERATOR_TO_INT,       /* Convert to int.                       */
+  GAL_DATA_OPERATOR_TO_ULONG,     /* Convert to unsigned long.             */
+  GAL_DATA_OPERATOR_TO_LONG,      /* Convert to long.                      */
+  GAL_DATA_OPERATOR_TO_LONGLONG,  /* Convert to LONGLONG.                  */
+  GAL_DATA_OPERATOR_TO_FLOAT,     /* Convert to float.                     */
+  GAL_DATA_OPERATOR_TO_DOUBLE,    /* Convert to double.                    */
 };
 
 
@@ -215,6 +226,9 @@ typedef struct
 /*********************************************************************/
 /*************         Size and allocation         *******************/
 /*********************************************************************/
+void
+gal_data_copy_wcs(gal_data_t *in, gal_data_t *out);
+
 int
 gal_data_dsize_is_different(gal_data_t *first, gal_data_t *second);
 
@@ -307,4 +321,4 @@ gal_data_arithmetic(int operator, unsigned char flags, ...);
 
 __END_C_DECLS    /* From C++ preparations */
 
-#endif           /* __GAL_BOX_H__ */
+#endif           /* __GAL_DATA_H__ */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]