gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master ad16c2a 12/16: Cosmetic changes in fits and tx


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master ad16c2a 12/16: Cosmetic changes in fits and txtarray libraries
Date: Wed, 24 Aug 2016 22:27:44 +0000 (UTC)

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

    Cosmetic changes in fits and txtarray libraries
    
    In preparation to be more usable/readable some very minor cosmetic changes
    were made in these two libraries:
    
      - `lib/fits.c': The various variable types of `gal_fits_change_type' were
        ordered in a much more readable fashion. This was part of an initial
        effor to also make this function accept the datatype instead of
        `bitpix', following commits 2071999, c113fc3, and 9c7d9a0. However,
        after trying to start the internals of this function, I realized that
        we have to find a more generic way, adding all the different datatypes
        would make this function too long. I am still thinking on it. But until
        then, this better variable ordering can be useful, so it is included in
        this commit.
    
      - `lib/txtarray.[ch]': The Table utility also deals with making a printf
        format string, so the old `doformatting' function in `lib/txtarray.c'
        was renamed to `gal_txtarray_printf_format' in both the `.c' and `.h'
        files.
---
 lib/fits.c              |   12 ++++++------
 lib/gnuastro/txtarray.h |    4 ++++
 lib/txtarray.c          |    7 ++++---
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/lib/fits.c b/lib/fits.c
index e1343e6..d5d7d91 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -664,12 +664,12 @@ gal_fits_change_type(void *in, int inbitpix, size_t size, 
int anyblank,
                      void **out, int outbitpix)
 {
   size_t i=0;
-  unsigned char *b, *bf, *ib=in, *iib=in;
-  short *s, *sf, *is=in, *iis=in;
-  long *l, *lf, *il=in, *iil=in;
-  LONGLONG *L, *Lf, *iL=in, *iiL=in;
-  float *f, *ff, *iif=in, *iiif=in;
-  double *d, *df, *id=in, *iid=in;
+  unsigned char *b, *bf,  *ib=in,  *iib=in;
+  short         *s, *sf,  *is=in,  *iis=in;
+  long          *l, *lf,  *il=in,  *iil=in;
+  LONGLONG      *L, *Lf,  *iL=in,  *iiL=in;
+  float         *f, *ff, *iif=in, *iiif=in;
+  double        *d, *df,  *id=in,  *iid=in;
 
   /* Allocate space for the output and start filling it. */
   *out=gal_fits_datatype_alloc(size, gal_fits_bitpix_to_dtype(outbitpix) );
diff --git a/lib/gnuastro/txtarray.h b/lib/gnuastro/txtarray.h
index 277adb3..6c65281 100644
--- a/lib/gnuastro/txtarray.h
+++ b/lib/gnuastro/txtarray.h
@@ -50,6 +50,10 @@ gal_txtarray_txt_to_array(char *filename, double **array,
                           size_t *s0, size_t *s1);
 
 void
+gal_txtarray_printf_format(int numcols, char **fmt, int *int_cols,
+                           int *accu_cols, int *space, int *prec, char forg);
+
+void
 gal_txtarray_array_to_txt(double *array, size_t s0, size_t s1, char *comments,
                           int *int_cols, int *accu_cols, int *space, int *prec,
                           char forg, const char *filename);
diff --git a/lib/txtarray.c b/lib/txtarray.c
index 638bd79..d5f11de 100644
--- a/lib/txtarray.c
+++ b/lib/txtarray.c
@@ -292,8 +292,8 @@ gal_txtarray_txt_to_array(char *filename, double **array,
    by writeasciitable and makes an array of formatting conditions that
    is suitable for printing.  */
 void
-doformatting(int numcols, char **fmt, int *int_cols, int *accu_cols,
-             int *space, int *prec, char forg)
+gal_txtarray_printf_format(int numcols, char **fmt, int *int_cols,
+                           int *accu_cols, int *space, int *prec, char forg)
 {
   int i,j, found=0;
 
@@ -403,7 +403,8 @@ gal_txtarray_array_to_txt(double *array, size_t s0, size_t 
s1,
           "column with %lu elements", s1);
 
   /* Prepare the formatting for each column */
-  doformatting(s1, fmt, int_cols, accu_cols, space, prec, forg);
+  gal_txtarray_printf_format(s1, fmt, int_cols, accu_cols,
+                             space, prec, forg);
 
   /* Open the output file: */
   errno=0;



reply via email to

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