[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;
- [gnuastro-commits] master 474db42 07/16: Table and TEMPLATE added to the genauthors, (continued)
- [gnuastro-commits] master 474db42 07/16: Table and TEMPLATE added to the genauthors, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master 56bd4e5 03/16: checkset func for some option value allocations, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master c113fc3 09/16: Allocation for FITS types by datatype, not bitpix, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master 9c7d9a0 10/16: Blank replacement function now accepts datatype, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master 2071999 08/16: Blank CFITSIO pointers set by datatype, not bitpix, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master 01dfb1b 05/16: Some code management in Table, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master d09e850 04/16: FITS table column information printed by Table, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master 5606978 11/16: Configuration file in tests/during-dev.sh, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master c719806 06/16: Table accepts specified column number, name and regex, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master 647406f 02/16: Table utility bare minimum structure in place, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master ad16c2a 12/16: Cosmetic changes in fits and txtarray libraries,
Mohammad Akhlaghi <=
- [gnuastro-commits] master b16c7a4 15/16: New Section added to the book for Table, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master cd5b5cf 13/16: Table prints contents of a FITS table, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master b553085 01/16: Template for creating a new utility added, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master ce08c34 14/16: FITS (binary) tables <--> plain text in Table, Mohammad Akhlaghi, 2016/08/24
- [gnuastro-commits] master b78b0c7 16/16: New Table utility merged, Mohammad Akhlaghi, 2016/08/24