mirror of
https://github.com/n5ac/mmtty.git
synced 2025-12-06 04:12:03 +01:00
288 lines
7.7 KiB
C
288 lines
7.7 KiB
C
|
|
//Copyright+LGPL
|
|||
|
|
|
|||
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|||
|
|
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
|
|||
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|||
|
|
// This file is part of MMTTY.
|
|||
|
|
|
|||
|
|
// MMTTY is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
|
|||
|
|
// as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|||
|
|
|
|||
|
|
// MMTTY is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|||
|
|
|
|||
|
|
// You should have received a copy of the GNU Lesser General Public License along with MMTTY. If not, see
|
|||
|
|
// <http://www.gnu.org/licenses/>.
|
|||
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//---------------------------------------------------------------------------
|
|||
|
|
#ifndef LogFileH
|
|||
|
|
#define LogFileH
|
|||
|
|
|
|||
|
|
#include "ComLib.h"
|
|||
|
|
//---------------------------------------------------------------------------
|
|||
|
|
#define MMLOGID "MMLOG DATA Ver1.00\032"
|
|||
|
|
|
|||
|
|
enum {
|
|||
|
|
testOFF,
|
|||
|
|
testON,
|
|||
|
|
testCQRJ,
|
|||
|
|
testPED,
|
|||
|
|
testBARTG,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
typedef struct { // Log<6F>̓<EFBFBD><CC93><EFBFBD><EFBFBD>I<EFBFBD>v<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD>
|
|||
|
|
char m_TimeZone; // <20>\<5C><><EFBFBD>p<EFBFBD>^<5E>C<EFBFBD><43><EFBFBD>]<5D>[<5B><>
|
|||
|
|
|
|||
|
|
int m_UpperName; // <20>啶<EFBFBD><E595B6><EFBFBD>ւ̕ϊ<CC95>
|
|||
|
|
int m_UpperQTH; // <20>啶<EFBFBD><E595B6><EFBFBD>ւ̕ϊ<CC95>
|
|||
|
|
int m_UpperREM; // <20>啶<EFBFBD><E595B6><EFBFBD>ւ̕ϊ<CC95>
|
|||
|
|
int m_UpperQSL; // <20>啶<EFBFBD><E595B6><EFBFBD>ւ̕ϊ<CC95>
|
|||
|
|
|
|||
|
|
int m_DefMyRST; // 0-OFF, 1-ON
|
|||
|
|
int m_Contest; // 0-OFF, 1-ON
|
|||
|
|
|
|||
|
|
int m_CopyFreq; // 0-Band, 1-Freq
|
|||
|
|
int m_CopyHis; // 0-599, 1-599001, 2-599UTC
|
|||
|
|
int m_CopyName; // 0-OFF, 1-ON
|
|||
|
|
int m_CopyQTH; // 0-OFF, 1-ON
|
|||
|
|
int m_CopyREM; // 0-OFF, 1-ON
|
|||
|
|
int m_CopyQSL; // 0-OFF, 1-ON
|
|||
|
|
int m_CopyREMB4; // 0-OFF, 1-ON
|
|||
|
|
|
|||
|
|
int m_AutoSave; // <20><><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD>[<5B>u
|
|||
|
|
|
|||
|
|
int m_QSOMacroFlag; // 0-OFF, 1-ON
|
|||
|
|
int m_CheckBand; // <20><><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD>h<EFBFBD>ł̏d<CC8F><64><EFBFBD><EFBFBD><EFBFBD>`<60>F<EFBFBD>b<EFBFBD>N
|
|||
|
|
int m_QSOMacro[5]; // 0-Run 1st, 1-Run 2nd, 2-Run Dupe, 3-S&P 1st, 4-S&P 2nd
|
|||
|
|
WORD m_QSOMacroKey[5];
|
|||
|
|
AnsiString m_QSOMacroStr[5];
|
|||
|
|
|
|||
|
|
AnsiString m_THRTTY;
|
|||
|
|
AnsiString m_THSSTV;
|
|||
|
|
int m_ClipRSTADIF;
|
|||
|
|
int m_DateType;
|
|||
|
|
int m_THTZ;
|
|||
|
|
|
|||
|
|
int m_Backup;
|
|||
|
|
BYTE m_Hamlog5Len[17];
|
|||
|
|
}LOGSET;
|
|||
|
|
|
|||
|
|
#define MLCALL 16 /* <20><>ٻ<EFBFBD>݂̒<DD82><CC92><EFBFBD> */
|
|||
|
|
#define MLRST 20 /* RST<53>i<EFBFBD><69><EFBFBD>o<EFBFBD>̒<EFBFBD><CC92><EFBFBD> */
|
|||
|
|
#define MLREM 56 /* <20>L<EFBFBD><4C><EFBFBD>̒<EFBFBD><CC92><EFBFBD> */
|
|||
|
|
#define MLNAME 16 /* <20><><EFBFBD>O<EFBFBD>̒<EFBFBD><CC92><EFBFBD> */
|
|||
|
|
#define MLQTH 28 /* <20>p<EFBFBD>s<EFBFBD>g<EFBFBD>̒<EFBFBD><CC92><EFBFBD> */
|
|||
|
|
#define MLQSL 54 /* <20>p<EFBFBD>r<EFBFBD>k<EFBFBD>̒<EFBFBD><CC92><EFBFBD> */
|
|||
|
|
#define MLPOW 4 /* <20>d<EFBFBD><64> */
|
|||
|
|
#define MLOPT 8 /* <20>I<EFBFBD>v<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD> */
|
|||
|
|
|
|||
|
|
#define MODEMAX 48
|
|||
|
|
|
|||
|
|
#define YEAR(c) (((c)<50)?(2000+(c)):(1900+(c)))
|
|||
|
|
|
|||
|
|
#pragma option -a- // <20>p<EFBFBD>b<EFBFBD>N<EFBFBD>̎w<CC8E><77>
|
|||
|
|
typedef struct { /* <20>l<EFBFBD>l<EFBFBD>k<EFBFBD>n<EFBFBD>f<EFBFBD>f<EFBFBD>[<5B>^<5E>`<60><> */
|
|||
|
|
BYTE year; /* <20>N */
|
|||
|
|
WORD date; /* <20><><EFBFBD>t */
|
|||
|
|
WORD btime; /* <20>J<EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD> */
|
|||
|
|
WORD etime; /* <20>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char call[MLCALL+1]; /* <20><>ٻ<EFBFBD><D9BB> */
|
|||
|
|
char ur[MLRST+1]; /* T <20><>߰<EFBFBD> */
|
|||
|
|
char my[MLRST+1]; /* R <20><>߰<EFBFBD> */
|
|||
|
|
BYTE band; /* <20><><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
SHORT fq; /* <20><><EFBFBD>g<EFBFBD><67> */
|
|||
|
|
BYTE mode; /* Ӱ<><D3B0> */
|
|||
|
|
char pow[MLPOW+1]; /* <20>d<EFBFBD><64> */
|
|||
|
|
char name[MLNAME+1]; /* <20><><EFBFBD>O */
|
|||
|
|
char qth[MLQTH+1]; /* QTH */
|
|||
|
|
char qsl[MLQSL+1]; /* QSL */
|
|||
|
|
char send; /* QSL <20><><EFBFBD>M */
|
|||
|
|
char recv; /* QSL <20><><EFBFBD>M */
|
|||
|
|
char cq; /* cq/call */
|
|||
|
|
WORD env; /* <20><><EFBFBD>NJ<C78A> */
|
|||
|
|
char rem[MLREM+1]; /* <20>L<EFBFBD><4C> */
|
|||
|
|
char opt1[MLOPT+1]; /* <20><><EFBFBD><DFBC> */
|
|||
|
|
char opt2[MLOPT+1]; /* <20><><EFBFBD><DFBC>2 */
|
|||
|
|
}SDMMLOG;
|
|||
|
|
|
|||
|
|
#define FHDOFF 256 /* <20>擪<EFBFBD>̃w<CC83>b<EFBFBD>_<EFBFBD>̃I<CC83>t<EFBFBD>Z<EFBFBD>b<EFBFBD>g */
|
|||
|
|
#define UMODEMAX 32
|
|||
|
|
typedef struct {
|
|||
|
|
char id[20]; /* <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>o<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD> */
|
|||
|
|
char dmy[4]; /* <20>_<EFBFBD>~<7E>[<5B>̈<EFBFBD> */
|
|||
|
|
USHORT mlt; /* <20>}<7D><><EFBFBD>`<60><><EFBFBD><EFBFBD><EFBFBD>̃T<CC83>C<EFBFBD>Y */
|
|||
|
|
char td; /* <20><><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h */
|
|||
|
|
char hash; /* <20>n<EFBFBD>b<EFBFBD>V<EFBFBD><56><EFBFBD>f<EFBFBD>[<5B>^<5E>i<EFBFBD>[<5B>t<EFBFBD><74><EFBFBD>O */
|
|||
|
|
long size; /* <20>f<EFBFBD>[<5B>^<5E>T<EFBFBD>C<EFBFBD>Y */
|
|||
|
|
char master; /* <20>}<7D>X<EFBFBD>^<5E>[<5B>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>t<EFBFBD><74><EFBFBD>O */
|
|||
|
|
char dm2[15]; /* <20>_<EFBFBD>~<7E>[<5B>Q */
|
|||
|
|
char mode[UMODEMAX][6]; /* <20><><EFBFBD>[<5B>U<EFBFBD><55><EFBFBD>`<60><><EFBFBD>[<5B>h */
|
|||
|
|
}FHD;
|
|||
|
|
#pragma option -a. // <20>p<EFBFBD>b<EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>̎w<CC8E><77>
|
|||
|
|
|
|||
|
|
class CIndex
|
|||
|
|
{
|
|||
|
|
private:
|
|||
|
|
int m_IndexMax; // <20>m<EFBFBD>ے<EFBFBD><DB92>̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD>̐<EFBFBD>
|
|||
|
|
int m_IndexCnt; // <20><><EFBFBD>݂̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD>̐<EFBFBD>
|
|||
|
|
LPSTR pIndex; // <20>C<EFBFBD><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD>̈<EFBFBD><CC88>̃|<7C>C<EFBFBD><43><EFBFBD>^(16<31>o<EFBFBD>C<EFBFBD>g<EFBFBD>C<EFBFBD><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X)
|
|||
|
|
BYTE *pMult; // <20>}<7D><><EFBFBD>`<60><><EFBFBD><EFBFBD><EFBFBD>̃|<7C>C<EFBFBD><43><EFBFBD>^
|
|||
|
|
public:
|
|||
|
|
CIndex();
|
|||
|
|
~CIndex();
|
|||
|
|
void AllocIndex(int n);
|
|||
|
|
void ClearIndex(void);
|
|||
|
|
void WriteIndex(LPCSTR pCall, int n);
|
|||
|
|
void ReadIndex(LPSTR pCall, int n);
|
|||
|
|
LPSTR PointIndex(int n);
|
|||
|
|
void AddBlock(LPCSTR p, int len);
|
|||
|
|
int ReadIndex(int handle, FHD *hp);
|
|||
|
|
void MakeIndex(int handle, FHD *hp);
|
|||
|
|
int WriteIndex(int handle, FHD *hp);
|
|||
|
|
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#define FINDMAX 32768
|
|||
|
|
class CLogFind
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
int m_FindCnt;
|
|||
|
|
int m_FindCmp1Max;
|
|||
|
|
int m_FindCmp2Max;
|
|||
|
|
int m_FindStr1Max;
|
|||
|
|
int m_FindStr2Max;
|
|||
|
|
|
|||
|
|
int *pFindTbl;
|
|||
|
|
AnsiString m_FindStr;
|
|||
|
|
public:
|
|||
|
|
CLogFind();
|
|||
|
|
~CLogFind();
|
|||
|
|
inline int GetCount(void){return m_FindCnt;};
|
|||
|
|
inline void Clear(void){
|
|||
|
|
m_FindCnt = m_FindCmp1Max = m_FindCmp2Max = m_FindStr1Max = m_FindStr2Max = 0;
|
|||
|
|
};
|
|||
|
|
int Add(int n);
|
|||
|
|
void Ins(int n);
|
|||
|
|
|
|||
|
|
inline void Write(int n){
|
|||
|
|
pFindTbl[m_FindCnt] = n;
|
|||
|
|
m_FindCnt++;
|
|||
|
|
};
|
|||
|
|
inline void SetText(LPCSTR p){
|
|||
|
|
if( p != m_FindStr.c_str() ){
|
|||
|
|
m_FindStr = p;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
inline LPCSTR GetText(void){
|
|||
|
|
return m_FindStr.c_str();
|
|||
|
|
};
|
|||
|
|
inline void ClearText(void){
|
|||
|
|
m_FindStr = "";
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
class CLogFile
|
|||
|
|
{
|
|||
|
|
private:
|
|||
|
|
int m_Open; // <20>I<EFBFBD>[<5B>v<EFBFBD><76><EFBFBD>t<EFBFBD><74><EFBFBD>O
|
|||
|
|
int m_EditFlag; // <20>ҏW<D28F>t<EFBFBD><74><EFBFBD>O
|
|||
|
|
int m_Handle; // <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
|
CIndex m_Index; // <20><><EFBFBD>݃I<DD83>[<5B>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD>̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X
|
|||
|
|
FHD m_fhd; // <20><><EFBFBD>݃I<DD83>[<5B>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43><EFBFBD>w<EFBFBD>b<EFBFBD>_
|
|||
|
|
AnsiString m_Name; // <20><><EFBFBD>O<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̖<EFBFBD><CC96>O
|
|||
|
|
char m_modebuf[8];
|
|||
|
|
public:
|
|||
|
|
AnsiString m_FileName; // <20><><EFBFBD>O<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̖<EFBFBD><CC96>O<EFBFBD>i<EFBFBD>t<EFBFBD><74><EFBFBD>p<EFBFBD>X<EFBFBD>j
|
|||
|
|
|
|||
|
|
int m_CurNo;
|
|||
|
|
int m_CurChg;
|
|||
|
|
SDMMLOG m_sd;
|
|||
|
|
SDMMLOG m_bak;
|
|||
|
|
SDMMLOG m_asd;
|
|||
|
|
|
|||
|
|
CLogFind m_Find; // <20>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>[<5B>^
|
|||
|
|
LOGSET m_LogSet;
|
|||
|
|
SYSTEMTIME m_UTC;
|
|||
|
|
private:
|
|||
|
|
void SetHisRST(SDMMLOG *sp);
|
|||
|
|
void InitHeader(void);
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
CLogFile();
|
|||
|
|
~CLogFile();
|
|||
|
|
|
|||
|
|
void DoBackup(void);
|
|||
|
|
int Open(LPCSTR pName, BOOL fNew);
|
|||
|
|
int Open(LPCSTR pName){Open(pName, TRUE); return 0;}; //JA7UDE 0428
|
|||
|
|
int Close(void);
|
|||
|
|
|
|||
|
|
void ReadIniFile(LPCSTR pKey, TMemIniFile *pIniFile);
|
|||
|
|
void WriteIniFile(LPCSTR pKey, TMemIniFile *pIniFile);
|
|||
|
|
|
|||
|
|
void MakeIndex(void);
|
|||
|
|
|
|||
|
|
inline IsEdit(void){return m_EditFlag;};
|
|||
|
|
void MakePathName(LPCSTR pName);
|
|||
|
|
void MakeName(LPCSTR pName);
|
|||
|
|
inline LPCSTR GetName(void){return m_Name.c_str();};
|
|||
|
|
|
|||
|
|
inline int GetCount(void){return m_fhd.size;};
|
|||
|
|
inline int IsOpen(void){return m_Open;};
|
|||
|
|
int GetData(SDMMLOG *sp, int n);
|
|||
|
|
int PutData(SDMMLOG *sp, int n);
|
|||
|
|
|
|||
|
|
LPCSTR GetDateString(SDMMLOG *sp, int sw);
|
|||
|
|
inline LPCSTR GetDateString(SDMMLOG *sp){ return GetDateString(sp, m_LogSet.m_DateType); };
|
|||
|
|
LPCSTR GetTimeString(WORD d);
|
|||
|
|
|
|||
|
|
|
|||
|
|
LPCSTR GetModeString(BYTE m);
|
|||
|
|
void SetMode(SDMMLOG *sp, LPCSTR s);
|
|||
|
|
|
|||
|
|
LPCSTR GetFreqString(BYTE b, short fq);
|
|||
|
|
void SetFreq(SDMMLOG *sp, LPCSTR p);
|
|||
|
|
LPCSTR GetOptStr(int n, SDMMLOG *sp);
|
|||
|
|
void SetOptStr(int n, SDMMLOG *sp, LPCSTR pOpt);
|
|||
|
|
|
|||
|
|
void CopyAF(void);
|
|||
|
|
void SetHisUTC(void);
|
|||
|
|
|
|||
|
|
void SortDate(int bb, int eb);
|
|||
|
|
int FindSameBand(void);
|
|||
|
|
|
|||
|
|
void FindStrSet(CLogFind *fp, LPCSTR pCall);
|
|||
|
|
int FindCmpSet(CLogFind *fp, LPCSTR pCall);
|
|||
|
|
int FindClipSet(CLogFind *fp, LPCSTR pCall);
|
|||
|
|
int FindSet(CLogFind *fp, LPCSTR pCall);
|
|||
|
|
int Find(LPCSTR pCall, int b, int dir);
|
|||
|
|
int IsAlready(LPCSTR pCall);
|
|||
|
|
void DeleteAll(void);
|
|||
|
|
void DeleteLast(void);
|
|||
|
|
void Delete(int top, int end);
|
|||
|
|
void Insert(int n, SDMMLOG *sp);
|
|||
|
|
|
|||
|
|
void InitCur(void);
|
|||
|
|
void SetLastPos(void);
|
|||
|
|
|
|||
|
|
int ReadAscii(SDMMLOG *sp, LPSTR p);
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
void JSTtoUTC(int &Year, int &Mon, int &Day, int &Hour);
|
|||
|
|
void JSTtoUTC(SDMMLOG *sp);
|
|||
|
|
void UTCtoJST(int &Year, int &Mon, int &Day, int &Hour);
|
|||
|
|
void UTCtoJST(SDMMLOG *sp);
|
|||
|
|
void mBandToBand(SDMMLOG *sp, LPCSTR p);
|
|||
|
|
LPCSTR FreqTomBand(SDMMLOG *sp);
|
|||
|
|
int GetLMode(BYTE m);
|
|||
|
|
|
|||
|
|
extern CLogFile Log;
|
|||
|
|
extern const char MONN[];
|
|||
|
|
extern const char MONU[];
|
|||
|
|
#endif
|
|||
|
|
|