Commit 78572b5d authored by Edward Vigmond's avatar Edward Vigmond
Browse files

Added sources to make igbhead in the utils subdir

parent 3c6a0f61
......@@ -82,3 +82,6 @@ TBmeshWin.o: TBmeshWin.cc $(READER_OBJS)
%.o : %.C
c++ -c $(CFLAGS) $(INCLUDES) $<
utils:
(cd utils; make )
../IGBheader.cc
\ No newline at end of file
../IGBheader.h
\ No newline at end of file
####################################################
#
# Makefile for igbutils
#
# All rights , etc., blah, blah, blah Edward Vigmond
#
####################################################
OBJS = igbhead.o \
IGBheader.o \
cmdline.o \
getopt.o \
getopt1.o
all: $(OBJS)
g++ $(CFLAGS) -I.. -g -static $(LDFLAGS) -o igbhead $(OBJS) -lz
install: igbhead
$(INSTALL) igbhead $(bindir)
%.o : %.cc
$(CXX) -c -g $(CPPFLAGS) -I../src $(CFLAGS) $(INCLUDES) -o $@ $<
%.o : %.c
$(CC) -c -g $(CPPFLAGS) $(CFLAGS) $(INCLUDES) -o $@ $<
cmdline.c: igbhead.ggo
gengetopt -u < igbhead.ggo
clean:
rm *.o
This diff is collapsed.
/** @file cmdline.h
* @brief The header file for the command line option parser
* generated by GNU Gengetopt version 2.21
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
#ifndef CMDLINE_H
#define CMDLINE_H
/* If we use autoconf. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef CMDLINE_PARSER_PACKAGE
/** @brief the program name */
#define CMDLINE_PARSER_PACKAGE "igbhead"
#endif
#ifndef CMDLINE_PARSER_VERSION
/** @brief the program version */
#define CMDLINE_PARSER_VERSION "0.1"
#endif
/** @brief Where the command line options are stored */
struct gengetopt_args_info
{
const char *help_help; /**< @brief Print help and exit help description. */
const char *version_help; /**< @brief Print version and exit help description. */
int x_arg; /**< @brief number of x pixels. */
char * x_orig; /**< @brief number of x pixels original value given at command line. */
const char *x_help; /**< @brief number of x pixels help description. */
int y_arg; /**< @brief number of y pixels. */
char * y_orig; /**< @brief number of y pixels original value given at command line. */
const char *y_help; /**< @brief number of y pixels help description. */
int z_arg; /**< @brief number of z pixels. */
char * z_orig; /**< @brief number of z pixels original value given at command line. */
const char *z_help; /**< @brief number of z pixels help description. */
int t_arg; /**< @brief number of time slices. */
char * t_orig; /**< @brief number of time slices original value given at command line. */
const char *t_help; /**< @brief number of time slices help description. */
char * data_type_arg; /**< @brief char byte int uint float long double vec3f vec4f vec3d vec4d OR rgba. */
char * data_type_orig; /**< @brief char byte int uint float long double vec3f vec4f vec3d vec4d OR rgba original value given at command line. */
const char *data_type_help; /**< @brief char byte int uint float long double vec3f vec4f vec3d vec4d OR rgba help description. */
char * system_arg; /**< @brief big_||little_endian. */
char * system_orig; /**< @brief big_||little_endian original value given at command line. */
const char *system_help; /**< @brief big_||little_endian help description. */
float dim_x_arg; /**< @brief Size in x. */
char * dim_x_orig; /**< @brief Size in x original value given at command line. */
const char *dim_x_help; /**< @brief Size in x help description. */
float dim_y_arg; /**< @brief Size in y. */
char * dim_y_orig; /**< @brief Size in y original value given at command line. */
const char *dim_y_help; /**< @brief Size in y help description. */
float dim_z_arg; /**< @brief Size in z. */
char * dim_z_orig; /**< @brief Size in z original value given at command line. */
const char *dim_z_help; /**< @brief Size in z help description. */
float dim_t_arg; /**< @brief Duration. */
char * dim_t_orig; /**< @brief Duration original value given at command line. */
const char *dim_t_help; /**< @brief Duration help description. */
float fac_x_arg; /**< @brief Scaling factor in x. */
char * fac_x_orig; /**< @brief Scaling factor in x original value given at command line. */
const char *fac_x_help; /**< @brief Scaling factor in x help description. */
float fac_y_arg; /**< @brief Scaling factor in y. */
char * fac_y_orig; /**< @brief Scaling factor in y original value given at command line. */
const char *fac_y_help; /**< @brief Scaling factor in y help description. */
float fac_z_arg; /**< @brief Scaling factor in z. */
char * fac_z_orig; /**< @brief Scaling factor in z original value given at command line. */
const char *fac_z_help; /**< @brief Scaling factor in z help description. */
float fac_t_arg; /**< @brief Scaling factor in t. */
char * fac_t_orig; /**< @brief Scaling factor in t original value given at command line. */
const char *fac_t_help; /**< @brief Scaling factor in t help description. */
float org_x_arg; /**< @brief Origin for x. */
char * org_x_orig; /**< @brief Origin for x original value given at command line. */
const char *org_x_help; /**< @brief Origin for x help description. */
float org_y_arg; /**< @brief Origin for y. */
char * org_y_orig; /**< @brief Origin for y original value given at command line. */
const char *org_y_help; /**< @brief Origin for y help description. */
float org_z_arg; /**< @brief Origin for z. */
char * org_z_orig; /**< @brief Origin for z original value given at command line. */
const char *org_z_help; /**< @brief Origin for z help description. */
float org_t_arg; /**< @brief Origin for t. */
char * org_t_orig; /**< @brief Origin for t original value given at command line. */
const char *org_t_help; /**< @brief Origin for t help description. */
float inc_x_arg; /**< @brief Increment in x. */
char * inc_x_orig; /**< @brief Increment in x original value given at command line. */
const char *inc_x_help; /**< @brief Increment in x help description. */
float inc_y_arg; /**< @brief Increment in y. */
char * inc_y_orig; /**< @brief Increment in y original value given at command line. */
const char *inc_y_help; /**< @brief Increment in y help description. */
float inc_z_arg; /**< @brief Increment in z. */
char * inc_z_orig; /**< @brief Increment in z original value given at command line. */
const char *inc_z_help; /**< @brief Increment in z help description. */
float inc_t_arg; /**< @brief Increment in t. */
char * inc_t_orig; /**< @brief Increment in t original value given at command line. */
const char *inc_t_help; /**< @brief Increment in t help description. */
float data_factor_arg; /**< @brief Scaling factor for data. */
char * data_factor_orig; /**< @brief Scaling factor for data original value given at command line. */
const char *data_factor_help; /**< @brief Scaling factor for data help description. */
float data_zero_arg; /**< @brief Origin for data scaling. */
char * data_zero_orig; /**< @brief Origin for data scaling original value given at command line. */
const char *data_zero_help; /**< @brief Origin for data scaling help description. */
char * author_arg; /**< @brief Author name with no spaces. */
char * author_orig; /**< @brief Author name with no spaces original value given at command line. */
const char *author_help; /**< @brief Author name with no spaces help description. */
char * x_units_arg; /**< @brief Units for x. */
char * x_units_orig; /**< @brief Units for x original value given at command line. */
const char *x_units_help; /**< @brief Units for x help description. */
char * y_units_arg; /**< @brief Units for y. */
char * y_units_orig; /**< @brief Units for y original value given at command line. */
const char *y_units_help; /**< @brief Units for y help description. */
char * z_units_arg; /**< @brief Units for z. */
char * z_units_orig; /**< @brief Units for z original value given at command line. */
const char *z_units_help; /**< @brief Units for z help description. */
char * t_units_arg; /**< @brief Units for t. */
char * t_units_orig; /**< @brief Units for t original value given at command line. */
const char *t_units_help; /**< @brief Units for t help description. */
const char *jive_time_help; /**< @brief Make no. time slices jive with data size help description. */
char * transparent_arg; /**< @brief Transparent pixel value in hex. */
char * transparent_orig; /**< @brief Transparent pixel value in hex original value given at command line. */
const char *transparent_help; /**< @brief Transparent pixel value in hex help description. */
const char *no_transparent_help; /**< @brief Turn transparency off help description. */
const char *decapitate_help; /**< @brief Remove header help description. */
char * comment_arg; /**< @brief Add a line of comment. */
char * comment_orig; /**< @brief Add a line of comment original value given at command line. */
const char *comment_help; /**< @brief Add a line of comment help description. */
const char *clear_comment_help; /**< @brief Clear all comments help description. */
char * output_file_arg; /**< @brief output file. */
char * output_file_orig; /**< @brief output file original value given at command line. */
const char *output_file_help; /**< @brief output file help description. */
char * frankenstein_arg; /**< @brief attach header to this file. */
char * frankenstein_orig; /**< @brief attach header to this file original value given at command line. */
const char *frankenstein_help; /**< @brief attach header to this file help description. */
const char *explode_help; /**< @brief explode file into igb time slices help description. */
const char *memfeminize_help; /**< @brief convert igb to memfem format help description. */
int help_given ; /**< @brief Whether help was given. */
int version_given ; /**< @brief Whether version was given. */
int x_given ; /**< @brief Whether x was given. */
int y_given ; /**< @brief Whether y was given. */
int z_given ; /**< @brief Whether z was given. */
int t_given ; /**< @brief Whether t was given. */
int data_type_given ; /**< @brief Whether data-type was given. */
int system_given ; /**< @brief Whether system was given. */
int dim_x_given ; /**< @brief Whether dim-x was given. */
int dim_y_given ; /**< @brief Whether dim-y was given. */
int dim_z_given ; /**< @brief Whether dim-z was given. */
int dim_t_given ; /**< @brief Whether dim-t was given. */
int fac_x_given ; /**< @brief Whether fac-x was given. */
int fac_y_given ; /**< @brief Whether fac-y was given. */
int fac_z_given ; /**< @brief Whether fac-z was given. */
int fac_t_given ; /**< @brief Whether fac-t was given. */
int org_x_given ; /**< @brief Whether org-x was given. */
int org_y_given ; /**< @brief Whether org-y was given. */
int org_z_given ; /**< @brief Whether org-z was given. */
int org_t_given ; /**< @brief Whether org-t was given. */
int inc_x_given ; /**< @brief Whether inc-x was given. */
int inc_y_given ; /**< @brief Whether inc-y was given. */
int inc_z_given ; /**< @brief Whether inc-z was given. */
int inc_t_given ; /**< @brief Whether inc-t was given. */
int data_factor_given ; /**< @brief Whether data-factor was given. */
int data_zero_given ; /**< @brief Whether data-zero was given. */
int author_given ; /**< @brief Whether author was given. */
int x_units_given ; /**< @brief Whether x-units was given. */
int y_units_given ; /**< @brief Whether y-units was given. */
int z_units_given ; /**< @brief Whether z-units was given. */
int t_units_given ; /**< @brief Whether t-units was given. */
int jive_time_given ; /**< @brief Whether jive-time was given. */
int transparent_given ; /**< @brief Whether transparent was given. */
int no_transparent_given ; /**< @brief Whether no-transparent was given. */
int decapitate_given ; /**< @brief Whether decapitate was given. */
int comment_given ; /**< @brief Whether comment was given. */
int clear_comment_given ; /**< @brief Whether clear-comment was given. */
int output_file_given ; /**< @brief Whether output-file was given. */
int frankenstein_given ; /**< @brief Whether frankenstein was given. */
int explode_given ; /**< @brief Whether explode was given. */
int memfeminize_given ; /**< @brief Whether memfeminize was given. */
char **inputs ; /**< @brief unamed options (options without names) */
unsigned inputs_num ; /**< @brief unamed options number */
} ;
/** @brief The additional parameters to pass to parser functions */
struct cmdline_parser_params
{
int override; /**< @brief whether to override possibly already present options (default 0) */
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 0) */
int check_required; /**< @brief whether to check that all required options were provided (default 0) */
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
} ;
/** @brief the purpose string of the program */
extern const char *gengetopt_args_info_purpose;
/** @brief the usage string of the program */
extern const char *gengetopt_args_info_usage;
/** @brief all the lines making the help output */
extern const char *gengetopt_args_info_help[];
/**
* The command line parser
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser (int argc, char * const *argv,
struct gengetopt_args_info *args_info);
/**
* The command line parser (version with additional parameters - deprecated)
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @param override whether to override possibly already present options
* @param initialize whether to initialize the option structure my_args_info
* @param check_required whether to check that all required options were provided
* @return 0 if everything went fine, NON 0 if an error took place
* @deprecated use cmdline_parser_ext() instead
*/
int cmdline_parser2 (int argc, char * const *argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);
/**
* The command line parser (version with additional parameters)
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser_ext (int argc, char * const *argv,
struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params);
/**
* Save the contents of the option struct into a (text) file.
* This file can be read by the config file parser (if generated by gengetopt)
* @param filename the file where to save
* @param args_info the option struct to save
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser_file_save(const char *filename,
struct gengetopt_args_info *args_info);
/**
* Print the help
*/
void cmdline_parser_print_help(void);
/**
* Print the version
*/
void cmdline_parser_print_version(void);
/**
* Allocates dynamically a cmdline_parser_params structure and initializes
* all its fields to 0
* @return the initialized cmdline_parser_params structure
*/
struct cmdline_parser_params *cmdline_parser_params_init();
/**
* Initializes the passed gengetopt_args_info structure's fields
* (also set default values for options that have a default)
* @param args_info the structure to initialize
*/
void cmdline_parser_init (struct gengetopt_args_info *args_info);
/**
* Deallocates the string fields of the gengetopt_args_info structure
* (but does not deallocate the structure itself)
* @param args_info the structure to deallocate
*/
void cmdline_parser_free (struct gengetopt_args_info *args_info);
/**
* Checks that all the required options were specified
* @param args_info the structure to check
* @param prog_name the name of the program that will be used to print
* possible errors
* @return
*/
int cmdline_parser_required (struct gengetopt_args_info *args_info,
const char *prog_name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CMDLINE_H */
This diff is collapsed.
/* Declarations for getopt.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if __STDC__
#if defined(__GNU_LIBRARY__)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* not __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H */
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "getopt.h"
#if !__STDC__ && !defined(const) && IN_GCC
#define const
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == EOF)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':