1funinfoput(3)                 SAORD Documentation                funinfoput(3)
2
3
4

NAME

6       FunInfoPut - put information into a Funtools struct
7

SYNOPSIS

9         #include <funtools.h>
10
11         int FunInfoPut(Fun fun, int type, char *addr, ...)
12

DESCRIPTION

14       The FunInfoPut() routine puts information into a Funtools structure.
15       The first argument is the Fun handle from which information is to be
16       retrieved.  After this first required argument comes a variable length
17       list of pairs of arguments. Each pair consists of an integer represent‐
18       ing the type of information to store and the address of the new infor‐
19       mation to store in the struct. The variable list is terminated by a 0.
20       The routine returns the number of put actions performed.
21
22       The full list of available information is described above with the Fun‐
23       InfoPut() routine. Although use of this routine is expected to be
24       uncommon, there is one important situation in which it plays an essen‐
25       tial part: writing multiple extensions to a single output file.
26
27       For input, multiple extensions are handled by calling FunOpen() for
28       each extension to be processed. When opening multiple inputs, it some‐
29       times is the case that you will want to process them and then write
30       them (including their header parameters) to a single output file.  To
31       accomplish this, you open successive input extensions using FunOpen()
32       and then call FunInfoPut() to set the Funtools reference handle of the
33       output file to that of the newly opened input extension:
34
35         /* open a new input extension */
36         ifun=FunOpen(tbuf, "r", NULL)) )
37         /* make the new extension the reference handle for the output file */
38         FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
39
40       Resetting FUN_IFUN has same effect as when a funtools handle is passed
41       as the final argument to FunOpen().  The state of the output file is
42       reset so that a new extension is ready to be written.  Thus, the next
43       I/O call on the output extension will output the header, as expected.
44
45       For example, in a binary table, after resetting FUN_IFUN you can then
46       call FunColumnSelect() to select the columns for output. When you then
47       call FunImagePut() or <A HREF="./library.html#funtablerowput">FunT‐
48       ableRowPut(), a new extension will be written that contains the header
49       parameters from the reference extension. Remember to call FunFlush() to
50       complete output of a given extension.
51
52       A complete example of this capability is given in the evcol example
53       code.  The central algorithm is:
54
55       ·   open the output file without a reference handle
56
57       ·   loop: open each input extension in turn
58
59           ·   set the reference handle for output to the newly opened input
60               extension
61
62           ·   read the input rows or image and perform processing
63
64           ·   write new rows or image to the output file
65
66           ·   flush the output
67
68           ·   close input extension
69
70       ·   close output file
71
72       Note that FunFlush() is called after processing each input extension in
73       order to ensure that the proper padding is written to the output file.
74       A call to FunFlush() also ensures that the extension header is written
75       to the output file in the case where there are no rows to output.
76
77       If you wish to output a new extension without using a Funtools refer‐
78       ence handle, you can call FunInfoPut() to reset the FUN_OPS value
79       directly.  For a binary table, you would then call FunColumnSelect() to
80       set up the columns for this new extension.
81
82         /* reset the operations performed on this handle */
83         int ops=0;
84         FunInfoPut(ofun, FUN_OPS, &ops, 0);
85         FunColumnSelect(fun, sizeof(EvRec), NULL,
86                         "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
87                         NULL);
88
89       Once the FUN_OPS variable has been reset, the next I/O call on the out‐
90       put extension will output the header, as expected.
91

SEE ALSO

93       See funtools(n) for a list of Funtools help pages
94
95
96
97version 1.4.0                   August 15, 2007                  funinfoput(3)
Impressum