[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_funcs.c
User: cnieves
Date: 07/04/21 05:24:03
Modified: . g_funcs.c g_register.c
Log:
Apply patch from Peter Brett, adding the gschem-browse-wiki Scheme function.
* include/prototype.h, src/g_funcs.h, src/g_register.c:
Apply patch from Peter Brett, adding the gschem-browse-wiki
Scheme function. Thanks!
This function allows Scheme code to open a browser to a wiki page by
calling gschemdoc with its -w option.
This will facilitate adding more useful things to gschem's "Help"menu
without needing a large number of callbacks to be added to gschem.
Revision Changes Path
1.23 +56 -0 eda/geda/gaf/gschem/src/g_funcs.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_funcs.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_funcs.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- g_funcs.c 24 Feb 2007 11:47:33 -0000 1.22
+++ g_funcs.c 21 Apr 2007 09:24:02 -0000 1.23
@@ -308,3 +308,59 @@
return(return_value);
}
+
+/*! \brief Use gschemdoc to open a browser to a specific wiki page
+ *
+ * \param [in] wikiname the name of the wiki page
+ *
+ * \par Function Description
+ * Invokes gschemdoc with its -w switch to open a browser to the wiki
+ * page specified by wikiname. If wikiname is empty or not a string,
+ * will browse to the main wiki page.
+ */
+SCM g_funcs_browse_wiki(SCM wikiname)
+{
+ char *wikistr;
+ int pid;
+
+ /* Extract wiki name string from Scheme value structure.
+ * If not a string, use the empty string */
+ if (SCM_STRINGP (wikiname)) {
+ wikistr = SCM_STRING_CHARS(wikiname);
+ } else {
+ wikistr = "";
+ }
+
+ #ifndef __MINGW32__
+
+ pid = fork();
+
+ if (pid < 0) {
+ /* Fork failed. Still in parent process, so can use the log
+ * window */
+ s_log_message(_("Could not fork\n"));
+ return SCM_BOOL_F;
+ } else if (pid > 0) {
+ /* Parent process, we're finished here */
+ return SCM_BOOL_T;
+ }
+
+ /* begin daughter process stuff */
+
+ /* assume gschemdoc is part of path */
+ char *gschemdoc = "gschemdoc";
+ char *wikiarg = "-w";
+
+ execlp(gschemdoc, gschemdoc, wikiarg, wikistr, NULL);
+
+ /* if we return, then nothing happened */
+ fprintf(stderr, _("Could not invoke %s\n"), gschemdoc);
+ _exit(0);
+
+ /* end daughter process stuff */
+
+#else /* __MINGW32__ */
+ s_log_message(_("Documentation commands not supported under MinGW.\n"));
+ return SCM_BOOL_F;
+#endif /* __MINGW32__ */
+}
1.55 +1 -0 eda/geda/gaf/gschem/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/gschem/src/g_register.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- g_register.c 17 Apr 2007 20:19:16 -0000 1.54
+++ g_register.c 21 Apr 2007 09:24:02 -0000 1.55
@@ -167,6 +167,7 @@
{ "gschem-msg", 1, 0, 0, g_funcs_msg },
{ "gschem-confirm", 1, 0, 0, g_funcs_confirm },
{ "gschem-filesel", 2, 0, 1, g_funcs_filesel },
+ { "gschem-browse-wiki", 0, 1, 0, g_funcs_browse_wiki },
/* keymapping callbacks */
{ "file-new-window", 0, 0, 0, g_keys_file_new_window },
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs