Exemple #1
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void s_toplevel_delete (TOPLEVEL *toplevel)
{
  GList *iter;

  if (toplevel->auto_save_timeout != 0) {
    /* Assume this works */
    g_source_remove (toplevel->auto_save_timeout);
  }

  g_free (toplevel->bitmap_directory);
  g_free (toplevel->bus_ripper_symname);

  /* delete all pages */
  s_page_delete_list (toplevel);

  /* Delete the page list */
  g_object_unref(toplevel->pages);

  /* Remove all change notification handlers */
  for (iter = toplevel->change_notify_funcs;
       iter != NULL; iter = g_list_next (iter)) {
    g_free (iter->data);
  }
  g_list_free (toplevel->change_notify_funcs);

  toplevel->weak_refs = s_weakref_notify (toplevel, toplevel->weak_refs);

  g_free (toplevel);

}
Exemple #2
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void s_toplevel_delete (TOPLEVEL *toplevel)
{
    if (toplevel->auto_save_timeout != 0) {
        /* Assume this works */
        g_source_remove (toplevel->auto_save_timeout);
    }

    g_free (toplevel->untitled_name);
    g_free (toplevel->font_directory);
    g_free (toplevel->scheme_directory);
    g_free (toplevel->bitmap_directory);
    g_free (toplevel->bus_ripper_symname);

    /* free all fonts */
    /* if you close a window, then you free the font set... */
    /* this is probably a bad idea... */
    /* The font set can ONLY be freed when exiting!!! */
    /*  o_text_freeallfonts (toplevel); */

    /* delete all pages */
    s_page_delete_list (toplevel);

    /* Delete the page list */
    g_object_unref(toplevel->pages);

    g_free (toplevel);

}
Exemple #3
0
void 
main_prog(void *closure, int argc, char *argv[])
{
  int i;
  int argv_index;
  int exit_status;
  char *cwd;

  char *logfile;
  
  TOPLEVEL *pr_current;
  
  argv_index = parse_commandline(argc, argv);
  cwd = g_get_current_dir();

  libgeda_init();

  /* create log file right away */
  /* even if logging is enabled */
  logfile = g_build_filename (cwd, "gsymcheck.log", NULL);
  x_log_update_func = s_log_update;
  s_log_init (logfile);
  g_free (logfile);

  logging_dest=STDOUT_TTY;
  if (!quiet_mode)
  {
    s_log_message(
                  "gEDA/gsymcheck version %s%s.%s\n", PREPEND_VERSION_STRING,
                  DOTTED_VERSION, DATE_VERSION);
    s_log_message(
                  "gEDA/symcheck comes with ABSOLUTELY NO WARRANTY; see COPYING for more details.\n");
    s_log_message(
                  "This is free software, and you are welcome to redistribute it under certain\n");
    s_log_message(
                  "conditions; please see the COPYING file for more details.\n\n"); 
  }

#ifdef __MINGW32__
  fprintf(stderr, "This is the MINGW32 port.\n");
#endif  

  logging_dest=-1; /* don't output to the screen for now */
  
  /* register guile (scheme) functions */
  g_register_funcs();

  pr_current = s_toplevel_new ();
  g_rc_parse(pr_current, "gsymcheckrc", rc_filename);

  i_vars_set(pr_current);
  
  i = argv_index;
  while (argv[i] != NULL) {

    gchar *filename;
    GError *err = NULL;

    if (g_path_is_absolute(argv[i]))
    {
      /* Path is already absolute so no need to do any concat of cwd */
      filename = g_strdup (argv[i]);
    } else {
      filename = g_build_filename (cwd, argv[i], NULL);
    }

    s_page_goto (pr_current,
                 s_page_new (pr_current, filename));

    if (!f_open (pr_current,
                 pr_current->page_current->page_filename,
                 &err)) {
      /* Not being able to load a file is apparently a fatal error */
      logging_dest = STDOUT_TTY;
      g_warning ("%s\n", err->message);
      g_error_free (err);
      exit(2);
    } else {
      g_message ("Loaded file [%s]\n", filename);
    }
    i++;
    g_free (filename);
  }

  if (argv[argv_index] == NULL) {
    fprintf(stderr, "\nERROR! You must specify at least one filename\n\n");
    usage(argv[0]);
  }

  g_free(cwd);

  logging_dest=STDOUT_TTY;

#if DEBUG 
  s_page_print_all(pr_current);
#endif
  
  if (!quiet_mode) s_log_message("\n");

  exit_status = s_check_all(pr_current);

  s_page_delete_list(pr_current);
  gsymcheck_quit();

  exit(exit_status);
}
void 
main_prog(void *closure, int argc, char *argv[])
{
  int i;
  int argv_index;
  int exit_status;
  char *cwd;

  TOPLEVEL *pr_current;
  
  argv_index = parse_commandline(argc, argv);
  cwd = g_get_current_dir();

  libgeda_init();

  /* create log file right away */
  /* even if logging is enabled */
  x_log_update_func = s_log_update;
  s_log_init ("symcheck");

  logging_dest=STDOUT_TTY;

#if defined(__MINGW32__) && defined(DEBUG)
  fprintf(stderr, "This is the MINGW32 port.\n");
#endif  

  logging_dest=-1; /* don't output to the screen for now */
  
  /* register guile (scheme) functions */
  g_register_funcs();

  pr_current = s_toplevel_new ();
  g_rc_parse (pr_current, argv[0], "gsymcheckrc", rc_filename);

  i_vars_set(pr_current);
  
  i = argv_index;
  while (argv[i] != NULL) {

    gchar *filename;
    GError *err = NULL;

    if (g_path_is_absolute(argv[i]))
    {
      /* Path is already absolute so no need to do any concat of cwd */
      filename = g_strdup (argv[i]);
    } else {
      filename = g_build_filename (cwd, argv[i], NULL);
    }

    s_page_goto (pr_current,
                 s_page_new (pr_current, filename));

    if (!f_open (pr_current,
                 pr_current->page_current,
                 s_page_get_filename (pr_current->page_current),
                 &err)) {
      /* Not being able to load a file is apparently a fatal error */
      logging_dest = STDOUT_TTY;
      g_warning ("%s\n", err->message);
      g_error_free (err);
      exit(2);
    } else {
      g_message (_("Loaded file [%1$s]\n"), filename);
    }
    i++;
    g_free (filename);
  }

  if (argv[argv_index] == NULL) {
    fprintf(stderr, _("\nERROR! You must specify at least one filename\n\n"));
    usage(argv[0]);
  }

  g_free(cwd);

  logging_dest=STDOUT_TTY;

#if DEBUG 
  s_page_print_all(pr_current);
#endif
  
  if (!quiet_mode) s_log_message("\n");

  exit_status = s_check_all(pr_current);

  s_page_delete_list(pr_current);
  gsymcheck_quit();

  exit(exit_status);
}