|
gimme-alpha 0.1
|
#include <glib.h>#include <gio/gio.h>
Include dependency graph for process-gimme-density-args.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | gimme_density_args |
Functions | |
| struct gimme_density_args * | process_gimme_density_args (int argc, char *argv[]) |
| struct gimme_density_args* process_gimme_density_args | ( | int | argc, |
| char * | argv[] | ||
| ) | [read] |
Definition at line 51 of file process-gimme-density-args.c.
References ARGDEFAULT_DEPRECATED_GROUP_HELPINFO, gimme_density_args::base_dir, gimme_density_args::dir, do_print_version(), gimme_density_args::material, print_version(), processed_args, gimme_density_args::xmax, and gimme_density_args::xmin.
Referenced by main().
{
gboolean print_version = FALSE;
GOptionEntry options[] = {
{ "dir", 'd', 0, G_OPTION_ARG_FILENAME, &(processed_args.dir), "Directory with nextnano output", NULL },
{ "material", 'm', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING, &(processed_args.material), "Calculate the total charge in this region (NOT IMPLEMENTED YET)", NULL },
{ "version", 'v', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &print_version, "Print version information about this program", NULL },
{ NULL }
};
GOptionEntry deprecated_opts[] = {
{ "xmin", 'x', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_DOUBLE, &(processed_args.xmin), "x coordinate from which to integrate the charge density", NULL },
{ "xmax", 'X', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_DOUBLE, &(processed_args.xmax), "x coordinate to which to integrate the charge density", NULL },
{ NULL }
};
GOptionContext *ctx;
GOptionGroup *deprecated_group;
ctx = g_option_context_new("- computes the Rashba spin-orbit parameter from the output of a nextnano well calculation.");
deprecated_group = g_option_group_new("deprecated", ARGDEFAULT_DEPRECATED_GROUP_HELPINFO, "Show help about deprecated options.", NULL, NULL);
g_option_group_add_entries(deprecated_group, deprecated_opts);
g_option_context_add_main_entries(ctx, options, "Options");
g_option_context_add_group(ctx, deprecated_group);
g_option_context_parse(ctx, &argc, &argv, NULL);
if(print_version){
do_print_version();
return NULL;
}
gchar* htext = g_option_context_get_help(ctx, FALSE, NULL);
int errored=0;
if(((isnan(processed_args.xmin) || isnan(processed_args.xmax))) && (processed_args.material == NULL)) {
fprintf(stderr, "ERROR: You MUST specify either --material or --xmin and --xmax!\n");
errored=1;
}
if((!((isnan(processed_args.xmin) || isnan(processed_args.xmax)))) && (processed_args.material != NULL)) {
fprintf(stderr, "ERROR: You MAY ONLY specify either --material or --xmin and --xmax, not both!\n");
errored=1;
}
g_option_context_free(ctx);
if(errored){
int errored=0;
printf("%s", htext);
printf("**Run with --version for version and compilation information**\n");
return NULL;
}
/*Check to make sure what we want is there.*/
processed_args.base_dir = g_file_new_for_commandline_arg(processed_args.dir);
/*
if(processed_args.base_dir != NULL)
fprintf(stderr, "base_dir OK\n");
else
fprintf(stderr, "base_dir NULL!!\n");
*/
return &processed_args;
}
Here is the call graph for this function:
Here is the caller graph for this function: