git-svn-id: svn://qnap.local/TwoTerm/trunk@1653 5590a31f-7b70-45f8-8c82-aa3a8e5f4507

This commit is contained in:
Kelvin Sherlock 2010-07-09 23:52:30 +00:00
parent 2e08a6f99d
commit 2249c8af33
6 changed files with 466 additions and 980 deletions

File diff suppressed because it is too large Load Diff

View File

@ -269,6 +269,8 @@
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
<array> <array>
<string>29B97314FDCFA39411CA2CEA</string> <string>29B97314FDCFA39411CA2CEA</string>
<string>B6697A3911E7CC66002ED475</string>
<string>B6697A3A11E7CC80002ED475</string>
<string>080E96DDFE201D6D7F000001</string> <string>080E96DDFE201D6D7F000001</string>
<string>29B97315FDCFA39411CA2CEA</string> <string>29B97315FDCFA39411CA2CEA</string>
<string>29B97317FDCFA39411CA2CEA</string> <string>29B97317FDCFA39411CA2CEA</string>
@ -282,9 +284,8 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array> <array>
<array> <array>
<integer>37</integer> <integer>4</integer>
<integer>36</integer> <integer>1</integer>
<integer>27</integer>
<integer>0</integer> <integer>0</integer>
</array> </array>
</array> </array>
@ -306,7 +307,7 @@
<real>324</real> <real>324</real>
</array> </array>
<key>RubberWindowFrame</key> <key>RubberWindowFrame</key>
<string>203 218 1060 902 0 0 1920 1178 </string> <string>494 147 1060 902 0 0 1920 1178 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXSmartGroupTreeModule</string> <string>PBXSmartGroupTreeModule</string>
@ -322,7 +323,7 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>B676054211DADB9000D6B66C</string> <string>B676054211DADB9000D6B66C</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>CurveView.m</string> <string>Screen.h</string>
<key>PBXSplitModuleInNavigatorKey</key> <key>PBXSplitModuleInNavigatorKey</key>
<dict> <dict>
<key>Split0</key> <key>Split0</key>
@ -330,11 +331,11 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>B676054311DADB9000D6B66C</string> <string>B676054311DADB9000D6B66C</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>CurveView.m</string> <string>Screen.h</string>
<key>_historyCapacity</key> <key>_historyCapacity</key>
<integer>0</integer> <integer>0</integer>
<key>bookmark</key> <key>bookmark</key>
<string>B6697A3211E6C439002ED475</string> <string>B6697A6311E7E0F3002ED475</string>
<key>history</key> <key>history</key>
<array> <array>
<string>B676058811DAE21100D6B66C</string> <string>B676058811DAE21100D6B66C</string>
@ -348,23 +349,25 @@
<string>B65FA28111E29EDE00EB447E</string> <string>B65FA28111E29EDE00EB447E</string>
<string>B65FA2FE11E2A5D200EB447E</string> <string>B65FA2FE11E2A5D200EB447E</string>
<string>B649E0B511E2A88D0061921F</string> <string>B649E0B511E2A88D0061921F</string>
<string>B6F444CF11E41C7200C3A836</string>
<string>B699A0BE11E58D3B00F54CC8</string> <string>B699A0BE11E58D3B00F54CC8</string>
<string>B699A0C011E58D3B00F54CC8</string> <string>B699A0C011E58D3B00F54CC8</string>
<string>B699A0C211E58D3B00F54CC8</string> <string>B699A0C211E58D3B00F54CC8</string>
<string>B699A0C311E58D3B00F54CC8</string>
<string>B699A0C411E58D3B00F54CC8</string>
<string>B669796011E6A606002ED475</string>
<string>B669796111E6A606002ED475</string>
<string>B669796211E6A606002ED475</string>
<string>B669796311E6A606002ED475</string> <string>B669796311E6A606002ED475</string>
<string>B669797711E6A6CE002ED475</string> <string>B669797711E6A6CE002ED475</string>
<string>B66979BD11E6ACB9002ED475</string> <string>B66979BD11E6ACB9002ED475</string>
<string>B66979D811E6BD4B002ED475</string>
<string>B66979FE11E6BEC3002ED475</string> <string>B66979FE11E6BEC3002ED475</string>
<string>B6697A1A11E6C28A002ED475</string> <string>B6697A1A11E6C28A002ED475</string>
<string>B6697A1B11E6C28A002ED475</string> <string>B6697A1B11E6C28A002ED475</string>
<string>B6697A1C11E6C28A002ED475</string> <string>B6697A5211E7E072002ED475</string>
<string>B6697A5311E7E072002ED475</string>
<string>B6697A5411E7E072002ED475</string>
<string>B6697A5511E7E072002ED475</string>
<string>B6697A5611E7E072002ED475</string>
<string>B6697A5711E7E072002ED475</string>
<string>B6697A5811E7E072002ED475</string>
<string>B6697A5911E7E072002ED475</string>
<string>B6697A5A11E7E072002ED475</string>
<string>B6697A5B11E7E072002ED475</string>
</array> </array>
</dict> </dict>
<key>SplitCount</key> <key>SplitCount</key>
@ -380,7 +383,7 @@
<key>Frame</key> <key>Frame</key>
<string>{{0, 0}, {714, 454}}</string> <string>{{0, 0}, {714, 454}}</string>
<key>RubberWindowFrame</key> <key>RubberWindowFrame</key>
<string>203 218 1060 902 0 0 1920 1178 </string> <string>494 147 1060 902 0 0 1920 1178 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXNavigatorGroup</string> <string>PBXNavigatorGroup</string>
@ -480,7 +483,7 @@
<key>Frame</key> <key>Frame</key>
<string>{{10, 27}, {714, 375}}</string> <string>{{10, 27}, {714, 375}}</string>
<key>RubberWindowFrame</key> <key>RubberWindowFrame</key>
<string>203 218 1060 902 0 0 1920 1178 </string> <string>494 147 1060 902 0 0 1920 1178 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXBuildResultsModule</string> <string>PBXBuildResultsModule</string>
@ -702,15 +705,14 @@
<integer>5</integer> <integer>5</integer>
<key>WindowOrderList</key> <key>WindowOrderList</key>
<array> <array>
<string>B6697A3311E6C439002ED475</string>
<string>B669796711E6A606002ED475</string> <string>B669796711E6A606002ED475</string>
<string>B669796811E6A606002ED475</string> <string>B669796811E6A606002ED475</string>
<string>B66979DC11E6BD4B002ED475</string>
<string>/Users/kelvin/Projects/2Term/2Term.xcodeproj</string> <string>/Users/kelvin/Projects/2Term/2Term.xcodeproj</string>
<string>B6697A1F11E6C28A002ED475</string> <string>B6697A5E11E7E072002ED475</string>
<string>B6697A5D11E7E072002ED475</string>
</array> </array>
<key>WindowString</key> <key>WindowString</key>
<string>203 218 1060 902 0 0 1920 1178 </string> <string>494 147 1060 902 0 0 1920 1178 </string>
<key>WindowToolsV3</key> <key>WindowToolsV3</key>
<array> <array>
<dict> <dict>

View File

@ -17,6 +17,7 @@
B66979FA11E6BEB5002ED475 /* sl75.png in Resources */ = {isa = PBXBuildFile; fileRef = B66979F811E6BEB5002ED475 /* sl75.png */; }; B66979FA11E6BEB5002ED475 /* sl75.png in Resources */ = {isa = PBXBuildFile; fileRef = B66979F811E6BEB5002ED475 /* sl75.png */; };
B66979FB11E6BEB5002ED475 /* sl50.png in Resources */ = {isa = PBXBuildFile; fileRef = B66979F911E6BEB5002ED475 /* sl50.png */; }; B66979FB11E6BEB5002ED475 /* sl50.png in Resources */ = {isa = PBXBuildFile; fileRef = B66979F911E6BEB5002ED475 /* sl50.png */; };
B6697A0F11E6BF95002ED475 /* CurveView.m in Sources */ = {isa = PBXBuildFile; fileRef = B6697A0E11E6BF95002ED475 /* CurveView.m */; }; B6697A0F11E6BF95002ED475 /* CurveView.m in Sources */ = {isa = PBXBuildFile; fileRef = B6697A0E11E6BF95002ED475 /* CurveView.m */; };
B6697A3D11E7CCA0002ED475 /* PTSE.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6697A3C11E7CCA0002ED475 /* PTSE.mm */; };
B676063B11DEAD3500D6B66C /* TermWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = B676063A11DEAD3500D6B66C /* TermWindowController.m */; }; B676063B11DEAD3500D6B66C /* TermWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = B676063A11DEAD3500D6B66C /* TermWindowController.m */; };
B676065111DEBAE900D6B66C /* TermWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B676065011DEBAE900D6B66C /* TermWindow.xib */; }; B676065111DEBAE900D6B66C /* TermWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B676065011DEBAE900D6B66C /* TermWindow.xib */; };
B67606DA11DF6DAB00D6B66C /* EmulatorView.mm in Sources */ = {isa = PBXBuildFile; fileRef = B67606D911DF6DAB00D6B66C /* EmulatorView.mm */; }; B67606DA11DF6DAB00D6B66C /* EmulatorView.mm in Sources */ = {isa = PBXBuildFile; fileRef = B67606D911DF6DAB00D6B66C /* EmulatorView.mm */; };
@ -47,6 +48,8 @@
B66979F911E6BEB5002ED475 /* sl50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sl50.png; sourceTree = "<group>"; }; B66979F911E6BEB5002ED475 /* sl50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sl50.png; sourceTree = "<group>"; };
B6697A0D11E6BF95002ED475 /* CurveView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurveView.h; sourceTree = "<group>"; }; B6697A0D11E6BF95002ED475 /* CurveView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurveView.h; sourceTree = "<group>"; };
B6697A0E11E6BF95002ED475 /* CurveView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CurveView.m; sourceTree = "<group>"; }; B6697A0E11E6BF95002ED475 /* CurveView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CurveView.m; sourceTree = "<group>"; };
B6697A3B11E7CCA0002ED475 /* PTSE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTSE.h; sourceTree = "<group>"; };
B6697A3C11E7CCA0002ED475 /* PTSE.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PTSE.mm; sourceTree = "<group>"; };
B676063911DEAD3500D6B66C /* TermWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TermWindowController.h; sourceTree = "<group>"; }; B676063911DEAD3500D6B66C /* TermWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TermWindowController.h; sourceTree = "<group>"; };
B676063A11DEAD3500D6B66C /* TermWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TermWindowController.m; sourceTree = "<group>"; }; B676063A11DEAD3500D6B66C /* TermWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TermWindowController.m; sourceTree = "<group>"; };
B676064D11DEBAE300D6B66C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/TermWindow.xib; sourceTree = "<group>"; }; B676064D11DEBAE300D6B66C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/TermWindow.xib; sourceTree = "<group>"; };
@ -81,8 +84,6 @@
080E96DDFE201D6D7F000001 /* Classes */ = { 080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B669798311E6A786002ED475 /* Lock.h */,
B669798411E6A786002ED475 /* Lock.cpp */,
256AC3D80F4B6AC300CF3369 /* TwoTermAppDelegate.h */, 256AC3D80F4B6AC300CF3369 /* TwoTermAppDelegate.h */,
256AC3D90F4B6AC300CF3369 /* TwoTermAppDelegate.m */, 256AC3D90F4B6AC300CF3369 /* TwoTermAppDelegate.m */,
B676063911DEAD3500D6B66C /* TermWindowController.h */, B676063911DEAD3500D6B66C /* TermWindowController.h */,
@ -91,16 +92,7 @@
B67606D911DF6DAB00D6B66C /* EmulatorView.mm */, B67606D911DF6DAB00D6B66C /* EmulatorView.mm */,
B6EBE2B311E0EA9100EA0458 /* CharacterGenerator.h */, B6EBE2B311E0EA9100EA0458 /* CharacterGenerator.h */,
B6EBE2B411E0EA9100EA0458 /* CharacterGenerator.m */, B6EBE2B411E0EA9100EA0458 /* CharacterGenerator.m */,
B6F444C611E41AC000C3A836 /* VT05.h */,
B699A08B11E5720F00F54CC8 /* Emulator.h */,
B699A08F11E572A300F54CC8 /* VT52.h */,
B699A09011E572A300F54CC8 /* VT52.mm */,
B6F444C711E41AC000C3A836 /* VT05.mm */,
B699A02E11E528BC00F54CC8 /* Screen.h */,
B699A02F11E528BC00F54CC8 /* Screen.cpp */,
B699A03211E528DE00F54CC8 /* iGeometry.h */, B699A03211E528DE00F54CC8 /* iGeometry.h */,
B699A05B11E54D4500F54CC8 /* OutputChannel.h */,
B699A05C11E54D4500F54CC8 /* OutputChannel.cpp */,
B6697A0D11E6BF95002ED475 /* CurveView.h */, B6697A0D11E6BF95002ED475 /* CurveView.h */,
B6697A0E11E6BF95002ED475 /* CurveView.m */, B6697A0E11E6BF95002ED475 /* CurveView.m */,
); );
@ -136,6 +128,8 @@
29B97314FDCFA39411CA2CEA /* 2Term */ = { 29B97314FDCFA39411CA2CEA /* 2Term */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B6697A3911E7CC66002ED475 /* cpp */,
B6697A3A11E7CC80002ED475 /* Emulators */,
080E96DDFE201D6D7F000001 /* Classes */, 080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */, 29B97317FDCFA39411CA2CEA /* Resources */,
@ -185,6 +179,33 @@
path = images; path = images;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
B6697A3911E7CC66002ED475 /* cpp */ = {
isa = PBXGroup;
children = (
B669798311E6A786002ED475 /* Lock.h */,
B669798411E6A786002ED475 /* Lock.cpp */,
B699A02E11E528BC00F54CC8 /* Screen.h */,
B699A02F11E528BC00F54CC8 /* Screen.cpp */,
B699A05B11E54D4500F54CC8 /* OutputChannel.h */,
B699A05C11E54D4500F54CC8 /* OutputChannel.cpp */,
);
name = cpp;
sourceTree = "<group>";
};
B6697A3A11E7CC80002ED475 /* Emulators */ = {
isa = PBXGroup;
children = (
B699A08B11E5720F00F54CC8 /* Emulator.h */,
B6697A3B11E7CCA0002ED475 /* PTSE.h */,
B6697A3C11E7CCA0002ED475 /* PTSE.mm */,
B6F444C611E41AC000C3A836 /* VT05.h */,
B6F444C711E41AC000C3A836 /* VT05.mm */,
B699A08F11E572A300F54CC8 /* VT52.h */,
B699A09011E572A300F54CC8 /* VT52.mm */,
);
name = Emulators;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@ -255,6 +276,7 @@
B699A09111E572A300F54CC8 /* VT52.mm in Sources */, B699A09111E572A300F54CC8 /* VT52.mm in Sources */,
B669798511E6A786002ED475 /* Lock.cpp in Sources */, B669798511E6A786002ED475 /* Lock.cpp in Sources */,
B6697A0F11E6BF95002ED475 /* CurveView.m in Sources */, B6697A0F11E6BF95002ED475 /* CurveView.m in Sources */,
B6697A3D11E7CCA0002ED475 /* PTSE.mm in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

26
PTSE.h Normal file
View File

@ -0,0 +1,26 @@
//
// PTSE.h
// 2Term
//
// Created by Kelvin Sherlock on 7/9/2010.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "Emulator.h"
#include "iGeometry.h"
@interface PTSE : NSObject <Emulator>
{
unsigned _state;
iPoint _dca;
uint8_t _repeatChar;
}
@end

238
PTSE.mm Normal file
View File

@ -0,0 +1,238 @@
//
// PTSE.mm
// 2Term
//
// Created by Kelvin Sherlock on 7/9/2010.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#include <sys/ttydefaults.h>
#import "PTSE.h"
#include "OutputChannel.h"
#include "Screen.h"
@implementation PTSE
enum {
StateText,
StateDCAX,
StateDCAY,
StateRepeatChar,
StateRepeatCount,
StateTone1,
StateTone2,
StateToneDuration
};
-(const char *)termName
{
return "proterm-special";
}
-(NSString *)name
{
return @"Proterm Special Emulation";
}
-(void)reset
{
_state = StateText;
}
-(void)processCharacter:(uint8_t)c screen:(Screen *)screen output:(OutputChannel *)output
{
if (_state == StateText)
{
switch (c)
{
case CTRL('N'):
//Set: inverse off, mousetext off.
screen->setFlag(Screen::FlagNormal);
break;
case CTRL('O'):
//Set: inverse on, mousetext off.
screen->setFlag(Screen::FlagInverse);
break;
case CTRL('P'):
//Set inverse off, mousetext on.
screen->setFlag(Screen::FlagMouseText);
break;
case CTRL('H'):
//Move cursor left one character.
screen->decrementX();
break;
case CTRL('U'):
//Move cursor right one character.
screen->incrementX();
break;
case CTRL('K'):
//Move cursor up one line.
screen->decrementY();
break;
case CTRL('J'):
//Move cursor down one line.
screen->incrementY();
break;
case CTRL('I'):
//Move cursor to next tab stop (every 8 chars).
screen->setX((screen->x() + 8) & 0x07);
break;
case CTRL('A'):
//Move cursor to beginning of line.
screen->setX(0);
break;
case CTRL('B'):
//Move cursor to end of line.
screen->setX(screen->width() - 1);
break;
case CTRL('X'):
//Move cursor to upper-left corner.
screen->setCursor(0, 0);
break;
case CTRL('^'):
// CONTROL-^, X + 32, Y + 32
//Position cursor to the X, Y coordinates.
_state = StateDCAX;
break;
case CTRL('M'):
screen->lineFeed();
screen->setX(0);
break;
case CTRL('D'):
//Delete current character (under cursor).
break;
case CTRL('F'):
//Insert space at cursor.
break;
case CTRL('Z'):
//Delete current line.
break;
case CTRL('V'):
//Insert blank like.
break;
case CTRL('Y'):
//Clear to end of line.
screen->eraseLine();
break;
case CTRL('W'):
//Clear to end of screen.
screen->eraseScreen();
break;
case CTRL('L'):
//Clear the screen (and home cursor)
screen->setCursor(0, 0);
screen->eraseScreen();
break;
case CTRL('E'):
//Inquire if using ProTERM Special Emulation
/*
* When you send out [CONTROL-E] to a caller using ProTERM
* Special, the callers ProTERM will send back [CONTROL-“]”]
* (ASCII code 29). This allows a BBS to transparently
* detect the use of PSE.
*/
output->write(29);
break;
case CTRL('R'):
//CONTROL-R, character, count
//Display character, count times.
/*
* This allows a three character code to be used to display
* multiple characters. For example, to display a window frame,
* it is necessary to show the top and bottom borders which are
* long lines of the same character (dashes, underlines, etc.).
* To draw a 64-character line consisting of equal signs, send
* [CONTROL-R = @] where “@” is the ASCII code for 64.
*/
_state = StateRepeatChar;
break;
case CTRL('G'):
//Sound the Bell.
NSBeep();
break;
case CTRL('T'):
//Sound single/dual-tone for duration.
/*
* The tone command has two forms. The first invokes the single-tone
* generator, which produces relatively pure tones. The second
* invokes the dual-tone generator, which produces some rather
* interesting sounds. The three parameters, tone1, tone2, and
* duration, can all take values from 1 through 127. There is
* currently no known translation between pitch/duration values
* and actual frequencies/times.
*/
//NB - parsed but ignored, for now.
_state = StateTone1;
break;
}
return;
}
switch (_state)
{
case StateDCAX:
_dca.x = c - 32;
_state = StateDCAY;
break;
case StateDCAY:
_dca.y = c - 32;
screen->setCursor(_dca);
_state = StateText;
break;
case StateRepeatChar:
_repeatChar = c;
_state = StateRepeatCount;
break;
case StateRepeatCount:
for (unsigned i = 0; i < c; ++i)
{
screen->putc(_repeatChar);
}
_state = StateText;
break;
case StateTone1:
_state = StateTone2;
break;
case StateTone2:
// CONTROL-A indicates same as tone1.
_state = StateToneDuration;
break;
case StateToneDuration:
_state = StateText;
break;
}
}
@end

View File

@ -31,6 +31,14 @@ class Screen {
public: public:
static const unsigned FlagNormal = 0x00;
static const unsigned FlagInverse = 0x01;
static const unsigned FlagMouseText = 0x02;
static const unsigned FlagBold = 0x04;
static const unsigned FlagUnderscore = 0x08;
static const unsigned FlagBlink = 0x10;
Screen(unsigned height = 24, unsigned width = 80); Screen(unsigned height = 24, unsigned width = 80);
int x() const; int x() const;