"Ruurd A Reitsma" <[EMAIL PROTECTED]> writes:

| At this momemt, lyx compiles almost out of the box on win32 using the cygwin
| environement, except for one little detail:
| 
| --- lyxserver.C       Wed Oct 11 20:47:48 2000
| +++ lyx-devel/src/lyxserver.C Wed Oct 11 13:51:18 2000
| @@ -72,7 +72,7 @@
|  // provide an empty mkfifo() if we do not have one. This disables the
|  // lyxserver.
|  #ifndef HAVE_MKFIFO
| -int  mkfifo( char *__path, mode_t __mode ) {
| +int  mkfifo(const char *__path, mode_t __mode ) {
|       return 0;
|  }
|  #endif

I'll add this.

| Which seems to be more compliant with the lyxstring class...(?)
| 
| I've made a small patch to get lyx to set some environement vars by itself,
| i.e. reading them from the windows registry. This enables lyx to stand on
| it's own, not using any shell scripts to start. Linking with the
| 
| -mwindows -e _mainCRTStartup

Hmm, you chould be able to do this with CXXFLAGS?
Actualy there should be no problem for us to add this to configure.
Is this always wanted? Or are there situations were you want the
console?

| flags gets rid of the console window. I would be usefull to add an autoconf
| option to do this, but I actually don't know how to do this.
| Besides that, there are probably a few more patches needed to get the whole
| thing to work under win32. Claus, could you post the changes you've made? I
| wasn't able to find them on the list/source/your homepage.
| 
| --Ruurd

--- main.C      Wed Oct 11 17:46:57 2000
+++ lyx-devel/src/main.C        Wed Oct 11 19:11:52 2000
@@ -16,6 +16,12 @@
 #include "support/filetools.h"
 #include "frontends/GUIRunTime.h"
 
+#ifdef __CYGWIN__
+#include <stdio.h>
+#include <windows.h>
+#include <io.h>
+#endif
+

I can ensure you that we don't want this one :-)
 
 int main(int argc, char * argv[])
 {
@@ -35,6 +41,44 @@
 
 #ifdef __EMX__
        _wildcard(&argc, &argv);
+#endif
+
+#ifdef __CYGWIN__
+
+static char display[100];
+static char home[100];
+static char value[100];
+HKEY reg_key = NULL;
+DWORD type;
+DWORD nbytes = sizeof (value);
+
+if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Lyx", 0,
+                   KEY_QUERY_VALUE, &reg_key) != ERROR_SUCCESS
+      || RegQueryValueEx (reg_key, "DISPLAY", 0,
+                         &type, (BYTE *) value, &nbytes) != ERROR_SUCCESS
+      || type != REG_SZ)
+    {
+      /* Use the default value */
+      sprintf (value, "localhost:0.0");
+    }
+
+sprintf(display,"DISPLAY=%s",value);
+PutEnv(display);
+   
+if (RegQueryValueEx (reg_key, "HOME", 0,
+                         &type, (BYTE *) value, &nbytes) != ERROR_SUCCESS
+      || type != REG_SZ)
+    {
+      /* Use the default value */
+      sprintf (value, "//c");
+    }
+
+if (reg_key != NULL)
+    RegCloseKey (reg_key);
+
+sprintf(home,"HOME=%s",value);
+PutEnv(home);
+

All this should be moved to some support file, that only gets
included/built when we are compiling on a __CYGWIN__ environment.

I guess we could add a src/os/ directory similar to src/frontends to
take care of things like this.

from int main(...) we can then just call something like:

os::init(...)

This should also work for the OS2 _wildcard stuff.

If we have other cases like this other places in the code we can add
more functions to os::

        Lgb

Reply via email to