Beispiel #1
0
void summaries_init(Logbook *logbook)
{
  summaries_html_init(logbook);
  scripter_init(logbook->summaries_scripter, GTK_COMBO_BOX(logbook->summaries_select_summary), GTK_BOX(logbook->summaries_parameters), NULL);
  scripter_merge_script_dir(logbook->summaries_scripter, SUMMARIES_DIR);
  gtk_combo_box_set_active(GTK_COMBO_BOX(logbook->summaries_select_summary), 0);
}
Beispiel #2
0
void import_init(Logbook *logbook)
{
  scripter_init(logbook->import_scripter, GTK_COMBO_BOX(logbook->import_script), GTK_BOX(logbook->import_script_options), "-g");
  scripter_merge_script_dir(logbook->import_scripter, IMPORT_SCRIPT_DIR);
  gtk_combo_box_set_active(GTK_COMBO_BOX(logbook->import_script), 0);
}
Beispiel #3
0
int main (int argc, char *argv[])
{
	int status;

	phoebe_debug ("starting up PHOEBE scripter:\n");

	phoebe_debug ("  initializing PHOEBE library.\n");

	status = phoebe_init ();
	if (status != SUCCESS)
		phoebe_fatal (phoebe_scripter_error (status));

	phoebe_debug ("  adding config entries.\n");
	scripter_config_populate ();

	phoebe_debug ("  parsing the start-up line.\n");
	parse_startup_line (argc, argv);

	if (PHOEBE_args.CONFIG_DIR != NULL) {
		phoebe_debug ("  found a --config-dir switch.\n");
		free (PHOEBE_HOME_DIR);
		PHOEBE_HOME_DIR = strdup (PHOEBE_args.CONFIG_DIR);
	}

	phoebe_debug ("  configuring PHOEBE...\n");
	phoebe_configure ();

	phoebe_debug ("  initializing the scripter.\n");

	status = scripter_init ();
	if (status != SUCCESS)
		phoebe_fatal (phoebe_scripter_error (status));

	status = scripter_plugins_init ();
	if (status != SUCCESS)
		phoebe_scripter_output (phoebe_scripter_error (status));

	if (PHOEBE_args.CONFIGURE_SWITCH == 1) {
		phoebe_debug ("  found a '-c' switch, proceeding to configuration mode.\n");
		scripter_create_config_file ();
	}

	if (PHOEBE_args.SCRIPT_SWITCH == 1) {
		FILE *in = fopen (PHOEBE_args.SCRIPT_NAME, "r");

		phoebe_debug ("  found a '-e' switch, proceeding to the execute mode.\n");

		if (!in) {
			printf ("\n");
			phoebe_warning ("cannot open script %s, aborting.\n\n", PHOEBE_args.SCRIPT_NAME);
			phoebe_quit ();
			exit(0);
		}

		phoebe_debug ("  script to be executed: %s.\n", PHOEBE_args.SCRIPT_NAME);

		phoebe_debug ("  initializing the scripter.\n");
		status = scripter_init ();
		if (status != SUCCESS)
			phoebe_fatal (phoebe_scripter_error (status));

		phoebe_debug ("PHOEBE start-up successful.\n");
		phoebe_debug ("executing the script from the stream.\n");
		scripter_execute_script_from_stream (in);
		fclose (in);

		return SUCCESS;
	}

	if (PHOEBE_args.PARAMETER_SWITCH)
		status = phoebe_open_parameter_file (PHOEBE_args.PARAMETER_FILE);
	if (status != SUCCESS) {
		phoebe_warning (phoebe_scripter_error (status));
		scripter_quit ();
		phoebe_quit ();
		exit(0);
	}
	
	phoebe_debug ("  entering the main scripter loop.\n");
	phoebe_debug ("PHOEBE start-up successful.\n");
	scripter_main_loop ();

	return SUCCESS;
}