1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998-2007 Ales Hvezda
4 * Copyright (C) 1998-2007 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
47 #include "../include/i_vars.h"
48 #include "../include/papersizes.h"
49 #include "../include/prototype.h"
51 #ifdef HAVE_LIBDMALLOC
55 /*! \todo Finish function documentation!!!
57 * \par Function Description
60 int vstbl_lookup_str(const vstbl_entry
*table
,
61 int size
, const char *str
)
65 for(i
= 0; i
< size
; i
++) {
66 if(strcmp(table
[i
].m_str
, str
) == 0) {
73 /*! \todo Finish function documentation!!!
75 * \par Function Description
78 int vstbl_get_val(const vstbl_entry
*table
, int index
)
80 return table
[index
].m_val
;
83 /*! \todo Finish function documentation!!!
85 * \par Function Description
88 SCM
g_rc_mode_general(SCM scmmode
,
91 const vstbl_entry
*table
,
98 SCM_ASSERT (scm_is_string (scmmode
), scmmode
,
101 mode
= SCM_STRING_CHARS (scmmode
);
103 index
= vstbl_lookup_str(table
, table_size
, mode
);
105 if(index
== table_size
) {
107 "Invalid mode [%s] passed to %s\n",
112 *mode_var
= vstbl_get_val(table
, index
);
119 extern GHashTable
*font_char_to_file
;
121 /*! \brief Reads the gafrc file.
122 * \par Function Description
123 * This is the function which actually reads in the RC file.
124 * First, it looks in a list of previously read RC files. If the file has
125 * already been read, it just says OK. After reading the file, it places
126 * the filename in the list of read files.
128 * \param [in] w_current The TOPLEVEL object.
129 * \param [in] fname RC file name to read.
130 * \param [in] ok_msg Message to print if file is read ok.
131 * \param [in] err_msg Message to print if file read error occurs
132 * \return 1 on success, 0 otherwise.
134 gint
g_rc_parse_general(TOPLEVEL
*w_current
,
136 const gchar
*ok_msg
, const gchar
*err_msg
)
138 gint found_rc
= FALSE
;
139 GList
*found_rc_filename_element
;
141 /* First see if fname is in list of previously read RC files. */
142 found_rc_filename_element
= g_list_find_custom(w_current
->RC_list
,
143 (gconstpointer
) fname
,
144 (GCompareFunc
) strcmp
);
145 if (found_rc_filename_element
!= NULL
) {
146 /* We've already read this one in. */
147 s_log_message("RC file [%s] already read in.\n", fname
);
151 /* Now try to read in contents of RC file. */
152 if (access (fname
, R_OK
) == 0) {
155 /* Everything was OK. Now add this file to list of read RC files. */
156 w_current
->RC_list
= g_list_append (w_current
->RC_list
,
158 s_log_message (ok_msg
, fname
);
161 s_log_message (err_msg
, fname
);
168 /*! \brief Read gEDA root path from RC file.
169 * \par Function Description
170 * This function will read the RC file and parse the root path for gEDA.
172 * \return String containing rc root path
174 * \warning Do not free the returned character string.
176 const gchar
* g_rc_parse_path(void)
178 const gchar
*rc_path
;
180 if (g_strcasecmp (GEDARCDIR
, "none") == 0) {
181 /* rc dir not specified at configure time, so search for config in */
182 /* the normal GEDADATA directory */
183 rc_path
= g_getenv ("GEDADATA");
185 /* rc path specified at configure time, always return specified path */
192 /*! \brief Parses a system RC file.
193 * \par Function Description
194 * This function wil open and parse a system rc file.
196 * \param [in] w_current The TOPLEVEL object.
197 * \param [in] rcname System RC file name to parse.
198 * \return 1 on success, 0 on failure.
200 gint
g_rc_parse_system_rc(TOPLEVEL
*w_current
, const gchar
*rcname
)
202 const gchar
*geda_data
= g_getenv ("GEDADATA");
206 gchar
*ok_msg
, *err_msg
;
208 if (geda_data
== NULL
) {
209 fprintf(stderr
, "You must set the GEDADATA environment variable!\n");
213 tmp
= g_strconcat (g_rc_parse_path (),
217 filename
= f_normalize_filename(tmp
);
218 if (filename
== NULL
) {
222 ok_msg
= g_strdup_printf ("Read system-%s file [%%s]\n",
224 err_msg
= g_strdup_printf ("Did not find required system-%s file [%%s]\n",
226 found_rc
= g_rc_parse_general(w_current
, filename
, ok_msg
, err_msg
);
236 /*! \brief Parse a RC file in users home directory.
237 * \par Function Description
238 * This function will open and parse a RC file in the users home directory.
240 * \param [in] w_current The TOPLEVEL object.
241 * \param [in] rcname User's RC file name.
242 * \return 1 on success, 0 on failure.
244 gint
g_rc_parse_home_rc(TOPLEVEL
*w_current
, const gchar
*rcname
)
246 const gchar
*home
= g_getenv ("HOME");
250 gchar
*ok_msg
, *err_msg
;
256 tmp
= g_strconcat (home
,
262 filename
= f_normalize_filename(tmp
);
263 if (filename
== NULL
) {
267 ok_msg
= g_strdup_printf ("Read ~/.gEDA/%s file [%%s]\n",
269 err_msg
= g_strdup_printf ("Did not find optional ~/.gEDA/%s file [%%s]\n",
271 found_rc
= g_rc_parse_general(w_current
, filename
, ok_msg
, err_msg
);
281 /*! \brief Parse rc file in current working directory.
282 * \par Function Description
283 * This function will open and parse a RC file in the current working directory.
285 * \param [in] w_current The TOPLEVEL object.
286 * \param [in] rcname Local directory RC file name.
287 * \return 1 on success, 0 on failure.
289 gint
g_rc_parse_local_rc(TOPLEVEL
*w_current
, const gchar
*rcname
)
297 tmp
= g_strconcat (".", G_DIR_SEPARATOR_S
, rcname
, NULL
);
298 filename
= f_normalize_filename (tmp
);
299 if (filename
== NULL
) {
303 ok_msg
= g_strdup_printf ("Read local %s file [%%s]\n",
305 err_msg
= g_strdup_printf ("Did not find optional local %s file [%%s]\n",
307 found_rc
= g_rc_parse_general(w_current
, filename
, ok_msg
, err_msg
);
317 /*! \brief Parse a RC file from a specified location.
318 * \par Function Description
319 * This function will open and parse a RC file from a specified location.
321 * \param [in] w_current The TOPLEVEL object.
322 * \param [in] rcname Specified location RC file name.
323 * \return 1 on success, 0 on failure.
325 gint
g_rc_parse_specified_rc(TOPLEVEL
*w_current
, const gchar
*rcname
)
332 if (rcname
== NULL
) {
336 filename
= f_normalize_filename (rcname
);
338 ok_msg
= g_strdup_printf ("Read specified %s file [%%s]\n",
340 err_msg
= g_strdup_printf ("Did not find specified %s file [%%s]\n",
342 found_rc
= g_rc_parse_general(w_current
, filename
, ok_msg
, err_msg
);
351 /*! \brief General RC file parsing function.
352 * \par Function Description
353 * This function will check for System, HOME and Local RC files matching
354 * the rcname input parameter. If none of those three are found it will
355 * search for the specified_rc_filename. When none are found it will
356 * call exit(-1) to terminate the program.
358 * \param [in] w_current The TOPLEVEL object.
359 * \param [in] rcname RC file name.
360 * \param [in] specified_rc_filename Specific location RC file name.
361 * \return calls exit(-1) when no RC file matching either rcname or
362 * specified_rc_filename is found.
364 void g_rc_parse(TOPLEVEL
*w_current
,
365 const gchar
*rcname
, const gchar
*specified_rc_filename
)
371 /* set the GEDADATARC environment variable so that the rc files */
372 /* know where to look for others */
373 rc_path
= f_normalize_filename (g_rc_parse_path ());
374 /* Reversion to putenv inspired by W. Hoch, 2.17.2005 */
375 /* g_setenv ("GEDADATARC", rc_path, TRUE); */ /*requires glib 2.4.x*/
376 geda_rcdata
= g_strdup_printf("GEDADATARC=%s", rc_path
);
380 /* visit rc files in order */
381 /* Changed by SDB 1.2.2005 in response to Peter Kaiser's bug report.
382 * Read gafrc files first */
383 found_rc
|= g_rc_parse_system_rc(w_current
, "gafrc");
384 found_rc
|= g_rc_parse_home_rc(w_current
, "gafrc");
385 found_rc
|= g_rc_parse_local_rc(w_current
, "gafrc");
386 /* continue support for individual rc files for each program. */
387 found_rc
|= g_rc_parse_system_rc(w_current
, rcname
);
388 found_rc
|= g_rc_parse_home_rc(w_current
, rcname
);
389 found_rc
|= g_rc_parse_local_rc(w_current
, rcname
);
391 /* New fcn introduced by SDB to consolidate this & make it available
392 * for other programs */
393 found_rc
|= g_rc_parse_specified_rc(w_current
, specified_rc_filename
);
395 /* Oh well, I couldn't find any rcfile, exit! */
397 /*! \todo these two are basically the
400 s_log_message("Could not find any %s file!\n", rcname
);
401 fprintf(stderr
, "Could not find a %s file\n", rcname
);
407 * \par Function Description
410 * \param [in] name Optional descriptive name for library directory.
411 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
413 SCM
g_rc_component_library(SCM path
, SCM name
)
416 char *namestr
= NULL
;
418 SCM_ASSERT (scm_is_string (path
), path
,
419 SCM_ARG1
, "component-library");
421 if (name
!= SCM_UNDEFINED
) {
422 SCM_ASSERT (scm_is_string (name
), name
,
423 SCM_ARG2
, "component-library");
424 namestr
= SCM_STRING_CHARS (name
);
427 string
= g_strdup (SCM_STRING_CHARS (path
));
428 /* take care of any shell variables */
429 string
= expand_env_variables(string
);
432 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
434 "Invalid path [%s] passed to component-library\n",
440 if (g_path_is_absolute (string
)) {
441 s_clib_add_directory (string
, namestr
);
443 gchar
*cwd
= g_get_current_dir ();
446 u_basic_strip_trailing(cwd
, G_DIR_SEPARATOR
);
448 temp
= g_strconcat (cwd
, G_DIR_SEPARATOR_S
, string
, NULL
);
449 s_clib_add_directory (temp
, namestr
);
461 /*! \brief Guile callback for adding library commands.
462 * \par Function Description
463 * Callback function for the "component-library-command" Guile
464 * function, which can be used in the rc files to add a command to
465 * the component library.
467 * \param [in] command Command to add.
468 * \param [in] name Optional descriptive name for component source.
469 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
471 SCM
g_rc_component_library_command (SCM listcmd
, SCM getcmd
,
474 gchar
*namestr
= NULL
;
475 gchar
*lcmdstr
= NULL
;
476 gchar
*gcmdstr
= NULL
;
477 const CLibSource
*src
;
480 SCM_ASSERT (scm_is_string (listcmd
), listcmd
, SCM_ARG1
,
481 "component-library-command");
482 tmp_str
= scm_to_locale_string (listcmd
);
483 lcmdstr
= g_strdup (tmp_str
);
484 free (tmp_str
); /* this should stay as free (allocated from guile) */
486 SCM_ASSERT (scm_is_string (getcmd
), getcmd
, SCM_ARG2
,
487 "component-library-command");
488 tmp_str
= scm_to_locale_string (getcmd
);
489 gcmdstr
= g_strdup (tmp_str
);
490 free (tmp_str
); /* this should stay as free (allocated from guile) */
492 SCM_ASSERT (scm_is_string (name
), name
, SCM_ARG3
,
493 "component-library-command");
494 tmp_str
= scm_to_locale_string (name
);
495 namestr
= g_strdup (tmp_str
);
496 free (tmp_str
); /* this should stay as free (allocated from guile) */
498 /* take care of any shell variables */
499 /*! \bug this may be a security risk! */
500 lcmdstr
= expand_env_variables(lcmdstr
);
501 gcmdstr
= expand_env_variables(gcmdstr
);
503 src
= s_clib_add_command (lcmdstr
, gcmdstr
, namestr
);
509 if (src
!= NULL
) return SCM_BOOL_T
;
514 /*! \brief Guile callback for adding library functions.
515 * \par Function Description
516 * Callback function for the "component-library-funcs" Guile
517 * function, which can be used in the rc files to add a set of Guile
518 * procedures for listing and generating symbols.
520 * \param [in] listfunc A Scheme procedure which takes no arguments
521 * and returns a Scheme list of component names.
522 * \param [in] getfunc A Scheme procedure which takes a component
523 * name as an argument and returns a symbol
524 * encoded in a string in gEDA format, or the \b
525 * \#f if the component name is unknown.
526 * \param [in] name A descriptive name for this component source.
528 * \returns SCM_BOOL_T on success, SCM_BOOL_F otherwise.
530 SCM
g_rc_component_library_funcs (SCM listfunc
, SCM getfunc
, SCM name
)
532 SCM_ASSERT (scm_is_true (scm_procedure_p (listfunc
)), listfunc
, SCM_ARG1
,
533 "component-library-funcs");
534 SCM_ASSERT (scm_is_true (scm_procedure_p (getfunc
)), getfunc
, SCM_ARG2
,
535 "component-library-funcs");
536 SCM_ASSERT (scm_is_string (name
), name
, SCM_ARG1
,
537 "component-library-funcs");
539 if (s_clib_add_scm (listfunc
, getfunc
, SCM_STRING_CHARS (name
)) != NULL
) {
546 /*! \todo Finish function description!!!
548 * \par Function Description
551 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
553 SCM
g_rc_component_library_search(SCM path
)
559 SCM_ASSERT (scm_is_string (path
), path
,
560 SCM_ARG1
, "component-library-search");
562 string
= g_strdup (SCM_STRING_CHARS (path
));
563 /* take care of any shell variables */
564 string
= expand_env_variables(string
);
567 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
569 "Invalid path [%s] passed to component-library-search\n",
575 dir
= g_dir_open (string
, 0, NULL
);
578 "Invalid path [%s] passed to component-library-search\n",
584 while ((entry
= g_dir_read_name (dir
))) {
585 /* don't do . and .. and special case font */
586 if ((g_strcasecmp (entry
, ".") != 0) &&
587 (g_strcasecmp (entry
, "..") != 0) &&
588 (g_strcasecmp (entry
, "font") != 0))
590 gchar
*fullpath
= g_strconcat (string
,
595 if (g_file_test (fullpath
, G_FILE_TEST_IS_DIR
)) {
596 if (g_path_is_absolute (fullpath
)) {
597 s_clib_add_directory (fullpath
, NULL
);
599 gchar
*cwd
= g_get_current_dir ();
602 u_basic_strip_trailing(cwd
, G_DIR_SEPARATOR
);
604 temp
= g_strconcat (cwd
,
608 s_clib_add_directory (temp
, NULL
);
624 /*! \todo Finish function description!!!
626 * \par Function Description
629 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
631 SCM
g_rc_source_library(SCM path
)
635 SCM_ASSERT (scm_is_string (path
), path
,
636 SCM_ARG1
, "source-library");
638 string
= g_strdup (SCM_STRING_CHARS (path
));
639 /* take care of any shell variables */
640 string
= expand_env_variables(string
);
643 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
645 "Invalid path [%s] passed to source-library\n",
651 if (g_path_is_absolute (string
)) {
652 s_slib_add_entry (string
);
654 gchar
*cwd
= g_get_current_dir ();
657 u_basic_strip_trailing(cwd
, G_DIR_SEPARATOR
);
659 temp
= g_strconcat (cwd
,
663 s_slib_add_entry (temp
);
675 /*! \todo Finish function description!!!
677 * \par Function Description
680 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
682 SCM
g_rc_source_library_search(SCM path
)
688 SCM_ASSERT (scm_is_string (path
), path
,
689 SCM_ARG1
, "source-library-search");
691 string
= g_strdup (SCM_STRING_CHARS (path
));
692 /* take care of any shell variables */
693 string
= expand_env_variables(string
);
696 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
698 "Invalid path [%s] passed to source-library-search\n",
704 dir
= g_dir_open (string
, 0, NULL
);
707 "Invalid path [%s] passed to source-library-search\n",
715 while ((entry
= g_dir_read_name (dir
))) {
716 /* don't do . and .. and special case font */
717 if ((g_strcasecmp (entry
, ".") != 0) &&
718 (g_strcasecmp (entry
, "..") != 0) &&
719 (g_strcasecmp (entry
, "font") != 0))
721 gchar
*fullpath
= g_strconcat (string
,
726 if (g_file_test (fullpath
, G_FILE_TEST_IS_DIR
)) {
727 if (s_slib_uniq (fullpath
)) {
728 if (g_path_is_absolute (fullpath
)) {
729 s_slib_add_entry (fullpath
);
731 gchar
*cwd
= g_get_current_dir ();
734 u_basic_strip_trailing(cwd
, G_DIR_SEPARATOR
);
736 temp
= g_strconcat (cwd
,
740 s_slib_add_entry (temp
);
757 /*! \todo Finish function description!!!
759 * \par Function Description
764 * \return SCM_BOOL_T always.
766 SCM
g_rc_world_size(SCM width
, SCM height
, SCM border
)
767 #define FUNC_NAME "world-size"
769 int i_width
, i_height
, i_border
;
770 int init_right
, init_bottom
;
772 SCM_ASSERT (SCM_NIMP (width
) && SCM_REALP (width
), width
,
773 SCM_ARG1
, FUNC_NAME
);
774 SCM_ASSERT (SCM_NIMP (height
) && SCM_REALP (height
), height
,
775 SCM_ARG2
, FUNC_NAME
);
776 SCM_ASSERT (SCM_NIMP (border
) && SCM_REALP (border
), border
,
777 SCM_ARG3
, FUNC_NAME
);
779 /* yes this is legit, we are casing the resulting double to an int */
780 i_width
= (int) (SCM_NUM2DOUBLE (0, width
) * MILS_PER_INCH
);
781 i_height
= (int) (SCM_NUM2DOUBLE (0, height
) * MILS_PER_INCH
);
782 i_border
= (int) (SCM_NUM2DOUBLE (0, border
) * MILS_PER_INCH
);
784 PAPERSIZEtoWORLD(i_width
, i_height
, i_border
,
785 &init_right
, &init_bottom
);
788 printf("%d %d\n", i_width
, i_height
);
789 printf("%d %d\n", init_right
, init_bottom
);
792 default_init_right
= init_right
;
793 default_init_bottom
= init_bottom
;
799 /*! \todo Finish function description!!!
801 * \par Function Description
804 * \return SCM_BOOL_T always.
806 SCM
g_rc_default_series_name(SCM name
)
808 SCM_ASSERT (scm_is_string (name
), name
,
809 SCM_ARG1
, "default-series-name");
811 if (default_series_name
) {
812 g_free(default_series_name
);
815 default_series_name
= g_strdup (SCM_STRING_CHARS (name
));
820 /*! \todo Finish function description!!!
822 * \par Function Description
825 * \return SCM_BOOL_T always.
827 SCM
g_rc_untitled_name(SCM name
)
829 SCM_ASSERT (scm_is_string (name
), name
,
830 SCM_ARG1
, "untitled-name");
832 if (default_untitled_name
) {
833 g_free(default_untitled_name
);
836 default_untitled_name
= g_strdup (SCM_STRING_CHARS (name
));
841 /*! \todo Finish function description!!!
843 * \par Function Description
846 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
848 SCM
g_rc_font_directory(SCM path
)
852 SCM_ASSERT (scm_is_string (path
), path
,
853 SCM_ARG1
, "font-directory");
855 string
= g_strdup (SCM_STRING_CHARS (path
));
856 /* take care of any shell variables */
857 string
= expand_env_variables(string
);
860 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
862 "Invalid path [%s] passed to font-directory\n",
870 if (default_font_directory
) {
871 g_free(default_font_directory
);
873 default_font_directory
= string
;
878 /*! \todo Finish function description!!!
880 * \par Function Description
883 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
885 SCM
g_rc_scheme_directory(SCM path
)
889 SCM_ASSERT (scm_is_string (path
), path
,
890 SCM_ARG1
, "scheme-directory");
892 string
= g_strdup (SCM_STRING_CHARS (path
));
893 /* take care of any shell variables */
894 string
= expand_env_variables(string
);
897 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
899 "Invalid path [%s] passed to scheme-directory\n",
907 if (default_scheme_directory
) {
908 g_free(default_scheme_directory
);
910 default_scheme_directory
= string
;
915 /*! \todo Finish function description!!!
917 * \par Function Description
920 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
922 SCM
g_rc_bitmap_directory(SCM path
)
926 SCM_ASSERT (scm_is_string (path
), path
,
927 SCM_ARG1
, "bitmap-directory");
929 string
= g_strdup (SCM_STRING_CHARS (path
));
930 /* take care of any shell variables */
931 string
= expand_env_variables(string
);
934 if (!g_file_test (string
, G_FILE_TEST_IS_DIR
)) {
936 "Invalid path [%s] passed to bitmap-directory\n",
944 if (default_bitmap_directory
) {
945 g_free(default_bitmap_directory
);
947 default_bitmap_directory
= string
;
952 /*! \todo Finish function description!!!
954 * \par Function Description
956 * \param [in] scmsymname
957 * \return SCM_BOOL_T always.
959 SCM
g_rc_bus_ripper_symname(SCM scmsymname
)
961 SCM_ASSERT (scm_is_string (scmsymname
), scmsymname
,
962 SCM_ARG1
, "bus-ripper-symname");
964 if (default_bus_ripper_symname
) {
965 g_free(default_bus_ripper_symname
);
967 default_bus_ripper_symname
= g_strdup (SCM_STRING_CHARS (scmsymname
));
972 /*! \todo Finish function description!!!
974 * \par Function Description
976 * \param [in] scmsymname
977 * \return SCM_BOOL_T always.
979 SCM
g_rc_postscript_prolog(SCM scmsymname
)
983 SCM_ASSERT (scm_is_string (scmsymname
), scmsymname
,
984 SCM_ARG1
, "postsript-prolog");
986 if (default_postscript_prolog
) {
987 g_free(default_postscript_prolog
);
990 string
= g_strdup (SCM_STRING_CHARS (scmsymname
));
991 /* take care of any shell variables */
992 string
= expand_env_variables(string
);
994 default_postscript_prolog
= g_strdup (string
);
999 /*! \todo Finish function description!!!
1001 * \par Function Description
1003 * \return SCM_BOOL_T always.
1005 SCM
g_rc_reset_component_library(void)
1012 /*! \todo Finish function description!!!
1014 * \par Function Description
1016 * \return SCM_BOOL_T always.
1018 SCM
g_rc_reset_source_library(void)
1026 /*! \todo Finish function description!!!
1028 * \par Function Description
1030 * \param [in] scmcharstr
1031 * \param [in] scmfilename
1032 * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise.
1034 SCM
g_rc_map_font_character_to_file(SCM scmcharstr
, SCM scmfilename
)
1036 gchar
*charstr
, *filename
;
1039 SCM_ASSERT (scm_is_string (scmcharstr
), scmcharstr
,
1040 SCM_ARG1
, "map-font-character-to-file");
1041 SCM_ASSERT (scm_is_string (scmfilename
), scmfilename
,
1042 SCM_ARG2
, "map-font-character-to-file");
1044 charstr
= SCM_STRING_CHARS (scmcharstr
);
1045 filename
= SCM_STRING_CHARS (scmfilename
);
1047 if (charstr
== NULL
|| filename
== NULL
) {
1049 "%s requires two strings as parameters\n",
1050 "map-font-character-to-file"
1055 /* take care of expansion of any shell variables in filename */
1056 filename
= expand_env_variables (g_strdup (filename
));
1058 character
= g_utf8_get_char_validated (charstr
, -1);
1060 /* insert the new character declaration in the hash table */
1061 g_hash_table_insert (font_char_to_file
,
1062 GUINT_TO_POINTER ((guint
)character
),
1068 /*! \todo Finish function documentation!!!
1070 * \par Function Description
1073 SCM
g_rc_attribute_promotion(SCM mode
)
1075 static const vstbl_entry mode_table
[] = {
1076 {TRUE
, "enabled" },
1077 {FALSE
, "disabled"},
1080 RETURN_G_RC_MODE("attribute-promotion",
1081 default_attribute_promotion
,
1085 /*! \todo Finish function documentation!!!
1087 * \par Function Description
1090 SCM
g_rc_promote_invisible(SCM mode
)
1092 static const vstbl_entry mode_table
[] = {
1093 {TRUE
, "enabled" },
1094 {FALSE
, "disabled"},
1097 RETURN_G_RC_MODE("promote-invisible",
1098 default_promote_invisible
,
1102 /*! \todo Finish function documentation!!!
1104 * \par Function Description
1107 SCM
g_rc_keep_invisible(SCM mode
)
1109 static const vstbl_entry mode_table
[] = {
1110 {TRUE
, "enabled" },
1111 {FALSE
, "disabled"},
1114 RETURN_G_RC_MODE("keep-invisible",
1115 default_keep_invisible
,
1119 /*! \todo Finish function description!!!
1121 * \par Function Description
1123 * \param [in] scmsymname
1124 * \return SCM_BOOL_T always.
1126 SCM
g_rc_always_promote_attributes(SCM scmsymname
)
1128 SCM_ASSERT (scm_is_string (scmsymname
), scmsymname
,
1129 SCM_ARG1
, "always-promote-attributes");
1131 if (default_always_promote_attributes
) {
1132 g_free(default_always_promote_attributes
);
1134 default_always_promote_attributes
=
1135 g_strdup_printf(" %s ", SCM_STRING_CHARS (scmsymname
));