Subject: Another Patch to FvwmM4/Cpp

From: Olivier Chapuis <[email-masked]>
Date: Mon, 04 Oct 1999 21:52:30 +0200

Hello,

In the patches attached to this message (one for FvwmM4 and FvwmCpp
(things are perfectly symetric) and one for the ChangeLog since it 
will be out of date when the patch will be applied ... if it is applied).

These patches add two new options -noread and -lock to FvwmM4/Cpp.

-noread causes FvwmM4/Cpp to do not says to fvwm to Read the
preprocessed file. This is useful for using FvwmM4/Cpp for preprocess 
script for FvwmScript.

-lock have some effects only if you start FvwmM4/Cpp with 
ModuleSynchronous. This option causes fvwm to wait that the pre-process
finish and that FvwmM4 ask fvwm to Read the pre-processed file before 
continuing. This may be useful at startup if you use a
session manager as Gnome. Also, this is useful if you want to process
and run a Form in a fvwm function. For example a function like

AddToFunc M4AndRunForm \
I ModuleSynchronous FvwmM4 -lock $0
+ I FvwmForm $1

will work as expected (i.e., "M4AndRunForm afile AForm" will pre-process
the file afile (with a macro configuration of AForm) and run the Form AForm
which have been just Read by fvwm) 
 
To obtain such a result I have use the SendFinishedStartupNotification
function: if the -lock option is used, this function is used only after
FvwmM4/Cpp ask fvwm to read the preprocessed file.

Patches Description:

	modules        : ChangeLog
	modules/FvwmCpp: FvwmCpp.c FvwmCpp.1
        modules/FvwmM4 : FvwmM4.c FvwmM4.1

Olivier

Index: modules/FvwmCpp/FvwmCpp.1
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmCpp/FvwmCpp.1,v
retrieving revision 1.11
diff -u -b -B -u -r1.11 FvwmCpp.1
--- modules/FvwmCpp/FvwmCpp.1	1999/09/28 13:43:16	1.11
+++ modules/FvwmCpp/FvwmCpp.1	1999/10/04 19:53:32
@@ -57,7 +57,18 @@
 Causes the temporary file create by Cpp to
 be retained. This file is usually called "/tmp/fvwmrcXXXXXX"
 
+.IP -lock
+If you want to use this option you need to start FvwmCpp with 
+ModuleSynchronous. This option causes fvwm to wait that the pre-process
+finish and that FvwmCpp asks fvwm to Read the pre-processed file before 
+continuing. This may be useful at startup if you use a session manager 
+as Gnome. Also, this is useful if you want to process and run a Form in 
+a fvwm function.
 
+.IP -noread
+Causes the pre-processed file to be not read by fvwm. Useful to
+pre-process a FvwmScript script with FvwmCpp.
+
 .SH CONFIGURATION OPTIONS
 FvwmCpp defines some values for use in the pre-processor file:
 
@@ -83,6 +94,8 @@
 The X server vendor.
 .IP RELEASE
 The X server release number.
+.IP SCREEN
+The screen number.
 .IP WIDTH
 The screen width in pixels.
 .IP HEIGHT
@@ -130,6 +143,7 @@
 #define REVISION 0
 #define VENDOR HDS human designed systems, inc. (2.1.2-D)
 #define RELEASE 4
+#define SCREEN 0
 #define WIDTH 1280
 #define HEIGHT 1024
 #define X_RESOLUTION 3938
Index: modules/FvwmCpp/FvwmCpp.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmCpp/FvwmCpp.c,v
retrieving revision 1.22
diff -u -b -B -u -r1.22 FvwmCpp.c
--- modules/FvwmCpp/FvwmCpp.c	1999/09/28 13:43:16	1.22
+++ modules/FvwmCpp/FvwmCpp.c	1999/10/04 19:53:36
@@ -84,7 +84,7 @@
   char *display_name = NULL;
   char *filename = NULL;
   char *tmp_file, read_string[80],delete_string[80];
-  int i,cpp_debug = 0;
+  int i,cpp_debug,lock,noread = 0;
 
   strcpy(cpp_options,"");
 
@@ -133,6 +133,14 @@
 	{
 	  cpp_debug = 1;
 	}
+      else if(strcasecmp(argv[i], "-lock") == 0)
+	{
+	  lock = 1;
+	}
+      else if(strcasecmp(argv[i], "-noread") == 0)
+	{
+	  noread = 1;
+	}
       else if (strncasecmp(argv[i],"-",1) == 0)
       {
         /* pass on any other arguments starting with '-' to cpp */
@@ -165,13 +173,21 @@
   /* set up G */
   InitPictureCMap(dpy);
 
-  /* tell fvwm we're running */
+  /* tell fvwm we're running if -lock is not used */
+  if (!lock)
   SendFinishedStartupNotification(fd);
 
   tmp_file = cpp_defs(dpy, display_name,cpp_options, filename);
 
+  if (!noread)
+    {
   sprintf(read_string,"read %s\n",tmp_file);
   SendInfo(fd,read_string,0);
+    }
+
+  /* tell fvwm to continue if -lock is used */
+  if (lock)
+    SendFinishedStartupNotification(fd);
 
   /* For a debugging version, we may wish to omit this part. */
   /* I'll let some cpp advocates clean this up */
Index: modules/FvwmM4/FvwmM4.1
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmM4/FvwmM4.1,v
retrieving revision 1.7
diff -u -b -B -u -r1.7 FvwmM4.1
--- modules/FvwmM4/FvwmM4.1	1999/09/28 13:43:16	1.7
+++ modules/FvwmM4/FvwmM4.1	1999/10/04 19:53:38
@@ -75,7 +75,19 @@
 Causes the temporary file create by m4 to
 be retained. This file is usually called "/tmp/fvwmrcXXXXXX"
 
+.IP -lock
+If you want to use this option you need to start FvwmM4 with 
+ModuleSynchronous. This option causes fvwm to wait that the pre-process
+finish and that FvwmM4 asks fvwm to Read the pre-processed file before 
+continuing. This may be useful at startup if you use a session manager 
+as Gnome. Also, this is useful if you want to process and run a Form in 
+a fvwm function.
 
+.IP -noread
+Causes the pre-processed file to be not read by fvwm. Useful to
+pre-process a FvwmScript script with FvwmM4.
+
+
 .SH CONFIGURATION OPTIONS
 FvwmM4 defines some values for use in the pre-processor file:
 
@@ -101,6 +113,8 @@
 The X server vendor.
 .IP RELEASE
 The X server release number.
+.IP SCREEN
+The screen number.
 .IP WIDTH
 The screen width in pixels.
 .IP HEIGHT
@@ -148,6 +162,7 @@
 define(REVISION,``0'')dnl
 define(VENDOR,``HDS human designed systems, inc. (2.1.2-D)'')dnl
 define(RELEASE,``4'')dnl
+define(SCREEN,``0'')dnl
 define(WIDTH,``1280'')dnl
 define(HEIGHT,``1024'')dnl
 define(X_RESOLUTION,``3938'')dnl
Index: modules/FvwmM4/FvwmM4.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmM4/FvwmM4.c,v
retrieving revision 1.20
diff -u -b -B -u -r1.20 FvwmM4.c
--- modules/FvwmM4/FvwmM4.c	1999/09/28 13:43:17	1.20
+++ modules/FvwmM4/FvwmM4.c	1999/10/04 19:53:39
@@ -88,7 +88,7 @@
   char *display_name = NULL;
   char *filename = NULL;
   char *tmp_file, read_string[80],delete_string[80];
-  int i,m4_debug = 0;
+  int i,m4_debug,lock,noread = 0;
 
   m4_enable = True;
   m4_prefix = False;
@@ -154,6 +154,14 @@
 	{
 	  m4_debug = 1;
 	}
+      else if(strcasecmp(argv[i], "-lock") == 0)
+	{
+	  lock = 1;
+	}
+      else if(strcasecmp(argv[i], "-noread") == 0)
+	{
+	  noread = 1;
+	}
       else if (strncasecmp(argv[i],"-",1) == 0)
 	{
 	  /* pass on any other arguments starting with '-' to m4 */
@@ -180,13 +188,21 @@
   /* set up G */
   InitPictureCMap(dpy);
 
-  /* tell fvwm we're running */
+  /* tell fvwm we're running if -lock is not used */
+  if (!lock)
   SendFinishedStartupNotification(fd);
 
   tmp_file = m4_defs(dpy, display_name,m4_options, filename);
 
+  if (!noread)
+    {
   sprintf(read_string,"read %s\n",tmp_file);
   SendInfo(fd,read_string,0);
+    }
+
+  /* tell fvwm to continue if -lock is used */
+  if (lock)
+    SendFinishedStartupNotification(fd);
 
   /* For a debugging version, we may wish to omit this part. */
   /* I'll let some m4 advocates clean this up */
Index: modules/ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/ChangeLog,v
retrieving revision 1.319
diff -u -b -B -u -r1.319 ChangeLog
--- modules/ChangeLog	1999/10/03 19:23:43	1.319
+++ modules/ChangeLog	1999/10/04 19:53:31
@@ -1,3 +1,10 @@
+1999-10-04 Olivier Chapuis <[email-masked]>
+	* FvwmCpp/FvwmCpp.c (main):
+	* FvwmCpp/FvwmCpp.1:
+	* FvwmM4/FvwmM4.c (main):
+	* FvwmM4/FvwmM4.1:
+	New options -noread and -lock
+
 1999-10-03  Dominik Vogt  <[email-masked]>
 
 	* FvwmTheme/FvwmTheme.1: add description of colour set command line