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 9871 by zmatsuo, Wed Apr 20 13:02:00 2022 UTC revision 9872 by zmatsuo, Thu Apr 21 13:36:07 2022 UTC
# Line 96  typedef struct { Line 96  typedef struct {
96          LogCode_t log_code;          LogCode_t log_code;
97          BOOL bom;          BOOL bom;
98    
99            BOOL FileLog;
100            BOOL BinLog;
101  } TFileVar_;  } TFileVar_;
102  typedef TFileVar_ *PFileVar_;  typedef TFileVar_ *PFileVar_;
103    
# Line 104  typedef TFileVar_ *PFileVar_; Line 106  typedef TFileVar_ *PFileVar_;
106    
107  static PFileVar LogVar = NULL;  static PFileVar LogVar = NULL;
108    
 static BOOL FileLog = FALSE;  
 static BOOL BinLog = FALSE;  
   
109  static PCHAR cv_LogBuf;  static PCHAR cv_LogBuf;
110  static int cv_LogPtr, cv_LStart, cv_LCount;  static int cv_LogPtr, cv_LStart, cv_LCount;
111  static PCHAR cv_BinBuf;  static PCHAR cv_BinBuf;
# Line 706  static BOOL LogStart(const wchar_t *fnam Line 705  static BOOL LogStart(const wchar_t *fnam
705    
706          if (ts.LogBinary > 0)          if (ts.LogBinary > 0)
707          {          {
708                  BinLog = TRUE;                  fv->BinLog = TRUE;
709                  FileLog = FALSE;                  fv->FileLog = FALSE;
710                  if (! CreateBinBuf())                  if (! CreateBinBuf())
711                  {                  {
712                          return FALSE;                          return FALSE;
713                  }                  }
714          }          }
715          else {          else {
716                  BinLog = FALSE;                  fv->BinLog = FALSE;
717                  FileLog = TRUE;                  fv->FileLog = TRUE;
718                  if (! CreateLogBuf())                  if (! CreateLogBuf())
719                  {                  {
720                          return FALSE;                          return FALSE;
# Line 777  static BOOL LogStart(const wchar_t *fnam Line 776  static BOOL LogStart(const wchar_t *fnam
776                  StartThread(fv);                  StartThread(fv);
777          }          }
778    
779          if (FileLog) {          if (fv->FileLog) {
780                  cv.Log1Byte = LogPut1;                  cv.Log1Byte = LogPut1;
781          }          }
782          if (BinLog) {          if (fv->BinLog) {
783                  cv.Log1Bin = Log1Bin;                  cv.Log1Bin = Log1Bin;
784                  cv.LogBinSkip = LogBinSkip;                  cv.LogBinSkip = LogBinSkip;
785          }          }
# Line 819  void FLogOutputAllBuffer(void) Line 818  void FLogOutputAllBuffer(void)
818   */   */
819  void LogPut1(BYTE b)  void LogPut1(BYTE b)
820  {  {
821            PFileVar fv = LogVar;
822    
823          cv_LogBuf[cv_LogPtr] = b;          cv_LogBuf[cv_LogPtr] = b;
824          cv_LogPtr++;          cv_LogPtr++;
825          if (cv_LogPtr>=InBuffSize)          if (cv_LogPtr>=InBuffSize)
826                  cv_LogPtr = cv_LogPtr-InBuffSize;                  cv_LogPtr = cv_LogPtr-InBuffSize;
827    
828          if (FileLog)          if (fv->FileLog)
829          {          {
830                  if (cv_LCount>=InBuffSize)                  if (cv_LCount>=InBuffSize)
831                  {                  {
# Line 972  static wchar_t *TimeStampStr() Line 973  static wchar_t *TimeStampStr()
973   */   */
974  static void LogToFile(void)  static void LogToFile(void)
975  {  {
976            PFileVar fv = LogVar;
977          PCHAR Buf;          PCHAR Buf;
978          int Start, Count;          int Start, Count;
979          BYTE b;          BYTE b;
980    
981          if (FileLog)          if (fv->FileLog)
982          {          {
983                  Buf = cv_LogBuf;                  Buf = cv_LogBuf;
984                  Start = cv_LStart;                  Start = cv_LStart;
985                  Count = cv_LCount;                  Count = cv_LCount;
986          }          }
987          else if (BinLog)          else if (fv->BinLog)
988          {          {
989                  Buf = cv_BinBuf;                  Buf = cv_BinBuf;
990                  Start = cv_BStart;                  Start = cv_BStart;
# Line 1030  static void LogToFile(void) Line 1032  static void LogToFile(void)
1032    
1033          logfile_unlock();          logfile_unlock();
1034    
1035          if (FileLog)          if (fv->FileLog)
1036          {          {
1037                  cv_LStart = Start;                  cv_LStart = Start;
1038                  cv_LCount = Count;                  cv_LCount = Count;
# Line 1094  static void FileTransEnd_(void) Line 1096  static void FileTransEnd_(void)
1096          if (LogVar == NULL) {          if (LogVar == NULL) {
1097                  return;                  return;
1098          }          }
1099          FileLog = FALSE;          PFileVar fv = LogVar;
1100          BinLog = FALSE;          fv->FileLog = FALSE;
1101            fv->BinLog = FALSE;
1102          cv.Log1Byte = NULL;          cv.Log1Byte = NULL;
1103          cv.Log1Bin = NULL;          cv.Log1Bin = NULL;
1104          cv.LogBinSkip = NULL;          cv.LogBinSkip = NULL;
# Line 1243  BOOL FLogOpen(const wchar_t *fname, LogC Line 1246  BOOL FLogOpen(const wchar_t *fname, LogC
1246          if (LogVar != NULL) {          if (LogVar != NULL) {
1247                  return FALSE;                  return FALSE;
1248          }          }
         if ((FileLog) || (BinLog)) return FALSE;  
1249    
1250          //          //
1251          PFileVar fv = (PFileVar)malloc(sizeof(TFileVar));          PFileVar fv = (PFileVar)malloc(sizeof(TFileVar));
# Line 1273  BOOL FLogIsOpend(void) Line 1275  BOOL FLogIsOpend(void)
1275    
1276  BOOL FLogIsOpendText(void)  BOOL FLogIsOpendText(void)
1277  {  {
1278          return LogVar != NULL && FileLog;          return LogVar != NULL && LogVar->FileLog;
1279  }  }
1280    
1281  BOOL FLogIsOpendBin(void)  BOOL FLogIsOpendBin(void)
1282  {  {
1283          return LogVar != NULL && BinLog;          return LogVar != NULL && LogVar->BinLog;
1284  }  }
1285    
1286  void FLogWriteStr(const wchar_t *str)  void FLogWriteStr(const wchar_t *str)
# Line 1450  static void LogBinSkip(int add) Line 1452  static void LogBinSkip(int add)
1452   */   */
1453  int FLogGetCount(void)  int FLogGetCount(void)
1454  {  {
1455          if (FileLog) {          PFileVar fv = LogVar;
1456            if (fv == NULL) {
1457                    return 0;
1458            }
1459            if (fv->FileLog) {
1460                  return cv_LCount;                  return cv_LCount;
1461          }          }
1462          if (BinLog) {          if (fv->BinLog) {
1463                  return cv_BCount;                  return cv_BCount;
1464          }          }
1465          return 0;          return 0;
# Line 1464  int FLogGetCount(void) Line 1470  int FLogGetCount(void)
1470   */   */
1471  int FLogGetFreeCount(void)  int FLogGetFreeCount(void)
1472  {  {
1473          if (FileLog) {          PFileVar fv = LogVar;
1474            if (fv == NULL) {
1475                    return 0;
1476            }
1477            if (fv->FileLog) {
1478                  return InBuffSize - cv_LCount;                  return InBuffSize - cv_LCount;
1479          }          }
1480          if (BinLog) {          if (fv->BinLog) {
1481                  return InBuffSize - cv_BCount;                  return InBuffSize - cv_BCount;
1482          }          }
1483          return 0;          return 0;
# Line 1478  int FLogGetFreeCount(void) Line 1488  int FLogGetFreeCount(void)
1488   */   */
1489  void FLogWriteFile(void)  void FLogWriteFile(void)
1490  {  {
1491            PFileVar fv = LogVar;
1492            if (fv == NULL) {
1493                    return;
1494            }
1495          if (cv_LogBuf!=NULL)          if (cv_LogBuf!=NULL)
1496          {          {
1497                  if (FileLog) {                  if (fv->FileLog) {
1498                          LogToFile();                          LogToFile();
1499                  }                  }
1500          }          }
1501    
1502          if (cv_BinBuf!=NULL)          if (cv_BinBuf!=NULL)
1503          {          {
1504                  if (BinLog) {                  if (fv->BinLog) {
1505                          LogToFile();                          LogToFile();
1506                  }                  }
1507          }          }

Legend:
Removed from v.9871  
changed lines
  Added in v.9872

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