[BACK]Return to io.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / windows / asir32gui

Diff for /OpenXM_contrib2/windows/asir32gui/io.c between version 1.4 and 1.11

version 1.4, 2005/10/19 06:22:59 version 1.11, 2018/09/08 02:06:08
Line 11 
Line 11 
 #define ASIR_KEYNAME "SoftWare\\Fujitsu\\Asir\\1999.03.31"  #define ASIR_KEYNAME "SoftWare\\Fujitsu\\Asir\\1999.03.31"
   
 #define MAXHIST 256  #define MAXHIST 256
 #define HISTORY "history"  #define HISTORY "asirgui_history"
   
 static int use_current_dir;  static int use_current_dir;
   
Line 38  char *errmsg;
Line 38  char *errmsg;
         LONG    ret;          LONG    ret;
         HKEY    hOpenKey;          HKEY    hOpenKey;
         DWORD   Type,dw;          DWORD   Type,dw;
         char    dir[BUFSIZ],message[BUFSIZ];          char    dir[BUFSIZ],message[BUFSIZ],engine[BUFSIZ];
         char    *slash;          char    *slash;
         int             ldir;          size_t  ldir;
         static  char rootdir[BUFSIZ];          static  char rootdir[BUFSIZ];
         static  int rootdir_is_initialized;          static  int rootdir_is_initialized;
   
Line 49  char *errmsg;
Line 49  char *errmsg;
                 return TRUE;                  return TRUE;
         }          }
   
       if(GetModuleFileName(NULL,dir,BUFSIZ)) {
           slash = strrchr(dir,'\\');
           *slash = 0;
           sprintf(engine,"%s\\engine.exe", dir);
           if ( access(engine,0) >= 0 ) {
               slash = strrchr(dir,'\\');
               if ( slash ) {
                   *slash = 0;
               }
               use_current_dir = 1;
               strcpy(rootdir,dir);
               strcpy(name,dir);
               rootdir_is_initialized = 1;
               return TRUE;
           }
       }
         GetCurrentDirectory(BUFSIZ,dir);          GetCurrentDirectory(BUFSIZ,dir);
         slash = strrchr(dir,'\\');          slash = strrchr(dir,'\\');
         if ( slash )          if ( slash )
Line 86  char *errmsg;
Line 102  char *errmsg;
                                 NULL);                                  NULL);
                         return FALSE;                          return FALSE;
                 }                  }
                 if ( ret = RegSetValueEx(hOpenKey,"Directory",NULL,REG_SZ,dir,ldir) ) {                  if ( ret = RegSetValueEx(hOpenKey,"Directory",0,REG_SZ,dir,ldir) ) {
                         FormatMessage(                          FormatMessage(
                                 FORMAT_MESSAGE_FROM_SYSTEM |                                  FORMAT_MESSAGE_FROM_SYSTEM |
                                 FORMAT_MESSAGE_IGNORE_INSERTS,                                  FORMAT_MESSAGE_IGNORE_INSERTS,
Line 106  char *errmsg;
Line 122  char *errmsg;
         return TRUE;          return TRUE;
 }  }
   
   const char *get_helpdir() {
       static char helpdir[BUFSIZ];
       static int helpdir_is_initialized;
       char lang[BUFSIZ];
       char file[BUFSIZ];
       char root[BUFSIZ];
       char errmsg[BUFSIZ];
   
       if( !helpdir_is_initialized ) {
           get_rootdir(root,sizeof(root),errmsg);
           GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SISO639LANGNAME, lang, BUFSIZ);
           sprintf(helpdir, "%s\\help\\%s", root, lang);
           sprintf(file, "%s\\asirhelp.chm", helpdir);
           if ( access(file,0) < 0 ) {
               sprintf(helpdir, "%s\\help", root);
           }
           helpdir_is_initialized = 1;
       }
       return helpdir;
   }
   
 BOOL Init_IO(char *errmsg) {  BOOL Init_IO(char *errmsg) {
         int i;          int i;
         char *av[BUFSIZ];          char *av[BUFSIZ];
Line 117  BOOL Init_IO(char *errmsg) {
Line 154  BOOL Init_IO(char *errmsg) {
         char notify[100],notify_ack[100],intr[100],intr_ack[100],kill[100];          char notify[100],notify_ack[100],intr[100],intr_ack[100],kill[100];
         char name[BUFSIZ],qname[BUFSIZ],home[BUFSIZ];          char name[BUFSIZ],qname[BUFSIZ],home[BUFSIZ];
   
   #if _MSC_VER < 1900
         _setargv();          _setargv();
   #endif
         if ( !strcmp(__argv[0],"debuggui") ) {          if ( !strcmp(__argv[0],"debuggui") ) {
                 asirgui_kind = ASIRGUI_DEBUG;                  asirgui_kind = ASIRGUI_DEBUG;
                 hRead = atoi(__argv[1]);                  hRead = atoi(__argv[1]);
Line 165  BOOL Init_IO(char *errmsg) {
Line 204  BOOL Init_IO(char *errmsg) {
                         return FALSE;                          return FALSE;
                 }                  }
                 sprintf(AsirExe,"%s\\bin\\engine.exe",name);                  sprintf(AsirExe,"%s\\bin\\engine.exe",name);
 //              sprintf(AsirExe,"c:\\home\\noro\\engine2000\\debug\\engine.exe");  //              sprintf(AsirExe,"d:\\cygwin\\home\\noro\\new\\OpenXM_contrib2\\windows\\engine2000\\debug\\engine.exe");
                 if ( !getenv("HOME") ) {                  if ( !getenv("HOME") ) {
                         sprintf(home,"HOME=%s",name);                          sprintf(home,"HOME=%s",name);
                         _putenv(home);                          _putenv(home);
Line 259  void read_and_insert()
Line 298  void read_and_insert()
         }          }
 }  }
   
   static char history_path[BUFSIZ];
   static char history_errmsg[BUFSIZ];
   
 void init_input_history()  void init_input_history()
 {  {
           char rootdir[BUFSIZ];
           char *env = getenv("TEMP");
           if( env ) {
                   sprintf(history_path,"%s\\%s",env,HISTORY);
           }else {
                   get_rootdir(rootdir,sizeof(rootdir),history_errmsg);
                   sprintf(history_path,"%s\\bin\\%s",rootdir,HISTORY);
           }
         init_hist(MAXHIST);          init_hist(MAXHIST);
 }  }
   
 void write_input_history()  void write_input_history()
 {  {
         write_hist(HISTORY);          write_hist(history_path);
 }  }
   
 void read_input_history()  void read_input_history()
 {  {
         read_hist(HISTORY);          read_hist(history_path);
 }  }
   
 void send_intr() {  void send_intr() {
           HANDLE handle[1];
   
         PulseEvent(hIntr);          PulseEvent(hIntr);
           handle[0] = hIntr_Ack;
           WaitForMultipleObjects(1,(CONST HANDLE *)handle,FALSE,(DWORD)-1);
 }  }
   
 void terminate_asir() {  void terminate_asir() {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.11

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>