/[gcl]/gcl/o/mingwin.c
ViewVC logotype

Diff of /gcl/o/mingwin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by mjthomas, Mon Jul 26 11:35:51 2004 UTC revision 1.14 by mjthomas, Thu Oct 14 07:19:43 2004 UTC
# Line 6  Line 6 
6  #include "errno.h"  #include "errno.h"
7  #include "signal.h"  #include "signal.h"
8  #include "stdlib.h"  #include "stdlib.h"
9    extern void sigint ( int );
10    
11  #ifdef DODEBUG  #ifdef DODEBUG
12  #define dprintf(s,arg) \  #define dprintf(s,arg) \
# Line 85  static struct { Line 86  static struct {
86  static int SocketsEnabled();  static int SocketsEnabled();
87  static void close_winsock();  static void close_winsock();
88  extern void doReverse ( char *s, int n );  extern void doReverse ( char *s, int n );
89    extern void init_shared_memory (void);
90    
91    unsigned int shared_memory_initialised = FALSE;
92    
93    
94    
95    
96  /*  /*
# Line 855  void close_shared_memory() Line 861  void close_shared_memory()
861  }  }
862    
863  void init_shared_memory (void)  void init_shared_memory (void)
864  {  {
865    sprintf(sharedMemory.name,"gcl-%d",getpid());      if ( ! shared_memory_initialised ) {
866    sharedMemory.handle =          sprintf(sharedMemory.name,"gcl-%d",getpid());
867      CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, sharedMemory.length , TEXT (sharedMemory.name));          sharedMemory.handle =
868    if (sharedMemory.handle == NULL)              CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, sharedMemory.length , TEXT (sharedMemory.name));
869      error("CreateFileMapping failed");          if (sharedMemory.handle == NULL)
870     sharedMemory.address =              error("CreateFileMapping failed");
871       MapViewOfFile(sharedMemory.handle, /* Handle to mapping object.  */          sharedMemory.address =
872                     FILE_MAP_WRITE,               /* Read/write permission */              MapViewOfFile(sharedMemory.handle, /* Handle to mapping object.  */
873                     0,                                 /* Max.  object size.  */                             FILE_MAP_WRITE, /* Read/write permission */
874                     0,                                 /* Size of hFile.  */                             0,              /* Max.  object size.  */
875                     0);                                /* Map entire file.  */                             0,              /* Size of hFile.  */
876     if (sharedMemory.address == NULL)                             0);             /* Map entire file.  */
877       { error("MapViewOfFile failed");}          if (sharedMemory.address == NULL)
878     init_signals_pendingPtr();              { error("MapViewOfFile failed");}
879     atexit(close_shared_memory);          init_signals_pendingPtr();
880            atexit(close_shared_memory);
881        }
882  }  }
883    
884  /* The only signal REALLY handled somewhat under mingw is the  /* The only signal REALLY handled somewhat under mingw is the
# Line 939  fix_filename(object pathname, char *file Line 947  fix_filename(object pathname, char *file
947    
948  char *GCLExeName ( void )  char *GCLExeName ( void )
949  {  {
950      static char module_name_buf[PATH_MAX];      static char module_name_buf[128];
951      char *rv = NULL;      char *rv = NULL;
952      module_name_buf[0] = 0;      module_name_buf[0] = 0;
953      DWORD result = GetModuleFileName ( (HMODULE) NULL, (LPTSTR) &module_name_buf, PATH_MAX );      DWORD result = GetModuleFileName ( (HMODULE) NULL, (LPTSTR) &module_name_buf, 128 );
954      if ( result > PATH_MAX ) {      if ( result != 0 ) {
955        fprintf ( stderr,        rv = module_name_buf;
                 "GCLExeName: ERROR: GetModuleFileName returned a path larger than %d characters.\n",  
                 PATH_MAX );  
     } else {  
       if ( result != 0 ) {  
         rv = module_name_buf;  
       }  
956      }      }
957      return ( (char *) rv );      return ( (char *) rv );
958  }  }
959    
960    void WindowsHandlers ( void )
961    {
962        /* SetConsoleCtrlHandler ( (PHANDLER_ROUTINE) sigint, TRUE ); */
963    }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26