Skip to content

Commit

Permalink
Fixed some Makefile config for the drawviz tool
Browse files Browse the repository at this point in the history
  • Loading branch information
TrimVis committed Dec 5, 2023
1 parent a397c72 commit 8860686
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/Drawviz/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CXXFLAGS= -O0 -Wno-deprecated -Wall
CCFLAGS= -O0
LDFLAGS= -lps -lboost_regex-mt
LDFLAGS= -lps -lboost_regex

all:
gengetopt < drawviz.ggo
Expand Down
111 changes: 71 additions & 40 deletions src/Drawviz/cmdline.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
File autogenerated by gengetopt version 2.22.1
File autogenerated by gengetopt version 2.23
generated with the following command:
gengetopt
Expand All @@ -17,26 +17,32 @@
#include <stdlib.h>
#include <string.h>

#include "getopt.h"
#ifndef FIX_UNUSED
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
#endif

#include <getopt.h>

#include "cmdline.h"

const char *gengetopt_args_info_purpose = "";

const char *gengetopt_args_info_usage = "Usage: drawviz [OPTIONS]...";
const char *gengetopt_args_info_usage = "Usage: drawviz [OPTION]...";

const char *gengetopt_args_info_versiontext = "";

const char *gengetopt_args_info_description = "";

const char *gengetopt_args_info_help[] = {
" -h, --help Print help and exit",
" -V, --version Print version and exit",
" -i, --inputfile=STRING Name of the inputfile (event data)",
" -o, --outputfile=STRING Name of the output file (postscript) \n (default=`timeline.ps')",
" -o, --outputfile=STRING Name of the output file (postscript)\n (default=`timeline.ps')",
" -l, --linethickness=INT Thickness of lines (default=`1')",
" -s, --starttime=INT Starttime, if only a interval should be drawn \n (default=`0')",
" -e, --endtime=INT Endtime, if only a interval should be drawn \n (default=`0')",
" --arrowheads If this flag is given, arrowheads will be drawn \n (default=off)",
" --descrtext If this flag is given, text will be written below \n o_send and o_recv (default=off)",
" -s, --starttime=INT Starttime, if only a interval should be drawn\n (default=`0')",
" -e, --endtime=INT Endtime, if only a interval should be drawn\n (default=`0')",
" --arrowheads If this flag is given, arrowheads will be drawn\n (default=off)",
" --descrtext If this flag is given, text will be written below\n o_send and o_recv (default=off)",
0
};

Expand All @@ -52,7 +58,7 @@ static
void clear_args (struct gengetopt_args_info *args_info);

static int
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params, const char *additional_error);

static int
Expand All @@ -78,6 +84,7 @@ void clear_given (struct gengetopt_args_info *args_info)
static
void clear_args (struct gengetopt_args_info *args_info)
{
FIX_UNUSED (args_info);
args_info->inputfile_arg = NULL;
args_info->inputfile_orig = NULL;
args_info->outputfile_arg = gengetopt_strdup ("timeline.ps");
Expand Down Expand Up @@ -113,22 +120,33 @@ void init_args_info(struct gengetopt_args_info *args_info)
void
cmdline_parser_print_version (void)
{
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
}

static void print_help_common(void) {
cmdline_parser_print_version ();

if (strlen(gengetopt_args_info_purpose) > 0)
printf("\n%s\n", gengetopt_args_info_purpose);
printf ("%s %s\n",
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
CMDLINE_PARSER_VERSION);

if (strlen(gengetopt_args_info_usage) > 0)
printf("\n%s\n", gengetopt_args_info_usage);

printf("\n");
if (strlen(gengetopt_args_info_versiontext) > 0)
printf("\n%s\n", gengetopt_args_info_versiontext);
}

if (strlen(gengetopt_args_info_description) > 0)
printf("%s\n\n", gengetopt_args_info_description);
static void print_help_common(void)
{
size_t len_purpose = strlen(gengetopt_args_info_purpose);
size_t len_usage = strlen(gengetopt_args_info_usage);

if (len_usage > 0) {
printf("%s\n", gengetopt_args_info_usage);
}
if (len_purpose > 0) {
printf("%s\n", gengetopt_args_info_purpose);
}

if (len_usage || len_purpose) {
printf("\n");
}

if (strlen(gengetopt_args_info_description) > 0) {
printf("%s\n\n", gengetopt_args_info_description);
}
}

void
Expand Down Expand Up @@ -200,8 +218,9 @@ cmdline_parser_release (struct gengetopt_args_info *args_info)


static void
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
{
FIX_UNUSED (values);
if (arg) {
fprintf(outfile, "%s=\"%s\"\n", opt, arg);
} else {
Expand Down Expand Up @@ -275,7 +294,7 @@ cmdline_parser_free (struct gengetopt_args_info *args_info)
char *
gengetopt_strdup (const char *s)
{
char *result = NULL;
char *result = 0;
if (!s)
return result;

Expand All @@ -287,17 +306,17 @@ gengetopt_strdup (const char *s)
}

int
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
{
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
}

int
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params)
{
int result;
result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
result = cmdline_parser_internal (argc, argv, args_info, params, 0);

if (result == EXIT_FAILURE)
{
Expand All @@ -309,7 +328,7 @@ cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *ar
}

int
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
{
int result;
struct cmdline_parser_params params;
Expand All @@ -320,7 +339,7 @@ cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_
params.check_ambiguity = 0;
params.print_errors = 1;

result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
result = cmdline_parser_internal (argc, argv, args_info, &params, 0);

if (result == EXIT_FAILURE)
{
Expand All @@ -336,7 +355,7 @@ cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog
{
int result = EXIT_SUCCESS;

if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
result = EXIT_FAILURE;

if (result == EXIT_FAILURE)
Expand All @@ -351,19 +370,20 @@ cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog
int
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
{
int error = 0;
int error_occurred = 0;
FIX_UNUSED (additional_error);

/* checks for required options */
if (! args_info->inputfile_given)
{
fprintf (stderr, "%s: '--inputfile' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
error = 1;
error_occurred = 1;
}


/* checks for dependences among options */

return error;
return error_occurred;
}


Expand All @@ -390,7 +410,8 @@ static char *package_name = 0;
static
int update_arg(void *field, char **orig_field,
unsigned int *field_given, unsigned int *prev_given,
char *value, char *possible_values[], const char *default_value,
char *value, const char *possible_values[],
const char *default_value,
cmdline_parser_arg_type arg_type,
int check_ambiguity, int override,
int no_free, int multiple_option,
Expand All @@ -401,6 +422,7 @@ int update_arg(void *field, char **orig_field,
const char *val = value;
int found;
char **string_field;
FIX_UNUSED (field);

stop_char = 0;
found = 0;
Expand All @@ -418,6 +440,7 @@ int update_arg(void *field, char **orig_field,
return 1; /* failure */
}

FIX_UNUSED (default_value);

if (field_given && *field_given && ! override)
return 0;
Expand Down Expand Up @@ -481,12 +504,13 @@ int update_arg(void *field, char **orig_field,


int
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
cmdline_parser_internal (
int argc, char **argv, struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params, const char *additional_error)
{
int c; /* Character of the parsed option. */

int error = 0;
int error_occurred = 0;
struct gengetopt_args_info local_args_info;

int override;
Expand All @@ -496,10 +520,16 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf

package_name = argv[0];

/* TODO: Why is this here? It is not used anywhere. */
override = params->override;
FIX_UNUSED(override);

initialize = params->initialize;
check_required = params->check_required;

/* TODO: Why is this here? It is not used anywhere. */
check_ambiguity = params->check_ambiguity;
FIX_UNUSED(check_ambiguity);

if (initialize)
cmdline_parser_init (args_info);
Expand All @@ -525,7 +555,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
{ "endtime", 1, NULL, 'e' },
{ "arrowheads", 0, NULL, 0 },
{ "descrtext", 0, NULL, 0 },
{ NULL, 0, NULL, 0 }
{ 0, 0, 0, 0 }
};

c = getopt_long (argc, argv, "hVi:o:l:s:e:", long_options, &option_index);
Expand Down Expand Up @@ -646,12 +676,12 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf

if (check_required)
{
error += cmdline_parser_required2 (args_info, argv[0], additional_error);
error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error);
}

cmdline_parser_release (&local_args_info);

if ( error )
if ( error_occurred )
return (EXIT_FAILURE);

return 0;
Expand All @@ -661,3 +691,4 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
cmdline_parser_release (&local_args_info);
return (EXIT_FAILURE);
}
/* vim: set ft=c noet ts=8 sts=8 sw=8 tw=80 nojs spell : */
19 changes: 13 additions & 6 deletions src/Drawviz/cmdline.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @file cmdline.h
* @brief The header file for the command line option parser
* generated by GNU Gengetopt version 2.22.1
* generated by GNU Gengetopt version 2.23
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
* @author GNU Gengetopt */

#ifndef CMDLINE_H
#define CMDLINE_H
Expand All @@ -20,10 +20,15 @@ extern "C" {
#endif /* __cplusplus */

#ifndef CMDLINE_PARSER_PACKAGE
/** @brief the program name */
/** @brief the program name (used for printing errors) */
#define CMDLINE_PARSER_PACKAGE "drawviz"
#endif

#ifndef CMDLINE_PARSER_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
#define CMDLINE_PARSER_PACKAGE_NAME "drawviz"
#endif

#ifndef CMDLINE_PARSER_VERSION
/** @brief the program version */
#define CMDLINE_PARSER_VERSION "0.1"
Expand Down Expand Up @@ -80,6 +85,8 @@ struct cmdline_parser_params
extern const char *gengetopt_args_info_purpose;
/** @brief the usage string of the program */
extern const char *gengetopt_args_info_usage;
/** @brief the description string of the program */
extern const char *gengetopt_args_info_description;
/** @brief all the lines making the help output */
extern const char *gengetopt_args_info_help[];

Expand All @@ -90,7 +97,7 @@ extern const char *gengetopt_args_info_help[];
* @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,
int cmdline_parser (int argc, char **argv,
struct gengetopt_args_info *args_info);

/**
Expand All @@ -104,7 +111,7 @@ int cmdline_parser (int argc, char * const *argv,
* @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,
int cmdline_parser2 (int argc, char **argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);

Expand All @@ -116,7 +123,7 @@ int cmdline_parser2 (int argc, char * const *argv,
* @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,
int cmdline_parser_ext (int argc, char **argv,
struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params);

Expand Down

0 comments on commit 8860686

Please sign in to comment.