\r
#include <string.h>\r
\r
-static const uint16_t FIRMWARE_VERSION = 0x0603;\r
+static const uint16_t FIRMWARE_VERSION = 0x0604;\r
\r
// 1 flash row\r
static const uint8_t DEFAULT_CONFIG[128] =\r
static void\r
scsiTestCommand()\r
{\r
- int resultCode = 0; // TODO scsiSelfTest();\r
+ int resultCode = scsiSelfTest();\r
uint8_t response[] =\r
{\r
resultCode == 0 ? S2S_CFG_STATUS_GOOD : S2S_CFG_STATUS_ERR,\r
// You should have received a copy of the GNU General Public License\r
// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.\r
\r
+#include "stm32f2xx.h"\r
+\r
#include "scsi.h"\r
#include "scsiPhy.h"\r
#include "config.h"\r
int prep = 0;\r
int i = 0;\r
int scsiActive = 0;\r
- // int sdActive = 0;\r
+ int sdActive = 0;\r
while ((i < totalSDSectors) &&\r
likely(scsiDev.phase == DATA_IN) &&\r
likely(!scsiDev.resetFlag))\r
// Wait for the next DMA interrupt. It's beneficial to halt the\r
// processor to give the DMA controller more memory bandwidth to\r
// work with.\r
-#if 0\r
- int scsiBusy = 1;\r
- int sdBusy = 1;\r
- while (scsiBusy && sdBusy)\r
+ if (sdActive && scsiActive)\r
{\r
- uint8_t intr = CyEnterCriticalSection();\r
- scsiBusy = scsiDMABusy();\r
- sdBusy = sdDMABusy();\r
- if (scsiBusy && sdBusy)\r
- {\r
- __WFI();\r
- }\r
- CyExitCriticalSection(intr);\r
+ __WFI();\r
}\r
-#endif\r
\r
-#if 0\r
- if (sdActive && !sdBusy && sdReadSectorDMAPoll())\r
+ if (sdActive && sdReadDMAPoll())\r
{\r
+ prep += sdActive;\r
sdActive = 0;\r
- prep++;\r
}\r
\r
- // Usually SD is slower than the SCSI interface.\r
- // Prioritise starting the read of the next sector over starting a\r
- // SCSI transfer for the last sector\r
- // ie. NO "else" HERE.\r
if (!sdActive &&\r
(prep - i < buffers) &&\r
(prep < totalSDSectors))\r
{\r
// Start an SD transfer if we have space.\r
- if (transfer.multiBlock)\r
+ uint32_t startBuffer = prep % buffers;\r
+ uint32_t sectors = totalSDSectors - prep;\r
+ if (!scsiActive && prep == i)\r
{\r
- sdReadMultiSectorDMA(&scsiDev.data[SD_SECTOR_SIZE * (prep % buffers)]);\r
+ sectors = 1; // We need to get some data to send ASAP !\r
}\r
else\r
{\r
- sdReadSingleSectorDMA(sdLBA + prep, &scsiDev.data[SD_SECTOR_SIZE * (prep % buffers)]);\r
+ uint32_t freeBuffers = buffers - (prep - i);\r
+ uint32_t contiguousBuffers = buffers - startBuffer;\r
+ freeBuffers = freeBuffers < contiguousBuffers\r
+ ? freeBuffers : contiguousBuffers;\r
+ sectors = sectors < freeBuffers ? sectors : freeBuffers;\r
}\r
- sdActive = 1;\r
- }\r
-#endif\r
-#if 0\r
- uint32_t maxSectors = sizeof(scsiDev.data) / SD_SECTOR_SIZE;\r
- uint32_t rem = totalSDSectors - i;\r
- uint32_t sectors =\r
- rem < maxSectors ? rem : maxSectors;\r
- sdTmpRead(&scsiDev.data[0], i + sdLBA, sectors);\r
- scsiWrite(&scsiDev.data[0], sectors * SD_SECTOR_SIZE);\r
- i += sectors;\r
-#endif\r
- if ((prep - i < buffers) &&\r
- (prep < totalSDSectors))\r
- {\r
- // TODO MM Blocking reads are bad mmkay\r
- sdTmpRead(&scsiDev.data[SD_SECTOR_SIZE * (prep % buffers)], sdLBA + prep, 1);\r
- prep++;\r
+ sdReadDMA(sdLBA + prep, sectors, &scsiDev.data[SD_SECTOR_SIZE * startBuffer]);\r
+\r
+ sdActive = sectors;\r
}\r
\r
if (scsiActive && scsiPhyComplete() && scsiWriteDMAPoll())\r
likely(scsiDev.phase == DATA_IN) &&\r
likely(!scsiDev.resetFlag))\r
{\r
-#if 0\r
- _WFI();\r
-#endif\r
+ __WFI();\r
}\r
\r
\r
transfer.currentBlock = 0;\r
\r
// Cancel long running commands!\r
+#if 0\r
if (\r
((scsiDev.boardCfg.flags & S2S_CFG_ENABLE_CACHE) == 0) ||\r
(transfer.multiBlock == 0)\r
)\r
+#endif\r
{\r
-#if 0\r
sdCompleteTransfer();\r
-#endif\r
}\r
\r
transfer.multiBlock = 0;\r
}\r
else\r
{\r
-#if 0\r
// Wait for our 1ms timer to save some power.\r
// There's an interrupt on the SEL signal to ensure we respond\r
// quickly to any SCSI commands. The selection abort time is\r
// only 250us, and new SCSI-3 controllers time-out very\r
// not long after that, so we need to ensure we wake up quickly.\r
- uint8_t interruptState = CyEnterCriticalSection();\r
- if (!SCSI_ReadFilt(SCSI_Filt_SEL))\r
+ uint32_t interruptState = __get_PRIMASK();\r
+ __disable_irq();\r
+\r
+ if (!*SCSI_STS_SELECTED)\r
{\r
__WFI(); // Will wake on interrupt, regardless of mask\r
}\r
- CyExitCriticalSection(interruptState);\r
-#endif\r
+ if (!interruptState)\r
+ {\r
+ __enable_irq();\r
+ }\r
}\r
}\r
else if (scsiDev.phase >= 0)\r
\r
uint8_t selStatus = *SCSI_STS_SELECTED;\r
\r
-#if 0\r
- int sel = SCSI_ReadFilt(SCSI_Filt_SEL);\r
- int bsy = SCSI_ReadFilt(SCSI_Filt_BSY);\r
- int io = SCSI_ReadPin(SCSI_In_IO);\r
-\r
- // Only read these pins AFTER SEL and BSY - we don't want to catch them\r
- // during a transition period.\r
- uint8_t mask = scsiReadDBxPins();\r
- int atnFlag = SCSI_ReadFilt(SCSI_Filt_ATN);\r
-#endif\r
int tgtIndex;\r
TargetState* target = NULL;\r
for (tgtIndex = 0; tgtIndex < S2S_MAX_TARGETS; ++tgtIndex)\r
// Wait for the next DMA interrupt (or the 1ms systick)\r
// It's beneficial to halt the processor to\r
// give the DMA controller more memory bandwidth to work with.\r
-#if 0\r
__WFI();\r
-#endif\r
trace(trace_spinReadDMAPoll);\r
\r
while (!scsiReadDMAPoll() && likely(!scsiDev.resetFlag))\r
{\r
-#if 0\r
-// TODO NEED SCSI DMA IRQs\r
- __WFI();\r
-#endif\r
+ __WFI();\r
};\r
}\r
\r
// Wait for the next DMA interrupt (or the 1ms systick)\r
// It's beneficial to halt the processor to\r
// give the DMA controller more memory bandwidth to work with.\r
-#if 0\r
__WFI();\r
-#endif\r
trace(trace_spinReadDMAPoll);\r
\r
while (!scsiWriteDMAPoll() && likely(!scsiDev.resetFlag))\r
{\r
-#if 0\r
-// TODO NEED SCSI DMA IRQs\r
- __WFI();\r
-#endif\r
+ __WFI();\r
};\r
}\r
\r
- while (!scsiPhyComplete() && likely(!scsiDev.resetFlag)) {}\r
+ while (!scsiPhyComplete() && likely(!scsiDev.resetFlag))\r
+ {\r
+ __WFI();\r
+ }\r
\r
#if FIFODEBUG\r
if (!scsiPhyFifoAltEmpty()) {\r
#endif\r
\r
scsiPhyFifoFlip();\r
-#if 0\r
-// TODO NEED SCSI IRQs\r
- __WFI();\r
-#endif\r
-\r
i += chunk;\r
}\r
- while (!scsiPhyComplete() && likely(!scsiDev.resetFlag)) {}\r
+ while (!scsiPhyComplete() && likely(!scsiDev.resetFlag))\r
+ {\r
+ __WFI();\r
+ }\r
\r
#if FIFODEBUG\r
if (!scsiPhyFifoAltEmpty()) {\r
\r
scsiPhyFifoSel = 0;\r
*SCSI_FIFO_SEL = 0;\r
+ *SCSI_CTRL_DBX = 0;\r
\r
// DMA Benchmark code\r
// Currently 10MB/s. Assume 20MB/s is achievable with 16 bits.\r
\r
// FPGA comms test code\r
#ifdef FPGA_TEST\r
-\r
while(1)\r
{\r
for (int j = 0; j < SCSI_FIFO_DEPTH; ++j)\r
scsiDev.data[j] = j;\r
}\r
\r
+ if (!scsiPhyFifoEmpty())\r
+ {\r
+ assertFail();\r
+ }\r
+\r
*SCSI_CTRL_PHASE = DATA_IN;\r
HAL_DMA_Start(\r
&memToFSMC,\r
HAL_DMA_FULL_TRANSFER,\r
0xffffffff);\r
\r
+ if (!scsiPhyFifoFull())\r
+ {\r
+ assertFail();\r
+ }\r
+\r
memset(&scsiDev.data[0], 0, SCSI_FIFO_DEPTH);\r
\r
*SCSI_CTRL_PHASE = DATA_OUT;\r
HAL_DMA_FULL_TRANSFER,\r
0xffffffff);\r
\r
+ if (!scsiPhyFifoEmpty())\r
+ {\r
+ assertFail();\r
+ }\r
+\r
+\r
for (int j = 0; j < SCSI_FIFO_DEPTH; ++j)\r
{\r
if (scsiDev.data[j] != (uint8_t) j)\r
*SCSI_CTRL_BSY = 0x00;\r
scsiPhyFifoSel = 0;\r
*SCSI_FIFO_SEL = 0;\r
+ *SCSI_CTRL_DBX = 0;\r
\r
}\r
\r
// 32 = other error\r
int scsiSelfTest()\r
{\r
- return 0;\r
-#if 0\r
+ if (scsiDev.phase != BUS_FREE)\r
+ {\r
+ return 32;\r
+ }\r
+\r
+ // Acquire the SCSI bus.\r
+ for (int i = 0; i < 100; ++i)\r
+ {\r
+ if (scsiStatusBSY())\r
+ {\r
+ s2s_delay_ms(1);\r
+ }\r
+ }\r
+ if (scsiStatusBSY())\r
+ {\r
+ // Error, couldn't acquire scsi bus\r
+ return 32;\r
+ }\r
+ *SCSI_CTRL_BSY = 1;\r
+ if (! scsiStatusBSY())\r
+ {\r
+ // Error, BSY doesn't work.\r
+ return 32;\r
+ }\r
+\r
+ // Should be safe to use the bus now.\r
+\r
int result = 0;\r
\r
- // TEST DBx and DBp\r
+ // TEST DBx\r
+ // TODO test DBp\r
int i;\r
- SCSI_Out_Ctl_Write(1); // Write bits manually.\r
- SCSI_CTL_PHASE_Write(__scsiphase_io); // Needed for parity generation\r
for (i = 0; i < 256; ++i)\r
{\r
- SCSI_Out_Bits_Write(i);\r
- scsiDeskewDelay();\r
- if (scsiReadDBxPins() != (i & 0xff))\r
+ *SCSI_CTRL_DBX = i;\r
+ busSettleDelay();\r
+ if (*SCSI_STS_DBX != (i & 0xff))\r
{\r
result |= 1;\r
}\r
- if (Lookup_OddParity[i & 0xff] != SCSI_ReadPin(SCSI_In_DBP))\r
+ /*if (Lookup_OddParity[i & 0xff] != SCSI_ReadPin(SCSI_In_DBP))\r
{\r
result |= 2;\r
- }\r
+ }*/\r
}\r
- SCSI_Out_Ctl_Write(0); // Write bits normally.\r
+ *SCSI_CTRL_DBX = 0;\r
\r
// TEST MSG, CD, IO\r
+ /* TODO\r
for (i = 0; i < 8; ++i)\r
{\r
SCSI_CTL_PHASE_Write(i);\r
}\r
SCSI_ClearPin(signalsOut[i]);\r
}\r
+ */\r
+\r
+ *SCSI_CTRL_BSY = 0;\r
return result;\r
-#endif\r
}\r
\r
#define SCSI_DATA_CNT_HI ((volatile uint8_t*)0x60000004)
#define SCSI_DATA_CNT_LO ((volatile uint8_t*)0x60000005)
#define SCSI_DATA_CNT_SET ((volatile uint8_t*)0x60000006)
+#define SCSI_CTRL_DBX ((volatile uint8_t*)0x60000007)
#define SCSI_STS_FIFO ((volatile uint8_t*)0x60000010)
#define SCSI_STS_ALTFIFO ((volatile uint8_t*)0x60000011)
void sdTmpWrite(uint8_t* data, uint32_t lba, int sectors);
#if 0
-
-
-
-
-#define SCSI_SetPin(pin) \
- CyPins_SetPin((pin));
-
-#define SCSI_ClearPin(pin) \
- CyPins_ClearPin((pin));
-
-// Active low: we interpret a 0 as "true", and non-zero as "false"
-#define SCSI_ReadPin(pin) \
- (CyPins_ReadPin((pin)) == 0)
-
-// These signals go through a glitch filter - we do not access the pin
-// directly
-enum FilteredInputs
-{
- SCSI_Filt_ATN = 0x01,
- SCSI_Filt_BSY = 0x02,
- SCSI_Filt_SEL = 0x04,
- SCSI_Filt_RST = 0x08,
- SCSI_Filt_ACK = 0x10
-};
-#define SCSI_ReadFilt(filt) \
- ((SCSI_Filtered_Read() & (filt)) == 0)
-
-// SCSI delays, as referenced to the cpu clock
-#define CPU_CLK_PERIOD_NS (1000000000U / BCLK__BUS_CLK__HZ)
-#define scsiDeskewDelay() CyDelayCycles((55 / CPU_CLK_PERIOD_NS) + 1)
-
// Contains the odd-parity flag for a given 8-bit value.
extern const uint8_t Lookup_OddParity[256];
void scsiWriteDMA(const uint8_t* data, uint32_t count);
int scsiWriteDMAPoll();
-#if 0
-uint8_t scsiReadDBxPins(void);
-
-
int scsiSelfTest(void);
#endif
-
-#endif
// Global\r
SdDevice sdDev;\r
\r
-#if 0\r
-enum SD_CMD_STATE { CMD_STATE_IDLE, CMD_STATE_READ, CMD_STATE_WRITE };\r
-static int sdCmdState = CMD_STATE_IDLE;\r
-static uint32_t sdCmdNextLBA; // Only valid in CMD_STATE_READ or CMD_STATE_WRITE\r
-static uint32_t sdCmdTime;\r
-static uint32_t sdLastCmdState = CMD_STATE_IDLE;\r
-\r
-enum SD_IO_STATE { SD_DMA, SD_ACCEPTED, SD_IDLE };\r
-static int sdIOState = SD_IDLE;\r
-\r
-// Private DMA variables.\r
-static uint8 sdDMARxChan = CY_DMA_INVALID_CHANNEL;\r
-static uint8 sdDMATxChan = CY_DMA_INVALID_CHANNEL;\r
-\r
-// Dummy location for DMA to send unchecked CRC bytes to\r
-static uint8 discardBuffer __attribute__((aligned(4)));\r
-\r
-// 2 bytes CRC, response, 8bits to close the clock..\r
-// "NCR" time is up to 8 bytes.\r
-static uint8_t writeResponseBuffer[8] __attribute__((aligned(4)));\r
-\r
-// Padded with a dummy byte just to allow the tx DMA channel to\r
-// use 2-byte bursts for performance.\r
-static uint8_t writeStartToken[2] __attribute__((aligned(4))) = {0xFF, 0xFC};\r
-\r
-// Source of dummy SPI bytes for DMA\r
-static uint8_t dummyBuffer[2] __attribute__((aligned(4))) = {0xFF, 0xFF};\r
-\r
-volatile uint8_t sdRxDMAComplete;\r
-volatile uint8_t sdTxDMAComplete;\r
-\r
-static void sdCompleteRead();\r
-static void sdCompleteWrite();\r
-\r
-CY_ISR_PROTO(sdRxISR);\r
-CY_ISR(sdRxISR)\r
-{\r
- sdRxDMAComplete = 1;\r
-}\r
-CY_ISR_PROTO(sdTxISR);\r
-CY_ISR(sdTxISR)\r
-{\r
- sdTxDMAComplete = 1;\r
-}\r
-\r
-static uint8 sdCrc7(uint8* chr, uint8 cnt, uint8 crc)\r
-{\r
- uint8 a;\r
- for(a = 0; a < cnt; a++)\r
- {\r
- uint8 Data = chr[a];\r
- uint8 i;\r
- for(i = 0; i < 8; i++)\r
- {\r
- crc <<= 1;\r
- if( (Data & 0x80) ^ (crc & 0x80) ) {crc ^= 0x09;}\r
- Data <<= 1;\r
- }\r
- }\r
- return crc & 0x7F;\r
-}\r
-\r
-\r
-// Read and write 1 byte.\r
-static uint8_t sdSpiByte(uint8_t value)\r
-{\r
- SDCard_WriteTxData(value);\r
- trace(trace_spinSpiByte);\r
- while (!(SDCard_ReadRxStatus() & SDCard_STS_RX_FIFO_NOT_EMPTY)) {}\r
- trace(trace_sdSpiByte);\r
- return SDCard_ReadRxData();\r
-}\r
-\r
-static void sdWaitWriteBusy()\r
-{\r
- uint8 val;\r
- do\r
- {\r
- val = sdSpiByte(0xFF);\r
- } while (val != 0xFF);\r
-}\r
-\r
-static void sdPreCmdState(uint32_t newState)\r
-{\r
- if (sdCmdState == CMD_STATE_READ)\r
- {\r
- sdCompleteRead();\r
- }\r
- else if (sdCmdState == CMD_STATE_WRITE)\r
- {\r
- sdCompleteWrite();\r
- }\r
- sdCmdState = CMD_STATE_IDLE;\r
-\r
- if (sdLastCmdState != newState && newState != CMD_STATE_IDLE)\r
- {\r
- sdWaitWriteBusy();\r
- sdLastCmdState = newState;\r
- }\r
-}\r
-\r
-static uint16_t sdDoCommand(\r
- uint8_t cmd,\r
- uint32_t param,\r
- int useCRC,\r
- int use2byteResponse)\r
-{\r
- int waitWhileBusy = (cmd != SD_GO_IDLE_STATE) && (cmd != SD_STOP_TRANSMISSION);\r
-\r
- // "busy" probe. We'll examine the results later.\r
- if (waitWhileBusy)\r
- {\r
- SDCard_WriteTxData(0xFF);\r
- }\r
-\r
- // send is static as the address must remain consistent for the static\r
- // DMA descriptors to work.\r
- // Size must be divisible by 2 to suit 2-byte-burst TX DMA channel.\r
- static uint8_t send[6] __attribute__((aligned(4)));\r
- send[0] = cmd | 0x40;\r
- send[1] = param >> 24;\r
- send[2] = param >> 16;\r
- send[3] = param >> 8;\r
- send[4] = param;\r
- if (unlikely(useCRC))\r
- {\r
- send[5] = (sdCrc7(send, 5, 0) << 1) | 1;\r
- }\r
- else\r
- {\r
- send[5] = 1; // stop bit\r
- }\r
-\r
- static uint8_t dmaRxTd = CY_DMA_INVALID_TD;\r
- static uint8_t dmaTxTd = CY_DMA_INVALID_TD;\r
- if (unlikely(dmaRxTd == CY_DMA_INVALID_TD))\r
- {\r
- dmaRxTd = CyDmaTdAllocate();\r
- dmaTxTd = CyDmaTdAllocate();\r
- CyDmaTdSetConfiguration(dmaTxTd, sizeof(send), CY_DMA_DISABLE_TD, TD_INC_SRC_ADR|SD_TX_DMA__TD_TERMOUT_EN);\r
- CyDmaTdSetAddress(dmaTxTd, LO16((uint32)&send), LO16((uint32)SDCard_TXDATA_PTR));\r
- CyDmaTdSetConfiguration(dmaRxTd, sizeof(send), CY_DMA_DISABLE_TD, SD_RX_DMA__TD_TERMOUT_EN);\r
- CyDmaTdSetAddress(dmaRxTd, LO16((uint32)SDCard_RXDATA_PTR), LO16((uint32)&discardBuffer));\r
- }\r
-\r
- sdTxDMAComplete = 0;\r
- sdRxDMAComplete = 0;\r
-\r
- CyDmaChSetInitialTd(sdDMARxChan, dmaRxTd);\r
- CyDmaChSetInitialTd(sdDMATxChan, dmaTxTd);\r
-\r
- // Some Samsung cards enter a busy-state after single-sector reads.\r
- // But we also need to wait for R1B to complete from the multi-sector\r
- // reads.\r
- if (waitWhileBusy)\r
- {\r
- trace(trace_spinSDRxFIFO);\r
- while (!(SDCard_ReadRxStatus() & SDCard_STS_RX_FIFO_NOT_EMPTY)) {}\r
- int busy = SDCard_ReadRxData() != 0xFF;\r
- if (unlikely(busy))\r
- {\r
- trace(trace_spinSDBusy);\r
- while (sdSpiByte(0xFF) != 0xFF) {}\r
- }\r
- }\r
-\r
- // The DMA controller is a bit trigger-happy. It will retain\r
- // a drq request that was triggered while the channel was\r
- // disabled.\r
- CyDmaChSetRequest(sdDMATxChan, CY_DMA_CPU_REQ);\r
- CyDmaClearPendingDrq(sdDMARxChan);\r
-\r
- // There is no flow control, so we must ensure we can read the bytes\r
- // before we start transmitting\r
- CyDmaChEnable(sdDMARxChan, 1);\r
- CyDmaChEnable(sdDMATxChan, 1);\r
-\r
- trace(trace_spinSDDMA);\r
- int allComplete = 0;\r
- while (!allComplete)\r
- {\r
- uint8_t intr = CyEnterCriticalSection();\r
- allComplete = sdTxDMAComplete && sdRxDMAComplete;\r
- if (!allComplete)\r
- {\r
- __WFI();\r
- }\r
- CyExitCriticalSection(intr);\r
- }\r
-\r
- uint16_t response = sdSpiByte(0xFF); // Result code or stuff byte\r
- if (unlikely(cmd == SD_STOP_TRANSMISSION))\r
- {\r
- // Stuff byte is required for this command only.\r
- // Part 1 Simplified standard 3.01\r
- // "The stop command has an execution delay due to the serial command\r
- // transmission."\r
- response = sdSpiByte(0xFF);\r
- }\r
-\r
- uint32_t start = getTime_ms();\r
-\r
- trace(trace_spinSDBusy);\r
- while ((response & 0x80) && likely(elapsedTime_ms(start) <= 200))\r
- {\r
- response = sdSpiByte(0xFF);\r
- }\r
- if (unlikely(use2byteResponse))\r
- {\r
- response = (response << 8) | sdSpiByte(0xFF);\r
- }\r
- return response;\r
-}\r
-\r
-\r
-static inline uint16_t sdCommandAndResponse(uint8_t cmd, uint32_t param)\r
-{\r
- return sdDoCommand(cmd, param, 0, 0);\r
-}\r
-\r
-static inline uint16_t sdCRCCommandAndResponse(uint8_t cmd, uint32_t param)\r
-{\r
- return sdDoCommand(cmd, param, 1, 0);\r
-}\r
-\r
-// Clear the sticky status bits on error.\r
-static void sdClearStatus()\r
-{\r
- sdSpiByte(0xFF);\r
- uint16_t r2 = sdDoCommand(SD_SEND_STATUS, 0, 1, 1);\r
- (void) r2;\r
-}\r
-\r
-void\r
-sdReadMultiSectorPrep(uint32_t sdLBA, uint32_t sdSectors)\r
-{\r
- uint32_t tmpNextLBA = sdLBA + sdSectors;\r
-\r
- if (!sdDev.ccs)\r
- {\r
- sdLBA = sdLBA * SD_SECTOR_SIZE;\r
- tmpNextLBA = tmpNextLBA * SD_SECTOR_SIZE;\r
- }\r
-\r
- if (sdCmdState == CMD_STATE_READ && sdCmdNextLBA == sdLBA)\r
- {\r
- // Well, that was lucky. We're already reading this data\r
- sdCmdNextLBA = tmpNextLBA;\r
- sdCmdTime = getTime_ms();\r
- }\r
- else\r
- {\r
- sdPreCmdState(CMD_STATE_READ);\r
-\r
- uint8_t v = sdCommandAndResponse(SD_READ_MULTIPLE_BLOCK, sdLBA);\r
- if (unlikely(v))\r
- {\r
- scsiDiskReset();\r
- sdClearStatus();\r
-\r
- scsiDev.status = CHECK_CONDITION;\r
- scsiDev.target->sense.code = HARDWARE_ERROR;\r
- scsiDev.target->sense.asc = LOGICAL_UNIT_COMMUNICATION_FAILURE;\r
- scsiDev.phase = STATUS;\r
- }\r
- else\r
- {\r
- sdCmdNextLBA = tmpNextLBA;\r
- sdCmdState = CMD_STATE_READ;\r
- sdCmdTime = getTime_ms();\r
- }\r
- }\r
-}\r
-\r
-static void\r
-dmaReadSector(uint8_t* outputBuffer)\r
-{\r
- // Wait for a start-block token.\r
- // Don't wait more than 200ms. The standard recommends 100ms.\r
- uint32_t start = getTime_ms();\r
- uint8_t token = sdSpiByte(0xFF);\r
- trace(trace_spinSDBusy);\r
- while (token != 0xFE && likely(elapsedTime_ms(start) <= 200))\r
- {\r
- if (unlikely(token && ((token & 0xE0) == 0)))\r
- {\r
- // Error token!\r
- break;\r
- }\r
- token = sdSpiByte(0xFF);\r
- }\r
- if (unlikely(token != 0xFE))\r
- {\r
- if (transfer.multiBlock)\r
- {\r
- sdCompleteRead();\r
- }\r
- if (scsiDev.status != CHECK_CONDITION)\r
- {\r
- scsiDev.status = CHECK_CONDITION;\r
- scsiDev.target->sense.code = HARDWARE_ERROR;\r
- scsiDev.target->sense.asc = UNRECOVERED_READ_ERROR;\r
- scsiDev.phase = STATUS;\r
- }\r
- sdClearStatus();\r
- return;\r
- }\r
-\r
- static uint8_t dmaRxTd[2] = { CY_DMA_INVALID_TD, CY_DMA_INVALID_TD};\r
- static uint8_t dmaTxTd = CY_DMA_INVALID_TD;\r
- if (unlikely(dmaRxTd[0] == CY_DMA_INVALID_TD))\r
- {\r
- dmaRxTd[0] = CyDmaTdAllocate();\r
- dmaRxTd[1] = CyDmaTdAllocate();\r
- dmaTxTd = CyDmaTdAllocate();\r
-\r
- // Receive 512 bytes of data and then 2 bytes CRC.\r
- CyDmaTdSetConfiguration(dmaRxTd[0], SD_SECTOR_SIZE, dmaRxTd[1], TD_INC_DST_ADR);\r
- CyDmaTdSetConfiguration(dmaRxTd[1], 2, CY_DMA_DISABLE_TD, SD_RX_DMA__TD_TERMOUT_EN);\r
- CyDmaTdSetAddress(dmaRxTd[1], LO16((uint32)SDCard_RXDATA_PTR), LO16((uint32)&discardBuffer));\r
-\r
- CyDmaTdSetConfiguration(dmaTxTd, SD_SECTOR_SIZE + 2, CY_DMA_DISABLE_TD, SD_TX_DMA__TD_TERMOUT_EN);\r
- CyDmaTdSetAddress(dmaTxTd, LO16((uint32)&dummyBuffer), LO16((uint32)SDCard_TXDATA_PTR));\r
-\r
- }\r
- CyDmaTdSetAddress(dmaRxTd[0], LO16((uint32)SDCard_RXDATA_PTR), LO16((uint32)outputBuffer));\r
-\r
- sdIOState = SD_DMA;\r
- sdTxDMAComplete = 0;\r
- sdRxDMAComplete = 0;\r
-\r
- // Re-loading the initial TD's here is very important, or else\r
- // we'll be re-using the last-used TD, which would be the last\r
- // in the chain (ie. CRC TD)\r
- CyDmaChSetInitialTd(sdDMARxChan, dmaRxTd[0]);\r
- CyDmaChSetInitialTd(sdDMATxChan, dmaTxTd);\r
-\r
- // The DMA controller is a bit trigger-happy. It will retain\r
- // a drq request that was triggered while the channel was\r
- // disabled.\r
- CyDmaChSetRequest(sdDMATxChan, CY_DMA_CPU_REQ);\r
- CyDmaClearPendingDrq(sdDMARxChan);\r
-\r
- // There is no flow control, so we must ensure we can read the bytes\r
- // before we start transmitting\r
- CyDmaChEnable(sdDMARxChan, 1);\r
- CyDmaChEnable(sdDMATxChan, 1);\r
-}\r
+static int sdCmdActive = 0;\r
\r
int\r
-sdReadSectorDMAPoll()\r
+sdReadDMAPoll()\r
{\r
- if (sdRxDMAComplete && sdTxDMAComplete)\r
+ if (hsd.DmaTransferCplt ||\r
+ hsd.SdTransferCplt ||\r
+ (HAL_SD_ErrorTypedef)hsd.SdTransferErr != SD_OK)\r
{\r
+ HAL_SD_CheckReadOperation(&hsd, (uint32_t)SD_DATATIMEOUT);\r
// DMA transfer is complete\r
- sdIOState = SD_IDLE;\r
+ sdCmdActive = 0;\r
return 1;\r
}\r
else\r
}\r
}\r
\r
-void sdReadSingleSectorDMA(uint32_t lba, uint8_t* outputBuffer)\r
+void sdReadDMA(uint32_t lba, uint32_t sectors, uint8_t* outputBuffer)\r
{\r
- sdPreCmdState(CMD_STATE_READ);\r
-\r
- uint8 v;\r
- if (!sdDev.ccs)\r
- {\r
- lba = lba * SD_SECTOR_SIZE;\r
- }\r
- v = sdCommandAndResponse(SD_READ_SINGLE_BLOCK, lba);\r
- if (unlikely(v))\r
+ if (HAL_SD_ReadBlocks_DMA(\r
+ &hsd, (uint32_t*)outputBuffer, lba * 512ll, 512, sectors\r
+ ) != SD_OK)\r
{\r
scsiDiskReset();\r
- sdClearStatus();\r
\r
scsiDev.status = CHECK_CONDITION;\r
scsiDev.target->sense.code = HARDWARE_ERROR;\r
}\r
else\r
{\r
- dmaReadSector(outputBuffer);\r
+ sdCmdActive = 1;\r
}\r
}\r
\r
-void\r
-sdReadMultiSectorDMA(uint8_t* outputBuffer)\r
-{\r
- // Pre: sdReadMultiSectorPrep called.\r
- dmaReadSector(outputBuffer);\r
-}\r
-\r
-static void sdCompleteRead()\r
+void sdCompleteTransfer()\r
{\r
- if (unlikely(sdIOState != SD_IDLE))\r
+ if (sdCmdActive)\r
{\r
- // Not much choice but to wait until we've completed the transfer.\r
- // Cancelling the transfer can't be done as we have no way to reset\r
- // the SD card.\r
- trace(trace_spinSDCompleteRead);\r
- while (!sdReadSectorDMAPoll()) { /* spin */ }\r
+ HAL_SD_StopTransfer(&hsd);\r
+ HAL_DMA_Abort(hsd.hdmarx);\r
+ HAL_DMA_Abort(hsd.hdmatx);\r
+ sdCmdActive = 0;\r
}\r
-\r
-\r
- if (sdCmdState == CMD_STATE_READ)\r
- {\r
- uint8 r1b = sdCommandAndResponse(SD_STOP_TRANSMISSION, 0);\r
-\r
- if (unlikely(r1b) && (scsiDev.phase == DATA_IN))\r
- {\r
- scsiDev.status = CHECK_CONDITION;\r
- scsiDev.target->sense.code = HARDWARE_ERROR;\r
- scsiDev.target->sense.asc = UNRECOVERED_READ_ERROR;\r
- scsiDev.phase = STATUS;\r
- }\r
- }\r
-\r
- // R1b has an optional trailing "busy" signal, but we defer waiting on this.\r
- // The next call so sdCommandAndResponse will wait for the busy state to\r
- // clear.\r
-\r
- sdCmdState = CMD_STATE_IDLE;\r
}\r
\r
+\r
+#if 0\r
void\r
sdWriteMultiSectorDMA(uint8_t* outputBuffer)\r
{\r
CyDmaTdSetAddress(dmaTxTd[1], LO16((uint32)outputBuffer), LO16((uint32)SDCard_TXDATA_PTR));\r
\r
\r
- sdIOState = SD_DMA;\r
// The DMA controller is a bit trigger-happy. It will retain\r
// a drq request that was triggered while the channel was\r
// disabled.\r
sdCmdState = CMD_STATE_IDLE;\r
}\r
\r
-void sdCompleteTransfer()\r
-{\r
- sdPreCmdState(CMD_STATE_IDLE);\r
-}\r
-\r
-\r
-// SD Version 2 (SDHC) support\r
-static int sendIfCond()\r
-{\r
- int retries = 50;\r
-\r
- do\r
- {\r
- // 11:8 Host voltage. 1 = 2.7-3.6V\r
- // 7:0 Echo bits. Ignore.\r
- uint8 status = sdCRCCommandAndResponse(SD_SEND_IF_COND, 0x000001AA);\r
-\r
- if (status == SD_R1_IDLE)\r
- {\r
- // Version 2 card.\r
- sdDev.version = 2;\r
- // Read 32bit response. Should contain the same bytes that\r
- // we sent in the command parameter.\r
- sdSpiByte(0xFF);\r
- sdSpiByte(0xFF);\r
- sdSpiByte(0xFF);\r
- sdSpiByte(0xFF);\r
- break;\r
- }\r
- else if (status & SD_R1_ILLEGAL)\r
- {\r
- // Version 1 card.\r
- sdDev.version = 1;\r
- sdClearStatus();\r
- break;\r
- }\r
-\r
- sdClearStatus();\r
- } while (--retries > 0);\r
-\r
- return retries > 0;\r
-}\r
-\r
-static int sdOpCond()\r
-{\r
- uint32_t start = getTime_ms();\r
-\r
- uint8 status;\r
- do\r
- {\r
- sdCRCCommandAndResponse(SD_APP_CMD, 0);\r
- // Host Capacity Support = 1 (SDHC/SDXC supported)\r
- status = sdCRCCommandAndResponse(SD_APP_SEND_OP_COND, 0x40000000);\r
-\r
- sdClearStatus();\r
-\r
- // Spec says to poll for 1 second.\r
- } while ((status != 0) && (elapsedTime_ms(start) < 1000));\r
-\r
- return status == 0;\r
-}\r
-\r
-static int sdReadOCR()\r
-{\r
- uint32_t start = getTime_ms();\r
- int complete;\r
- uint8 status;\r
-\r
- do\r
- {\r
- uint8 buf[4];\r
- int i;\r
-\r
- status = sdCRCCommandAndResponse(SD_READ_OCR, 0);\r
- if(status) { break; }\r
-\r
- for (i = 0; i < 4; ++i)\r
- {\r
- buf[i] = sdSpiByte(0xFF);\r
- }\r
-\r
- sdDev.ccs = (buf[0] & 0x40) ? 1 : 0;\r
- complete = (buf[0] & 0x80);\r
-\r
- } while (!status &&\r
- !complete &&\r
- (elapsedTime_ms(start) < 1000));\r
-\r
- return (status == 0) && complete;\r
-}\r
-\r
-static void sdReadCID()\r
-{\r
- uint8 startToken;\r
- int maxWait, i;\r
-\r
- uint8 status = sdCRCCommandAndResponse(SD_SEND_CID, 0);\r
- if(status){return;}\r
-\r
- maxWait = 1023;\r
- do\r
- {\r
- startToken = sdSpiByte(0xFF);\r
- } while(maxWait-- && (startToken != 0xFE));\r
- if (startToken != 0xFE) { return; }\r
-\r
- for (i = 0; i < 16; ++i)\r
- {\r
- sdDev.cid[i] = sdSpiByte(0xFF);\r
- }\r
- sdSpiByte(0xFF); // CRC\r
- sdSpiByte(0xFF); // CRC\r
-}\r
-\r
-static int sdReadCSD()\r
-{\r
- uint8 startToken;\r
- int maxWait, i;\r
-\r
- uint8 status = sdCRCCommandAndResponse(SD_SEND_CSD, 0);\r
- if(status){goto bad;}\r
-\r
- maxWait = 1023;\r
- do\r
- {\r
- startToken = sdSpiByte(0xFF);\r
- } while(maxWait-- && (startToken != 0xFE));\r
- if (startToken != 0xFE) { goto bad; }\r
-\r
- for (i = 0; i < 16; ++i)\r
- {\r
- sdDev.csd[i] = sdSpiByte(0xFF);\r
- }\r
- sdSpiByte(0xFF); // CRC\r
- sdSpiByte(0xFF); // CRC\r
-\r
- if ((sdDev.csd[0] >> 6) == 0x00)\r
- {\r
- // CSD version 1\r
- // C_SIZE in bits [73:62]\r
- uint32 c_size = (((((uint32)sdDev.csd[6]) & 0x3) << 16) | (((uint32)sdDev.csd[7]) << 8) | sdDev.csd[8]) >> 6;\r
- uint32 c_mult = (((((uint32)sdDev.csd[9]) & 0x3) << 8) | ((uint32)sdDev.csd[0xa])) >> 7;\r
- uint32 sectorSize = sdDev.csd[5] & 0x0F;\r
- sdDev.capacity = ((c_size+1) * ((uint64)1 << (c_mult+2)) * ((uint64)1 << sectorSize)) / SD_SECTOR_SIZE;\r
- }\r
- else if ((sdDev.csd[0] >> 6) == 0x01)\r
- {\r
- // CSD version 2\r
- // C_SIZE in bits [69:48]\r
-\r
- uint32 c_size =\r
- ((((uint32)sdDev.csd[7]) & 0x3F) << 16) |\r
- (((uint32)sdDev.csd[8]) << 8) |\r
- ((uint32)sdDev.csd[7]);\r
- sdDev.capacity = (c_size + 1) * 1024;\r
- }\r
- else\r
- {\r
- goto bad;\r
- }\r
-\r
- return 1;\r
-bad:\r
- return 0;\r
-}\r
-\r
#endif\r
static void sdInitDMA()\r
{\r
{\r
int result = 0;\r
\r
- // TODO sdCmdState = CMD_STATE_IDLE;\r
sdClear();\r
\r
\r
// Check if there's an SD card present.\r
int result = 0;\r
\r
-#if 0\r
- if ((scsiDev.phase == BUS_FREE) &&\r
- (sdIOState == SD_IDLE) &&\r
- (sdCmdState == CMD_STATE_IDLE))\r
-#endif\r
static int firstInit = 1;\r
\r
if (firstInit)\r
#define SD_SECTOR_SIZE 512
-/*
-typedef enum
-{
- SD_GO_IDLE_STATE = 0,
- SD_SEND_OP_COND = 1,
- SD_SEND_IF_COND = 8, // SD V2
- SD_SEND_CSD = 9,
- SD_SEND_CID = 10,
- SD_STOP_TRANSMISSION = 12,
- SD_SEND_STATUS = 13,
- SD_SET_BLOCKLEN = 16,
- SD_READ_SINGLE_BLOCK = 17,
- SD_READ_MULTIPLE_BLOCK = 18,
- SD_APP_SET_WR_BLK_ERASE_COUNT = 23,
- SD_WRITE_MULTIPLE_BLOCK = 25,
- SD_APP_SEND_OP_COND = 41,
- SD_APP_CMD = 55,
- SD_READ_OCR = 58,
- SD_CRC_ON_OFF = 59
-} SD_CMD;
-
-typedef enum
-{
- SD_R1_IDLE = 1,
- SD_R1_ERASE_RESET = 2,
- SD_R1_ILLEGAL = 4,
- SD_R1_CRC = 8,
- SD_R1_ERASE_SEQ = 0x10,
- SD_R1_ADDRESS = 0x20,
- SD_R1_PARAMETER = 0x40
-} SD_R1;
-*/
-
typedef struct
{
int version; // SDHC = version 2.
} SdDevice;
extern SdDevice sdDev;
-extern volatile uint8_t sdRxDMAComplete;
-extern volatile uint8_t sdTxDMAComplete;
int sdInit(void);
-#define sdDMABusy() (!(sdRxDMAComplete && sdTxDMAComplete))
-
void sdWriteMultiSectorPrep(uint32_t sdLBA, uint32_t sdSectors);
void sdWriteMultiSectorDMA(uint8_t* outputBuffer);
int sdWriteSectorDMAPoll();
-void sdReadMultiSectorPrep(uint32_t sdLBA, uint32_t sdSectors);
-void sdReadMultiSectorDMA(uint8_t* outputBuffer);
-void sdReadSingleSectorDMA(uint32_t lba, uint8_t* outputBuffer);
-int sdReadSectorDMAPoll();
+void sdReadDMA(uint32_t lba, uint32_t sectors, uint8_t* outputBuffer);
+int sdReadDMAPoll();
+void sdCompleteTransfer();
-void sdCompleteTransfer(void);
void sdPoll();
#endif
--- /dev/null
+// Copyright (C) 2016 Michael McMaster <michael@codesrc.com>
+//
+// This file is part of SCSI2SD.
+//
+// SCSI2SD is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// SCSI2SD 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
+
+#include "Dfu.hh"
+
+#include <stdexcept>
+#include <string.h>
+
+using namespace SCSI2SD;
+
+
+
+Dfu::Dfu()
+{
+ libusb_init(&m_usbctx);
+}
+
+Dfu::~Dfu()
+{
+ if (m_usbctx)
+ {
+ libusb_exit(m_usbctx);
+ m_usbctx = NULL;
+ }
+}
+
+bool Dfu::hasDevice()
+{
+ bool found = false;
+
+ libusb_device **list;
+ ssize_t cnt = libusb_get_device_list(m_usbctx, &list);
+ ssize_t i = 0;
+ if (cnt < 0) return false;
+
+ for (i = 0; i < cnt; i++) {
+ libusb_device *device = list[i];
+ libusb_device_descriptor desc;
+ libusb_get_device_descriptor(device, &desc);
+ if (desc.idVendor == Vendor && desc.idProduct == Product )
+ {
+ found = true;
+ break;
+ }
+ }
+
+ libusb_free_device_list(list, 1);
+
+ return found;
+}
+
--- /dev/null
+// Copyright (C) 2016 Michael McMaster <michael@codesrc.com>
+//
+// This file is part of SCSI2SD.
+//
+// SCSI2SD is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// SCSI2SD 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
+
+#include <libusb.h>
+
+#include <string>
+
+#ifndef SCSI2SD_DFU_H
+#define SCSI2SD_DFU_H
+
+namespace SCSI2SD
+{
+
+class Dfu
+{
+public:
+ Dfu();
+
+ ~Dfu();
+
+ bool hasDevice();
+
+private:
+ enum { Vendor = 0x0483, Product = 0xdf11 };
+
+ libusb_context* m_usbctx;
+
+ std::string m_filename;
+};
+
+} // namespace
+
+#endif
+
-VPATH=../firmware dfu-programmer/src
+VPATH=../firmware TerminalWx/src TerminalWx/src/taTelnet TerminalWx/src/GTerm
VERSION=6.0
NAME=scsi2sd-util6
CPPFLAGS_LIBUSB=$(shell pkg-config libusb-1.0 --cflags)
LDFLAGS_LIBUSB=$(shell pkg-config libusb-1.0 --libs)
else
-CPPFLAGS_LIBUSB=-I libusb-1.0.9/libusb
+CPPFLAGS_LIBUSB=-I $(PWD)/libusb-1.0.20/libusb
LDFLAGS_LIBUSB=-L $(BUILD)/libusb/libusb/.libs -lusb-1.0
endif
LDFLAGS_WX=$(shell $(BUILD)/wx/wx-config --libs)
endif
-CPPFLAGS = $(CPPFLAGS_HIDAPI) -I. -I ../../include -Idfu-programmer/src \
+CPPFLAGS = $(CPPFLAGS_HIDAPI) -I. -I ../../include -ITerminalWx/src \
-Ilibzipper-1.0.4 \
$(CPPFLAGS_ZLIB) \
$(CPPFLAGS_LIBUSB) \
EXE=.exe
WX_CONFIG+=--host=i686-w64-mingw32
LIBUSB_CONFIG+=--host=i686-w64-mingw32 --disable-shared
+ DFU-UTIL_CONFIG+=--host=i686-w64-mingw32
endif
ifeq ($(TARGET),Win64)
VPATH += hidapi/windows
EXE=.exe
WX_CONFIG+=--host=x86_64-w64-mingw32
LIBUSB_CONFIG+=--host=x86_64-w64-mingw32 --disable-shared
+ DFU-UTIL_CONFIG+=--host=x86_64-w64-mingw32
endif
ifeq ($(TARGET),Linux)
VPATH += hidapi/linux
LDFLAGS += -ludev -lexpat -lusb-1.0
BUILD := $(PWD)/build/linux
LIBUSB_CONFIG+=--disable-shared
+ LDFLAGS_LIBUSB+= -ludev -lpthread
endif
ifeq ($(TARGET),Darwin)
# Should match OSX
CXX=clang++ -stdlib=libc++ -mmacosx-version-min=10.7
WX_CONFIG += --with-macosx-version-min=10.7
LIBUSB_CONFIG += --with-macosx-version-min=10.7 --disable-shared
+ LDFLAGS_LIBUSB += -lobjc
+ DFU-UTIL_CONFIG += --with-macosx-version-min=10.7 --disable-shared
BUILD := $(PWD)/build/mac
all: $(BUILD)/scsi2sd-util6.dmg
$(BUILD)/TargetPanel.o \
$(BUILD)/SCSI2SD_HID.o \
$(BUILD)/hidpacket.o \
-
-# $(BUILD)/Dfu.o \
-# $(BUILD)/dfu.o \
+ $(BUILD)/Dfu.o \
+ $(BUILD)/terminalwx.o \
+ $(BUILD)/terminalinputevent.o \
+ $(BUILD)/wxterm.o \
+ $(BUILD)/gterm.o \
+ $(BUILD)/actions.o \
+ $(BUILD)/keytrans.o \
+ $(BUILD)/states.o \
+ $(BUILD)/utils.o \
+ $(BUILD)/vt52_states.o \
EXEOBJ = \
mkdir -p $(dir $@)
( \
cd $(dir $@) && \
- $(CURDIR)/libusb-1.0.9/configure $(LIBUSB_CONFIG) && \
+ $(CURDIR)/libusb-1.0.20/configure $(LIBUSB_CONFIG) && \
$(MAKE) \
) && \
touch $@
+else
+$(BUILD)/libusb/buildstamp:
+ mkdir -p $(dir $@)
+ touch $@
endif
ifneq ($(USE_SYSTEM_WX),Yes)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) `wx-config-3.0 --cxxflags` $< -c -o $@
endif
+$(BUILD)/%.o: %.cpp
+ mkdir -p $(dir $@)
+ifneq ($(USE_SYSTEM_WX),Yes)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) `$(BUILD)/wx/wx-config --cxxflags` $< -c -o $@
+else
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) `wx-config-3.0 --cxxflags` $< -c -o $@
+endif
+
$(BUILD)/scsi2sd-util6$(EXE): $(OBJ) $(BUILD)/scsi2sd-util.o
mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS_WX) $(LDFLAGS) -o $@
+all: $(BUILD)/dfu-util/buildstamp
+$(BUILD)/dfu-util/buildstamp: $(BUILD)/libusb/buildstamp
+ mkdir -p $(dir $@)
+ ( \
+ cd $(dir $@) && \
+ $(CURDIR)/dfu-util/configure ${DFU-UTIL_CONFIG} CPPFLAGS="${CPPFLAGS_LIBUSB}" LDFLAGS="${LDFLAGS_LIBUSB} ${LDFLAGS}" && \
+ $(MAKE) \
+ ) && \
+ touch $@
+
clean:
rm $(BUILD)/scsi2sd-util6$(EXE) $(OBJ) $(BUILD)/libzipper/buildstamp
}
bool
-HID::scsiSelfTest()
+HID::scsiSelfTest(int& code)
{
std::vector<uint8_t> cmd { S2S_CMD_SCSITEST };
std::vector<uint8_t> out;
{
return false;
}
+ code = out.size() >= 2 ? out[1] : -1;
return (out.size() >= 1) && (out[0] == S2S_CFG_STATUS_GOOD);
}
std::vector<uint8_t> getSD_CSD();
std::vector<uint8_t> getSD_CID();
- bool scsiSelfTest();
+ bool scsiSelfTest(int& code);
void enterBootloader();
--- /dev/null
+# Doxyfile 1.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = TerminalWx
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = 0.1
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doc
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = src src/taTelnet src/GTerm
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans.ttf
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
--- /dev/null
+#------------------------------------------------------------------------------#
+# This makefile was generated by 'cbp2make' tool rev.147 #
+#------------------------------------------------------------------------------#
+
+
+WORKDIR = `pwd`
+
+CC = gcc
+CXX = g++
+AR = ar
+LD = g++
+WINDRES = windres
+
+INC =
+CFLAGS = `wx-config --cflags` -Wall
+RESINC =
+LIBDIR =
+LIB =
+LDFLAGS = `wx-config --libs`
+
+INC_DEBUG = $(INC)
+CFLAGS_DEBUG = $(CFLAGS) -g
+RESINC_DEBUG = $(RESINC)
+RCFLAGS_DEBUG = $(RCFLAGS)
+LIBDIR_DEBUG = $(LIBDIR)
+LIB_DEBUG = $(LIB)
+LDFLAGS_DEBUG = $(LDFLAGS)
+OBJDIR_DEBUG = obj/Debug
+DEP_DEBUG =
+OUT_DEBUG = bin/Debug/TestApp
+
+INC_RELEASE = $(INC)
+CFLAGS_RELEASE = $(CFLAGS) -O2
+RESINC_RELEASE = $(RESINC)
+RCFLAGS_RELEASE = $(RCFLAGS)
+LIBDIR_RELEASE = $(LIBDIR)
+LIB_RELEASE = $(LIB)
+LDFLAGS_RELEASE = -s $(LDFLAGS)
+OBJDIR_RELEASE = obj/Release
+DEP_RELEASE =
+OUT_RELEASE = bin/Release/TestApp
+
+OBJ_DEBUG = $(OBJDIR_DEBUG)/src/GTerm/states.o $(OBJDIR_DEBUG)/src/terminalwx.o $(OBJDIR_DEBUG)/src/terminalinputevent.o $(OBJDIR_DEBUG)/src/taTelnet/wxterm.o $(OBJDIR_DEBUG)/src/GTerm/vt52_states.o $(OBJDIR_DEBUG)/src/GTerm/utils.o $(OBJDIR_DEBUG)/TestApp.o $(OBJDIR_DEBUG)/src/GTerm/keytrans.o $(OBJDIR_DEBUG)/src/GTerm/gterm.o $(OBJDIR_DEBUG)/src/GTerm/actions.o $(OBJDIR_DEBUG)/TestMain.o
+
+OBJ_RELEASE = $(OBJDIR_RELEASE)/src/GTerm/states.o $(OBJDIR_RELEASE)/src/terminalwx.o $(OBJDIR_RELEASE)/src/terminalinputevent.o $(OBJDIR_RELEASE)/src/taTelnet/wxterm.o $(OBJDIR_RELEASE)/src/GTerm/vt52_states.o $(OBJDIR_RELEASE)/src/GTerm/utils.o $(OBJDIR_RELEASE)/TestApp.o $(OBJDIR_RELEASE)/src/GTerm/keytrans.o $(OBJDIR_RELEASE)/src/GTerm/gterm.o $(OBJDIR_RELEASE)/src/GTerm/actions.o $(OBJDIR_RELEASE)/TestMain.o
+
+all: debug release
+
+clean: clean_debug clean_release
+
+before_debug:
+ test -d bin/Debug || mkdir -p bin/Debug
+ test -d $(OBJDIR_DEBUG)/src/GTerm || mkdir -p $(OBJDIR_DEBUG)/src/GTerm
+ test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src
+ test -d $(OBJDIR_DEBUG)/src/taTelnet || mkdir -p $(OBJDIR_DEBUG)/src/taTelnet
+ test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG)
+
+after_debug:
+
+debug: before_debug out_debug after_debug
+
+out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG)
+ $(LD) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG)
+
+$(OBJDIR_DEBUG)/src/GTerm/states.o: src/GTerm/states.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/GTerm/states.cpp -o $(OBJDIR_DEBUG)/src/GTerm/states.o
+
+$(OBJDIR_DEBUG)/src/terminalwx.o: src/terminalwx.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/terminalwx.cpp -o $(OBJDIR_DEBUG)/src/terminalwx.o
+
+$(OBJDIR_DEBUG)/src/terminalinputevent.o: src/terminalinputevent.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/terminalinputevent.cpp -o $(OBJDIR_DEBUG)/src/terminalinputevent.o
+
+$(OBJDIR_DEBUG)/src/taTelnet/wxterm.o: src/taTelnet/wxterm.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/taTelnet/wxterm.cpp -o $(OBJDIR_DEBUG)/src/taTelnet/wxterm.o
+
+$(OBJDIR_DEBUG)/src/GTerm/vt52_states.o: src/GTerm/vt52_states.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/GTerm/vt52_states.cpp -o $(OBJDIR_DEBUG)/src/GTerm/vt52_states.o
+
+$(OBJDIR_DEBUG)/src/GTerm/utils.o: src/GTerm/utils.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/GTerm/utils.cpp -o $(OBJDIR_DEBUG)/src/GTerm/utils.o
+
+$(OBJDIR_DEBUG)/TestApp.o: TestApp.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c TestApp.cpp -o $(OBJDIR_DEBUG)/TestApp.o
+
+$(OBJDIR_DEBUG)/src/GTerm/keytrans.o: src/GTerm/keytrans.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/GTerm/keytrans.cpp -o $(OBJDIR_DEBUG)/src/GTerm/keytrans.o
+
+$(OBJDIR_DEBUG)/src/GTerm/gterm.o: src/GTerm/gterm.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/GTerm/gterm.cpp -o $(OBJDIR_DEBUG)/src/GTerm/gterm.o
+
+$(OBJDIR_DEBUG)/src/GTerm/actions.o: src/GTerm/actions.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/GTerm/actions.cpp -o $(OBJDIR_DEBUG)/src/GTerm/actions.o
+
+$(OBJDIR_DEBUG)/TestMain.o: TestMain.cpp
+ $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c TestMain.cpp -o $(OBJDIR_DEBUG)/TestMain.o
+
+clean_debug:
+ rm -f $(OBJ_DEBUG) $(OUT_DEBUG)
+ rm -rf bin/Debug
+ rm -rf $(OBJDIR_DEBUG)/src/GTerm
+ rm -rf $(OBJDIR_DEBUG)/src
+ rm -rf $(OBJDIR_DEBUG)/src/taTelnet
+ rm -rf $(OBJDIR_DEBUG)
+
+before_release:
+ test -d bin/Release || mkdir -p bin/Release
+ test -d $(OBJDIR_RELEASE)/src/GTerm || mkdir -p $(OBJDIR_RELEASE)/src/GTerm
+ test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src
+ test -d $(OBJDIR_RELEASE)/src/taTelnet || mkdir -p $(OBJDIR_RELEASE)/src/taTelnet
+ test -d $(OBJDIR_RELEASE) || mkdir -p $(OBJDIR_RELEASE)
+
+after_release:
+
+release: before_release out_release after_release
+
+out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE)
+ $(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE)
+
+$(OBJDIR_RELEASE)/src/GTerm/states.o: src/GTerm/states.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/GTerm/states.cpp -o $(OBJDIR_RELEASE)/src/GTerm/states.o
+
+$(OBJDIR_RELEASE)/src/terminalwx.o: src/terminalwx.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/terminalwx.cpp -o $(OBJDIR_RELEASE)/src/terminalwx.o
+
+$(OBJDIR_RELEASE)/src/terminalinputevent.o: src/terminalinputevent.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/terminalinputevent.cpp -o $(OBJDIR_RELEASE)/src/terminalinputevent.o
+
+$(OBJDIR_RELEASE)/src/taTelnet/wxterm.o: src/taTelnet/wxterm.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/taTelnet/wxterm.cpp -o $(OBJDIR_RELEASE)/src/taTelnet/wxterm.o
+
+$(OBJDIR_RELEASE)/src/GTerm/vt52_states.o: src/GTerm/vt52_states.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/GTerm/vt52_states.cpp -o $(OBJDIR_RELEASE)/src/GTerm/vt52_states.o
+
+$(OBJDIR_RELEASE)/src/GTerm/utils.o: src/GTerm/utils.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/GTerm/utils.cpp -o $(OBJDIR_RELEASE)/src/GTerm/utils.o
+
+$(OBJDIR_RELEASE)/TestApp.o: TestApp.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c TestApp.cpp -o $(OBJDIR_RELEASE)/TestApp.o
+
+$(OBJDIR_RELEASE)/src/GTerm/keytrans.o: src/GTerm/keytrans.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/GTerm/keytrans.cpp -o $(OBJDIR_RELEASE)/src/GTerm/keytrans.o
+
+$(OBJDIR_RELEASE)/src/GTerm/gterm.o: src/GTerm/gterm.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/GTerm/gterm.cpp -o $(OBJDIR_RELEASE)/src/GTerm/gterm.o
+
+$(OBJDIR_RELEASE)/src/GTerm/actions.o: src/GTerm/actions.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/GTerm/actions.cpp -o $(OBJDIR_RELEASE)/src/GTerm/actions.o
+
+$(OBJDIR_RELEASE)/TestMain.o: TestMain.cpp
+ $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c TestMain.cpp -o $(OBJDIR_RELEASE)/TestMain.o
+
+clean_release:
+ rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
+ rm -rf bin/Release
+ rm -rf $(OBJDIR_RELEASE)/src/GTerm
+ rm -rf $(OBJDIR_RELEASE)/src
+ rm -rf $(OBJDIR_RELEASE)/src/taTelnet
+ rm -rf $(OBJDIR_RELEASE)
+
+.PHONY: before_debug after_debug clean_debug before_release after_release clean_release
+
--- /dev/null
+This is a wxWidgets Terminal widget conveniently packaged for you.
+
+For doxygen documentation, see: http://jeremysalwen.github.com/TerminalWx/
+
+TerminalWx is taken (with modifications) from the Chameleon IDE (Mark
+Erikson), which itself took (with modifications) from taTelnet (Derry
+Bryson), which itself took (with modifications) from GTerm (Timothy
+Miller). So this code has a bit of history ;). All credit to those
+before me, the amount I've contributed is relatively nothing.
+
+It is offered under the terms of the wxWindows License Version 3.1,
+which is basically the LGPL version 2+ with an exception for the
+requirement to distribute the source code with binaries. (see
+license3.txt for details of the license).
+
+Dependencies
+-----
+
+You will need wxgtk version 2.9 or later.
+You will also need libwxsmith to compile the test application.
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="TerminalWx" />
+ <Option pch_mode="2" />
+ <Option compiler="gcc" />
+ <Build>
+ <Target title="Debug">
+ <Option output="bin/Debug/TestApp" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/Debug/" />
+ <Option type="0" />
+ <Option compiler="gcc" />
+ <Option projectLinkerOptionsRelation="2" />
+ <Compiler>
+ <Add option="-g" />
+ </Compiler>
+ </Target>
+ <Target title="Release">
+ <Option output="bin/Release/TestApp" prefix_auto="1" extension_auto="1" />
+ <Option object_output="obj/Release/" />
+ <Option type="0" />
+ <Option compiler="gcc" />
+ <Option projectLinkerOptionsRelation="2" />
+ <Compiler>
+ <Add option="-O2" />
+ </Compiler>
+ <Linker>
+ <Add option="-s" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="`wx-config --cflags`" />
+ <Add option="-Wall" />
+ </Compiler>
+ <Linker>
+ <Add option="`wx-config --libs`" />
+ </Linker>
+ <Unit filename="TestApp.cpp" />
+ <Unit filename="TestApp.h" />
+ <Unit filename="TestMain.cpp" />
+ <Unit filename="TestMain.h" />
+ <Unit filename="src/GTerm/actions.cpp" />
+ <Unit filename="src/GTerm/gterm.cpp" />
+ <Unit filename="src/GTerm/gterm.hpp" />
+ <Unit filename="src/GTerm/keytrans.cpp" />
+ <Unit filename="src/GTerm/states.cpp" />
+ <Unit filename="src/GTerm/utils.cpp" />
+ <Unit filename="src/GTerm/vt52_states.cpp" />
+ <Unit filename="src/taTelnet/wxterm.cpp" />
+ <Unit filename="src/taTelnet/wxterm.h" />
+ <Unit filename="src/terminalinputevent.cpp" />
+ <Unit filename="src/terminalinputevent.h" />
+ <Unit filename="src/terminalwx.cpp" />
+ <Unit filename="src/terminalwx.h" />
+ <Extensions>
+ <code_completion />
+ <envvars />
+ <wxsmith version="1">
+ <gui name="wxWidgets" src="TerminalWxApp.cpp" main="TerminalWxFrame" init_handlers="necessary" language="CPP" />
+ <resources>
+ <wxFrame wxs="wxsmith/TerminalWxframe.wxs" src="TerminalWxMain.cpp" hdr="TerminalWxMain.h" name="TerminalWxFrame" language="CPP" />
+ </resources>
+ </wxsmith>
+ <lib_finder disable_auto="1" />
+ <debugger />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#include "TestApp.h"
+
+//(*AppHeaders
+#include "TestMain.h"
+#include <wx/image.h>
+//*)
+
+IMPLEMENT_APP(TestApp);
+
+bool TestApp::OnInit()
+{
+ //(*AppInitialize
+ bool wxsOK = true;
+ wxInitAllImageHandlers();
+ if ( wxsOK )
+ {
+ TerminalWxFrame* Frame = new TerminalWxFrame(0);
+ Frame->Show();
+ SetTopWindow(Frame);
+ }
+ //*)
+ return wxsOK;
+
+}
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#ifndef TESTAPP_H
+#define TESTAPP_H
+
+#include <wx/app.h>
+
+class TestApp : public wxApp
+{
+ public:
+ virtual bool OnInit();
+};
+
+#endif // TESTAPP_H
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#include <wx/gdicmn.h>
+#include <wx/menuitem.h>
+#include <wx/utils.h>
+#include <wx/msgdlg.h>
+
+#include "TestMain.h"
+#include "src/terminalinputevent.h"
+
+//(*InternalHeaders(TerminalWxFrame)
+#include <wx/string.h>
+#include <wx/intl.h>
+//*)
+
+//helper functions
+enum wxbuildinfoformat {
+ short_f, long_f };
+
+wxString wxbuildinfo(wxbuildinfoformat format)
+{
+ wxString wxbuild(wxVERSION_STRING);
+
+ if (format == long_f )
+ {
+#if defined(__WXMSW__)
+ wxbuild << _T("-Windows");
+#elif defined(__UNIX__)
+ wxbuild << _T("-Linux");
+#endif
+
+#if wxUSE_UNICODE
+ wxbuild << _T("-Unicode build");
+#else
+ wxbuild << _T("-ANSI build");
+#endif // wxUSE_UNICODE
+ }
+
+ return wxbuild;
+}
+
+//(*IdInit(TerminalWxFrame)
+const long TerminalWxFrame::ID_TERM = wxNewId();
+const long TerminalWxFrame::idMenuQuit = wxNewId();
+const long TerminalWxFrame::idMenuAbout = wxNewId();
+const long TerminalWxFrame::ID_STATUSBAR1 = wxNewId();
+//*)
+
+BEGIN_EVENT_TABLE(TerminalWxFrame,wxFrame)
+ //(*EventTable(TerminalWxFrame)
+ //*)
+END_EVENT_TABLE()
+
+TerminalWxFrame::TerminalWxFrame(wxWindow* parent,wxWindowID id)
+{
+ //(*Initialize(TerminalWxFrame)
+ wxMenuItem* MenuItem2;
+ wxMenuItem* MenuItem1;
+ wxMenu* Menu1;
+ wxMenuBar* MenuBar1;
+ wxMenu* Menu2;
+
+ Create(parent, id, _("Test TerminalWx App"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
+ Term1 = new TerminalWx(this,ID_TERM,wxPoint(72,56),80,24,_T("ID_TERM"));
+ MenuBar1 = new wxMenuBar();
+ Menu1 = new wxMenu();
+ MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
+ Menu1->Append(MenuItem1);
+ MenuBar1->Append(Menu1, _("&File"));
+ Menu2 = new wxMenu();
+ MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
+ Menu2->Append(MenuItem2);
+ MenuBar1->Append(Menu2, _("Help"));
+ SetMenuBar(MenuBar1);
+ StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
+ int __wxStatusBarWidths_1[1] = { -1 };
+ int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
+ StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
+ StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
+ SetStatusBar(StatusBar1);
+
+ Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&TerminalWxFrame::OnQuit);
+ Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&TerminalWxFrame::OnAbout);
+ Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&TerminalWxFrame::OnClose);
+ //*)
+}
+
+TerminalWxFrame::~TerminalWxFrame()
+{
+ //(*Destroy(TerminalWxFrame)
+ //*)
+}
+
+void TerminalWxFrame::OnQuit(wxCommandEvent& event)
+{
+ Close();
+}
+
+void TerminalWxFrame::OnAbout(wxCommandEvent& event)
+{
+ wxString msg = wxbuildinfo(long_f);
+ wxMessageBox(msg, _("Welcome to..."));
+
+ Term1->DisplayCharsUnsafe(msg);
+}
+
+void TerminalWxFrame::OnClose(wxCloseEvent& event)
+{
+ Destroy();
+}
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#ifndef TESTMAIN_H
+#define TESTMAIN_H
+
+//(*Headers(TerminalWxFrame)
+#include <wx/menu.h>
+#include <wx/statusbr.h>
+#include <wx/frame.h>
+//*)
+
+#include <wx/event.h>
+#include <wx/window.h>
+
+#include "src/terminalwx.h"
+
+class TerminalWxFrame: public wxFrame
+{
+ public:
+
+ TerminalWxFrame(wxWindow* parent,wxWindowID id = -1);
+ virtual ~TerminalWxFrame();
+
+ private:
+
+ //(*Handlers(TerminalWxFrame)
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnClose(wxCloseEvent& event);
+ void OnCustom1Paint(wxPaintEvent& event);
+ //*)
+
+ //(*Identifiers(TerminalWxFrame)
+ static const long ID_TERM;
+ static const long idMenuQuit;
+ static const long idMenuAbout;
+ static const long ID_STATUSBAR1;
+ //*)
+
+ //(*Declarations(TerminalWxFrame)
+ wxStatusBar* StatusBar1;
+ TerminalWx* Term1;
+ //*)
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // TERMINALWXMAIN_H
--- /dev/null
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+\f
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+\f
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+\f
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
--- /dev/null
+ wxWindows Library Licence, Version 3.1
+ ======================================
+
+ Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this licence document, but changing it is not allowed.
+
+ WXWINDOWS LIBRARY LICENCE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public Licence as published by
+ the Free Software Foundation; either version 2 of the Licence, or (at
+ your option) any later version.
+
+ This library 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 Library
+ General Public Licence for more details.
+
+ You should have received a copy of the GNU Library General Public Licence
+ along with this software, usually in a file named COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ Boston, MA 02111-1307 USA.
+
+ EXCEPTION NOTICE
+
+ 1. As a special exception, the copyright holders of this library give
+ permission for additional uses of the text contained in this release of
+ the library as licenced under the wxWindows Library Licence, applying
+ either version 3.1 of the Licence, or (at your option) any later version of
+ the Licence as published by the copyright holders of version
+ 3.1 of the Licence document.
+
+ 2. The exception is that you may use, copy, link, modify and distribute
+ under your own terms, binary object code versions of works based
+ on the Library.
+
+ 3. If you copy code from files distributed under the terms of the GNU
+ General Public Licence or the GNU Library General Public Licence into a
+ copy of this library, as this licence permits, the exception does not
+ apply to the code that you add in this way. To avoid misleading anyone as
+ to the status of such modified files, you must delete this exception
+ notice from such code and/or adjust the licensing conditions notice
+ accordingly.
+
+ 4. If you write modifications of your own for this library, it is your
+ choice whether to permit this exception to apply to your modifications.
+ If you do not wish that, you must delete the exception notice from such
+ code and/or adjust the licensing conditions notice accordingly.
+
+
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Timothy Miller
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#include "gterm.hpp"
+
+
+// For efficiency, this grabs all printing characters from buffer, up to
+// the end of the line or end of buffer
+void GTerm::normal_input()
+{
+ int n, n_taken, i, c, y;
+#if 0
+char str[100];
+#endif
+
+#define IS_CTRL_CHAR(c) ((c)<32 || (c) ==127)
+
+ if (IS_CTRL_CHAR(*input_data)) return;
+
+ if (cursor_x >= width) {
+ if (mode_flags & NOEOLWRAP) {
+ cursor_x = width-1;
+ } else {
+ next_line();
+ }
+ }
+
+ n = 0;
+ if (mode_flags & NOEOLWRAP) {
+ while (!IS_CTRL_CHAR(input_data[n]) && n<data_len) n++;
+ n_taken = n;
+ if (cursor_x+n>=width) n = width-cursor_x;
+ } else {
+ while (!IS_CTRL_CHAR(input_data[n]) && n<data_len && cursor_x+n<width) n++;
+ n_taken = n;
+ }
+
+#if 0
+memcpy(str, input_data, n);
+str[n] = 0;
+//printf("Processing %d characters (%d): %s\n", n, str[0], str);
+#endif
+
+ if (mode_flags & INSERT) {
+ changed_line(cursor_y, cursor_x, width-1);
+ } else {
+ changed_line(cursor_y, cursor_x, cursor_x+n-1);
+ }
+
+ y = linenumbers[cursor_y]*MAXWIDTH;
+ if (mode_flags & INSERT) for (i=width-1; i>=cursor_x+n; i--) {
+ text[y+i] = text[y+i-n];
+ color[y+i] = color[y+i-n];
+ }
+
+ c = calc_color(fg_color, bg_color, mode_flags);
+ for (i=0; i<n; i++) {
+ text[y+cursor_x] = input_data[i];
+ color[y+cursor_x] = c;
+ cursor_x++;
+ }
+
+ input_data += n_taken-1;
+ data_len -= n_taken-1;
+}
+
+void GTerm::cr()
+{
+ move_cursor(0, cursor_y);
+}
+
+void GTerm::lf()
+{
+ if (cursor_y < scroll_bot) {
+ move_cursor(cursor_x, cursor_y+1);
+ } else {
+ scroll_region(scroll_top, scroll_bot, 1);
+ }
+}
+
+void GTerm::ff()
+{
+ clear_area(0, scroll_top, width-1, scroll_bot);
+ move_cursor(0, scroll_top);
+}
+
+void GTerm::tab()
+{
+ int i, x = 0;
+
+ for (i=cursor_x+1; i<width && !x; i++) if (tab_stops[i]) x = i;
+ if (!x) x = (cursor_x+8) & -8;
+ if (x < width) {
+ move_cursor(x, cursor_y);
+ } else {
+ if (mode_flags & NOEOLWRAP) {
+ move_cursor(width-1, cursor_y);
+ } else {
+ next_line();
+ }
+ }
+}
+
+void GTerm::bs()
+{
+ if (cursor_x>0) move_cursor(cursor_x-1, cursor_y);
+ if (mode_flags & DESTRUCTBS) {
+ clear_area(cursor_x, cursor_y, cursor_x, cursor_y);
+ }
+}
+
+void GTerm::bell()
+{
+ Bell();
+}
+
+void GTerm::clear_param()
+{
+ nparam = 0;
+ memset(param, 0, sizeof(param));
+ q_mode = 0;
+ got_param = 0;
+}
+
+void GTerm::keypad_numeric() { clear_mode_flag(KEYAPPMODE); }
+void GTerm::keypad_application() { set_mode_flag(KEYAPPMODE); }
+
+void GTerm::save_cursor()
+{
+ save_attrib = mode_flags;
+ save_x = cursor_x;
+ save_y = cursor_y;
+}
+
+void GTerm::restore_cursor()
+{
+ mode_flags = (mode_flags & ~15) | (save_attrib & 15);
+ move_cursor(save_x, save_y);
+}
+
+void GTerm::set_tab()
+{
+ tab_stops[cursor_x] = 1;
+}
+
+void GTerm::index_down()
+{
+ lf();
+}
+
+void GTerm::next_line()
+{
+ lf(); cr();
+}
+
+void GTerm::index_up()
+{
+ if (cursor_y > scroll_top) {
+ move_cursor(cursor_x, cursor_y-1);
+ } else {
+ scroll_region(scroll_top, scroll_bot, -1);
+ }
+}
+
+void GTerm::reset()
+{
+ int i;
+
+ pending_scroll = 0;
+ bg_color = 0;
+ fg_color = 7;
+ scroll_top = 0;
+ scroll_bot = height-1;
+ for (i=0; i<MAXHEIGHT; i++) linenumbers[i] = i;
+ memset(tab_stops, 0, sizeof(tab_stops));
+ current_state = GTerm::normal_state;
+
+ clear_mode_flag(NOEOLWRAP | CURSORAPPMODE | CURSORRELATIVE |
+ NEWLINE | INSERT | UNDERLINE | BLINK | KEYAPPMODE |
+ CURSORINVISIBLE);
+
+ clear_area(0, 0, width-1, height-1);
+ move_cursor(0, 0);
+}
+
+void GTerm::set_q_mode()
+{
+ q_mode = 1;
+}
+
+// The verification test used some strange sequence which was
+// ^[[61"p
+// in a function called set_level,
+// but it didn't explain the meaning. Just in case I ever find out,
+// and just so that it doesn't leave garbage on the screen, I accept
+// the quote and mark a flag.
+void GTerm::set_quote_mode()
+{
+ quote_mode = 1;
+}
+
+// for performance, this grabs all digits
+void GTerm::param_digit()
+{
+ got_param = 1;
+ param[nparam] = param[nparam]*10 + (*input_data)-'0';
+}
+
+void GTerm::next_param()
+{
+ nparam++;
+}
+
+void GTerm::cursor_left()
+{
+ int n, x;
+ n = param[0]; if (n<1) n = 1;
+ x = cursor_x-n; if (x<0) x = 0;
+ move_cursor(x, cursor_y);
+}
+
+void GTerm::cursor_right()
+{
+ int n, x;
+ n = param[0]; if (n<1) n = 1;
+ x = cursor_x+n; if (x>=width) x = width-1;
+ move_cursor(x, cursor_y);
+}
+
+void GTerm::cursor_up()
+{
+ int n, y;
+ n = param[0]; if (n<1) n = 1;
+ y = cursor_y-n; if (y<0) y = 0;
+ move_cursor(cursor_x, y);
+}
+
+void GTerm::cursor_down()
+{
+ int n, y;
+ n = param[0]; if (n<1) n = 1;
+ y = cursor_y+n; if (y>=height) y = height-1;
+ move_cursor(cursor_x, y);
+}
+
+void GTerm::cursor_position()
+{
+ int x, y;
+ x = param[1]; if (x<1) x=1;
+ y = param[0]; if (y<1) y=1;
+ if (mode_flags & CURSORRELATIVE) {
+ move_cursor(x-1, y-1+scroll_top);
+ } else {
+ move_cursor(x-1, y-1);
+ }
+}
+
+void GTerm::device_attrib()
+{
+ char *str = "\033[?1;2c";
+ ProcessOutput(strlen(str), (unsigned char *)str);
+}
+
+void GTerm::delete_char()
+{
+ int n, mx;
+ n = param[0]; if (n<1) n = 1;
+ mx = width-cursor_x;
+ if (n>=mx) {
+ clear_area(cursor_x, cursor_y, width-1, cursor_y);
+ } else {
+ shift_text(cursor_y, cursor_x, width-1, -n);
+ }
+}
+
+void GTerm::set_mode() // h
+{
+ switch (param[0] + 1000*q_mode) {
+ case 1007: clear_mode_flag(NOEOLWRAP); break;
+ case 1001: set_mode_flag(CURSORAPPMODE); break;
+ case 1006: set_mode_flag(CURSORRELATIVE); break;
+ case 4: set_mode_flag(INSERT); break;
+ case 1003: RequestSizeChange(132, height); break;
+ case 20: set_mode_flag(NEWLINE); break;
+ case 12: clear_mode_flag(LOCALECHO); break;
+ case 1025:
+ clear_mode_flag(CURSORINVISIBLE);
+ move_cursor(cursor_x, cursor_y);
+ break;
+ }
+}
+
+void GTerm::clear_mode() // l
+{
+ switch (param[0] + 1000*q_mode) {
+ case 1007: set_mode_flag(NOEOLWRAP); break;
+ case 1001: clear_mode_flag(CURSORAPPMODE); break;
+ case 1006: clear_mode_flag(CURSORRELATIVE); break;
+ case 4: clear_mode_flag(INSERT); break;
+ case 1003: RequestSizeChange(80, height); break;
+ case 20: clear_mode_flag(NEWLINE); break;
+ case 1002: current_state = vt52_normal_state; break;
+ case 12: set_mode_flag(LOCALECHO); break;
+ case 1025:
+ set_mode_flag(CURSORINVISIBLE); break;
+ move_cursor(cursor_x, cursor_y);
+ break;
+ }
+}
+
+void GTerm::request_param()
+{
+ char str[40];
+ sprintf(str, "\033[%d;1;1;120;120;1;0x", param[0]+2);
+ ProcessOutput(strlen(str), (unsigned char *)str);
+}
+
+void GTerm::set_margins()
+{
+ int t, b;
+
+ t = param[0];
+ if (t<1) t = 1;
+ b = param[1];
+ if (b<1) b = height;
+
+ if (pending_scroll) update_changes();
+
+ scroll_top = t-1;
+ scroll_bot = b-1;
+ if (cursor_y < scroll_top) move_cursor(cursor_x, scroll_top);
+ if (cursor_y > scroll_bot) move_cursor(cursor_x, scroll_bot);
+}
+
+void GTerm::delete_line()
+{
+ int n, mx;
+ n = param[0]; if (n<1) n = 1;
+ mx = scroll_bot-cursor_y+1;
+ if (n>=mx) {
+ clear_area(0, cursor_y, width-1, scroll_bot);
+ } else {
+ scroll_region(cursor_y, scroll_bot, n);
+ }
+}
+
+void GTerm::status_report()
+{
+ char str[20];
+ if (param[0] == 5) {
+ char *str = "\033[0n";
+ ProcessOutput(strlen(str), (unsigned char *)str);
+ } else if (param[0] == 6) {
+ sprintf(str, "\033[%d;%dR", cursor_y+1, cursor_x+1);
+ ProcessOutput(strlen(str), (unsigned char *)str);
+ }
+}
+
+void GTerm::erase_display()
+{
+ switch (param[0]) {
+ case 0:
+ clear_area(cursor_x, cursor_y, width-1, cursor_y);
+ if (cursor_y<height-1)
+ clear_area(0, cursor_y+1, width-1, height-1);
+ break;
+ case 1:
+ clear_area(0, cursor_y, cursor_x, cursor_y);
+ if (cursor_y>0)
+ clear_area(0, 0, width-1, cursor_y-1);
+ break;
+ case 2:
+ clear_area(0, 0, width-1, height-1);
+ break;
+ }
+}
+
+void GTerm::erase_line()
+{
+ switch (param[0]) {
+ case 0:
+ clear_area(cursor_x, cursor_y, width-1, cursor_y);
+ break;
+ case 1:
+ clear_area(0, cursor_y, cursor_x, cursor_y);
+ break;
+ case 2:
+ clear_area(0, cursor_y, width-1, cursor_y);
+ break;
+ }
+}
+
+void GTerm::insert_line()
+{
+ int n, mx;
+ n = param[0]; if (n<1) n = 1;
+ mx = scroll_bot-cursor_y+1;
+ if (n>=mx) {
+ clear_area(0, cursor_y, width-1, scroll_bot);
+ } else {
+ scroll_region(cursor_y, scroll_bot, -n);
+ }
+}
+
+void GTerm::set_colors()
+{
+ int n;
+
+ if (!nparam && param[0] == 0) {
+ clear_mode_flag(15);
+ fg_color = 7;
+ bg_color = 0;
+ return;
+ }
+
+ for (n=0; n<=nparam; n++) {
+ if (param[n]/10 == 4) {
+ bg_color = param[n]%10;
+ } else if (param[n]/10 == 3) {
+ fg_color = param[n]%10;
+ } else switch (param[n]) {
+ case 0:
+ clear_mode_flag(15);
+ fg_color = 7;
+ bg_color = 0;
+ break;
+ case 1:
+ set_mode_flag(BOLD);
+ break;
+ case 4:
+ set_mode_flag(UNDERLINE);
+ break;
+ case 5:
+ set_mode_flag(BLINK);
+ break;
+ case 7:
+ set_mode_flag(INVERSE);
+ break;
+ }
+ }
+}
+
+void GTerm::clear_tab()
+{
+ if (param[0] == 3) {
+ memset(tab_stops, 0, sizeof(tab_stops));
+ } else if (param[0] == 0) {
+ tab_stops[cursor_x] = 0;
+ }
+}
+
+void GTerm::insert_char()
+{
+ int n, mx;
+ n = param[0]; if (n<1) n = 1;
+ mx = width-cursor_x;
+ if (n>=mx) {
+ clear_area(cursor_x, cursor_y, width-1, cursor_y);
+ } else {
+ shift_text(cursor_y, cursor_x, width-1, n);
+ }
+}
+
+void GTerm::screen_align()
+{
+ int y, yp, x, c;
+
+ c = calc_color(7, 0, 0);
+ for (y=0; y<height; y++) {
+ yp = linenumbers[y]*MAXWIDTH;
+ changed_line(y, 0, width-1);
+ for (x=0; x<width; x++) {
+ text[yp+x] = 'E';
+ color[yp+x] = c;
+ }
+ }
+}
+
+void GTerm::erase_char()
+{
+ int n, mx;
+ n = param[0]; if (n<1) n = 1;
+ mx = width-cursor_x;
+ if (n>mx) n = mx;
+ clear_area(cursor_x, cursor_y, cursor_x+n-1, cursor_y);
+}
+
+void GTerm::vt52_cursory()
+{
+ // store y coordinate
+ param[0] = (*input_data) - 32;
+ if (param[0]<0) param[0] = 0;
+ if (param[0]>=height) param[0] = height-1;
+}
+
+void GTerm::vt52_cursorx()
+{
+ int x;
+ x = (*input_data)-32;
+ if (x<0) x = 0;
+ if (x>=width) x = width-1;
+ move_cursor(x, param[0]);
+}
+
+void GTerm::vt52_ident()
+{
+ char *str = "\033/Z";
+ ProcessOutput(strlen(str), (unsigned char *)str);
+}
+
+
+#ifdef GTERM_PC
+
+void GTerm::pc_begin(void)
+{
+//printf("pc_begin...\n");
+ set_mode_flag(PC);
+//printf("pc_begin: mode_flags = %x\n", mode_flags);
+ ProcessOutput((unsigned int)strlen(pc_machinename) + 1, (unsigned char *)pc_machinename);
+ pc_oldWidth = Width();
+ pc_oldHeight = Height();
+ ResizeTerminal(80, 25);
+ update_changes();
+}
+
+void GTerm::pc_end(void)
+{
+// printf("pc_end...\n");
+ clear_mode_flag(PC);
+ ResizeTerminal(pc_oldWidth, pc_oldHeight);
+ update_changes();
+}
+
+void GTerm::pc_cmd(void)
+{
+ pc_curcmd = *input_data;
+//printf("pc_cmd: pc_curcmd = %d...\n", pc_curcmd);
+ pc_argcount = 0;
+ switch(pc_curcmd)
+ {
+ case GTERM_PC_CMD_CURONOFF : // <on/off>
+ pc_numargs = 1;
+ break;
+
+ case GTERM_PC_CMD_MOVECURSOR : // <x> <y>
+ pc_numargs = 2;
+ break;
+
+ case GTERM_PC_CMD_PUTTEXT : // <x> <y> <wid> <len>
+ pc_numargs = 4;
+ break;
+
+ case GTERM_PC_CMD_WRITE : // <x> <y> <wid> <attr>
+ pc_numargs = 4;
+ break;
+
+ case GTERM_PC_CMD_MOVETEXT : // <sx> <sy> <wid> <len> <dx> <dy>
+ pc_numargs = 6;
+ break;
+
+ case GTERM_PC_CMD_BEEP :
+ Bell();
+ break;
+
+ case GTERM_PC_CMD_SELECTPRINTER :
+ pc_numargs = 1;
+ break;
+
+ case GTERM_PC_CMD_PRINTCHAR :
+ pc_numargs = 1;
+ break;
+
+ case GTERM_PC_CMD_PRINTCHARS :
+ pc_numargs = 2;
+ break;
+
+ default :
+ current_state = pc_cmd_state;
+ break;
+ }
+}
+
+void GTerm::pc_arg(void)
+{
+ int
+ i,
+ yp,
+ yp2;
+
+//printf("pc_arg: pc_curcmd = %d...\n", pc_curcmd);
+
+ pc_args[pc_argcount++] = *input_data;
+ if(pc_argcount == pc_numargs)
+ {
+ switch(pc_curcmd)
+ {
+ case GTERM_PC_CMD_CURONOFF :
+//printf("pc_arg: curonoff got %d\n", *input_data);
+ if(*input_data)
+ clear_mode_flag(CURSORINVISIBLE);
+ else
+ set_mode_flag(CURSORINVISIBLE);
+ current_state = pc_cmd_state;
+ changed_line(cursor_y, cursor_x, cursor_x);
+ break;
+
+ case GTERM_PC_CMD_MOVECURSOR :
+//printf("pc_arg: movecursor (%d, %d)\n", pc_args[0], pc_args[1]);
+ move_cursor(pc_args[0], pc_args[1]);
+ current_state = pc_cmd_state;
+ break;
+
+ case GTERM_PC_CMD_PUTTEXT :
+//printf("pc_arg: puttext got %d, %d, %d, %d\n", pc_args[0], pc_args[1], pc_args[2], pc_args[3]);
+ pc_numdata = pc_args[2] * pc_args[3] * 2;
+ pc_datacount = 0;
+ pc_curx = pc_args[0];
+ pc_cury = pc_args[1];
+ if(pc_numdata)
+ current_state = pc_data_state;
+ else
+ current_state = pc_cmd_state;
+ break;
+
+ case GTERM_PC_CMD_WRITE :
+//printf("pc_arg: write got %d, %d, %d, %d\n", pc_args[0], pc_args[1], pc_args[2], pc_args[3]);
+ pc_numdata = pc_args[2];
+ pc_datacount = 0;
+ pc_curx = pc_args[0];
+ pc_cury = pc_args[1];
+ if(pc_numdata)
+ current_state = pc_data_state;
+ else
+ current_state = pc_cmd_state;
+ break;
+
+ case GTERM_PC_CMD_MOVETEXT : // <sx> <sy> <wid> <len> <dx> <dy>
+ if(pc_args[1] < pc_args[5])
+ {
+ for(i = 0; i < pc_args[3]; i++)
+ {
+ yp = linenumbers[pc_args[1] + i] * MAXWIDTH;
+ yp2 = linenumbers[pc_args[5] + i] * MAXWIDTH;
+ memmove(&text[yp2 + pc_args[4]], &text[yp + pc_args[0]], pc_args[2]);
+ memmove(&color[yp2 + pc_args[4]], &color[yp + pc_args[0]], pc_args[2]);
+ changed_line(pc_args[5] + i, pc_args[4], pc_args[4] + pc_args[2] - 1);
+ }
+ }
+ else
+ {
+ for(i = pc_args[3] - 1; i >= 0; i--)
+ {
+ yp = linenumbers[pc_args[1] + i] * MAXWIDTH;
+ yp2 = linenumbers[pc_args[5] + i] * MAXWIDTH;
+ memmove(&text[yp2 + pc_args[4]], &text[yp + pc_args[0]], pc_args[2]);
+ memmove(&color[yp2 + pc_args[4]], &color[yp + pc_args[0]], pc_args[2]);
+ changed_line(pc_args[5] + i, pc_args[4], pc_args[4] + pc_args[2] - 1);
+ }
+ }
+ current_state = pc_cmd_state;
+ break;
+
+ case GTERM_PC_CMD_SELECTPRINTER :
+ pc_numdata = pc_args[0];
+ pc_datacount = 0;
+ memset(pc_printername, 0, sizeof(pc_printername));
+ if(pc_numdata)
+ current_state = pc_data_state;
+ else
+ {
+ SelectPrinter("");
+ current_state = pc_cmd_state;
+ }
+ break;
+
+ case GTERM_PC_CMD_PRINTCHAR :
+ PrintChars(1, &pc_args[0]);
+ current_state = pc_cmd_state;
+ break;
+
+ case GTERM_PC_CMD_PRINTCHARS :
+ pc_numdata = (pc_args[0] << 8) + pc_args[1];
+ pc_datacount = 0;
+ if(pc_numdata)
+ current_state = pc_data_state;
+ else
+ current_state = pc_cmd_state;
+ break;
+ }
+ }
+}
+
+void GTerm::pc_data(void)
+{
+ int
+ yp;
+
+//printf("pc_data: pc_curcmd = %d, pc_datacount = %d, pc_numdata = %d, pc_curx = %d, pc_cur_y = %d...\n", pc_curcmd, pc_datacount, pc_numdata, pc_curx, pc_cury);
+ switch(pc_curcmd)
+ {
+ case GTERM_PC_CMD_PUTTEXT :
+ yp = linenumbers[pc_cury] * MAXWIDTH;
+ if(!(pc_datacount & 1))
+ {
+//printf("pc_data: got char %d\n", *input_data);
+ text[yp + pc_curx] = *input_data;
+ }
+ else
+ {
+//printf("pc_data: got attr %d\n", *input_data);
+ color[yp + pc_curx] = *input_data << 4;
+ }
+ if(pc_datacount & 1)
+ {
+ changed_line(pc_cury, pc_args[0], pc_curx);
+ pc_curx++;
+ if(pc_curx == pc_args[0] + pc_args[2])
+ {
+ pc_curx = pc_args[0];
+ pc_cury++;
+ }
+ }
+ break;
+
+ case GTERM_PC_CMD_WRITE :
+ yp = linenumbers[pc_cury] * MAXWIDTH;
+ text[yp + pc_curx] = *input_data;
+ color[yp + pc_curx] = (unsigned short)pc_args[3] << 4;
+ changed_line(pc_cury, pc_args[0], pc_curx);
+ pc_curx++;
+ break;
+
+ case GTERM_PC_CMD_SELECTPRINTER :
+ if(pc_datacount < GTERM_PC_MAXPRINTERNAME - 1)
+ pc_printername[pc_datacount] = *input_data;
+ if(pc_datacount == pc_numdata - 1)
+ SelectPrinter(pc_printername);
+ break;
+
+ case GTERM_PC_CMD_PRINTCHARS :
+ PrintChars(1, input_data);
+ break;
+ }
+
+ pc_datacount++;
+ if(pc_datacount == pc_numdata)
+ current_state = pc_cmd_state;
+}
+
+#endif // GTERM_PC
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Timothy Miller
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#ifdef __GNUG__
+ #pragma implementation "gterm.hpp"
+#endif
+
+#include "gterm.hpp"
+#include <algorithm>
+
+using namespace std;
+
+void GTerm::Update()
+{
+ update_changes();
+}
+
+void GTerm::ProcessInput(int len, unsigned char *data)
+{
+//printf("ProcessInput called...\n");
+ int i;
+ StateOption *last_state;
+
+ data_len = len;
+ input_data = data;
+
+ while (data_len) {
+//printf("ProcessInput() processing %d...\n", *input_data);
+ i = 0;
+ while (current_state[i].byte != -1 &&
+ current_state[i].byte != *input_data) i++;
+
+ // action must be allowed to redirect state change
+ last_state = current_state+i;
+ current_state = last_state->next_state;
+ if (last_state->action)
+ (this->*(last_state->action))();
+ input_data++;
+ data_len--;
+ }
+
+ if (!(mode_flags & DEFERUPDATE) ||
+ (pending_scroll > scroll_bot-scroll_top)) update_changes();
+}
+
+void GTerm::Reset()
+{
+ reset();
+}
+
+void GTerm::ExposeArea(int x, int y, int w, int h)
+{
+ int i;
+ for (i=0; i<h; i++) changed_line(i+y, x, x+w-1);
+ if (!(mode_flags & DEFERUPDATE)) update_changes();
+}
+
+void GTerm::ResizeTerminal(int w, int h)
+{
+ int cx, cy;
+ clear_area(min(width,w), 0, MAXWIDTH-1, MAXHEIGHT-1);
+ clear_area(0, min(height,h), min(width,w)-1, MAXHEIGHT-1);
+ width = w;
+ height = h;
+ scroll_bot = height-1;
+ if (scroll_top >= height) scroll_top = 0;
+ cx = min(width-1, cursor_x);
+ cy = min(height-1, cursor_y);
+ move_cursor(cx, cy);
+}
+
+GTerm::GTerm(int w, int h) : width(w), height(h)
+{
+ int i;
+
+ doing_update = 0;
+
+ // could make this dynamic
+ text = new unsigned char[MAXWIDTH*MAXHEIGHT];
+ color = new unsigned short[MAXWIDTH*MAXHEIGHT];
+
+ for (i=0; i<MAXHEIGHT; i++) {
+ // make it draw whole terminal to start
+ dirty_startx[i] = 0;
+ dirty_endx[i] = MAXWIDTH-1;
+ }
+
+#ifdef GTERM_PC
+ pc_machinename = new char[7];
+ strcpy(pc_machinename, "pcterm");
+#endif
+ cursor_x = 0;
+ cursor_y = 0;
+ save_x = 0;
+ save_y = 0;
+ mode_flags = 0;
+ reset();
+}
+
+GTerm::~GTerm()
+{
+ delete text;
+ delete color;
+#ifdef GTERM_PC
+ if(pc_machinename)
+ delete pc_machinename;
+#endif // GTERM_PC
+}
+
+#ifdef GTERM_PC
+void
+GTerm::SetMachineName(char *machinename)
+{
+ if(pc_machinename)
+ delete pc_machinename;
+
+ pc_machinename = new char[strlen(machinename) + 1];
+ strcpy(pc_machinename, machinename);
+}
+#endif // GTERM_PC
+
+int
+GTerm::IsSelected(int x, int y)
+{
+ if(color && x >= 0 && x < Width() && y >= 0 && y < Height())
+ return color[(linenumbers[y] * MAXWIDTH) + x] & SELECTED;
+ return 0;
+}
+
+void
+GTerm::Select(int x, int y, int select)
+{
+ if(color && x >= 0 && x < Width() && y >= 0 && y < Height())
+ {
+ if(select)
+ color[(linenumbers[y] * MAXWIDTH) + x] |= SELECTED;
+ else
+ color[(linenumbers[y] * MAXWIDTH) + x] &= ~SELECTED;
+ changed_line(y, x, x);
+// update_changes();
+ }
+}
+
+unsigned char
+GTerm::GetChar(int x, int y)
+{
+ if(text && x >= 0 && x < Width() && y >= 0 && y < Height())
+ return text[(linenumbers[y] * MAXWIDTH) + x];
+
+ return 0;
+}
+
+
+
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Timothy Miller
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#ifndef INCLUDED_GTERM_H
+#define INCLUDED_GTERM_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define MAXWIDTH 200
+#define MAXHEIGHT 100
+
+
+#define GTERM_PC
+
+
+class GTerm;
+typedef void (GTerm::*StateFunc)();
+
+struct StateOption {
+ int byte; // char value to look for; -1==end/default
+ StateFunc action;
+ StateOption *next_state;
+};
+
+class GTerm {
+public:
+ // mode flags
+ enum
+ {
+ BOLD=0x1,
+ BLINK=0x2,
+ UNDERLINE=0x4,
+ INVERSE=0x8,
+ NOEOLWRAP=0x10,
+ CURSORAPPMODE=0x20,
+ CURSORRELATIVE=0x40,
+ NEWLINE=0x80,
+ INSERT=0x100,
+ KEYAPPMODE=0x200,
+ DEFERUPDATE=0x400,
+ DESTRUCTBS=0x800,
+ TEXTONLY=0x1000,
+ LOCALECHO=0x2000,
+ CURSORINVISIBLE=0x4000,
+#ifdef GTERM_PC
+// ,PC=0x10000
+ PC=0x8000,
+#endif // GTERM_PC
+ SELECTED=0x8000 // flag to indicate a char is selected
+ } MODES;
+
+private:
+ // terminal info
+ int width, height, scroll_top, scroll_bot;
+ unsigned char *text;
+ unsigned short *color;
+ short linenumbers[MAXHEIGHT]; // text at text[linenumbers[y]*MAXWIDTH]
+ unsigned char dirty_startx[MAXHEIGHT], dirty_endx[MAXHEIGHT];
+ int pending_scroll; // >0 means scroll up
+ int doing_update;
+
+ // terminal state
+ int cursor_x, cursor_y;
+ int save_x, save_y, save_attrib;
+ int fg_color, bg_color;
+ int mode_flags;
+ char tab_stops[MAXWIDTH];
+ StateOption *current_state;
+ static StateOption normal_state[], esc_state[], bracket_state[];
+ static StateOption cset_shiftin_state[], cset_shiftout_state[];
+ static StateOption hash_state[];
+ static StateOption vt52_normal_state[], vt52_esc_state[];
+ static StateOption vt52_cursory_state[], vt52_cursorx_state[];
+
+public:
+ // keycode translation
+ enum
+ {
+ KEY_NULL = 0,
+ KEY_BACK = 1000,
+ KEY_TAB,
+ KEY_RETURN,
+ KEY_ESCAPE,
+ KEY_SPACE,
+ KEY_LEFT,
+ KEY_UP,
+ KEY_RIGHT,
+ KEY_DOWN,
+ KEY_NUMPAD_LEFT,
+ KEY_NUMPAD_UP,
+ KEY_NUMPAD_RIGHT,
+ KEY_NUMPAD_DOWN,
+ KEY_DIVIDE,
+ KEY_NUMPAD_DIVIDE,
+ KEY_MULTIPLY,
+ KEY_NUMPAD_MULTIPLY,
+ KEY_SUBTRACT,
+ KEY_NUMPAD_SUBTRACT,
+ KEY_ADD,
+ KEY_NUMPAD_ADD,
+ KEY_HOME,
+ KEY_NUMPAD_HOME,
+ KEY_END,
+ KEY_NUMPAD_END,
+ KEY_PAGEUP,
+ KEY_NUMPAD_PAGEUP,
+ KEY_PAGEDOWN,
+ KEY_NUMPAD_PAGEDOWN,
+ KEY_INSERT,
+ KEY_NUMPAD_INSERT,
+ KEY_DELETE,
+ KEY_NUMPAD_DELETE,
+ KEY_ENTER,
+ KEY_NUMPAD_ENTER,
+ KEY_NEXT,
+ KEY_PRIOR,
+ KEY_NUMPAD0,
+ KEY_NUMPAD1,
+ KEY_NUMPAD2,
+ KEY_NUMPAD3,
+ KEY_NUMPAD4,
+ KEY_NUMPAD5,
+ KEY_NUMPAD6,
+ KEY_NUMPAD7,
+ KEY_NUMPAD8,
+ KEY_NUMPAD9,
+ KEY_NUMPAD_BEGIN,
+ KEY_NUMPAD_DECIMAL,
+ KEY_F1,
+ KEY_F2,
+ KEY_F3,
+ KEY_F4,
+ KEY_F5,
+ KEY_F6,
+ KEY_F7,
+ KEY_F8,
+ KEY_F9,
+ KEY_F10,
+ KEY_F11,
+ KEY_F12
+ } KEYCODE;
+
+private:
+ typedef struct
+ {
+ int
+ keyCode;
+
+ char
+ *seq;
+ } VTKeySeq;
+
+ static VTKeySeq cursor_keys[];
+ static VTKeySeq cursor_app_keys[];
+ static VTKeySeq keypad_keys[];
+ static VTKeySeq keypad_app_keys[];
+ static VTKeySeq other_keys[];
+
+#ifdef GTERM_PC
+ typedef struct
+ {
+ int
+ keyCode;
+
+ unsigned short
+ normSeq,
+ shiftSeq,
+ ctrlSeq,
+ altSeq;
+ } PCKeySeq;
+
+ static PCKeySeq pc_keys[];
+#endif // GTERM_PC
+
+ VTKeySeq *translate_vt_keycode(int keyCode, VTKeySeq *table);
+#ifdef GTERM_PC
+ unsigned short translate_pc_keycode(int KeyCode, int shift, int ctrl, int alt);
+#endif // GTERM_PC
+
+#ifdef GTERM_PC
+
+#define GTERM_PC_MAXARGS 10
+
+#define GTERM_PC_CMD_EXIT 0 // end console mode
+#define GTERM_PC_CMD_CURONOFF 1 // cursor on/off
+#define GTERM_PC_CMD_MOVECURSOR 2 // move cursor to x,y
+#define GTERM_PC_CMD_PUTTEXT 3 // put text
+#define GTERM_PC_CMD_WRITE 4 // write text
+#define GTERM_PC_CMD_MOVETEXT 5 // move text
+#define GTERM_PC_CMD_BEEP 6 // beep
+#define GTERM_PC_CMD_SELECTPRINTER 7 // select printer
+#define GTERM_PC_CMD_PRINTCHAR 8 // print a single character
+#define GTERM_PC_CMD_PRINTCHARS 9 // prints multiple characters
+
+#define GTERM_PC_MAXPRINTERNAME 100
+
+ int pc_cury;
+ int pc_curx;
+ int pc_state;
+ int pc_curcmd;
+ int pc_numargs;
+ int pc_argcount;
+ int pc_numdata;
+ int pc_datacount;
+ int pc_oldWidth;
+ int pc_oldHeight;
+ unsigned char pc_args[GTERM_PC_MAXARGS];
+ char *pc_machinename;
+ char pc_printername[GTERM_PC_MAXPRINTERNAME];
+
+//
+// Define state tables
+//
+ static StateOption pc_cmd_state[];
+ static StateOption pc_arg_state[];
+ static StateOption pc_data_state[];
+
+//
+// Define actions
+//
+ void pc_begin(void);
+ void pc_end(void);
+ void pc_cmd(void);
+ void pc_arg(void);
+ void pc_data(void);
+
+#endif // GTERM_PC
+
+ // utility functions
+ void update_changes();
+ void scroll_region(int start_y, int end_y, int num); // does clear
+ void shift_text(int y, int start_x, int end_x, int num); // ditto
+ void clear_area(int start_x, int start_y, int end_x, int end_y);
+ void changed_line(int y, int start_x, int end_x);
+ void move_cursor(int x, int y);
+ int calc_color(int fg, int bg, int flags);
+
+ // action parameters
+ int nparam, param[30];
+ unsigned char *input_data;
+ int data_len, q_mode, got_param, quote_mode;
+
+ // terminal actions
+ void normal_input();
+ void set_q_mode();
+ void set_quote_mode();
+ void clear_param();
+ void param_digit();
+ void next_param();
+
+ // non-printing characters
+ void cr(), lf(), ff(), bell(), tab(), bs();
+
+ // escape sequence actions
+ void keypad_numeric();
+ void keypad_application();
+ void save_cursor();
+ void restore_cursor();
+ void set_tab();
+ void index_down();
+ void index_up();
+ void next_line();
+ void reset();
+
+ void cursor_left();
+ void cursor_down();
+ void cursor_right();
+ void cursor_up();
+ void cursor_position();
+ void device_attrib();
+ void delete_char();
+ void set_mode();
+ void clear_mode();
+ void request_param();
+ void set_margins();
+ void delete_line();
+ void status_report();
+ void erase_display();
+ void erase_line();
+ void insert_line();
+ void set_colors();
+ void clear_tab();
+ void insert_char();
+ void screen_align();
+ void erase_char();
+
+ // vt52 stuff
+ void vt52_cursory();
+ void vt52_cursorx();
+ void vt52_ident();
+
+public:
+ GTerm(int w, int h);
+ virtual ~GTerm();
+
+ // function to control terminal
+ virtual void ProcessInput(int len, unsigned char *data);
+ virtual void ProcessOutput(int len, unsigned char *data) { SendBack(len, (char *)data); }
+ virtual void ResizeTerminal(int width, int height);
+ int Width() { return width; }
+ int Height() { return height; }
+ virtual void Update();
+ virtual void ExposeArea(int x, int y, int w, int h);
+ virtual void Reset();
+
+ int GetMode() { return mode_flags; }
+ void SetMode(int mode) { mode_flags = mode; }
+ void set_mode_flag(int flag);
+ void clear_mode_flag(int flag);
+
+ // manditory child-supplied functions
+ virtual void DrawText(int fg_color, int bg_color, int flags,
+ int x, int y, int len, unsigned char *string) = 0;
+ virtual void DrawCursor(int fg_color, int bg_color, int flags,
+ int x, int y, unsigned char c) = 0;
+
+ // optional child-supplied functions
+ virtual void MoveChars(int sx, int sy, int dx, int dy, int w, int h) { }
+ virtual void ClearChars(int bg_color, int x, int y, int w, int h) { }
+ virtual void SendBack(int len, char *data) { }
+ virtual void SendBack(char *data) { SendBack(strlen(data), data); }
+ virtual void ModeChange(int state) { }
+ virtual void Bell() { }
+ virtual void RequestSizeChange(int w, int h) { }
+
+ virtual int TranslateKeyCode(int keycode, int *len, char *data,
+ int shift = 0, int ctrl = 0, int alt = 0);
+
+#ifdef GTERM_PC
+ virtual void SelectPrinter(char *PrinterName) {}
+ virtual void PrintChars(int len, unsigned char *data) {}
+
+ void SetMachineName(char *machinename);
+ char *GetMachineName(void) { return pc_machinename; }
+#endif // GTERM_PC
+
+ virtual int IsSelected(int x, int y);
+ virtual void Select(int x, int y, int select);
+ virtual unsigned char GetChar(int x, int y);
+};
+
+#endif
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Derry Bryson
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+
+#include "gterm.hpp"
+#include <ctype.h>
+
+//
+// Keycode translation tables
+//
+GTerm::VTKeySeq GTerm::cursor_keys[] =
+{
+ { KEY_LEFT, "\033[D" },
+ { KEY_UP, "\033[A" },
+ { KEY_RIGHT, "\033[C" },
+ { KEY_DOWN, "\033[B" },
+ { KEY_NUMPAD_LEFT, "\033[D" },
+ { KEY_NUMPAD_UP, "\033[A" },
+ { KEY_NUMPAD_RIGHT, "\033[C" },
+ { KEY_NUMPAD_DOWN, "\033[B" },
+ { KEY_NULL, 0 }
+};
+
+GTerm::VTKeySeq GTerm::cursor_app_keys[] =
+{
+ { KEY_LEFT, "\033OD" },
+ { KEY_UP, "\033OA" },
+ { KEY_RIGHT, "\033OC" },
+ { KEY_DOWN, "\033OB" },
+ { KEY_NUMPAD_LEFT, "\033OD" },
+ { KEY_NUMPAD_UP, "\033OA" },
+ { KEY_NUMPAD_RIGHT, "\033OC" },
+ { KEY_NUMPAD_DOWN, "\033OB" },
+ { KEY_NULL, 0 }
+};
+
+GTerm::VTKeySeq GTerm::keypad_keys[] =
+{
+ { KEY_NUMPAD_DIVIDE, "/" },
+ { KEY_NUMPAD_MULTIPLY, "*" },
+ { KEY_NUMPAD_SUBTRACT, "-" },
+ { KEY_NUMPAD_HOME, "\033[\000" },
+ { KEY_NUMPAD7, "7" },
+ { KEY_NUMPAD8, "8" },
+ { KEY_NUMPAD_PAGEUP, "\033[5~" },
+ { KEY_NUMPAD9, "9" },
+ { KEY_NUMPAD_ADD, "+" },
+ { KEY_NUMPAD4, "4" },
+ { KEY_NUMPAD_BEGIN, "\033[s" },
+ { KEY_NUMPAD5, "5" },
+ { KEY_NUMPAD6, "6" },
+ { KEY_NUMPAD_END, "\033[e" },
+ { KEY_NUMPAD1, "1" },
+ { KEY_NUMPAD2, "2" },
+ { KEY_NUMPAD_PAGEDOWN, "\033[6~" },
+ { KEY_NUMPAD3, "3" },
+ { KEY_NUMPAD_INSERT, "\033[2~" },
+ { KEY_NUMPAD0, "0" },
+ { KEY_NUMPAD_DELETE, "\033[3~" },
+ { KEY_NUMPAD_DECIMAL, "." },
+ { KEY_NUMPAD_ENTER, "\r" },
+ { KEY_NULL, 0 }
+};
+
+GTerm::VTKeySeq GTerm::keypad_app_keys[] =
+{
+ { KEY_NUMPAD_DIVIDE, "\033Oo" },
+ { KEY_NUMPAD_MULTIPLY, "\033Oj" },
+ { KEY_NUMPAD_SUBTRACT, "\033Om" },
+ { KEY_NUMPAD_HOME, "\033[\000" },
+ { KEY_NUMPAD7, "\033Ow" },
+ { KEY_NUMPAD8, "\033Ox" },
+ { KEY_NUMPAD_PAGEUP, "\033[5~" },
+ { KEY_NUMPAD9, "\033Oy" },
+ { KEY_NUMPAD_ADD, "\033Ok" },
+ { KEY_NUMPAD4, "\033Ot" },
+ { KEY_NUMPAD_BEGIN, "\033[s" },
+ { KEY_NUMPAD5, "\033Ou" },
+ { KEY_NUMPAD6, "\033Ov" },
+ { KEY_NUMPAD_END, "\033[e" },
+ { KEY_NUMPAD1, "\033Oq" },
+ { KEY_NUMPAD2, "\033Or" },
+ { KEY_NUMPAD_PAGEDOWN, "\033[6~" },
+ { KEY_NUMPAD3, "\033Os" },
+ { KEY_NUMPAD_INSERT, "\033[2~" },
+ { KEY_NUMPAD0, "\033Op" },
+ { KEY_NUMPAD_DELETE, "\033[3~" },
+ { KEY_NUMPAD_DECIMAL, "\033On" },
+ { KEY_NUMPAD_ENTER, "\033OM" },
+ { KEY_NULL, 0 }
+};
+
+GTerm::VTKeySeq GTerm::other_keys[] =
+{
+ { KEY_HOME, "\033[\000" },
+ { KEY_PAGEUP, "\033[5~" },
+ { KEY_PRIOR, "\033[5~" },
+ { KEY_PAGEDOWN, "\033[6~"},
+ { KEY_NEXT, "\033[6~" },
+ { KEY_END, "\033[e" },
+ { KEY_INSERT, "\033[2~" },
+ { KEY_F1, "\033[11~" },
+ { KEY_F2, "\033[12~" },
+ { KEY_F3, "\033[13~" },
+ { KEY_F4, "\033[14~" },
+ { KEY_F5, "\033[15~" },
+ { KEY_F6, "\033[17~" },
+ { KEY_F7, "\033[18~" },
+ { KEY_F8, "\033[19~" },
+ { KEY_F9, "\033[20~" },
+ { KEY_F10, "\033[21~" },
+ { KEY_F11, "\033[23~" },
+ { KEY_F12, "\033[24~" },
+ { KEY_RETURN, "\r" },
+ { KEY_SPACE, " " },
+ { KEY_BACK, "\x8" },
+ { KEY_ESCAPE, "\x1b" },
+ { KEY_TAB, "\x9" },
+ { KEY_DELETE, "\x7f" },
+ { KEY_NULL, 0 }
+};
+
+#ifdef GTERM_PC
+GTerm::PCKeySeq GTerm::pc_keys[] =
+{
+ { '0', 0x0030, 0x0029, 0x0000, 0x8100 },
+ { '1', 0x0031, 0x0021, 0x0000, 0x7800 },
+ { '2', 0x0032, 0x0040, 0x0000, 0x7900 },
+ { '3', 0x0033, 0x0023, 0x0000, 0x7a00 },
+ { '4', 0x0034, 0x0024, 0x0000, 0x7b00 },
+ { '5', 0x0035, 0x0025, 0x0000, 0x7c00 },
+ { '6', 0x0036, 0x005e, 0x0000, 0x7d00 },
+ { '7', 0x0037, 0x0026, 0x0000, 0x7e00 },
+ { '8', 0x0038, 0x002a, 0x0000, 0x7f00 },
+ { '9', 0x0039, 0x0028, 0x0000, 0x8000 },
+
+ { ')', 0x0030, 0x0029, 0x0000, 0x8100 },
+ { '!', 0x0031, 0x0021, 0x0000, 0x7800 },
+ { '@', 0x0032, 0x0040, 0x0000, 0x7900 },
+ { '#', 0x0033, 0x0023, 0x0000, 0x7a00 },
+ { '$', 0x0034, 0x0024, 0x0000, 0x7b00 },
+ { '%', 0x0035, 0x0025, 0x0000, 0x7c00 },
+ { '^', 0x0036, 0x005e, 0x0000, 0x7d00 },
+ { '&', 0x0037, 0x0026, 0x0000, 0x7e00 },
+ { '*', 0x0038, 0x002a, 0x0000, 0x7f00 },
+ { '(', 0x0039, 0x0028, 0x0000, 0x8000 },
+
+ { 'a', 0x0061, 0x0041, 0x0001, 0x1e00 },
+ { 'b', 0x0062, 0x0042, 0x0002, 0x3000 },
+ { 'c', 0x0063, 0x0043, 0x0003, 0x2e00 },
+ { 'd', 0x0064, 0x0044, 0x0004, 0x2000 },
+ { 'e', 0x0065, 0x0045, 0x0005, 0x1200 },
+ { 'f', 0x0066, 0x0046, 0x0006, 0x2100 },
+ { 'g', 0x0067, 0x0047, 0x0007, 0x2200 },
+ { 'h', 0x0068, 0x0048, 0x0008, 0x2300 },
+ { 'i', 0x0069, 0x0049, 0x0009, 0x1700 },
+ { 'j', 0x006a, 0x004a, 0x000a, 0x2400 },
+ { 'k', 0x006b, 0x004b, 0x000b, 0x2500 },
+ { 'l', 0x006c, 0x004c, 0x000c, 0x2600 },
+ { 'm', 0x006d, 0x004d, 0x000d, 0x3200 },
+ { 'n', 0x006e, 0x004e, 0x000e, 0x3100 },
+ { 'o', 0x006f, 0x004f, 0x000f, 0x1800 },
+ { 'p', 0x0070, 0x0050, 0x0010, 0x1900 },
+ { 'q', 0x0071, 0x0051, 0xff91, 0x1000 },
+ { 'r', 0x0072, 0x0052, 0x0012, 0x1300 },
+ { 's', 0x0073, 0x0053, 0xff93, 0x1f00 },
+ { 't', 0x0074, 0x0054, 0x0014, 0x1400 },
+ { 'u', 0x0075, 0x0055, 0x0015, 0x1600 },
+ { 'v', 0x0076, 0x0056, 0x0016, 0x2f00 },
+ { 'w', 0x0077, 0x0057, 0x0017, 0x1100 },
+ { 'x', 0x0078, 0x0058, 0x0018, 0x2d00 },
+ { 'y', 0x0079, 0x0059, 0x0019, 0x1500 },
+ { 'z', 0x007a, 0x005a, 0x001a, 0x2c00 },
+
+ { '`', 0x0060, 0x007e, 0x0000, 0x0000 },
+ { '~', 0x0060, 0x007e, 0x0000, 0x0000 },
+ { '-', 0x002d, 0x005f, 0x0000, 0x0000 },
+ { '_', 0x002d, 0x005f, 0x0000, 0x0000 },
+ { '=', 0x003d, 0x002b, 0x0000, 0x0000 },
+ { '+', 0x003d, 0x002b, 0x0000, 0x0000 },
+ { ',', 0x002c, 0x003c, 0x0000, 0x0000 },
+ { '<', 0x002c, 0x003c, 0x0000, 0x0000 },
+ { '.', 0x002e, 0x003e, 0x0000, 0x0000 },
+ { '>', 0x002e, 0x003e, 0x0000, 0x0000 },
+ { ';', 0x003b, 0x003a, 0x0000, 0x0000 },
+ { ':', 0x003b, 0x003a, 0x0000, 0x0000 },
+ { '\'', 0x002c, 0x0022, 0x0000, 0x0000 },
+ { '"', 0x002c, 0x0022, 0x0000, 0x0000 },
+ { '[', 0x005b, 0x007b, 0x0000, 0x0000 },
+ { '{', 0x005b, 0x007b, 0x0000, 0x0000 },
+ { ']', 0x005d, 0x007d, 0x0000, 0x0000 },
+ { '}', 0x005d, 0x007d, 0x0000, 0x0000 },
+ { '\\', 0x005c, 0x007c, 0x0000, 0x0000 },
+ { '|', 0x005c, 0x007c, 0x0000, 0x0000 },
+ { '/', 0x002f, 0x003f, 0x0000, 0x0000 },
+ { '?', 0x002f, 0x003f, 0x0000, 0x0000 },
+
+ { KEY_BACK, 0x0008, 0x0008, 0x007f, 0x0000 },
+ { KEY_TAB, 0x0009, 0x0f00, 0x0000, 0x0000 },
+ { KEY_RETURN, 0x000d, 0x000d, 0x000a, 0x0000 },
+ { KEY_ESCAPE, 0x001b, 0x001b, 0x001b, 0x0000 },
+ { KEY_SPACE, 0x0020, 0x0020, 0x0000, 0x0000 },
+ { KEY_LEFT, 0x4b00, 0x0034, 0x7300, 0xb200 },
+ { KEY_UP, 0x4800, 0x0038, 0xa000, 0xaf00 },
+ { KEY_RIGHT, 0x4d00, 0x0036, 0x7400, 0xb400 },
+ { KEY_DOWN, 0x5000, 0x0032, 0xa400, 0xb700 },
+ { KEY_NUMPAD_LEFT, 0x4b00, 0x0034, 0x7300, 0xb200 },
+ { KEY_NUMPAD_UP, 0x4800, 0x0038, 0xa000, 0xaf00 },
+ { KEY_NUMPAD_RIGHT, 0x4d00, 0x0036, 0x7400, 0xb400 },
+ { KEY_NUMPAD_DOWN, 0x5000, 0x0032, 0xa400, 0xb700 },
+ { KEY_DIVIDE, 0x002f, 0x002f, 0x0000, 0x0000 },
+ { KEY_MULTIPLY, 0x0038, 0x0038, 0x0000, 0x7f00 },
+ { KEY_SUBTRACT, 0x002d, 0x002d, 0x0000, 0x0000 },
+ { KEY_ADD, 0x003d, 0x003d, 0x0000, 0x0000 },
+ { KEY_HOME, 0x4700, 0x0037, 0x7700, 0xae00 },
+ { KEY_END, 0x4f00, 0x0031, 0x7500, 0xb600 },
+ { KEY_PAGEUP, 0x4900, 0x0039, 0x8400, 0xb000 },
+ { KEY_PAGEDOWN, 0x5100, 0x0033, 0x7600, 0xb800 },
+ { KEY_INSERT, 0x5200, 0x0030, 0xa500, 0xb900 },
+ { KEY_DELETE, 0x5300, 0x002e, 0xa600, 0xba00 },
+ { KEY_ENTER, 0x000d, 0x000d, 0x000a, 0x0000 },
+ { KEY_NEXT, 0x5100, 0x0033, 0x7600, 0xb800 },
+ { KEY_PRIOR, 0x4900, 0x0039, 0x8400, 0xb000 },
+
+ { KEY_NUMPAD0, 0x0030, 0x0029, 0x0000, 0x8100 },
+ { KEY_NUMPAD1, 0x0031, 0x0021, 0x0000, 0x7800 },
+ { KEY_NUMPAD2, 0x0032, 0x0040, 0x0000, 0x7900 },
+ { KEY_NUMPAD3, 0x0033, 0x0023, 0x0000, 0x7a00 },
+ { KEY_NUMPAD4, 0x0034, 0x0024, 0x0000, 0x7b00 },
+ { KEY_NUMPAD5, 0x0035, 0x0025, 0x0000, 0x7c00 },
+ { KEY_NUMPAD6, 0x0036, 0x005e, 0x0000, 0x7d00 },
+ { KEY_NUMPAD7, 0x0037, 0x0026, 0x0000, 0x7e00 },
+ { KEY_NUMPAD8, 0x0038, 0x002a, 0x0000, 0x7f00 },
+ { KEY_NUMPAD9, 0x0039, 0x0028, 0x0000, 0x8000 },
+
+ { KEY_F1, 0x3b00, 0x5400, 0x5e00, 0x6800 },
+ { KEY_F2, 0x3c00, 0x5500, 0x5f00, 0x6900 },
+ { KEY_F3, 0x3d00, 0x5600, 0x6000, 0x6a00 },
+ { KEY_F4, 0x3e00, 0x5700, 0x6100, 0x6b00 },
+ { KEY_F5, 0x3f00, 0x5800, 0x6200, 0x6c00 },
+ { KEY_F6, 0x4000, 0x5900, 0x6300, 0x6d00 },
+ { KEY_F7, 0x4100, 0x5a00, 0x6400, 0x6e00 },
+ { KEY_F8, 0x4200, 0x5b00, 0x6500, 0x6f00 },
+ { KEY_F9, 0x4300, 0x5c00, 0x6600, 0x7000 },
+ { KEY_F10, 0x4400, 0x5d00, 0x6700, 0x7100 },
+ { KEY_F11, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { KEY_F12, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { KEY_NULL, 0, 0, 0, 0 }
+};
+#endif // GTERM_PC
+
+GTerm::VTKeySeq *
+GTerm::translate_vt_keycode(int keyCode, VTKeySeq *table)
+{
+ while(table->keyCode != KEY_NULL)
+ {
+ if(table->keyCode == keyCode)
+ return table;
+ table++;
+ }
+ return 0;
+}
+
+#ifdef GTERM_PC
+unsigned short
+GTerm::translate_pc_keycode(int keyCode, int shift, int ctrl, int alt)
+{
+ int
+ i;
+
+ if(keyCode < 1000)
+ {
+ if(isupper(keyCode))
+ {
+ if(!alt)
+ shift = 1;
+ keyCode = tolower(keyCode);
+ }
+
+ if(iscntrl(keyCode))
+ {
+ ctrl = 1;
+ keyCode = keyCode + 'a' - 1;
+ }
+ }
+
+//printf("looking for %d...", keyCode);
+ for(i = 0; pc_keys[i].keyCode; i++)
+ {
+ if(keyCode == pc_keys[i].keyCode)
+ {
+//printf("found!\n");
+ if(shift)
+ return pc_keys[i].shiftSeq;
+ if(ctrl)
+ return pc_keys[i].ctrlSeq;
+ if(alt)
+ return pc_keys[i].altSeq;
+ return pc_keys[i].normSeq;
+ }
+ }
+//printf("not found!\n");
+ return 0;
+}
+#endif // GTERM_PC
+
+int
+GTerm::TranslateKeyCode(int keyCode, int *len, char *data, int shift,
+ int ctrl, int alt)
+{
+ int
+ mode = GetMode();
+
+#ifdef GTERM_PC
+ unsigned short
+ pcKeySeq;
+#endif // GTERM_PC
+
+ VTKeySeq
+ *keySeq;
+
+//printf("keycode = %d, shift = %d, ctrl = %d, alt = %d\n", keyCode, shift, ctrl, alt);
+//printf("GTerm::TranslateKeyCode(): mode = %x\n", mode);
+#ifdef GTERM_PC
+ if(mode & PC)
+ {
+ pcKeySeq = translate_pc_keycode(keyCode, shift, ctrl, alt);
+ if(pcKeySeq)
+ {
+//printf("keySeq = %x\n", pcKeySeq);
+ *(unsigned char *)data++ = pcKeySeq >> 8;
+ *(unsigned char *)data = pcKeySeq & 0xff;
+ *len = 2;
+ return 1;
+ }
+ return 0;
+ }
+ else
+ {
+#endif // GTERM_PC
+//printf("mode = %x\n", mode);
+ if(mode & KEYAPPMODE)
+ {
+//printf("KEYAPPMODE\n");
+ keySeq = translate_vt_keycode(keyCode, keypad_app_keys);
+ }
+ else
+ keySeq = translate_vt_keycode(keyCode, keypad_keys);
+
+ if(!keySeq)
+ {
+ if(mode & CURSORAPPMODE)
+ {
+//printf("CURSORAPPMODE\n");
+ keySeq = translate_vt_keycode(keyCode, cursor_app_keys);
+//printf("keySeq = %08x\n", keySeq);
+ }
+ else
+ keySeq = translate_vt_keycode(keyCode, cursor_keys);
+ }
+
+ if(!keySeq)
+ keySeq = translate_vt_keycode(keyCode, other_keys);
+
+ if(keySeq)
+ {
+ *len = strlen(keySeq->seq);
+ strcpy(data, keySeq->seq);
+ return 1;
+ }
+ return 0;
+#ifdef GTERM_PC
+ }
+#endif // GTERM_PC
+}
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Timothy Miller
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+
+/* GRG: Added a lot of GTerm:: prefixes to correctly form pointers
+ * to functions in all the tables. Example: &cr -> >erm::cr
+ */
+
+#include "gterm.hpp"
+
+// state machine transition tables
+StateOption GTerm::normal_state[] = {
+ { 13, >erm::cr, normal_state },
+ { 10, >erm::lf, normal_state },
+ { 12, >erm::ff, normal_state },
+ { 9, >erm::tab, normal_state },
+ { 8, >erm::bs, normal_state },
+ { 7, >erm::bell, normal_state },
+ { 27, 0, esc_state },
+ { -1, >erm::normal_input, normal_state} };
+
+StateOption GTerm::esc_state[] = {
+ { '[', >erm::clear_param, bracket_state },
+ { '>', >erm::keypad_numeric, normal_state },
+ { '=', >erm::keypad_application, normal_state },
+ { '7', >erm::save_cursor, normal_state },
+ { '8', >erm::restore_cursor, normal_state },
+ { 'H', >erm::set_tab, normal_state },
+ { 'D', >erm::index_down, normal_state },
+ { 'M', >erm::index_up, normal_state },
+ { 'E', >erm::next_line, normal_state },
+ { 'c', >erm::reset, normal_state },
+ { '(', 0, cset_shiftin_state },
+ { ')', 0, cset_shiftout_state },
+ { '#', 0, hash_state },
+#ifdef GTERM_PC
+ { '!', >erm::pc_begin, pc_cmd_state },
+#endif
+
+ { 13, >erm::cr, esc_state }, // standard VT100 wants
+ { 10, >erm::lf, esc_state }, // cursor controls in
+ { 12, >erm::ff, esc_state }, // the middle of ESC
+ { 9, >erm::tab, esc_state }, // sequences
+ { 8, >erm::bs, esc_state },
+ { 7, >erm::bell, esc_state },
+ { -1, 0, normal_state} };
+
+// Should but cursor control characters in these groups as well.
+// Maybe later.
+
+StateOption GTerm::cset_shiftin_state[] = {
+ { 'A', 0, normal_state }, // should set UK characters
+ { '0', 0, normal_state }, // should set Business Gfx
+ { -1, 0, normal_state }, // default to ASCII
+ };
+
+StateOption GTerm::cset_shiftout_state[] = {
+ { 'A', 0, normal_state }, // should set UK characters
+ { '0', 0, normal_state }, // should set Business Gfx
+ { -1, 0, normal_state }, // default to ASCII
+ };
+
+StateOption GTerm::hash_state[] = {
+ { '8', >erm::screen_align, normal_state },
+ { -1, 0, normal_state} };
+
+StateOption GTerm::bracket_state[] = {
+ { '?', >erm::set_q_mode, bracket_state },
+ { '"', >erm::set_quote_mode, bracket_state },
+ { '0', >erm::param_digit, bracket_state },
+ { '1', >erm::param_digit, bracket_state },
+ { '2', >erm::param_digit, bracket_state },
+ { '3', >erm::param_digit, bracket_state },
+ { '4', >erm::param_digit, bracket_state },
+ { '5', >erm::param_digit, bracket_state },
+ { '6', >erm::param_digit, bracket_state },
+ { '7', >erm::param_digit, bracket_state },
+ { '8', >erm::param_digit, bracket_state },
+ { '9', >erm::param_digit, bracket_state },
+ { ';', >erm::next_param, bracket_state },
+ { 'D', >erm::cursor_left, normal_state },
+ { 'B', >erm::cursor_down, normal_state },
+ { 'C', >erm::cursor_right, normal_state },
+ { 'A', >erm::cursor_up, normal_state },
+ { 'H', >erm::cursor_position, normal_state },
+ { 'f', >erm::cursor_position, normal_state },
+ { 'c', >erm::device_attrib, normal_state },
+ { 'P', >erm::delete_char, normal_state },
+ { 'h', >erm::set_mode, normal_state },
+ { 'l', >erm::clear_mode, normal_state },
+ { 's', >erm::save_cursor, normal_state },
+ { 'u', >erm::restore_cursor, normal_state },
+ { 'x', >erm::request_param, normal_state },
+ { 'r', >erm::set_margins, normal_state },
+ { 'M', >erm::delete_line, normal_state },
+ { 'n', >erm::status_report, normal_state },
+ { 'J', >erm::erase_display, normal_state },
+ { 'K', >erm::erase_line, normal_state },
+ { 'L', >erm::insert_line, normal_state },
+ { 'm', >erm::set_colors, normal_state },
+ { 'g', >erm::clear_tab, normal_state },
+ { '@', >erm::insert_char, normal_state },
+ { 'X', >erm::erase_char, normal_state },
+ { 'p', 0, normal_state }, // something to do with levels
+
+ { 13, >erm::cr, bracket_state },// standard VT100 wants
+ { 10, >erm::lf, bracket_state },// cursor controls in
+ { 12, >erm::ff, bracket_state },// the middle of ESC
+ { 9, >erm::tab, bracket_state },// sequences
+ { 8, >erm::bs, bracket_state },
+ { 7, >erm::bell, bracket_state },
+ { -1, 0, normal_state} };
+
+#ifdef GTERM_PC
+
+StateOption GTerm::pc_cmd_state[] =
+{
+ { GTERM_PC_CMD_CURONOFF, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_MOVECURSOR, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_PUTTEXT, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_WRITE, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_MOVETEXT, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_EXIT, >erm::pc_end, normal_state },
+ { GTERM_PC_CMD_BEEP, >erm::pc_cmd, pc_cmd_state },
+ { GTERM_PC_CMD_SELECTPRINTER, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_PRINTCHAR, >erm::pc_cmd, pc_arg_state },
+ { GTERM_PC_CMD_PRINTCHARS, >erm::pc_cmd, pc_arg_state },
+ { -1, >erm::pc_cmd, pc_cmd_state }
+};
+
+StateOption GTerm::pc_arg_state[] =
+{
+ { -1, >erm::pc_arg, pc_arg_state }
+};
+
+StateOption GTerm::pc_data_state[] =
+{
+ { -1, >erm::pc_data, pc_data_state }
+};
+
+#endif // GTERM_PC
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Timothy Miller
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+
+#include "gterm.hpp"
+//#include <stdlib.h>
+
+int GTerm::calc_color(int fg, int bg, int flags)
+{
+ return (flags & 15) | (fg << 4) | (bg << 8);
+}
+
+void GTerm::update_changes()
+{
+ int yp, start_x, mx;
+ int blank, c, x, y;
+
+ // prevent recursion for scrolls which cause exposures
+ if (doing_update) return;
+ doing_update = 1;
+
+ // first perform scroll-copy
+ mx = scroll_bot-scroll_top+1;
+ if (!(mode_flags & TEXTONLY) && pending_scroll &&
+ pending_scroll<mx && -pending_scroll<mx) {
+ if (pending_scroll<0) {
+ MoveChars(0, scroll_top, 0, scroll_top-pending_scroll,
+ width, scroll_bot-scroll_top+pending_scroll+1);
+ } else {
+ MoveChars(0, scroll_top+pending_scroll, 0, scroll_top,
+ width, scroll_bot-scroll_top-pending_scroll+1);
+ }
+ }
+ pending_scroll = 0;
+
+ // then update characters
+ for (y=0; y<height; y++) {
+ if (dirty_startx[y]>=MAXWIDTH) continue;
+ yp = linenumbers[y]*MAXWIDTH;
+
+ blank = !(mode_flags & TEXTONLY);
+ start_x = dirty_startx[y];
+ c = color[yp+start_x];
+ for (x=start_x; x<=dirty_endx[y]; x++) {
+ if (text[yp+x]!=32 && text[yp+x]) blank = 0;
+ if (c != color[yp+x]) {
+ if (!blank) {
+ if(mode_flags & PC)
+ DrawText((c>>4)&0xf, (c>>8)&0xf, c/*&15*/, start_x,
+ y, x-start_x, text+yp+start_x);
+ else
+ DrawText((c>>4)&7, (c>>8)&7, c/*&15*/, start_x,
+ y, x-start_x, text+yp+start_x);
+ } else {
+ ClearChars((c>>8)&7, start_x, y, x-start_x, 1);
+ }
+ start_x = x;
+ c = color[yp+x];
+ blank = !(mode_flags & TEXTONLY);
+ if (text[yp+x]!=32 && text[yp+x]) blank = 0;
+ }
+ }
+ if (!blank) {
+ if(mode_flags & PC)
+ DrawText((c>>4)&0xf, (c>>8)&0xf, c/*&15*/, start_x,
+ y, x-start_x, text+yp+start_x);
+ else
+ DrawText((c>>4)&7, (c>>8)&7, c/*&15*/, start_x,
+ y, x-start_x, text+yp+start_x);
+ } else {
+ ClearChars((c>>8)&7, start_x, y, x-start_x, 1);
+ }
+
+ dirty_endx[y] = 0;
+ dirty_startx[y] = MAXWIDTH;
+ }
+
+ if (!(mode_flags & CURSORINVISIBLE)) {
+ x = cursor_x;
+ if (x>=width) x = width-1;
+ yp = linenumbers[cursor_y]*MAXWIDTH+x;
+ c = color[yp];
+ if(mode_flags & PC)
+ DrawCursor((c>>4)&0xf, (c>>8)&0xf, c&15, x, cursor_y, text[yp]);
+ else
+ DrawCursor((c>>4)&7, (c>>8)&7, c&15, x, cursor_y, text[yp]);
+ }
+
+ doing_update = 0;
+}
+
+void GTerm::scroll_region(int start_y, int end_y, int num)
+{
+ int y, takey, fast_scroll, mx, clr, x, yp, c;
+ short temp[MAXHEIGHT];
+ unsigned char temp_sx[MAXHEIGHT], temp_ex[MAXHEIGHT];
+
+ if (!num) return;
+ mx = end_y-start_y+1;
+ if (num > mx) num = mx;
+ if (-num > mx) num = -mx;
+
+ fast_scroll = (start_y == scroll_top && end_y == scroll_bot &&
+ !(mode_flags & TEXTONLY));
+
+ if (fast_scroll) pending_scroll += num;
+
+ memcpy(temp, linenumbers, sizeof(linenumbers));
+ if (fast_scroll) {
+ memcpy(temp_sx, dirty_startx, sizeof(dirty_startx));
+ memcpy(temp_ex, dirty_endx, sizeof(dirty_endx));
+ }
+
+ c = calc_color(fg_color, bg_color, mode_flags);
+
+ // move the lines by renumbering where they point to
+ if (num<mx && -num<mx) for (y=start_y; y<=end_y; y++) {
+ takey = y+num;
+ clr = (takey<start_y) || (takey>end_y);
+ if (takey<start_y) takey = end_y+1-(start_y-takey);
+ if (takey>end_y) takey = start_y-1+(takey-end_y);
+
+ linenumbers[y] = temp[takey];
+ if (!fast_scroll || clr) {
+ dirty_startx[y] = 0;
+ dirty_endx[y] = width-1;
+ } else {
+ dirty_startx[y] = temp_sx[takey];
+ dirty_endx[y] = temp_ex[takey];
+ }
+ if (clr) {
+ yp = linenumbers[y]*MAXWIDTH;
+ memset(text+yp, 32, width);
+ for (x=0; x<width; x++) {
+ color[yp++] = c;
+ }
+ }
+ }
+}
+
+void GTerm::shift_text(int y, int start_x, int end_x, int num)
+{
+ int x, yp, mx, c;
+
+ if (!num) return;
+
+ yp = linenumbers[y]*MAXWIDTH;
+
+ mx = end_x-start_x+1;
+ if (num>mx) num = mx;
+ if (-num>mx) num = -mx;
+
+ if (num<mx && -num<mx) {
+ if (num<0) {
+ memmove(text+yp+start_x, text+yp+start_x-num, mx+num);
+ memmove(color+yp+start_x, color+yp+start_x-num, (mx+num)<<1);
+ } else {
+ memmove(text+yp+start_x+num, text+yp+start_x, mx-num);
+ memmove(color+yp+start_x+num, color+yp+start_x, (mx-num)<<1);
+ }
+ }
+
+ if (num<0) {
+ x = yp+end_x+num+1;
+ } else {
+ x = yp+start_x;
+ }
+ num = abs(num);
+ memset(text+x, 32, num);
+ c = calc_color(fg_color, bg_color, mode_flags);
+ while (num--) color[x++] = c;
+
+ changed_line(y, start_x, end_x);
+}
+
+void GTerm::clear_area(int start_x, int start_y, int end_x, int end_y)
+{
+ int x, y, c, yp, w;
+
+ c = calc_color(fg_color, bg_color, mode_flags);
+
+ w = end_x - start_x + 1;
+ if (w<1) return;
+
+ for (y=start_y; y<=end_y; y++) {
+ yp = linenumbers[y]*MAXWIDTH;
+ memset(text+yp+start_x, 32, w);
+ for (x=start_x; x<=end_x; x++) {
+ color[yp+x] = c;
+ }
+ changed_line(y, start_x, end_x);
+ }
+}
+
+void GTerm::changed_line(int y, int start_x, int end_x)
+{
+ if (dirty_startx[y] > start_x) dirty_startx[y] = start_x;
+ if (dirty_endx[y] < end_x) dirty_endx[y] = end_x;
+}
+
+void GTerm::move_cursor(int x, int y)
+{
+ if (cursor_x>=width) cursor_x = width-1;
+ changed_line(cursor_y, cursor_x, cursor_x);
+ cursor_x = x;
+ cursor_y = y;
+}
+
+void GTerm::set_mode_flag(int flag)
+{
+ mode_flags |= flag;
+ ModeChange(mode_flags);
+}
+
+void GTerm::clear_mode_flag(int flag)
+{
+ mode_flags &= ~flag;
+ ModeChange(mode_flags);
+}
+
--- /dev/null
+/*
+TerminalWx - A wxWidgets terminal widget
+Copyright (C) 1999 Timothy Miller
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+/* GRG: Added a lot of GTerm:: prefixes to correctly form pointers
+ * to functions in all the tables. Example: &cr -> >erm::cr
+ */
+
+#include "gterm.hpp"
+
+// I'm certain that this set is incomplete, but I got these from reverse-
+// engineering a VT100 verification test program.
+
+
+// state machine transition tables
+StateOption GTerm::vt52_normal_state[] = {
+ { 13, >erm::cr, vt52_normal_state },
+ { 10, >erm::lf, vt52_normal_state },
+ { 12, >erm::ff, vt52_normal_state },
+ { 9, >erm::tab, vt52_normal_state },
+ { 8, >erm::bs, vt52_normal_state },
+ { 7, >erm::bell, vt52_normal_state },
+ { 27, >erm::clear_param, vt52_esc_state },
+ { -1, >erm::normal_input, vt52_normal_state } };
+
+StateOption GTerm::vt52_esc_state[] = {
+ { 'D', >erm::cursor_left, vt52_normal_state },
+ { 'B', >erm::cursor_down, vt52_normal_state },
+ { 'C', >erm::cursor_right, vt52_normal_state },
+ { 'A', >erm::cursor_up, vt52_normal_state },
+ { 'Y', 0, vt52_cursory_state },
+ { 'J', >erm::erase_display, vt52_normal_state },
+ { 'K', >erm::erase_line, vt52_normal_state },
+ { 'H', >erm::cursor_position, vt52_normal_state },
+ { 'I', >erm::index_up, vt52_normal_state },
+ { 'F', 0, vt52_normal_state }, // graphics mode
+ { 'G', 0, vt52_normal_state }, // ASCII mode
+ { 'Z', >erm::vt52_ident, vt52_normal_state }, // identify
+ { '<', 0, normal_state },
+ { -1, 0, vt52_normal_state }};
+
+StateOption GTerm::vt52_cursory_state[] = {
+ { -1, >erm::vt52_cursory, vt52_cursorx_state } };
+
+StateOption GTerm::vt52_cursorx_state[] = {
+ { -1, >erm::vt52_cursorx, vt52_normal_state } };
+
--- /dev/null
+/*
+ taTelnet - A cross-platform telnet program.
+ Copyright (c) 2000 Derry Bryson
+ 2004 Mark Erikson
+ 2012-2013 Jeremy Salwen
+
+License: wxWindows License Version 3.1 (See the file license3.txt)
+
+*/
+
+#ifdef __GNUG__
+ #pragma implementation "wxterm.h"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#include <wx/timer.h>
+#include <wx/event.h>
+#include <wx/bitmap.h>
+#include <wx/brush.h>
+#include <wx/cursor.h>
+#include <wx/dcclient.h>
+#include <wx/log.h>
+#include <wx/pen.h>
+#include <wx/settings.h>
+#include <wx/utils.h>
+
+#include <ctype.h>
+
+#include "../GTerm/gterm.hpp"
+#include "wxterm.h"
+
+
+
+#define CURSOR_BLINK_DEFAULT_TIMEOUT 300
+#define CURSOR_BLINK_MAX_TIMEOUT 2000
+
+/*
+** Keycode translation tables
+*/
+wxTerm::TermKeyMap wxTerm::keyMapTable[] =
+{
+ { WXK_BACK, GTerm::KEY_BACK },
+ { WXK_TAB, GTerm::KEY_TAB },
+ { WXK_RETURN, GTerm::KEY_RETURN },
+ { WXK_ESCAPE, GTerm::KEY_ESCAPE },
+ { WXK_SPACE, GTerm::KEY_SPACE },
+ { WXK_LEFT, GTerm::KEY_LEFT },
+ { WXK_UP, GTerm::KEY_UP },
+ { WXK_RIGHT, GTerm::KEY_RIGHT },
+ { WXK_DOWN, GTerm::KEY_DOWN },
+// { WXK_DIVIDE, GTerm::KEY_DIVIDE },
+// { WXK_MULTIPLY, GTerm::KEY_MULTIPLY },
+// { WXK_SUBTRACT, GTerm::KEY_SUBTRACT },
+// { WXK_ADD, GTerm::KEY_ADD },
+ { WXK_HOME, GTerm::KEY_HOME },
+ { WXK_END, GTerm::KEY_END },
+ { WXK_PAGEUP, GTerm::KEY_PAGEUP },
+ { WXK_PAGEDOWN, GTerm::KEY_PAGEDOWN },
+ { WXK_INSERT, GTerm::KEY_INSERT },
+ { WXK_DELETE, GTerm::KEY_DELETE },
+// { WXK_NEXT, GTerm::KEY_NEXT },
+// { WXK_PRIOR, GTerm::KEY_PRIOR },
+// { WXK_NUMPAD0, GTerm::KEY_NUMPAD0 },
+// { WXK_NUMPAD1, GTerm::KEY_NUMPAD1 },
+// { WXK_NUMPAD2, GTerm::KEY_NUMPAD2 },
+// { WXK_NUMPAD3, GTerm::KEY_NUMPAD3 },
+// { WXK_NUMPAD4, GTerm::KEY_NUMPAD4 },
+// { WXK_NUMPAD5, GTerm::KEY_NUMPAD5 },
+// { WXK_NUMPAD6, GTerm::KEY_NUMPAD6 },
+// { WXK_NUMPAD7, GTerm::KEY_NUMPAD7 },
+// { WXK_NUMPAD8, GTerm::KEY_NUMPAD8 },
+// { WXK_NUMPAD9, GTerm::KEY_NUMPAD9 },
+// { WXK_DECIMAL, GTerm::KEY_NUMPAD_DECIMAL },
+ { WXK_F1, GTerm::KEY_F1 },
+ { WXK_F2, GTerm::KEY_F2 },
+ { WXK_F3, GTerm::KEY_F3 },
+ { WXK_F4, GTerm::KEY_F4 },
+ { WXK_F5, GTerm::KEY_F5 },
+ { WXK_F6, GTerm::KEY_F6 },
+ { WXK_F7, GTerm::KEY_F7 },
+ { WXK_F8, GTerm::KEY_F8 },
+ { WXK_F9, GTerm::KEY_F9 },
+ { WXK_F10, GTerm::KEY_F10 },
+ { WXK_F11, GTerm::KEY_F11 },
+ { WXK_F12, GTerm::KEY_F12 },
+ { (wxKeyCode)0, GTerm::KEY_NULL }
+};
+
+static unsigned char
+ xCharMap[] =
+ {
+ 0, // 0
+ 1, // 1
+ 2, // 2
+ 3, // 3
+ 1, // 4
+ 5, // 5
+ 6, // 6
+ 7, // 7
+ 8, // 8
+ 9, // 9
+ 10, // 10
+ 11, // 11
+ 12, // 12
+ 13, // 13
+ 14, // 14
+ 15, // 15
+ 62, // 16
+ 60, // 17
+ 18, // 18
+ 19, // 19
+ 20, // 20
+ 21, // 21
+ 22, // 22
+ 23, // 23
+ 24, // 24
+ 25, // 25
+ 26, // 26
+ 27, // 27
+ 28, // 28
+ 29, // 29
+ 94, // 30
+ 31, // 31
+ 32, // 32
+ 33, // 33
+ 34, // 34
+ 35, // 35
+ 36, // 36
+ 37, // 37
+ 38, // 38
+ 39, // 39
+ 40, // 40
+ 41, // 41
+ 42, // 42
+ 43, // 43
+ 44, // 44
+ 45, // 45
+ 46, // 46
+ 47, // 47
+ 48, // 48
+ 49, // 49
+ 50, // 50
+ 51, // 51
+ 52, // 52
+ 53, // 53
+ 54, // 54
+ 55, // 55
+ 56, // 56
+ 57, // 57
+ 58, // 58
+ 59, // 59
+ 60, // 60
+ 61, // 61
+ 62, // 62
+ 63, // 63
+ 64, // 64
+ 65, // 65
+ 66, // 66
+ 67, // 67
+ 68, // 68
+ 69, // 69
+ 70, // 70
+ 71, // 71
+ 72, // 72
+ 73, // 73
+ 74, // 74
+ 75, // 75
+ 76, // 76
+ 77, // 77
+ 78, // 78
+ 79, // 79
+ 80, // 80
+ 81, // 81
+ 82, // 82
+ 83, // 83
+ 84, // 84
+ 85, // 85
+ 86, // 86
+ 87, // 87
+ 88, // 88
+ 89, // 89
+ 90, // 90
+ 91, // 91
+ 92, // 92
+ 93, // 93
+ 94, // 94
+ 95, // 95
+ 96, // 96
+ 97, // 97
+ 98, // 98
+ 99, // 99
+ 100, // 100
+ 101, // 101
+ 102, // 102
+ 103, // 103
+ 104, // 104
+ 105, // 105
+ 106, // 106
+ 107, // 107
+ 108, // 108
+ 109, // 109
+ 110, // 110
+ 111, // 111
+ 112, // 112
+ 113, // 113
+ 114, // 114
+ 115, // 115
+ 116, // 116
+ 117, // 117
+ 118, // 118
+ 119, // 119
+ 120, // 120
+ 121, // 121
+ 122, // 122
+ 123, // 123
+ 124, // 124
+ 125, // 125
+ 126, // 126
+ 127, // 127
+ 128, // 128
+ 129, // 129
+ 130, // 130
+ 131, // 131
+ 132, // 132
+ 133, // 133
+ 134, // 134
+ 135, // 135
+ 136, // 136
+ 137, // 137
+ 138, // 138
+ 139, // 139
+ 140, // 140
+ 141, // 141
+ 142, // 142
+ 143, // 143
+ 144, // 144
+ 145, // 145
+ 146, // 146
+ 147, // 147
+ 148, // 148
+ 149, // 149
+ 150, // 150
+ 151, // 151
+ 152, // 152
+ 153, // 153
+ 154, // 154
+ 155, // 155
+ 156, // 156
+ 157, // 157
+ 158, // 158
+ 159, // 159
+ 160, // 160
+ 161, // 161
+ 162, // 162
+ 163, // 163
+ 164, // 164
+ 165, // 165
+ 166, // 166
+ 167, // 167
+ 168, // 168
+ 169, // 169
+ 170, // 170
+ 171, // 171
+ 172, // 172
+ 173, // 173
+ 174, // 174
+ 175, // 175
+ 2, // 176
+ 2, // 177
+ 2, // 178
+ 25, // 179
+ 22, // 180
+ 22, // 181
+ 22, // 182
+ 12, // 183
+ 12, // 184
+ 22, // 185
+ 25, // 186
+ 12, // 187
+ 11, // 188
+ 11, // 189
+ 11, // 190
+ 12, // 191
+ 14, // 192
+ 23, // 193
+ 24, // 194
+ 21, // 195
+ 18, // 196
+ 15, // 197
+ 21, // 198
+ 21, // 199
+ 14, // 200
+ 13, // 201
+ 23, // 202
+ 24, // 203
+ 21, // 204
+ 18, // 205
+ 15, // 206
+ 23, // 207
+ 23, // 208
+ 24, // 209
+ 24, // 210
+ 14, // 211
+ 14, // 212
+ 13, // 213
+ 13, // 214
+ 15, // 215
+ 15, // 216
+ 11, // 217
+ 13, // 218
+ 0, // 219
+ 220, // 220
+ 221, // 221
+ 222, // 222
+ 223, // 223
+ 224, // 224
+ 225, // 225
+ 226, // 226
+ 227, // 227
+ 228, // 228
+ 229, // 229
+ 230, // 230
+ 231, // 231
+ 232, // 232
+ 233, // 233
+ 234, // 234
+ 235, // 235
+ 236, // 236
+ 237, // 237
+ 238, // 238
+ 239, // 239
+ 240, // 240
+ 241, // 241
+ 242, // 242
+ 243, // 243
+ 244, // 244
+ 245, // 245
+ 246, // 246
+ 247, // 247
+ 248, // 248
+ 249, // 249
+ 250, // 250
+ 251, // 251
+ 252, // 252
+ 253, // 253
+ 254, // 254
+ 255 // 255
+ };
+
+BEGIN_EVENT_TABLE(wxTerm, wxWindow)
+ EVT_PAINT (wxTerm::OnPaint)
+ EVT_CHAR (wxTerm::OnChar)
+ EVT_LEFT_DOWN (wxTerm::OnLeftDown)
+ EVT_LEFT_UP (wxTerm::OnLeftUp)
+ EVT_MOTION (wxTerm::OnMouseMove)
+ EVT_TIMER (-1, wxTerm::OnTimer)
+#if 0
+ EVT_KEY_DOWN(wxTerm::OnKeyDown)
+#endif
+
+ EVT_SIZE (wxTerm::OnSize)
+ EVT_SET_FOCUS (wxTerm::OnGainFocus)
+ EVT_KILL_FOCUS (wxTerm::OnLoseFocus)
+END_EVENT_TABLE()
+
+wxTerm::wxTerm(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos,
+ int width, int height,
+ const wxString& name) :
+ wxWindow(parent, id, pos, wxSize(-1, -1), wxWANTS_CHARS, name),
+ GTerm(width, height)
+{
+ int
+ i;
+
+ m_inUpdateSize = false;
+ m_init = 1;
+
+ m_curDC = 0;
+
+ m_charsInLine = width;
+ m_linesDisplayed = height;
+
+ m_selecting = FALSE;
+ m_selx1 = m_sely1 = m_selx2 = m_sely2 = 0;
+ m_marking = FALSE;
+ m_curX = -1;
+ m_curY = -1;
+ m_curBlinkRate = CURSOR_BLINK_DEFAULT_TIMEOUT;
+ m_timer.SetOwner(this);
+ if(m_curBlinkRate)
+ m_timer.Start(m_curBlinkRate);
+
+ m_boldStyle = COLOR;
+
+ GetDefVTColors(m_vt_colors);
+ GetDefPCColors(m_pc_colors);
+
+ m_colors = m_vt_colors;
+
+ SetBackgroundColour(m_colors[0]);
+
+ for(i = 0; i < 16; i++)
+ m_vt_colorPens[i] = wxPen(m_vt_colors[i], 1, wxSOLID);
+
+ for(i = 0; i < 16; i++)
+ m_pc_colorPens[i] = wxPen(m_pc_colors[i], 1, wxSOLID);
+
+ m_colorPens = m_vt_colorPens;
+
+ m_width = width;
+ m_height = height;
+
+ m_printerFN = 0;
+ m_printerName = 0;
+
+
+
+ m_normalFont = GetFont();
+ m_underlinedFont = GetFont();
+ m_underlinedFont.SetUnderlined(TRUE);
+ m_boldFont = GetFont();
+ m_boldFont.SetWeight(wxBOLD);
+ m_boldUnderlinedFont = m_boldFont;
+ m_boldUnderlinedFont.SetUnderlined(TRUE);
+
+ m_bitmap = 0;
+
+
+ //ResizeTerminal(width, height);
+
+
+ //SetVirtualSize(m_charWidth * 80, m_charHeight * 100);
+ //SetScrollRate(m_charWidth, m_charHeight);
+
+ m_init = 0;
+
+ SetCursor(wxCursor(wxCURSOR_IBEAM));
+
+ wxFont monospacedFont(10, wxMODERN, wxNORMAL, wxNORMAL, false, "Courier New");
+
+ SetFont(monospacedFont);
+
+ // 10pt Courier New is 8 pixels wide and 16 pixels high... set up
+ // a default client size to match
+ SetClientSize(m_charsInLine * 8, m_linesDisplayed * 16);
+ UpdateSize();
+}
+
+wxTerm::~wxTerm()
+{
+ if(m_bitmap)
+ {
+ m_memDC.SelectObject(wxNullBitmap);
+ delete m_bitmap;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public SetBoldStyle
+/// Sets the bold style for the terminal
+///
+/// @param boldStyle wxTerm::BOLDSTYLE & The style to be used
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::SetBoldStyle(wxTerm::BOLDSTYLE boldStyle)
+{
+// wxColour colors[16];
+
+ if(boldStyle == DEFAULT)
+ boldStyle = COLOR;
+
+ m_boldStyle = boldStyle;
+// GetDefVTColors(colors, m_boldStyle);
+// SetVTColors(colors);
+ Refresh();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public SetFont
+/// Sets the font for the terminal
+///
+/// @param font const wxFont & The font to be used
+///
+/// @return bool Unused (returns true)
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+bool
+wxTerm::SetFont(const wxFont& font)
+{
+ m_init = 1;
+
+ wxWindow::SetFont(font);
+ m_normalFont = font;
+ m_underlinedFont = font;
+ m_underlinedFont.SetUnderlined(TRUE);
+ m_boldFont = GetFont();
+ m_boldFont.SetWeight(wxBOLD);
+ m_boldUnderlinedFont = m_boldFont;
+ m_boldUnderlinedFont.SetUnderlined(TRUE);
+ m_init = 0;
+
+ ResizeTerminal(m_width, m_height);
+ Refresh();
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public GetDfVTColors
+/// Gets the colors for a VT100 terminal
+///
+/// @param colors wxColour [] The colors that need to be assigned to
+/// @param boldStyle wxTerm::BOLDSTYLE The bold style used in the terminal
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::GetDefVTColors(wxColour colors[16], wxTerm::BOLDSTYLE boldStyle)
+{
+ if(boldStyle == DEFAULT)
+ boldStyle = m_boldStyle;
+
+ if(boldStyle != COLOR)
+ {
+ colors[0] = wxColour(0, 0, 0); // black
+ colors[1] = wxColour(255, 0, 0); // red
+ colors[2] = wxColour(0, 255, 0); // green
+ colors[3] = wxColour(255, 0, 255); // yellow
+ colors[4] = wxColour(0, 0, 255); // blue
+ colors[5] = wxColour(255, 255, 0); // magenta
+ colors[6] = wxColour(0, 255, 255); // cyan
+ colors[7] = wxColour(255, 255, 255); // white
+ colors[8] = wxColour(0, 0, 0); // black
+ colors[9] = wxColour(255, 0, 0); // red
+ colors[10] = wxColour(0, 255, 0); // green
+ colors[11] = wxColour(255, 0, 255); // yellow
+ colors[12] = wxColour(0, 0, 255); // blue
+ colors[13] = wxColour(255, 255, 0); // magenta
+ colors[14] = wxColour(0, 255, 255); // cyan
+ colors[15] = wxColour(255, 255, 255); // white
+ }
+ else
+ {
+ colors[0] = wxColour(0, 0, 0); // black
+ colors[1] = wxColour(170, 0, 0); // red
+ colors[2] = wxColour(0, 170, 0); // green
+ colors[3] = wxColour(170, 0, 170); // yellow
+ colors[4] = wxColour(0, 0, 170); // blue
+ colors[5] = wxColour(170, 170, 0); // magenta
+ colors[6] = wxColour(0, 170, 170); // cyan
+ colors[7] = wxColour(192, 192, 192); // white
+// colors[7] = wxColour(170, 170, 170); // white
+#if 0
+ colors[8] = wxColour(85, 85, 85); // bold black
+ colors[9] = wxColour(255, 85, 85); // bold red
+ colors[10] = wxColour(85, 255, 85); // bold green
+ colors[11] = wxColour(255, 85, 255); // bold yellow
+ colors[12] = wxColour(85, 85, 255); // bold blue
+ colors[13] = wxColour(255, 255, 85); // bold magenta
+ colors[14] = wxColour(85, 255, 255); // bold cyan
+ colors[15] = wxColour(255, 255, 255); // bold white
+#else
+ colors[8] = wxColour(85, 85, 85); // bold black
+ colors[9] = wxColour(255, 0, 0); // bold red
+ colors[10] = wxColour(0, 255, 0); // bold green
+ colors[11] = wxColour(255, 0, 255); // bold yellow
+ colors[12] = wxColour(0, 0, 255); // bold blue
+ colors[13] = wxColour(255, 255, 0); // bold magenta
+ colors[14] = wxColour(0, 255, 255); // bold cyan
+ colors[15] = wxColour(255, 255, 255); // bold white
+#endif
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public GetVTColors
+/// Retrieves a copy of the VT100 colors
+///
+/// @param colors wxColour [] An array to be filled with the VT100 colors
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::GetVTColors(wxColour colors[16])
+{
+ int
+ i;
+
+ for(i = 0; i < 16; i++)
+ colors[i] = m_vt_colors[i];
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public SetVTColors
+/// Sets the VT100 colors
+///
+/// @param colors wxColour [] The new colors to be used
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::SetVTColors(wxColour colors[16])
+{
+ int
+ i;
+
+ m_init = 1;
+ for(i = 0; i < 16; i++)
+ m_vt_colors[i] = colors[i];
+
+ if(!(GetMode() & PC))
+ SetBackgroundColour(m_vt_colors[0]);
+
+ for(i = 0; i < 16; i++)
+ m_vt_colorPens[i] = wxPen(m_vt_colors[i], 1, wxSOLID);
+ m_init = 0;
+
+ Refresh();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public GetDefPCColors
+/// Gets the default PC colors
+///
+/// @param colors wxColour [] Filled with the colors to be used
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::GetDefPCColors(wxColour colors[16])
+{
+#if 0
+ /*
+ ** These colors need tweaking. I'm sure they are not correct.
+ */
+ colors[0] = wxColour(0, 0, 0); // black
+ colors[1] = wxColour(0, 0, 128); // blue
+ colors[2] = wxColour(0, 128, 0); // green
+ colors[3] = wxColour(0, 128, 128); // cyan
+ colors[4] = wxColour(128, 0, 0); // red
+ colors[5] = wxColour(128, 0, 128); // magenta
+ colors[6] = wxColour(128, 128, 0); // brown
+ colors[7] = wxColour(128, 128, 128); // white
+ colors[8] = wxColour(64, 64, 64); // gray
+ colors[9] = wxColour(0, 0, 255); // lt blue
+ colors[10] = wxColour(0, 255, 0); // lt green
+ colors[11] = wxColour(0, 255, 255); // lt cyan
+ colors[12] = wxColour(255, 0, 0); // lt red
+ colors[13] = wxColour(255, 0, 255); // lt magenta
+ colors[14] = wxColour(255, 255, 0); // yellow
+ colors[15] = wxColour(255, 255, 255); // white
+#else
+ /*
+ ** These are much better
+ */
+ colors[0] = wxColour(0, 0, 0); // black
+ colors[1] = wxColour(0, 0, 170); // blue
+ colors[2] = wxColour(0, 170, 0); // green
+ colors[3] = wxColour(0, 170, 170); // cyan
+ colors[4] = wxColour(170, 0, 0); // red
+ colors[5] = wxColour(170, 0, 170); // magenta
+ colors[6] = wxColour(170, 170, 0); // brown
+ colors[7] = wxColour(170, 170, 170); // white
+#if 0
+ colors[8] = wxColour(85, 85, 85); // gray
+ colors[9] = wxColour(85, 85, 255); // lt blue
+ colors[10] = wxColour(85, 255, 85); // lt green
+ colors[11] = wxColour(85, 255, 255); // lt cyan
+ colors[12] = wxColour(255, 85, 85); // lt red
+ colors[13] = wxColour(255, 85, 255); // lt magenta
+ colors[14] = wxColour(255, 255, 85); // yellow
+ colors[15] = wxColour(255, 255, 255); // white
+#else
+ colors[8] = wxColour(50, 50, 50); // gray
+ colors[9] = wxColour(0, 0, 255); // lt blue
+ colors[10] = wxColour(0, 255, 0); // lt green
+ colors[11] = wxColour(0, 255, 255); // lt cyan
+ colors[12] = wxColour(255, 0, 0); // lt red
+ colors[13] = wxColour(255, 0, 255); // lt magenta
+ colors[14] = wxColour(255, 255, 0); // yellow
+ colors[15] = wxColour(255, 255, 255); // white
+#endif
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public GetPCColors
+/// Retrieves the PC colors
+///
+/// @param colors wxColour [] Filled with the PC colors
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::GetPCColors(wxColour colors[16])
+{
+ int
+ i;
+
+ for(i = 0; i < 16; i++)
+ colors[i] = m_pc_colors[i];
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public SetPCColors
+/// Sets the PC colors
+///
+/// @param colors wxColour [] The new colors to be used
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::SetPCColors(wxColour colors[16])
+{
+ int
+ i;
+
+ m_init = 1;
+ for(i = 0; i < 16; i++)
+ m_pc_colors[i] = colors[i];
+
+ if(GetMode() & PC)
+ SetBackgroundColour(m_pc_colors[0]);
+
+ for(i = 0; i < 16; i++)
+ m_pc_colorPens[i] = wxPen(m_pc_colors[i], 1, wxSOLID);
+ m_init = 0;
+
+ Refresh();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public SetCursorBlinkRate
+/// Sets how often the cursor blinks
+///
+/// @param rate int How many milliseconds between blinks
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::SetCursorBlinkRate(int rate)
+{
+ if(rate < 0 || rate > CURSOR_BLINK_MAX_TIMEOUT)
+ return;
+
+ m_init = 1;
+ if(rate != m_curBlinkRate)
+ {
+ m_curBlinkRate = rate;
+ if(!m_curBlinkRate)
+ m_timer.Stop();
+ else
+ m_timer.Start(m_curBlinkRate);
+ }
+ m_init = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private OnChar
+/// Handles user keyboard input and begins processing the server's response
+///
+/// @param event wxKeyEvent & The generated key event
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::OnChar(wxKeyEvent& event)
+{
+ if(!(GetMode() & PC) && event.AltDown())
+ event.Skip();
+ else
+ {
+
+ int
+ rc,
+ keyCode = 0,
+ len;
+
+ unsigned char
+ buf[10];
+
+ /*
+ ** Map control characters
+ */
+ if(event.ControlDown())
+ {
+ if(event.GetKeyCode() >= 'a' && event.GetKeyCode() <= 'z')
+ keyCode = event.GetKeyCode() - 'a' + 1;
+ else if(event.GetKeyCode() >= '[' && event.GetKeyCode() <= '_')
+ keyCode = event.GetKeyCode() - '[' + 0x1b;
+ else if(event.GetKeyCode() == '6')
+ keyCode = 0x1e;
+ else if(event.GetKeyCode() == '-')
+ keyCode = 0x1f;
+ }
+
+ if(!keyCode && !(keyCode = MapKeyCode((int)event.GetKeyCode())))
+ {
+ /*
+ ** If the keycode wasn't mapped in the table and it is a special
+ ** key, then we just ignore it.
+ */
+ if(event.GetKeyCode() >= WXK_START)
+ {
+ event.Skip();
+ return;
+ }
+ /*
+ ** Otherwise, it must just be an ascii character
+ */
+ keyCode = (int)event.GetKeyCode();
+ }
+
+ if(GetMode() & PC)
+ rc = TranslateKeyCode(keyCode, &len, (char *)buf, event.ShiftDown(),
+ event.ControlDown(), event.AltDown());
+ else
+ rc = TranslateKeyCode(keyCode, &len, (char *)buf);
+
+ if(rc)
+ {
+ if((GetMode() & NEWLINE) && !(GetMode() & PC) && (buf[len - 1] == 10))
+ {
+ buf[len - 1] = 13;
+ buf[len] = 10;
+ len++;
+ }
+ ProcessOutput(len, buf);
+ if((GetMode() & LOCALECHO) && !(GetMode() & PC))
+ ProcessInput(len, buf);
+ }
+ else if(!(GetMode() & PC))
+ {
+ if((GetMode() & NEWLINE) && !(GetMode() & PC) && (keyCode == 10))
+ {
+ len = 2;
+ buf[0] = 13;
+ buf[1] = keyCode;
+ }
+ else
+ {
+ len = 1;
+ buf[0] = keyCode;
+ }
+ ProcessOutput(len, buf);
+ if((GetMode() & LOCALECHO) && !(GetMode() & PC))
+ ProcessInput(len, buf);
+ }
+ else
+ event.Skip();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private OnKeyDown
+/// Appears to be unused
+///
+/// @param event wxKeyEvent & The generated key event
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::OnKeyDown(wxKeyEvent& event)
+{
+ if(!(GetMode() & PC) && event.AltDown())
+ event.Skip();
+ else if(event.AltDown())
+ {
+// wxLogMessage("OnKeyDown() got KeyCode = %d", event.KeyCode());
+// if(event.KeyCode() != 309)
+// OnChar(event);
+ }
+ else
+ event.Skip();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private OnPaint
+/// Redraws the terminal widget
+///
+/// @param event wxPaintEvent & The generated paint event
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+ wxPaintDC
+ dc(this);
+
+ m_curDC = &dc;
+ ExposeArea(0, 0, m_width, m_height);
+ m_curDC = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private OnLeftDown
+/// Begins selection of terminal text
+///
+/// @param event wxMouseEvent & The generated mouse event
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::OnLeftDown(wxMouseEvent& event)
+{
+ SetFocus();
+
+ ClearSelection();
+ m_selx1 = m_selx2 = event.GetX() / m_charWidth;
+ m_sely1 = m_sely2 = event.GetY() / m_charHeight;
+ m_selecting = TRUE;
+ CaptureMouse();
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private OnLeftUp
+/// Ends text selection
+///
+/// @param event wxMouseEvent & The generated mouse event
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::OnLeftUp(wxMouseEvent& event)
+{
+
+ m_selecting = FALSE;
+ if(GetCapture() == this)
+ {
+ ReleaseMouse();
+ }
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private OnMouseMove
+/// Changes the selection if the mouse button is down
+///
+/// @param event wxMouseEvent & The generated mouse event
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::OnMouseMove(wxMouseEvent& event)
+{
+
+ if(m_selecting)
+ {
+ m_selx2 = event.GetX() / m_charWidth;
+ if(m_selx2 >= Width())
+ m_selx2 = Width() - 1;
+ m_sely2 = event.GetY() / m_charHeight;
+ if(m_sely2 >= Height())
+ m_sely2 = Height() - 1;
+
+ MarkSelection();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// public ClearSelection
+/// De-selects all selected text
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::ClearSelection()
+{
+ int
+ x,
+ y;
+
+ wxClientDC
+ *dc = 0;
+
+ m_selx1 = m_sely1 = m_selx2 = m_sely2 = 0;
+
+ if(!m_curDC)
+ {
+ dc = new wxClientDC(this);
+ m_curDC = dc;
+ }
+
+ for(y = 0; y < Height(); y++)
+ for(x = 0; x < Width(); x++)
+ Select(x, y, 0);
+
+ if(dc)
+ {
+ this->wxWindow::Update();
+
+ m_curDC = 0;
+ delete dc;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// private MarkSelection
+/// Does _something_ as far as selecting text, but not really sure... used for SelectAll, I think
+///
+/// @return void
+///
+/// @author Derry Bryson @date 04-22-2004
+//////////////////////////////////////////////////////////////////////////////
+void
+wxTerm::MarkSelection()
+{
+ int
+ x,
+ y;
+
+ wxClientDC
+ *dc = 0;
+
+ m_marking = TRUE;
+
+ if(!m_curDC)
+ {
+ dc = new wxClientDC(this);
+ m_curDC = dc;
+ }
+
+ for(y = 0; y < Height(); y++)
+ for(x = 0; x < Width(); x++)
+ Select(x, y, 0);
+
+ if(m_sely1 == m_sely2)
+ {
+ if(m_selx1 >= m_selx2)
+ for(x = m_selx1; x <= m_selx2; x++)
+ Select(x, m_sely1, 1);
+ else
+ for(x = m_selx2; x >= m_selx1; x--)
+ Select(x, m_sely1, 1);
+ }
+ else if(m_sely1 < m_sely2)
+ {
+ for(x = m_selx1; x < Width(); x++)
+ Select(x, m_sely1, 1);
+
+ for(y = m_sely1 + 1; y < m_sely2; y++)
+ for(x = 0; x < Width(); x++)
+ Select(x, y, 1);
+
+ for(x = 0; x <= m_selx2; x++)
+ Select(x, m_sely2, 1);
+ }
+ &nbs