本文整理汇总了C++中G_parser函数的典型用法代码示例。如果您正苦于以下问题:C++ G_parser函数的具体用法?C++ G_parser怎么用?C++ G_parser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_parser函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
struct Option *raster, *conf, *output;
struct GModule *module;
G_gisinit(argv[0]);
module = G_define_module();
module->description =
_("Calculates coefficient of variation of patch area on a raster map");
module->keywords = _("raster, landscape structure analysis, patch index");
/* define options */
raster = G_define_standard_option(G_OPT_R_MAP);
conf = G_define_option();
conf->key = "conf";
conf->description = _("Configuration file");
conf->gisprompt = "old_file,file,input";
conf->type = TYPE_STRING;
conf->required = YES;
output = G_define_standard_option(G_OPT_R_OUTPUT);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
return calculateIndex(conf->answer, patchAreaDistributionCV, NULL,
raster->answer, output->answer);
}
开发者ID:imincik,项目名称:pkg-grass,代码行数:25,代码来源:padcv.c
示例2: parse_command_line
static void parse_command_line(int argc, char **argv)
{
struct Option *driver, *database;
struct GModule *module;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
driver = G_define_standard_option(G_OPT_DB_DRIVER);
driver->options = db_list_drivers();
driver->required = YES;
driver->answer = (char *) db_get_default_driver_name();
database = G_define_standard_option(G_OPT_DB_DATABASE);
database->required = YES;
/* Set description */
module = G_define_module();
G_add_keyword(_("database"));
G_add_keyword(_("attribute table"));
G_add_keyword(_("SQL"));
module->description = _("Removes an existing database.");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
parms.driver = driver->answer;
parms.database = database->answer;
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:29,代码来源:main.c
示例3: main
int main(int argc, char **argv)
{
int i;
G_gisinit(argv[0]);
for (i = 0; i < MAXVIEWS; i++) {
char buf[BUFSIZ];
viewopts[i] = G_define_option();
sprintf(buf, "view%d", i + 1);
viewopts[i]->key = G_store(buf);
viewopts[i]->type = TYPE_STRING;
viewopts[i]->required = (i ? NO : YES);
viewopts[i]->multiple = YES;
viewopts[i]->gisprompt = "old,cell,Raster";;
sprintf(buf, _("Raster file(s) for View%d"), i + 1);
viewopts[i]->description = G_store(buf);
}
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
parse_command(viewopts, vfiles, &numviews, &frames);
return wxEntry(argc, argv);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:27,代码来源:main.cpp
示例4: main
int main(int argc, char *argv[])
{
char name[200];
char *fpath;
struct GModule *module;
struct Option *opt1;
module = G_define_module();
G_add_keyword(_("general"));
G_add_keyword(_("map management"));
G_add_keyword(_("scripts"));
module->description = "Searches for GRASS support files.";
G_gisinit(argv[0]);
/* Define the different options */
opt1 = G_define_option();
opt1->key = "file";
opt1->type = TYPE_STRING;
opt1->required = YES;
opt1->description = "Name of an file or directory";
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
strcpy(name, opt1->answer);
fpath = G_find_etc(name);
if (fpath)
fprintf(stdout, "%s\n", fpath);
exit(fpath ? EXIT_SUCCESS : EXIT_FAILURE);
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:34,代码来源:main.c
示例5: main
int main(int argc, char *argv[])
{
struct Option *raster, *conf, *output;
struct GModule *module;
G_gisinit(argv[0]);
module = G_define_module();
module->description =
_("Calculates range of patch area size on a raster map");
G_add_keyword(_("raster"));
G_add_keyword(_("landscape structure analysis"));
G_add_keyword(_("patch index"));
/* define options */
raster = G_define_standard_option(G_OPT_R_INPUT);
conf = G_define_standard_option(G_OPT_F_INPUT);
conf->key = "config";
conf->description = _("Configuration file");
conf->required = YES;
output = G_define_standard_option(G_OPT_R_OUTPUT);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
return calculateIndex(conf->answer, patchAreaDistributionRANGE, NULL,
raster->answer, output->answer);
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:28,代码来源:padrange.c
示例6: parse_command_line
static void parse_command_line(int argc, char **argv)
{
struct Option *driver, *database;
struct GModule *module;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
driver = G_define_standard_option(G_OPT_DRIVER);
driver->options = db_list_drivers();
driver->required = YES;
database = G_define_standard_option(G_OPT_DATABASE);
database->required = YES;
/* Set description */
module = G_define_module();
module->keywords = _("database, SQL");
module->description = _("Creates an empty database.");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
parms.driver = driver->answer;
parms.database = database->answer;
}
开发者ID:imincik,项目名称:pkg-grass,代码行数:26,代码来源:createdb.c
示例7: main
int main(int argc, char *argv[])
{
struct Option *raster, *conf, *output;
struct GModule *module;
G_gisinit(argv[0]);
module = G_define_module();
module->description = _("Calculates shape index on a raster map");
G_add_keyword(_("raster"));
G_add_keyword(_("landscape structure analysis"));
G_add_keyword(_("patch index"));
/* define options */
raster = G_define_standard_option(G_OPT_R_INPUT);
conf = G_define_option();
conf->key = "config";
conf->description = _("Configuration file");
conf->gisprompt = "old_file,file,input";
conf->type = TYPE_STRING;
conf->required = YES;
output = G_define_standard_option(G_OPT_R_OUTPUT);
/** add other options for index parameters here */
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
return calculateIndex(conf->answer, shape_index, NULL, raster->answer,
output->answer);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:34,代码来源:main.c
示例8: main
int main( int argc, char **argv )
{
char *mapset;
char *name;
int fp;
struct GModule *module;
struct Option *map;
struct Option *win;
struct Cell_head window;
/* Initialize the GIS calls */
G_gisinit( argv[0] );
module = G_define_module();
module->keywords = ( "display, raster" );
module->description = ( "Output raster map layers in a format suitable for display in QGIS" );
map = G_define_standard_option( G_OPT_R_MAP );
map->description = ( "Raster map to be displayed" );
win = G_define_option();
win->key = "window";
win->type = TYPE_DOUBLE;
win->multiple = YES;
win->description = "xmin,ymin,xmax,ymax,ncols,nrows";
if ( G_parser( argc, argv ) )
exit( EXIT_FAILURE );
name = map->answer;
/* Make sure map is available */
mapset = G_find_cell2( name, "" );
if ( mapset == NULL )
G_fatal_error(( "Raster map <%s> not found" ), name );
/* It can happen that GRASS data set is 'corrupted' and zone differs in WIND and
* cellhd, and G_open_cell_old fails, so it is better to read window from map */
/* G_get_window( &window ); */
G_get_cellhd( name, mapset, &window );
window.west = atof( win->answers[0] );
window.south = atof( win->answers[1] );
window.east = atof( win->answers[2] );
window.north = atof( win->answers[3] );
window.cols = atoi( win->answers[4] );
window.rows = atoi( win->answers[5] );
G_adjust_Cell_head( &window, 1, 1 );
G_set_window( &window );
fp = G_raster_map_is_fp( name, mapset );
/* use DCELL even if the map is FCELL */
if ( fp )
display( name, mapset, DCELL_TYPE );
else
display( name, mapset, CELL_TYPE );
exit( EXIT_SUCCESS );
}
开发者ID:mmubangizi,项目名称:qgis,代码行数:59,代码来源:qgis.d.rast.c
示例9: main
int main(int argc, char *argv[])
{
int nlines;
double textsize;
char *dxf_file;
struct Map_info In;
struct GModule *module;
struct Option *input, *output, *field;
G_gisinit(argv[0]);
/* Set description */
module = G_define_module();
G_add_keyword(_("vector"));
G_add_keyword(_("export"));
G_add_keyword(_("DXF"));
module->description =
_("Exports vector map to DXF file format.");
input = G_define_standard_option(G_OPT_V_INPUT);
field = G_define_standard_option(G_OPT_V_FIELD_ALL);
output = G_define_standard_option(G_OPT_F_OUTPUT);
output->required = YES;
output->description = _("Name for DXF output file");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
overwrite = module->overwrite;
/* open input vector */
dxf_file = G_store(output->answer);
Vect_set_open_level(2);
if (Vect_open_old2(&In, input->answer, "", field->answer) < 0)
G_fatal_error(_("Unable to open vector map <%s>"), input->answer);
dxf_open(dxf_file); /* open output */
textsize = do_limits(&In); /* does header in dxf_fp */
make_layername();
dxf_entities();
nlines = add_plines(&In, Vect_get_field_number(&In, field->answer),
textsize); /* puts plines in dxf_fp */
dxf_endsec();
dxf_eof(); /* puts final stuff in dxf_fp, closes file */
G_done_msg(_("%d features written to '%s'."), nlines, dxf_file);
G_free(dxf_file);
exit(EXIT_SUCCESS);
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:56,代码来源:main.c
示例10: user_input
void user_input(int argc, char **argv)
{
struct Flag *bound;
struct Flag *trace;
struct Option *name;
struct Option *out;
bound = G_define_flag();
bound->key = 'p';
bound->description = "Include sampling area boundary as perimeter";
trace = G_define_flag();
trace->key = 't';
trace->description = "Use 4 neighbor tracing instead of 8 neighbor";
name = G_define_option();
name->key = "map";
name->description = "Raster map to be analyzed";
name->type = TYPE_STRING;
name->gisprompt = "old,cell,raster";
name->required = YES;
out = G_define_option();
out->key = "out";
out->description = "Name of output file to store patch data";
out->type = TYPE_STRING;
out->required = NO;
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
strcpy(choice->fn, name->answer);
if (out->answer)
strcpy(choice->out, out->answer);
else
strcpy(choice->out, "");
/* if the 4 neighbor tracing flag -t
is specified, then set the
choice->trace flag to 1 */
choice->trace = 1;
if (trace->answer)
choice->trace = 0;
/* if the -p flag is specified, then
set the choice->perim2 flag to 0 */
if (bound->answer)
choice->perim2 = 0;
else
choice->perim2 = 1;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:56,代码来源:user_input.c
示例11: parse_args
void parse_args(int argc, char** argv,
char** input, char** field,
int* history, int* columns, int *shell)
{
int i;
const char *answer;
struct Option *input_opt, *field_opt;
struct Flag *hist_flag, *col_flag, *shell_flag, *region_flag, *topo_flag;
input_opt = G_define_standard_option(G_OPT_V_MAP);
field_opt = G_define_standard_option(G_OPT_V_FIELD);
hist_flag = G_define_flag();
hist_flag->key = 'h';
hist_flag->description = _("Print history instead of info and exit");
hist_flag->guisection = _("Print");
col_flag = G_define_flag();
col_flag->key = 'c';
col_flag->description =
_("Print types/names of table columns for specified layer instead of info and exit");
col_flag->guisection = _("Print");
shell_flag = G_define_flag();
shell_flag->key = 'g';
shell_flag->description = _("Print basic info in shell script style");
shell_flag->guisection = _("Print");
region_flag = G_define_flag();
region_flag->key = 'e';
region_flag->description = _("Print also region info in shell script style");
region_flag->guisection = _("Print");
topo_flag = G_define_flag();
topo_flag->key = 't';
topo_flag->description = _("Print also topology info in shell script style");
topo_flag->guisection = _("Print");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
*input = G_store(input_opt->answer);
*field = G_store(field_opt->answer);
*history = hist_flag->answer ? TRUE : FALSE;
*columns = col_flag->answer ? TRUE : FALSE;
i = 0;
*shell = SHELL_NO;
if (shell_flag->answer)
*shell |= SHELL_BASIC;
if (region_flag->answer)
*shell |= SHELL_REGION;
if (topo_flag->answer)
*shell |= SHELL_TOPO;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:56,代码来源:parse.c
示例12: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct Option *map, *date;
struct TimeStamp ts;
char *name;
int modify;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("metadata"));
G_add_keyword(_("timestamp"));
module->label = _("Modifies a timestamp for a raster map.");
module->description = _("Print/add/remove a timestamp for a raster map.");
map = G_define_standard_option(G_OPT_R_MAP);
date = G_define_option();
date->key = "date";
date->key_desc = "timestamp";
date->required = NO;
date->type = TYPE_STRING;
date->label = _("Datetime, datetime1/datetime2, or 'none' to remove");
date->description = _("Format: '15 jan 1994' (absolute) or '2 years' (relative)");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
name = map->answer;
modify = date->answer != NULL;
if (!modify) {
if (G_read_raster_timestamp(name, "", &ts) == 1) {
G__write_timestamp(stdout, &ts);
exit(EXIT_SUCCESS);
}
else
exit(EXIT_FAILURE);
}
if (strcmp(date->answer, "none") == 0) {
G_remove_raster_timestamp(name);
exit(EXIT_SUCCESS);
}
if (1 == G_scan_timestamp(&ts, date->answer)) {
G_write_raster_timestamp(name, &ts);
exit(EXIT_SUCCESS);
}
else
G_fatal_error(_("Invalid timestamp"));
exit(EXIT_SUCCESS);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:56,代码来源:main.c
示例13: parse_args
void parse_args(int argc, char **argv,
struct _options *options, struct _flags* flags)
{
options->dsn = G_define_option();
options->dsn->key = "dsn";
options->dsn->type = TYPE_STRING;
options->dsn->label = _("Name of input OGR or PostGIS data source");
options->dsn->description = _("Examples:\n"
"\t\tESRI Shapefile: directory containing a shapefile\n"
"\t\tMapInfo File: directory containing a mapinfo file\n"
"\t\tPostGIS database: connection string, eg. 'PG:dbname=db user=grass'");
options->dsn->required = YES;
options->layer = G_define_option();
options->layer->key = "layer";
options->layer->type = TYPE_STRING;
options->layer->required = NO;
options->layer->multiple = NO;
options->layer->label = _("Name of OGR layer or PostGIS feature table to be linked");
options->layer->description = _("Examples:\n"
"\t\tESRI Shapefile: shapefile name\n"
"\t\tMapInfo File: mapinfo file name\n"
"\t\tPostGIS database: table name");
options->layer->required = YES;
options->layer->key_desc = "name";
options->output = G_define_standard_option(G_OPT_V_OUTPUT);
options->output->required = NO;
options->output->description = _("Name for output GRASS vector map (default: input layer)");
flags->format = G_define_flag();
flags->format->key = 'f';
flags->format->description = _("List supported formats and exit");
flags->format->guisection = _("Print");
flags->format->suppress_required = YES;
flags->list = G_define_flag();
flags->list->key = 'l';
flags->list->description = _("List available layers in data source and exit");
flags->list->guisection = _("Print");
flags->list->suppress_required = YES;
flags->tlist = G_define_flag();
flags->tlist->key = 't';
flags->tlist->label = _("List available layers including feature type "
"in data source and exit");
flags->tlist->description = _("Format: layer name,type,projection check");
flags->tlist->guisection = _("Print");
flags->tlist->suppress_required = YES;
flags->topo = G_define_standard_flag(G_FLG_V_TOPO);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
}
开发者ID:caomw,项目名称:grass,代码行数:55,代码来源:args.c
示例14: parse
int parse(int argc, char *argv[], struct parms *parms)
{
struct Option *group, *subgroup, *sigfile, *output;
struct Option *blocksize;
struct Flag *ml;
group = G_define_standard_option(G_OPT_I_GROUP);
subgroup = G_define_standard_option(G_OPT_I_SUBGROUP);
sigfile = G_define_option();
sigfile->key = "signaturefile";
sigfile->label = _("Name of file containing signatures");
sigfile->description = _("Generated by i.gensigset");
sigfile->key_desc = "name";
sigfile->required = YES;
sigfile->type = TYPE_STRING;
output = G_define_standard_option(G_OPT_R_OUTPUT);
blocksize = G_define_option();
blocksize->key = "blocksize";
blocksize->description = _("Size of submatrix to process at one time");
blocksize->required = NO;
blocksize->type = TYPE_INTEGER;
blocksize->answer = "128";
ml = G_define_flag();
ml->key = 'm';
ml->description =
_("Use maximum likelihood estimation (instead of smap)");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
parms->ml = ml->answer;
parms->output_map = output->answer;
parms->group = group->answer;
parms->subgroup = subgroup->answer;
parms->sigfile = sigfile->answer;
/* check all the inputs */
if (!I_find_group(parms->group))
G_fatal_error(_("Group <%s> not found"), parms->group);
if (!I_find_subgroup(parms->group, parms->subgroup))
G_fatal_error(_("Subgroup <%s> not found"), parms->subgroup);
if (sscanf(blocksize->answer, "%d", &parms->blocksize) != 1
|| parms->blocksize <= 8)
parms->blocksize = 8;
return 0;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:55,代码来源:parse.c
示例15: parse
void parse(int argc, char *argv[], struct Parms *parms)
{
struct Option *maps, *fs;
struct Flag *labels, *overlap;
const char *name, *mapset;
maps = G_define_option();
maps->key = "maps";
maps->key_desc = "map1,map2";
maps->required = YES;
maps->multiple = NO;
maps->type = TYPE_STRING;
maps->description = _("Maps for computing inter-class distances");
maps->gisprompt = "old,cell,raster";
fs = G_define_option();
fs->key = "fs";
fs->required = NO;
fs->multiple = NO;
fs->answer = ":"; /* colon is default output fs */
fs->type = TYPE_STRING;
fs->description = _("Output field separator");
labels = G_define_flag();
labels->key = 'l';
labels->description = _("Include category labels in the output");
overlap = G_define_flag();
overlap->key = 'o';
overlap->description =
_("Report zero distance if rasters are overlapping");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
name = parms->map1.name = maps->answers[0];
mapset = parms->map1.mapset = G_find_raster2(name, "");
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
parms->map1.fullname = G_fully_qualified_name(name, mapset);
name = parms->map2.name = maps->answers[1];
mapset = parms->map2.mapset = G_find_raster2(name, "");
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
parms->map2.fullname = G_fully_qualified_name(name, mapset);
parms->labels = labels->answer ? 1 : 0;
parms->fs = fs->answer;
parms->overlap = overlap->answer ? 1 : 0;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:54,代码来源:parse.c
示例16: main
int main(int argc, char *argv[])
{
struct Option *raster, *conf, *output, *alpha;
struct GModule *module;
char **par = NULL;
G_gisinit(argv[0]);
module = G_define_module();
module->description =
_("Calculates Renyi's diversity index on a raster map");
G_add_keyword(_("raster"));
G_add_keyword(_("landscape structure analysis"));
G_add_keyword(_("diversity index"));
/* define options */
raster = G_define_standard_option(G_OPT_R_INPUT);
conf = G_define_option();
conf->key = "config";
conf->description = _("Configuration file");
conf->gisprompt = "old_file,file,input";
conf->type = TYPE_STRING;
conf->required = YES;
alpha = G_define_option();
alpha->key = "alpha";
alpha->description =
_("Alpha value is the order of the generalized entropy");
alpha->type = TYPE_STRING;
alpha->required = YES;
output = G_define_standard_option(G_OPT_R_OUTPUT);
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
if (atoi(alpha->answer) == 1) {
G_fatal_error
("If alpha = 1 Renyi index is not defined. (Ricotta et al., 2003, Environ. Model. Softw.)");
exit(RLI_ERRORE);
}
else if (atof(alpha->answer) < 0.) {
G_fatal_error
("Alpha must be > 0 otherwise Renyi index is not defined. (Ricotta et al., 2003, Environ. Model. Softw.)");
exit(RLI_ERRORE);
}
else {
par = &alpha->answer;
}
return calculateIndex(conf->answer, renyi, par, raster->answer,
output->answer);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:54,代码来源:renyi.c
示例17: parse_command_line
static void parse_command_line(int argc, char **argv)
{
struct Option *driver, *database, *schema, *input;
struct Flag *i;
struct GModule *module;
const char *drv, *db, *schema_name;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
/* Set description */
module = G_define_module();
G_add_keyword(_("database"));
G_add_keyword(_("attribute table"));
G_add_keyword(_("SQL"));
module->label = _("Executes any SQL statement.");
module->description = _("For SELECT statements use 'db.select'.");
input = G_define_standard_option(G_OPT_F_INPUT);
input->label = _("Name of file containing SQL statements");
input->description = _("'-' to read from standard input");
driver = G_define_standard_option(G_OPT_DB_DRIVER);
driver->options = db_list_drivers();
driver->guisection = _("Connection");
if ((drv = db_get_default_driver_name()))
driver->answer = (char *) drv;
database = G_define_standard_option(G_OPT_DB_DATABASE);
database->guisection = _("Connection");
if ((db = db_get_default_database_name()))
database->answer = (char *) db;
schema = G_define_standard_option(G_OPT_DB_SCHEMA);
schema->guisection = _("Connection");
if ((schema_name = db_get_default_schema_name()))
schema->answer = (char *) schema_name;
i = G_define_flag();
i->key = 'i';
i->description = _("Ignore SQL errors and continue");
i->guisection = _("Errors");
if (G_parser(argc, argv))
exit(EXIT_SUCCESS);
parms.driver = driver->answer;
parms.database = database->answer;
parms.schema = schema->answer;
parms.input = input->answer;
parms.i = i->answer;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:52,代码来源:main.c
示例18: parse_args
void parse_args(int argc, char **argv,
struct _options *options, struct _flags *flags)
{
options->dsn = G_define_option();
options->dsn->key = "dsn";
options->dsn->description = _("Name for output OGR datasource");
options->dsn->required = YES;
options->dsn->type = TYPE_STRING;
options->format = G_define_option();
options->format->key = "format";
options->format->description = _("Format of output files");
options->format->required = YES;
options->format->type = TYPE_STRING;
options->format->options = format_list();
options->opts = G_define_option();
options->opts->key = "options";
options->opts->description = _("Creation options");
options->opts->required = NO;
options->opts->multiple = YES;
options->opts->type = TYPE_STRING;
flags->f = G_define_flag();
flags->f->key = 'f';
flags->f->description = _("List supported formats and exit");
flags->f->guisection = _("Print");
flags->f->suppress_required = YES;
flags->r = G_define_flag();
flags->r->key = 'r';
flags->r->description = _("Cease using OGR, revert to native output and exit");
flags->r->suppress_required = YES;
flags->r->guisection = _("Native");
flags->p = G_define_flag();
flags->p->key = 'p';
flags->p->description = _("Print current status");
flags->p->guisection = _("Print");
flags->p->suppress_required = YES;
flags->g = G_define_flag();
flags->g->key = 'g';
flags->g->description = _("Print current status in shell script style");
flags->g->guisection = _("Print");
flags->g->suppress_required = YES;
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:50,代码来源:args.c
示例19: main
int main(int argc, char *argv[])
{
struct Option *driver, *database, *user, *password;
struct GModule *module;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("database"));
G_add_keyword(_("connection settings"));
module->description = _("Sets user/password for driver/database.");
driver = G_define_standard_option(G_OPT_DB_DRIVER);
driver->options = db_list_drivers();
driver->required = YES;
driver->answer = (char *) db_get_default_driver_name();
database = G_define_standard_option(G_OPT_DB_DATABASE);
database->required = YES;
database->answer = (char *) db_get_default_database_name();
user = G_define_option();
user->key = "user";
user->type = TYPE_STRING;
user->required = NO;
user->multiple = NO;
user->description = _("Username");
password = G_define_option();
password->key = "password";
password->type = TYPE_STRING;
password->required = NO;
password->multiple = NO;
password->description = _("Password");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
if (db_set_login(driver->answer, database->answer, user->answer,
password->answer) == DB_FAILED) {
G_fatal_error(_("Unable to set user/password"));
}
if (password->answer)
G_important_message(_("The password was stored in file (%s/dblogin)"), CONFIG_DIR);
exit(EXIT_SUCCESS);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:49,代码来源:main.c
示例20: main
int main(int argc, char *argv[])
{
struct GModule *module;
struct
{
struct Option *map;
struct Option *line;
struct Option *null_str;
} parms;
struct Flag *coord;
G_gisinit(argv[0]);
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("transect"));
module->description =
_("Outputs raster map layer values lying along "
"user defined transect line(s).");
parms.map = G_define_standard_option(G_OPT_R_MAP);
parms.map->description = _("Raster map to be queried");
parms.line = G_define_option();
parms.line->key = "line";
parms.line->key_desc = "east,north,azimuth,distance";
parms.line->type = TYPE_STRING;
parms.line->description = _("Transect definition");
parms.line->required = YES;
parms.line->multiple = YES;
parms.null_str = G_define_standard_option(G_OPT_M_NULL_VALUE);
parms.null_str->answer = "*";
coord = G_define_flag();
coord->key = 'g';
coord->description =
_("Output easting and northing in first two columns of four column output");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
return profile(coord->answer,
parms.map->answer,
parms.null_str->answer,
parms.line->answers) != 0;
}
开发者ID:rkrug,项目名称:grass-ci,代码行数:47,代码来源:main.c
注:本文中的G_parser函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论