Пример #1
0
/* print login menu */
int Mlogin(void)
{
	int order = CNULL;
	do
	{
		start_ui();
		int n = Moption();	
		order = get_order(n,1,2);
	}while(order == CNULL);
	return order;
}
Пример #2
0
int main(int argc, char *argv[])
{
    snprintf(DEFAULT_FILE_NAME, 1024, "%s/%s", getenv("HOME"), DB_NAME);
    if(argc == 2)
    {
        if(strcmp(argv[1], "--version") == 0)
        {
            printf("Version : %s\n", TODO_VERSION);
            return 0;
        }
    }
    start_ui();
    return 0;
}
Пример #3
0
int main(int argc, char *argv[]) {
#else
int gstat_main(int argc, char *argv[]) {
#endif

	DATA      **data = NULL, *valdata = NULL;

/*
 * initialise some global variables:
 */
	atexit(close_gstat_log_file);
	init_userio(1);
	init_global_variables();
	argv0 = argv[0];
/*
 * register command line arguments on command_line:
 */
	command_line = store_argv(argc, argv);
	parse_gstatrc();
/*
 * INPUT: command line options;
 */
	parse_options(argc, argv); /* exits on -e options */

/*
 * start with program heading:
 */
	printlog("%s: %s version %s\n", GSTAT_NAME, GSTAT_OS, VERSION);
	printlog("%s\n", GSTAT_CR);
	gstat_start();

/*
 * INPUT: Parse command files: 
 */
	if (optind == argc) { /* there's no command file name left */
		if (get_method() != UIF) { /* -i or -m command line option */
			/* no arguments */
			printlog("Updates, manuals and source code: %s\n", 
				GSTAT_HOME);
			printlog("%s\n", USAGE);
			ErrMsg(ER_NOCMD, "");
		} else {
			start_ui();
			exit(0);
		}
	} else { /* we have a command file to be read */
		for ( ; optind < argc; optind++) {
			command_file_name = argv[optind];
			parse_file(command_file_name);
			if (logfile_name != NULL)
				set_gstat_log_file(efopen(logfile_name, "w"));
/* 
 * get global variables locally: 
 */
			data = 			get_gstat_data();
			valdata = 		get_dataval();
			set_seed(gl_seed);

/* 
 * check variable settings and next
 * INPUT: read data values from file: 
 */
			read_all_data(data, valdata, get_n_vars());
			if (get_method() == NSP) /* Still no answer to this: choose default */
				set_method(get_default_method());
			set_mode();
			check_global_variables();
			setup_meschach_error_handler();
			if (DEBUG_DUMP)
				dump_all();
			if (get_method() != NSP)
				printlog("[%s]\n", method_string(get_method()));
			if (check_only)
				set_method(NSP);

/*
 * start calculations && OUTPUT routines:
 */
			switch (get_method()) {
				case UIF:
					start_ui();
					break;
				case NSP:
					break;
				case COV: 
				case SEM:
					do_variogram(get_n_vars(), get_method());
					break;
        		case POLY:
            		setup_poly_method();
            		/*FALLTHROUGH*/
				default: 
					if (gl_xvalid) /* validation/cross validation */
						cross_valid(data);
					else
						predict_all(data); /* or prediction: */
					break;
			} /* switch get_method() */
			remove_all(); /* free all data etc. */
			init_global_variables(); /* re-init for next round */
		}
	}

	if (DEBUG_DUMP)
		atexit(print_file_record);

	if (get_method() != UIF)
		elapsed();
/* 
 * file closing & data freeing time:
 */
	if (plotfile != NULL)
		efclose(plotfile);

	exit(0);
} /* end of main() */