1
0
Fork 0

Remove code ifdefed for OS/2

Cleanup before replacing SDL1.2 with SDL2.

OS/2 support was introduced in DOSBox in March 2006.  OS/2 reached EOL
in December 2006.

As of 2019, OS/2 is being continued by proprietary 32-bit only ArcaOS,
although there is no official SDL2 support, despite pledges from SDL2
maintainers.
This commit is contained in:
Patryk Obara 2019-11-06 10:19:07 +01:00 committed by Patryk Obara
parent ef2686ac02
commit 5f9ac5eeab
19 changed files with 29 additions and 529 deletions

View file

@ -7,4 +7,4 @@ libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioc
drives.cpp drives.h drive_virtual.cpp drive_local.cpp drive_cache.cpp drive_fat.cpp \
drive_iso.cpp dev_con.h dos_mscdex.cpp dos_keyboard_layout.cpp \
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp \
cdrom_ioctl_os2.cpp drive_overlay.cpp
drive_overlay.cpp

View file

@ -153,7 +153,7 @@ int CDROM_GetMountType(char* path, int forceCD) {
const char* cdName;
char buffer[512];
strcpy(buffer,path);
#if defined (WIN32) || defined(OS2)
#if defined (WIN32)
upcase(buffer);
#endif

View file

@ -415,7 +415,7 @@ private:
#endif /* WIN 32 */
#if defined (LINUX) || defined(OS2)
#if defined (LINUX)
class CDROM_Interface_Ioctl : public CDROM_Interface_SDL
{

View file

@ -1159,9 +1159,8 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname)
return true;
}
}
#if defined (WIN32) || defined(OS2)
//Nothing
#else
#if !defined (WIN32)
//Consider the possibility that the filename has a windows directory seperator (inside the CUE file)
//which is common for some commercial rereleases of DOS games using DOSBox
@ -1181,7 +1180,6 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname)
filename = tmpstr;
return true;
}
#endif
return false;
}

View file

@ -1,152 +0,0 @@
/*
* Copyright (C) 2002-2019 The DOSBox Team
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <string.h>
#include "dosbox.h"
#include "cdrom.h"
#if defined (OS2)
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#include "os2.h"
// Ripped from linux/cdrom.h
#define CD_FRAMESIZE_RAW 2352
#define CD_FRAMESIZE 2048
CDROM_Interface_Ioctl::CDROM_Interface_Ioctl(void) : CDROM_Interface_SDL(){
strcpy(device_name, "");
}
bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc){
HFILE cdrom_fd = 0;
ULONG ulAction = 0;
APIRET rc = DosOpen((unsigned char*)device_name, &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
if (rc != NO_ERROR) {
return false;
}
char data[50];
ULONG len = sizeof(data);
char sig[] = {'C', 'D', '0', '1'};
ULONG sigsize = 4;
rc = DosDevIOCtl(cdrom_fd, IOCTL_CDROMDISK, CDROMDISK_GETUPC, sig, sigsize, &sigsize,
data, len, &len);
if (rc != NO_ERROR) {
return false;
}
rc = DosClose(cdrom_fd);
return rc == NO_ERROR;
}
bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num){
HFILE cdrom_fd = 0;
ULONG ulAction = 0;
APIRET rc = DosOpen((unsigned char*)device_name, &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
if (rc != NO_ERROR) {
return false;
}
Bitu buflen = raw ? num * CD_FRAMESIZE_RAW : num * CD_FRAMESIZE;
Bit8u* buf = new Bit8u[buflen];
int ret = NO_ERROR;
if (raw) {
struct paramseek {
UCHAR sig[4];
UCHAR mode;
ULONG sec;
paramseek(ULONG sector)
{
sig[0] = 'C'; sig[1] = 'D'; sig[2] = '0'; sig[3] = '1';
sec = sector;
}
} param_seek(sector);
ULONG paramsize = sizeof (paramseek);
rc = DosDevIOCtl(cdrom_fd, IOCTL_CDROMDISK, CDROMDISK_SEEK, &param_seek, paramsize, &paramsize,
0, 0, 0);
if (rc != NO_ERROR) {
return false;
}
struct paramread {
UCHAR sig[4];
UCHAR mode;
USHORT number;
BYTE sec;
BYTE reserved;
BYTE interleave;
paramread(USHORT num)
{
sig[0] = 'C'; sig[1] = 'D'; sig[2] = '0'; sig[3] = '1';
mode = 0; number = num;
sec = interleave = 0;
}
} param_read(num);
paramsize = sizeof (paramread);
ULONG len = buflen;
rc = DosDevIOCtl(cdrom_fd, IOCTL_CDROMDISK, CDROMDISK_READLONG, &param_read, paramsize, &paramsize,
buf, len, &len);
if (rc != NO_ERROR) {
return false;
}
} else {
ULONG pos = 0;
rc = DosSetFilePtr(cdrom_fd, sector * CD_FRAMESIZE, FILE_BEGIN, &pos);
if (rc != NO_ERROR) {
return false;
}
ULONG read = 0;
rc = DosRead(cdrom_fd, buf, buflen, &read);
if (rc != NO_ERROR || read != buflen) {
return false;
}
}
rc = DosClose(cdrom_fd);
MEM_BlockWrite(buffer, buf, buflen);
delete[] buf;
return (ret == NO_ERROR);
}
bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD) {
bool success = CDROM_Interface_SDL::SetDevice(path, forceCD);
if (success) {
char temp[3] = {0, 0, 0};
if (path[1] == ':') {
temp[0] = path[0];
temp[1] = path[1];
temp[2] = 0;
}
strncpy(device_name, temp, 512);
} else {
strcpy(device_name, "");
success = false;
}
return success;
}
#endif

View file

@ -285,8 +285,8 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit)
break;
}
#endif
#if defined (LINUX) || defined(OS2)
// Always use IOCTL in Linux or OS/2
#if defined (LINUX)
// Always use IOCTL in Linux
cdrom[numDrives] = new CDROM_Interface_Ioctl();
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: IOCTL Interface.");
#else

View file

@ -40,11 +40,6 @@
#include "dma.h"
#if defined(OS2)
#define INCL DOSFILEMGR
#define INCL_DOSERRORS
#include "os2.h"
#endif
#if defined(WIN32)
#ifndef S_ISDIR
@ -302,35 +297,12 @@ public:
}
struct stat test;
//Win32 : strip tailing backslashes
//os2: some special drive check
//rest: substitute ~ for home
bool failed = false;
#if defined (WIN32) || defined(OS2)
#if defined (WIN32)
/* Removing trailing backslash if not root dir so stat will succeed */
if(temp_line.size() > 3 && temp_line[temp_line.size()-1]=='\\') temp_line.erase(temp_line.size()-1,1);
if (stat(temp_line.c_str(),&test)) {
#endif
#if defined(WIN32)
// Nothing to do here.
#elif defined (OS2)
if (temp_line.size() <= 2) // Seems to be a drive.
{
failed = true;
HFILE cdrom_fd = 0;
ULONG ulAction = 0;
APIRET rc = DosOpen((unsigned char*)temp_line.c_str(), &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
DosClose(cdrom_fd);
if (rc != NO_ERROR && rc != ERROR_NOT_READY)
{
failed = true;
} else {
failed = false;
}
}
}
if (failed) {
#else
if (stat(temp_line.c_str(),&test)) {
failed = true;
@ -345,22 +317,9 @@ public:
}
/* Not a switch so a normal directory/file */
if (!S_ISDIR(test.st_mode)) {
#ifdef OS2
HFILE cdrom_fd = 0;
ULONG ulAction = 0;
APIRET rc = DosOpen((unsigned char*)temp_line.c_str(), &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
DosClose(cdrom_fd);
if (rc != NO_ERROR && rc != ERROR_NOT_READY) {
WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str());
return;
}
#else
WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str());
return;
#endif
}
if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
Bit8u bit8size=(Bit8u) sizes[1];
@ -413,7 +372,7 @@ public:
}
} else {
/* Give a warning when mount c:\ or the / */
#if defined (WIN32) || defined(OS2)
#if defined (WIN32)
if( (temp_line == "c:\\") || (temp_line == "C:\\") ||
(temp_line == "c:/") || (temp_line == "C:/") )
WriteOut(MSG_Get("PROGRAM_MOUNT_WARNING_WIN"));
@ -484,7 +443,7 @@ public:
if(type == "floppy") incrementFDD();
return;
showusage:
#if defined (WIN32) || defined(OS2)
#if defined (WIN32)
WriteOut(MSG_Get("PROGRAM_MOUNT_USAGE"),"d:\\dosprogs","d:\\dosprogs");
#else
WriteOut(MSG_Get("PROGRAM_MOUNT_USAGE"),"~/dosprogs","~/dosprogs");

View file

@ -33,11 +33,6 @@
#include <windows.h>
#endif
#if defined (OS2)
#define INCL_DOSERRORS
#define INCL_DOSFILEMGR
#include <os2.h>
#endif
int fileInfoCounter = 0;
@ -159,25 +154,14 @@ void DOS_Drive_Cache::SetBaseDir(const char* baseDir) {
ReadDir(id,result);
};
// Get Volume Label
#if defined (WIN32) || defined (OS2)
#if defined (WIN32)
bool cdrom = false;
char labellocal[256]={ 0 };
char drive[4] = "C:\\";
drive[0] = basePath[0];
#if defined (WIN32)
if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) {
UINT test = GetDriveType(drive);
if(test == DRIVE_CDROM) cdrom = true;
#else // OS2
//TODO determine wether cdrom or not!
FSINFO fsinfo;
ULONG drivenumber = drive[0];
if (drivenumber > 26) { // drive letter was lowercase
drivenumber = drive[0] - 'a' + 1;
}
APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
if (rc == NO_ERROR) {
#endif
/* Set label and allow being updated */
SetLabel(labellocal,cdrom,true);
}
@ -209,12 +193,11 @@ char* DOS_Drive_Cache::GetExpandName(const char* path) {
if (*work) {
size_t len = strlen(work);
#if defined (WIN32)
//What about OS/2
#if defined (WIN32)
if((work[len-1] == CROSS_FILESPLIT ) && (len >= 2) && (work[len-2] != ':')) {
#else
if((len > 1) && (work[len-1] == CROSS_FILESPLIT )) {
#endif
#endif
work[len-1] = 0; // Remove trailing slashes except when in root
}
}
@ -263,8 +246,7 @@ void DOS_Drive_Cache::AddEntryDirOverlay(const char* path, bool checkExists) {
char* post = strrchr(dironly,CROSS_FILESPLIT);
if (post) {
#if defined (WIN32)
//OS2 ?
#if defined (WIN32)
if (post > dironly && *(post - 1) == ':' && (post - dironly) == 2)
post++; //move away from X: as need to end up with x:\ .
#else
@ -392,7 +374,7 @@ bool DOS_Drive_Cache::GetShortName(const char* fullname, char* shortname) {
// The orgname part of the list is not sorted (shortname is)! So we can only walk through it.
for(Bitu i = 0; i < filelist_size; i++) {
#if defined (WIN32) || defined (OS2) /* Win 32 & OS/2*/
#if defined (WIN32)
if (strcasecmp(pos,curDir->longNameList[i]->orgname) == 0) {
#else
if (strcmp(pos,curDir->longNameList[i]->orgname) == 0) {

View file

@ -37,10 +37,10 @@
bool logoverlay = false;
using namespace std;
#if defined (WIN32) || defined (OS2) /* Win 32 & OS/2*/
#define CROSS_DOSFILENAME(blah)
#if defined (WIN32)
#define CROSS_DOSFILENAME(blah)
#else
//Convert back to DOS PATH
//Convert back to DOS PATH
#define CROSS_DOSFILENAME(blah) strreplace(blah,'/','\\')
#endif
@ -345,7 +345,6 @@ void Overlay_Drive::convert_overlay_to_DOSname_in_base(char* dirname )
if (strlen(overlaydir) >= strlen(basedir) ) {
//Needs to be longer at least.
#if defined (WIN32)
//OS2 ?
if (strncasecmp(overlaydir,basedir,strlen(basedir)) == 0) {
#else
if (strncmp(overlaydir,basedir,strlen(basedir)) == 0) {

View file

@ -433,7 +433,7 @@ Bitu GetKeyCode(SDL_keysym keysym) {
/* try to retrieve key from symbolic key as scancode is zero */
if (keysym.sym<MAX_SDLKEYS) key=scancode_map[(Bitu)keysym.sym];
}
#if !defined (WIN32) && !defined (MACOSX) && !defined(OS2)
#if !defined (WIN32) && !defined (MACOSX)
/* Linux adds 8 to all scancodes */
else key-=8;
#endif
@ -2438,25 +2438,6 @@ void MAPPER_StartUp(Section * sec) {
/* Note: table has to be tested/updated for various OSs */
#if defined (MACOSX)
/* nothing */
#elif defined(OS2)
sdlkey_map[0x61]=SDLK_UP;
sdlkey_map[0x66]=SDLK_DOWN;
sdlkey_map[0x63]=SDLK_LEFT;
sdlkey_map[0x64]=SDLK_RIGHT;
sdlkey_map[0x60]=SDLK_HOME;
sdlkey_map[0x65]=SDLK_END;
sdlkey_map[0x62]=SDLK_PAGEUP;
sdlkey_map[0x67]=SDLK_PAGEDOWN;
sdlkey_map[0x68]=SDLK_INSERT;
sdlkey_map[0x69]=SDLK_DELETE;
sdlkey_map[0x5C]=SDLK_KP_DIVIDE;
sdlkey_map[0x5A]=SDLK_KP_ENTER;
sdlkey_map[0x5B]=SDLK_RCTRL;
sdlkey_map[0x5F]=SDLK_PAUSE;
// sdlkey_map[0x00]=SDLK_PRINT;
sdlkey_map[0x5E]=SDLK_RALT;
sdlkey_map[0x40]=SDLK_KP5;
sdlkey_map[0x41]=SDLK_KP6;
#elif !defined (WIN32) /* => Linux & BSDs */
bool evdev_input = false;
#ifdef SDL_VIDEO_DRIVER_X11

View file

@ -121,11 +121,6 @@ struct private_hwdata {
#define PRIO_TOTAL (PRIO_MAX-PRIO_MIN)
#endif
#ifdef OS2
#define INCL_DOS
#define INCL_WIN
#include <os2.h>
#endif
enum SCREEN_TYPES {
SCREEN_SURFACE,
@ -2038,14 +2033,6 @@ int main(int argc, char* argv[]) {
SetConsoleCtrlHandler((PHANDLER_ROUTINE) ConsoleEventHandler,TRUE);
#endif
#ifdef OS2
PPIB pib;
PTIB tib;
DosGetInfoBlocks(&tib, &pib);
if (pib->pib_ultype == 2) pib->pib_ultype = 3;
setbuf(stdout, NULL);
setbuf(stderr, NULL);
#endif
/* Display Welcometext in the console */
LOG_MSG("DOSBox version %s",VERSION);

View file

@ -478,232 +478,3 @@ void SERIAL_setRTS(COMPORT port, bool value) {
}
#endif
#ifdef OS2
// OS/2 related headers
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#define INCL_DOSPROCESS
#include <os2.h>
#include <malloc.h>
#include <string.h>
#include <stdio.h>
struct _COMPORT {
HFILE porthandle;
DCBINFO orig_dcb;
};
// TODO: THIS IS INCOMPLETE and UNTESTED.
bool SERIAL_open(const char* portname, COMPORT* port) {
// allocate COMPORT structure
COMPORT cp = (_COMPORT*)malloc(sizeof(_COMPORT));
if(cp == NULL) return false;
cp->porthandle=0;
USHORT errors = 0;
ULONG ulAction = 0;
ULONG ulParmLen = sizeof(DCBINFO);
APIRET rc = DosOpen((PSZ)portname, &cp->porthandle,
&ulAction, 0L, FILE_NORMAL, FILE_OPEN,
OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE | OPEN_FLAGS_SEQUENTIAL, 0L);
if (rc != NO_ERROR) {
goto cleanup_error;
}
rc = DosDevIOCtl(cp->porthandle, IOCTL_ASYNC, ASYNC_GETDCBINFO,
0, 0, 0, &cp->orig_dcb, ulParmLen, &ulParmLen);
if ( rc != NO_ERROR) {
goto cleanup_error;
}
// configure the port for polling
DCBINFO newdcb;
memcpy(&newdcb,&cp->orig_dcb,sizeof(DCBINFO));
newdcb.usWriteTimeout = 0;
newdcb.usReadTimeout = 0; //65535;
newdcb.fbCtlHndShake = cp->orig_dcb.fbFlowReplace = 0;
newdcb.fbTimeout = 6;
rc = DosDevIOCtl(cp->porthandle, IOCTL_ASYNC, ASYNC_SETDCBINFO,
&newdcb, ulParmLen, &ulParmLen, 0, 0, 0);
if ( rc != NO_ERROR) {
goto cleanup_error;
}
ulParmLen = sizeof(errors);
rc = DosDevIOCtl(cp->porthandle, IOCTL_ASYNC, ASYNC_GETCOMMERROR,
0, 0, 0, &errors, ulParmLen, &ulParmLen);
if ( rc != NO_ERROR) {
goto cleanup_error;
}
*port = cp;
return true;
cleanup_error:
// TODO error string - rc value
if (cp->porthandle != 0) DosClose(cp->porthandle);
free(cp);
return false;
}
void SERIAL_getErrorString(char* buffer, size_t length) {
sprintf(buffer, "TODO: error handling is not fun");
}
void SERIAL_close(COMPORT port) {
ULONG ulParmLen = sizeof(DCBINFO);
// restore original DCB, close handle, free the COMPORT struct
if (port->porthandle != 0) {
DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_SETDCBINFO,
&port->orig_dcb, ulParmLen, &ulParmLen, 0, 0, 0);
DosClose (port->porthandle);
}
free(port);
}
bool SERIAL_sendchar(COMPORT port, char data) {
ULONG bytesWritten = 0;
APIRET rc = DosWrite(port->porthandle, &data, 1, &bytesWritten);
if (rc == NO_ERROR && bytesWritten > 0) return true;
else return false;
}
void SERIAL_setBREAK(COMPORT port, bool value) {
USHORT error;
ULONG ulParmLen = sizeof(error);
DosDevIOCtl(port->porthandle, IOCTL_ASYNC,
value ? ASYNC_SETBREAKON : ASYNC_SETBREAKOFF,
0,0,0, &error, ulParmLen, &ulParmLen);
}
int SERIAL_getextchar(COMPORT port) {
ULONG dwRead = 0; // Number of chars read
char chRead;
int retval = 0;
// receive a byte; TODO communicate failure
if (DosRead(port->porthandle, &chRead, 1, &dwRead) == NO_ERROR) {
if (dwRead) {
// check for errors; will OS/2 clear the error on reading its data?
// if yes then this is in wrong order
USHORT errors = 0, event = 0;
ULONG ulParmLen = sizeof(errors);
DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_GETCOMMEVENT,
0, 0, 0, &event, ulParmLen, &ulParmLen);
if (event & (64 + 128) ) { // Break (Bit 6) or Frame or Parity (Bit 7) error
Bit8u errreg = 0;
if (event & 64) retval |= SERIAL_BREAK_ERR;
if (event & 128) {
DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_GETCOMMERROR,
0, 0, 0, &errors, ulParmLen, &ulParmLen);
if (errors & 8) retval |= SERIAL_FRAMING_ERR;
if (errors & 4) retval |= SERIAL_PARITY_ERR;
}
}
retval |= (chRead & 0xff);
retval |= 0x10000;
}
}
return retval;
}
int SERIAL_getmodemstatus(COMPORT port) {
UCHAR dptr = 0;
ULONG ulParmLen = sizeof(dptr);
DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_GETMODEMINPUT,
0, 0, 0, &dptr, ulParmLen, &ulParmLen);
// bits are the same as return value
return (int)dptr;
}
void SERIAL_setDTR(COMPORT port, bool value) {
UCHAR masks[2];
ULONG ulParmLen = sizeof(masks);
if(value) {
masks[0]=0x01;
masks[1]=0xFF;
} else {
masks[0]=0x00;
masks[1]=0xFE;
}
DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_SETMODEMCTRL,
0,0,0, &masks, ulParmLen, &ulParmLen);
}
void SERIAL_setRTS(COMPORT port, bool value) {
UCHAR masks[2];
ULONG ulParmLen = sizeof(masks);
if(value) {
masks[0]=0x02;
masks[1]=0xFF;
} else {
masks[0]=0x00;
masks[1]=0xFD;
}
DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_SETMODEMCTRL,
0,0,0, &masks, ulParmLen, &ulParmLen);
}
bool SERIAL_setCommParameters(COMPORT port,
int baudrate, char parity, int stopbits, int length) {
// baud
struct {
ULONG baud;
BYTE fraction;
} setbaud;
setbaud.baud = baudrate;
setbaud.fraction = 0;
ULONG ulParmLen = sizeof(setbaud);
APIRET rc = DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_EXTSETBAUDRATE,
&setbaud, ulParmLen, &ulParmLen, 0, 0, 0);
if (rc != NO_ERROR) {
return false;
}
struct {
UCHAR data;
UCHAR parity;
UCHAR stop;
} paramline;
// byte length
if(length > 8 || length < 5) {
// TODO SetLastError(ERROR_INVALID_PARAMETER);
return false;
}
paramline.data = length;
// parity
switch (parity) {
case 'n': paramline.parity = 0; break;
case 'o': paramline.parity = 1; break;
case 'e': paramline.parity = 2; break;
case 'm': paramline.parity = 3; break;
case 's': paramline.parity = 4; break;
default:
// TODO SetLastError(ERROR_INVALID_PARAMETER);
return false;
}
// stopbits
switch(stopbits) {
case SERIAL_1STOP: paramline.stop = 0; break;
case SERIAL_2STOP: paramline.stop = 2; break;
case SERIAL_15STOP: paramline.stop = 1; break;
default:
// TODO SetLastError(ERROR_INVALID_PARAMETER);
return false;
}
// set it
ulParmLen = sizeof(paramline);
rc = DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_SETLINECTRL,
&paramline, ulParmLen, &ulParmLen, 0, 0, 0);
if ( rc != NO_ERROR)
return false;
return true;
}
#endif

View file

@ -64,11 +64,7 @@ TCPClientSocket::TCPClientSocket(int platformsocket) {
((struct _TCPsocketX*)nativetcpstruct)->sflag=0;
((struct _TCPsocketX*)nativetcpstruct)->channel=(SOCKET) platformsocket;
sockaddr_in sa;
#ifdef OS2
int sz;
#else
socklen_t sz;
#endif
sz=sizeof(sa);
if(getpeername(platformsocket, (sockaddr *)(&sa), &sz)==0) {
((struct _TCPsocketX*)nativetcpstruct)->

View file

@ -40,7 +40,7 @@
#include <ws2tcpip.h> //for socklen_t
//typedef int socklen_t;
//Tests for BSD/OS2/LINUX
//Tests for BSD/LINUX
#elif defined HAVE_STDLIB_H && defined HAVE_SYS_TYPES_H && defined HAVE_SYS_SOCKET_H && defined HAVE_NETINET_IN_H
#define NATIVESOCKETS
#define SOCKET int

View file

@ -124,7 +124,7 @@ void Cross::CreateDir(std::string const& in) {
bool Cross::IsPathAbsolute(std::string const& in) {
// Absolute paths
#if defined (WIN32) || defined(OS2)
#if defined (WIN32)
// drive letter
if (in.size() > 2 && in[1] == ':' ) return true;
// UNC path
@ -247,7 +247,7 @@ void close_directory(dir_information* dirp) {
#endif
FILE *fopen_wrap(const char *path, const char *mode) {
#if defined(WIN32) || defined(OS2)
#if defined(WIN32)
;
#elif defined (MACOSX)
;

View file

@ -409,7 +409,7 @@ public:
/* Maximum of extra commands: 10 */
Bitu i = 1;
while (control->cmdline->FindString("-c",line,true) && (i <= 11)) {
#if defined (WIN32) || defined (OS2)
#if defined (WIN32)
//replace single with double quotes so that mount commands can contain spaces
for(Bitu temp = 0;temp < line.size();++temp) if(line[temp] == '\'') line[temp]='\"';
#endif //Linux users can simply use \" in their shell