home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
550b.lha
/
Term_v1.8a
/
Source.LZH
/
termData.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-20
|
15KB
|
617 lines
/* $Revision Header * Header built automatically - do not edit! *************
*
* (C) Copyright 1990 by Olaf 'Olsen' Barthel & MXM
*
* Name .....: TermData.c
* Created ..: Monday 21-Jan-91 20:12
* Revision .: 0
*
* Date Author Comment
* ========= ======== ====================
* 21-Jan-91 Olsen Created this file!
*
* $Revision Header ********************************************************/
#include "TermGlobal.h"
/* Libraries. */
struct ExecBase *SysBase;
struct DosLibrary *DOSBase;
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *GadToolsBase;
struct Library *DiskfontBase;
struct Device *TimerBase;
struct Library *AslBase;
struct RxsLib *RexxSysBase;
struct Library *IFFParseBase;
struct Library *CxBase;
struct Library *LayersBase;
/* Timer device. */
struct timerequest *TimeRequest;
/* Console device. */
struct IOStdReq *ConsoleRequest;
struct Device *ConsoleDevice;
/* Screen & Windows. */
struct Screen *Screen;
struct Window *Window;
struct Window *StatusWindow;
APTR OldWindowPtr;
/* Graphics rendering. */
struct ViewPort *VPort;
struct RastPort *RPort;
struct TextFont *Topaz;
struct TextFont *IBM;
struct TextFont *GFX;
APTR VisualInfo;
UWORD ANSIPens[numDrIPens + 1] =
{
0,4,4,7,4,6,4,0,7,~0
};
UWORD EGAPens[numDrIPens + 1] =
{
0,8,8,15,8,7,8,0,15,~0
};
UWORD AtomicColours[16] =
{
0x000,
0xDDD,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000,
0x000
};
UWORD EGAColours[16] =
{
0x000, /* Black. */
0xA00, /* Dark red. */
0x0A0, /* Dark green. */
0xA60, /* Dark yellow (orange). */
0x00A, /* Dark blue. */
0xA0A, /* Dark magenta.*/
0x0AA, /* Dark cyan. */
0xBBB, /* Light grey. */
0x666, /* Dark grey. */
0xF00, /* Red. */
0x0F0, /* Green. */
0xFF0, /* Yellow. */
0x00F, /* Blue. */
0xF0F, /* Magenta. */
0x0FF, /* Cyan. */
0xFFF /* White. */
};
UWORD ANSIColours[16] =
{
0x000, /* Black. */
0xF00, /* Red. */
0x0F0, /* Green. */
0xFF0, /* Yellow. */
0x00F, /* Blue. */
0xF0F, /* Magenta. */
0x0FF, /* Cyan. */
0xFFF, /* White. */
0x000, /* Black. */
0xF00, /* Red. */
0x0F0, /* Green. */
0xFF0, /* Yellow. */
0x00F, /* Blue. */
0xF0F, /* Magenta. */
0x0FF, /* Cyan. */
0xFFF /* White. */
};
UWORD DefaultColours[16],BlinkColours[16],StandardColours[16];
/* DOS data. */
struct Process *ThisProcess;
struct Task *StatusTask;
struct Process *BufferProcess;
struct Process *RexxProcess;
struct MsgPort *TermRexxPort;
struct WBStartup *WBenchMsg;
struct TermPort *TermPort;
BPTR RemoteCurrentDir;
/* Character conversion. */
struct InputEvent *FakeInputEvent;
/* Serial I/O. */
struct IOExtSer *ReadRequest;
struct IOExtSer *WriteRequest;
struct MsgPort *ReadPort;
APTR ReadBuffer;
/* Hotkeys. */
struct Hotkeys Hotkeys;
struct NewBroker NewTermBroker =
{
NB_VERSION,
"term",
"term © 1990,91 by MXM",
"Terminal program",
0,0,0,NULL,0
};
/* Static default fonts. */
struct TextAttr DefaultFont =
{
(UBYTE *)"topaz.font",
8,
FS_NORMAL,
FPF_ROMFONT
};
struct TextAttr IBMFont =
{
(UBYTE *)"IBM.font",
8,
FS_NORMAL,
FPF_DISKFONT
};
struct TextAttr GFXFont =
{
(UBYTE *)"GFX.font",
8,
FS_NORMAL,
FPF_DISKFONT
};
/* Audio data. */
UBYTE AnyChannel[4] =
{
LEFT0F,
LEFT1F,
RIGHT0F,
RIGHT1F,
};
UBYTE __chip SineWave[8] =
{
90,
127,
90,
0,
-90,
-127,
-90,
0
};
struct IOAudio *AudioBlock;
/* Character lookup tables. */
BYTE ValidTab[256] =
{
0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,
0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
};
/* IBM <-> Amiga/DEC font conversion. */
UBYTE IBMConversion[256] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,
0x00,0x11,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x00,0x00,0x00,0x00,
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xAD,0x9B,0x9C,0x00,0x9D,0x00,0x15,0x00,0x00,0xA6,0x00,0x00,0x00,0xAE,0x00,
0xF8,0xF1,0xFD,0x00,0x00,0xE6,0x14,0xF9,0x00,0x00,0xA7,0xAF,0xAC,0xAB,0x00,0xA8,
0x00,0x00,0x00,0x00,0x8E,0x8F,0x92,0x80,0x00,0x90,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xA5,0x00,0x00,0x00,0x00,0x99,0x00,0x00,0x00,0x00,0x00,0x9A,0x00,0x00,0xE1,
0x85,0xA0,0x83,0x00,0x84,0x86,0x91,0x87,0x8A,0x82,0x88,0x89,0x8D,0xA1,0x8C,0x00,
0x00,0xA4,0x95,0xA2,0x93,0x00,0x94,0x00,0x00,0x97,0xA3,0x96,0x81,0x00,0x00,0x98
};
/* Special character treatment. */
struct SpecialKey SpecialKeys[SPECIALKEYS] =
{
BEL, DoSomeBeep, /* Ring the bell. */
XON, XOn, /* Flow control - stop output. */
BKS, DoBackspace, /* Erase a character. */
ENT, DoLF_FF_VT, /* Enter key. */
FFD, DoFF, /* Form feed. */
VTB, DoLF_FF_VT, /* Vertical tab (huh?). */
RET, DoCR, /* Return key. */
TAB, DoTab, /* Move to next tab stop. */
'\16', DoIgnore, /* ^N shift in (trapped). */
'\17', DoIgnore, /* ^O shift out (trapped). */
'\30', DoCancel, /* Cancel ESC sequence. */
'\32', DoCancel /* Cancel ESC sequence. */
};
UBYTE SpecialMap[256];
/* Shared global string formatting buffer. */
UBYTE SharedBuffer[512];
/* Screen pull-down-menu. */
struct NewMenu TermMenu[] =
{
{ NM_TITLE, "Project", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Open Preferences...", "O", 0, 0, (APTR)MEN_OPEN},
{ NM_ITEM, "Save Preferences", 0 , 0, 0, (APTR)MEN_SAVE},
{ NM_ITEM, "Save Preferences As...", "S", 0, 0, (APTR)MEN_SAVEAS},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Print Screen", "P", 0, 0, (APTR)MEN_PRINTSCREEN},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "About...", "?", 0, 0, (APTR)MEN_ABOUT},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Quit...", "Q", 0, 0, (APTR)MEN_QUIT},
{ NM_TITLE, "Utilities", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Set Console Window...", "W", 0, 0, (APTR)MEN_SETCONSOLE},
{ NM_ITEM, "Execute AmigaDOS Command...", "A", 0, 0, (APTR)MEN_DOSCOMMAND},
{ NM_ITEM, "Execute ARexx Command...", "R", 0, 0, (APTR)MEN_REXXCOMMAND},
{ NM_ITEM, "Edit File...", ".", 0, 0, (APTR)MEN_EDIT},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Paste Clipboard Contents", "V", 0, 0, (APTR)MEN_PASTE},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Packet Window...", "-", 0, 0, (APTR)MEN_PACKET},
{ NM_TITLE, "Capture & Buffer", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Clear Buffer", "K", 0, 0, (APTR)MEN_CLEARBUFFER},
{ NM_ITEM, "Display Buffer...", "B", 0, 0, (APTR)MEN_DISPLAYBUFFER},
{ NM_ITEM, "Close Buffer", "J", 0, 0, (APTR)MEN_CLOSEBUFFER},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Load Buffer...", "(", 0, 0, (APTR)MEN_LOADBUFFER},
{ NM_ITEM, "Save Buffer...", ")", 0, 0, (APTR)MEN_SAVEBUFFER},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Capture To Disk...", "[", CHECKIT|MENUTOGGLE, 0, (APTR)MEN_CAPTUREDISK},
{ NM_ITEM, "Capture To Printer", "]", CHECKIT|MENUTOGGLE, 0, (APTR)MEN_CAPTUREPRINTER},
{ NM_TITLE, "Transfer", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Upload Text...", "T", 0, 0, (APTR)MEN_UPLOADTEXT},
{ NM_ITEM, "Download Text...", "G", 0, 0, (APTR)MEN_DOWNLOADTEXT},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Send ASCII...", ">", 0, 0, (APTR)MEN_SEND},
{ NM_ITEM, "Receive ASCII...", "<", 0, 0, (APTR)MEN_RECEIVE},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Upload Files(s)...", "U", 0, 0, (APTR)MEN_UPLOAD},
{ NM_ITEM, "Download File(s)...", "D", 0, 0, (APTR)MEN_DOWNLOAD},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Transfer Options...", "7", 0, 0, (APTR)MEN_XFERPROTOCOL},
{ NM_ITEM, "Select Transfer Protocol...", "8", 0, 0, (APTR)MEN_SELECTXFER},
{ NM_TITLE, "Modem", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Phonebook...", "F", 0, 0, (APTR)MEN_PHONEBOOK},
{ NM_ITEM, "Dial...", "L", 0, 0, (APTR)MEN_DIAL},
{ NM_ITEM, "Redial...", "E", 0, 0, (APTR)MEN_REDIAL},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Play Number...", "!", 0, 0, (APTR)MEN_PLAY},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Send Break", "X", 0, 0, (APTR)MEN_SENDBREAK},
{ NM_ITEM, "Hang Up", "H", 0, 0, (APTR)MEN_HANGUP},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Release Serial Device...", "Z", 0, 0, (APTR)MEN_RELEASE},
{ NM_TITLE, "Display", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Reset Styles", "Y", 0, 0, (APTR)MEN_RESETSTYLES},
{ NM_ITEM, "Clear Screen", "C", 0, 0, (APTR)MEN_CLEARSCREEN},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Save Screen (IFF-ILBM)...", 0 , 0, 0, (APTR)MEN_SAVEILBM},
{ NM_ITEM, "Save Screen (ASCII)...", 0 , 0, 0, (APTR)MEN_SAVEASCII},
{ NM_TITLE, "Preferences", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Serial...", "1", 0, 0, (APTR)MEN_SERIAL},
{ NM_ITEM, "Modem...", "2", 0, 0, (APTR)MEN_MODEM},
{ NM_ITEM, "Screen...", "3", 0, 0, (APTR)MEN_SCREEN},
{ NM_ITEM, "Terminal...", "4", 0, 0, (APTR)MEN_TERMINAL},
{ NM_ITEM, "Startup...", "5", 0, 0, (APTR)MEN_STARTUP},
{ NM_ITEM, "Paths...", "6", 0, 0, (APTR)MEN_PATH},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Macros...", "M", 0, 0, (APTR)MEN_MACROS},
{ NM_ITEM, "Hotkeys...", "+", 0, 0, (APTR)MEN_HOTKEYS},
{ NM_ITEM, "Speech...", "*", 0, 0, (APTR)MEN_SPEECH},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Emulation...", "9", 0, 0, (APTR)MEN_EMULATION},
{ NM_END, 0, 0 , 0, 0, (APTR)0},
};
struct Menu *Menu;
/* Pointer. */
USHORT __chip Stopwatch[(2 + 16) * 2] =
{
0x0000,0x0000,
0x0400,0x07C0,
0x0000,0x07C0,
0x0100,0x0380,
0x0000,0x07E0,
0x07C0,0x1FF8,
0x1FF0,0x3FEC,
0x3FF8,0x7FDE,
0x3FF8,0x7FBE,
0x7FFC,0xFF7F,
0x7EFC,0xFFFF,
0x7FFC,0xFFFF,
0x3FF8,0x7FFE,
0x3FF8,0x7FFE,
0x1FF0,0x3FFC,
0x07C0,0x1FF8,
0x0000,0x07E0,
0x0000,0x0000
};
/* Configuration. */
struct Configuration Config;
struct Configuration PrivateConfig;
struct SpeechConfig SpeechConfig;
BYTE Status;
BYTE Online;
UWORD PublicModes;
UBYTE LastConfig[256];
UBYTE DefaultPubScreen[MAXPUBSCREENNAME];
/* These are the sixteen more or less different display modes the
* term main and buffer display screens will be opened in.
*/
ULONG ModeID[16] =
{
DEFAULT_MONITOR_ID|HIRES_KEY,
DEFAULT_MONITOR_ID|HIRESLACE_KEY,
DEFAULT_MONITOR_ID|SUPER_KEY,
DEFAULT_MONITOR_ID|SUPERLACE_KEY,
DEFAULT_MONITOR_ID|VGAPRODUCT_KEY,
DEFAULT_MONITOR_ID|VGAPRODUCTLACE_KEY,
PAL_MONITOR_ID|HIRES_KEY,
PAL_MONITOR_ID|HIRESLACE_KEY,
PAL_MONITOR_ID|SUPER_KEY,
PAL_MONITOR_ID|SUPERLACE_KEY,
NTSC_MONITOR_ID|HIRES_KEY,
NTSC_MONITOR_ID|HIRESLACE_KEY,
NTSC_MONITOR_ID|SUPER_KEY,
NTSC_MONITOR_ID|SUPERLACE_KEY,
A2024TENHERTZ_KEY,
A2024FIFTEENHERTZ_KEY
};
/* Capture file. */
BPTR FileCapture;
BPTR PrinterCapture;
UBYTE CaptureName[256];
/* Buffer. */
UBYTE **BufferLines;
LONG Lines;
struct SignalSemaphore *BufferSemaphore;
LONG MaxLines = 100;
LONG BufferSpace;
/* Phonebook. */
struct PhoneEntry **Phonebook;
LONG PhoneSize;
LONG NumPhoneEntries;
UBYTE LastPhone[256];
UBYTE LastKeys[256];
UBYTE LastMacros[256];
UBYTE LastSpeech[256];
struct MacroKeys *MacroKeys;
struct List EmptyList;
/* Console stuff. */
UWORD LastLine,LastColumn;
BYTE Charset,Attributes,FgPen,BgPen;
SHORT CursorX,CursorY,Top,Bottom;
BYTE UseRegion,InSequence,Quiet;
BYTE TabStops[1024];
struct CursorData CursorBackup;
BYTE ResetDisplay = FALSE,Escape = FALSE;
/* Flow filter. */
UBYTE *AttentionBuffers[7],AttentionCount[7],FlowCount;
BYTE BaudPending,FullCheck;
UBYTE BaudBuffer[20],BaudCount;
struct FlowInfo FlowInfo;
/* Transfer data. */
LONG FileCount,FileCountMax;
struct WBArg *FileArg;
BYTE MultipleFiles,FileMatch,BinaryTransfer;
struct AnchorPath *FileAnchor;
LONG TransferBits;
struct Window *TransferWindow;
struct Menu *TransferMenu;
struct Library *XProtocolBase;
struct XPR_IO *XprIO;
UBYTE ProtocolOptsBuffer[256];
BYTE NewLibrary,NewOptions;
UBYTE LastXprLibrary[60];
BYTE UsesZModem;
/* Pay per minute. */
LONG CurrentPay;
LONG PayPerUnit[2];
LONG SecPerUnit[2];
LONG TimeOfDay[2];
SHORT PreferredTime;
UBYTE Password[40];
/* Execute a command/script. */
UBYTE WindowName[256];
/* Rexx server info. */
BYTE WeAreBlocking;
/* "Sub" Dial panel. */
struct List *SubList;
LONG SubItemNum;
struct Window *SubWindow;
LONG SubListNum;
BYTE SendStartup;
/* TermMain data. */
BYTE ReleaseSerial;
BYTE ResetSerial;
BYTE BatchMode;
/* Upload/Download paths. */
UBYTE LastDownload[256];
UBYTE LastUpload[256];
/* String gadgets hooks. */
struct Hook CommandHook;
BYTE DontActivate;
UBYTE CommandWorkBuffer[256];
struct StringExtend CommandExtend =
{
(struct TextFont *)NULL,
1,0,
1,0,
SGM_NOFILTER,
&CommandHook,
CommandWorkBuffer
};
struct Window *CommandWindow;
struct Gadget *CommandGadget;
struct Gadget *ActiveGadget;
/* Packet window. */
struct Window *PacketWindow;
struct Gadget *PacketGadgetArray[1];
struct Menu *PacketMenu;
struct Gadget *PacketGadgetList;
struct List PacketHistoryList;
/* Some more colour control flags. */
BYTE Initializing,LoadColours;
/* The character raster. */
UBYTE *Raster;
SHORT RasterWidth,RasterHeight;
/* File download tracking. */
struct SignalSemaphore *DownloadSemaphore;
struct List DownloadList;
LONG DownloadLineCount;
struct Node *DownloadNode;
/* Rexx scanning sequences. */
struct List SequenceList;
LONG SequenceCount;
/* File version test. */
ULONG VersionProps[2] =
{
'TERM',
'VERS'
};
/* Cause a rexx command to terminate without waiting. */
BYTE ExitQuietly;
/* The ARexx output window. */
struct Window *RexxWindow;
/* Window stack. */
struct Window *TopWindow;
struct Window *WindowStack[5];
SHORT WindowStackPtr;
/* Global term ID. */
LONG TermID;
UBYTE TermIDString[20];