Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /branches/ttcomtester/teraterm/teraterm/teraterm.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6806 - (hide annotations) (download) (as text)
Thu Jun 15 00:37:01 2017 UTC (6 years, 9 months ago) by doda
Original Path: trunk/teraterm/teraterm/teraterm.cpp
File MIME type: text/x-c++src
File size: 6031 byte(s)
TeraTerm Project としてのライセンス表記を追加

とりあえず Tera Term 本体分。
TeraTerm Project としての copyright 表記の年部分はコミットログを確認して書いたつもりだけど、ミスってたらすみません。

TODO: 過去に取り込んだパッチに関する著作権表記の追加
1 doda 6806 /*
2     * Copyright (C) 1994-1998 T. Teranishi
3     * (C) 2006-2017 TeraTerm Project
4     * All rights reserved.
5     *
6     * Redistribution and use in source and binary forms, with or without modification,
7     * are permitted provided that the following conditions are met:
8     *
9     * 1. Redistributions of source code must retain the above copyright notice,
10     * this list of conditions and the following disclaimer.
11     * 2. Redistributions in binary form must reproduce the above copyright notice,
12     * this list of conditions and the following disclaimer in the documentation
13     * and/or other materials provided with the distribution.
14     * 3. The name of the author may not be used to endorse or promote products derived
15     * from this software without specific prior written permission.
16     *
17     * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18     * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20     * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21     * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22     * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24     * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25     * OF SUCH DAMAGE.
26     */
27 maya 3227
28     /* TERATERM.EXE, main */
29    
30     #include "stdafx.h"
31     #include "teraterm.h"
32     #include "tttypes.h"
33     #include "commlib.h"
34     #include "ttwinman.h"
35     #include "buffer.h"
36     #include "vtterm.h"
37     #include "vtwin.h"
38     #include "clipboar.h"
39     #include "ttftypes.h"
40     #include "filesys.h"
41     #include "telnet.h"
42     #include "tektypes.h"
43     #include "tekwin.h"
44     #include "ttdde.h"
45 doda 4414 #include "keyboard.h"
46 maya 3227
47     #include "teraapp.h"
48    
49     #include "compat_w95.h"
50    
51     #ifdef _DEBUG
52     #define new DEBUG_NEW
53     #undef THIS_FILE
54     static char THIS_FILE[] = __FILE__;
55     #endif
56    
57     BEGIN_MESSAGE_MAP(CTeraApp, CWinApp)
58     //{{AFX_MSG_MAP(CTeraApp)
59     //}}AFX_MSG_MAP
60     END_MESSAGE_MAP()
61    
62     CTeraApp::CTeraApp()
63     {
64 doda 6793 typedef BOOL (WINAPI *pSetDllDir)(LPCSTR);
65     typedef BOOL (WINAPI *pSetDefDllDir)(DWORD);
66    
67     HMODULE module;
68     pSetDllDir setDllDir;
69     pSetDefDllDir setDefDllDir;
70    
71     if ((module = GetModuleHandle("kernel32.dll")) != NULL) {
72     if ((setDefDllDir = (pSetDefDllDir)GetProcAddress(module, "SetDefaultDllDirectories")) != NULL) {
73     // SetDefaultDllDirectories() ���g�����������A�����p�X�� %WINDOWS%\system32 ��������������
74     (*setDefDllDir)((DWORD)0x00000800); // LOAD_LIBRARY_SEARCH_SYSTEM32
75     }
76     else if ((setDllDir = (pSetDllDir)GetProcAddress(module, "SetDllDirectoryA")) != NULL) {
77     // SetDefaultDllDirectories() ���g�����������ASetDllDirectory() ���g����������
78     // �J�����g�f�B���N�g���������������p�X�����������������B
79     (*setDllDir)("");
80     }
81     }
82 maya 3227 }
83    
84     // CTeraApp instance
85     CTeraApp theApp;
86    
87    
88    
89    
90    
91     // CTeraApp initialization
92     BOOL CTeraApp::InitInstance()
93     {
94 maya 3392 hInst = m_hInstance;
95     m_pMainWnd = new CVTWindow();
96     pVTWin = m_pMainWnd;
97     return TRUE;
98 maya 3227 }
99    
100     int CTeraApp::ExitInstance()
101     {
102 maya 3392 return CWinApp::ExitInstance();
103 maya 3227 }
104    
105     // Tera Term main engine
106     BOOL CTeraApp::OnIdle(LONG lCount)
107     {
108     static int Busy = 2;
109     int Change, nx, ny;
110     BOOL Size;
111    
112     if (lCount==0) Busy = 2;
113    
114     if (cv.Ready)
115     {
116     /* Sender */
117     CommSend(&cv);
118    
119     /* Parser */
120     if ((cv.HLogBuf!=NULL) && (cv.LogBuf==NULL))
121     cv.LogBuf = (PCHAR)GlobalLock(cv.HLogBuf);
122    
123     if ((cv.HBinBuf!=NULL) && (cv.BinBuf==NULL))
124     cv.BinBuf = (PCHAR)GlobalLock(cv.HBinBuf);
125    
126     if ((TelStatus==TelIdle) && cv.TelMode)
127     TelStatus = TelIAC;
128    
129     if (TelStatus != TelIdle)
130     {
131     ParseTel(&Size,&nx,&ny);
132     if (Size) {
133     LockBuffer();
134     ChangeTerminalSize(nx,ny);
135     UnlockBuffer();
136     }
137     }
138     else {
139     if (cv.ProtoFlag) Change = ProtoDlgParse();
140     else {
141     switch (ActiveWin) {
142 doda 6435 case IdVT:
143     Change = ((CVTWindow*)pVTWin)->Parse();
144 maya 3227 // TEK window���A�N�e�B�u���� pause ���g�����ACPU�g�p��100%������
145     // ���������b�������B(2006.2.6 yutaka)
146     // �����������������A�R���e�L�X�g�X�C�b�`�����������B(2006.3.20 yutaka)
147     Sleep(0);
148     break;
149    
150     case IdTEK:
151     if (pTEKWin != NULL) {
152     Change = ((CTEKWindow*)pTEKWin)->Parse();
153     // TEK window���A�N�e�B�u���� pause ���g�����ACPU�g�p��100%������
154     // ���������b�������B(2006.2.6 yutaka)
155     Sleep(1);
156     }
157 maya 3392 else {
158 maya 3227 Change = IdVT;
159 maya 3392 }
160 maya 3227 break;
161    
162     default:
163     Change = 0;
164     }
165    
166     switch (Change) {
167 maya 3392 case IdVT:
168     VTActivate();
169     break;
170     case IdTEK:
171     ((CVTWindow*)pVTWin)->OpenTEK();
172     break;
173 maya 3227 }
174     }
175     }
176    
177     if (cv.LogBuf!=NULL)
178     {
179 maya 3392 if (FileLog) {
180     LogToFile();
181     }
182     if (DDELog && AdvFlag) {
183     DDEAdv();
184     }
185 maya 3227 GlobalUnlock(cv.HLogBuf);
186     cv.LogBuf = NULL;
187     }
188    
189     if (cv.BinBuf!=NULL)
190     {
191 maya 3392 if (BinLog) {
192     LogToFile();
193     }
194 maya 3227 GlobalUnlock(cv.HBinBuf);
195     cv.BinBuf = NULL;
196     }
197    
198     /* Talker */
199     switch (TalkStatus) {
200 maya 3392 case IdTalkCB:
201     CBSend();
202     break; /* clip board */
203     case IdTalkFile:
204     FileSend();
205     break; /* file */
206 maya 3227 }
207    
208     /* Receiver */
209     if (DDELog && cv.DCount >0) {
210     // ���O�o�b�t�@������DDE�N���C�A���g�����������������������A
211     // TCP�p�P�b�g�����M���s�������B
212     // �A���������M���s�����A���O�o�b�t�@�����E���h���r�������������M���f�[�^��
213     // �������������������\���������B(2007.6.14 yutaka)
214    
215     } else {
216     CommReceive(&cv);
217     }
218    
219     }
220    
221     if (cv.Ready &&
222 doda 3494 (cv.RRQ || (cv.OutBuffCount>0) || (cv.InBuffCount>0) || (cv.FlushLen>0) || (cv.LCount>0) || (cv.BCount>0) || (cv.DCount>0)) ) {
223 maya 3227 Busy = 2;
224 maya 3392 }
225     else {
226 maya 3227 Busy--;
227 maya 3392 }
228 maya 3227
229     return (Busy>0);
230     }
231    
232     BOOL CTeraApp::PreTranslateMessage(MSG* pMsg)
233     {
234 doda 4414 if (MetaKey(ts.MetaKey)) {
235 maya 3392 return FALSE; /* ignore accelerator keys */
236     }
237     else {
238     return CWinApp::PreTranslateMessage(pMsg);
239     }
240 maya 3227 }

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