1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
37 #include "libgeda_priv.h"
39 #ifdef HAVE_LIBDMALLOC
43 /*! \todo Finish function documentation!!!
45 * \par Function Description
48 int vstbl_lookup_str(const vstbl_entry
*table
,
49 int size
, const char *str
)
53 for(i
= 0; i
< size
; i
++) {
54 if(strcmp(table
[i
].m_str
, str
) == 0) {
61 /*! \todo Finish function documentation!!!
63 * \par Function Description
66 int vstbl_get_val(const vstbl_entry
*table
, int index
)
68 return table
[index
].m_val
;
71 /*! \todo Finish function documentation!!!
73 * \par Function Description
76 SCM
g_rc_mode_general(SCM scmmode
,
79 const vstbl_entry
*table
,
86 SCM_ASSERT (scm_is_string (scmmode
), scmmode
,
89 mode
= scm_to_utf8_string (scmmode
);
91 index
= vstbl_lookup_str(table
, table_size
, mode
);
93 if(index
== table_size
) {
95 "Invalid mode [%s] passed to %s\n",
100 *mode_var
= vstbl_get_val(table
, index
);
109 /*! \brief Load a system configuration file.
110 * \par Function Description
111 * Attempts to load the system configuration file with basename \a
112 * rcname. The string "system-" is prefixed to \a rcname. If \a
113 * rcname is NULL, the default value of "gafrc" is used.
115 * \param toplevel The current #TOPLEVEL structure.
116 * \param rcfile The basename of the configuration file to load, or NULL.
117 * \param err Return location for errors, or NULL.
118 * \return TRUE on success, FALSE on failure.
121 g_rc_parse_system (TOPLEVEL
*toplevel
, const gchar
*rcname
, GError
**err
)
123 gchar
*sysname
= NULL
;
126 /* Default to gafrc */
127 rcname
= (rcname
!= NULL
) ? rcname
: "gafrc";
129 sysname
= g_strdup_printf ("system-%s", rcname
);
130 status
= g_rc_parse_local (toplevel
, sysname
, s_path_sys_config (), err
);
135 /*! \brief Load a user configuration file.
136 * \par Function Description
137 * Attempts to load the user configuration file with basename \a
138 * rcname. If \a rcname is NULL, the default value of "gafrc" is
141 * \param toplevel The current #TOPLEVEL structure.
142 * \param rcfile The basename of the configuration file to load, or NULL.
143 * \param err Return location for errors, or NULL.
144 * \return TRUE on success, FALSE on failure.
147 g_rc_parse_user (TOPLEVEL
*toplevel
, const gchar
*rcname
, GError
**err
)
149 /* Default to gafrc */
150 rcname
= (rcname
!= NULL
) ? rcname
: "gafrc";
152 return g_rc_parse_local (toplevel
, rcname
, s_path_user_config (), err
);
155 /*! \brief Load a local configuration file.
156 * \par Function Description
157 * Attempts to load the configuration file with basename \a rcname
158 * corresponding to \a path, reporting errors via \a err. If \a path
159 * is a directory, looks for a file named \a rcname in that
160 * directory. Otherwise, looks for a file named \a rcname in the same
161 * directory as \a path. If \a path is NULL, looks in the current
162 * directory. If \a rcname is NULL, the default value of "gafrc" is
165 * \param toplevel The current #TOPLEVEL structure.
166 * \param rcname The basename of the configuration file to load, or NULL.
167 * \param path The path to load a configuration file for, or NULL.
168 * \param err Return location for errors, or NULL.
169 * \return TRUE on success, FALSE on failure.
172 g_rc_parse_local (TOPLEVEL
*toplevel
, const gchar
*rcname
, const gchar
*path
,
176 gchar
*rcfile
= NULL
;
178 g_return_val_if_fail ((toplevel
!= NULL
), FALSE
);
180 /* Default to gafrc */
181 rcname
= (rcname
!= NULL
) ? rcname
: "gafrc";
183 path
= (path
!= NULL
) ? path
: ".";
185 /* If path isn't a directory, get the dirname. */
186 if (g_file_test (path
, G_FILE_TEST_IS_DIR
)) {
187 dir
= g_strdup (path
);
189 dir
= g_path_get_dirname (path
);
192 rcfile
= g_build_filename (dir
, rcname
, NULL
);
193 status
= g_rc_parse_file (toplevel
, rcfile
, err
);
200 /*! \brief Mark a configuration file as read.
201 * \par Function Description
202 * If the config file \a filename has not already been loaded, mark it
203 * as loaded and return TRUE, storing \a filename in \a toplevel (\a
204 * filename should not subsequently be freed). Otherwise, return
205 * FALSE, and set \a err appropriately.
207 * \note Should only be called by g_rc_parse_file().
209 * \param toplevel The current #TOPLEVEL structure.
210 * \param filename The config file name to test.
211 * \param err Return location for errors, or NULL.
212 * \return TRUE if \a filename not already loaded, FALSE otherwise.
215 g_rc_try_mark_read (TOPLEVEL
*toplevel
, gchar
*filename
, GError
**err
)
218 g_return_val_if_fail ((toplevel
!= NULL
), FALSE
);
219 g_return_val_if_fail ((filename
!= NULL
), FALSE
);
221 /* Test if marked read already */
222 found
= g_list_find_custom (toplevel
->RC_list
, filename
,
223 (GCompareFunc
) strcmp
);
225 g_set_error (err
, EDA_ERROR
, EDA_ERROR_RC_TWICE
,
226 _("Config file already loaded"));
230 toplevel
->RC_list
= g_list_append (toplevel
->RC_list
, filename
);
231 /* N.b. don't free name_norm here; it's stored in the TOPLEVEL. */
235 /*! \brief Load a configuration file.
236 * \par Function Description
237 * Load the configuration file \a rcfile, reporting errors via \a err.
239 * \param toplevel The current #TOPLEVEL structure.
240 * \param rcfile The filename of the configuration file to load.
241 * \param err Return location for errors, or NULL;
242 * \return TRUE on success, FALSE on failure.
245 g_rc_parse_file (TOPLEVEL
*toplevel
, const gchar
*rcfile
, GError
**err
)
247 gchar
*name_norm
= NULL
;
248 GError
*tmp_err
= NULL
;
249 g_return_val_if_fail ((toplevel
!= NULL
), FALSE
);
250 g_return_val_if_fail ((rcfile
!= NULL
), FALSE
);
252 /* Normalise filename */
253 name_norm
= f_normalize_filename (rcfile
, &tmp_err
);
254 if (name_norm
== NULL
) goto parse_file_error
;
256 /* Attempt to load the rc file, if it hasn't been loaded already.
257 * If g_rc_try_mark_read() succeeds, it stores name_norm in
258 * toplevel, so we *don't* free it. */
259 if (g_rc_try_mark_read (toplevel
, name_norm
, &tmp_err
)
260 && g_read_file (toplevel
, name_norm
, &tmp_err
)) {
261 s_log_message (_("Parsed config from [%s]\n"), name_norm
);
266 /* Copy tmp_err into err, with a prefixed message. */
267 /*! \todo We should upgrade to GLib >= 2.16 and use
268 * g_propagate_prefixed_error(). */
270 g_error_free (tmp_err
);
272 gchar
*orig_msg
= tmp_err
->message
;
274 g_strdup_printf (_("Unable to parse config from [%s]: %s"),
275 (name_norm
!= NULL
) ? name_norm
: rcfile
, orig_msg
);
284 g_rc_parse__process_error (GError
**err
, const gchar
*pname
)
288 /* Take no chances; if err was not set for some reason, bail out. */
291 _("ERROR: An unknown error occurred while parsing configuration files.");
292 s_log_message ("%s\n", msgl
);
293 fprintf(stderr
, "%s\n", msgl
);
296 /* Config files are allowed to be missing or skipped; check for
298 if (g_error_matches (*err
, G_FILE_ERROR
, G_FILE_ERROR_NOENT
) ||
299 g_error_matches (*err
, EDA_ERROR
, EDA_ERROR_RC_TWICE
)) {
303 s_log_message (_("ERROR: %s\n"), (*err
)->message
);
304 fprintf (stderr
, _("ERROR: %s\n"), (*err
)->message
);
307 /* g_path_get_basename() allocates memory, but we don't care
308 * because we're about to exit. */
309 pbase
= g_path_get_basename (pname
);
310 fprintf (stderr
, _("ERROR: The %s log may contain more information.\n"),
315 /*! \brief General RC file parsing function.
316 * \par Function Description
317 * Calls g_rc_parse_handler() with the default error handler. If any
318 * error other than ENOENT occurs while parsing a configuration file,
319 * prints an informative message and calls exit(1).
321 * \bug libgeda shouldn't call exit().
323 * \warning Since this function may not return, it should only be used
324 * on application startup or when there is no chance of data loss from
325 * an unexpected exit().
327 * \param [in] toplevel The current #TOPLEVEL structure.
328 * \param [in] pname The name of the application (usually argv[0]).
329 * \param [in] rcname Config file basename, or NULL.
330 * \param [in] rcfile Specific config file path, or NULL.
333 g_rc_parse (TOPLEVEL
*toplevel
, const gchar
*pname
,
334 const gchar
*rcname
, const gchar
*rcfile
)
336 g_rc_parse_handler (toplevel
, rcname
, rcfile
,
337 (ConfigParseErrorFunc
) g_rc_parse__process_error
,
341 /*! \brief General RC file parsing function.
342 * \par Function Description
343 * Attempt to load system, user and local (current working directory)
344 * configuration files, first with the default "gafrc" basename and
345 * then with the basename \a rcname, if \a rcname is not NULL.
346 * Additionally, attempt to load configuration from \a rcfile if \a
347 * rcfile is not NULL.
349 * If an error occurs, calls \a handler with the provided \a user_data
354 * \param toplevel The current #TOPLEVEL structure.
355 * \param rcname Config file basename, or NULL.
356 * \param rcfile Specific config file path, or NULL.
357 * \param handler Handler function for config parse errors.
358 * \param user_data Data to be passed to \a handler.
361 g_rc_parse_handler (TOPLEVEL
*toplevel
,
362 const gchar
*rcname
, const gchar
*rcfile
,
363 ConfigParseErrorFunc handler
, void *user_data
)
367 #ifdef HANDLER_DISPATCH
368 # error HANDLER_DISPATCH already defined
370 #define HANDLER_DISPATCH \
371 do { if (err == NULL) break; handler (&err, user_data); \
372 g_error_free (err); err = NULL; } while (0)
374 /* Load configuration files in order. */
375 /* First gafrc files. */
376 g_rc_parse_system (toplevel
, NULL
, &err
); HANDLER_DISPATCH
;
377 g_rc_parse_user (toplevel
, NULL
, &err
); HANDLER_DISPATCH
;
378 g_rc_parse_local (toplevel
, NULL
, NULL
, &err
); HANDLER_DISPATCH
;
379 /* Next application-specific rcname. */
380 if (rcname
!= NULL
) {
381 g_rc_parse_system (toplevel
, rcname
, &err
); HANDLER_DISPATCH
;
382 g_rc_parse_user (toplevel
, rcname
, &err
); HANDLER_DISPATCH
;
383 g_rc_parse_local (toplevel
, rcname
, NULL
, &err
); HANDLER_DISPATCH
;
385 /* Finally, optional additional config file. */
386 if (rcfile
!= NULL
) {
387 g_rc_parse_file (toplevel
, rcfile
, &err
); HANDLER_DISPATCH
;
390 #undef HANDLER_DISPATCH
394 * \par Function Description
397 * \param [in] name Optional descriptive name for library directory.
398 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
400 SCM
g_rc_component_library(SCM path
, SCM name
)
404 char *namestr
= NULL
;
406 SCM_ASSERT (scm_is_string (path
), path
,
407 SCM_ARG1
, "component-library");
409 if (name
!= SCM_UNDEFINED
) {
410 SCM_ASSERT (scm_is_string (name
), name
,
411 SCM_ARG2
, "component-library");
412 namestr
= scm_to_utf8_string (name
);
415 /* take care of any shell variables */
416 temp
= scm_to_utf8_string (path
);
417 string
= s_expand_env_variables (temp
);
421 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
423 "Invalid path [%s] passed to component-library\n",
425 if (namestr
!= NULL
) {
432 if (g_path_is_absolute (string
)) {
433 s_clib_add_directory (string
, namestr
);
435 gchar
*cwd
= g_get_current_dir ();
437 temp
= g_build_filename (cwd
, string
, NULL
);
438 s_clib_add_directory (temp
, namestr
);
443 if (namestr
!= NULL
) {
451 /*! \brief Guile callback for adding library commands.
452 * \par Function Description
453 * Callback function for the "component-library-command" Guile
454 * function, which can be used in the rc files to add a command to
455 * the component library.
457 * \param [in] listcmd command to get a list of symbols
458 * \param [in] getcmd command to get a symbol from the library
459 * \param [in] name Optional descriptive name for component source.
460 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
462 SCM
g_rc_component_library_command (SCM listcmd
, SCM getcmd
,
465 const CLibSource
*src
;
466 gchar
*lcmdstr
, *gcmdstr
;
467 char *tmp_str
, *namestr
;
469 SCM_ASSERT (scm_is_string (listcmd
), listcmd
, SCM_ARG1
,
470 "component-library-command");
471 SCM_ASSERT (scm_is_string (getcmd
), getcmd
, SCM_ARG2
,
472 "component-library-command");
473 SCM_ASSERT (scm_is_string (name
), name
, SCM_ARG3
,
474 "component-library-command");
476 /* take care of any shell variables */
477 /*! \bug this may be a security risk! */
478 tmp_str
= scm_to_utf8_string (listcmd
);
479 lcmdstr
= s_expand_env_variables (tmp_str
);
480 free (tmp_str
); /* this should stay as free (allocated from guile) */
482 /* take care of any shell variables */
483 /*! \bug this may be a security risk! */
484 tmp_str
= scm_to_utf8_string (getcmd
);
485 gcmdstr
= s_expand_env_variables (tmp_str
);
486 free (tmp_str
); /* this should stay as free (allocated from guile) */
488 namestr
= scm_to_utf8_string (name
);
490 src
= s_clib_add_command (lcmdstr
, gcmdstr
, namestr
);
492 free (namestr
); /* this should stay as free (allocated from guile) */
496 if (src
!= NULL
) return SCM_BOOL_T
;
501 /*! \brief Guile callback for adding library functions.
502 * \par Function Description
503 * Callback function for the "component-library-funcs" Guile
504 * function, which can be used in the rc files to add a set of Guile
505 * procedures for listing and generating symbols.
507 * \param [in] listfunc A Scheme procedure which takes no arguments
508 * and returns a Scheme list of component names.
509 * \param [in] getfunc A Scheme procedure which takes a component
510 * name as an argument and returns a symbol
511 * encoded in a string in gEDA format, or the \b
512 * \#f if the component name is unknown.
513 * \param [in] name A descriptive name for this component source.
515 * \returns SCM_BOOL_T on success, SCM_BOOL_F otherwise.
517 SCM
g_rc_component_library_funcs (SCM listfunc
, SCM getfunc
, SCM name
)
520 SCM result
= SCM_BOOL_F
;
522 SCM_ASSERT (scm_is_true (scm_procedure_p (listfunc
)), listfunc
, SCM_ARG1
,
523 "component-library-funcs");
524 SCM_ASSERT (scm_is_true (scm_procedure_p (getfunc
)), getfunc
, SCM_ARG2
,
525 "component-library-funcs");
526 SCM_ASSERT (scm_is_string (name
), name
, SCM_ARG3
,
527 "component-library-funcs");
529 namestr
= scm_to_utf8_string (name
);
531 if (s_clib_add_scm (listfunc
, getfunc
, namestr
) != NULL
) {
539 /*! \todo Finish function description!!!
541 * \par Function Description
544 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
546 SCM
g_rc_component_library_search(SCM path
)
553 SCM_ASSERT (scm_is_string (path
), path
,
554 SCM_ARG1
, "component-library-search");
556 /* take care of any shell variables */
557 temp
= scm_to_utf8_string (path
);
558 string
= s_expand_env_variables (temp
);
562 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
564 "Invalid path [%s] passed to component-library-search\n",
570 dir
= g_dir_open (string
, 0, NULL
);
573 "Invalid path [%s] passed to component-library-search\n",
579 while ((entry
= g_dir_read_name (dir
))) {
580 /* don't do . and .. and special case font */
581 if ((g_strcasecmp (entry
, ".") != 0) &&
582 (g_strcasecmp (entry
, "..") != 0) &&
583 (g_strcasecmp (entry
, "font") != 0))
585 gchar
*fullpath
= g_build_filename (string
, entry
, NULL
);
587 if (g_file_test (fullpath
, G_FILE_TEST_IS_DIR
)) {
588 if (g_path_is_absolute (fullpath
)) {
589 s_clib_add_directory (fullpath
, NULL
);
591 gchar
*cwd
= g_get_current_dir ();
593 temp
= g_build_filename (cwd
, fullpath
, NULL
);
594 s_clib_add_directory (temp
, NULL
);
609 /*! \todo Finish function description!!!
611 * \par Function Description
614 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
616 SCM
g_rc_source_library(SCM path
)
621 SCM_ASSERT (scm_is_string (path
), path
,
622 SCM_ARG1
, "source-library");
624 /* take care of any shell variables */
625 temp
= scm_to_utf8_string (path
);
626 string
= s_expand_env_variables (temp
);
630 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
632 "Invalid path [%s] passed to source-library\n",
638 if (g_path_is_absolute (string
)) {
639 s_slib_add_entry (string
);
641 gchar
*cwd
= g_get_current_dir ();
643 temp
= g_build_filename (cwd
, string
, NULL
);
644 s_slib_add_entry (temp
);
654 /*! \todo Finish function description!!!
656 * \par Function Description
659 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
661 SCM
g_rc_source_library_search(SCM path
)
668 SCM_ASSERT (scm_is_string (path
), path
,
669 SCM_ARG1
, "source-library-search");
671 /* take care of any shell variables */
672 temp
= scm_to_utf8_string (path
);
673 string
= s_expand_env_variables (temp
);
677 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
679 "Invalid path [%s] passed to source-library-search\n",
685 dir
= g_dir_open (string
, 0, NULL
);
688 "Invalid path [%s] passed to source-library-search\n",
694 while ((entry
= g_dir_read_name (dir
))) {
695 /* don't do . and .. and special case font */
696 if ((g_strcasecmp (entry
, ".") != 0) &&
697 (g_strcasecmp (entry
, "..") != 0) &&
698 (g_strcasecmp (entry
, "font") != 0))
700 gchar
*fullpath
= g_build_filename (string
, entry
, NULL
);
702 if (g_file_test (fullpath
, G_FILE_TEST_IS_DIR
)) {
703 if (s_slib_uniq (fullpath
)) {
704 if (g_path_is_absolute (fullpath
)) {
705 s_slib_add_entry (fullpath
);
707 gchar
*cwd
= g_get_current_dir ();
709 temp
= g_build_filename (cwd
, fullpath
, NULL
);
710 s_slib_add_entry (temp
);
726 /*! \todo Finish function description!!!
728 * \par Function Description
733 * \return SCM_BOOL_T always.
735 SCM
g_rc_world_size(SCM width
, SCM height
, SCM border
)
736 #define FUNC_NAME "world-size"
738 int i_width
, i_height
, i_border
;
739 int init_right
, init_bottom
;
741 SCM_ASSERT (SCM_NIMP (width
) && SCM_REALP (width
), width
,
742 SCM_ARG1
, FUNC_NAME
);
743 SCM_ASSERT (SCM_NIMP (height
) && SCM_REALP (height
), height
,
744 SCM_ARG2
, FUNC_NAME
);
745 SCM_ASSERT (SCM_NIMP (border
) && SCM_REALP (border
), border
,
746 SCM_ARG3
, FUNC_NAME
);
748 /* yes this is legit, we are casing the resulting double to an int */
749 i_width
= (int) (scm_to_double (width
) * MILS_PER_INCH
);
750 i_height
= (int) (scm_to_double (height
) * MILS_PER_INCH
);
751 i_border
= (int) (scm_to_double (border
) * MILS_PER_INCH
);
753 PAPERSIZEtoWORLD(i_width
, i_height
, i_border
,
754 &init_right
, &init_bottom
);
757 printf("%d %d\n", i_width
, i_height
);
758 printf("%d %d\n", init_right
, init_bottom
);
761 default_init_right
= init_right
;
762 default_init_bottom
= init_bottom
;
768 /*! \todo Finish function description!!!
770 * \par Function Description
773 * \return SCM_BOOL_T always.
775 SCM
g_rc_untitled_name(SCM name
)
778 SCM_ASSERT (scm_is_string (name
), name
,
779 SCM_ARG1
, "untitled-name");
781 g_free(default_untitled_name
);
783 temp
= scm_to_utf8_string (name
);
784 default_untitled_name
= g_strdup (temp
);
791 /*! \brief Add a directory to the Guile load path.
792 * \par Function Description
793 * Prepends \a s_path to the Guile system '%load-path', after
794 * expanding environment variables.
796 * \param [in] s_path Path to be added.
797 * \return SCM_BOOL_T.
799 SCM
g_rc_scheme_directory(SCM s_path
)
806 SCM_ASSERT (scm_is_string (s_path
), s_path
,
807 SCM_ARG1
, "scheme-directory");
809 /* take care of any shell variables */
810 temp
= scm_to_utf8_string (s_path
);
811 expanded
= s_expand_env_variables (temp
);
812 s_path
= scm_from_utf8_string (expanded
);
816 s_load_path_var
= scm_c_lookup ("%load-path");
817 s_load_path
= scm_variable_ref (s_load_path_var
);
818 scm_variable_set_x (s_load_path_var
, scm_cons (s_path
, s_load_path
));
820 scm_remember_upto_here_2 (s_load_path_var
, s_load_path
);
821 scm_remember_upto_here_1 (s_path
);
826 /*! \todo Finish function description!!!
828 * \par Function Description
831 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
833 SCM
g_rc_bitmap_directory(SCM path
)
838 SCM_ASSERT (scm_is_string (path
), path
,
839 SCM_ARG1
, "bitmap-directory");
841 /* take care of any shell variables */
842 temp
= scm_to_utf8_string (path
);
843 string
= s_expand_env_variables (temp
);
847 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
849 "Invalid path [%s] passed to bitmap-directory\n",
855 g_free(default_bitmap_directory
);
856 default_bitmap_directory
= string
;
861 /*! \todo Finish function description!!!
863 * \par Function Description
865 * \param [in] scmsymname
866 * \return SCM_BOOL_T always.
868 SCM
g_rc_bus_ripper_symname(SCM scmsymname
)
872 SCM_ASSERT (scm_is_string (scmsymname
), scmsymname
,
873 SCM_ARG1
, "bus-ripper-symname");
875 g_free(default_bus_ripper_symname
);
877 temp
= scm_to_utf8_string (scmsymname
);
878 default_bus_ripper_symname
= g_strdup (temp
);
884 /*! \todo Finish function description!!!
886 * \par Function Description
888 * \param [in] scmsymname
889 * \return SCM_BOOL_T always.
891 SCM
g_rc_postscript_prolog(SCM scmsymname
)
895 SCM_ASSERT (scm_is_string (scmsymname
), scmsymname
,
896 SCM_ARG1
, "postsript-prolog");
898 g_free(default_postscript_prolog
);
900 /* take care of any shell variables */
901 temp
= scm_to_utf8_string (scmsymname
);
902 default_postscript_prolog
=
903 s_expand_env_variables (temp
);
909 /*! \todo Finish function description!!!
911 * \par Function Description
913 * \return SCM_BOOL_T always.
915 SCM
g_rc_reset_component_library(void)
922 /*! \todo Finish function description!!!
924 * \par Function Description
926 * \return SCM_BOOL_T always.
928 SCM
g_rc_reset_source_library(void)
937 /*! \todo Finish function documentation!!!
939 * \par Function Description
942 SCM
g_rc_attribute_promotion(SCM mode
)
944 static const vstbl_entry mode_table
[] = {
949 RETURN_G_RC_MODE("attribute-promotion",
950 default_attribute_promotion
,
954 /*! \todo Finish function documentation!!!
956 * \par Function Description
959 SCM
g_rc_promote_invisible(SCM mode
)
961 static const vstbl_entry mode_table
[] = {
966 RETURN_G_RC_MODE("promote-invisible",
967 default_promote_invisible
,
971 /*! \todo Finish function documentation!!!
973 * \par Function Description
976 SCM
g_rc_keep_invisible(SCM mode
)
978 static const vstbl_entry mode_table
[] = {
983 RETURN_G_RC_MODE("keep-invisible",
984 default_keep_invisible
,
988 /*! \todo Finish function description!!!
990 * \par Function Description
992 * \param [in] attrlist
993 * \return SCM_BOOL_T always.
995 SCM
g_rc_always_promote_attributes(SCM attrlist
)
1002 g_list_foreach(default_always_promote_attributes
, (GFunc
)g_free
, NULL
);
1003 g_list_free(default_always_promote_attributes
);
1005 if (scm_is_string (attrlist
)) {
1007 s_log_message(_("WARNING: using a string for 'always-promote-attributes'"
1008 " is deprecated. Use a list of strings instead\n"));
1010 /* convert the space separated strings into a GList */
1011 temp
= scm_to_utf8_string (attrlist
);
1012 attr2
= g_strsplit(temp
," ", 0);
1015 for (i
=0; attr2
[i
] != NULL
; i
++) {
1016 if (strlen(attr2
[i
]) > 0) {
1017 list
= g_list_prepend(list
, g_strdup(attr2
[i
]));
1022 SCM_ASSERT(scm_list_p(attrlist
), attrlist
, SCM_ARG1
, "always-promote-attributes");
1023 length
= scm_ilength(attrlist
);
1024 /* convert the scm list into a GList */
1025 for (i
=0; i
< length
; i
++) {
1027 SCM_ASSERT(scm_is_string(scm_list_ref(attrlist
, scm_from_int(i
))),
1028 scm_list_ref(attrlist
, scm_from_int(i
)), SCM_ARG1
,
1029 "always-promote-attribute: list element is not a string");
1030 temp
= scm_to_utf8_string (scm_list_ref (attrlist
, scm_from_int (i
)));
1031 attr
= g_strdup(temp
);
1033 list
= g_list_prepend(list
, attr
);
1037 default_always_promote_attributes
= g_list_reverse(list
);
1042 extern COLOR print_colors
[MAX_COLORS
];
1044 SCM
g_rc_print_color_map (SCM scm_map
)
1046 if (scm_map
== SCM_UNDEFINED
) {
1047 return s_color_map_to_scm (print_colors
);
1050 SCM_ASSERT (scm_is_true (scm_list_p (scm_map
)),
1051 scm_map
, SCM_ARG1
, "print-color-map");
1053 s_color_map_from_scm (print_colors
, scm_map
, "print-color-map");