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 6841 - (hide annotations) (download) (as text)
Tue Jul 4 15:02:28 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: 6027 byte(s)
TeraTerm Project としてのライセンス表記を追加

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

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