-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathLogFile.h
More file actions
280 lines (230 loc) · 8.41 KB
/
LogFile.h
File metadata and controls
280 lines (230 loc) · 8.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMVARI.
// MMVARI 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.
// MMVARI 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"
extern const char *_band[];
typedef struct { // Logの動作オプション
char m_TimeZone; // 表示用タイムゾーン
int m_UpperName; // 大文字への変換
int m_UpperQTH; // 大文字への変換
int m_UpperREM; // 大文字への変換
int m_UpperQSL; // 大文字への変換
int m_DefMyRST; // 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; // 自動セーブ
int m_QSOMacroFlag; // 0-OFF, 1-ON
int m_CheckBand; // 同一バンドでの重複をチェック
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;
AnsiString m_THGMSK;
int m_THTZ;
int m_ClipRSTADIF;
int m_DateType;
int m_Backup; // バックアップ作成
BYTE m_Hamlog5Len[17];
}LOGSET;
#define MLCALL 16 /* コールサインの長さ */
#define MLRST 20 /* RSTナンバの長さ */
#define MLREM 56 /* 記事の長さ */
#define MLNAME 16 /* 名前の長さ */
#define MLQTH 28 /* QTHの長さ */
#define MLQSL 54 /* QSLの長さ */
#define MLPOW 4 /* 電力 */
#define MLOPT 8 /* オプション */
#define MODEMAX 48
#define YEAR(c) (((c)<50)?(2000+(c)):(1900+(c)))
#pragma option -a- // パックの指示
typedef struct { /* MMLOGデータ形式 */
BYTE year; /* 年 */
WORD date; /* 日付 */
WORD btime; /* 開始時刻 */
WORD etime; /* 終了時刻 */
char call[MLCALL+1]; /* コールサイン */
char ur[MLRST+1]; /* T リポート */
char my[MLRST+1]; /* R リポート */
BYTE band; /* バンド */
SHORT fq; /* 周波数 */
BYTE mode; /* モード */
char pow[MLPOW+1]; /* 電力 */
char name[MLNAME+1]; /* 名前 */
char qth[MLQTH+1]; /* QTH */
char qsl[MLQSL+1]; /* QSL */
char send; /* QSL 送信 */
char recv; /* QSL 受信 */
char cq; /* cq/call */
WORD env; /* 自局環境 */
char rem[MLREM+1]; /* 記事 */
char opt1[MLOPT+1]; /* オプション */
char opt2[MLOPT+1]; /* オプション2 */
}SDMMLOG;
#define FHDOFF 256 /* 先頭のヘッダのオフセット */
#define UMODEMAX 32
typedef struct {
char id[20]; /* ファイルバージョン */
char dmy[4]; /* ダミー領域 */
USHORT mlt; /* マルチ情報のサイズ */
char td; /* 時差コード */
char hash; /* ハッシュデータ格納フラグ */
long size; /* データサイズ */
char master; /* マスターファイルフラグ */
char dm2[15]; /* ダミー2 */
char mode[UMODEMAX][6]; /* ユーザ定義モード */
}FHD;
#pragma option -a. // パック解除の指示
class CIndex
{
private:
int m_IndexMax; // 確保中のインデックスの数
int m_IndexCnt; // 現在のインデックスの数
LPSTR pIndex; // インデックス領域のポインタ(16バイトインデックス)
BYTE *pMult; // マルチ情報のポインタ
public:
__fastcall CIndex();
__fastcall ~CIndex();
void __fastcall AllocIndex(int n);
void __fastcall ClearIndex(void);
void __fastcall WriteIndex(LPCSTR pCall, int n);
void __fastcall ReadIndex(LPSTR pCall, int n);
LPSTR __fastcall PointIndex(int n);
void __fastcall AddBlock(LPCSTR p, int len);
int __fastcall ReadIndex(int handle, FHD *hp);
void __fastcall MakeIndex(int handle, FHD *hp);
int __fastcall 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:
__fastcall CLogFind();
__fastcall ~CLogFind();
inline int __fastcall GetCount(void){return m_FindCnt;};
inline void __fastcall Clear(void){
m_FindCnt = m_FindCmp1Max = m_FindCmp2Max = m_FindStr1Max = m_FindStr2Max = 0;
};
int __fastcall Add(int n);
void __fastcall Ins(int n);
inline void __fastcall Write(int n){
pFindTbl[m_FindCnt] = n;
m_FindCnt++;
};
inline void __fastcall SetText(LPCSTR p){
if( p != m_FindStr.c_str() ){
m_FindStr = p;
}
};
inline LPCSTR __fastcall GetText(void){
return m_FindStr.c_str();
};
inline void __fastcall ClearText(void){
m_FindStr = "";
};
};
class CLogFile
{
private:
int m_Open; // オープンフラグ
int m_EditFlag; // 編集フラグ
int m_Handle; // ファイルハンドル
CIndex m_Index; // 現在オープン中のインデックス
FHD m_fhd; // 現在オープン中のファイルヘッダ
AnsiString m_Name; // ログファイルの名前
char m_modebuf[8];
public:
AnsiString m_FileName; // ログファイルの名前(フルパス)
int m_CurNo;
int m_CurChg;
SDMMLOG m_sd;
SDMMLOG m_bak;
SDMMLOG m_asd;
CLogFind m_Find; // カレント検索データ
LOGSET m_LogSet;
private:
void __fastcall SetHisRST(SDMMLOG *sp);
void __fastcall InitHeader(void);
public:
__fastcall CLogFile();
__fastcall ~CLogFile();
void __fastcall DoBackup(void);
int __fastcall Open(LPCSTR pName, BOOL fNew);
int __fastcall Close(void);
void __fastcall ReadIniFile(LPCSTR pKey, TMemIniFile *pIniFile);
void __fastcall WriteIniFile(LPCSTR pKey, TMemIniFile *pIniFile);
void __fastcall MakeIndex(void);
inline int __fastcall IsEdit(void){return m_EditFlag;};
void __fastcall MakePathName(LPCSTR pName);
void __fastcall MakeName(LPCSTR pName);
inline LPCSTR __fastcall GetName(void){return m_Name.c_str();};
inline int __fastcall GetCount(void){return m_fhd.size;};
inline int __fastcall IsOpen(void){return m_Open;};
int __fastcall GetData(SDMMLOG *sp, int n);
int __fastcall PutData(SDMMLOG *sp, int n);
LPCSTR __fastcall GetDateString(SDMMLOG *sp, int sw);
inline LPCSTR __fastcall GetDateString(SDMMLOG *sp){ return GetDateString(sp, m_LogSet.m_DateType); };
LPCSTR __fastcall GetTimeString(WORD d);
LPCSTR __fastcall GetModeString(BYTE m);
void __fastcall SetMode(SDMMLOG *sp, LPCSTR s);
LPCSTR __fastcall GetFreqString(BYTE b, short fq);
void __fastcall SetFreq(SDMMLOG *sp, LPCSTR p);
LPCSTR __fastcall GetOptStr(int n, SDMMLOG *sp);
void __fastcall SetOptStr(int n, SDMMLOG *sp, LPCSTR pOpt);
void __fastcall CopyAF(void);
void __fastcall SortDate(int bb, int eb);
int __fastcall FindSameBand(BOOL fMode);
int __fastcall FindSameDate(void);
void __fastcall FindStrSet(CLogFind *fp, LPCSTR pCall);
int __fastcall FindCmpSet(CLogFind *fp, LPCSTR pCall);
int __fastcall FindClipSet(CLogFind *fp, LPCSTR pCall);
int __fastcall FindSet(CLogFind *fp, LPCSTR pCall);
int __fastcall Find(LPCSTR pCall, int b, int dir);
int __fastcall IsAlready(LPCSTR pCall);
void __fastcall DeleteAll(void);
void __fastcall DeleteLast(void);
void __fastcall Delete(int top, int end);
void __fastcall Insert(int n, SDMMLOG *sp);
void __fastcall InitCur(void);
void __fastcall SetLastPos(void);
int __fastcall ReadAscii(SDMMLOG *sp, LPSTR p);
};
void __fastcall JSTtoUTC(int &Year, int &Mon, int &Day, int &Hour);
void __fastcall JSTtoUTC(SDMMLOG *sp);
void __fastcall UTCtoJST(int &Year, int &Mon, int &Day, int &Hour);
void __fastcall UTCtoJST(SDMMLOG *sp);
void __fastcall UTCtoJST(SYSTEMTIME *tp);
void __fastcall mBandToBand(SDMMLOG *sp, LPCSTR p);
LPCSTR __fastcall FreqTomBand(SDMMLOG *sp);
int __fastcall GetLMode(BYTE m);
extern CLogFile Log;
extern const char MONN[];
extern const char MONU[];
#endif