Beispiel #1
0
void
print_tomorrows_date (void)
{

  /* Figure out what tomorrow's date is and print it to stdio. */

  GTimeZone *tz;
  
  GDateTime *dt1;
  GDateTime *dt2;
  gchar *str;
  
  tz = (GTimeZone *)g_time_zone_new_local();

  dt1 = (GDateTime *)g_date_time_new_now(tz);
  dt2 = (GDateTime *)g_date_time_add_days(dt1, 1);
  str = (gchar *)g_date_time_format(dt2, "Tomorrow is %c.\n");
  g_print("%s\n", str);
  
  g_date_time_unref(dt1);
  g_date_time_unref(dt2);
  g_time_zone_unref(tz);
  g_free(str);

}
Beispiel #2
0
void
create_status_bar(void)
{
    int i;
    int cols = getmaxx(stdscr);

    is_active[1] = TRUE;
    is_new[1] = FALSE;
    for (i = 2; i < 12; i++) {
        is_active[i] = FALSE;
        is_new[i] = FALSE;
    }
    remaining_active = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
    remaining_new = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
    current = 1;

    int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);

    int row = screen_statusbar_row();
    status_bar = newwin(1, cols, row, 0);
    wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
    wattron(status_bar, bracket_attrs);
    mvwprintw(status_bar, 0, cols - 34, _active);
    mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
    wattroff(status_bar, bracket_attrs);

    tz = g_time_zone_new_local();

    if (last_time) {
        g_date_time_unref(last_time);
    }
    last_time = g_date_time_new_now(tz);

    _status_bar_draw();
}
Beispiel #3
0
static void
log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user)
{
    gsize       n_written;
    GError     *error = NULL;
    GIOChannel *channel = user;

#if GLIB_CHECK_VERSION(2, 26, 0)
    GTimeZone  *tz;
    GDateTime  *date_time;
    gchar      *new_message;

    tz = g_time_zone_new_local ();
    date_time = g_date_time_new_now (tz);

    new_message = g_strdup_printf ("[%s] %s\n", g_date_time_format (date_time, "%FT%H:%M:%S%z"), message);

    g_time_zone_unref (tz);
    g_date_time_unref (date_time);

    g_io_channel_write_chars (channel, new_message, strlen (new_message), &n_written, &error);
    g_assert_no_error (error);
    g_free (new_message);
#else
    g_io_channel_write_chars (channel, message, strlen (message), &n_written, &error);
    g_assert_no_error (error);
#endif

    g_io_channel_flush (channel, &error);
    g_assert_no_error (error);
}
Beispiel #4
0
void
print_days_until_birthday (void)
{


  /*Calculate how many days there are between now and my
    birthday. (If you get something out of this glib-cookbook then
    feel free to send me a present after that many days go by. ;) */

  GTimeZone *tz;
  GDateTime *now;
  GDateTime *bday;
  GTimeSpan diff;

  tz = (GTimeZone *)g_time_zone_new_local();  
  now = (GDateTime *)g_date_time_new_now(tz);

  bday = (GDateTime *)g_date_time_new(tz, g_date_time_get_year(now) + 1, 6, 25, 0, 0, 0);

  diff = g_date_time_difference(bday, now);
  
  g_print("There are %ld days until Jamil's birthday.\n",
	  diff / G_TIME_SPAN_DAY);
  
  g_date_time_unref(now);
  g_date_time_unref(bday);
  g_time_zone_unref(tz);

}
Beispiel #5
0
void
print_is_leap_year (void)
{

  /* Print a message to stdio letting user know if the current year is
     a leap year. */

  GTimeZone *tz;  
  GDateTime *dt;
  GDateYear theYear;

  tz = (GTimeZone *)g_time_zone_new_local();  
  dt = (GDateTime *)g_date_time_new_now(tz);

  theYear = g_date_time_get_year(dt);

  if (g_date_is_leap_year(theYear)) {
    g_print("This year (%d) is a leap year.\n", theYear);
  } else {
    g_print("This year (%d) is not a leap year.\n", theYear);
  }

  g_date_time_unref(dt);
  g_time_zone_unref(tz);

}
Beispiel #6
0
static void
_status_bar_draw(void)
{
    if (last_time) {
        g_date_time_unref(last_time);
    }
    last_time = g_date_time_new_now(tz);

    int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
    int time_attrs = theme_attrs(THEME_STATUS_TIME);

    char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
    if (g_strcmp0(time_pref, "off") != 0) {
        gchar *date_fmt = g_date_time_format(last_time, time_pref);
        assert(date_fmt != NULL);
        size_t len = strlen(date_fmt);
        wattron(status_bar, bracket_attrs);
        mvwaddch(status_bar, 0, 1, '[');
        wattroff(status_bar, bracket_attrs);
        wattron(status_bar, time_attrs);
        mvwprintw(status_bar, 0, 2, date_fmt);
        wattroff(status_bar, time_attrs);
        wattron(status_bar, bracket_attrs);
        mvwaddch(status_bar, 0, 2 + len, ']');
        wattroff(status_bar, bracket_attrs);
        g_free(date_fmt);
    }
    prefs_free_string(time_pref);

    _update_win_statuses();
    wnoutrefresh(status_bar);
    inp_put_back();
}
DateTime DateTime::NowLocal()
{
    auto gtz = g_time_zone_new_local();
    auto gdt = g_date_time_new_now(gtz);
    DateTime dt(gtz, gdt);
    g_time_zone_unref(gtz);
    g_date_time_unref(gdt);
    return dt;
}
Beispiel #8
0
static unsigned long get_frame_offset_day_now(GCContext *context, int day)
{
    GCConfig      *config = context->config;
    GDateTime     *dt     = g_date_time_new_now(config->timeZone);
    unsigned long  f      = get_frame_offset_day(context, day);

    f += (g_date_time_get_hour(dt) * 60 + g_date_time_get_minute(dt)) * get_frames_per_minute(context);

    g_date_time_unref(dt);

    return (f >= config->number_of_frames) ? 0 : f;
}
Beispiel #9
0
static gboolean
is_new_record (OfficeRunner *run,
	       int          *new_pos)
{
	ORecord *o;
	guint i;
	gboolean new_record;
	GList *l;

#if 0
	GDateTime *dt;
	GTimeZone *tz;
	char *date;
#endif

	new_record = FALSE;

#if 0
	/* Unused */
	tz = g_time_zone_new_local ();
	dt = g_date_time_new_now (tz);
	date = g_date_time_format (dt, "%c");
	g_date_time_unref (dt);
	g_time_zone_unref (tz);
	g_free (date);
#endif
	o = new_orecord (run->elapsed);
	run->records = g_list_insert_sorted (run->records, o, (GCompareFunc) record_compare_func);
	g_debug ("Elapsed: %lf", o->time);
	for (l = run->records, i = GOLD; l != NULL; l = l->next, i++)
		g_debug ("\t%d = %lf", i, ((ORecord *) l->data)->time);

	*new_pos = 0;
	for (l = run->records, i = GOLD; i <= BRONZE; l = l->next, i++) {
		ORecord *o = l->data;
		if (run->elapsed == o->time && i <= BRONZE) {
			new_record = TRUE;
			*new_pos = i;
			break;
		}
	}

	if (new_record == FALSE)
		return FALSE;

	run->dirty_records = TRUE;

	return TRUE;
}
Beispiel #10
0
static gboolean
update_clock (gpointer data)
{
	GnomeWallClock   *self = data;
	GDesktopClockFormat clock_format;
	gboolean show_full_date;
	gboolean show_weekday;
	gboolean show_seconds;
	GSource *source;
	GDateTime *now;
	GDateTime *expiry;

	clock_format = g_settings_get_enum (self->priv->desktop_settings, "clock-format");
	show_weekday = !self->priv->time_only && g_settings_get_boolean (self->priv->desktop_settings, "clock-show-weekday");
	show_full_date = !self->priv->time_only && g_settings_get_boolean (self->priv->desktop_settings, "clock-show-date");
	show_seconds = g_settings_get_boolean (self->priv->desktop_settings, "clock-show-seconds");

	now = g_date_time_new_now (self->priv->timezone);
	if (show_seconds)
		expiry = g_date_time_add_seconds (now, 1);
	else
		expiry = g_date_time_add_seconds (now, 60 - g_date_time_get_second (now));

	if (self->priv->clock_update_id)
		g_source_remove (self->priv->clock_update_id);

	source = _gnome_datetime_source_new (now, expiry, TRUE);
	g_source_set_priority (source, G_PRIORITY_HIGH);
	g_source_set_callback (source, update_clock, self, NULL);
	self->priv->clock_update_id = g_source_attach (source, NULL);
	g_source_unref (source);

	g_free (self->priv->clock_string);
	self->priv->clock_string = gnome_wall_clock_string_for_datetime (self,
									 now,
									 clock_format,
									 show_weekday,
									 show_full_date,
									 show_seconds);

	g_date_time_unref (now);
	g_date_time_unref (expiry);

	g_object_notify ((GObject*)self, "clock");

	return FALSE;
}
static void
update_timestamp (IdoLocationMenuItem * self)
{
  GTimeZone * tz;
  GDateTime * date_time;

  tz = g_time_zone_new (self->priv->timezone);
  if (tz == NULL)
    tz = g_time_zone_new_local ();
  date_time = g_date_time_new_now (tz);

  ido_time_stamp_menu_item_set_date_time (IDO_TIME_STAMP_MENU_ITEM(self),
                                          date_time);

  g_date_time_unref (date_time);
  g_time_zone_unref (tz);
}
Beispiel #12
0
/** 
 * Creates a GDate set to yesterday.
 * 
 * 
 * @return A GDate with year, month, and day set to yesterday.
 */
GDate *yesterday(void)
{

  GTimeZone *tz = g_time_zone_new_local();
  GDateTime *now = g_date_time_new_now(tz);
  g_time_zone_unref(tz);
  gint year, month, day;
  GDateTime *temp_copy = g_date_time_add_days(now, -1);
  g_date_time_unref(now);
  g_date_time_get_ymd(temp_copy, &year, &month, &day);
  g_date_time_unref(temp_copy);

  // and now we can create yesterday:
  GDate *yest = g_date_new_dmy(day, month, year);

  return yest;
  
}
Beispiel #13
0
void
print_current_timezone (void)
{

  /* Print a string representation of the local time zone to stdio. */

  GTimeZone *tz;
  GDateTime *dt;

  tz = (GTimeZone *)g_time_zone_new_local();
  
  dt = (GDateTime *)g_date_time_new_now(tz);
  g_print("The current timezone is %s.\n",
	  g_date_time_get_timezone_abbreviation(dt));

  g_date_time_unref(dt);
  g_time_zone_unref(tz);


}
Beispiel #14
0
void
log_msg(log_level_t level, const char * const area, const char * const msg)
{
    if (level >= level_filter) {
        long result;
        dt = g_date_time_new_now(tz);

        gchar *date_fmt = g_date_time_format(dt, "%d/%m/%Y %H:%M:%S");
        fprintf(logp, "%s: %s: %s\n", date_fmt, area, msg);
        g_date_time_unref(dt);

        fflush(logp);
        g_free(date_fmt);

        result = ftell(logp);
        if (result != -1 && result >= prefs_get_max_log_size()) {
            _rotate_log_file();
        }
    }
}
Beispiel #15
0
void
print_todays_date (void)
{

  /* Just figure out what the current date is and print it. */

  GTimeZone *tz;
  GDateTime *dt;
  gchar *str;
  
  tz = (GTimeZone *)g_time_zone_new_local();
    dt = (GDateTime *)g_date_time_new_now(tz);
  str = (gchar *)g_date_time_format(dt, "Today is %c.\n");
  g_printf("%s\n", str);
  
  /* You gotta unref and free up all those gThingys. */

  g_date_time_unref(dt);
  g_time_zone_unref(tz);
  g_free(str);
}
Beispiel #16
0
void
log_msg(log_level_t level, const char * const area, const char * const msg)
{
    if (level >= level_filter && logp != NULL) {
        dt = g_date_time_new_now(tz);

        char *level_str = _log_string_from_level(level);

        gchar *date_fmt = g_date_time_format(dt, "%d/%m/%Y %H:%M:%S");

        fprintf(logp, "%s: %s: %s: %s\n", date_fmt, area, level_str, msg);
        g_date_time_unref(dt);

        fflush(logp);
        g_free(date_fmt);

        if (prefs_get_boolean(PREF_LOG_ROTATE)) {
            long result = ftell(logp);
            if (result != -1 && result >= prefs_get_max_log_size()) {
                _rotate_log_file();
            }
        }
    }
}
Beispiel #17
0
void
print_yesterdays_date (void)
{

  /* Figure out what yesterday's date is and print it to stdio. */

  GTimeZone *tz;
  GDateTime *dt;
  GDateTime *dt2;
  gchar *str;

  tz = (GTimeZone *)g_time_zone_new_local();
  
  dt = (GDateTime *)g_date_time_new_now(tz);
  dt2 = (GDateTime *)g_date_time_add_days(dt, -1);
  str = (gchar *)g_date_time_format(dt2, "Yesterday was %c.\n");
  g_print("%s\n", str);
  
  g_date_time_unref(dt);
  g_date_time_unref(dt2);
  g_time_zone_unref(tz);
  g_free(str);

}
Beispiel #18
0
/**
 * Function to open and perform a optimization.
 */
void
optimize_open ()
{
  GTimeZone *tz;
  GDateTime *t0, *t;
  unsigned int i, j;

#if DEBUG_OPTIMIZE
  char *buffer;
  fprintf (stderr, "optimize_open: start\n");
#endif

  // Getting initial time
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: getting initial time\n");
#endif
  tz = g_time_zone_new_utc ();
  t0 = g_date_time_new_now (tz);

  // Obtaining and initing the pseudo-random numbers generator seed
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: getting initial seed\n");
#endif
  if (optimize->seed == DEFAULT_RANDOM_SEED)
    optimize->seed = input->seed;
  gsl_rng_set (optimize->rng, optimize->seed);

  // Replacing the working directory
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: replacing the working directory\n");
#endif
  g_chdir (input->directory);

  // Getting results file names
  optimize->result = input->result;
  optimize->variables = input->variables;

  // Obtaining the simulator file
  optimize->simulator = input->simulator;

  // Obtaining the evaluator file
  optimize->evaluator = input->evaluator;

  // Reading the algorithm
  optimize->algorithm = input->algorithm;
  switch (optimize->algorithm)
    {
    case ALGORITHM_MONTE_CARLO:
      optimize_algorithm = optimize_MonteCarlo;
      break;
    case ALGORITHM_SWEEP:
      optimize_algorithm = optimize_sweep;
      break;
    case ALGORITHM_ORTHOGONAL:
      optimize_algorithm = optimize_orthogonal;
      break;
    default:
      optimize_algorithm = optimize_genetic;
      optimize->mutation_ratio = input->mutation_ratio;
      optimize->reproduction_ratio = input->reproduction_ratio;
      optimize->adaptation_ratio = input->adaptation_ratio;
    }
  optimize->nvariables = input->nvariables;
  optimize->nsimulations = input->nsimulations;
  optimize->niterations = input->niterations;
  optimize->nbest = input->nbest;
  optimize->tolerance = input->tolerance;
  optimize->nsteps = input->nsteps;
  optimize->nestimates = 0;
  optimize->threshold = input->threshold;
  optimize->stop = 0;
  if (input->nsteps)
    {
      optimize->relaxation = input->relaxation;
      switch (input->climbing)
        {
        case CLIMBING_METHOD_COORDINATES:
          optimize->nestimates = 2 * optimize->nvariables;
          optimize_estimate_climbing = optimize_estimate_climbing_coordinates;
          break;
        default:
          optimize->nestimates = input->nestimates;
          optimize_estimate_climbing = optimize_estimate_climbing_random;
        }
    }

#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: nbest=%u\n", optimize->nbest);
#endif
  optimize->simulation_best
    = (unsigned int *) alloca (optimize->nbest * sizeof (unsigned int));
  optimize->error_best = (double *) alloca (optimize->nbest * sizeof (double));

  // Reading the experimental data
#if DEBUG_OPTIMIZE
  buffer = g_get_current_dir ();
  fprintf (stderr, "optimize_open: current directory=%s\n", buffer);
  g_free (buffer);
#endif
  optimize->nexperiments = input->nexperiments;
  optimize->ninputs = input->experiment->ninputs;
  optimize->experiment
    = (char **) alloca (input->nexperiments * sizeof (char *));
  optimize->weight = (double *) alloca (input->nexperiments * sizeof (double));
  for (i = 0; i < input->experiment->ninputs; ++i)
    optimize->file[i] = (GMappedFile **)
      g_malloc (input->nexperiments * sizeof (GMappedFile *));
  for (i = 0; i < input->nexperiments; ++i)
    {
#if DEBUG_OPTIMIZE
      fprintf (stderr, "optimize_open: i=%u\n", i);
#endif
      optimize->experiment[i] = input->experiment[i].name;
      optimize->weight[i] = input->experiment[i].weight;
#if DEBUG_OPTIMIZE
      fprintf (stderr, "optimize_open: experiment=%s weight=%lg\n",
               optimize->experiment[i], optimize->weight[i]);
#endif
      for (j = 0; j < input->experiment->ninputs; ++j)
        {
#if DEBUG_OPTIMIZE
          fprintf (stderr, "optimize_open: stencil%u\n", j + 1);
#endif
          optimize->file[j][i]
            = g_mapped_file_new (input->experiment[i].stencil[j], 0, NULL);
        }
    }

  // Reading the variables data
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: reading variables\n");
#endif
  optimize->label = (char **) alloca (input->nvariables * sizeof (char *));
  j = input->nvariables * sizeof (double);
  optimize->rangemin = (double *) alloca (j);
  optimize->rangeminabs = (double *) alloca (j);
  optimize->rangemax = (double *) alloca (j);
  optimize->rangemaxabs = (double *) alloca (j);
  optimize->step = (double *) alloca (j);
  j = input->nvariables * sizeof (unsigned int);
  optimize->precision = (unsigned int *) alloca (j);
  optimize->nsweeps = (unsigned int *) alloca (j);
  optimize->nbits = (unsigned int *) alloca (j);
  for (i = 0; i < input->nvariables; ++i)
    {
      optimize->label[i] = input->variable[i].name;
      optimize->rangemin[i] = input->variable[i].rangemin;
      optimize->rangeminabs[i] = input->variable[i].rangeminabs;
      optimize->rangemax[i] = input->variable[i].rangemax;
      optimize->rangemaxabs[i] = input->variable[i].rangemaxabs;
      optimize->precision[i] = input->variable[i].precision;
      optimize->step[i] = input->variable[i].step;
      optimize->nsweeps[i] = input->variable[i].nsweeps;
      optimize->nbits[i] = input->variable[i].nbits;
    }
  if (input->algorithm == ALGORITHM_SWEEP
      || input->algorithm == ALGORITHM_ORTHOGONAL)
    {
      optimize->nsimulations = 1;
      for (i = 0; i < input->nvariables; ++i)
        {
          optimize->nsimulations *= optimize->nsweeps[i];
#if DEBUG_OPTIMIZE
          fprintf (stderr, "optimize_open: nsweeps=%u nsimulations=%u\n",
                   optimize->nsweeps[i], optimize->nsimulations);
#endif
        }
    }
  if (optimize->nsteps)
    optimize->climbing
      = (double *) alloca (optimize->nvariables * sizeof (double));

  // Setting error norm
  switch (input->norm)
    {
    case ERROR_NORM_EUCLIDIAN:
      optimize_norm = optimize_norm_euclidian;
      break;
    case ERROR_NORM_MAXIMUM:
      optimize_norm = optimize_norm_maximum;
      break;
    case ERROR_NORM_P:
      optimize_norm = optimize_norm_p;
      optimize->p = input->p;
      break;
    default:
      optimize_norm = optimize_norm_taxicab;
    }

  // Allocating values
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: allocating variables\n");
  fprintf (stderr, "optimize_open: nvariables=%u algorithm=%u\n",
           optimize->nvariables, optimize->algorithm);
#endif
  optimize->genetic_variable = NULL;
  if (optimize->algorithm == ALGORITHM_GENETIC)
    {
      optimize->genetic_variable = (GeneticVariable *)
        g_malloc (optimize->nvariables * sizeof (GeneticVariable));
      for (i = 0; i < optimize->nvariables; ++i)
        {
#if DEBUG_OPTIMIZE
          fprintf (stderr, "optimize_open: i=%u min=%lg max=%lg nbits=%u\n",
                   i, optimize->rangemin[i], optimize->rangemax[i],
                   optimize->nbits[i]);
#endif
          optimize->genetic_variable[i].minimum = optimize->rangemin[i];
          optimize->genetic_variable[i].maximum = optimize->rangemax[i];
          optimize->genetic_variable[i].nbits = optimize->nbits[i];
        }
    }
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: nvariables=%u nsimulations=%u\n",
           optimize->nvariables, optimize->nsimulations);
#endif
  optimize->value = (double *)
    g_malloc ((optimize->nsimulations
               + optimize->nestimates * optimize->nsteps)
              * optimize->nvariables * sizeof (double));

  // Calculating simulations to perform for each task
#if HAVE_MPI
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: rank=%u ntasks=%u\n",
           optimize->mpi_rank, ntasks);
#endif
  optimize->nstart = optimize->mpi_rank * optimize->nsimulations / ntasks;
  optimize->nend = (1 + optimize->mpi_rank) * optimize->nsimulations / ntasks;
  if (optimize->nsteps)
    {
      optimize->nstart_climbing
        = optimize->mpi_rank * optimize->nestimates / ntasks;
      optimize->nend_climbing
        = (1 + optimize->mpi_rank) * optimize->nestimates / ntasks;
    }
#else
  optimize->nstart = 0;
  optimize->nend = optimize->nsimulations;
  if (optimize->nsteps)
    {
      optimize->nstart_climbing = 0;
      optimize->nend_climbing = optimize->nestimates;
    }
#endif
#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: nstart=%u nend=%u\n", optimize->nstart,
           optimize->nend);
#endif

  // Calculating simulations to perform for each thread
  optimize->thread
    = (unsigned int *) alloca ((1 + nthreads) * sizeof (unsigned int));
  for (i = 0; i <= nthreads; ++i)
    {
      optimize->thread[i] = optimize->nstart
        + i * (optimize->nend - optimize->nstart) / nthreads;
#if DEBUG_OPTIMIZE
      fprintf (stderr, "optimize_open: i=%u thread=%u\n", i,
               optimize->thread[i]);
#endif
    }
  if (optimize->nsteps)
    optimize->thread_climbing = (unsigned int *)
      alloca ((1 + nthreads_climbing) * sizeof (unsigned int));

  // Opening result files
  optimize->file_result = g_fopen (optimize->result, "w");
  optimize->file_variables = g_fopen (optimize->variables, "w");

  // Performing the algorithm
  switch (optimize->algorithm)
    {
      // Genetic algorithm
    case ALGORITHM_GENETIC:
      optimize_genetic ();
      break;

      // Iterative algorithm
    default:
      optimize_iterate ();
    }

  // Getting calculation time
  t = g_date_time_new_now (tz);
  optimize->calculation_time = 0.000001 * g_date_time_difference (t, t0);
  g_date_time_unref (t);
  g_date_time_unref (t0);
  g_time_zone_unref (tz);
  printf ("%s = %.6lg s\n", _("Calculation time"), optimize->calculation_time);
  fprintf (optimize->file_result, "%s = %.6lg s\n",
           _("Calculation time"), optimize->calculation_time);

  // Closing result files
  fclose (optimize->file_variables);
  fclose (optimize->file_result);

#if DEBUG_OPTIMIZE
  fprintf (stderr, "optimize_open: end\n");
#endif
}