gnuastro-devel
[Top][All Lists]
Advanced

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

[task #15317] Concatenate two or more tables


From: Mohammad Akhlaghi
Subject: [task #15317] Concatenate two or more tables
Date: Fri, 13 Mar 2020 08:10:50 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Follow-up Comment #7, task #15317 (project gnuastro):

I encourage you to read the Developing
<https://www.gnu.org/software/gnuastro/manual/html_node/Developing.html>
chapter of the book. In particular the Program source
<https://www.gnu.org/software/gnuastro/manual/html_node/Program-source.html>
and Mandatory source code files
<https://www.gnu.org/software/gnuastro/manual/html_node/Mandatory-source-code-files.html>
section and subsection. There, you'll see an explanation of all the basic
program source files. 

If you also have a look at the Gnuastro library
<https://www.gnu.org/software/gnuastro/manual/html_node/Gnuastro-library.html>
section, you will see how you can find the definition of the macros and
library functions. For example, you will see that `GAL_TYPE_STRLL' is defined
in the Library data types
<https://www.gnu.org/software/gnuastro/manual/html_node/Library-data-types.html>
section. 

Adding new options is easy once you get use to it, but I haven't had too much
time to document it yet unfortunately. In principle if you follow the
functions from `main.c' you will see how the program enters `ui.c', and how it
starts parsing the options.

But here is a summary of steps to add new options (I'll put this into the book
later):

0 Add an entry into `args.h', just like the `column' option that you cited.
The easiest case is to copy a similar option and re-set some of its parts. For
two options you want to add, the `column' option is a good reference to copy.
0 Go into `ui.h' and add a `UI_KEY_*' element with the same name as your new
option. This is the integer "key" that is used to identify your new option.
Then use that as the second element.
0 Update the option description (4th element) to describe what the option
does. This is printed with the `--help' option.
0 If you option belongs to a different "group" of options (see `--help' for
the grouping), change the group key.
0 Go to `main.h' and define an element in the main program structure to host
the values (in the case of the `--column' option, this is the `p->columns'
element). 
0 The "type" of the value is specified by the 8th element. For example if you
want you option to only read a single, 32-bit floating point, you would put
`GAL_TYPE_FLOAT32'.
0 If you have chosen a sufficiently similar option as a reference to copy
from, you won't need to change the final set of elements. But generally, you
can read about each element of this structure under in the comments of the
`argp_option' structure in `bootstrapped/lib/argp.h'.
0 If the program then compiles, you can simply pass the new option and
check/use its values in the program (after `ui.c') by looking into the element
you defined in `main.h' (`p->columns' in the case of the `--column' option).
All elements of the program's main structure get initialized to a 0 (for
numbers) or NULL (for pointers). So if your new function is a pointer (like
this case), one way to see if the user called your new option is to check if
its NULL or not.

I hope I haven't missed anything ;-).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/task/?15317>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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