Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/filesys_log.cpp

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

revision 8899 by zmatsuo, Tue Aug 18 15:29:19 2020 UTC revision 8900 by zmatsuo, Tue Aug 18 15:29:32 2020 UTC
# Line 28  Line 28 
28    
29  /* TERATERM.EXE, log routines */  /* TERATERM.EXE, log routines */
30  #include <stdio.h>  #include <stdio.h>
31  #include <io.h>  #if !defined(_CRTDBG_MAP_ALLOC)
32    #define _CRTDBG_MAP_ALLOC
33    #endif
34    #include <stdlib.h>
35    #include <crtdbg.h>
36  #include <process.h>  #include <process.h>
37  #include <windows.h>  #include <windows.h>
38  #include <htmlhelp.h>  #include <htmlhelp.h>
# Line 53  Line 57 
57  #include "asprintf.h"  #include "asprintf.h"
58    
59  #include "filesys_log_res.h"  #include "filesys_log_res.h"
60  #include "filesys.h"  #include "filesys_log.h"
61    
62  typedef struct {  typedef struct {
63    wchar_t *FullName;    wchar_t *FullName;
# Line 62  typedef struct { Line 66  typedef struct {
66    BOOL FileOpen;    BOOL FileOpen;
67    HANDLE FileHandle;    HANDLE FileHandle;
68    LONG FileSize, ByteCount;    LONG FileSize, ByteCount;
   BOOL OverWrite;  
69    
70    DWORD StartTime;    DWORD StartTime;
71    
# Line 74  typedef struct { Line 77  typedef struct {
77    HANDLE LogThread;    HANDLE LogThread;
78    DWORD LogThreadId;    DWORD LogThreadId;
79    HANDLE LogThreadEvent;    HANDLE LogThreadEvent;
80    
81      BOOL IsPause;
82  } TFileVar_;  } TFileVar_;
83  typedef TFileVar_ *PFileVar_;  typedef TFileVar_ *PFileVar_;
84    
# Line 82  typedef TFileVar_ *PFileVar_; Line 87  typedef TFileVar_ *PFileVar_;
87    
88  static PFileVar LogVar = NULL;  static PFileVar LogVar = NULL;
89    
90  BOOL FileLog = FALSE;  static BOOL FileLog = FALSE;
91  BOOL BinLog = FALSE;  static BOOL BinLog = FALSE;
92    
93  /*  /*
94     Line Head flag for timestamping     Line Head flag for timestamping
# Line 644  static BOOL LogStart(const wchar_t *fnam Line 649  static BOOL LogStart(const wchar_t *fnam
649    
650          LogVar->FullName = _wcsdup(fname);          LogVar->FullName = _wcsdup(fname);
651    
         if (! LoadTTFILE()) return FALSE;  
   
652          PFileVar fv = LogVar;          PFileVar fv = LogVar;
653          wchar_t *p = wcsrchr(fv->FullName, L'\\');          wchar_t *p = wcsrchr(fv->FullName, L'\\');
654          if (p == NULL) {          if (p == NULL) {
# Line 736  static BOOL LogStart(const wchar_t *fnam Line 739  static BOOL LogStart(const wchar_t *fnam
739                  return FALSE;                  return FALSE;
740          }          }
741    
742          cv.FilePause &= ~OpLog;          LogVar->IsPause = FALSE;
743          LogVar->StartTime = GetTickCount();          LogVar->StartTime = GetTickCount();
744    
745          // 遅延書き込み用スレッドを起こす。          // 遅延書き込み用スレッドを起こす。
# Line 1183  static void FreeBinBuf(void) Line 1186  static void FreeBinBuf(void)
1186    
1187  static void FileTransEnd_(void)  static void FileTransEnd_(void)
1188  {  {
1189            if (LogVar == NULL) {
1190                    return;
1191            }
1192          FileLog = FALSE;          FileLog = FALSE;
1193          BinLog = FALSE;          BinLog = FALSE;
1194          cv.Log1Byte = NULL;          cv.Log1Byte = NULL;
# Line 1193  static void FileTransEnd_(void) Line 1199  static void FileTransEnd_(void)
1199                  FLogDlg->DestroyWindow();                  FLogDlg->DestroyWindow();
1200                  FLogDlg = NULL;                  FLogDlg = NULL;
1201          }          }
1202          if (LogVar != NULL)          CloseFileSync(LogVar);
         {  
                 CloseFileSync(LogVar);  
                 free(LogVar->FullName);  
                 free(LogVar->FileName);  
                 free(LogVar);  
                 LogVar = NULL;  
         }  
1203          FreeLogBuf();          FreeLogBuf();
1204          FreeBinBuf();          FreeBinBuf();
1205          FreeTTFILE();          free(LogVar);
1206            LogVar = NULL;
1207  }  }
1208    
   
1209  /**  /**
1210   *      ログをポーズする   *      ログをポーズする
  *      元は FLogChangeButton() だった  
1211   */   */
1212  void FLogPause(BOOL Pause)  void FLogPause(BOOL Pause)
1213  {  {
1214          if (LogVar == NULL) {          if (LogVar == NULL) {
1215                  return;                  return;
1216          }          }
1217          if (FLogDlg!=NULL)          LogVar->IsPause = Pause;
1218                  FLogDlg->ChangeButton(Pause);          FLogDlg->ChangeButton(Pause);
         FileTransPause(OpLog, Pause);  
1219  }  }
1220    
1221  /**  /**
# Line 1344  BOOL FLogOpen(const wchar_t *fname) Line 1341  BOOL FLogOpen(const wchar_t *fname)
1341          memset(fv, 0, sizeof(TFileVar));          memset(fv, 0, sizeof(TFileVar));
1342    
1343          fv->FileOpen = FALSE;          fv->FileOpen = FALSE;
         fv->OverWrite = ((ts.FTFlag & FT_RENAME) == 0);  
1344    
1345          ret = LogStart(fname);          ret = LogStart(fname);
1346          return ret;          return ret;
# Line 1473  wchar_t *FLogGetLogFilename(const wchar_ Line 1469  wchar_t *FLogGetLogFilename(const wchar_
1469    
1470  BOOL FLogIsPause()  BOOL FLogIsPause()
1471  {  {
1472          return ((cv.FilePause & OpLog) !=0);          if (LogVar == NULL) {
1473                    return FALSE;
1474            }
1475            return LogVar->IsPause;
1476  }  }
1477    
1478  void FLogWindow(int nCmdShow)  void FLogWindow(int nCmdShow)
1479  {  {
1480            if (LogVar == NULL) {
1481                    return;
1482            }
1483          if (FLogDlg == NULL)          if (FLogDlg == NULL)
1484                  return;                  return;
1485    
# Line 1491  void FLogWindow(int nCmdShow) Line 1493  void FLogWindow(int nCmdShow)
1493    
1494  void FLogShowDlg(void)  void FLogShowDlg(void)
1495  {  {
1496            if (LogVar == NULL) {
1497                    return;
1498            }
1499          if (FLogDlg != NULL) {          if (FLogDlg != NULL) {
1500                  FLogDlg->ShowWindow(SW_SHOWNORMAL);                  FLogDlg->ShowWindow(SW_SHOWNORMAL);
1501                  SetForegroundWindow(FLogDlg->GetSafeHwnd());                  SetForegroundWindow(FLogDlg->GetSafeHwnd());
# Line 1504  void FLogShowDlg(void) Line 1509  void FLogShowDlg(void)
1509  //void Log1Bin(PComVar cv, BYTE b)  //void Log1Bin(PComVar cv, BYTE b)
1510  static void Log1Bin(BYTE b)  static void Log1Bin(BYTE b)
1511  {  {
1512          if (((cv.FilePause & OpLog)!=0) || cv.ProtoFlag) {          if (LogVar->IsPause || cv.ProtoFlag) {
1513                  return;                  return;
1514          }          }
1515          if (cv.BinSkip > 0) {          if (cv.BinSkip > 0) {

Legend:
Removed from v.8899  
changed lines
  Added in v.8900

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26