-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathLogConv.h
More file actions
248 lines (217 loc) · 6.34 KB
/
LogConv.h
File metadata and controls
248 lines (217 loc) · 6.34 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
//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 LogConvH
#define LogConvH
#include "LogFile.h"
extern const char *MONT1[];
extern const char *MONT2[];
//*************************************************************
// ログ変換の基本クラス
//
class CLogConv
{
protected:
int m_Type; // 0-TEXT, 1-LOG200, 2-HAMLOG, 3-DBASE
int m_Mode; // 0-Read, 1-Write
FILE *m_fp;
AnsiString m_FileName; // 変換中のファイル名
public:
CLogConv();
virtual ~CLogConv();
virtual int IsOpen(void){return m_fp != NULL ? 1 : 0;};
virtual int Open(LPCSTR pName)=0;
virtual int Create(LPCSTR pName)=0;
virtual int Close(void)=0;
virtual int Read(SDMMLOG *sp)=0;
virtual int Write(SDMMLOG *sp)=0;
};
#define TEXTCONVMAX 64
typedef struct {
int w;
AnsiString Key;
}TCONV;
//*************************************************************
// テキストファイルアクセスのクラス
//
class CLogText : public CLogConv
{
public:
int m_Double;
int m_Delm;
TCONV m_rConv[TEXTCONVMAX];
TCONV m_tConv[TEXTCONVMAX];
int m_UTC;
int m_err;
protected:
char m_bf[2048]; // ファイルバッファ
private:
int Text2MMLOG(SDMMLOG *sp, LPSTR p, int &err);
void MMLOG2Text(LPSTR t, SDMMLOG *sp);
public:
CLogText();
virtual int Open(LPCSTR pName);
virtual int Create(LPCSTR pName);
virtual int Close(void);
virtual int Read(SDMMLOG *sp);
virtual int Write(SDMMLOG *sp);
};
void MMLOG2Text(LPSTR t, SDMMLOG *sp, AnsiString &Key);
int Text2MMLOG(SDMMLOG *sp, LPCSTR s, AnsiString &Key);
extern const LPCSTR ConvTbl[];
extern CLogText LogText;
//*************************************************************
// LOG200ファイルアクセスのクラス
//
#define LOG200WIDTH 200
class CLog200 : public CLogConv
{
public:
int m_Index;
int m_err;
protected:
char m_bf[200]; // ファイルバッファ
private:
public:
CLog200();
virtual int Open(LPCSTR pName);
virtual int Create(LPCSTR pName);
virtual int Close(void);
virtual int Read(SDMMLOG *sp);
virtual int Write(SDMMLOG *sp);
};
//*************************************************************
// HAMLOGファイルアクセスのクラス
//
#pragma option -a- // パックの指示
typedef struct {
char Memo; // 03h=メモフィールド無し 83h=メモフィールド有り(HAMLOGでは 1Ah)
char YY, MM, DD; // 最終更新年月日
long Max; // レコード件数
WORD HeadLen; // ヘッダの長さ(HAMLOG.DBSは 449)
WORD DataLen; // レコードの長さ(HAMLOG.DBSは 58)
char dummy[20]; // 00h
}DBSHD;
typedef struct {
char Memo; // 03h=メモフィールド無し 83h=メモフィールド有り(HAMLOGでは 1Ah)
char YY, MM, DD; // 最終更新年月日
long Max; // レコード件数
char dm1;
char m1; // 01h
char dm2;
char dummy[21]; // 00h
char dummy2[255-32]; // 00h
char term; // 1ah
}DBRHD;
typedef struct {
char Name[11];
BYTE Type;
BYTE dm1[4];
BYTE Len;
BYTE dm2[15];
}DBSLOT;
typedef struct {
char del[1]; /* 削除マーク */
char calls[7]; /* コールサイン */
char potbl[3]; /* 移動エリア */
char code[6]; /* JCCコード */
char glid[6]; /* グリッドロケーター */
char freq[4]; /* 周波数 */
char mode[3]; /* モード */
char name[12]; /* 氏名 */
char qsl [1]; /* QSL via */
char send[1]; /* QSL SEND */
char rcv[1]; /* QSL RCV */
char date[3]; /* 日付 */
char time[2]; /* 時間 */
char hiss[2]; /* HIS RST */
char myrs[2]; /* MY RST */
long ofs; /* HAMLOG.DBR オフセットアドレス */
}SDHAMLOG;
typedef struct { /* DBRのフィールド位置データ */
BYTE LenQTH;
BYTE LenREM1;
BYTE LenREM2;
}FHDDBR;
#pragma option -a. // パック解除の指示
class CHamLog : public CLogConv
{
public:
int m_Index;
int m_err;
protected:
DBSHD m_hd; // DBSヘッダ
SDHAMLOG m_RecBuf; // レコードバッファ
AnsiString m_DBRName; // DBRファイルの名前
FILE *m_dbrfp; // DBRファイルのファイルポインタ
DBRHD m_dbrhd; // DBRヘッダ
private:
int Seek(DWORD Index);
BOOL MakeHD(void);
public:
CHamLog();
virtual int Open(LPCSTR pName);
virtual int Create(LPCSTR pName);
virtual int Close(void);
virtual int Read(SDMMLOG *sp);
virtual int Write(SDMMLOG *sp);
};
void HAMLOGtoMMLOG(SDMMLOG *sp, SDHAMLOG *hp, FILE *dbrfp);
int MMLOGtoHAMLOG(SDHAMLOG *hp, SDMMLOG *sp, FILE *dbrfp);
void AddMMLOGKey(AnsiString &REM1, AnsiString &REM2, LPCSTR s, LPCSTR pKey);
void SetMMLOGKey(SDMMLOG *sp, LPSTR bf);
//*************************************************************
// ADIFアクセスのクラス
//
class CLogADIF : public CLogConv
{
public:
protected:
char m_bf[1024]; // ファイルバッファ
LPSTR m_p;
int m_conv;
private:
void MMLOG2ADIF(LPSTR t, SDMMLOG *sp);
void SetData(SDMMLOG *sp, LPCSTR pKey, LPSTR pData);
void AdjustData(SDMMLOG *sp);
void OutF(int &col, FILE *fp, LPCSTR fmt, ...);
public:
CLogADIF();
virtual int Open(LPCSTR pName);
virtual int Create(LPCSTR pName);
virtual int Close(void);
virtual int Read(SDMMLOG *sp);
virtual int Write(SDMMLOG *sp);
};
//*************************************************************
// Cabrillo アクセスのクラス
//
class CLogCabrillo : public CLogConv
{
public:
protected:
char m_bf[1024]; // ファイルバッファ
LPSTR m_p;
AnsiString m_SNR;
private:
void MMLOG2Cabrillo(LPSTR t, SDMMLOG *sp);
void AdjustData(SDMMLOG *sp);
public:
CLogCabrillo();
virtual int Open(LPCSTR pName);
virtual int Create(LPCSTR pName);
virtual int Close(void);
virtual int Read(SDMMLOG *sp);
virtual int Write(SDMMLOG *sp);
};
#endif