next up previous [pdf]

Next: sfcmplx: Create a complex Up: sfcat: Concatenate datasets. Previous: sfcat: Concatenate datasets.

Implementation: system/main/cat.c

The first input file is either in the list or in the standard input.

system/main/cat.c

Everything on the command line that does not contain a ``='' sign is treated as a file name, and the corresponding file object is added to the list.

system/main/cat.c

As explained above, if the space= parameter is not set, it is inferred from the program name: sfmerge corresponds to space=y and sfcat corresponds to space=n.

system/main/cat.c

Find the axis for the merging (from the command line axis= argument) and figure out two sizes: n1 for everything after the axis and n2 for everything before the axis.

system/main/cat.c

In the output, the selected axis will get extended.

system/main/cat.c

The rest is simple: loop through the datasets reading and writing the data in buffer-size chunks and adding extra empty chunks if space=y.

system/main/cat.c


next up previous [pdf]

Next: sfcmplx: Create a complex Up: sfcat: Concatenate datasets. Previous: sfcat: Concatenate datasets.

2012-07-19