[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: g_rc.c



  User: peterb  
  Date: 07/05/28 03:48:31

  Modified:    .        g_rc.c g_register.c
  Log:
  Add & update Scheme callbacks for new component library.
  
  
  
  Add the (component-library-command) function, and make
  
  (component-library) take an optional second argument for the
  
  directory's source name.
  
  
  
  
  Revision  Changes    Path
  1.4                  eda/geda/gaf/libgeda/src/g_rc.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_rc.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/g_rc.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- g_rc.c	28 May 2007 07:46:11 -0000	1.3
  +++ g_rc.c	28 May 2007 07:48:31 -0000	1.4
  @@ -342,15 +342,23 @@
    *  \par Function Description
    *
    *  \param [in] path  
  + *  \param [in] name Optional descriptive name for library directory.
    *  \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
    */
  -SCM g_rc_component_library(SCM path)
  +SCM g_rc_component_library(SCM path, SCM name)
   {
     char *string;
  +  char *namestr = NULL;
   
     SCM_ASSERT (SCM_NIMP (path) && SCM_STRINGP (path), path,
                 SCM_ARG1, "component-library");
     
  +  if (name != SCM_UNDEFINED) {
  +    SCM_ASSERT (SCM_NIMP (name) && SCM_STRINGP (name), name,
  +		SCM_ARG2, "component-library");
  +    namestr = SCM_STRING_CHARS (name);
  +  }
  +  
     string = g_strdup (SCM_STRING_CHARS (path));
     /* take care of any shell variables */
     string = expand_env_variables(string);
  @@ -365,7 +373,7 @@
     }
   
     if (g_path_is_absolute (string)) {
  -    s_clib_add_directory (string, NULL);
  +    s_clib_add_directory (string, namestr);
     } else {
       gchar *cwd = g_get_current_dir ();
       gchar *temp;
  @@ -373,7 +381,7 @@
       u_basic_strip_trailing(cwd, G_DIR_SEPARATOR);
   #endif
       temp = g_strconcat (cwd, G_DIR_SEPARATOR_S, string, NULL);
  -    s_clib_add_directory (temp, NULL);
  +    s_clib_add_directory (temp, namestr);
       g_free(temp);
       g_free(cwd);
     }
  @@ -385,6 +393,39 @@
     return SCM_BOOL_T;
   }
   
  +/*! \brief Guile callback for adding library commands.
  + *  \par Function Description
  + *  Callback function for the "component-library-command" Guile
  + *  function, which can be used in the rc files to add a command to
  + *  the component library.
  + *
  + *  \param [in] command Command to add.
  + *  \param [in] name    Optional descriptive name for component source.
  + *  \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
  + */
  +SCM g_rc_component_library_command (SCM command, SCM name)
  +{
  +  gchar *namestr = NULL;
  +  gchar *cmdstr = NULL;
  +  SCM_ASSERT (SCM_STRINGP (command), command, SCM_ARG1, 
  +	      "component-library-command");
  +  cmdstr = g_strdup(SCM_STRING_CHARS (command));
  +
  +  if (name != SCM_UNDEFINED) {
  +    SCM_ASSERT (SCM_STRINGP (name), name, SCM_ARG2, 
  +	      "component-library-command");
  +    namestr = SCM_STRING_CHARS (name);
  +  }
  +  /* take care of any shell variables */
  +  cmdstr = expand_env_variables(cmdstr);
  +
  +  s_clib_add_command (cmdstr, namestr);
  +
  +  g_free (cmdstr);
  +
  +  return SCM_BOOL_T;
  +}
  +
   /*! \todo Finish function description!!!
    *  \brief
    *  \par Function Description
  
  
  
  1.3                  eda/geda/gaf/libgeda/src/g_register.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_register.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/g_register.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- g_register.c	5 Apr 2007 22:57:49 -0000	1.2
  +++ g_register.c	28 May 2007 07:48:31 -0000	1.3
  @@ -57,7 +57,8 @@
   
   /*! \brief */
   static struct gsubr_t libgeda_funcs[] = {
  -  { "component-library",        1, 0, 0, g_rc_component_library },
  +  { "component-library",        1, 1, 0, g_rc_component_library },
  +  { "component-library-command", 1, 1, 0, g_rc_component_library_command },
     { "component-library-search", 1, 0, 0, g_rc_component_library_search },
     { "source-library",           1, 0, 0, g_rc_source_library },
     { "source-library-search",    1, 0, 0, g_rc_source_library_search },
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs